diff --git a/readme.md b/readme.md index 121b3850a3e953de0151f4ce0b5c437a64fbe6f4..39e594d64d66b6c0db0d0163878cadf57dcd4eab 100644 --- a/readme.md +++ b/readme.md @@ -5,10 +5,36 @@ Contains a plyground to run NEMO5 (ver. ) with XIOS TRUNK (ver. 2311). ## Structure +* **nemo5_src** and **xios_2311_src** contain the sources for build the applications. +* The **inputs** are `reference rundirs` with the required namelists and all required files for each resolution. +* **scripts** contains utils to compile and execute, expected to be used as boilerplates. ## Usage +1. Compile XIOS +````bash +# At xios_3211_src dir: +./make_xios --arch mn5_gpp_intel --job 10 --build_dir xios_impi +./make_xios --arch mn5_gpp_intel_openmpi --job 10 --build_dir xios_ompi +```` +> If you need to recompile XIOS, use `--full`. -## Example +2. Compile NEMO5: + + 2.1. Change the ARCH file with the XIOS build dir (nemo5_src/arch/arch-mn5_gpp_intel*) + ````bash + %XIOS_INC -I/your/path/to/xios_2311_src/inc + %XIOS_LIB -L/your/path/to/xios_2311_src/lib -lxios -lstdc++ + ```` + 2.2. Submit the compilations, several options available + ````bash + # At nemo5_src dir: + + ```` +3. Execute the model: + + 3.1. Untar inputs + + 3.2. Check the boilerplate to execute the model. diff --git a/xios_2311_src/arch/arch-X64_IRENE.env b/xios_2311_src/arch/arch-X64_IRENE.env index f461b930c6814fa40c3b63c43812d3a10fc935ff..20d65b1647cc8e893c7637461c56975ea2bcf9ad 100644 --- a/xios_2311_src/arch/arch-X64_IRENE.env +++ b/xios_2311_src/arch/arch-X64_IRENE.env @@ -1,11 +1,9 @@ -module purge -module load flavor/buildcompiler/intel/20 -module load mpi/openmpi/4.0.2 - +module unload netcdf-c netcdf-fortran hdf5 flavor perl hdf5 boost blitz mpi gnu +#module purge module load flavor/hdf5/parallel module load netcdf-fortran/4.4.4 module load hdf5/1.8.20 module load gnu/7.3.0 - -module load totalview -module load perl/5.30.2 +module load boost +module load blitz +module load feature/bridge/heterogenous_mpmd diff --git a/xios_2311_src/arch/arch-X64_IRENE_GNU.env b/xios_2311_src/arch/arch-X64_IRENE_GNU.env deleted file mode 100644 index 816db1486b180bb23c71112e75e426d7b9f6806a..0000000000000000000000000000000000000000 --- a/xios_2311_src/arch/arch-X64_IRENE_GNU.env +++ /dev/null @@ -1,11 +0,0 @@ -module purge -module load flavor/buildcompiler/gcc/8 -module load mpi/openmpi/4.0.2 - -module load flavor/hdf5/parallel -module load netcdf-fortran/4.4.4 -module load hdf5/1.8.20 -module load gnu/8.3.0 - -module load totalview -module load perl/5.30.2 diff --git a/xios_2311_src/arch/arch-X64_IRENE_GNU.fcm b/xios_2311_src/arch/arch-X64_IRENE_GNU.fcm deleted file mode 100644 index baf5542204442c3db14c048a4c92bed135e37ab7..0000000000000000000000000000000000000000 --- a/xios_2311_src/arch/arch-X64_IRENE_GNU.fcm +++ /dev/null @@ -1,26 +0,0 @@ -################################################################################ -################### Projet XIOS ################### -################################################################################ - -%CCOMPILER mpicc -%FCOMPILER mpif90 -%LINKER mpif90 - -%BASE_CFLAGS -std=c++11 -w -fpermissive -D__XIOS_EXCEPTION -%PROD_CFLAGS -O3 -D BOOST_DISABLE_ASSERTS -#%DEV_CFLAGS -g -fbacktrace -%DEV_CFLAGS -g -%DEBUG_CFLAGS -DBZ_DEBUG -g -fbacktrace -fno-inline - -%BASE_FFLAGS -D__NONE__ --free-form -ffree-line-length-0 -%PROD_FFLAGS -O3 -#%DEV_FFLAGS -g -fbacktrace -%DEV_FFLAGS -g -%DEBUG_FFLAGS -g -fbacktrace - -%BASE_INC -D__NONE__ -%BASE_LD -lstdc++ - -%CPP cpp -%FPP cpp -P -%MAKE gmake diff --git a/xios_2311_src/arch/arch-X64_IRENE_GNU.path b/xios_2311_src/arch/arch-X64_IRENE_GNU.path deleted file mode 100644 index 4e9e3a2b99cccdbe51bd62d0e35b21965afd482d..0000000000000000000000000000000000000000 --- a/xios_2311_src/arch/arch-X64_IRENE_GNU.path +++ /dev/null @@ -1,28 +0,0 @@ -NETCDF_INCDIR="-I $NETCDFC_INCDIR -I $NETCDFFORTRAN_INCDIR" -NETCDF_LIBDIR="-L $NETCDFC_LIBDIR -L $NETCDFFORTRAN_LIBDIR" -NETCDF_LIB="-lnetcdf -lnetcdff" - -MPI_INCDIR="" -MPI_LIBDIR="" -MPI_LIB="" - -HDF5_INCDIR="-I$HDF5_INCDIR" -HDF5_LIBDIR="-L$HDF5_LIBDIR" -HDF5_LIB="-lhdf5_hl -lhdf5 -lz -lcurl" - -BOOST_INCDIR="-I $BOOST_INCDIR" -BOOST_LIBDIR="-L $BOOST_LIBDIR" -BOOST_LIB="" - -BLITZ_INCDIR="-I $BLITZ_INCDIR" -BLITZ_LIBDIR="-L $BLITZ_LIBDIR" -BLITZ_LIB="" - -OASIS_INCDIR="-I$PWD/../../oasis3-mct/BLD/build/lib/psmile.MPI1" -OASIS_LIBDIR="-L$PWD/../../oasis3-mct/BLD/lib" -OASIS_LIB="-lpsmile.MPI1 -lscrip -lmct -lmpeu" - - -#only for MEMTRACK debuging : developper only -ADDR2LINE_LIBDIR="-L${WORKDIR}/ADDR2LINE_LIB" -ADDR2LINE_LIB="-laddr2line" diff --git a/xios_2311_src/arch/arch-X64_JEANZAY.env b/xios_2311_src/arch/arch-X64_JEANZAY.env index 52cc2b31c2c0fbddf40f357468f9f2caa183b7bd..0dd276baf017aba487637331687eb54245019264 100644 --- a/xios_2311_src/arch/arch-X64_JEANZAY.env +++ b/xios_2311_src/arch/arch-X64_JEANZAY.env @@ -1,7 +1,8 @@ module purge -module load intel-all/2020.4 -module load hdf5/1.12.0-mpi -module load netcdf-c/4.7.4-mpi -module load netcdf-fortran/4.5.3-mpi -source $I_MPI_ROOT/intel64/bin/mpivars.sh release_mt +module load gcc/9.1.0 +module load intel-all +module load gcc/9.1.0 +module load hdf5/1.10.5-mpi +module load netcdf/4.7.2-mpi +module load netcdf-fortran/4.5.2-mpi diff --git a/xios_2311_src/arch/arch-X64_JEANZAY_OPENMPI.env b/xios_2311_src/arch/arch-X64_JEANZAY_OPENMPI.env deleted file mode 100644 index 85fa447dc4c01df146b5928a522a7dcf7e86015a..0000000000000000000000000000000000000000 --- a/xios_2311_src/arch/arch-X64_JEANZAY_OPENMPI.env +++ /dev/null @@ -1,7 +0,0 @@ -module purge -module load openmpi/4.1.1 -module load intel-all/2020.4 -module load hdf5/1.12.0-mpi -module load netcdf-c/4.7.4-mpi -module load netcdf-fortran/4.5.3-mpi - diff --git a/xios_2311_src/arch/arch-X64_JEANZAY_OPENMPI.fcm b/xios_2311_src/arch/arch-X64_JEANZAY_OPENMPI.fcm deleted file mode 100644 index 7fc70bbf4f3ac88f82bdd27777001b546b99def1..0000000000000000000000000000000000000000 --- a/xios_2311_src/arch/arch-X64_JEANZAY_OPENMPI.fcm +++ /dev/null @@ -1,25 +0,0 @@ -################################################################################ -#################### Projet XIOS ################### -################################################################################# - - -%CCOMPILER mpicc -%FCOMPILER mpif90 -%LINKER mpif90 -nofor-main - -%BASE_CFLAGS -diag-disable 1125 -diag-disable 279 -std=c++11 -%PROD_CFLAGS -O3 -D BOOST_DISABLE_ASSERTS -%DEV_CFLAGS -g -traceback -%DEBUG_CFLAGS -DBZ_DEBUG -g -traceback -fno-inline - -%BASE_FFLAGS -D__NONE__ -%PROD_FFLAGS -O3 -%DEV_FFLAGS -g -O2 -traceback -%DEBUG_FFLAGS -g -traceback - -%BASE_INC -D__NONE__ -%BASE_LD -lstdc++ - -%CPP mpiicc -EP -%FPP cpp -P -%MAKE gmake diff --git a/xios_2311_src/arch/arch-X64_JEANZAY_OPENMPI.path b/xios_2311_src/arch/arch-X64_JEANZAY_OPENMPI.path deleted file mode 100644 index 03839412b76f227643daaccc95d63aefc42929fd..0000000000000000000000000000000000000000 --- a/xios_2311_src/arch/arch-X64_JEANZAY_OPENMPI.path +++ /dev/null @@ -1,15 +0,0 @@ -NETCDF_INCDIR="" -NETCDF_LIBDIR="" -NETCDF_LIB="-lnetcdff -lnetcdf" - -MPI_INCDIR="" -MPI_LIBDIR="" -MPI_LIB="" - -HDF5_INCDIR="" -HDF5_LIBDIR="" -HDF5_LIB="" - -OASIS_INCDIR="-I$PWD/../../oasis3-mct/BLD/build/lib/psmile.MPI1" -OASIS_LIBDIR="-L$PWD/../../oasis3-mct/BLD/lib" -OASIS_LIB="-lpsmile.MPI1 -lscrip -lmct -lmpeu" diff --git a/xios_2311_src/arch/arch-X64_ZEUS.path b/xios_2311_src/arch/arch-X64_ZEUS.path index 592c0688f907763479d175b3a21d881789193b77..dab340217faa915b3178945b9802b22d567440bb 100644 --- a/xios_2311_src/arch/arch-X64_ZEUS.path +++ b/xios_2311_src/arch/arch-X64_ZEUS.path @@ -12,4 +12,3 @@ OASIS_INCDIR="" OASIS_LIBDIR="" OASIS_LIB="" - diff --git a/xios_2311_src/arch/arch-ifort_CICLAD.fcm b/xios_2311_src/arch/arch-ifort_CICLAD.fcm index cf2b8abaeb098244f11b2866672e7c4641500dcb..fa78556ea0757052f7c512dfb7da52dcd09550ea 100644 --- a/xios_2311_src/arch/arch-ifort_CICLAD.fcm +++ b/xios_2311_src/arch/arch-ifort_CICLAD.fcm @@ -1,13 +1,13 @@ -%CCOMPILER /usr/lib64/openmpi/1.4.5-ifort/bin/mpicc -%FCOMPILER /usr/lib64/openmpi/1.4.5-ifort/bin/mpif90 -%LINKER /usr/lib64/openmpi/1.4.5-ifort/bin/mpif90 -nofor-main +%CCOMPILER mpicc +%FCOMPILER mpif90 +%LINKER mpif90 -nofor-main -%BASE_CFLAGS +%BASE_CFLAGS -fPIC -std=c++11 %PROD_CFLAGS -O3 -D BOOST_DISABLE_ASSERTS -%DEV_CFLAGS -g -traceback -%DEBUG_CFLAGS -DBZ_DEBUG -g -traceback -fno-inline +%DEV_CFLAGS -g +%DEBUG_CFLAGS -DBZ_DEBUG -g -fno-inline -%BASE_FFLAGS -D__NONE__ +%BASE_FFLAGS -fPIC -D__NONE__ %PROD_FFLAGS -O3 %DEV_FFLAGS -g -O2 -traceback %DEBUG_FFLAGS -g -traceback @@ -15,6 +15,6 @@ %BASE_INC -D__NONE__ %BASE_LD -lstdc++ -%CPP /usr/lib64/openmpi/1.4.5-ifort/bin/mpicc -EP +%CPP mpicc -EP %FPP cpp -P %MAKE gmake diff --git a/xios_2311_src/arch/arch-ifort_CICLAD.path b/xios_2311_src/arch/arch-ifort_CICLAD.path index 1d370c15050f45ccbd9c55054ca9669ed547b48f..13f6989fe5af8f15f6f2198d7a2176f58a5b3e70 100644 --- a/xios_2311_src/arch/arch-ifort_CICLAD.path +++ b/xios_2311_src/arch/arch-ifort_CICLAD.path @@ -1,9 +1,10 @@ -NETCDF_INCDIR="-I /opt/netcdf42/ifort/include" -NETCDF_LIBDIR="-L/opt/netcdf42/ifort/lib" -NETCDF_LIB="-lnetcdf" +NETCDF_INCDIR="-I /opt/netcdf4/4.4.1.1-parallel/ifort/include" +NETCDF_LIBDIR="-L/opt/netcdf4/4.4.1.1-parallel/ifort/lib" +NETCDF_LIB="-lnetcdff -lnetcdf" MPI_INCDIR="" MPI_LIBDIR="" MPI_LIB="" HDF5_INCDIR="" HDF5_LIBDIR="" HDF5_LIB="" + diff --git a/xios_2311_src/arch/arch-ifort_LSCE.fcm b/xios_2311_src/arch/arch-ifort_LSCE.fcm index 8cfbe64c9efcb3ee48cc17cbeb4f2ff4c4014230..54160ef328ebed007dd6d329c52ab9680d4160f9 100644 --- a/xios_2311_src/arch/arch-ifort_LSCE.fcm +++ b/xios_2311_src/arch/arch-ifort_LSCE.fcm @@ -2,7 +2,7 @@ %FCOMPILER mpif90 %LINKER mpif90 -nofor-main -%BASE_CFLAGS +%BASE_CFLAGS -std=c++11 %PROD_CFLAGS -O3 -D BOOST_DISABLE_ASSERTS %DEV_CFLAGS -g %DEBUG_CFLAGS -DBZ_DEBUG -g -fno-inline diff --git a/xios_2311_src/arch/arch-mn5-gpp-intel-openmpi.env b/xios_2311_src/arch/arch-mn5-gpp-intel-openmpi.env deleted file mode 100644 index 94c09c99db55f4b7e49cd304f7c886e61b26fda8..0000000000000000000000000000000000000000 --- a/xios_2311_src/arch/arch-mn5-gpp-intel-openmpi.env +++ /dev/null @@ -1,4 +0,0 @@ -module --force purge -module load oneapi/2023.2 -module load hdf5/1.14.1-2 pnetcdf/1.12.3 #dependencies for netcdf -module load netcdf/2023-06-14 diff --git a/xios_2311_src/arch/arch-mn5-gpp-intel-openmpi.fcm b/xios_2311_src/arch/arch-mn5-gpp-intel-openmpi.fcm deleted file mode 100644 index 4eeaea50954f45e70f738d47c4ba25a2d838b289..0000000000000000000000000000000000000000 --- a/xios_2311_src/arch/arch-mn5-gpp-intel-openmpi.fcm +++ /dev/null @@ -1,25 +0,0 @@ -################################################################################ -################### Projet XIOS ################### -################################################################################ - -%CCOMPILER mpicc -%FCOMPILER mpifort -%LINKER mpifort - -%BASE_CFLAGS -fPIC -std=c++11 -%PROD_CFLAGS -O3 -DBOOST_DISABLE_ASSERTS -%DEV_CFLAGS -g -O2 -%DEBUG_CFLAGS -g - -%BASE_FFLAGS -D__NONE__ -%PROD_FFLAGS -O3 -%DEV_FFLAGS -g -O2 -%DEBUG_FFLAGS -g - -%BASE_INC -D__NONE__ -%BASE_LD -lstdc++ - -%CPP mpicc -EP -%FPP cpp -P -%MAKE gmake - diff --git a/xios_2311_src/arch/arch-mn5-gpp-intel-openmpi.path b/xios_2311_src/arch/arch-mn5-gpp-intel-openmpi.path deleted file mode 100644 index 586ab58641b0860a27a052291815887c68175054..0000000000000000000000000000000000000000 --- a/xios_2311_src/arch/arch-mn5-gpp-intel-openmpi.path +++ /dev/null @@ -1,8 +0,0 @@ - -NETCDF_INCDIR="-I/apps/GPP/NETCDF/c-4.9.2_fortran-4.6.1_cxx4-4.3.1_hdf5-1.14.1-2_pnetcdf-1.12.3/INTEL/IMPI/include" -NETCDF_LIBDIR="-L/apps/GPP/NETCDF/c-4.9.2_fortran-4.6.1_cxx4-4.3.1_hdf5-1.14.1-2_pnetcdf-1.12.3/INTEL/IMPI/lib" -NETCDF_LIB="-lnetcdf -lnetcdff" -HDF5_INCDIR="-I/apps/GPP/HDF5/1.14.1-2/INTEL/IMPI/include" -HDF5_LIBDIR="-L/apps/GPP/HDF5/1.14.1-2/INTEL/IMPI/lib" -HDF5_LIB="-lhdf5_hl -lhdf5 -lhdf5 -lz" - diff --git a/xios_2311_src/bld.cfg b/xios_2311_src/bld.cfg index a361cda92a80106f0c94a33426f9e0166121f750..e575240500ac01eb3c1502cdd8356bd0d4eed2bb 100644 --- a/xios_2311_src/bld.cfg +++ b/xios_2311_src/bld.cfg @@ -21,27 +21,22 @@ bld::infile_ext::hpp CPP::INCLUDE # IMPORTANT: as the build directory may not necessarily coincide with the source directory, # each source subfolder should be declared individually search_src false -src::xios $PWD/src -src::xios::config $PWD/src/config -src::xios::date $PWD/src/date -src::xios::filter $PWD/src/filter -src::xios::functor $PWD/src/functor -src::xios::interface::c $PWD/src/interface/c -src::xios::interface::c_attr $PWD/src/interface/c_attr -src::xios::interface::fortran $PWD/src/interface/fortran -src::xios::interface::fortran_attr $PWD/src/interface/fortran_attr -src::xios::io $PWD/src/io -src::xios::node $PWD/src/node -src::xios::parse_expr $PWD/src/parse_expr -src::xios::test $PWD/src/test -src::xios::transformation $PWD/src/transformation -src::xios::transformation::Functions $PWD/src/transformation/Functions -src::xios::transformation::axis_algorithm $PWD/src/transformation/axis_algorithm -src::xios::transformation::domain_algorithm $PWD/src/transformation/domain_algorithm -src::xios::transformation::scalar_algorithm $PWD/src/transformation/scalar_algorithm -src::xios::type $PWD/src/type -src::xios::manager $PWD/src/manager -src::xios::distribution $PWD/src/distribution +src::xios $PWD/src +src::xios::config $PWD/src/config +src::xios::date $PWD/src/date +src::xios::filter $PWD/src/filter +src::xios::functor $PWD/src/functor +src::xios::interface::c $PWD/src/interface/c +src::xios::interface::c_attr $PWD/src/interface/c_attr +src::xios::interface::fortran $PWD/src/interface/fortran +src::xios::interface::fortran_attr $PWD/src/interface/fortran_attr +src::xios::io $PWD/src/io +src::xios::node $PWD/src/node +src::xios::parse_expr $PWD/src/parse_expr +src::xios::test $PWD/src/test +src::xios::transformation $PWD/src/transformation +src::xios::transformation::Functions $PWD/src/transformation/Functions +src::xios::type $PWD/src/type src::netcdf $PWD/extern/netcdf4 src::remap $PWD/extern/remap/src @@ -55,6 +50,7 @@ bld::target generic_testcase.exe #bld::target test_xios2_cmip6.exe #bld::target test_new_features.exe test_unstruct_complete.exe #bld::target test_remap.exe +#bld::target test_interpolate.exe #bld::target test_complete.exe #bld::target test_client.exe #bld::target test_unstruct_complete.exe diff --git a/xios_2311_src/bld_dir.cfg b/xios_2311_src/bld_dir.cfg index d491b4634d3fe2e9ff7803eaba4de14fda2d6582..f0362e81103ac9840af01e59b3917bd5bded4352 100644 --- a/xios_2311_src/bld_dir.cfg +++ b/xios_2311_src/bld_dir.cfg @@ -1,3 +1,4 @@ -inc /gpfs/scratch/bsc32/bsc032756/APPS/NEMO5_2024/xios_2311_src/.//arch.fcm -inc /gpfs/scratch/bsc32/bsc032756/APPS/NEMO5_2024/xios_2311_src/.//config.fcm -dir::root /gpfs/scratch/bsc32/bsc032756/APPS/NEMO5_2024/xios_2311_src/./ +inc /gpfs/scratch/bsc32/bsc032756/APPS/NEMO5_2024/xios_2311_src/new_mn5_gpp_intel/arch.fcm +inc /gpfs/scratch/bsc32/bsc032756/APPS/NEMO5_2024/xios_2311_src/new_mn5_gpp_intel/config.fcm +dir::root /gpfs/scratch/bsc32/bsc032756/APPS/NEMO5_2024/xios_2311_src/new_mn5_gpp_intel +src::blitz /gpfs/scratch/bsc32/bsc032756/APPS/NEMO5_2024/xios_2311_src/extern/blitz/src diff --git a/xios_2311_src/doc/XIOS_reference_guide.lyx b/xios_2311_src/doc/XIOS_reference_guide.lyx index 45a5a2f3b2cf85ca5692ba5d96ca2a433d4e6749..cef5e0bb89c7d54cbc5d72e064f0b163f9757c16 100644 --- a/xios_2311_src/doc/XIOS_reference_guide.lyx +++ b/xios_2311_src/doc/XIOS_reference_guide.lyx @@ -1,10613 +1,11981 @@ -#LyX 2.1 created this file. For more info see http://www.lyx.org/ -\lyxformat 474 -\begin_document -\begin_header -\textclass book -\use_default_options true -\begin_modules -logicalmkup -\end_modules -\maintain_unincluded_children false -\language english -\language_package auto -\inputencoding auto -\fontencoding global -\font_roman default -\font_sans default -\font_typewriter default -\font_math auto -\font_default_family default -\use_non_tex_fonts false -\font_sc false -\font_osf false -\font_sf_scale 100 -\font_tt_scale 100 -\graphics default -\default_output_format default -\output_sync 0 -\bibtex_command default -\index_command default -\paperfontsize default -\spacing single -\use_hyperref false -\papersize a4paper -\use_geometry false -\use_package amsmath 1 -\use_package amssymb 1 -\use_package cancel 1 -\use_package esint 1 -\use_package mathdots 1 -\use_package mathtools 1 -\use_package mhchem 1 -\use_package stackrel 1 -\use_package stmaryrd 1 -\use_package undertilde 1 -\cite_engine basic -\cite_engine_type default -\biblio_style plain -\use_bibtopic false -\use_indices false -\paperorientation portrait -\suppress_date false -\justification true -\use_refstyle 0 -\index Index -\shortcut idx -\color #008000 -\end_index -\secnumdepth 3 -\tocdepth 3 -\paragraph_separation indent -\paragraph_indentation default -\quotes_language english -\papercolumns 1 -\papersides 1 -\paperpagestyle default -\tracking_changes false -\output_changes false -\html_math_output 0 -\html_css_as_file 0 -\html_be_strict false -\end_header - -\begin_body - -\begin_layout Title -XIOS Fortran Reference Guide -\end_layout - -\begin_layout Author -Yann Meurdesoif -\end_layout - -\begin_layout Chapter -Attribute reference -\end_layout - -\begin_layout Section -Context attribute reference -\end_layout - -\begin_layout Section -Calendar attribute reference -\end_layout - -\begin_layout Subsection* -type: -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -enumeration {Gregorian, Julian, D360, AllLeap, NoLeap, user_defined} -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: type -\end_layout - -\begin_layout Standard -Define the calendar used for the current context. - This attribute is mandatory and cannot be modified once it has been set. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -When using the Fortran interface, this attribute must be defined using the - following subroutine: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_define_calendar(type, timestep, start_date, time_origin, -\begin_inset Newline newline -\end_inset - - day_length, month_lengths, year_length, -\begin_inset Newline newline -\end_inset - - leap_year_month, leap_year_drift, -\begin_inset Newline newline -\end_inset - - leap_year_drift_offset) -\end_layout - -\begin_layout Subsection* -start_date: -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -date -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -TYPE(xios_date) :: start_date -\end_layout - -\begin_layout Standard -Define the start date of the simulation for the current context. - This attribute is optional, the default value is -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout - -\series bold -0000-01-01 00:00:00 -\end_layout - -\end_inset - -. - The -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -type -\end_layout - -\end_inset - - attribute must always be set at the same time or before this attribute - is defined. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -A partial date is allowed in the configuration file as long as the omitted - parts are at the end, in which case they are initialized as in the default - value. - Optionally an offset can be added to the date using the notation " -\emph on -+ duration -\emph default -". - -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -When using the Fortran interface, this attribute can be defined at the same - time as the calendar -\series bold -type -\series default -: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_define_calendar(type, timestep, start_date, time_origin, -\begin_inset Newline newline -\end_inset - - day_length, month_lengths, year_length, -\begin_inset Newline newline -\end_inset - - leap_year_month, leap_year_drift, -\begin_inset Newline newline -\end_inset - - leap_year_drift_offset) -\end_layout - -\begin_layout Standard -or later using the following subroutine: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_set_start_date(start_date) -\end_layout - -\begin_layout Subsection* -time_origin: -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -date -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -TYPE(xios_date) :: time_origin -\end_layout - -\begin_layout Standard -Define the time origin of a time axis. - It will appear as metadata attached to the time axis in an output file. - This attribute is optional, the default value is -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout - -\series bold -0000-01-01 00:00:00 -\end_layout - -\end_inset - -. - The -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -type -\end_layout - -\end_inset - - attribute must always be set at the same time or before this attribute - is defined. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -A partial date is allowed in the configuration file as long as the omitted - parts are at the end, in which case they are initialized as in the default - value. - Optionally an offset can be added to the date using the notation " -\emph on -+ duration -\emph default -". - -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -When using the Fortran interface, this attribute can be defined at the same - time as the calendar -\series bold -type -\series default -: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_define_calendar(type, timestep, start_date, time_origin, -\begin_inset Newline newline -\end_inset - - day_length, month_lengths, year_length, -\begin_inset Newline newline -\end_inset - - leap_year_month, leap_year_drift, -\begin_inset Newline newline -\end_inset - - leap_year_drift_offset) -\end_layout - -\begin_layout Standard -or later using the following subroutine: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_set_time_origin(time_origin) -\end_layout - -\begin_layout Subsection* -timestep: -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -duration -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -TYPE(xios_duration) :: timestep -\end_layout - -\begin_layout Standard -Define the time step of the simulation for the current context. - This attribute is mandatory. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -When using the Fortran interface, this attribute can be defined at the same - time as the calendar -\series bold -type -\series default -: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_define_calendar(type, timestep, start_date, time_origin, -\begin_inset Newline newline -\end_inset - - day_length, month_lengths, year_length, -\begin_inset Newline newline -\end_inset - - leap_year_month, leap_year_drift, -\begin_inset Newline newline -\end_inset - - leap_year_drift_offset) -\end_layout - -\begin_layout Standard -or using the following subroutine: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_set_timestep(timestep) -\end_layout - -\begin_layout Subsection* -day_length: -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: day_length -\end_layout - -\begin_layout Standard -Define the duration of a day in seconds when using a custom calendar. - This attribute is mandatory if the calendar -\series bold -type -\series default - is set to " -\emph on -user_defined -\emph default -", otherwise it must not be defined. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -When using the Fortran interface, this attribute must be defined at the - same time as the calendar -\series bold -type -\series default -: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_define_calendar(type, timestep, start_date, time_origin, -\begin_inset Newline newline -\end_inset - - day_length, month_lengths, year_length, -\begin_inset Newline newline -\end_inset - - leap_year_month, leap_year_drift, -\begin_inset Newline newline -\end_inset - - leap_year_drift_offset) -\end_layout - -\begin_layout Subsection* -month_lengths: -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -1D-array of integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: month_lengths(:) -\end_layout - -\begin_layout Standard -Define the duration of each month, in days, when using a custom calendar. - The number of elements in the array defines the number of months in a year - and the sum of all elements is the total number of days in a year. - This attribute is mandatory if the calendar -\series bold -type -\series default - is set to -\series bold -\emph on -user_defined -\series default -\emph default - and the -\series bold -year_length -\series default - attribute is not used, otherwise it must not be defined. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -When using the Fortran interface, this attribute must be defined at the - same time as the calendar -\series bold -type -\series default -: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_define_calendar(type, timestep, start_date, time_origin, -\begin_inset Newline newline -\end_inset - - day_length, month_lengths, year_length, -\begin_inset Newline newline -\end_inset - - leap_year_month, leap_year_drift, -\begin_inset Newline newline -\end_inset - - leap_year_drift_offset) -\end_layout - -\begin_layout Subsection* -year_length: -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: year_length -\end_layout - -\begin_layout Standard -Define the duration of a year, in seconds, when using a custom calendar. - This attribute is mandatory if the calendar -\series bold -type -\series default - is set to -\series bold -\emph on -user_defined -\series default -\emph default - and the -\series bold -month_lengths -\series default - attribute is not used, otherwise it must not be defined. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -Note that the date format is modified when using this attribute: the month - must be always be omitted and the day must also be omitted if -\begin_inset Formula $year\_length\leq day\_length$ -\end_inset - -. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -When using the Fortran interface, this attribute must be defined at the - same time as the calendar -\series bold -type -\series default -: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_define_calendar(type, timestep, start_date, time_origin, -\begin_inset Newline newline -\end_inset - - day_length, month_lengths, year_length, -\begin_inset Newline newline -\end_inset - - leap_year_month, leap_year_drift, -\begin_inset Newline newline -\end_inset - - leap_year_drift_offset) -\end_layout - -\begin_layout Subsection* -leap_year_month: -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: leap_year_month -\end_layout - -\begin_layout Standard -Define the month to which the extra day will be added in case of leap year, - when using a custom calendar. - This attribute is optional if the calendar -\series bold -type -\series default - is set to -\series bold -\emph on -user_defined -\series default -\emph default - and the -\series bold -month_lengths -\series default - attribute is used, otherwise it must not be defined. - The default behavior is not to have any leap year. - If defined, this attribute must comply with the following constraint: -\begin_inset Formula $1\leq leap\_year\_month\leq size(month\_lengths)$ -\end_inset - - and the -\series bold -leap_year_drift -\series default - attribute must also be defined. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -When using the Fortran interface, this attribute must be defined at the - same time as the calendar -\series bold -type -\series default -: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_define_calendar(type, timestep, start_date, time_origin, -\begin_inset Newline newline -\end_inset - - day_length, month_lengths, year_length, -\begin_inset Newline newline -\end_inset - - leap_year_month, leap_year_drift, -\begin_inset Newline newline -\end_inset - - leap_year_drift_offset) -\end_layout - -\begin_layout Subsection* -leap_year_drift: -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -double -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: leap_year_drift -\end_layout - -\begin_layout Standard -Define the yearly drift, expressed as a fraction of a day, between the calendar - year and the astronomical year, when using a custom calendar. - This attribute is optional if the calendar -\series bold -type -\series default - is set to -\series bold -\emph on -user_defined -\series default -\emph default - and the -\series bold -month_lengths -\series default - attribute is used, otherwise it must not be defined. - The default behavior is not to have any leap year, i.e. - the default value is -\begin_inset Formula $\mathbf{0}$ -\end_inset - -. - If defined, this attribute must comply with the following constraint: -\begin_inset Formula $0\leq leap\_year\_drift<1$ -\end_inset - - and the -\series bold -leap_year_month -\series default - attribute must also be defined. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -When using the Fortran interface, this attribute must be defined at the - same time as the calendar -\series bold -type -\series default -: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_define_calendar(type, timestep, start_date, time_origin, -\begin_inset Newline newline -\end_inset - - day_length, month_lengths, year_length, -\begin_inset Newline newline -\end_inset - - leap_year_month, leap_year_drift, -\begin_inset Newline newline -\end_inset - - leap_year_drift_offset) -\end_layout - -\begin_layout Subsection* -leap_year_drift_offset: -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -double -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: leap_year_drift_offset -\end_layout - -\begin_layout Standard -Define the initial drift between the calendar year and the astronomical - year, expressed as a fraction of a day, at the beginning of the time origin's - year, when using a custom calendar. - This attribute is optional if the -\series bold -leap_year_month -\series default - and -\series bold -leap_year_drift -\series default - attributes are used, otherwise it must not be defined. - The default value is -\begin_inset Formula $\mathbf{0}$ -\end_inset - -. - If defined, this attribute must comply with the following constraint: -\begin_inset Formula $0\leq leap\_year\_drift\_offset<1$ -\end_inset - -. - If -\begin_inset Formula $leap\_yeap\_drift\_offset+leap\_yeap\_drift$ -\end_inset - - is greater or equal to 1, then the first year will be a leap year. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -When using the Fortran interface, this attribute must be defined at the - same time as the calendar -\series bold -type -\series default -: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_define_calendar(type, timestep, start_date, time_origin, -\begin_inset Newline newline -\end_inset - - day_length, month_lengths, year_length, -\begin_inset Newline newline -\end_inset - - leap_year_month, leap_year_drift, -\begin_inset Newline newline -\end_inset - - leap_year_drift_offset) -\end_layout - -\begin_layout Section -Scalar attribute reference -\end_layout - -\begin_layout Subsection* -name (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: name -\end_layout - -\begin_layout Standard -Defines the name of a scalar as it will appear in a file. - If not defined, the name will be generated automatically based on the id. - If multiple scalars are defined in the same file, each scalar must have - a unique name. - -\end_layout - -\begin_layout Subsection* -standard_name (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: standard_name -\end_layout - -\begin_layout Standard -Defines the standard name of a scalar as it will appear in the scalar's - metadata in an output file. - -\end_layout - -\begin_layout Subsection* -long_name (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: long_name -\end_layout - -\begin_layout Standard -Defines the long name of a scalar as it will appear in the scalar's metadata - in an output file. - -\end_layout - -\begin_layout Subsection* -unit (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: unit -\end_layout - -\begin_layout Standard -Defines the scalar unit as it will appear in the scalar's metadata in an - output file. -\end_layout - -\begin_layout Subsection* -value (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -double -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: value -\end_layout - -\begin_layout Standard -Defines the value of a scalar. - If both, the label and the value, are set then only the label will be written - into a file. -\end_layout - -\begin_layout Subsection* -bounds (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -1D-array of double -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: bounds(:) -\end_layout - -\begin_layout Standard -Defines (two) scalar boundaries. - The array size must should be equal to 2. -\end_layout - -\begin_layout Subsection* -bounds_name (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: bounds_name -\end_layout - -\begin_layout Standard -Defines the name of scalar bounds as it will appear in a file. - If not defined, the name will be generated automatically based on the scalar - id. -\end_layout - -\begin_layout Subsection* -prec (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: prec -\end_layout - -\begin_layout Standard -Defines the precision in bytes of scalar value and boundaries as it will - be written into an output file. - Available values are: 2 (integer), 4 (float single precision) and 8 (float - double precision). - The default value is 8. -\end_layout - -\begin_layout Subsection* -label (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: label -\end_layout - -\begin_layout Standard -Defines the label of a scalar. - If both, the label and the value, are set then only the label will be output - into a file. -\end_layout - -\begin_layout Subsection* -scalar_ref (optional): string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: scalar_ref -\end_layout - -\begin_layout Standard -Defines the reference to a scalar. - All attributes will be inherited from the referenced scalar via the classical - inheritance mechanism. - The value assigned to the referenced scalar will be transmitted to the - current scalar. -\end_layout - -\begin_layout Subsection* -positive (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -enumeration {up, down} -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: positive -\end_layout - -\begin_layout Standard -Defines the positive direction for fields representing height or depth. -\end_layout - -\begin_layout Subsection* -axis_type (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -enumeration {X, Y, Z, T} -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: axis_type -\end_layout - -\begin_layout Standard -Defines the type of a (scalar) axis. - The values correspond to the following axis types: -\end_layout - -\begin_layout Itemize - -\series bold -\shape italic -X: -\series default -\shape default - longitude -\end_layout - -\begin_layout Itemize - -\series bold -\shape italic -\emph on -Y -\emph default -: -\series default -\shape default - latitude -\end_layout - -\begin_layout Itemize - -\series bold -\shape italic -\emph on -Z -\emph default -: -\series default -\shape default - vertical axis -\end_layout - -\begin_layout Itemize - -\series bold -\shape italic -T: -\series default -\shape default -time axis. -\end_layout - -\begin_layout Subsection* -comment: -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: comment -\end_layout - -\begin_layout Standard -Allows a user to set a comment. - -\end_layout - -\begin_layout Section -Axis attribute reference -\end_layout - -\begin_layout Subsection* -name (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: name -\end_layout - -\begin_layout Standard -Defines the name of a vertical axis as it will appear in an output file. - If not defined, the name will be generated automatically based on the axis - id. - If multiple vertical axes are defined in the same file, each axis must - have a unique name. - -\end_layout - -\begin_layout Subsection* -standard_name (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: standard_name -\end_layout - -\begin_layout Standard -Defines the standard name of a vertical axis as it will appear in the axis' - metadata in an output file. - -\end_layout - -\begin_layout Subsection* -long_name (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: long_name -\end_layout - -\begin_layout Standard -Defines the long name of a vertical axis as it will appear in the axis' - metadata in an output file. - -\end_layout - -\begin_layout Subsection* -unit (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: unit -\end_layout - -\begin_layout Standard -Defines the unit of an axis as it will appear in the axis' metadata in an - output file. -\end_layout - -\begin_layout Subsection* -dim_name (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: dim_name -\end_layout - -\begin_layout Standard -Defines the name of axis dimension as it will appear in the file's metadata. -\end_layout - -\begin_layout Subsection* -formula (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: formula -\end_layout - -\begin_layout Standard -Adds the formula attribute to a parametric vertical axis. -\end_layout - -\begin_layout Subsection* -formula_term (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: formula_term -\end_layout - -\begin_layout Standard -Adds the formula terms attribute to a parametric vertical axis. -\end_layout - -\begin_layout Subsection* -formula_bounds (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: formula_bounds -\end_layout - -\begin_layout Standard -Adds the formula attribute to the bounds of a parametric vertical axis. - The attribute is mandatory if the -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -formula -\end_layout - -\end_inset - - attribute is defined for the axis. -\end_layout - -\begin_layout Subsection* -formula_term_bounds (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: formula_term_bounds -\end_layout - -\begin_layout Standard -Adds the formula terms attribute to the bounds of a parametric vertical - axis. - The attribute is mandatory if the -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -formula -\end_layout - -\end_inset - - attribute is defined for the axis. -\end_layout - -\begin_layout Subsection* -n_glo (mandatory): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: n_glo -\end_layout - -\begin_layout Standard -Defines the global size of an axis. -\end_layout - -\begin_layout Subsection* -begin (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: begin -\end_layout - -\begin_layout Standard -Defines the beginning index of the local domain. - It can take value between 0 and -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -n_glo-1 -\end_layout - -\end_inset - -. - If not specified the default value is 0. -\end_layout - -\begin_layout Subsection* -n (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: zoom_size -\end_layout - -\begin_layout Standard -Defines the local size of an axis. - It can take value between 0 and -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -n_glo -\end_layout - -\end_inset - -. - If not specified the default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -n_glo -\end_layout - -\end_inset - -. - Local axis decomposition can be declared either with attributes -\series bold -\shape italic -{n, begin} -\series default -\shape default - or with -\series bold -\shape italic -index -\series default -\shape default -. -\end_layout - -\begin_layout Subsection* -index (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -1D-array of double -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: index(:) -\end_layout - -\begin_layout Standard -Defines the global indexes of a local axis held by each process. - If the attribute is specified, its array size must be equal to -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -n -\end_layout - -\end_inset - -. - Local axis decomposition can be declared either with attributes -\series bold -\shape italic -{n, begin} -\series default -\shape default - or with -\series bold -\shape italic -index -\series default -\shape default -. -\end_layout - -\begin_layout Subsection* -value (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -1D-array of double -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: value(:) -\end_layout - -\begin_layout Standard -Defines the value of each level of a vertical axis. - The array size must be equal to the value of the attribute -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -n -\end_layout - -\end_inset - -. - If the label is provided then only the label will be written into a file - and not the axis value and the axis boundaries. -\end_layout - -\begin_layout Subsection* -bounds (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -2D-array of double -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: bounds(:,:) -\end_layout - -\begin_layout Standard -Defines the boundaries of each level of a vertical axis. - The dimensions of the array must be -\begin_inset Formula $2\times n$ -\end_inset - -. -\end_layout - -\begin_layout Subsection* -bounds_name (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: bounds_name -\end_layout - -\begin_layout Standard -Defines the name of axis boundaries as it will appear in a file. - If not defined, the name will be generated automatically based on the axis - id. -\end_layout - -\begin_layout Subsection* -prec (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: prec -\end_layout - -\begin_layout Standard -Defines the precision in bytes of axis value and boundaries as it will be - written into an output file. - Available values are: 2 (integer), 4 (float single precision) and 8 (float - double precision). - The default value is 8. -\end_layout - -\begin_layout Subsection* -label (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER, ALLOCATABLE :: label(:) -\end_layout - -\begin_layout Standard -Defines the label of an axis. - The size of the array must be equal to the value of the attribute -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -n -\end_layout - -\end_inset - -. - If the label is provided then only the label will be written into a file - and not the axis value and the axis boundaries. -\end_layout - -\begin_layout Subsection* -data_begin (optional): -\emph on - integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: data_begin -\end_layout - -\begin_layout Standard -Defines the beginning index of local field data owned by each process. - The attribute is an offset relative to the local axis, so the value can - be negative. - A negative value indicates that only some valid part of the data will extracted -, for example in the case of a ghost cell. - A positive value indicates that the local domain is greater than the data - stored in memory. - The 0-value means that the local domain matches the data in memory. - The default value is 0. - The attributes -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -data_begin -\end_layout - -\end_inset - - and -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -data_n -\end_layout - -\end_inset - - must be defined together. -\end_layout - -\begin_layout Subsection* -data_n (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: data_n -\end_layout - -\begin_layout Standard -Defines the size of local field data. - The attribute can take value starting from 0 (no data on a process). - The default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -n -\end_layout - -\end_inset - -. - The attributes -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -data_begin -\end_layout - -\end_inset - - and -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -data_n -\end_layout - -\end_inset - - must be defined together. -\end_layout - -\begin_layout Subsection* -data_index (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: data_index -\end_layout - -\begin_layout Standard -In case of a compressed vertical axis, the attribute defines the position - of data points stored in the memory. - The array size has to be equal to -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -data_n -\end_layout - -\end_inset - -. - For example, for a local axis of size -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -n=3 -\end_layout - -\end_inset - - and local data size of -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -data_n=5 -\end_layout - -\end_inset - -, if -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -data_index=(/ -1, 2, 1, 0, -1 /) -\end_layout - -\end_inset - - then the first and the last data points are ghosts and only the three middle - values will be written in the reversed order. -\end_layout - -\begin_layout Subsection* -mask (optional): -\emph on -1D-array of bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: mask(:) -\end_layout - -\begin_layout Standard -Defines the mask of the local axis. - The masked value will be replaced by the value of the field attribute -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -default_value -\end_layout - -\end_inset - - in an output file. -\end_layout - -\begin_layout Subsection* -n_distributed_partition (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: n_distributed_partition -\end_layout - -\begin_layout Standard -Defines the number of local axes in case if the axis is generated automatically - by XIOS. - The default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -1 -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Subsection* -axis_ref (optional): string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: axis_ref -\end_layout - -\begin_layout Standard -Defines the reference of an axis. - All attributes will be inherited from the referenced axis with the classical - inheritance mechanism. - The value assigned to the referenced axis will be transmitted to the current - axis. -\end_layout - -\begin_layout Subsection* -positive (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -enumeration {up, down} -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: positive -\end_layout - -\begin_layout Standard -Defines the positive direction for fields representing height or depth. -\end_layout - -\begin_layout Subsection* -axis_type (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -enumeration {X, Y, Z, T} -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: axis_type -\end_layout - -\begin_layout Standard -Defines the type of an axis. - The values correspond to the following axis types: -\end_layout - -\begin_layout Itemize - -\series bold -\shape italic -X: -\series default -\shape default - longitude -\end_layout - -\begin_layout Itemize - -\series bold -\shape italic -\emph on -Y -\emph default -: -\series default -\shape default - latitude -\end_layout - -\begin_layout Itemize - -\series bold -\shape italic -\emph on -Z -\emph default -: -\series default -\shape default - vertical axis -\end_layout - -\begin_layout Itemize - -\series bold -\shape italic -T: -\series default -\shape default -time axis. -\end_layout - -\begin_layout Subsection* -comment (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: comment -\end_layout - -\begin_layout Standard -Allows a user to set a comment. - -\end_layout - -\begin_layout Section -Domain attribute reference -\end_layout - -\begin_layout Subsection* -name (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: name -\end_layout - -\begin_layout Standard -Defines the name of a horizontal domain. - This attribute may be used in case of multiple domains defined in the same - file. - In this case, the -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -name -\end_layout - -\end_inset - - attribute will be suffixed to the longitude and latitude dimensions and - axis name. - If the domain name is not provided, it will be generated automatically. -\end_layout - -\begin_layout Subsection* -standard_name (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: standard_name -\end_layout - -\begin_layout Standard -Defines the standard name of a domain as it will appear in the domain's - metadata in an output file. - -\end_layout - -\begin_layout Subsection* -long_name (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: long_name -\end_layout - -\begin_layout Standard -Defines the long name of a domain as it will appear in the domain's metadata - in an output file. - -\end_layout - -\begin_layout Subsection* -type (mandatory): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -enumeration {rectilinear, curvilinear, unstructured, gaussian} -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: type -\end_layout - -\begin_layout Standard -Defines the type of a grid. -\end_layout - -\begin_layout Subsection* -dim_i_name (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: dim_i_name -\end_layout - -\begin_layout Standard -Defines the name of the first domain dimension as it will appear in the - file's metadata. -\end_layout - -\begin_layout Subsection* -dim_j_name (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: dim_j_name -\end_layout - -\begin_layout Standard -Defines the name of the second domain dimension as it will appear in file's - metadata. -\end_layout - -\begin_layout Subsection* -ni_glo (mandatory): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: ni_glo -\end_layout - -\begin_layout Standard -Defines the size of the first dimension of the global domain. -\end_layout - -\begin_layout Subsection* -nj_glo (mandatory): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: nj_glo -\end_layout - -\begin_layout Standard -Defines the size of the second dimension of the global domain. -\end_layout - -\begin_layout Subsection* -ibegin (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: ibegin -\end_layout - -\begin_layout Standard -Defines the beginning index of the first dimension of a local domain. - The attribute takes value between -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -0 -\end_layout - -\end_inset - - and -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -ni_glo-1 -\end_layout - -\end_inset - -. - If not specified the default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -0 -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Subsection* -ni (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: ni -\end_layout - -\begin_layout Standard -Defines the size of the first dimension of a local domain. - The attribute takes value between -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -1 -\end_layout - -\end_inset - -and -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -ni_glo -\end_layout - -\end_inset - -. - If not specified the default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -ni_glo -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Subsection* -jbegin (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: jbegin -\end_layout - -\begin_layout Standard -Defines the beginning index of the second dimension of a local domain. - The attribute takes value between -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -0 -\end_layout - -\end_inset - - and -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -nj_glo-1 -\end_layout - -\end_inset - -. - If not specified the default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -0 -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Subsection* -nj (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: nj -\end_layout - -\begin_layout Standard -Defines the size of the second dimension of a local domain. - he attribute takes value between -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -1 -\end_layout - -\end_inset - -and -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -nj_glo -\end_layout - -\end_inset - -. - If not specified the default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -nj_glo -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Subsection* -lonvalue_1d (optional): -\emph on -1D-array of double -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: lonvalue(:) -\end_layout - -\begin_layout Standard -Defines the longitude values of a local domain. - For a cartesian grid, the array size should be -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -ni -\end_layout - -\end_inset - -. - For a curvilinear grid, the array size should be -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -ni -\begin_inset Formula $\times$ -\end_inset - -nj -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Subsection* -lonvalue_2d (optional): -\emph on -2D-array of double -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: lonvalue(:,:) -\end_layout - -\begin_layout Standard -Defines the longitude values of a local domain. - For cartesian and curvilinear grids the array size should be -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -ni -\begin_inset Formula $\times$ -\end_inset - -nj -\end_layout - -\end_inset - -. - Only lonvalue_1d or lonvalue_2d can be defined. - Also the layout of latitude and longitude should be in conformance with - each other: either 1D or 2D. -\end_layout - -\begin_layout Subsection* -latvalue_1d (optional): -\emph on -1D-array of double -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: latvalue(:) -\end_layout - -\begin_layout Standard -Defines the latitude values of a local domain. - For a cartesian grid, the size of the array will be nj. - For a curvilinear grid, the size of the array will be -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -ni -\begin_inset Formula $\times$ -\end_inset - -nj -\end_layout - -\end_inset - -. - -\end_layout - -\begin_layout Subsection* -latvalue_2d (optional): -\emph on -2D-array of double -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: latvalue(:,:) -\end_layout - -\begin_layout Standard -Defines the latitude values of a local domain. - For cartesian and curvilinear grids the array size should be -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -ni -\begin_inset Formula $\times$ -\end_inset - -nj -\end_layout - -\end_inset - -. - Only latvalue_1d or latvalue_2d can be defined. - Also the layout of latitude and longitude should be in conformance with - each other: either 1D or 2D. -\end_layout - -\begin_layout Subsection* -lon_name (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: lon_name -\end_layout - -\begin_layout Standard -Defines the longitude name as it will appear in an output file. -\end_layout - -\begin_layout Subsection* -lat_name (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: lat_name -\end_layout - -\begin_layout Standard -Defines the latitude name as it will appear in an output file. -\end_layout - -\begin_layout Subsection* -nvertex (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: nvertex -\end_layout - -\begin_layout Standard -Defines the maximum number of vertices for a grid. - The attribute is required for specifying the cell boundaries of unstructured - meshes. -\end_layout - -\begin_layout Subsection* -bounds_lon_1d (optional): -\emph on -2D-array of double -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: bounds_lon(:,:) -\end_layout - -\begin_layout Standard -Defines the longitude values of domain vertexes. - The attribute -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -nvertex -\end_layout - -\end_inset - - must be also defined. - The array dimensions must be -\begin_inset Formula $\textbf{nvertex}\times\textbf{ni}$ -\end_inset - -. -\end_layout - -\begin_layout Subsection* -bounds_lon_2d (optional): -\emph on -3D-array of double -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: bounds_lon(:,:,:) -\end_layout - -\begin_layout Standard -Defines the longitude values of domain vertexes. - The attribute -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -nvertex -\end_layout - -\end_inset - - must be also defined. - This attribute is useful when lonvalue_2d is defined. - The array dimensions must be -\begin_inset Formula $\textbf{nvertex}\times\textbf{ni}\times\textbf{nj}$ -\end_inset - -. - Either bounds_lon_1d or bounds_lon_2d can be defined. -\end_layout - -\begin_layout Subsection* -bounds_lat_1d (optional): -\emph on -2D-array of double -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: bounds_lat(:,:) -\end_layout - -\begin_layout Standard -Defines the latitude values of domain vertexes. - The attribute -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -nvertex -\end_layout - -\end_inset - - must be also defined. - The array dimensions must be -\begin_inset Formula $\textbf{nvertex}\times\textbf{ni}$ -\end_inset - -. -\end_layout - -\begin_layout Subsection* -bounds_lat_2d (optional): -\emph on -3D-array of double -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: bounds_lat(:,:) -\end_layout - -\begin_layout Standard -Defines the latitude values of domain vertexes. - The attribute -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -nvertex -\end_layout - -\end_inset - - must be also defined. - The attribute is useful when lonvalue_2d is defined. - The array dimensions must be -\begin_inset Formula $\textbf{nvertex}\times\textbf{ni}\times\textbf{nj}$ -\end_inset - -. - Either bounds_lon_1d or bounds_lon_2d can be defined. -\end_layout - -\begin_layout Subsection* -bounds_lon_name (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: lon_name -\end_layout - -\begin_layout Standard -Defines the longitude name of domain vertexes as it will appear in an output - file. -\end_layout - -\begin_layout Subsection* -bounds_lat_name (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: lat_name -\end_layout - -\begin_layout Standard -Defines the latitude name of domain vertexes as it will appear in an output - file. -\end_layout - -\begin_layout Subsection* -area (optional): -\emph on -2D-array of double -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: area(:,:) -\end_layout - -\begin_layout Standard -The area of cells. - The size of the array must be -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -ni -\begin_inset Formula $\times$ -\end_inset - -nj -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Subsection* -prec (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: prec -\end_layout - -\begin_layout Standard -Defines the precision in bytes of domain attributes. - Available values are: 2 (integer), 4 (float single precision) and 8 (float - double precision). - The default value of 8. -\end_layout - -\begin_layout Subsection* -data_dim (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: datadim -\end_layout - -\begin_layout Standard -Defines how a field is stored on memory for the client code. - The value can be either -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -1 -\end_layout - -\end_inset - - or -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -2 -\end_layout - -\end_inset - -. - The value of -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -1 -\end_layout - -\end_inset - - indicates that the horizontal layer of the field is stored as a 1D array. - The value of -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -2 -\end_layout - -\end_inset - - indicates that the horizontal layer is stored as a 2D array. - The default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -1 -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Subsection* -data_ibegin (optional): -\emph on - integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: data_ibegin -\end_layout - -\begin_layout Standard -Defines the beginning index of field data for the first dimension. - This attribute is an offset relative to the local domain, so the value - can be negative. - A negative value indicates that only some valid part of the data will extracted -, for example in the case of a ghost cell. - A positive value indicates that the local domain is greater than the data - stored in memory. - A 0-value means that the local domain matches the data in memory. - The default value is 0. - The attributes -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -data_ibegin -\end_layout - -\end_inset - - and -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -data_ni -\end_layout - -\end_inset - - must be defined together. -\end_layout - -\begin_layout Subsection* -data_ni (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: data_ni -\end_layout - -\begin_layout Standard -Defines the size of field data for the first dimension. - The default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -ni -\end_layout - -\end_inset - -. - The attributes -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -data_ibegin -\end_layout - -\end_inset - - and -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -data_ni -\end_layout - -\end_inset - - must be defined together. -\end_layout - -\begin_layout Subsection* -data_jbegin (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: data_jbegin -\end_layout - -\begin_layout Standard -Defines the beginning index of field data for the second dimension. - The attribute is taken into account only if -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout - data_dim=2 -\end_layout - -\end_inset - -. - The attribute is an offset relative to the local domain, so the value can - be negative. - A negative value indicate that only some valid part of the data will extracted, - for example in case of ghost cell. - A positive value indicate that the local domain is greater than the data - stored in memory. - The 0-value means that the local domain matches the data in memory. - The default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -0 -\end_layout - -\end_inset - -. - The attributes -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -data_jbegin -\end_layout - -\end_inset - - and -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -data_nj -\end_layout - -\end_inset - - must be defined together. -\end_layout - -\begin_layout Subsection* -data_nj (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: data_nj -\end_layout - -\begin_layout Standard -Defines the size of field data for the second dimension. - The attribute is taken account only if -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -data_dim=2 -\end_layout - -\end_inset - -. - The default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -nj -\end_layout - -\end_inset - -. - The attributes -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -data_jbegin -\end_layout - -\end_inset - - and -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -data_nj -\end_layout - -\end_inset - - must be defined together. -\end_layout - -\begin_layout Subsection* -data_i_index (optional): -\emph on -1D-array of integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: data_i_index(:) -\end_layout - -\begin_layout Standard -In case of a compressed horizontal domain, define the data indexation for - the first dimension. - The array size must be -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -data_n -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Subsection* -data_j_index (optional): -\emph on -1D-array of integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: data_j_index(:) -\end_layout - -\begin_layout Standard -In case of a compressed horizontal domain, defines the data indexation for - the second dimension. - The attribute is meaningful only if -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -data_dim=2 -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Subsection* -mask_1d (optional): -\emph on -1D-array of bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: mask(:) -\end_layout - -\begin_layout Standard -Defines the 1D mask of a local domain. - The masked value will be replaced by the value of the field attribute -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -default_value -\end_layout - -\end_inset - - in an output file. - This value is useful in case a field is stored linearly in memory. - By default none of the values are masked. -\end_layout - -\begin_layout Subsection* -mask_2d (optional): -\emph on -2D-array of bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: mask(:,:) -\end_layout - -\begin_layout Standard -Defines the 2D mask of a local domain. - The masked values will be replaced by the value of the field attribute - -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -default_value -\end_layout - -\end_inset - - in an output file. - By default, none of the values are masked. - Only mask_2d or mask_1d can be defined. -\end_layout - -\begin_layout Subsection* -domain_ref (optional): string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: domain_ref -\end_layout - -\begin_layout Standard -Defines the reference to a domain. - All attributes are inherited from the referenced domain with the classic - inheritance mechanism. - The value assigned to the referenced domain is transmitted to to current - domain. -\end_layout - -\begin_layout Subsection* -i_index (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -1D-array of double -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: i_index(:) -\end_layout - -\begin_layout Standard -Defines the global index of the first dimension of a local domain held by - a process. - By default the size of the array is equal to -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -ni*nj -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Subsection* -j_index (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -1D-array of double -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: j_index(:) -\end_layout - -\begin_layout Standard -Defines the global index of the second dimension of a local domain held - by a process. - By default the size of the array is equal to -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -ni*nj -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Subsection* -comment (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: comment -\end_layout - -\begin_layout Standard -Allows a user to set a comment. -\end_layout - -\begin_layout Section -Grid attribute reference -\end_layout - -\begin_layout Subsection* -name (optional): string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: name -\end_layout - -\begin_layout Standard -Defines the name of a grid. -\end_layout - -\begin_layout Subsection* -description (optional): string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: description -\end_layout - -\begin_layout Standard -Defines the descriptions of a grid. -\end_layout - -\begin_layout Subsection* -mask_1d (optional): -\emph on -1D-array of bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: mask_1d(:) -\end_layout - -\begin_layout Standard -Defines the mask of a local 1D grid. - Masked values will be replaced by the value of the field attribute -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -default_value -\end_layout - -\end_inset - - in an output file. - By default none of the value are masked. -\end_layout - -\begin_layout Subsection* -mask_2d (optional): -\emph on -2D-array of bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: mask_2d(:,:) -\end_layout - -\begin_layout Standard -Defines the mask of a local 2D grid. - Masked values will be replaced by the value of the field attribute -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -default_value -\end_layout - -\end_inset - - in an output file. - By default none of the value are masked. -\end_layout - -\begin_layout Subsection* -mask_3d (optional): -\emph on -3D-array of bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: mask_3d(:,:,:) -\end_layout - -\begin_layout Standard -Define the mask of a local 3D grid. - Masked values will be replaced by the value of the field attribute -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -default_value -\end_layout - -\end_inset - - in an output file. - By default none of the value are masked. -\end_layout - -\begin_layout Subsection* -mask_4d (optional): -\emph on -4D-array of bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: mask_4d(:,:,:) -\end_layout - -\begin_layout Standard -Define the mask of a local 4D grid. - Masked values will be replaced by the value of the field attribute -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -default_value -\end_layout - -\end_inset - - in an output file. - By default none of the value are masked. -\end_layout - -\begin_layout Subsection* -mask_5d (optional): -\emph on -5D-array of bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: mask_5d(:,:,:) -\end_layout - -\begin_layout Standard -Define the mask of a local 5D grid. - Masked values will be replaced by the value of the field attribute -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -default_value -\end_layout - -\end_inset - - in an output file. - By default none of the value are masked. -\end_layout - -\begin_layout Subsection* -mask_6d (optional): -\emph on -6D-array of bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: mask_6d(:,:,:) -\end_layout - -\begin_layout Standard -Define the mask of a local 6D grid. - Masked values will be replaced by the value of the field attribute -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -default_value -\end_layout - -\end_inset - - in an output file. - By default none of the value are masked. -\end_layout - -\begin_layout Subsection* -mask_7d (optional): -\emph on -7D-array of bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: mask_7d(:,:,:) -\end_layout - -\begin_layout Standard -Define the mask of a local 7D grid. - Masked values will be replaced by the value of the field attribute -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -default_value -\end_layout - -\end_inset - - in an output file. - By default none of the value are masked. -\end_layout - -\begin_layout Subsection* -comment (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: comment -\end_layout - -\begin_layout Standard -Allows a user to set a comment. -\end_layout - -\begin_layout Section -Field attribute reference -\end_layout - -\begin_layout Subsection* -name (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: name -\end_layout - -\begin_layout Standard -Defines the name of a field as it will appear in an output file. - If not present, the identifier -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -id -\end_layout - -\end_inset - - will be substituted. -\end_layout - -\begin_layout Subsection* -standard_name (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: standard_name -\end_layout - -\begin_layout Standard -Defines the -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -standard_name -\end_layout - -\end_inset - - attribute as it will appear in the metadata of an output file. -\end_layout - -\begin_layout Subsection* -long_name (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: long_name -\end_layout - -\begin_layout Standard -Defines the long name as it will appear in the metadata of an output file. -\end_layout - -\begin_layout Subsection* -expr (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: expr -\end_layout - -\begin_layout Standard -Defines the expression for arithmetic or time-integration operations performed - on a field. - For example if -\series bold -expr= -\begin_inset Quotes erd -\end_inset - -sqrt(@temp2 - pow(@temp, 2)) -\begin_inset Quotes erd -\end_inset - - -\series default - then the variance will be calculated on the incoming flux of the field - -\series bold -temp -\series default - (given that field temp2 that holds the square of temp was correctly defined). - -\end_layout - -\begin_layout Subsection* -unit (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: unit -\end_layout - -\begin_layout Standard -Defines the unit of a field. -\end_layout - -\begin_layout Subsection* -operation (mandatory): enumeration -\emph on - {once, instant, average, maximum, minimum, accumulate} -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: operation -\end_layout - -\begin_layout Standard -Defines the temporal operation applied to a field. -\end_layout - -\begin_layout Subsection* -freq_op (optional): -\emph on -duration -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -TYPE(xios_duration) :: freq_op -\end_layout - -\begin_layout Standard -Defines the sampling frequency of a temporal operation, so that field values - will be used for temporal sampling at frequency -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -freq_op -\end_layout - -\end_inset - -. - It is useful for sub-processes called at different frequency in a model. - The default value is equal to the file attribute -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -output_freq -\end_layout - -\end_inset - - for -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -instant -\end_layout - -\end_inset - - operations and -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -1ts -\end_layout - -\end_inset - - (1 time step) otherwise. -\end_layout - -\begin_layout Subsection* -freq_offset (optional): -\emph on -duration -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -TYPE(xios_duration) :: freq_offset -\end_layout - -\begin_layout Standard -Defines the offset when -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -freq_op -\end_layout - -\end_inset - - is defined. - Accepted values lie between -\series bold -0 -\series default - and -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -freq_op -\end_layout - -\end_inset - -. - The default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -freq_op - 1ts -\end_layout - -\end_inset - - for fields in the -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -write -\end_layout - -\end_inset - - mode and -\series bold -0 -\series default - for fields in the -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -read -\end_layout - -\end_inset - - mode. -\end_layout - -\begin_layout Subsection* -level (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: level -\end_layout - -\begin_layout Standard -Defines the output level of a field. - The field will be output only if the file attribute -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout - output_level -\begin_inset Formula $\geq$ -\end_inset - -level -\end_layout - -\end_inset - -. - The default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -0 -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Subsection* -prec (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: prec -\end_layout - -\begin_layout Standard -Defines the precision in bytes of a field in an output file. - Available values are: 2 (integer), 4 (float single precision) and 8 (float - double precision). - The default value of 8. -\end_layout - -\begin_layout Subsection* -enabled (optional): -\emph on -bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: enabled -\end_layout - -\begin_layout Standard -Defines if a field must be output or not. - The default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -true -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Subsection* -check_if_active (optional): -\emph on -bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: check_if_active -\end_layout - -\begin_layout Standard -Sets a check if a field will be used at a given time step. - Activating the check may improve performance for fields which are not used - frequently, while it can detoriate performance for fields used at each - time step. - The default value is false. -\end_layout - -\begin_layout Subsection* -read_access (optional): -\emph on -bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: read_access -\end_layout - -\begin_layout Standard -Defines whether a field can be read from the model or not. - The default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -false -\end_layout - -\end_inset - -. - Note that for fields belonging to a file in -\series bold -\emph on -read -\series default -\emph default - -\series bold -mode -\series default -, this attribute is always -\series bold -true -\series default -. -\end_layout - -\begin_layout Subsection* -field_ref (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: field_ref -\end_layout - -\begin_layout Standard -Defines the field reference. - All attributes will be inherited from the referenced field via the classical - inheritance mechanism. - The values assigned to the referenced field will be transmitted to the - current field to perform temporal operation. -\end_layout - -\begin_layout Subsection* -grid_ref (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: grid_ref -\end_layout - -\begin_layout Standard -Defines the field grid. - Note that only either -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -grid_ref -\end_layout - -\end_inset - - or a combination of -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -domain_ref -\end_layout - -\end_inset - -, -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -scalar_ref -\end_layout - -\end_inset - - or -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -axis_ref -\end_layout - -\end_inset - - can be specified. -\end_layout - -\begin_layout Subsection* -domain_ref (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: domain_ref -\end_layout - -\begin_layout Standard -Defines the field domain. - If the attribute is defined, the attribute -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -grid_ref -\end_layout - -\end_inset - - must not be specified. -\end_layout - -\begin_layout Subsection* -axis_ref (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: axis_ref -\end_layout - -\begin_layout Standard -Defines an axis for the current field. - If the attribute is defined, the attribute -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -grid_ref -\end_layout - -\end_inset - - must not be specified. -\end_layout - -\begin_layout Subsection* -scalar_ref (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: scalar_ref -\end_layout - -\begin_layout Standard -Defines a scalar domain for the current field. - If the attribute is defined, the attribute -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -grid_ref -\end_layout - -\end_inset - - must not be specified. -\end_layout - -\begin_layout Subsection* -grid_path (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: grid_path -\end_layout - -\begin_layout Standard -Defines the way operations pass from a grid to other grids. -\end_layout - -\begin_layout Subsection* -default_value (optional): -\emph on -double -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: default_value -\end_layout - -\begin_layout Standard -Defines the value which will be used instead of missing field data. - If no value is provided, the missing data will be replaced by uninitialized - values what can lead to undefined behavior. -\end_layout - -\begin_layout Subsection* -valid_min (optional): -\emph on -double -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: valid_min -\end_layout - -\begin_layout Standard -All field values below -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -valid_min -\end_layout - -\end_inset - - attribute value will be set to missing value. -\end_layout - -\begin_layout Subsection* -valid_max (optional): -\emph on -double -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: valid_max -\end_layout - -\begin_layout Standard -All field values above -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -valid_max -\end_layout - -\end_inset - - attribute value will be set to missing value. -\end_layout - -\begin_layout Subsection* -detect_missing_value (optional): -\emph on -bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL: detect_missing_value -\end_layout - -\begin_layout Standard -When XIOS detects a default value in a field, it does not take into account - the value during arithmetic operations such as averaging, minimum, maximum, - etc. -\end_layout - -\begin_layout Subsection* -add_offset (optional): -\emph on -double -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION: add_offset -\end_layout - -\begin_layout Standard -Sets the -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -add_offset -\end_layout - -\end_inset - - metadata CF attribute in an output file. - In output, the -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -add_offset -\end_layout - -\end_inset - - value will be subtracted from the field values. -\end_layout - -\begin_layout Subsection* -scale_factor: -\emph on -double -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION: scale_factor -\end_layout - -\begin_layout Standard -Sets the -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -scale_factor -\end_layout - -\end_inset - - metadata CF attribute in an output file. - In output, the field values will be divided by the -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -scale_factor -\end_layout - -\end_inset - - value. -\end_layout - -\begin_layout Subsection* -compression_level (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: compression_level -\end_layout - -\begin_layout Standard -Defines whether a field should be compressed using NetCDF-4 built-in compression. - The compression level must range from 0 to 9. - A higher compression level means a better compression at the cost of using - more processing power. - The default value is inherited from the file attribute -\series bold -compression_level -\series default -. -\end_layout - -\begin_layout Subsection* -indexed_output (optional): -\emph on -bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: indexed_output -\end_layout - -\begin_layout Standard -Defines whether field data must be output as an indexed grid instead of - a full grid whenever possible. - The default value is -\series bold -\emph on -false -\series default -\emph default -. -\end_layout - -\begin_layout Subsection* -ts_enabled (optional): -\emph on -bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: ts_enabled -\end_layout - -\begin_layout Standard -Defines whether a field can be output as a timeseries. - The default value is -\series bold -\emph on -false -\series default -\emph default -. -\end_layout - -\begin_layout Subsection* -ts_split_freq (optional): -\emph on -duration -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -TYPE(xios_duration) :: ts_split_freq -\end_layout - -\begin_layout Standard -Defines the splitting frequency that should be used for a timeseries if - it has been requested. - By default the attribute value is inherited from the file attribute -\series bold -split_freq -\series default -. -\end_layout - -\begin_layout Subsection* -cell_methods (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: cell_methods -\end_layout - -\begin_layout Standard -Defines the cell methods field attribute. -\end_layout - -\begin_layout Subsection* -cell_methods_mode (optional): enumeration -\emph on - {overwrite, prefix, suffix, none} -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: cell_methods_mode -\end_layout - -\begin_layout Standard -Defines the cell methods mode of a field. -\end_layout - -\begin_layout Subsection* -comment (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: comment -\end_layout - -\begin_layout Standard -Allows a user to set a comment. -\end_layout - -\begin_layout Section -Variable attribute reference -\end_layout - -\begin_layout Subsection* -name (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: name -\end_layout - -\begin_layout Standard -Defines the name of a variable as it will appear in an output file. - If not present, the variable -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -id -\end_layout - -\end_inset - - will be used. -\end_layout - -\begin_layout Subsection* -type (mandatory): enumeration {bool, int, int32, int16, int64, float, double, - string} -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: type -\end_layout - -\begin_layout Standard -Defines the type of a variable. - Note that the -\series bold -\emph on -int -\series default -\emph default - type is a synonym for -\series bold -\emph on -int32 -\series default -\emph default -. -\end_layout - -\begin_layout Subsection* -ts_target (optional): enumeration {file, field, both, none} -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: ts_target -\end_layout - -\begin_layout Section -File attribute reference -\end_layout - -\begin_layout Subsection* -name (mandatory): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: name -\end_layout - -\begin_layout Standard -Defines the name of a file. -\end_layout - -\begin_layout Subsection* -description (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: description -\end_layout - -\begin_layout Standard -Defines the description of a file. -\end_layout - -\begin_layout Subsection* -name_suffix (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: name_suffix -\end_layout - -\begin_layout Standard -Defines a suffix added to the file name. -\end_layout - -\begin_layout Subsection* -min_digits (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: min_digits -\end_layout - -\begin_layout Standard -For the -\series bold -multiple_file -\series default - mode defines the minimum number of digits of the suffix describing the - server rank which will be appended to the file name. - The default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -0 -\end_layout - -\end_inset - - (no server rank suffix is added). -\end_layout - -\begin_layout Subsection* -output_freq (mandatory): -\emph on -duration -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -TYPE(xios_duration) :: output_freq -\end_layout - -\begin_layout Standard -Defines the output frequency for the current file. -\end_layout - -\begin_layout Subsection* -output_level (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: output_level -\end_layout - -\begin_layout Standard -Defines the output level for all fields of the current file. - The field is output only if the field attribute -\series bold -level -\series default - is less or equal to the file attribute -\series bold -output_level -\series default -. -\end_layout - -\begin_layout Subsection* -sync_freq (optional): -\emph on -duration -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -TYPE(xios_duration) :: sync_freq -\end_layout - -\begin_layout Standard -Defines the frequency for flushing the current file onto a disk. - It may result in poor performances but data will be written even if a file - is not yet closed. -\end_layout - -\begin_layout Subsection* -split_freq (optional): -\emph on -duration -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -TYPE(xios_duration) :: split_freq -\end_layout - -\begin_layout Standard -Defines the frequency for splitting the current file. - The start and end dates will be added to the file name (see -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout - -\series bold -\emph on -split_freq_format -\end_layout - -\end_inset - - attribute). - By default no splitting is done. -\end_layout - -\begin_layout Subsection* -split_freq_format (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: split_freq_format -\end_layout - -\begin_layout Standard -Defines the format of the split date suffixed to a file. - It can contain any character, -\emph on - -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -%y -\end_layout - -\end_inset - - -\emph default - will be replaced by the year (4 characters), -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -%mo -\end_layout - -\end_inset - - by the month (2 char), -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -%d -\end_layout - -\end_inset - - by the day (2 char), -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -%h -\end_layout - -\end_inset - - by the hour (2 char), -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -%mi -\end_layout - -\end_inset - - by the minute (2 char), -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -%s -\end_layout - -\end_inset - - by the second (2 char), -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -%S -\end_layout - -\end_inset - - by the number of seconds since the time origin and -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -%D -\end_layout - -\end_inset - - by the number of full days since the time origin. - The default behavior is to create a suffix with the date until the smaller - non zero unit. - For example, in one day split frequency, the hour, minute and second will - not appear in the suffix, only year, month and day. -\end_layout - -\begin_layout Subsection* -split_start_offset(optional): -\emph on -duration -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -TYPE(xios_duration) :: split_start_offset -\end_layout - -\begin_layout Standard -Defines the offset of file splitting. - -\end_layout - -\begin_layout Subsection* -split_end_offset(optional): -\emph on -duration -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -TYPE(xios_duration) :: split_end_offset -\end_layout - -\begin_layout Subsection* -split_last_date (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: split_last_date -\end_layout - -\begin_layout Subsection* -enabled (optional): -\emph on -bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: enabled -\end_layout - -\begin_layout Standard -Defines if a file must be written/read or not. - The default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -true -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Subsection* -mode (optional): -\emph on -enumeration {read, write} -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: mode -\end_layout - -\begin_layout Standard -Defines whether a file will be read or written. - The default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -write -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Subsection* -type (mandatory): -\emph on -enumeration {one_file, multiple_file} -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: type -\end_layout - -\begin_layout Standard -Defines the type of a file: -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout - -\emph on -multiple_file -\end_layout - -\end_inset - -: one file by server using sequential netcdf writing, -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout - -\emph on -one_file -\end_layout - -\end_inset - -: one single global file is wrote using netcdf4 parallel access. -\end_layout - -\begin_layout Subsection* -format (optional): -\emph on -enumeration {netcdf4, netcdf4_classic} -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: format -\end_layout - -\begin_layout Standard -Define the format of a file: -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout - -\emph on -netcdf4 -\end_layout - -\end_inset - -: the HDF5 format will be used, -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout - -\emph on -netcdf4 -\emph default -_ -\emph on -classic -\end_layout - -\end_inset - -: the classic NetCDF format will be used. - The default value is -\series bold -\emph on -netcdf4 -\series default -\emph default -. - Note that the -\series bold -\emph on -netcdf4 -\emph default -_ -\emph on -classic -\series default -\emph default - format can be used with the attribute -\series bold -type -\series default - set to -\series bold -\emph on -one_file -\series default -\emph default - only if the NetCDF4 library was compiled with Parallel NetCDF support (--enable --pnetcdf). -\end_layout - -\begin_layout Subsection* -par_access (optional): -\emph on -enumeration {collective, independent} -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: par_access -\end_layout - -\begin_layout Standard -For parallel writing, defines which type of MPI calls will be used. - The default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout - -\emph on -collective -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Subsection* -read_metadata_par (optional): -\emph on -bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: read_metadata_par -\end_layout - -\begin_layout Standard -For files in the read mode, defines if parallel or serial I/O will be used - by model processes for reading file metadata. - The default value is false implying serial I/O for reading metadata. -\end_layout - -\begin_layout Subsection* -convention (optional): -\emph on -enumeration {CF, UGRID} -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: convention -\end_layout - -\begin_layout Standard -Defines the file conventions. - By default the CF conventions are followed. -\end_layout - -\begin_layout Subsection* -convention_str (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: convention_str -\end_layout - -\begin_layout Standard -Defines the -\series bold -Conventions -\series default -attribute to be added to file global attributes. -\end_layout - -\begin_layout Subsection* -append (optional): -\emph on -bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: append -\end_layout - -\begin_layout Standard -Defines whether data is to be appended at the end of a file if it already - exists or if the existing file is to be overwritten. - The default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout - -\emph on -false -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Subsection* -compression_level (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: compression_level -\end_layout - -\begin_layout Standard -Defines whether the fields should be compressed using NetCDF-4 built-in - compression by default. - The compression level must range from 0 to 9. - A higher compression level means a better compression at the cost of using - more processing power. - The default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout - -\emph on -0 -\end_layout - -\end_inset - - (no compression). -\end_layout - -\begin_layout Subsection* -time_counter (optional): -\emph on -enumeration {centered, instant, record, exclusive, centered_exclusive, instant_e -xclusive, none} -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: time_counter -\end_layout - -\begin_layout Standard -Defines how the -\begin_inset Quotes eld -\end_inset - -time_counter -\begin_inset Quotes erd -\end_inset - - variable will be output: -\end_layout - -\begin_layout Itemize - -\series bold -\emph on -centered -\series default -\emph default -: use centered times (default option for all field operations except for - instant) -\end_layout - -\begin_layout Itemize - -\series bold -\emph on -instant -\series default -\emph default -: use instant times (default option for field operation -\series bold -instant -\series default -) -\end_layout - -\begin_layout Itemize - -\series bold -\emph on -record -\series default -\emph default -: use record indexes -\end_layout - -\begin_layout Itemize - -\series bold -\shape italic -centered_exclusive: -\series default -\shape default -do not include centered times into an output file -\end_layout - -\begin_layout Itemize - -\series bold -\shape italic -\emph on -instant_ -\emph default -exclusive: -\series default -\shape default -do not include instant times into an output file -\end_layout - -\begin_layout Itemize - -\series bold -\shape italic -exclusive: -\series default -\shape default -include neither instant times nor centered times into an output file -\end_layout - -\begin_layout Itemize - -\series bold -\emph on -none -\series default -\emph default -: do not output the variable. -\end_layout - -\begin_layout Standard -The default value is -\series bold -\emph on -centered -\series default -\emph default -. -\end_layout - -\begin_layout Subsection* -time_counter_name (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: time_counter_name -\end_layout - -\begin_layout Standard -Define the name of a time counter. -\end_layout - -\begin_layout Subsection* -timeseries (optional): -\emph on -enumeration {none, only, both, exclusive} -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: time_series -\end_layout - -\begin_layout Standard -Defines whether the timeseries must be output: -\end_layout - -\begin_layout Itemize - -\series bold -\emph on -none -\series default -\emph default -: no timeseries is outputted, only the regular file -\end_layout - -\begin_layout Itemize - -\series bold -\emph on -only -\series default -\emph default -: only the timeseries is outputted, the regular file is not created -\end_layout - -\begin_layout Itemize - -\series bold -\emph on -both -\series default -\emph default -: both the timeseries and the regular file are outputted. -\end_layout - -\begin_layout Itemize - -\series bold -\emph on -exclusive -\series default -\emph default -: the timeseries is outputted and a regular file is created with only the - fields which were not marked for output as a timeseries (if any). -\end_layout - -\begin_layout Standard -The default value is -\series bold -\emph on -none -\series default -\emph default -. -\end_layout - -\begin_layout Subsection* -ts_prefix (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: ts_prefix -\end_layout - -\begin_layout Standard -Defines the prefix to use for the name of the timeseries files. - By default the file name will be used. -\end_layout - -\begin_layout Subsection* -time_units (optional): -\emph on -enumeration {seconds, days} -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: time_units -\end_layout - -\begin_layout Subsection* -record_offset (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: record_offset -\end_layout - -\begin_layout Standard -Defines the offset of a record from the beginning record. - The default value is 0. -\end_layout - -\begin_layout Subsection* -cyclic (optional): -\emph on -bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: cyclic -\end_layout - -\begin_layout Standard -If the option is activated for fields to be read, then upon reaching the - last time record, reading will continue -\begin_inset Quotes eld -\end_inset - -cycle -\begin_inset Quotes erd -\end_inset - - at the first time record. - The default value is false. -\end_layout - -\begin_layout Subsection* -time_stamp_name (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: time_stamp_name -\end_layout - -\begin_layout Standard -Defines the timestamp name of the date and time when the program was executed - which will be written into an output file. - The default value is -\begin_inset Quotes eld -\end_inset - -timeStamp -\begin_inset Quotes erd -\end_inset - -. -\end_layout - -\begin_layout Subsection* -time_stamp_format (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: time_stamp_format -\end_layout - -\begin_layout Standard -Defines the timestamp format of the date and time when the program was executed - to be written into an output file. - It can contain any character. - -\emph on - -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -%Y -\end_layout - -\end_inset - - -\emph default - will be replaced by the 4-digit year (4 digits), while -\emph on - -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -%y -\end_layout - -\end_inset - - -\emph default - will be replaced by the 2-digit year. - -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -%m -\end_layout - -\end_inset - - will be by the 2-digit month, while %b will be replaced by the 3-character - month. - -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -%d -\end_layout - -\end_inset - - will be replaced by the day (2 char), -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -%H -\end_layout - -\end_inset - - by the hour (2 char), -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -%M -\end_layout - -\end_inset - - by the minute (2 char), -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -%S -\end_layout - -\end_inset - - by the number of seconds, -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -%D -\end_layout - -\end_inset - - by the date in the MM/DD/YY format. -\end_layout - -\begin_layout Subsection* -uuid_name (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: uuid_name -\end_layout - -\begin_layout Standard -Defines the name of file's UUID. -\end_layout - -\begin_layout Subsection* -uuid_format (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: uuid_format -\end_layout - -\begin_layout Standard -Defines the format of file's UUID. -\end_layout - -\begin_layout Subsection* -comment (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: comment -\end_layout - -\begin_layout Standard -Allows a user to set a comment. -\end_layout - -\begin_layout Section -Transformation attribute reference -\end_layout - -\begin_layout Subsection -reduce_scalar_to_scalar -\end_layout - -\begin_layout Subsection* -operation (mandatory): -\emph on -enumeration {min, max, sum, average} -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: operation -\end_layout - -\begin_layout Standard -Defines a reduction operation performed on a scalar across model processes. - (It is analogous to MPI_Allreduce.) -\end_layout - -\begin_layout Subsection -extract_axis_to_scalar -\end_layout - -\begin_layout Subsection* -position: -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: position -\end_layout - -\begin_layout Standard -Global index of a point on an axis to be extracted into a scalar. -\end_layout - -\begin_layout Standard - -\end_layout - -\begin_layout Subsection -interpolate_axis -\end_layout - -\begin_layout Subsection* -type (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: type -\end_layout - -\begin_layout Standard -Defines the interpolation type on an axis. - For now only polynomial interpolation is available. -\end_layout - -\begin_layout Subsection* -order (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: order -\end_layout - -\begin_layout Standard -Defines the order of interpolation. - The default value is 2. -\end_layout - -\begin_layout Subsection* -coordinate (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: coordinate -\end_layout - -\begin_layout Standard -Defines the coordinate associated with an axis on which interpolation will - be performed. -\end_layout - -\begin_layout Subsection -reduce_axis_to_axis -\end_layout - -\begin_layout Subsection* -operation (mandatory): -\emph on -enumeration {min, max, sum, average} -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: operation -\end_layout - -\begin_layout Standard -Defines a reduction operation performed on an axis across model processes. - (It is analogous to MPI_Allreduce.) -\end_layout - -\begin_layout Subsection -reduce_axis_to_scalar -\end_layout - -\begin_layout Standard -Reduces data defined on an axis into a scalar value. -\end_layout - -\begin_layout Subsection* -operation (mandatory): -\emph on -enumeration {min, max, sum, average} -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: operation -\end_layout - -\begin_layout Subsection -zoom_axis -\end_layout - -\begin_layout Subsection* -begin (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: begin -\end_layout - -\begin_layout Standard -Defines the beginning index of a zoomed region on a global axis. - The attribute value should be an integer between -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -0 -\end_layout - -\end_inset - - and -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -ni_glo-1 -\end_layout - -\end_inset - - of the associated axis. - If not specified the default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -0 -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Subsection* -n (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: n -\end_layout - -\begin_layout Standard -Defines the size of a zoomed region on a global axis. - The attribute value should be an integer between -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -1 -\end_layout - -\end_inset - -and -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -nj_glo -\end_layout - -\end_inset - - of the associated axis. - If not specified the default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -nj_glo -\end_layout - -\end_inset - - of the associated axis. -\end_layout - -\begin_layout Subsection -compute_connectivity_domain -\end_layout - -\begin_layout Subsection* -n_neighbor: -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -1D-array of integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: n_neighbor(:) -\end_layout - -\begin_layout Subsection* -local_neighbor: -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -2D-array of integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: local_neighbor(:,:) -\end_layout - -\begin_layout Subsection* -n_neighbor_max: -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: n_neighbor_max -\end_layout - -\begin_layout Subsection -extract_domain_to_axis -\end_layout - -\begin_layout Subsection* -position (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: position -\end_layout - -\begin_layout Standard -Defines the index on a domain starting which an axis will be extracted along - the direction specified with the -\series bold -direction -\series default - attribute. -\end_layout - -\begin_layout Subsection* -direction (mandatory): -\emph on -enumeration {iDir, jDir} -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: direction -\end_layout - -\begin_layout Standard -Defines the domain dimension along which an axis will be extracted. -\end_layout - -\begin_layout Subsection -interpolate_domain -\end_layout - -\begin_layout Subsection* -file (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: type -\end_layout - -\begin_layout Standard -Define a file which contains the weight values for interpolation from domain - source to domain destination. - If not specified, the internal interpolation module will be used. -\end_layout - -\begin_layout Subsection* -order (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: order -\end_layout - -\begin_layout Standard -Defines the order of interpolation. - This attribute is only for internal interpolation module. - The default value is 2. -\end_layout - -\begin_layout Subsection -reduce_domain_to_axis -\end_layout - -\begin_layout Subsection* -direction: -\emph on -enumeration {iDir, jDir} -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: direction -\end_layout - -\begin_layout Standard -Defines the domain dimension along which a reduction of the domain into - an axis will be performed. -\end_layout - -\begin_layout Subsection* -operation (mandatory): -\emph on -enumeration {min, max, sum, average} -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: operation -\end_layout - -\begin_layout Subsection* -local: -\emph on -bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: local -\end_layout - -\begin_layout Standard -Defines whether the reduction should be performed locally on data owned - by each process. -\end_layout - -\begin_layout Subsection -reduce_domain_to_scalar -\end_layout - -\begin_layout Standard -Reduces data defined on a domain into a scalar value. -\end_layout - -\begin_layout Subsection* -operation (mandatory): -\emph on -enumeration {min, max, sum, average} -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: operation -\end_layout - -\begin_layout Subsection* -local: -\emph on -bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: local -\end_layout - -\begin_layout Standard -Defines whether the reduction should be performed locally on data owned - by each process. -\end_layout - -\begin_layout Subsection -reorder_domain -\end_layout - -\begin_layout Subsection* -invert_lat (optional): -\emph on -bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: invert_lat -\end_layout - -\begin_layout Standard -Defines whether the latitude should be inverted. - The default value is false. -\end_layout - -\begin_layout Subsection* -shift_lon_fraction (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -double -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: shift_lon_fraction -\end_layout - -\begin_layout Standard -Defines the longitude offset. - The value of the parameter represents a fraction of -\series bold -ni_glo -\series default -. -\end_layout - -\begin_layout Subsection* -min_lon (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -double -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: min_lon -\end_layout - -\begin_layout Standard -If both, -\series bold -min_lon -\series default - and -\series bold -max_lon -\series default -, are defined, a domain will be reordered with latitude values starting - from -\series bold -min_lon -\series default - and ending at -\series bold -max_lon -\series default -. -\end_layout - -\begin_layout Subsection* -max_lon (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -double -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: max_lon -\end_layout - -\begin_layout Standard -If both, -\series bold -min_lon -\series default - and -\series bold -max_lon -\series default -, are defined, a domain will be reordered with latitude values starting - from -\series bold -min_lon -\series default - and ending at -\series bold -max_lon -\series default -. -\end_layout - -\begin_layout Subsection -expand_domain -\end_layout - -\begin_layout Subsection* -order: -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: order -\end_layout - -\begin_layout Subsection* -type (optional): -\emph on -enumeration {node, edge} -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: type -\end_layout - -\begin_layout Standard -Defines whether the node or edge connectivity should be calculated for the - expanded domain. -\end_layout - -\begin_layout Subsection* -i_periodic (optional): -\emph on -bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: i_periodic -\end_layout - -\begin_layout Standard -If the attribute value is true, values of fields defined on the expanded - domain will be duplicated from those of the original domain periodically - along the first dimension. - The default value is false (masked values on the expanded domain). -\end_layout - -\begin_layout Subsection* -j_periodic (optional): -\emph on -bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: j_periodic -\end_layout - -\begin_layout Standard -If the attribute value is true, values of fields defined on the expanded - domain will be duplicated from those of the original domain periodically - along the second dimension. - The default value is false (masked values on the expanded domain). -\end_layout - -\begin_layout Subsection -zoom_domain -\end_layout - -\begin_layout Subsection* -ibegin (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: ibegin -\end_layout - -\begin_layout Standard -Defines the beginning index of the zoomed region on the first dimension - of the global domain. - This must be an integer between -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -0 -\end_layout - -\end_inset - - and -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -ni_glo-1 -\end_layout - -\end_inset - - of the associated dimension of domain. - If not specified the default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -0 -\end_layout - -\end_inset - -. - Note that if one of the zoom attributes (ibegin, ni, jbegin or nj) is defined - then all the rest should be specified by a user as well. -\end_layout - -\begin_layout Subsection* -ni (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: ni -\end_layout - -\begin_layout Standard -Define the size of zoomed region on the first dimension of the global domain. - This must be an integer between -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -1 -\end_layout - -\end_inset - -and -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -ni_glo -\end_layout - -\end_inset - - of the associated dimension of domain. - If not specified the default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -ni_glo -\end_layout - -\end_inset - - of the dimension of domain. - Note that if one of the zoom attributes (ibegin, ni, jbegin or nj) is defined - then all the rest should be specified by a user as well. -\end_layout - -\begin_layout Subsection* -jbegin (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: jbegin -\end_layout - -\begin_layout Standard -Define the beginning index of the zoomed region on the second dimension - of the global domain. - This must be an integer between -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -0 -\end_layout - -\end_inset - - and -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -nj_glo-1 -\end_layout - -\end_inset - - of the associated dimension of domain. - If not specified the default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -0 -\end_layout - -\end_inset - -. - Note that if one of the zoom attributes (ibegin, ni, jbegin or nj) is defined - then all the rest should be specified by a user as well. -\end_layout - -\begin_layout Subsection* -nj (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: nj -\end_layout - -\begin_layout Standard -Define the size of zoomed region on the second dimension of the global domain. - The attribute value should be an integer between -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -1 -\end_layout - -\end_inset - -and -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -nj_glo -\end_layout - -\end_inset - - of the associated dimension of domain. - If not specified the default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -nj_glo -\end_layout - -\end_inset - - of the dimension of domain. - Note that if one of the zoom attributes (ibegin, ni, jbegin or nj) is defined - then all the rest should be specified by a user as well. -\end_layout - -\begin_layout Subsection -generate_rectilinear_domain -\end_layout - -\begin_layout Subsection* -lon_start (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -double -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: lon_start -\end_layout - -\begin_layout Standard -Along with -\series bold -lon_end -\series default -, the attribute defines the longitude range of a generated domain. -\end_layout - -\begin_layout Subsection* -lon_end (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -double -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: lon_end -\end_layout - -\begin_layout Standard -Along with -\series bold -lon_start -\series default -, the attribute defines the longitude range of a generated domain. -\end_layout - -\begin_layout Subsection* -lat_start (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -double -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: lat_start -\end_layout - -\begin_layout Standard -Along with -\series bold -lat_end -\series default -, the attribute defines the latitude range of a generated domain. -\end_layout - -\begin_layout Subsection* -lat_end (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -double -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: lat_end -\end_layout - -\begin_layout Standard -Along with -\series bold -lat_start -\series default -, the attribute defines the latitude range of a generated domain. -\end_layout - -\begin_layout Subsection* -bounds_lon_start: -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -double -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: bounds_lon_start -\end_layout - -\begin_layout Standard -Attributes -\series bold -bounds_lon_start -\series default - and -\series bold -bounds_lon_start -\series default - set the longitude range of a generated domain. - If both sets, -\series bold -(lon_start, lon_end) -\series default - and -\series bold -(bounds_lon_start, bounds_lon_end) -\series default -, are specified then the bound attributes will be ignored. -\end_layout - -\begin_layout Subsection* -bounds_lon_end: -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -double -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: bounds_lon_end -\end_layout - -\begin_layout Standard -Attributes -\series bold -bounds_lon_start -\series default - and -\series bold -bounds_lon_start -\series default - set the longitude range of a generated domain. - If both sets, -\series bold -(lon_start, lon_end) -\series default - and -\series bold -(bounds_lon_start, bounds_lon_end) -\series default -, are specified then the bound attributes will be ignored. -\end_layout - -\begin_layout Subsection* -bounds_lat_start: -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -double -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: bounds_lat_start -\end_layout - -\begin_layout Standard -Attributes -\series bold -bounds_lat_start -\series default - and -\series bold -bounds_lat_start -\series default - set the latitude range of a generated domain. - If both sets, -\series bold -(lat_start, lat_end) -\series default - and -\series bold -(bounds_lat_start, bounds_lat_end) -\series default -, are specified then the bound attributes will be ignored. -\end_layout - -\begin_layout Subsection* -bounds_lat_end: -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -double -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: bounds_lat_end -\end_layout - -\begin_layout Standard -Attributes -\series bold -bounds_lat_start -\series default - and -\series bold -bounds_lat_start -\series default - set the latitude range of a generated domain. - If both sets, -\series bold -(lat_start, lat_end) -\series default - and -\series bold -(bounds_lat_start, bounds_lat_end) -\series default -, are specified then the bound attributes will be ignored. -\end_layout - -\begin_layout Chapter -Fortran interface reference -\end_layout - -\begin_layout Section* -Initialization -\end_layout - -\begin_layout Subsection* -XIOS initialization -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_initialize(client_id, local_comm, return_comm) -\end_layout - -\begin_layout LyX-Code - CHARACTER(LEN=*),INTENT(IN) :: client_id -\end_layout - -\begin_layout LyX-Code - INTEGER,INTENT(IN),OPTIONAL :: local_comm -\end_layout - -\begin_layout LyX-Code - INTEGER,INTENT(OUT),OPTIONAL :: return_comm -\end_layout - -\begin_layout Subsubsection* -Argument: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -client_id -\end_layout - -\end_inset - -: client identifier -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -local_comm -\end_layout - -\end_inset - -: MPI communicator of the client -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -return_comm -\end_layout - -\end_inset - -: split return MPI communicator -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This subroutine must be called before any other call of MPI client library. - It may be able to initialize MPI library (calling -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -MPI_Init -\end_layout - -\end_inset - -) if not already initialized. - Since XIOS is able to work in client/server mode (parameter -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -using_server=true -\end_layout - -\end_inset - -), the global communicator must be split and a local split communicator - is returned to be used by the client model for it own purpose. - If more than one model is present, XIOS could be interfaced with the OASIS - coupler (compiled with -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout --using_oasis -\end_layout - -\end_inset - - option and parameter -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -using_oasis=true -\end_layout - -\end_inset - -), so in this case, the splitting would be done globally by OASIS. -\end_layout - -\begin_layout Itemize -If MPI is not initialized, XIOS would initialize it calling MPI_Init function. - In this case, the MPI finalization would be done by XIOS in the -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_finalize -\end_layout - -\end_inset - - subroutine, and must not be done by the model. -\end_layout - -\begin_layout Itemize -If OASIS coupler is not used (using_oasis=false) -\end_layout - -\begin_deeper -\begin_layout Itemize -If server mode is not activated ( -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -using_server=false -\end_layout - -\end_inset - -): if local_comm MPI communicator is specified then it would be used for - internal MPI communication otherwise -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -MPI_COMM_WORLD -\end_layout - -\end_inset - - communicator would be used by default. - A copy of the communicator (of -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -local_comm -\end_layout - -\end_inset - - or -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -MPI_COMM_WORLD -\end_layout - -\end_inset - -) would be returned in return_comm argument. - If -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -return_comm -\end_layout - -\end_inset - - is not specified, then -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -local_comm -\end_layout - -\end_inset - - or -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -MPI_COMM_WORLD -\end_layout - -\end_inset - - can be used by the model for it own communication. -\end_layout - -\begin_layout Itemize -If server mode is activated ( -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -using_server=true -\end_layout - -\end_inset - -): -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -local_comm -\end_layout - -\end_inset - - must not be specified since the global -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -MPI_COMM_WORLD -\end_layout - -\end_inset - - communicator would be split by XIOS. - The split communicator is returned in -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -return_comm -\end_layout - -\end_inset - - argument. -\end_layout - -\end_deeper -\begin_layout Itemize -If OASIS coupler is used ( -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -using_oasis=true -\end_layout - -\end_inset - -) -\end_layout - -\begin_deeper -\begin_layout Itemize -If server mode is not enabled ( -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -using_server=false -\end_layout - -\end_inset - -) -\end_layout - -\begin_deeper -\begin_layout Itemize -If -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -local_comm -\end_layout - -\end_inset - - is specified, it means that OASIS has been initialized by the model and - global communicator has been already split previously by OASIS, and passed - as -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -local_comm -\end_layout - -\end_inset - - argument. - The returned communicator would be a duplicate copy of -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -local_comm -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Itemize -Otherwise: if MPI was not initialized, OASIS will be initialized calling - -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -prism_init_comp_proto -\end_layout - -\end_inset - - subroutine. - In this case, XIOS will call -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -prism_terminate_proto -\end_layout - -\end_inset - - when -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_finalized -\end_layout - -\end_inset - - is called. - The split communicator is returned in -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -return_comm -\end_layout - -\end_inset - - argument using -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -prism_get_localcomm_proto -\end_layout - -\end_inset - - return argument. -\end_layout - -\end_deeper -\begin_layout Itemize -If server mode is enabled ( -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -using_server=true -\end_layout - -\end_inset - -) -\end_layout - -\begin_deeper -\begin_layout Itemize -If -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -local_comm -\end_layout - -\end_inset - - is specified, it means that OASIS has been initialized by the model and - global communicator has been already split previously by OASIS, and passed - as local_comm argument. - The returned communicator return_comm would be a split communicator given - by OASIS. -\end_layout - -\begin_layout Itemize -Otherwise: if MPI was not initialized, OASIS will be initialized calling - -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -prism_init_comp_proto -\end_layout - -\end_inset - - subroutine. - In this case, XIOS will call -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -prism_terminate_proto -\end_layout - -\end_inset - - when -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_finalized -\end_layout - -\end_inset - - is called. - The split communicator is returned in -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -return_comm -\end_layout - -\end_inset - - argument using -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -prism_get_localcomm_proto -\end_layout - -\end_inset - - return argument. -\end_layout - -\end_deeper -\end_deeper -\begin_layout Section* -Finalization -\end_layout - -\begin_layout Subsection* -XIOS finalization -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_finalize() -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Standard -None -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This call must be done at the end of the simulation for a successful execution. - It gives the end signal to the xios server pools to finish it execution. - If MPI has been initialize by XIOS the MPI_Finalize will be called. - If OASIS coupler has been initialized by XIOS, then finalization will be - done calling -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -prism_terminate_proto -\end_layout - -\end_inset - - subroutine. -\end_layout - -\begin_layout Section* -Tree elements management subroutines -\end_layout - -\begin_layout Standard -This set of subroutines enables the models to interact, complete or query - the XML tree data base. - New elements or group of elements can be added as child in the tree, attributes - of the elements can be set or query. - The type of elements currently available are: context, axis, domain, grid, - field, variable and file. - An element can be identified by a string or by an handle associated to - the type of the element. - Root element (ex: -\begin_inset Quotes eld -\end_inset - -axis_definition -\begin_inset Quotes erd -\end_inset - -, -\begin_inset Quotes eld -\end_inset - -field_definition -\begin_inset Quotes erd -\end_inset - -,....) are considered like a group of element and are identified by a specific - string -\begin_inset Quotes eld -\end_inset - -element_definition -\begin_inset Quotes erd -\end_inset - - where element can be any one of the existing elements. -\end_layout - -\begin_layout Subsection* -Fortran type of the handles element -\end_layout - -\begin_layout Quotation -TYPE(xios_element) -\end_layout - -\begin_layout Standard -where -\begin_inset Quotes eld -\end_inset - -element -\begin_inset Quotes erd -\end_inset - - can be any one among -\begin_inset Quotes eld -\end_inset - -context -\begin_inset Quotes erd -\end_inset - -, -\begin_inset Quotes eld -\end_inset - -axis -\begin_inset Quotes erd -\end_inset - -, -\begin_inset Quotes eld -\end_inset - -domain -\begin_inset Quotes erd -\end_inset - -, -\begin_inset Quotes eld -\end_inset - -grid -\begin_inset Quotes erd -\end_inset - -, -\begin_inset Quotes eld -\end_inset - -field -\begin_inset Quotes erd -\end_inset - -, -\begin_inset Quotes eld -\end_inset - -variable -\begin_inset Quotes erd -\end_inset - - or -\begin_inset Quotes eld -\end_inset - -file -\begin_inset Quotes erd -\end_inset - -, or the associated group (excepted for context): -\begin_inset Quotes eld -\end_inset - -axis_group -\begin_inset Quotes erd -\end_inset - -, -\begin_inset Quotes eld -\end_inset - -domain_group -\begin_inset Quotes erd -\end_inset - -, -\begin_inset Quotes eld -\end_inset - -grid_group -\begin_inset Quotes erd -\end_inset - -, -\begin_inset Quotes eld -\end_inset - -field_group -\begin_inset Quotes erd -\end_inset - -, -\begin_inset Quotes eld -\end_inset - -variable_group -\begin_inset Quotes erd -\end_inset - - or -\begin_inset Quotes eld -\end_inset - -file_group -\begin_inset Quotes erd -\end_inset - -. -\end_layout - -\begin_layout Subsection* -Getting handles -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_get_element_handle(id,handle) -\end_layout - -\begin_layout LyX-Code -CHARACTER(len = *) , INTENT(IN) :: id -\end_layout - -\begin_layout LyX-Code -TYPE(xios_element), INTENT(OUT):: handle -\end_layout - -\begin_layout Standard -where element is one of the existing elements or group of elements. -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -id -\end_layout - -\end_inset - -: string identifier. -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -handle -\end_layout - -\end_inset - -: element handle -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This subroutine returns the handle of the specified element identified by - its string. - The element must be existing otherwise an error is raised. -\end_layout - -\begin_layout Subsection* -Query for a valid element -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -LOGICAL FUNCTION xios_is_valid_element(id) -\end_layout - -\begin_layout LyX-Code -CHARACTER(len = *) , INTENT(IN) :: id -\end_layout - -\begin_layout Standard -where element is one of the existing elements or group of elements. -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -id -\end_layout - -\end_inset - -: string identifier. -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This function returns .TRUE. - if the element defined by the string identifier -\begin_inset Quotes eld -\end_inset - -id -\begin_inset Quotes erd -\end_inset - - exists in the data base, otherwise it returns .FALSE. - . -\end_layout - -\begin_layout Subsection* -Adding child -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_add_element(parent_handle, child_handle, child_id) -\end_layout - -\begin_layout LyX-Code -TYPE(xios_element) , INTENT(IN) :: parent_handle -\end_layout - -\begin_layout LyX-Code -TYPE(xios_element) , INTENT(OUT):: child_handle -\end_layout - -\begin_layout LyX-Code -CHARACTER(len = *), OPTIONAL, INTENT(IN) :: child_id -\end_layout - -\begin_layout Standard -where element is one of the existing elements or element groups. -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -parent_handle -\end_layout - -\end_inset - -: handle of the parent element. -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -child_handle -\end_layout - -\end_inset - -: handle of the child element. -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -child_id -\end_layout - -\end_inset - -: string identifier of the child. -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This subroutine adds a child to an existing parent element. - The identifier of the child, if existing, can be specified optionally. - All group elements can contain child of the same type, provided generic - inheritance. - Some elements can contain children of another type for a specific behavior. - File element may contain field_group, field, variable and variable_group - child elements. - Field elements may contain variable_group of variable child element. -\end_layout - -\begin_layout Subsection* -Query if the value of an element attribute is defined (by handle) -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_is_defined_attr(handle, attr_1=attribute_1, attr_2=attribute_2, - ...) -\end_layout - -\begin_layout LyX-Code -TYPE(xios_element) , INTENT(IN) :: handle -\end_layout - -\begin_layout LyX-Code -LOGICAL, OPTIONAL , INTENT(OUT) :: attr_1 -\end_layout - -\begin_layout LyX-Code -LOGICAL, OPTIONAL , INTENT(OUT) :: attr_2 -\end_layout - -\begin_layout LyX-Code -.... -\end_layout - -\begin_layout Standard -where element is one of the existing elements or element groups. - attribute_x is describing in the chapter dedicated to the attribute description. -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -handle -\end_layout - -\end_inset - -: element handle. -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -attr_x -\end_layout - -\end_inset - -: return true if the attribute as a defined value. -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This subroutine can be used to query if one or more attributes of an element - have a defined value. - The list of attributes and their type are described in a specific chapter - of the documentation. - -\end_layout - -\begin_layout Subsection* -Query if a value of an element attributes is defined (by identifier) -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_is_defined_element_attr(id, attr_1=attribute_1, attr_2=attribute -_2, ...) -\end_layout - -\begin_layout LyX-Code -CHARACTER(len = *) , INTENT(IN) :: id -\end_layout - -\begin_layout LyX-Code -LOGICAL, OPTIONAL , INTENT(OUT) :: attr_1 -\end_layout - -\begin_layout LyX-Code -LOGICAL, OPTIONAL , INTENT(OUT) :: attr_2 -\end_layout - -\begin_layout LyX-Code -.... -\end_layout - -\begin_layout Standard -where element is one of the existing elements or element groups. - attribute_x is describing in the chapter dedicated to the attribute description. -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -id -\end_layout - -\end_inset - -: element identifier. -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -attr_x -\end_layout - -\end_inset - -: return true if the attribute as a defined value. -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This subroutine can be used to query if one or more attributes of an element - have a defined value. - The list of available attributes and their type are described in a specific - chapter of the documentation. - -\end_layout - -\begin_layout Subsection* -Setting element attributes value by handle -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_set_attr(handle, attr_1=attribute_1, attr_2=attribute_2, - ...) -\end_layout - -\begin_layout LyX-Code -TYPE(xios_element) , INTENT(IN) :: handle -\end_layout - -\begin_layout LyX-Code -attribute_type_1, OPTIONAL , INTENT(IN) :: attr_1 -\end_layout - -\begin_layout LyX-Code -attribute_type_2, OPTIONAL , INTENT(IN) :: attr_2 -\end_layout - -\begin_layout LyX-Code -.... -\end_layout - -\begin_layout Standard -where element is one of the existing elements or element groups. - attribute_x and attribute_type_x are describing in the chapter dedicated - to the attribute description. -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -handle -\end_layout - -\end_inset - -: element handle. -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -attr_x -\end_layout - -\end_inset - -: value of the attribute to be set. -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This subroutine can be used to set one or more attributes of an element - defined by its handle. - The list of available attributes and their types are described in corresponding - chapters of the documentation. - -\end_layout - -\begin_layout Subsection* -Setting element attributes value by id -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_set_element_attr(id, attr_1=attribute_1, attr_2=attribute_2, - ...) -\end_layout - -\begin_layout LyX-Code -CHARACTER(len = *), INTENT(IN) :: id -\end_layout - -\begin_layout LyX-Code -attribute_type_1, OPTIONAL , INTENT(IN) :: attr_1 -\end_layout - -\begin_layout LyX-Code -attribute_type_2, OPTIONAL , INTENT(IN) :: attr_2 -\end_layout - -\begin_layout LyX-Code -.... -\end_layout - -\begin_layout Standard -where element is one of the existing elements or element groups. - The attributes attribute_x and attribute_type_x are described in corresponding - chapters. -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -id -\end_layout - -\end_inset - -: string identifier. -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -attr_x -\end_layout - -\end_inset - -: value of the attribute to be set. -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This subroutine can be used to set one or more attributes of an element - defined by its string id. - The list of available attributes and their type are described in corresponding - chapters of the documentation. -\end_layout - -\begin_layout Subsection* -Getting element attributes value (by handle) -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_get_attr(handle, attr_1=attribute_1, attr_2=attribute_2, - ...) -\end_layout - -\begin_layout LyX-Code -TYPE(xios_element) , INTENT(IN) :: handle -\end_layout - -\begin_layout LyX-Code -attribute_type_1, OPTIONAL , INTENT(OUT) :: attr_1 -\end_layout - -\begin_layout LyX-Code -attribute_type_2, OPTIONAL , INTENT(OUT) :: attr_2 -\end_layout - -\begin_layout LyX-Code -.... -\end_layout - -\begin_layout Standard -where element is one of the existing elements or element groups. - attribute_x and attribute_type_x are describing in the chapter dedicated - to the attribute description. -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -handle -\end_layout - -\end_inset - -: element handle. -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -attr_x -\end_layout - -\end_inset - -: value of the attribute to be get. -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This subroutine can be used to get one or more attribute value of an element - defined by its handle. - All attributes in the arguments list must be defined. - The list of available attributes and their type are described in a specific - chapter of the documentation. - -\end_layout - -\begin_layout Subsection* -Getting element attributes value (by identifier) -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_get_element_attr(id, attr_1=attribute_1, attr_2=attribute_2, - ...) -\end_layout - -\begin_layout LyX-Code -CHARACTER(len = *), INTENT(IN) :: id -\end_layout - -\begin_layout LyX-Code -attribute_type_1, OPTIONAL , INTENT(OUT) :: attr_1 -\end_layout - -\begin_layout LyX-Code -attribute_type_2, OPTIONAL , INTENT(OUT) :: attr_2 -\end_layout - -\begin_layout LyX-Code -.... -\end_layout - -\begin_layout Standard -where element is one of the existing elements or element groups. - attribute_x is describing in the chapter dedicated to the attribute description. -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -id -\end_layout - -\end_inset - -: element string identifier. -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -attr_x -\end_layout - -\end_inset - -: value of the attribute to be get. -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This subroutine can be used to get one or more attribute value of an element - defined by its handle. - All attributes in the arguments list must have a defined value. - The list of available attributes and their type are described in a specific - chapter of the documentation. -\end_layout - -\begin_layout Section* -Context management interface -\end_layout - -\begin_layout Subsection* -XIOS context initialization -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_context_initialize(context_id, context_comm) -\end_layout - -\begin_layout LyX-Code - CHARACTER(LEN=*),INTENT(IN) :: context_id -\end_layout - -\begin_layout LyX-Code - INTEGER,INTENT(IN) :: context_comm -\end_layout - -\begin_layout Subsubsection* -Argument: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -context_id -\end_layout - -\end_inset - -: context identifier -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -context_comm -\end_layout - -\end_inset - -: MPI communicator of the context -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This subroutine initializes a context identified by -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -context_id -\end_layout - -\end_inset - - string and must be called before any call related to this context. - A context must be associated to a communicator, which can be the returned - communicator of the -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_initialize -\end_layout - -\end_inset - - subroutine or a sub-communicator of this. - The context initialization is dynamic and can be done at any time before - the -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_finalize -\end_layout - -\end_inset - - call. -\end_layout - -\begin_layout Subsection* -XIOS context finalization -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_context_finalize() -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Standard -None -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This subroutine must be called to close a context before the -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_finalize -\end_layout - -\end_inset - - call. - It waits until that all pending requests sent to the servers will be processed - and all opened files will be closed. -\end_layout - -\begin_layout Subsection* -Setting current active context -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_set_current_context(context_handle) -\end_layout - -\begin_layout LyX-Code -TYPE(xios_context),INTENT(IN) :: context_handle -\end_layout - -\begin_layout Standard -or -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_set_current_context(context_id) -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*),INTENT(IN) :: context_id -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -context_handle -\end_layout - -\end_inset - -: handle of the context -\end_layout - -\begin_layout Standard -or -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -context_id -\end_layout - -\end_inset - -: string context identifier -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -These subroutines set the current active context. - All following XIOS calls will refer to this active context. - If only one context is defined, it will be set automatically as the active - context. - -\end_layout - -\begin_layout Subsection* -Closing definition -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_close_context_definition() -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Standard -None -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This subroutine must be called when all definitions of a context are finished - at the end of the initialization and before entering to the time loop. - A lot of operations are performed internally (inheritance, grid definition, - contacting servers,...) so this call is mandatory. - Any call related to the tree management definition done after will have - an undefined effect. -\end_layout - -\begin_layout Section* -Calendar management interface -\end_layout - -\begin_layout Subsection* -Creating the calendar -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_define_calendar(type, timestep, start_date, time_origin, - & -\begin_inset Newline newline -\end_inset - - day_length, month_lengths, year_length, - & -\begin_inset Newline newline -\end_inset - - leap_year_month, leap_year_drift, & -\begin_inset Newline newline -\end_inset - - leap_year_drift_offset) -\begin_inset Newline newline -\end_inset - -CHARACTER(len = *), INTENT(IN) :: type -\begin_inset Newline newline -\end_inset - -TYPE(xios_duration), OPTIONAL, INTENT(IN) :: timestep -\begin_inset Newline newline -\end_inset - -TYPE(xios_date), OPTIONAL, INTENT(IN) :: start_date -\begin_inset Newline newline -\end_inset - -TYPE(xios_date), OPTIONAL, INTENT(IN) :: time_origin -\begin_inset Newline newline -\end_inset - -INTEGER, OPTIONAL, INTENT(IN) :: day_length -\begin_inset Newline newline -\end_inset - -INTEGER, OPTIONAL, INTENT(IN) :: month_lengths(:) -\begin_inset Newline newline -\end_inset - -INTEGER, OPTIONAL, INTENT(IN) :: year_length -\begin_inset Newline newline -\end_inset - -DOUBLE PRECISION, OPTIONAL, INTENT(IN) :: leap_year_drift -\begin_inset Newline newline -\end_inset - -DOUBLE PRECISION, OPTIONAL, INTENT(IN) :: leap_year_drift_offset -\begin_inset Newline newline -\end_inset - -INTEGER, OPTIONAL, INTENT(IN) :: leap_year_month -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -type -\end_layout - -\end_inset - -: the calendar type, one of -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -"Gregorian" -\end_layout - -\end_inset - -, -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -"Julian" -\end_layout - -\end_inset - -, -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -"D360" -\end_layout - -\end_inset - -, -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -"AllLeap" -\end_layout - -\end_inset - -, -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -"NoLeap" -\end_layout - -\end_inset - -, -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -"user_defined" -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -timestep -\end_layout - -\end_inset - -: the time step of the simulation (optional, can be set later) -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -start_date -\end_layout - -\end_inset - -: the start date of the simulation (optional, -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_date(0000, 01, 01, 00, 00, 00) -\end_layout - -\end_inset - - is used by default) -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -time_origin -\end_layout - -\end_inset - -: the origin of the time axis (optional, -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_date(0000, 01, 01, 00, 00, 00) -\end_layout - -\end_inset - - is used by default) -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -day_length -\end_layout - -\end_inset - -: the length of a day in seconds (mandatory when creating an user defined - calendar, must not be set otherwise) -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -month_lengths -\end_layout - -\end_inset - -: the length of each month of the year in days (either -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -month_lengths -\end_layout - -\end_inset - - or -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -year_length -\end_layout - -\end_inset - - must be set when creating an user defined calendar, must not be set otherwise) -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -year_length -\end_layout - -\end_inset - -: the length of a year in seconds (either -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -month_lengths -\end_layout - -\end_inset - - or -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -year_length -\end_layout - -\end_inset - - must be set when creating an user defined calendar, must not be set otherwise) -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -leap_year_drift -\end_layout - -\end_inset - -: the yearly drift between the user defined calendar and the astronomical - calendar, expressed as a fraction of day (can optionally be set when creating - an user defined calendar in which case -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -leap_year_month -\end_layout - -\end_inset - - must be set too) -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -leap_year_drift_offset -\end_layout - -\end_inset - -: the initial drift between the user defined calendar and the astronomical - calendar at the time origin, expressed as a fraction of day (can optionally - be set if -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -leap_year_drift -\end_layout - -\end_inset - - and -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -leap_year_month -\end_layout - -\end_inset - - are set) -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -leap_year_month -\end_layout - -\end_inset - -: the month to which an extra day must be added in case of leap year (can - optionally be set when creating an user defined calendar in which case - -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -leap_year_drift -\end_layout - -\end_inset - - must be set too) -\end_layout - -\begin_layout Standard -For a more detailed description of those arguments, see the description - of the corresponding attributes in section 1.2 -\begin_inset Quotes eld -\end_inset - -Calendar attribute reference -\begin_inset Quotes erd -\end_inset - -. -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This subroutine creates the calendar for the current context. - Note that the calendar is created once and for all, either from the XML - configuration file or the Fortran interface. - If it was not created from the configuration file, then this subroutine - must be called once and only once before the context definition is closed. - The calendar features can be used immediately after the calendar was created. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -If an user defined calendar is created, the following arguments must also - be provided: -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -day_length -\end_layout - -\end_inset - - and either -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -month_lengths -\end_layout - -\end_inset - - or -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -year_length -\end_layout - -\end_inset - -. - Optionally it is possible to configure the user defined calendar to have - leap years. - In this case, -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -leap_year_drift -\end_layout - -\end_inset - - and -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -leap_year_month -\end_layout - -\end_inset - - must also be provided and -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -leap_year_drift_offset -\end_layout - -\end_inset - - might be used. -\end_layout - -\begin_layout Subsection* -Accessing the calendar type of the current calendar -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_get_calendar_type(calendar_type) -\begin_inset Newline newline -\end_inset - -CHARACTER(len=*), INTENT(OUT) :: calendar_type -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -calendar_type -\end_layout - -\end_inset - -: on output, the type of the calendar attached to the current context -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This subroutine gets the calendar type associated to the current context. - It will raise an error if used before the calendar was created. -\end_layout - -\begin_layout Subsection* -Accessing and defining the time step of the current calendar -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_get_timestep(timestep) -\begin_inset Newline newline -\end_inset - -TYPE(xios_duration), INTENT(OUT) :: timestep -\end_layout - -\begin_layout Standard -and -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_set_timestep(timestep) -\begin_inset Newline newline -\end_inset - -TYPE(xios_duration), INTENT(IN) :: timestep -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -timestep -\end_layout - -\end_inset - -: a duration corresponding to the time step of the simulation -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -Those subroutines respectively gets and sets the time step associated to - the calendar of the current context. - Note that the time step must always be set before the context definition - is closed and that an error will be raised if the getter subroutine is - used before the time step is defined. -\end_layout - -\begin_layout Subsection* -Accessing and defining the start date of the current calendar -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_get_start_date(start_date) -\begin_inset Newline newline -\end_inset - -TYPE(xios_date), INTENT(OUT) :: start_date -\end_layout - -\begin_layout Standard -and -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_set_start_date(start_date) -\begin_inset Newline newline -\end_inset - -TYPE(xios_date), INTENT(IN) :: start_date -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -start_date -\end_layout - -\end_inset - -: a date corresponding to the beginning of the simulation -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -Those subroutines respectively gets and sets the start date associated to - the calendar of the current context. - They must not be used before the calendar was created. -\end_layout - -\begin_layout Subsection* -Accessing and defining the time origin of the current calendar -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_get_time_origin(time_origin) -\begin_inset Newline newline -\end_inset - -TYPE(xios_date), INTENT(OUT) :: time_origin -\end_layout - -\begin_layout Standard -and -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_set_time_date(time_origin) -\begin_inset Newline newline -\end_inset - -TYPE(xios_date), INTENT(IN) :: time_origin -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -start_date -\end_layout - -\end_inset - -: a date corresponding to the origin of the time axis -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -Those subroutines respectively gets and sets the origin of time associated - to the calendar of the current context. - They must not be used before the calendar was created. -\end_layout - -\begin_layout Subsection* -Updating the current date of the current calendar -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_update_calendar(step) -\begin_inset Newline newline -\end_inset - -INTEGER, INTENT(IN) :: step -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -step -\end_layout - -\end_inset - -: the current iteration number -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This subroutine sets the current date associated to the calendar of the - current context based on the current iteration number: -\begin_inset Formula $current\_date=start\_date+step\times timestep$ -\end_inset - -. - It must not be used before the calendar was created. -\end_layout - -\begin_layout Subsection* -Accessing the current date of the current calendar -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_get_current_date(current_date) -\begin_inset Newline newline -\end_inset - -TYPE(xios_date), INTENT(OUT) :: current_date -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -current_date -\end_layout - -\end_inset - -: on output, the current date -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This subroutine gets the current date associated to the calendar of the - current context. - It must not be used before the calendar was created. -\end_layout - -\begin_layout Subsection* -Accessing the year length of the current calendar -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -INTEGER FUNCTION xios_get_year_length_in_seconds(year) -\begin_inset Newline newline -\end_inset - -INTEGER, INTENT(IN) :: year -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -year -\end_layout - -\end_inset - -: the year whose length is requested -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This function returns the duration in seconds of the specified year, taking - leap years into account based on the calendar of the current context. - It must not be used before the calendar was created. -\end_layout - -\begin_layout Subsection* -Accessing the day length of the current calendar -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -INTEGER FUNCTION xios_get_day_length_in_seconds() -\end_layout - -\begin_layout Subsubsection* -Arguments: None -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This function returns the duration in seconds of a day, based on the calendar - of the current context. - It must not be used before the calendar was created. -\end_layout - -\begin_layout Section* -Duration handling interface -\end_layout - -\begin_layout Subsection* -Duration constants -\end_layout - -\begin_layout Standard -Some duration constants are available to ease duration handling: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_year -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_month -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_day -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_hour -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_minute -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_second -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_timestep -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Subsection* -Arithmetic operations on durations -\end_layout - -\begin_layout Standard -The following arithmetic operations on durations are available: -\end_layout - -\begin_layout Itemize -Addition: -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_duration = xios_duration + xios_duration -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -Subtraction: -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_duration = xios_duration - xios_duration -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -Multiplication by a scalar value: -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_duration = scalar * xios_duration -\end_layout - -\end_inset - - or -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_duration = xios_duration * scalar -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -Negation: -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_duration = -xios_duration -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Subsection* -Comparison operations on durations -\end_layout - -\begin_layout Standard -The following comparison operations on durations are available: -\end_layout - -\begin_layout Itemize -Equality: -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -LOGICAL = xios_duration == xios_duration -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -Inequality: -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -LOGICAL = xios_duration /= xios_duration -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Section* -Interface relative to date handling -\end_layout - -\begin_layout Subsection* -Arithmetic operations on dates -\end_layout - -\begin_layout Standard -The following arithmetic operations on dates are available: -\end_layout - -\begin_layout Itemize -Addition of a duration: -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_date = xios_date + xios_duration -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -Subtraction of a duration: -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_date = xios_date - xios_duration -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -Subtraction of two dates: -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_duration = xios_date - xios_date -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Subsection* -Comparison operations on dates -\end_layout - -\begin_layout Standard -The following comparison operations on dates are available: -\end_layout - -\begin_layout Itemize -Equality: -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -LOGICAL = xios_date == xios_date -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -Inequality: -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -LOGICAL = xios_date /= xios_date -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -Less than: -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -LOGICAL = xios_date < xios_date -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -Less or equal: -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -LOGICAL = xios_date <= xios_date -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -Greater than: -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -LOGICAL = xios_date > xios_date -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -Greater or equal: -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -LOGICAL = xios_date >= xios_date -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Subsection* -Converting a date to a number of seconds since the time origin -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -FUNCTION INTEGER(kind = 8) xios_date_convert_to_seconds(date) -\begin_inset Newline newline -\end_inset - -TYPE(xios_date), INTENT(IN) :: date -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -date -\end_layout - -\end_inset - -: the date to convert -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This function returns the number of seconds since the time origin for the - specified date, based on the calendar of the current context. - It must not be used before the calendar was created. -\end_layout - -\begin_layout Subsection* -Converting a date to a number of seconds since the beginning of the year -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -FUNCTION INTEGER xios(date_get_second_of_year)(date) -\begin_inset Newline newline -\end_inset - -TYPE(xios_date), INTENT(IN) :: date -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -date -\end_layout - -\end_inset - -: the date to convert -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This function returns the number of seconds since the beginning of the year - for the specified date, based on the calendar of the current context. - It must not be used before the calendar was created. -\end_layout - -\begin_layout Subsection* -Converting a date to a number of days since the beginning of the year -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -FUNCTION DOUBLE_PRECISION xios_date_get_day_of_year(date) -\begin_inset Newline newline -\end_inset - -TYPE(xios_date), INTENT(IN) :: date -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -date -\end_layout - -\end_inset - -: the date to convert -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This function returns the number of days since the beginning of the year - for the specified date, based on the calendar of the current context. - It must not be used before the calendar was created. -\end_layout - -\begin_layout Subsection* -Converting a date to a fraction of the current year -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -FUNCTION DOUBLE_PRECISION xios_date_get_fraction_of_year(date) -\begin_inset Newline newline -\end_inset - -TYPE(xios_date), INTENT(IN) :: date -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -date -\end_layout - -\end_inset - -: the date to convert -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This function returns the fraction of year corresponding to the specified - date, based on the calendar of the current context. - It must not be used before the calendar was created. -\end_layout - -\begin_layout Subsection* -Converting a date to a number of seconds since the beginning of the day -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -FUNCTION INTEGER xios(date_get_second_of_day)(date) -\begin_inset Newline newline -\end_inset - -TYPE(xios_date), INTENT(IN) :: date -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -date -\end_layout - -\end_inset - -: the date to convert -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This function returns the number of seconds since the beginning of the day - for the specified date, based on the calendar of the current context. - It should not be used before the calendar was created. -\end_layout - -\begin_layout Subsection* -Converting a date to a fraction of the current day -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -FUNCTION DOUBLE_PRECISION xios_date_get_fraction_of_day(date) -\begin_inset Newline newline -\end_inset - -TYPE(xios_date), INTENT(IN) :: date -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -date -\end_layout - -\end_inset - -: the date to convert -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This function returns the fraction of day corresponding to the specified - date based on the calendar of the current context. - It should not be used before the calendar was created. -\end_layout - -\end_body -\end_document +#LyX 2.3 created this file. For more info see http://www.lyx.org/ +\lyxformat 544 +\begin_document +\begin_header +\save_transient_properties true +\origin unavailable +\textclass book +\use_default_options true +\begin_modules +logicalmkup +\end_modules +\maintain_unincluded_children false +\language english +\language_package auto +\inputencoding auto +\fontencoding global +\font_roman "default" "default" +\font_sans "default" "default" +\font_typewriter "default" "default" +\font_math "auto" "auto" +\font_default_family default +\use_non_tex_fonts false +\font_sc false +\font_osf false +\font_sf_scale 100 100 +\font_tt_scale 100 100 +\use_microtype false +\use_dash_ligatures false +\graphics default +\default_output_format default +\output_sync 0 +\bibtex_command default +\index_command default +\paperfontsize default +\spacing single +\use_hyperref false +\papersize a4paper +\use_geometry false +\use_package amsmath 1 +\use_package amssymb 1 +\use_package cancel 1 +\use_package esint 1 +\use_package mathdots 1 +\use_package mathtools 1 +\use_package mhchem 1 +\use_package stackrel 1 +\use_package stmaryrd 1 +\use_package undertilde 1 +\cite_engine basic +\cite_engine_type default +\biblio_style plain +\use_bibtopic false +\use_indices false +\paperorientation portrait +\suppress_date false +\justification true +\use_refstyle 0 +\use_minted 0 +\index Index +\shortcut idx +\color #008000 +\end_index +\secnumdepth 3 +\tocdepth 3 +\paragraph_separation indent +\paragraph_indentation default +\is_math_indent 0 +\math_numbering_side default +\quotes_style english +\dynamic_quotes 0 +\papercolumns 1 +\papersides 1 +\paperpagestyle default +\tracking_changes false +\output_changes false +\html_math_output 0 +\html_css_as_file 0 +\html_be_strict false +\end_header + +\begin_body + +\begin_layout Title +XIOS Fortran Reference Guide +\end_layout + +\begin_layout Chapter +Attribute reference +\end_layout + +\begin_layout Section +Context attribute reference +\end_layout + +\begin_layout Section +Calendar attribute reference +\end_layout + +\begin_layout Subsection* +type: +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +enumeration {Gregorian, Julian, D360, AllLeap, NoLeap, user_defined} +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: type +\end_layout + +\begin_layout Standard +Define the calendar used for the current context. + This attribute is mandatory and cannot be modified once it has been set. +\begin_inset Newline newline +\end_inset + + +\begin_inset Newline newline +\end_inset + +When using the Fortran interface, this attribute must be defined using the + following subroutine: +\end_layout + +\begin_layout LyX-Code +SUBROUTINE xios_define_calendar(type, timestep, start_date, time_origin, +\begin_inset Newline newline +\end_inset + + day_length, month_lengths, year_length, +\begin_inset Newline newline +\end_inset + + leap_year_month, leap_year_drift, +\begin_inset Newline newline +\end_inset + + leap_year_drift_offset) +\end_layout + +\begin_layout Subsection* +start_date: +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +date +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +TYPE(xios_date) :: start_date +\end_layout + +\begin_layout Standard +Define the start date of the simulation for the current context. + This attribute is optional, the default value is +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout + +\series bold +0000-01-01 00:00:00 +\end_layout + +\end_inset + +. + The +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +type +\end_layout + +\end_inset + + attribute must always be set at the same time or before this attribute + is defined. +\begin_inset Newline newline +\end_inset + + +\begin_inset Newline newline +\end_inset + +A partial date is allowed in the configuration file as long as the omitted + parts are at the end, in which case they are initialized as in the default + value. + Optionally an offset can be added to the date using the notation " +\emph on ++ duration +\emph default +". + +\begin_inset Newline newline +\end_inset + + +\begin_inset Newline newline +\end_inset + +When using the Fortran interface, this attribute can be defined at the same + time as the calendar +\series bold +type +\series default +: +\end_layout + +\begin_layout LyX-Code +SUBROUTINE xios_define_calendar(type, timestep, start_date, time_origin, +\begin_inset Newline newline +\end_inset + + day_length, month_lengths, year_length, +\begin_inset Newline newline +\end_inset + + leap_year_month, leap_year_drift, +\begin_inset Newline newline +\end_inset + + leap_year_drift_offset) +\end_layout + +\begin_layout Standard +or later using the following subroutine: +\end_layout + +\begin_layout LyX-Code +SUBROUTINE xios_set_start_date(start_date) +\end_layout + +\begin_layout Subsection* +time_origin: +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +date +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +TYPE(xios_date) :: time_origin +\end_layout + +\begin_layout Standard +Define the time origin of a time axis. + It will appear as metadata attached to the time axis in an output file. + This attribute is optional, the default value is +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout + +\series bold +0000-01-01 00:00:00 +\end_layout + +\end_inset + +. + The +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +type +\end_layout + +\end_inset + + attribute must always be set at the same time or before this attribute + is defined. +\begin_inset Newline newline +\end_inset + + +\begin_inset Newline newline +\end_inset + +A partial date is allowed in the configuration file as long as the omitted + parts are at the end, in which case they are initialized as in the default + value. + Optionally an offset can be added to the date using the notation " +\emph on ++ duration +\emph default +". + +\begin_inset Newline newline +\end_inset + + +\begin_inset Newline newline +\end_inset + +When using the Fortran interface, this attribute can be defined at the same + time as the calendar +\series bold +type +\series default +: +\end_layout + +\begin_layout LyX-Code +SUBROUTINE xios_define_calendar(type, timestep, start_date, time_origin, +\begin_inset Newline newline +\end_inset + + day_length, month_lengths, year_length, +\begin_inset Newline newline +\end_inset + + leap_year_month, leap_year_drift, +\begin_inset Newline newline +\end_inset + + leap_year_drift_offset) +\end_layout + +\begin_layout Standard +or later using the following subroutine: +\end_layout + +\begin_layout LyX-Code +SUBROUTINE xios_set_time_origin(time_origin) +\end_layout + +\begin_layout Subsection* +timestep: +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +duration +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +TYPE(xios_duration) :: timestep +\end_layout + +\begin_layout Standard +Define the time step of the simulation for the current context. + This attribute is mandatory. +\begin_inset Newline newline +\end_inset + + +\begin_inset Newline newline +\end_inset + +When using the Fortran interface, this attribute can be defined at the same + time as the calendar +\series bold +type +\series default +: +\end_layout + +\begin_layout LyX-Code +SUBROUTINE xios_define_calendar(type, timestep, start_date, time_origin, +\begin_inset Newline newline +\end_inset + + day_length, month_lengths, year_length, +\begin_inset Newline newline +\end_inset + + leap_year_month, leap_year_drift, +\begin_inset Newline newline +\end_inset + + leap_year_drift_offset) +\end_layout + +\begin_layout Standard +or using the following subroutine: +\end_layout + +\begin_layout LyX-Code +SUBROUTINE xios_set_timestep(timestep) +\end_layout + +\begin_layout Subsection* +day_length: +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +integer +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: day_length +\end_layout + +\begin_layout Standard +Define the duration of a day in seconds when using a custom calendar. + This attribute is mandatory if the calendar +\series bold +type +\series default + is set to " +\emph on +user_defined +\emph default +", otherwise it must not be defined. +\begin_inset Newline newline +\end_inset + + +\begin_inset Newline newline +\end_inset + +When using the Fortran interface, this attribute must be defined at the + same time as the calendar +\series bold +type +\series default +: +\end_layout + +\begin_layout LyX-Code +SUBROUTINE xios_define_calendar(type, timestep, start_date, time_origin, +\begin_inset Newline newline +\end_inset + + day_length, month_lengths, year_length, +\begin_inset Newline newline +\end_inset + + leap_year_month, leap_year_drift, +\begin_inset Newline newline +\end_inset + + leap_year_drift_offset) +\end_layout + +\begin_layout Subsection* +month_lengths: +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +1D-array of integer +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: month_lengths(:) +\end_layout + +\begin_layout Standard +Define the duration of each month, in days, when using a custom calendar. + The number of elements in the array defines the number of months in a year + and the sum of all elements is the total number of days in a year. + This attribute is mandatory if the calendar +\series bold +type +\series default + is set to +\series bold +\emph on +user_defined +\series default +\emph default + and the +\series bold +year_length +\series default + attribute is not used, otherwise it must not be defined. +\begin_inset Newline newline +\end_inset + + +\begin_inset Newline newline +\end_inset + +When using the Fortran interface, this attribute must be defined at the + same time as the calendar +\series bold +type +\series default +: +\end_layout + +\begin_layout LyX-Code +SUBROUTINE xios_define_calendar(type, timestep, start_date, time_origin, +\begin_inset Newline newline +\end_inset + + day_length, month_lengths, year_length, +\begin_inset Newline newline +\end_inset + + leap_year_month, leap_year_drift, +\begin_inset Newline newline +\end_inset + + leap_year_drift_offset) +\end_layout + +\begin_layout Subsection* +year_length: +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +integer +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: year_length +\end_layout + +\begin_layout Standard +Define the duration of a year, in seconds, when using a custom calendar. + This attribute is mandatory if the calendar +\series bold +type +\series default + is set to +\series bold +\emph on +user_defined +\series default +\emph default + and the +\series bold +month_lengths +\series default + attribute is not used, otherwise it must not be defined. +\begin_inset Newline newline +\end_inset + + +\begin_inset Newline newline +\end_inset + +Note that the date format is modified when using this attribute: the month + must be always be omitted and the day must also be omitted if +\begin_inset Formula $year\_length\leq day\_length$ +\end_inset + +. +\begin_inset Newline newline +\end_inset + + +\begin_inset Newline newline +\end_inset + +When using the Fortran interface, this attribute must be defined at the + same time as the calendar +\series bold +type +\series default +: +\end_layout + +\begin_layout LyX-Code +SUBROUTINE xios_define_calendar(type, timestep, start_date, time_origin, +\begin_inset Newline newline +\end_inset + + day_length, month_lengths, year_length, +\begin_inset Newline newline +\end_inset + + leap_year_month, leap_year_drift, +\begin_inset Newline newline +\end_inset + + leap_year_drift_offset) +\end_layout + +\begin_layout Subsection* +leap_year_month: +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +integer +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: leap_year_month +\end_layout + +\begin_layout Standard +Define the month to which the extra day will be added in case of leap year, + when using a custom calendar. + This attribute is optional if the calendar +\series bold +type +\series default + is set to +\series bold +\emph on +user_defined +\series default +\emph default + and the +\series bold +month_lengths +\series default + attribute is used, otherwise it must not be defined. + The default behavior is not to have any leap year. + If defined, this attribute must comply with the following constraint: +\begin_inset Formula $1\leq leap\_year\_month\leq size(month\_lengths)$ +\end_inset + + and the +\series bold +leap_year_drift +\series default + attribute must also be defined. +\begin_inset Newline newline +\end_inset + + +\begin_inset Newline newline +\end_inset + +When using the Fortran interface, this attribute must be defined at the + same time as the calendar +\series bold +type +\series default +: +\end_layout + +\begin_layout LyX-Code +SUBROUTINE xios_define_calendar(type, timestep, start_date, time_origin, +\begin_inset Newline newline +\end_inset + + day_length, month_lengths, year_length, +\begin_inset Newline newline +\end_inset + + leap_year_month, leap_year_drift, +\begin_inset Newline newline +\end_inset + + leap_year_drift_offset) +\end_layout + +\begin_layout Subsection* +leap_year_drift: +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +double +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +DOUBLE PRECISION :: leap_year_drift +\end_layout + +\begin_layout Standard +Define the yearly drift, expressed as a fraction of a day, between the calendar + year and the astronomical year, when using a custom calendar. + This attribute is optional if the calendar +\series bold +type +\series default + is set to +\series bold +\emph on +user_defined +\series default +\emph default + and the +\series bold +month_lengths +\series default + attribute is used, otherwise it must not be defined. + The default behavior is not to have any leap year, i.e. + the default value is +\begin_inset Formula $\mathbf{0}$ +\end_inset + +. + If defined, this attribute must comply with the following constraint: +\begin_inset Formula $0\leq leap\_year\_drift<1$ +\end_inset + + and the +\series bold +leap_year_month +\series default + attribute must also be defined. +\begin_inset Newline newline +\end_inset + + +\begin_inset Newline newline +\end_inset + +When using the Fortran interface, this attribute must be defined at the + same time as the calendar +\series bold +type +\series default +: +\end_layout + +\begin_layout LyX-Code +SUBROUTINE xios_define_calendar(type, timestep, start_date, time_origin, +\begin_inset Newline newline +\end_inset + + day_length, month_lengths, year_length, +\begin_inset Newline newline +\end_inset + + leap_year_month, leap_year_drift, +\begin_inset Newline newline +\end_inset + + leap_year_drift_offset) +\end_layout + +\begin_layout Subsection* +leap_year_drift_offset: +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +double +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +DOUBLE PRECISION :: leap_year_drift_offset +\end_layout + +\begin_layout Standard +Define the initial drift between the calendar year and the astronomical + year, expressed as a fraction of a day, at the beginning of the time origin's + year, when using a custom calendar. + This attribute is optional if the +\series bold +leap_year_month +\series default + and +\series bold +leap_year_drift +\series default + attributes are used, otherwise it must not be defined. + The default value is +\begin_inset Formula $\mathbf{0}$ +\end_inset + +. + If defined, this attribute must comply with the following constraint: +\begin_inset Formula $0\leq leap\_year\_drift\_offset<1$ +\end_inset + +. + If +\begin_inset Formula $leap\_yeap\_drift\_offset+leap\_yeap\_drift$ +\end_inset + + is greater or equal to 1, then the first year will be a leap year. +\begin_inset Newline newline +\end_inset + + +\begin_inset Newline newline +\end_inset + +When using the Fortran interface, this attribute must be defined at the + same time as the calendar +\series bold +type +\series default +: +\end_layout + +\begin_layout LyX-Code +SUBROUTINE xios_define_calendar(type, timestep, start_date, time_origin, +\begin_inset Newline newline +\end_inset + + day_length, month_lengths, year_length, +\begin_inset Newline newline +\end_inset + + leap_year_month, leap_year_drift, +\begin_inset Newline newline +\end_inset + + leap_year_drift_offset) +\end_layout + +\begin_layout Section +Scalar attribute reference +\end_layout + +\begin_layout Subsection* +name (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +string +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: name +\end_layout + +\begin_layout Standard +Defines the name of a scalar as it will appear in a file. + If not defined, the name will be generated automatically based on the id. + If multiple scalars are defined in the same file, each scalar must have + a unique name. + +\end_layout + +\begin_layout Subsection* +standard_name (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +string +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: standard_name +\end_layout + +\begin_layout Standard +Defines the standard name of a scalar as it will appear in the scalar's + metadata in an output file. + +\end_layout + +\begin_layout Subsection* +long_name (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +string +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: long_name +\end_layout + +\begin_layout Standard +Defines the long name of a scalar as it will appear in the scalar's metadata + in an output file. + +\end_layout + +\begin_layout Subsection* +unit (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +string +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: unit +\end_layout + +\begin_layout Standard +Defines the scalar unit as it will appear in the scalar's metadata in an + output file. +\end_layout + +\begin_layout Subsection* +value (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +double +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +DOUBLE PRECISION :: value +\end_layout + +\begin_layout Standard +Defines the value of a scalar. + If both, the label and the value, are set then only the label will be written + into a file. +\end_layout + +\begin_layout Subsection* +bounds (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +1D-array of double +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +DOUBLE PRECISION :: bounds(:) +\end_layout + +\begin_layout Standard +Defines (two) scalar boundaries. + The array size must should be equal to 2. +\end_layout + +\begin_layout Subsection* +bounds_name (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +string +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: bounds_name +\end_layout + +\begin_layout Standard +Defines the name of scalar bounds as it will appear in a file. + If not defined, the name will be generated automatically based on the scalar + id. +\end_layout + +\begin_layout Subsection* +prec (optional): +\emph on +integer +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: prec +\end_layout + +\begin_layout Standard +Defines the precision in bytes of scalar value and boundaries as it will + be written into an output file. + Available values are: 4 (float single precision) and 8 (float double precision). + The default value is 4. +\end_layout + +\begin_layout Subsection* +label (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +string +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: label +\end_layout + +\begin_layout Standard +Defines the label of a scalar. + If both, the label and the value, are set then only the label will be output + into a file. +\end_layout + +\begin_layout Subsection* +scalar_ref (optional): string +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: scalar_ref +\end_layout + +\begin_layout Standard +Defines the reference to a scalar. + All attributes will be inherited from the referenced scalar via the classical + inheritance mechanism. + The value assigned to the referenced scalar will be transmitted to the + current scalar. +\end_layout + +\begin_layout Subsection* +positive (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +enumeration {up, down} +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: positive +\end_layout + +\begin_layout Standard +Defines the positive direction for fields representing height or depth. +\end_layout + +\begin_layout Subsection* +axis_type (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +enumeration {X, Y, Z, T} +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: axis_type +\end_layout + +\begin_layout Standard +Defines the type of a (scalar) axis. + The values correspond to the following axis types: +\end_layout + +\begin_layout Itemize + +\series bold +\shape italic +X: +\series default +\shape default + longitude +\end_layout + +\begin_layout Itemize + +\series bold +\shape italic +\emph on +Y +\emph default +: +\series default +\shape default + latitude +\end_layout + +\begin_layout Itemize + +\series bold +\shape italic +\emph on +Z +\emph default +: +\series default +\shape default + vertical axis +\end_layout + +\begin_layout Itemize + +\series bold +\shape italic +T: +\series default +\shape default +time axis. +\end_layout + +\begin_layout Subsection* +comment: +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +string +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: comment +\end_layout + +\begin_layout Standard +Allows a user to set a comment. + +\end_layout + +\begin_layout Section +Axis attribute reference +\end_layout + +\begin_layout Subsection* +name (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +string +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: name +\end_layout + +\begin_layout Standard +Defines the name of a vertical axis as it will appear in an output file. + If not defined, the name will be generated automatically based on the axis + id. + If multiple vertical axes are defined in the same file, each axis must + have a unique name. + +\end_layout + +\begin_layout Subsection* +standard_name (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +string +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: standard_name +\end_layout + +\begin_layout Standard +Defines the standard name of a vertical axis as it will appear in the axis' + metadata in an output file. + +\end_layout + +\begin_layout Subsection* +long_name (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +string +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: long_name +\end_layout + +\begin_layout Standard +Defines the long name of a vertical axis as it will appear in the axis' + metadata in an output file. + +\end_layout + +\begin_layout Subsection* +unit (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +string +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: unit +\end_layout + +\begin_layout Standard +Defines the unit of an axis as it will appear in the axis' metadata in an + output file. +\end_layout + +\begin_layout Subsection* +dim_name (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +string +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: dim_name +\end_layout + +\begin_layout Standard +Defines the name of axis dimension as it will appear in the file's metadata. + The default axis dimension name is the axis name. +\end_layout + +\begin_layout Subsection* +formula (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +string +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: formula +\end_layout + +\begin_layout Standard +Adds the +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +formula +\end_layout + +\end_inset + + attribute to the metadata associated to the axis in the output file, for + CF conformance. +\end_layout + +\begin_layout Subsection* +formula_term (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +string +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: formula_term +\end_layout + +\begin_layout Standard +Adds the +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +formula_term +\end_layout + +\end_inset + + attribute to the metadata associated to the axis in the output file, for + CF conformance. +\end_layout + +\begin_layout Subsection* +formula_bounds (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +string +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: formula_bounds +\end_layout + +\begin_layout Standard +Adds the +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +formula +\end_layout + +\end_inset + + attribute to the metadata associated to the axis boundairies in the output + file, for CF conformance. + This attribute is meaningfull if +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +axis_bounds +\end_layout + +\end_inset + + is not defined. +\end_layout + +\begin_layout Subsection* +formula_term_bounds (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +string +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: formula_term_bounds +\end_layout + +\begin_layout Standard +Adds the +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +formula_term +\end_layout + +\end_inset + + attribute to the metadata associated to the axis boundairies in the output + file, for CF conformance. + This attribute is meaningfull if +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +axis_bounds +\end_layout + +\end_inset + + is not defined. +\end_layout + +\begin_layout Subsection* +n_glo (mandatory): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +integer +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: n_glo +\end_layout + +\begin_layout Standard +Defines the global size of an axis. +\end_layout + +\begin_layout Subsection* +begin (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +integer +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: begin +\end_layout + +\begin_layout Standard +Defines the beginning index of the local domain. + It can take value between 0 and +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +n_glo-1 +\end_layout + +\end_inset + +. + If not specified the default value is 0. +\end_layout + +\begin_layout Subsection* +n (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +integer +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: n +\end_layout + +\begin_layout Standard +Defines the local size of an axis. + It can take value between 0 and +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +n_glo +\end_layout + +\end_inset + +. + If not specified the default value is +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +n_glo +\end_layout + +\end_inset + +. + Local axis decomposition can be declared either with attributes +\series bold +\shape italic +{n, begin} +\series default +\shape default + or with +\series bold +\shape italic +index +\series default +\shape default +. +\end_layout + +\begin_layout Subsection* +index (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +1D-array of double +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +DOUBLE PRECISION :: index(:) +\end_layout + +\begin_layout Standard +Defines the global indexes of a local axis held by each process. + If the attribute is specified, its array size must be equal to +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +n +\end_layout + +\end_inset + +. + Local axis decomposition can be declared either with attributes +\series bold +\shape italic +{n, begin} +\series default +\shape default + or with +\series bold +\shape italic +index +\series default +\shape default +. +\end_layout + +\begin_layout Subsection* +value (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +1D-array of double +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +DOUBLE PRECISION :: value(:) +\end_layout + +\begin_layout Standard +Defines the value of each level of a vertical axis. + The array size must be equal to the value of the attribute +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +n +\end_layout + +\end_inset + +. + If the label is provided then only the label will be written into a file + and not the axis value and the axis boundaries. +\end_layout + +\begin_layout Subsection* +bounds (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +2D-array of double +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +DOUBLE PRECISION :: bounds(:,:) +\end_layout + +\begin_layout Standard +Defines the boundaries of each level of a vertical axis. + The dimensions of the array must be +\begin_inset Formula $2\times n$ +\end_inset + +. +\end_layout + +\begin_layout Subsection* +bounds_name (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +string +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: bounds_name +\end_layout + +\begin_layout Standard +Defines the name of axis boundaries as it will appear in an ouput file. + If not defined, the name will be generated automatically based on the axis + id. +\end_layout + +\begin_layout Subsection* +prec (optional): +\emph on +integer +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: prec +\end_layout + +\begin_layout Standard +Defines the precision in bytes of axis value and boundaries as it will be + written into an output file. + Available values are: 4 (float single precision) and 8 (float double precision). + The default value is 4. +\end_layout + +\begin_layout Subsection* +label (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +string +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER, ALLOCATABLE :: label(:) +\end_layout + +\begin_layout Standard +Defines the label of an axis. + The size of the array must be equal to the value of the attribute +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +n +\end_layout + +\end_inset + +. + If the label is provided then only the label will be written into a file + and not the axis value and the axis boundaries. +\end_layout + +\begin_layout Subsection* +data_begin (optional): +\emph on + integer +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: data_begin +\end_layout + +\begin_layout Standard +Defines the beginning index of local field data owned by each process. + The attribute is an offset relative to the local axis, so the value can + be negative. + A negative value indicates that only some valid part of the data will extracted +, for example in the case of a ghost cell. + A positive value indicates that the local domain is greater than the data + stored in memory. + The 0-value means that the local domain matches the data in memory. + The default value is 0. + The attributes +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +data_begin +\end_layout + +\end_inset + + and +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +data_n +\end_layout + +\end_inset + + must be defined together. +\end_layout + +\begin_layout Subsection* +data_n (optional): +\emph on +integer +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: data_n +\end_layout + +\begin_layout Standard +Defines the size of local field data. + The attribute can take value starting from 0 (no data on a process). + The default value is +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +n +\end_layout + +\end_inset + +. + The attributes +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +data_begin +\end_layout + +\end_inset + + and +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +data_n +\end_layout + +\end_inset + + must be defined together. +\end_layout + +\begin_layout Subsection* +data_index (optional): +\emph on +integer +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: data_index +\end_layout + +\begin_layout Standard +In case of a compressed vertical axis, the attribute defines the position + of data points stored in the memory. + For example, for a local axis of size +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +n=3 +\end_layout + +\end_inset + + and local data size of +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +data_n=5 +\end_layout + +\end_inset + +, if +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +data_index=(/ -1, 2, 1, 0, -1 /) +\end_layout + +\end_inset + + then the first and the last data points are ghosts and only the three middle + values will be written in the reversed order. + Only +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +data_begin/data_n +\end_layout + +\end_inset + + or +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +data_index +\end_layout + +\end_inset + + can be used together. +\end_layout + +\begin_layout Subsection* +mask (optional): +\emph on +1D-array of bool +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +LOGICAL :: mask(:) +\end_layout + +\begin_layout Standard +Defines the mask of the local axis. + The masked value will be replaced by the value of the field attribute +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +default_value +\end_layout + +\end_inset + + in an output file. +\end_layout + +\begin_layout Subsection* +n_distributed_partition (optional): +\emph on +integer +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: n_distributed_partition +\end_layout + +\begin_layout Standard +Defines the number of local axes in case if the axis is generated automatically + by XIOS. + The default value is +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +1 +\end_layout + +\end_inset + +. + Nota: currently this functionnality is broken, this attribute is meaningfull. +\end_layout + +\begin_layout Subsection* +axis_ref (optional): string +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: axis_ref +\end_layout + +\begin_layout Standard +Defines the reference of an axis. + All attributes will be inherited from the referenced axis with the classical + inheritance mechanism. + The value assigned to the referenced axis will be transmitted to the current + axis. +\end_layout + +\begin_layout Subsection* +positive (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +enumeration {up, down} +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: positive +\end_layout + +\begin_layout Standard +Defines the positive direction for fields representing height or depth. + It will just be appended in axis metadata in output file, for CF compliance. +\end_layout + +\begin_layout Subsection* +axis_type (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +enumeration {X, Y, Z, T} +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: axis_type +\end_layout + +\begin_layout Standard +Defines the type of an axis. + The values correspond to the following axis types: +\end_layout + +\begin_layout Itemize + +\series bold +\shape italic +X: +\series default +\shape default + longitude +\end_layout + +\begin_layout Itemize + +\series bold +\shape italic +\emph on +Y +\emph default +: +\series default +\shape default + latitude +\end_layout + +\begin_layout Itemize + +\series bold +\shape italic +\emph on +Z +\emph default +: +\series default +\shape default + vertical axis +\end_layout + +\begin_layout Itemize + +\series bold +\shape italic +T: +\series default +\shape default +time axis. +\end_layout + +\begin_layout Standard +It will just be append in axis metadata in ouput file, for CF compliance. +\end_layout + +\begin_layout Subsection* +comment (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +string +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: comment +\end_layout + +\begin_layout Standard +Allows a user to set a comment. + +\end_layout + +\begin_layout Section +Domain attribute reference +\end_layout + +\begin_layout Subsection* +name (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +string +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: name +\end_layout + +\begin_layout Standard +Defines the name of a horizontal domain. + This attribute may be used in case of multiple domains defined in the same + file. + In this case, the +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +name +\end_layout + +\end_inset + + attribute will be suffixed to the longitude and latitude dimensions and + axis name. + If the domain name is not provided, it will be generated automatically + with the id of the domain. +\end_layout + +\begin_layout Subsection* +standard_name (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +string +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: standard_name +\end_layout + +\begin_layout Standard +Defines the standard name of a domain as it will appear in the domain's + metadata in an output file. + +\end_layout + +\begin_layout Subsection* +long_name (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +string +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: long_name +\end_layout + +\begin_layout Standard +Defines the long name of a domain as it will appear in the domain's metadata + in an output file. + +\end_layout + +\begin_layout Subsection* +type (mandatory): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +enumeration {rectilinear, curvilinear, unstructured, gaussian} +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: type +\end_layout + +\begin_layout Standard +Defines the type of a grid. +\end_layout + +\begin_layout Subsection* +dim_i_name (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +string +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: dim_i_name +\end_layout + +\begin_layout Standard +Defines the name of the first domain dimension as it will appear in the + file's metadata. + The default value is ' +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +X +\end_layout + +\end_inset + +'. + In case of multiple domain in the file, the dimension will be preffixed + by the domain name. +\end_layout + +\begin_layout Subsection* +dim_j_name (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +string +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: dim_j_name +\end_layout + +\begin_layout Standard +Defines the name of the second domain dimension as it will appear in file's + metadata. + The default value is ' +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +Y +\end_layout + +\end_inset + +'. + In case of multiple domain in the file, the dimension will be preffixed + by the domain name. +\end_layout + +\begin_layout Subsection* +ni_glo (mandatory): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +integer +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: ni_glo +\end_layout + +\begin_layout Standard +Defines the size of the first dimension of the global domain. +\end_layout + +\begin_layout Subsection* +nj_glo (mandatory): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +integer +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: nj_glo +\end_layout + +\begin_layout Standard +Defines the size of the second dimension of the global domain. +\end_layout + +\begin_layout Subsection* +ibegin (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +integer +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: ibegin +\end_layout + +\begin_layout Standard +Defines the beginning index of the first dimension of a local domain. + The attribute takes value between +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +0 +\end_layout + +\end_inset + + and +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +ni_glo-1 +\end_layout + +\end_inset + +. + If not specified the default value is +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +0 +\end_layout + +\end_inset + +. +\end_layout + +\begin_layout Subsection* +ni (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +integer +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: ni +\end_layout + +\begin_layout Standard +Defines the size of the first dimension of a local domain. + The attribute takes value between +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +1 +\end_layout + +\end_inset + +and +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +ni_glo +\end_layout + +\end_inset + +. + If not specified the default value is +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +ni_glo +\end_layout + +\end_inset + +. +\end_layout + +\begin_layout Subsection* +jbegin (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +integer +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: jbegin +\end_layout + +\begin_layout Standard +Defines the beginning index of the second dimension of a local domain. + The attribute takes value between +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +0 +\end_layout + +\end_inset + + and +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +nj_glo-1 +\end_layout + +\end_inset + +. + If not specified the default value is +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +0 +\end_layout + +\end_inset + +. +\end_layout + +\begin_layout Subsection* +nj (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +integer +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: nj +\end_layout + +\begin_layout Standard +Defines the size of the second dimension of a local domain. + he attribute takes value between +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +1 +\end_layout + +\end_inset + +and +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +nj_glo +\end_layout + +\end_inset + +. + If not specified the default value is +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +nj_glo +\end_layout + +\end_inset + +. +\end_layout + +\begin_layout Subsection* +lonvalue_1d (optional): +\emph on +1D-array of double +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +DOUBLE PRECISION :: lonvalue(:) +\end_layout + +\begin_layout Standard +Defines the longitude values of a local domain. + For a cartesian grid, the array size should be +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +ni +\end_layout + +\end_inset + +. + For a curvilinear grid, the array size should be +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +ni +\begin_inset Formula $\times$ +\end_inset + +nj +\end_layout + +\end_inset + +. + In this case the first and second dimensions are collapsed into a linear + array. + For unstrutured and gaussian grid, the array size sould be +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +ni +\end_layout + +\end_inset + + (the second dimension +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +nj +\end_layout + +\end_inset + + is not used). + Only latvalue_1d or latvalue_2d can be defined. + Also the layout of latitude and longitude should be in conformance with + each other: either 1D or 2D. +\end_layout + +\begin_layout Subsection* +lonvalue_2d (optional): +\emph on +2D-array of double +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +DOUBLE PRECISION :: lonvalue(:,:) +\end_layout + +\begin_layout Standard +Defines the longitude values of a local domain. + For cartesian grid, the array size must beand curvilinear grids the array + size should be +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +(ni,nj) +\end_layout + +\end_inset + +. + For unstructured or gaussian grid it sould be +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +(ni,1) +\end_layout + +\end_inset + +. + Only lonvalue_1d or lonvalue_2d can be defined. + Also the layout of latitude and longitude should be in conformance with + each other: either 1D or 2D. +\end_layout + +\begin_layout Subsection* +latvalue_1d (optional): +\emph on +1D-array of double +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +DOUBLE PRECISION :: latvalue(:) +\end_layout + +\begin_layout Standard +Defines the latitude values of a local domain. + For a cartesian and curvilinear grid, the array size should be +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +ni +\begin_inset Formula $\times$ +\end_inset + +nj +\end_layout + +\end_inset + +. + In this case the first and second dimensions are collapsed into a linear + array. + For unstrutured and gaussian grid, the array size sould be +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +ni +\end_layout + +\end_inset + + (the second dimension +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +nj +\end_layout + +\end_inset + + is not used). + Only latvalue_1d or latvalue_2d can be defined. + Also the layout of latitude and longitude should be in conformance with + each other: either 1D or 2D. +\end_layout + +\begin_layout Subsection* +latvalue_2d (optional): +\emph on +2D-array of double +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +DOUBLE PRECISION :: latvalue(:,:) +\end_layout + +\begin_layout Standard +Defines the latitude values of a local domain. + For cartesian grid and curvilinear grids the array size should be +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +(ni,nj) +\end_layout + +\end_inset + +. + For unstructured or gaussian grid it sould be +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +(ni,1) +\end_layout + +\end_inset + +. + Only latvalue_1d or latvalue_2d can be defined. + Also the layout of latitude and longitude should be in conformance with + each other: either 1D or 2D. +\end_layout + +\begin_layout Subsection* +lon_name (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +string +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: lon_name +\end_layout + +\begin_layout Standard +Define the longitude name as it will appear in an output file. + If not defined, the default will be ' +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +lon +\end_layout + +\end_inset + +'. + In case of multiple domain defined in a file, the longitude name will be + suffixed by the domain name. +\end_layout + +\begin_layout Subsection* +lat_name (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +string +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: lat_name +\end_layout + +\begin_layout Standard +efine the longitude name as it will appear in an output file. + If not defined, the default will be ' +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +lat +\end_layout + +\end_inset + +'. + In case of multiple domain defined in a file, the longitude name will be + suffixed by the domain name. +\end_layout + +\begin_layout Subsection* +nvertex (optional): +\emph on +integer +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: nvertex +\end_layout + +\begin_layout Standard +Used only for unstructured domain. + Defines the maximum number of vertices for a grid. + The attribute is required for specifying the cell boundaries of the unstructure +d meshes. + For other grid (cartesian, curvilinear or gaussian), the nvertex value + will be set automatically to 4. +\end_layout + +\begin_layout Subsection* +bounds_lon_1d (optional): +\emph on +2D-array of double +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +DOUBLE PRECISION :: bounds_lon(:,:) +\end_layout + +\begin_layout Standard +Defines the longitude values of the domain vertexes. + For unstructured domain, the attribute +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +nvertex +\end_layout + +\end_inset + + must be also defined (for other mesh it is set automatically to 4). + The array dimensions shape must be of size +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +(nvertex, ni) +\end_layout + +\end_inset + +. +\end_layout + +\begin_layout Subsection* +bounds_lon_2d (optional): +\emph on +3D-array of double +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +DOUBLE PRECISION :: bounds_lon(:,:,:) +\end_layout + +\begin_layout Standard +Defines the longitude values of the domain vertexes. + For unstructured domain, the attribute +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +nvertex +\end_layout + +\end_inset + + must be also defined (for other mesh it is set automatically to 4). + This attribute is useful when lonvalue_2d is defined. + for cartesian and curvilinear domain, the array dimensions shape must be + of size +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +(nvertex, ni, nj) +\end_layout + +\end_inset + +, and for gaussian or unstructured domain, it sould be of size +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +(nvertex, ni, 1) +\end_layout + +\end_inset + +. + For cartesian, curvilinear . + Either +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +bounds_lon_1d +\end_layout + +\end_inset + + or +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +bounds_lon_2d +\end_layout + +\end_inset + + can be defined. +\end_layout + +\begin_layout Subsection* +bounds_lat_1d (optional): +\emph on +2D-array of double +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +DOUBLE PRECISION :: bounds_lat(:,:) +\end_layout + +\begin_layout Standard +Defines the latitude values of the domain vertexes. + For unstructured domain, the attribute +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +nvertex +\end_layout + +\end_inset + + must be also defined (for other mesh it is set automatically to 4). + The array dimensions shape must be of size +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +(nvertex, ni) +\end_layout + +\end_inset + +. +\end_layout + +\begin_layout Subsection* +bounds_lat_2d (optional): +\emph on +3D-array of double +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +DOUBLE PRECISION :: bounds_lat(:,:) +\end_layout + +\begin_layout Standard +Defines the latitude values of domain vertexes. + For unstructured domain, the attribute +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +nvertex +\end_layout + +\end_inset + + must be also defined. + This attribute is useful when lonvalue_2d is defined. + for cartesian and curvilinear domain, the array dimensions shape must be + of size +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +(nvertex, ni, nj) +\end_layout + +\end_inset + +, and for gaussian or unstructured domain, it sould be of size +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +(nvertex, ni, 1) +\end_layout + +\end_inset + +. + For cartesian, curvilinear . + Either +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +bounds_lon_1d +\end_layout + +\end_inset + + or +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +bounds_lon_2d +\end_layout + +\end_inset + + can be defined. +\end_layout + +\begin_layout Subsection* +bounds_lon_name (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +string +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: bounds_lon_name +\end_layout + +\begin_layout Standard +Defines the boundaries longitude boundaries name of domain as it will appear + in an output file. + Default value is ' +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +bounds_lon +\end_layout + +\end_inset + +'. + In case of multiple domains defined in a same file, the boundaries name + will be suffixed by the domain name. + +\end_layout + +\begin_layout Subsection* +bounds_lat_name (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +string +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: lat_name +\end_layout + +\begin_layout Standard +Defines the boundaries longitude boundaries name of domain as it will appear + in an output file. + Default value is ' +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +bounds_lon +\end_layout + +\end_inset + +'. + In case of multiple domains defined in a same file, the boundaries name + will be suffixed by the domain name. + +\end_layout + +\begin_layout Subsection* +area (optional): +\emph on +2D-array of double +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +DOUBLE PRECISION :: area(:,:) +\end_layout + +\begin_layout Standard +The area of cells. + The size of the array must +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +(ni, nj) +\end_layout + +\end_inset + + for cartesian or curvilinear domain and (ni, 1) for unstructured or gaussian + domain. + If this attribute is defined, it will be wrote in the output file as domain + metadata. + This attribute could be also used in domain interpolation to take into + account the area of the cell instead to take the computed value (for conservati +on consideration). + +\end_layout + +\begin_layout Subsection* +radius (optional): +\emph on +double +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +DOUBLE PRECISION :: radius +\end_layout + +\begin_layout Standard +Define the radius of the planet (or earth). + If defined, it can be used by domain interpolation together with +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +area +\end_layout + +\end_inset + + domain attribute in order to renormalize weight to compute conservative + interpolation (see +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +domain_interpolate +\end_layout + +\end_inset + + filter). +\end_layout + +\begin_layout Subsection* +prec (optional): +\emph on +integer +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: prec +\end_layout + +\begin_layout Standard +Defines the precision (in bytes) for which domain attributes (longitude, + latitude, boudairies, ...) will be written in output file. + Available values are: 4 (float single precision) and 8 (float double precision). + The default value is 4 bytes. +\end_layout + +\begin_layout Subsection* +data_dim (optional): +\emph on +integer +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: datadim +\end_layout + +\begin_layout Standard +Defines how a field is stored on memory for the client code. + The value can be either +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +1 +\end_layout + +\end_inset + + or +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +2 +\end_layout + +\end_inset + +. + The value of +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +1 +\end_layout + +\end_inset + + indicates that the horizontal layer of the field is stored as a 1D array. + The value of +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +2 +\end_layout + +\end_inset + + indicates that the horizontal layer is stored as a 2D array. + The default value is +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +1 +\end_layout + +\end_inset + +. +\end_layout + +\begin_layout Subsection* +data_ibegin (optional): +\emph on + integer +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: data_ibegin +\end_layout + +\begin_layout Standard +Defines the beginning index of field data for the first dimension. + This attribute is an offset relative to the local domain, so the value + can be negative. + A negative value indicates that only some valid part of the data will extracted +, for example in the case of a ghost cell. + A positive value indicates that the local domain is greater than the data + stored in memory. + A 0-value means that the local domain matches the data in memory. + The default value is 0. + The attributes +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +data_ibegin +\end_layout + +\end_inset + + and +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +data_ni +\end_layout + +\end_inset + + must be defined together. + Only data_ibegin/data_ni or data_i_index/ +\end_layout + +\begin_layout Subsection* +data_ni (optional): +\emph on +integer +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: data_ni +\end_layout + +\begin_layout Standard +Defines the size of field data for the first dimension. + The default value is +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +ni +\end_layout + +\end_inset + +. + The attributes +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +data_ibegin +\end_layout + +\end_inset + + and +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +data_ni +\end_layout + +\end_inset + + must be defined together. +\end_layout + +\begin_layout Subsection* +data_jbegin (optional): +\emph on +integer +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: data_jbegin +\end_layout + +\begin_layout Standard +Defines the beginning index of field data for the second dimension. + The attribute is taken into account only if +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout + data_dim=2 +\end_layout + +\end_inset + +. + The attribute is an offset relative to the local domain, so the value can + be negative. + A negative value indicate that only some valid part of the data will extracted, + for example in case of ghost cell. + A positive value indicate that the local domain is greater than the data + stored in memory. + The 0-value means that the local domain matches the data in memory. + The default value is +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +0 +\end_layout + +\end_inset + +. + The attributes +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +data_jbegin +\end_layout + +\end_inset + + and +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +data_nj +\end_layout + +\end_inset + + must be defined together. +\end_layout + +\begin_layout Subsection* +data_nj (optional): +\emph on +integer +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: data_nj +\end_layout + +\begin_layout Standard +Defines the size of field data for the second dimension. + The attribute is taken account only if +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +data_dim=2 +\end_layout + +\end_inset + +. + The default value is +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +nj +\end_layout + +\end_inset + +. + The attributes +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +data_jbegin +\end_layout + +\end_inset + + and +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +data_nj +\end_layout + +\end_inset + + must be defined together. +\end_layout + +\begin_layout Subsection* +data_i_index (optional): +\emph on +1D-array of integer +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: data_i_index(:) +\end_layout + +\begin_layout Standard +In case of a compressed horizontal domain, define the data indexation for + the first dimension. + This attribute cannot be used together with +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +data_ibegin/data_ni +\end_layout + +\end_inset + + attributes. + This attribute can be used only when +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +data_dim=1 +\end_layout + +\end_inset + +. + The size of data_i_index determine the size of the fields dimension of + the corresponding domain, that is sent from the model. + Value can be negative or greater than +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +ni +\end_layout + +\end_inset + +. + In this case, the corresponding point will be considered as masked and + will not be extracted to enter the workflow. +\end_layout + +\begin_layout Subsection* +data_j_index (optional): +\emph on +1D-array of integer +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: data_j_index(:) +\end_layout + +\begin_layout Standard +In case of a compressed horizontal domain, define the data indexation for + the first dimension. + This attribute cannot be used together with +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +data_jbegin/data_nj +\end_layout + +\end_inset + + attributes. + This attribute can be used only when +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +data_dim=1 +\end_layout + +\end_inset + +. + The size of data_i_index determine the size of the fields dimension of + the corresponding domain, that is sent from the model. + Value can be negative or greater than +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +nj +\end_layout + +\end_inset + +. + In this case, the corresponding point will be considered as masked and + will not be extracted to enter the workflow. +\end_layout + +\begin_layout Subsection* +mask_1d (optional): +\emph on +1D-array of bool +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +LOGICAL :: mask(:) +\end_layout + +\begin_layout Standard +Defines a 1D mask of a local domain. + The masked value will be replaced by the value of the field attribute +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +default_value +\end_layout + +\end_inset + + in an output file. + This attribute must be of size +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +ni*nj +\end_layout + +\end_inset + +. + By default no values are masked. +\end_layout + +\begin_layout Subsection* +mask_2d (optional): +\emph on +2D-array of bool +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +LOGICAL :: mask(:,:) +\end_layout + +\begin_layout Standard +Defines a 2D mask of a local domain. + The masked values will be replaced by the value of the field attribute + +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +default_value +\end_layout + +\end_inset + + in an output file. + This attribute must be of size +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +(ni,nj) +\end_layout + +\end_inset + +. + By default no values are masked. +\end_layout + +\begin_layout Subsection* +domain_ref (optional): string +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: domain_ref +\end_layout + +\begin_layout Standard +Defines the reference to a domain. + All attributes are inherited from the referenced domain with the classic + inheritance mechanism. + The value assigned to the referenced domain is transmitted to to current + domain. +\end_layout + +\begin_layout Subsection* +i_index (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +1D-array of double +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +DOUBLE PRECISION :: i_index(:) +\end_layout + +\begin_layout Standard +Defines the global index of the first dimension of a local domain held by + a process. + By default the size of the array must be +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +ni*nj +\end_layout + +\end_inset + +. +\end_layout + +\begin_layout Subsection* +j_index (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +1D-array of double +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +DOUBLE PRECISION :: j_index(:) +\end_layout + +\begin_layout Standard +Defines the global index of the second dimension of a local domain held + by a process. + By default the size of the array must be +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +ni*nj +\end_layout + +\end_inset + +. +\end_layout + +\begin_layout Subsection* +comment (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +string +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: comment +\end_layout + +\begin_layout Standard +Allows a user to set a comment. +\end_layout + +\begin_layout Section +Grid attribute reference +\end_layout + +\begin_layout Subsection* +name (optional): string +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: name +\end_layout + +\begin_layout Standard +Defines the name of a grid. +\end_layout + +\begin_layout Subsection* +description (optional): string +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: description +\end_layout + +\begin_layout Standard +Defines the descriptions of a grid. +\end_layout + +\begin_layout Subsection* +mask_1d (optional): +\emph on +1D-array of bool +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +LOGICAL :: mask_1d(:) +\end_layout + +\begin_layout Standard +Defines the mask of a local 1D grid. + Masked values will be replaced by the value of the field attribute +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +default_value +\end_layout + +\end_inset + + in an output file. + By default none of the value are masked. +\end_layout + +\begin_layout Subsection* +mask_2d (optional): +\emph on +2D-array of bool +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +LOGICAL :: mask_2d(:,:) +\end_layout + +\begin_layout Standard +Defines the mask of a local 2D grid. + Masked values will be replaced by the value of the field attribute +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +default_value +\end_layout + +\end_inset + + in an output file. + By default none of the value are masked. +\end_layout + +\begin_layout Subsection* +mask_3d (optional): +\emph on +3D-array of bool +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +LOGICAL :: mask_3d(:,:,:) +\end_layout + +\begin_layout Standard +Define the mask of a local 3D grid. + Masked values will be replaced by the value of the field attribute +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +default_value +\end_layout + +\end_inset + + in an output file. + By default none of the value are masked. +\end_layout + +\begin_layout Subsection* +mask_4d (optional): +\emph on +4D-array of bool +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +LOGICAL :: mask_4d(:,:,:) +\end_layout + +\begin_layout Standard +Define the mask of a local 4D grid. + Masked values will be replaced by the value of the field attribute +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +default_value +\end_layout + +\end_inset + + in an output file. + By default none of the value are masked. +\end_layout + +\begin_layout Subsection* +mask_5d (optional): +\emph on +5D-array of bool +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +LOGICAL :: mask_5d(:,:,:) +\end_layout + +\begin_layout Standard +Define the mask of a local 5D grid. + Masked values will be replaced by the value of the field attribute +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +default_value +\end_layout + +\end_inset + + in an output file. + By default none of the value are masked. +\end_layout + +\begin_layout Subsection* +mask_6d (optional): +\emph on +6D-array of bool +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +LOGICAL :: mask_6d(:,:,:) +\end_layout + +\begin_layout Standard +Define the mask of a local 6D grid. + Masked values will be replaced by the value of the field attribute +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +default_value +\end_layout + +\end_inset + + in an output file. + By default none of the value are masked. +\end_layout + +\begin_layout Subsection* +mask_7d (optional): +\emph on +7D-array of bool +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +LOGICAL :: mask_7d(:,:,:) +\end_layout + +\begin_layout Standard +Define the mask of a local 7D grid. + Masked values will be replaced by the value of the field attribute +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +default_value +\end_layout + +\end_inset + + in an output file. + By default none of the value are masked. +\end_layout + +\begin_layout Subsection* +comment (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +string +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: comment +\end_layout + +\begin_layout Standard +Allows a user to set a comment. + Meaningfull for the XIOS workflow. +\end_layout + +\begin_layout Section +Field attribute reference +\end_layout + +\begin_layout Subsection* +name (optional): +\emph on +string +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: name +\end_layout + +\begin_layout Standard +Defines the name of a field as it will appear in an output file. + If not present, the identifier +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +id +\end_layout + +\end_inset + + will be substituted. +\end_layout + +\begin_layout Subsection* +standard_name (optional): +\emph on +string +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: standard_name +\end_layout + +\begin_layout Standard +Defines the +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +standard_name +\end_layout + +\end_inset + + attribute as it will appear in the metadata of an output file. +\end_layout + +\begin_layout Subsection* +long_name (optional): +\emph on +string +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: long_name +\end_layout + +\begin_layout Standard +Defines the long name as it will appear in the metadata of an output file. +\end_layout + +\begin_layout Subsection* +expr (optional): +\emph on +string +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: expr +\end_layout + +\begin_layout Standard +Defines the expression for arithmetic or time-integration operations performed + on a field. + For example if +\series bold +expr= +\begin_inset Quotes erd +\end_inset + +sqrt(@temp2 - pow(@temp, 2)) +\begin_inset Quotes erd +\end_inset + + +\series default + then the variance will be calculated on the incoming flux of the field + +\series bold +temp +\series default + (given that field temp2 that holds the square of temp was correctly defined). + +\end_layout + +\begin_layout Subsection* +unit (optional): +\emph on +string +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: unit +\end_layout + +\begin_layout Standard +Defines the unit of a field, as it will apear in the associated metadata + in the output file. +\end_layout + +\begin_layout Subsection* +operation (mandatory): enumeration +\emph on + {once, instant, average, maximum, minimum, accumulate} +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: operation +\end_layout + +\begin_layout Standard +Defines the temporal operation applied to a field. +\end_layout + +\begin_layout Subsection* +freq_op (optional): +\emph on +duration +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +TYPE(xios_duration) :: freq_op +\end_layout + +\begin_layout Standard +Defines the sampling frequency of a temporal operation, so that field values + will be used for temporal sampling at frequency +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +freq_op +\end_layout + +\end_inset + +. + It can be also useful for sub-processes called at different frequency in + a model. + The default value is equal to the file attribute +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +output_freq +\end_layout + +\end_inset + + for +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +instant +\end_layout + +\end_inset + + operations and +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +1ts +\end_layout + +\end_inset + + (1 time step) otherwise. +\end_layout + +\begin_layout Subsection* +freq_offset (optional): +\emph on +duration +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +TYPE(xios_duration) :: freq_offset +\end_layout + +\begin_layout Standard +Defines the offset when +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +freq_op +\end_layout + +\end_inset + + is defined. + Accepted values lie between +\series bold +0 +\series default + and +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +freq_op - 1ts +\end_layout + +\end_inset + +. + The default value is +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +freq_op - 1ts +\end_layout + +\end_inset + + for fields in the +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +write +\end_layout + +\end_inset + + mode and +\series bold +0 +\series default + for fields in the +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +read +\end_layout + +\end_inset + + mode. +\end_layout + +\begin_layout Subsection* +level (optional): +\emph on +integer +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: level +\end_layout + +\begin_layout Standard +Defines the output level of a field. + The field will be output only if the file attribute +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout + output_level +\begin_inset Formula $\geq$ +\end_inset + +level +\end_layout + +\end_inset + +. + The default value is +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +0 +\end_layout + +\end_inset + +. +\end_layout + +\begin_layout Subsection* +prec (optional): +\emph on +integer +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: prec +\end_layout + +\begin_layout Standard +Defines the precision in bytes of a field in an output file. + Available values are: 2 (integer), 4 (float single precision) and 8 (float + double precision). + The default value is 4 (float single precision). +\end_layout + +\begin_layout Subsection* +enabled (optional): +\emph on +bool +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +LOGICAL :: enabled +\end_layout + +\begin_layout Standard +Defines if a field must be output or not. + The default value is +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +true +\end_layout + +\end_inset + +. +\end_layout + +\begin_layout Subsection* +check_if_active (optional): +\emph on +bool +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +LOGICAL :: check_if_active +\end_layout + +\begin_layout Standard +Sets a check if a field will be used at a given time step. + Activating the check may improve performance for fields which are not used + frequently, while it can detoriate performance for fields used at each + time step. + The default value is false. +\end_layout + +\begin_layout Subsection* +read_access (optional): +\emph on +bool +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +LOGICAL :: read_access +\end_layout + +\begin_layout Standard +Defines whether a field can be read from the model or not. + The default value is +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +false +\end_layout + +\end_inset + +. + Note that for fields belonging to a file in +\series bold +\emph on +read +\series default +\emph default + +\series bold +mode +\series default +, this attribute is always +\series bold +true +\series default +. +\end_layout + +\begin_layout Subsection* +field_ref (optional): +\emph on +string +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: field_ref +\end_layout + +\begin_layout Standard +Defines the field reference. + All attributes will be inherited from the referenced field via the classical + inheritance mechanism. + The values assigned to the referenced field will be transmitted to the + current field to perform temporal operation. +\end_layout + +\begin_layout Subsection* +grid_ref (optional): +\emph on +string +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: grid_ref +\end_layout + +\begin_layout Standard +Defines the field grid. + Note that only either +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +grid_ref +\end_layout + +\end_inset + + or a combination of +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +domain_ref +\end_layout + +\end_inset + +, +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +scalar_ref +\end_layout + +\end_inset + + or +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +axis_ref +\end_layout + +\end_inset + + can be specified. +\end_layout + +\begin_layout Subsection* +domain_ref (optional): +\emph on +string +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: domain_ref +\end_layout + +\begin_layout Standard +Defines the field domain. + If the attribute is defined, the attribute +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +grid_ref +\end_layout + +\end_inset + + must not be specified. +\end_layout + +\begin_layout Subsection* +axis_ref (optional): +\emph on +string +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: axis_ref +\end_layout + +\begin_layout Standard +Defines an axis for the current field. + If the attribute is defined, the attribute +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +grid_ref +\end_layout + +\end_inset + + must not be specified. +\end_layout + +\begin_layout Subsection* +scalar_ref (optional): +\emph on +string +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: scalar_ref +\end_layout + +\begin_layout Standard +Defines a scalar domain for the current field. + If the attribute is defined, the attribute +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +grid_ref +\end_layout + +\end_inset + + must not be specified. +\end_layout + +\begin_layout Subsection* +grid_path (optional): +\emph on +string +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: grid_path +\end_layout + +\begin_layout Standard +Defines the way operations pass from a grid to other grids, combined with + field_ref attribute. + Each grid name in +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +grid_path +\end_layout + +\end_inset + + must be separated by a comma. + All tranformation realated to the grid listed in grid_path will be applyed + successively, including the grid destination associated to the destination + field. + +\end_layout + +\begin_layout Subsection* +default_value (optional): +\emph on +double +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +DOUBLE PRECISION :: default_value +\end_layout + +\begin_layout Standard +Defines the value which will be used instead of missing field data. + For an entry field (coming from model, or from an input file), if +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +detect_missing_value +\end_layout + +\end_inset + + and +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +default_value +\end_layout + +\end_inset + + are defined the values of the field equal to +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +default_value +\end_layout + +\end_inset + + will be replaced by NaN. + For output field (read from the model or sent to server), the NaN values + will be replaced by +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +default_value +\end_layout + +\end_inset + +, if defined. + For masked value, in output, if +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +default_value +\end_layout + +\end_inset + + is defined, the corresponding value will be replaced by +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +default_value +\end_layout + +\end_inset + +, otherwise, the value is undefined and will depend of the initial value + of the allocated memory block. +\end_layout + +\begin_layout Subsection* +valid_min (optional): +\emph on +double +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +DOUBLE PRECISION :: valid_min +\end_layout + +\begin_layout Standard +Define the minimum validity range of the field as it will be written as + a field metadata in the output file, accordingly to CF compliance. + +\end_layout + +\begin_layout Subsection* +valid_max (optional): +\emph on +double +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +DOUBLE PRECISION :: valid_max +\end_layout + +\begin_layout Standard +Define the maximum validity range of the field as it will be written as + a field metadata in the output file, accordingly to CF compliance. + +\end_layout + +\begin_layout Subsection* +detect_missing_value (optional): +\emph on +bool +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +LOGICAL: detect_missing_value +\end_layout + +\begin_layout Standard +For entry field, if +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +detect_missing_value +\end_layout + +\end_inset + + is set to true and +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +default_value +\end_layout + +\end_inset + + is defined, the corresponding value will be replaced by NaN (see +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +default_value +\end_layout + +\end_inset + + attribute). + This attribute is also used during temporal operation such as averaging, + minimum, maximum, accumulate..., to detect NaN value and remove it from the + computation (otherwise the result will be NaN). + It is used also in some spatial transformation, but will be replaced later + by a specific detect_missing value attribute related to the transformation. +\end_layout + +\begin_layout Subsection* +add_offset (optional): +\emph on +double +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +DOUBLE PRECISION: add_offset +\end_layout + +\begin_layout Standard +Sets the +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +add_offset +\end_layout + +\end_inset + + metadata CF attribute in an output file. + In output, the +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +add_offset +\end_layout + +\end_inset + + value will be subtracted from the field values. + It can be used together with +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +scale_factor +\end_layout + +\end_inset + + and +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +prec +\end_layout + +\end_inset + + attributes in order to reduce the data range and the volume of written + data. + Fo reading, this attribute is also taking into account to +\begin_inset Quotes eld +\end_inset + +decompress +\begin_inset Quotes erd +\end_inset + + data. +\end_layout + +\begin_layout Subsection* +scale_factor: +\emph on +double +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +DOUBLE PRECISION: scale_factor +\end_layout + +\begin_layout Standard +Sets the +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +scale_factor +\end_layout + +\end_inset + + metadata CF attribute in an output file. + In output, the field values will be divided by the +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +scale_factor +\end_layout + +\end_inset + + value. + It can be used together with +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +add_offset +\end_layout + +\end_inset + + and +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +prec +\end_layout + +\end_inset + + attributes in order to reduce the data range and the volume of written + data. + Fo reading, this attribute is also taking into account to +\begin_inset Quotes eld +\end_inset + +decompress +\begin_inset Quotes erd +\end_inset + + data. +\end_layout + +\begin_layout Subsection* +compression_level (optional): +\emph on +integer +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: compression_level +\end_layout + +\begin_layout Standard +Defines whether a field should be compressed using NetCDF-4 built-in compression. + The compression level must range from 0 to 9. + A higher compression level means a better compression at the cost of using + more processing power. + The default value is inherited from the file attribute +\series bold +compression_level +\series default +. +\end_layout + +\begin_layout Subsection* +indexed_output (optional): +\emph on +bool +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +LOGICAL :: indexed_output +\end_layout + +\begin_layout Standard +Defines whether field data must be output as an indexed grid instead of + a full grid whenever possible. + The default value is +\series bold +\emph on +false +\series default +\emph default +. +\end_layout + +\begin_layout Subsection* +ts_enabled (optional): +\emph on +bool +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +LOGICAL :: ts_enabled +\end_layout + +\begin_layout Standard +Defines whether a field can be output as a timeseries. + The default value is +\series bold +\emph on +false +\series default +\emph default +. + A field will be tagged as timeseries if +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +ts_enabled +\end_layout + +\end_inset + + is set to true, and the associated file attribute timeserie is set to +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +only +\end_layout + +\end_inset + +, +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +both +\end_layout + +\end_inset + + or +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +exclusive +\end_layout + +\end_inset + +. + A field tagged as timeseries will be output alone in a specific file suffixed + by the field name. + +\end_layout + +\begin_layout Subsection* +ts_split_freq (optional): +\emph on +duration +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +TYPE(xios_duration) :: ts_split_freq +\end_layout + +\begin_layout Standard +Defines the splitting frequency that should be used for a timeseries if + it has been requested. + By default the attribute value is inherited from the file attribute +\series bold +split_freq +\series default +. +\end_layout + +\begin_layout Subsection* +cell_methods (optional): +\emph on +string +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: cell_methods +\end_layout + +\begin_layout Standard +Defines the cell methods field attribute. + it will be written as associated field metadata, accordingly to CF compliance. +\end_layout + +\begin_layout Subsection* +cell_methods_mode (optional): enumeration +\emph on + {overwrite, prefix, suffix, none} +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: cell_methods_mode +\end_layout + +\begin_layout Standard +Defines the cell methods mode of a field. + +\end_layout + +\begin_layout Standard +XIOS defined itself the cell_method string, taking into account the operations + applied on the field. + But in some case it can modified, with the +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +cell_methods +\end_layout + +\end_inset + + attribute. + +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +overwrite +\end_layout + +\end_inset + + will replace the computed default string by the +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +cell_methods +\end_layout + +\end_inset + + attribute, +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +prefix +\end_layout + +\end_inset + + will prefix the default string, and +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +suffix +\end_layout + +\end_inset + + will suffix the default string. +\end_layout + +\begin_layout Subsection* +comment (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +string +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: comment +\end_layout + +\begin_layout Standard +Allows a user to set a comment. + Meaningfull on XIOS workflow. +\end_layout + +\begin_layout Section +Variable attribute reference +\end_layout + +\begin_layout Subsection* +name (optional): +\emph on +string +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: name +\end_layout + +\begin_layout Standard +Defines the name of a variable as it will appear in an output file. + If not present, the variable +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +id +\end_layout + +\end_inset + + will be used. +\end_layout + +\begin_layout Subsection* +type (mandatory): enumeration {bool, int, int32, int16, int64, float, double, + string} +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: type +\end_layout + +\begin_layout Standard +Defines the type of a variable. + Note that the +\series bold +\emph on +int +\series default +\emph default + type is a synonym for +\series bold +\emph on +int32 +\series default +\emph default +. +\end_layout + +\begin_layout Subsection* +ts_target (optional): enumeration {file, field, both, none} +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: ts_target +\end_layout + +\begin_layout Standard +This attribute specify if a variable present in a file (global attribute) + must be reported in each timeseries generated file. + If +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +ts_target=none +\end_layout + +\end_inset + +, the variable is not included, if +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +ts_target=file +\end_layout + +\end_inset + +, the variable is included in each generated file as global attribute, if + +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +ts_target=field +\end_layout + +\end_inset + +, the variable is included as field attribute associated to the generated + files (field metadata), if +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +ts_target=both +\end_layout + +\end_inset + +, the varible is included twice as file global attribute and field attribute. + +\end_layout + +\begin_layout Section +File attribute reference +\end_layout + +\begin_layout Subsection* +name (optional): +\emph on +string +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: name +\end_layout + +\begin_layout Standard +Defines the name of a file. + If not specified a name is automaticaly defined from the file id. + For netcdf output, a +\begin_inset Quotes eld +\end_inset + + +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +.nc +\end_layout + +\end_inset + + +\begin_inset Quotes erd +\end_inset + + suffix will be added to the file name. +\end_layout + +\begin_layout Subsection* +description (optional): +\emph on +string +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: description +\end_layout + +\begin_layout Standard +Defines the description of a file. +\end_layout + +\begin_layout Subsection* +name_suffix (optional): +\emph on +string +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: name_suffix +\end_layout + +\begin_layout Standard +Defines a suffix added to the file name. +\end_layout + +\begin_layout Subsection* +min_digits (optional): +\emph on +integer +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: min_digits +\end_layout + +\begin_layout Standard +For the +\series bold +multiple_file +\series default + mode defines the minimum number of digits of the suffix describing the + server rank which will be appended to the file name. + The default value is +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +0 +\end_layout + +\end_inset + + (no server rank suffix is added). +\end_layout + +\begin_layout Subsection* +output_freq (mandatory): +\emph on +duration +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +TYPE(xios_duration) :: output_freq +\end_layout + +\begin_layout Standard +Defines the output frequency for the current file. +\end_layout + +\begin_layout Subsection* +output_level (optional): +\emph on +integer +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: output_level +\end_layout + +\begin_layout Standard +Defines the output level for all fields of the current file. + The field is output only if the field attribute +\series bold +level +\series default + is less or equal to the file attribute +\series bold +output_level +\series default +. +\end_layout + +\begin_layout Subsection* +sync_freq (optional): +\emph on +duration +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +TYPE(xios_duration) :: sync_freq +\end_layout + +\begin_layout Standard +Defines the frequency for flushing the current file onto a disk. + It may result in poor performances but data will be written even if a file + is not yet closed. +\end_layout + +\begin_layout Subsection* +split_freq (optional): +\emph on +duration +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +TYPE(xios_duration) :: split_freq +\end_layout + +\begin_layout Standard +Defines the frequency for splitting the current file. + The start and end dates will be added to the file name (see +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout + +\series bold +\emph on +split_freq_format +\end_layout + +\end_inset + + attribute). + By default no splitting is done. +\end_layout + +\begin_layout Subsection* +split_freq_format (optional): +\emph on +string +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: split_freq_format +\end_layout + +\begin_layout Standard +Defines the format of the split date suffixed to a file. + It can contain any character, +\emph on + +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +%y +\end_layout + +\end_inset + + +\emph default + will be replaced by the year (4 characters), +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +%mo +\end_layout + +\end_inset + + by the month (2 char), +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +%d +\end_layout + +\end_inset + + by the day (2 char), +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +%h +\end_layout + +\end_inset + + by the hour (2 char), +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +%mi +\end_layout + +\end_inset + + by the minute (2 char), +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +%s +\end_layout + +\end_inset + + by the second (2 char), +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +%S +\end_layout + +\end_inset + + by the number of seconds since the time origin and +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +%D +\end_layout + +\end_inset + + by the number of full days since the time origin. + The default behavior is to create a suffix with the date until the smaller + non zero unit. + For example, in one day split frequency, the hour, minute and second will + not appear in the suffix, only year, month and day. +\end_layout + +\begin_layout Subsection* +split_start_offset (optional): +\emph on +duration +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +TYPE(xios_duration) :: split_start_offset +\end_layout + +\begin_layout Standard +Defines the offset of the start splitting date when +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +split_freq +\end_layout + +\end_inset + + attribute is enabled. + This attribute is used only to shift the start date of the splitting format. + It has no impact on the real splitting date. + +\end_layout + +\begin_layout Subsection* +split_end_offset(optional): +\emph on +duration +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +TYPE(xios_duration) :: split_end_offset +\end_layout + +\begin_layout Standard +Defines the offset of the end splitting date when +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +split_freq +\end_layout + +\end_inset + + attribute is enabled. + This attribute is used only to shift the end date of the splitting format. + It has no impact on the real splitting date. + +\end_layout + +\begin_layout Subsection* +split_last_date (optional): +\emph on +string +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: split_last_date +\end_layout + +\begin_layout Standard +Define the end splitting date when +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +split_freq +\end_layout + +\end_inset + + attribute is enabled. + If +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +split_last_date +\end_layout + +\end_inset + + is lesser than the compute end splitting date, then the end splitting date + will be replaced by +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +split_last_date +\end_layout + +\end_inset + + in the file name. + This attribute can be usefull when a simulation is over before the computed + splitting date, to be consistent with the file internal calendar. + The format of +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +split_last_date +\end_layout + +\end_inset + + string attribute must be consistent with a date. + +\end_layout + +\begin_layout Subsection* +enabled (optional): +\emph on +bool +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +LOGICAL :: enabled +\end_layout + +\begin_layout Standard +Defines if a file must be written/read or not. + The default value is +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +true +\end_layout + +\end_inset + +. +\end_layout + +\begin_layout Subsection* +mode (optional): +\emph on +enumeration {read, write} +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: mode +\end_layout + +\begin_layout Standard +Defines whether a file will be read or written. + The default value is +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +write +\end_layout + +\end_inset + +. +\end_layout + +\begin_layout Subsection* +type (optionnal): +\emph on +enumeration {one_file, multiple_file} +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: type +\end_layout + +\begin_layout Standard +Defines the type of a file: +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout + +\emph on +multiple_file +\end_layout + +\end_inset + +: one file by server using sequential netcdf writing, +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout + +\emph on +one_file +\end_layout + +\end_inset + +: one single global file is wrote using netcdf4 parallel access. + The default value is +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +multiple_file +\end_layout + +\end_inset + +. +\end_layout + +\begin_layout Subsection* +format (optional): +\emph on +enumeration {netcdf4, netcdf4_classic} +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: format +\end_layout + +\begin_layout Standard +Define the format of a file: +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout + +\emph on +netcdf4 +\end_layout + +\end_inset + +: the HDF5 format will be used, +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout + +\emph on +netcdf4 +\emph default +_ +\emph on +classic +\end_layout + +\end_inset + +: the classic NetCDF format will be used. + The default value is +\series bold +\emph on +netcdf4 +\series default +\emph default +. + Note that the +\series bold +\emph on +netcdf4 +\emph default +_ +\emph on +classic +\series default +\emph default + format can be used with the attribute +\series bold +type +\series default + set to +\series bold +\emph on +one_file +\series default +\emph default + only if the NetCDF4 library was compiled with Parallel NetCDF support (–enable- +pnetcdf). +\end_layout + +\begin_layout Subsection* +par_access (optional): +\emph on +enumeration {collective, independent} +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: par_access +\end_layout + +\begin_layout Standard +For parallel writing, defines which type of MPI calls will be used. + The default value is +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout + +\emph on +collective +\end_layout + +\end_inset + +. + Nota : this attribute is now deprecated, and has no effect on I/O parallelism. + +\end_layout + +\begin_layout Subsection* +read_metadata_par (optional): +\emph on +bool +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +LOGICAL :: read_metadata_par +\end_layout + +\begin_layout Standard +For files in the read mode, defines if parallel or serial I/O will be used + by model processes for reading file metadata. + The default value is false implying serial I/O for reading metadata on + client side. + +\end_layout + +\begin_layout Subsection* +convention (optional): +\emph on +enumeration {CF, UGRID} +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: convention +\end_layout + +\begin_layout Standard +Defines the file conventions. + The netcdf file can be output following the CF convention (1.7) or the UGRID + convention, usefull for unstructured mesh. + By default the CF conventions are followed. + The global file attribute +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +Conventions +\end_layout + +\end_inset + + will be added in the output file following the specified value. +\end_layout + +\begin_layout Subsection* +convention_str (optional): +\emph on +string +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: convention_str +\end_layout + +\begin_layout Standard +Defines the +\series bold +Conventions +\series default +attribute to be added to file global attributes. + This attribute will overwrite the +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +Conventions +\end_layout + +\end_inset + + global file attribute generated by the +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +convention +\end_layout + +\end_inset + + XIOS attribute. +\end_layout + +\begin_layout Subsection* +append (optional): +\emph on +bool +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +LOGICAL :: append +\end_layout + +\begin_layout Standard +If this attribute is set to +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +true +\end_layout + +\end_inset + + and if the file is present, the file is open, and data will be append at + the specified time record. + If the time record already exists, data will be overwritten, otherwise + a new time record is created and data is appended. + If append is set to +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +false +\end_layout + +\end_inset + +, a new file will be created, even if a old file is present, overwritting + it. + The default value is +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +append = false +\end_layout + +\end_inset + +. +\end_layout + +\begin_layout Subsection* +compression_level (optional): +\emph on +integer +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: compression_level +\end_layout + +\begin_layout Standard +Defines whether the fields should be compressed using NetCDF-4 built-in + compression by default. + The compression level must range from 0 to 9. + A higher compression level means a better compression at the cost of using + more processing power. + The default value is +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout + +\emph on +0 +\end_layout + +\end_inset + + (no compression). +\end_layout + +\begin_layout Subsection* +time_counter (optional): +\emph on +enumeration {centered, instant, record, exclusive, centered_exclusive, instant_e +xclusive, none} +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: time_counter +\end_layout + +\begin_layout Standard +Defines how the +\begin_inset Quotes eld +\end_inset + +time_counter +\begin_inset Quotes erd +\end_inset + + variable will be output: +\end_layout + +\begin_layout Itemize + +\series bold +\emph on +centered +\series default +\emph default +: use centered times (default option for all field operations except for + instant) +\end_layout + +\begin_layout Itemize + +\series bold +\emph on +instant +\series default +\emph default +: use instant times (default option for field operation +\series bold +instant +\series default +) +\end_layout + +\begin_layout Itemize + +\series bold +\emph on +record +\series default +\emph default +: use record indexes +\end_layout + +\begin_layout Itemize + +\series bold +\shape italic +centered_exclusive: +\series default +\shape default +do not include centered times into an output file +\end_layout + +\begin_layout Itemize + +\series bold +\shape italic +\emph on +instant_ +\emph default +exclusive: +\series default +\shape default +do not include instant times into an output file +\end_layout + +\begin_layout Itemize + +\series bold +\shape italic +exclusive: +\series default +\shape default +include neither instant times nor centered times into an output file +\end_layout + +\begin_layout Itemize + +\series bold +\emph on +none +\series default +\emph default +: do not output the variable. +\end_layout + +\begin_layout Standard +The default value is +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +centered +\end_layout + +\end_inset + + if there are only centered time axis. + It will be +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +instant +\end_layout + +\end_inset + + if there are only instant time axis. + If both instant and centered time axis are present, the default value will + be +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +centered +\end_layout + +\end_inset + +. + +\end_layout + +\begin_layout Subsection* +time_counter_name (optional): +\emph on +string +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: time_counter_name +\end_layout + +\begin_layout Standard +Define the name of a time counter. + The default value is +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +time_counter +\end_layout + +\end_inset + +. +\end_layout + +\begin_layout Subsection* +timeseries (optional): +\emph on +enumeration {none, only, both, exclusive} +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: time_series +\end_layout + +\begin_layout Standard +Defines whether the timeseries must be output: +\end_layout + +\begin_layout Itemize + +\series bold +\emph on +none +\series default +\emph default +: no timeseries is outputted, only the regular file +\end_layout + +\begin_layout Itemize + +\series bold +\emph on +only +\series default +\emph default +: only the timeseries is outputted, the regular file is not created +\end_layout + +\begin_layout Itemize + +\series bold +\emph on +both +\series default +\emph default +: both the timeseries and the regular file are outputted. +\end_layout + +\begin_layout Itemize + +\series bold +\emph on +exclusive +\series default +\emph default +: the timeseries is outputted and a regular file is created with only the + fields which were not marked for output as a timeseries (if any). +\end_layout + +\begin_layout Standard +When time series is enabled, each tagged field (see +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +ts_enabled +\end_layout + +\end_inset + + field attribute) is output into a separate file. + The default value is +\series bold +\emph on +none +\series default +\emph default +. +\end_layout + +\begin_layout Subsection* +ts_prefix (optional): +\emph on +string +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: ts_prefix +\end_layout + +\begin_layout Standard +Defines the prefix to use for the name of the timeseries files. + By default the file name will be used. +\end_layout + +\begin_layout Subsection* +time_units (optional): +\emph on +enumeration {seconds, days} +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: time_units +\end_layout + +\begin_layout Standard +Define the time unit of the time axis present in the file. + Two choices are possible : +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +seconds +\end_layout + +\end_inset + + or +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +days +\end_layout + +\end_inset + +. + The default value is +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +seconds +\end_layout + +\end_inset + +. +\end_layout + +\begin_layout Subsection* +record_offset (optional): +\emph on +integer +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: record_offset +\end_layout + +\begin_layout Standard +Defines an offset for the time records associated to the file. + For a file in +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +read +\end_layout + +\end_inset + + mode, the first record sent will be shift of +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +record_offset +\end_layout + +\end_inset + + value instead of 0. + For file in write mode, the first time record to be output will begin from + +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +record_offset +\end_layout + +\end_inset + + value. + The default value is 0. +\end_layout + +\begin_layout Subsection* +cyclic (optional): +\emph on +bool +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +LOGICAL :: cyclic +\end_layout + +\begin_layout Standard +If the option is activated for fields to be read, then upon reaching the + last time record, reading will continue +\begin_inset Quotes eld +\end_inset + +cycle +\begin_inset Quotes erd +\end_inset + + at the first time record. + The default value is false. +\end_layout + +\begin_layout Subsection* +time_stamp_name (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +string +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: time_stamp_name +\end_layout + +\begin_layout Standard +Defines the timestamp name of the date and time when the program was executed + which will be written into an output file. + The default value is +\begin_inset Quotes eld +\end_inset + +timeStamp +\begin_inset Quotes erd +\end_inset + +. +\end_layout + +\begin_layout Subsection* +time_stamp_format (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +string +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: time_stamp_format +\end_layout + +\begin_layout Standard +Defines the timestamp format of the date and time when the program was executed + to be written into an output file. + It can contain any character. + +\emph on + +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +%Y +\end_layout + +\end_inset + + +\emph default + will be replaced by the 4-digit year (4 digits), while +\emph on + +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +%y +\end_layout + +\end_inset + + +\emph default + will be replaced by the 2-digit year. + +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +%m +\end_layout + +\end_inset + + will be by the 2-digit month, while %b will be replaced by the 3-character + month. + +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +%d +\end_layout + +\end_inset + + will be replaced by the day (2 char), +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +%H +\end_layout + +\end_inset + + by the hour (2 char), +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +%M +\end_layout + +\end_inset + + by the minute (2 char), +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +%S +\end_layout + +\end_inset + + by the number of seconds, +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +%D +\end_layout + +\end_inset + + by the date in the MM/DD/YY format. +\end_layout + +\begin_layout Subsection* +uuid_name (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +string +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: uuid_name +\end_layout + +\begin_layout Standard +Defines the name of the global attribute designing the UUID of the file. + The default global attribute is +\begin_inset Quotes eld +\end_inset + + +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +uuid +\end_layout + +\end_inset + + +\begin_inset Quotes erd +\end_inset + +. +\end_layout + +\begin_layout Subsection* +uuid_format (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +string +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: uuid_format +\end_layout + +\begin_layout Standard +Defines the format of file's UUID. + In the +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +uuid_format +\end_layout + +\end_inset + + string, the sub-string +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +%uuid% +\end_layout + +\end_inset + + will be replaced by string computed UUID. +\end_layout + +\begin_layout Subsection* +comment (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +string +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: comment +\end_layout + +\begin_layout Standard +Allows a user to set a comment. +\end_layout + +\begin_layout Section +Transformation attribute reference +\end_layout + +\begin_layout Subsection +reduce_scalar_to_scalar +\end_layout + +\begin_layout Subsection* +operation (mandatory): +\emph on +enumeration {min, max, sum, average} +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: operation +\end_layout + +\begin_layout Standard +Defines the type of reduction operation performed on the scalar. + Like a scalar is redondant accross process (except if masked), the reduction + will be similar to a MPI reduction accros procces. + +\end_layout + +\begin_layout Subsection +extract_axis_to_scalar +\end_layout + +\begin_layout Subsection* +position: +\emph on +integer +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: position +\end_layout + +\begin_layout Standard +Global index of a point on an axis to be extracted into a scalar. +\end_layout + +\begin_layout Standard + +\end_layout + +\begin_layout Subsection +interpolate_axis +\end_layout + +\begin_layout Subsection* +type (optional): +\emph on +string +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: type +\end_layout + +\begin_layout Standard +Defines the interpolation type on an axis. + For now only polynomial interpolation is available, so this attribute is + currently meaningless. + +\end_layout + +\begin_layout Subsection* +order (optional): +\emph on +integer +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: order +\end_layout + +\begin_layout Standard +Defines the order of interpolation. + The default value is 2. +\end_layout + +\begin_layout Subsection* +coordinate (optional): +\emph on +string +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: coordinate +\end_layout + +\begin_layout Standard +Defines the coordinate associated with an axis on which interpolation will + be performed. +\end_layout + +\begin_layout Subsection +reduce_axis_to_axis +\end_layout + +\begin_layout Subsection* +operation (mandatory): +\emph on +enumeration {min, max, sum, average} +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: operation +\end_layout + +\begin_layout Standard +Defines a reduction operation performed on an axis across model processes. +\end_layout + +\begin_layout Subsection +reduce_axis_to_scalar +\end_layout + +\begin_layout Standard +Reduces data defined on an axis into a scalar value. +\end_layout + +\begin_layout Subsection* +operation (mandatory): +\emph on +enumeration {min, max, sum, average} +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: operation +\end_layout + +\begin_layout Subsection +zoom_axis +\end_layout + +\begin_layout Subsection* +begin (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +integer +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: begin +\end_layout + +\begin_layout Standard +Defines the beginning index of a zoomed region on a global axis. + The attribute value should be an integer between +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +0 +\end_layout + +\end_inset + + and +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +ni_glo-1 +\end_layout + +\end_inset + + of the associated axis. + If not specified the default value is +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +0 +\end_layout + +\end_inset + +. +\end_layout + +\begin_layout Subsection* +n (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +integer +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: n +\end_layout + +\begin_layout Standard +Defines the size of a zoomed region on a global axis. + The attribute value should be an integer between +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +1 +\end_layout + +\end_inset + +and +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +nj_glo +\end_layout + +\end_inset + + of the associated axis. + If not specified the default value is +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +nj_glo +\end_layout + +\end_inset + + of the associated axis. +\end_layout + +\begin_layout Subsection +compute_connectivity_domain +\end_layout + +\begin_layout Subsection* +n_neighbor: +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +1D-array of integer +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: n_neighbor(:) +\end_layout + +\begin_layout Subsection* +local_neighbor: +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +2D-array of integer +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: local_neighbor(:,:) +\end_layout + +\begin_layout Subsection* +n_neighbor_max: +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +integer +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: n_neighbor_max +\end_layout + +\begin_layout Subsection +extract_domain_to_axis +\end_layout + +\begin_layout Subsection* +position (optional): +\emph on +integer +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: position +\end_layout + +\begin_layout Standard +Defines the index on a domain starting which an axis will be extracted along + the direction specified with the +\series bold +direction +\series default + attribute. +\end_layout + +\begin_layout Subsection* +direction (mandatory): +\emph on +enumeration {iDir, jDir} +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: direction +\end_layout + +\begin_layout Standard +Defines the domain dimension along which an axis will be extracted. + +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +iDir +\end_layout + +\end_inset + + means along the direction i, +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +jDir +\end_layout + +\end_inset + + along the direction j. +\end_layout + +\begin_layout Subsection +interpolate_domain +\end_layout + +\begin_layout Subsection* +order (optional): +\emph on +integer +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: order +\end_layout + +\begin_layout Standard +Defines the order of interpolation. + This attribute is only for internal interpolation module. + Currently, only first order and second order are available for conservative + interpolations. + The default value is +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +2 +\end_layout + +\end_inset + +. +\end_layout + +\begin_layout Subsection* +renormalize (optional): +\emph on +bool +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +LOGICAL :: renormalize +\end_layout + +\begin_layout Standard +This flag is usefull only when targeted cells intersect masked source cells. + In case a field corresponding to a flux value, the result of the interpolation + remain correct. + Otherwise for intensive field, the computed value need to be renormalize + prorate of the non masked intersected area to remain correct. + This flag activate these functionnality. + Default value is +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +false +\end_layout + +\end_inset + +. +\end_layout + +\begin_layout Subsection* +quantitity (optional): +\emph on +bool +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +LOGICAL :: quantity +\end_layout + +\begin_layout Standard +If this flag is set, the interpolation will preserve extensive property + of the field. + Default value is +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +false +\end_layout + +\end_inset + +. +\end_layout + +\begin_layout Subsection* +use_area (optional): +\emph on +bool +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +LOGICAL :: use_area +\end_layout + +\begin_layout Standard +If this flag is set, given area for source and target domain (if any) will + be used to renormalize compute weight by the ratio given area / computed + area. + Default value is +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +false +\end_layout + +\end_inset + +. +\end_layout + +\begin_layout Subsection* +detect_missing_value (optional): +\emph on +bool +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +LOGICAL :: detect_missing_value +\end_layout + +\begin_layout Standard +If flag is set to true, input data of the field to be interpolated are analyzed + to detect missing values. + Detected cells are considered as masked and will be taking into account + for interpolation in a similar way than the domain mask. + Default value is +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +false +\end_layout + +\end_inset + +. +\end_layout + +\begin_layout Subsection* +mode (optionnal): +\emph on +enumeration {compute, read, read_or_compute} +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: mode +\end_layout + +\begin_layout Standard +Define if interpolation must be computed (compute), read from file (read), + or if find file weight, read otherwise compute (read_or_compute). + Default value is +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +compute +\end_layout + +\end_inset + +. +\end_layout + +\begin_layout Subsection* +write_weight (optional): +\emph on +bool +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +LOGICAL :: write_weight +\end_layout + +\begin_layout Standard +If this flag is set, the computed weights will be written in file. + If weights are already read from a file, nothing will happen. + Default value is +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +false +\end_layout + +\end_inset + +. +\end_layout + +\begin_layout Subsection* +weight_filename (optional): +\emph on +string +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: weight_filename +\end_layout + +\begin_layout Standard +Define the file name where the weights will be written or read. + If not specified when trying to read or write, a name will be automatically + generated. + +\end_layout + +\begin_layout Subsection* +read_write_convention (optionnal): +\emph on +enumeration {c, fortran} +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: read_write_convention +\end_layout + +\begin_layout Standard +Define the convention for pair of global index source and destination for + wich a weight is defined. + For C convention, index will begin to 0, for fortran, index will begin + to 1. + Usefull only for read ar write weights from/to a file. + Default value is corresponding to C convention. +\end_layout + +\begin_layout Subsection +reduce_domain_to_axis +\end_layout + +\begin_layout Subsection* +direction: +\emph on +enumeration {iDir, jDir} +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: direction +\end_layout + +\begin_layout Standard +Defines the domain dimension along which a reduction of the domain into + an axis will be performed. + +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +iDir +\end_layout + +\end_inset + + means along the direction i, +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +jDir +\end_layout + +\end_inset + + along the direction j. +\end_layout + +\begin_layout Subsection* +operation (mandatory): +\emph on +enumeration {min, max, sum, average} +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: operation +\end_layout + +\begin_layout Standard +Defines the reduction operation performed on the domain. +\end_layout + +\begin_layout Subsection* +local (optionnal): +\emph on +bool +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +LOGICAL :: local +\end_layout + +\begin_layout Standard +Defines whether the reduction should be performed locally on data owned + by each process or on the global domain. +\end_layout + +\begin_layout Subsection +reduce_domain_to_scalar +\end_layout + +\begin_layout Standard +Reduces data defined on a domain into a scalar value. +\end_layout + +\begin_layout Subsection* +operation (mandatory): +\emph on +enumeration {min, max, sum, average} +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: operation +\end_layout + +\begin_layout Standard +Defines the reduction operation performed on the domain. +\end_layout + +\begin_layout Subsection* +local (optionnal): +\emph on +bool +\emph default + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +LOGICAL :: local +\end_layout + +\begin_layout Standard +Defines whether the reduction should be performed locally on data owned + by each process or on the global domain. + The default value is +\begin_inset Flex Code +status open + +\begin_layout Plain Layout +false +\end_layout + +\end_inset + +. +\end_layout + +\begin_layout Subsection +reorder_domain +\end_layout + +\begin_layout Subsection* +invert_lat (optional): +\emph on +bool +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +LOGICAL :: invert_lat +\end_layout + +\begin_layout Standard +Defines whether the latitude should be inverted. + The default value is false. +\end_layout + +\begin_layout Subsection* +shift_lon_fraction (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +double +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +DOUBLE PRECISION :: shift_lon_fraction +\end_layout + +\begin_layout Standard +Defines the longitude offset. + The value of the parameter represents a fraction of +\series bold +ni_glo +\series default +. + Default value is 0. +\end_layout + +\begin_layout Subsection* +min_lon (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +double +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +DOUBLE PRECISION :: min_lon +\end_layout + +\begin_layout Standard +If both, +\series bold +min_lon +\series default + and +\series bold +max_lon +\series default +, are defined, a domain will be reordered with latitude values starting + from +\series bold +min_lon +\series default + and ending at +\series bold +max_lon +\series default +. +\end_layout + +\begin_layout Subsection* +max_lon (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +double +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +DOUBLE PRECISION :: max_lon +\end_layout + +\begin_layout Standard +If both, +\series bold +min_lon +\series default + and +\series bold +max_lon +\series default +, are defined, a domain will be reordered with latitude values starting + from +\series bold +min_lon +\series default + and ending at +\series bold +max_lon +\series default +. +\end_layout + +\begin_layout Subsection +expand_domain +\end_layout + +\begin_layout Subsection* +order: +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +integer +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: order +\end_layout + +\begin_layout Standard +Define the size of the halo expansion. +\end_layout + +\begin_layout Subsection* +type (optional): +\emph on +enumeration {node, edge} +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*) :: type +\end_layout + +\begin_layout Standard +Defines whether the node or edge connectivity should be calculated for the + expanded domain. +\end_layout + +\begin_layout Subsection* +i_periodic (optional): +\emph on +bool +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +LOGICAL :: i_periodic +\end_layout + +\begin_layout Standard +If the attribute value is true, values of fields defined on the expanded + domain will be duplicated from those of the original domain periodically + along the first dimension. + The default value is false (masked values on the expanded domain). +\end_layout + +\begin_layout Subsection* +j_periodic (optional): +\emph on +bool +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +LOGICAL :: j_periodic +\end_layout + +\begin_layout Standard +If the attribute value is true, values of fields defined on the expanded + domain will be duplicated from those of the original domain periodically + along the second dimension. + The default value is false (masked values on the expanded domain). +\end_layout + +\begin_layout Subsection +zoom_domain +\end_layout + +\begin_layout Subsection* +ibegin (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +integer +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: ibegin +\end_layout + +\begin_layout Standard +Defines the beginning index of the zoomed region on the first dimension + of the global domain. + This must be an integer between +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +0 +\end_layout + +\end_inset + + and +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +ni_glo-1 +\end_layout + +\end_inset + + of the associated dimension of domain. + If not specified the default value is +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +0 +\end_layout + +\end_inset + +. + Note that if one of the zoom attributes (ibegin, ni, jbegin or nj) is defined + then all the rest should be specified by a user as well. +\end_layout + +\begin_layout Subsection* +ni (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +integer +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: ni +\end_layout + +\begin_layout Standard +Define the size of zoomed region on the first dimension of the global domain. + This must be an integer between +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +1 +\end_layout + +\end_inset + +and +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +ni_glo +\end_layout + +\end_inset + + of the associated dimension of domain. + If not specified the default value is +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +ni_glo +\end_layout + +\end_inset + + of the dimension of domain. + Note that if one of the zoom attributes (ibegin, ni, jbegin or nj) is defined + then all the rest should be specified by a user as well. +\end_layout + +\begin_layout Subsection* +jbegin (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +integer +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: jbegin +\end_layout + +\begin_layout Standard +Define the beginning index of the zoomed region on the second dimension + of the global domain. + This must be an integer between +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +0 +\end_layout + +\end_inset + + and +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +nj_glo-1 +\end_layout + +\end_inset + + of the associated dimension of domain. + If not specified the default value is +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +0 +\end_layout + +\end_inset + +. + Note that if one of the zoom attributes (ibegin, ni, jbegin or nj) is defined + then all the rest should be specified by a user as well. +\end_layout + +\begin_layout Subsection* +nj (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +integer +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +INTEGER :: nj +\end_layout + +\begin_layout Standard +Define the size of zoomed region on the second dimension of the global domain. + The attribute value should be an integer between +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +1 +\end_layout + +\end_inset + +and +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +nj_glo +\end_layout + +\end_inset + + of the associated dimension of domain. + If not specified the default value is +\begin_inset Flex Strong +status collapsed + +\begin_layout Plain Layout +nj_glo +\end_layout + +\end_inset + + of the dimension of domain. + Note that if one of the zoom attributes (ibegin, ni, jbegin or nj) is defined + then all the rest should be specified by a user as well. +\end_layout + +\begin_layout Subsection +generate_rectilinear_domain +\end_layout + +\begin_layout Subsection* +lon_start (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +double +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +DOUBLE PRECISION :: lon_start +\end_layout + +\begin_layout Standard +Along with +\series bold +lon_end +\series default +, the attribute defines the longitude range of a generated domain. +\end_layout + +\begin_layout Subsection* +lon_end (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +double +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +DOUBLE PRECISION :: lon_end +\end_layout + +\begin_layout Standard +Along with +\series bold +lon_start +\series default +, the attribute defines the longitude range of a generated domain. +\end_layout + +\begin_layout Subsection* +lat_start (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +double +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +DOUBLE PRECISION :: lat_start +\end_layout + +\begin_layout Standard +Along with +\series bold +lat_end +\series default +, the attribute defines the latitude range of a generated domain. +\end_layout + +\begin_layout Subsection* +lat_end (optional): +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +double +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +DOUBLE PRECISION :: lat_end +\end_layout + +\begin_layout Standard +Along with +\series bold +lat_start +\series default +, the attribute defines the latitude range of a generated domain. +\end_layout + +\begin_layout Subsection* +bounds_lon_start: +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +double +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +DOUBLE PRECISION :: bounds_lon_start +\end_layout + +\begin_layout Standard +Attributes +\series bold +bounds_lon_start +\series default + and +\series bold +bounds_lon_start +\series default + set the longitude range of a generated domain. + If both sets, +\series bold +(lon_start, lon_end) +\series default + and +\series bold +(bounds_lon_start, bounds_lon_end) +\series default +, are specified then the bound attributes will be ignored. +\end_layout + +\begin_layout Subsection* +bounds_lon_end: +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +double +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +DOUBLE PRECISION :: bounds_lon_end +\end_layout + +\begin_layout Standard +Attributes +\series bold +bounds_lon_start +\series default + and +\series bold +bounds_lon_start +\series default + set the longitude range of a generated domain. + If both sets, +\series bold +(lon_start, lon_end) +\series default + and +\series bold +(bounds_lon_start, bounds_lon_end) +\series default +, are specified then the bound attributes will be ignored. +\end_layout + +\begin_layout Subsection* +bounds_lat_start: +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +double +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +DOUBLE PRECISION :: bounds_lat_start +\end_layout + +\begin_layout Standard +Attributes +\series bold +bounds_lat_start +\series default + and +\series bold +bounds_lat_start +\series default + set the latitude range of a generated domain. + If both sets, +\series bold +(lat_start, lat_end) +\series default + and +\series bold +(bounds_lat_start, bounds_lat_end) +\series default +, are specified then the bound attributes will be ignored. +\end_layout + +\begin_layout Subsection* +bounds_lat_end: +\begin_inset Flex Emph +status collapsed + +\begin_layout Plain Layout +double +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Fortran: +\end_layout + +\begin_layout LyX-Code +DOUBLE PRECISION :: bounds_lat_end +\end_layout + +\begin_layout Standard +Attributes +\series bold +bounds_lat_start +\series default + and +\series bold +bounds_lat_start +\series default + set the latitude range of a generated domain. + If both sets, +\series bold +(lat_start, lat_end) +\series default + and +\series bold +(bounds_lat_start, bounds_lat_end) +\series default +, are specified then the bound attributes will be ignored. +\end_layout + +\begin_layout Chapter +Fortran interface reference +\end_layout + +\begin_layout Section* +Initialization +\end_layout + +\begin_layout Subsection* +XIOS initialization +\end_layout + +\begin_layout Subsubsection* +Synopsis: +\end_layout + +\begin_layout LyX-Code +SUBROUTINE xios_initialize(client_id, local_comm, return_comm) +\end_layout + +\begin_layout LyX-Code + CHARACTER(LEN=*),INTENT(IN) :: client_id +\end_layout + +\begin_layout LyX-Code + INTEGER,INTENT(IN),OPTIONAL :: local_comm +\end_layout + +\begin_layout LyX-Code + INTEGER,INTENT(OUT),OPTIONAL :: return_comm +\end_layout + +\begin_layout Subsubsection* +Argument: +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +client_id +\end_layout + +\end_inset + +: client identifier +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +local_comm +\end_layout + +\end_inset + +: MPI communicator of the client +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +return_comm +\end_layout + +\end_inset + +: split return MPI communicator +\end_layout + +\begin_layout Subsubsection* +Description: +\end_layout + +\begin_layout Standard +This subroutine must be called before any other call of MPI client library. + It may be able to initialize MPI library (calling +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +MPI_Init +\end_layout + +\end_inset + +) if not already initialized. + Since XIOS is able to work in client/server mode (parameter +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +using_server=true +\end_layout + +\end_inset + +), the global communicator must be split and a local split communicator + is returned to be used by the client model for it own purpose. + If more than one model is present, XIOS could be interfaced with the OASIS + coupler (compiled with +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +-using_oasis +\end_layout + +\end_inset + + option and parameter +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +using_oasis=true +\end_layout + +\end_inset + +), so in this case, the splitting would be done globally by OASIS. +\end_layout + +\begin_layout Itemize +If MPI is not initialized, XIOS would initialize it calling MPI_Init function. + In this case, the MPI finalization would be done by XIOS in the +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +xios_finalize +\end_layout + +\end_inset + + subroutine, and must not be done by the model. +\end_layout + +\begin_layout Itemize +If OASIS coupler is not used (using_oasis=false) +\begin_inset Separator latexpar +\end_inset + + +\end_layout + +\begin_deeper +\begin_layout Itemize +If server mode is not activated ( +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +using_server=false +\end_layout + +\end_inset + +): if local_comm MPI communicator is specified then it would be used for + internal MPI communication otherwise +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +MPI_COMM_WORLD +\end_layout + +\end_inset + + communicator would be used by default. + A copy of the communicator (of +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +local_comm +\end_layout + +\end_inset + + or +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +MPI_COMM_WORLD +\end_layout + +\end_inset + +) would be returned in return_comm argument. + If +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +return_comm +\end_layout + +\end_inset + + is not specified, then +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +local_comm +\end_layout + +\end_inset + + or +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +MPI_COMM_WORLD +\end_layout + +\end_inset + + can be used by the model for it own communication. +\end_layout + +\begin_layout Itemize +If server mode is activated ( +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +using_server=true +\end_layout + +\end_inset + +): +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +local_comm +\end_layout + +\end_inset + + must not be specified since the global +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +MPI_COMM_WORLD +\end_layout + +\end_inset + + communicator would be split by XIOS. + The split communicator is returned in +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +return_comm +\end_layout + +\end_inset + + argument. +\end_layout + +\end_deeper +\begin_layout Itemize +If OASIS coupler is used ( +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +using_oasis=true +\end_layout + +\end_inset + +) +\begin_inset Separator latexpar +\end_inset + + +\end_layout + +\begin_deeper +\begin_layout Itemize +If server mode is not enabled ( +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +using_server=false +\end_layout + +\end_inset + +) +\begin_inset Separator latexpar +\end_inset + + +\end_layout + +\begin_deeper +\begin_layout Itemize +If +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +local_comm +\end_layout + +\end_inset + + is specified, it means that OASIS has been initialized by the model and + global communicator has been already split previously by OASIS, and passed + as +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +local_comm +\end_layout + +\end_inset + + argument. + The returned communicator would be a duplicate copy of +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +local_comm +\end_layout + +\end_inset + +. +\end_layout + +\begin_layout Itemize +Otherwise: if MPI was not initialized, OASIS will be initialized calling + +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +prism_init_comp_proto +\end_layout + +\end_inset + + subroutine. + In this case, XIOS will call +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +prism_terminate_proto +\end_layout + +\end_inset + + when +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +xios_finalized +\end_layout + +\end_inset + + is called. + The split communicator is returned in +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +return_comm +\end_layout + +\end_inset + + argument using +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +prism_get_localcomm_proto +\end_layout + +\end_inset + + return argument. +\end_layout + +\end_deeper +\begin_layout Itemize +If server mode is enabled ( +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +using_server=true +\end_layout + +\end_inset + +) +\begin_inset Separator latexpar +\end_inset + + +\end_layout + +\begin_deeper +\begin_layout Itemize +If +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +local_comm +\end_layout + +\end_inset + + is specified, it means that OASIS has been initialized by the model and + global communicator has been already split previously by OASIS, and passed + as local_comm argument. + The returned communicator return_comm would be a split communicator given + by OASIS. +\end_layout + +\begin_layout Itemize +Otherwise: if MPI was not initialized, OASIS will be initialized calling + +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +prism_init_comp_proto +\end_layout + +\end_inset + + subroutine. + In this case, XIOS will call +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +prism_terminate_proto +\end_layout + +\end_inset + + when +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +xios_finalized +\end_layout + +\end_inset + + is called. + The split communicator is returned in +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +return_comm +\end_layout + +\end_inset + + argument using +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +prism_get_localcomm_proto +\end_layout + +\end_inset + + return argument. +\end_layout + +\end_deeper +\end_deeper +\begin_layout Section* +Finalization +\end_layout + +\begin_layout Subsection* +XIOS finalization +\end_layout + +\begin_layout Subsubsection* +Synopsis: +\end_layout + +\begin_layout LyX-Code +SUBROUTINE xios_finalize() +\end_layout + +\begin_layout Subsubsection* +Arguments: +\end_layout + +\begin_layout Standard +None +\end_layout + +\begin_layout Subsubsection* +Description: +\end_layout + +\begin_layout Standard +This call must be done at the end of the simulation for a successful execution. + It gives the end signal to the xios server pools to finish it execution. + If MPI has been initialize by XIOS the MPI_Finalize will be called. + If OASIS coupler has been initialized by XIOS, then finalization will be + done calling +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +prism_terminate_proto +\end_layout + +\end_inset + + subroutine. +\end_layout + +\begin_layout Section* +Tree elements management subroutines +\end_layout + +\begin_layout Standard +This set of subroutines enables the models to interact, complete or query + the XML tree data base. + New elements or group of elements can be added as child in the tree, attributes + of the elements can be set or query. + The type of elements currently available are: context, axis, domain, grid, + field, variable and file. + An element can be identified by a string or by an handle associated to + the type of the element. + Root element (ex: +\begin_inset Quotes eld +\end_inset + +axis_definition +\begin_inset Quotes erd +\end_inset + +, +\begin_inset Quotes eld +\end_inset + +field_definition +\begin_inset Quotes erd +\end_inset + +,....) are considered like a group of element and are identified by a specific + string +\begin_inset Quotes eld +\end_inset + +element_definition +\begin_inset Quotes erd +\end_inset + + where element can be any one of the existing elements. +\end_layout + +\begin_layout Subsection* +Fortran type of the handles element +\end_layout + +\begin_layout Quotation +TYPE(xios_element) +\end_layout + +\begin_layout Standard +where +\begin_inset Quotes eld +\end_inset + +element +\begin_inset Quotes erd +\end_inset + + can be any one among +\begin_inset Quotes eld +\end_inset + +context +\begin_inset Quotes erd +\end_inset + +, +\begin_inset Quotes eld +\end_inset + +axis +\begin_inset Quotes erd +\end_inset + +, +\begin_inset Quotes eld +\end_inset + +domain +\begin_inset Quotes erd +\end_inset + +, +\begin_inset Quotes eld +\end_inset + +grid +\begin_inset Quotes erd +\end_inset + +, +\begin_inset Quotes eld +\end_inset + +field +\begin_inset Quotes erd +\end_inset + +, +\begin_inset Quotes eld +\end_inset + +variable +\begin_inset Quotes erd +\end_inset + + or +\begin_inset Quotes eld +\end_inset + +file +\begin_inset Quotes erd +\end_inset + +, or the associated group (excepted for context): +\begin_inset Quotes eld +\end_inset + +axis_group +\begin_inset Quotes erd +\end_inset + +, +\begin_inset Quotes eld +\end_inset + +domain_group +\begin_inset Quotes erd +\end_inset + +, +\begin_inset Quotes eld +\end_inset + +grid_group +\begin_inset Quotes erd +\end_inset + +, +\begin_inset Quotes eld +\end_inset + +field_group +\begin_inset Quotes erd +\end_inset + +, +\begin_inset Quotes eld +\end_inset + +variable_group +\begin_inset Quotes erd +\end_inset + + or +\begin_inset Quotes eld +\end_inset + +file_group +\begin_inset Quotes erd +\end_inset + +. +\end_layout + +\begin_layout Subsection* +Getting handles +\end_layout + +\begin_layout Subsubsection* +Synopsis: +\end_layout + +\begin_layout LyX-Code +SUBROUTINE xios_get_element_handle(id,handle) +\end_layout + +\begin_layout LyX-Code +CHARACTER(len = *) , INTENT(IN) :: id +\end_layout + +\begin_layout LyX-Code +TYPE(xios_element), INTENT(OUT):: handle +\end_layout + +\begin_layout Standard +where element is one of the existing elements or group of elements. +\end_layout + +\begin_layout Subsubsection* +Arguments: +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +id +\end_layout + +\end_inset + +: string identifier. +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +handle +\end_layout + +\end_inset + +: element handle +\end_layout + +\begin_layout Subsubsection* +Description: +\end_layout + +\begin_layout Standard +This subroutine returns the handle of the specified element identified by + its string. + The element must be existing otherwise an error is raised. +\end_layout + +\begin_layout Subsection* +Query for a valid element +\end_layout + +\begin_layout Subsubsection* +Synopsis: +\end_layout + +\begin_layout LyX-Code +LOGICAL FUNCTION xios_is_valid_element(id) +\end_layout + +\begin_layout LyX-Code +CHARACTER(len = *) , INTENT(IN) :: id +\end_layout + +\begin_layout Standard +where element is one of the existing elements or group of elements. +\end_layout + +\begin_layout Subsubsection* +Arguments: +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +id +\end_layout + +\end_inset + +: string identifier. +\end_layout + +\begin_layout Subsubsection* +Description: +\end_layout + +\begin_layout Standard +This function returns .TRUE. + if the element defined by the string identifier +\begin_inset Quotes eld +\end_inset + +id +\begin_inset Quotes erd +\end_inset + + exists in the data base, otherwise it returns .FALSE. + . +\end_layout + +\begin_layout Subsection* +Adding child +\end_layout + +\begin_layout Subsubsection* +Synopsis: +\end_layout + +\begin_layout LyX-Code +SUBROUTINE xios_add_element(parent_handle, child_handle, child_id) +\end_layout + +\begin_layout LyX-Code +TYPE(xios_element) , INTENT(IN) :: parent_handle +\end_layout + +\begin_layout LyX-Code +TYPE(xios_element) , INTENT(OUT):: child_handle +\end_layout + +\begin_layout LyX-Code +CHARACTER(len = *), OPTIONAL, INTENT(IN) :: child_id +\end_layout + +\begin_layout Standard +where element is one of the existing elements or element groups. +\end_layout + +\begin_layout Subsubsection* +Arguments: +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +parent_handle +\end_layout + +\end_inset + +: handle of the parent element. +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +child_handle +\end_layout + +\end_inset + +: handle of the child element. +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +child_id +\end_layout + +\end_inset + +: string identifier of the child. +\end_layout + +\begin_layout Subsubsection* +Description: +\end_layout + +\begin_layout Standard +This subroutine adds a child to an existing parent element. + The identifier of the child, if existing, can be specified optionally. + All group elements can contain child of the same type, provided generic + inheritance. + Some elements can contain children of another type for a specific behavior. + File element may contain field_group, field, variable and variable_group + child elements. + Field elements may contain variable_group of variable child element. +\end_layout + +\begin_layout Subsection* +Query if the value of an element attribute is defined (by handle) +\end_layout + +\begin_layout Subsubsection* +Synopsis: +\end_layout + +\begin_layout LyX-Code +SUBROUTINE xios_is_defined_attr(handle, attr_1=attribute_1, attr_2=attribute_2, + ...) +\end_layout + +\begin_layout LyX-Code +TYPE(xios_element) , INTENT(IN) :: handle +\end_layout + +\begin_layout LyX-Code +LOGICAL, OPTIONAL , INTENT(OUT) :: attr_1 +\end_layout + +\begin_layout LyX-Code +LOGICAL, OPTIONAL , INTENT(OUT) :: attr_2 +\end_layout + +\begin_layout LyX-Code +.... +\end_layout + +\begin_layout Standard +where element is one of the existing elements or element groups. + attribute_x is describing in the chapter dedicated to the attribute description. +\end_layout + +\begin_layout Subsubsection* +Arguments: +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +handle +\end_layout + +\end_inset + +: element handle. +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +attr_x +\end_layout + +\end_inset + +: return true if the attribute as a defined value. +\end_layout + +\begin_layout Subsubsection* +Description: +\end_layout + +\begin_layout Standard +This subroutine can be used to query if one or more attributes of an element + have a defined value. + The list of attributes and their type are described in a specific chapter + of the documentation. + +\end_layout + +\begin_layout Subsection* +Query if a value of an element attributes is defined (by identifier) +\end_layout + +\begin_layout Subsubsection* +Synopsis: +\end_layout + +\begin_layout LyX-Code +SUBROUTINE xios_is_defined_element_attr(id, attr_1=attribute_1, attr_2=attribute +_2, ...) +\end_layout + +\begin_layout LyX-Code +CHARACTER(len = *) , INTENT(IN) :: id +\end_layout + +\begin_layout LyX-Code +LOGICAL, OPTIONAL , INTENT(OUT) :: attr_1 +\end_layout + +\begin_layout LyX-Code +LOGICAL, OPTIONAL , INTENT(OUT) :: attr_2 +\end_layout + +\begin_layout LyX-Code +.... +\end_layout + +\begin_layout Standard +where element is one of the existing elements or element groups. + attribute_x is describing in the chapter dedicated to the attribute description. +\end_layout + +\begin_layout Subsubsection* +Arguments: +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +id +\end_layout + +\end_inset + +: element identifier. +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +attr_x +\end_layout + +\end_inset + +: return true if the attribute as a defined value. +\end_layout + +\begin_layout Subsubsection* +Description: +\end_layout + +\begin_layout Standard +This subroutine can be used to query if one or more attributes of an element + have a defined value. + The list of available attributes and their type are described in a specific + chapter of the documentation. + +\end_layout + +\begin_layout Subsection* +Setting element attributes value by handle +\end_layout + +\begin_layout Subsubsection* +Synopsis: +\end_layout + +\begin_layout LyX-Code +SUBROUTINE xios_set_attr(handle, attr_1=attribute_1, attr_2=attribute_2, + ...) +\end_layout + +\begin_layout LyX-Code +TYPE(xios_element) , INTENT(IN) :: handle +\end_layout + +\begin_layout LyX-Code +attribute_type_1, OPTIONAL , INTENT(IN) :: attr_1 +\end_layout + +\begin_layout LyX-Code +attribute_type_2, OPTIONAL , INTENT(IN) :: attr_2 +\end_layout + +\begin_layout LyX-Code +.... +\end_layout + +\begin_layout Standard +where element is one of the existing elements or element groups. + attribute_x and attribute_type_x are describing in the chapter dedicated + to the attribute description. +\end_layout + +\begin_layout Subsubsection* +Arguments: +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +handle +\end_layout + +\end_inset + +: element handle. +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +attr_x +\end_layout + +\end_inset + +: value of the attribute to be set. +\end_layout + +\begin_layout Subsubsection* +Description: +\end_layout + +\begin_layout Standard +This subroutine can be used to set one or more attributes of an element + defined by its handle. + The list of available attributes and their types are described in corresponding + chapters of the documentation. + +\end_layout + +\begin_layout Subsection* +Setting element attributes value by id +\end_layout + +\begin_layout Subsubsection* +Synopsis: +\end_layout + +\begin_layout LyX-Code +SUBROUTINE xios_set_element_attr(id, attr_1=attribute_1, attr_2=attribute_2, + ...) +\end_layout + +\begin_layout LyX-Code +CHARACTER(len = *), INTENT(IN) :: id +\end_layout + +\begin_layout LyX-Code +attribute_type_1, OPTIONAL , INTENT(IN) :: attr_1 +\end_layout + +\begin_layout LyX-Code +attribute_type_2, OPTIONAL , INTENT(IN) :: attr_2 +\end_layout + +\begin_layout LyX-Code +.... +\end_layout + +\begin_layout Standard +where element is one of the existing elements or element groups. + The attributes attribute_x and attribute_type_x are described in corresponding + chapters. +\end_layout + +\begin_layout Subsubsection* +Arguments: +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +id +\end_layout + +\end_inset + +: string identifier. +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +attr_x +\end_layout + +\end_inset + +: value of the attribute to be set. +\end_layout + +\begin_layout Subsubsection* +Description: +\end_layout + +\begin_layout Standard +This subroutine can be used to set one or more attributes of an element + defined by its string id. + The list of available attributes and their type are described in corresponding + chapters of the documentation. +\end_layout + +\begin_layout Subsection* +Getting element attributes value (by handle) +\end_layout + +\begin_layout Subsubsection* +Synopsis: +\end_layout + +\begin_layout LyX-Code +SUBROUTINE xios_get_attr(handle, attr_1=attribute_1, attr_2=attribute_2, + ...) +\end_layout + +\begin_layout LyX-Code +TYPE(xios_element) , INTENT(IN) :: handle +\end_layout + +\begin_layout LyX-Code +attribute_type_1, OPTIONAL , INTENT(OUT) :: attr_1 +\end_layout + +\begin_layout LyX-Code +attribute_type_2, OPTIONAL , INTENT(OUT) :: attr_2 +\end_layout + +\begin_layout LyX-Code +.... +\end_layout + +\begin_layout Standard +where element is one of the existing elements or element groups. + attribute_x and attribute_type_x are describing in the chapter dedicated + to the attribute description. +\end_layout + +\begin_layout Subsubsection* +Arguments: +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +handle +\end_layout + +\end_inset + +: element handle. +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +attr_x +\end_layout + +\end_inset + +: value of the attribute to be get. +\end_layout + +\begin_layout Subsubsection* +Description: +\end_layout + +\begin_layout Standard +This subroutine can be used to get one or more attribute value of an element + defined by its handle. + All attributes in the arguments list must be defined. + The list of available attributes and their type are described in a specific + chapter of the documentation. + +\end_layout + +\begin_layout Subsection* +Getting element attributes value (by identifier) +\end_layout + +\begin_layout Subsubsection* +Synopsis: +\end_layout + +\begin_layout LyX-Code +SUBROUTINE xios_get_element_attr(id, attr_1=attribute_1, attr_2=attribute_2, + ...) +\end_layout + +\begin_layout LyX-Code +CHARACTER(len = *), INTENT(IN) :: id +\end_layout + +\begin_layout LyX-Code +attribute_type_1, OPTIONAL , INTENT(OUT) :: attr_1 +\end_layout + +\begin_layout LyX-Code +attribute_type_2, OPTIONAL , INTENT(OUT) :: attr_2 +\end_layout + +\begin_layout LyX-Code +.... +\end_layout + +\begin_layout Standard +where element is one of the existing elements or element groups. + attribute_x is describing in the chapter dedicated to the attribute description. +\end_layout + +\begin_layout Subsubsection* +Arguments: +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +id +\end_layout + +\end_inset + +: element string identifier. +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +attr_x +\end_layout + +\end_inset + +: value of the attribute to be get. +\end_layout + +\begin_layout Subsubsection* +Description: +\end_layout + +\begin_layout Standard +This subroutine can be used to get one or more attribute value of an element + defined by its handle. + All attributes in the arguments list must have a defined value. + The list of available attributes and their type are described in a specific + chapter of the documentation. +\end_layout + +\begin_layout Section* +Context management interface +\end_layout + +\begin_layout Subsection* +XIOS context initialization +\end_layout + +\begin_layout Subsubsection* +Synopsis: +\end_layout + +\begin_layout LyX-Code +SUBROUTINE xios_context_initialize(context_id, context_comm) +\end_layout + +\begin_layout LyX-Code + CHARACTER(LEN=*),INTENT(IN) :: context_id +\end_layout + +\begin_layout LyX-Code + INTEGER,INTENT(IN) :: context_comm +\end_layout + +\begin_layout Subsubsection* +Argument: +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +context_id +\end_layout + +\end_inset + +: context identifier +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +context_comm +\end_layout + +\end_inset + +: MPI communicator of the context +\end_layout + +\begin_layout Subsubsection* +Description: +\end_layout + +\begin_layout Standard +This subroutine initializes a context identified by +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +context_id +\end_layout + +\end_inset + + string and must be called before any call related to this context. + A context must be associated to a communicator, which can be the returned + communicator of the +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +xios_initialize +\end_layout + +\end_inset + + subroutine or a sub-communicator of this. + The context initialization is dynamic and can be done at any time before + the +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +xios_finalize +\end_layout + +\end_inset + + call. +\end_layout + +\begin_layout Subsection* +XIOS context finalization +\end_layout + +\begin_layout Subsubsection* +Synopsis: +\end_layout + +\begin_layout LyX-Code +SUBROUTINE xios_context_finalize() +\end_layout + +\begin_layout Subsubsection* +Arguments: +\end_layout + +\begin_layout Standard +None +\end_layout + +\begin_layout Subsubsection* +Description: +\end_layout + +\begin_layout Standard +This subroutine must be called to close a context before the +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +xios_finalize +\end_layout + +\end_inset + + call. + It waits until that all pending requests sent to the servers will be processed + and all opened files will be closed. +\end_layout + +\begin_layout Subsection* +Setting current active context +\end_layout + +\begin_layout Subsubsection* +Synopsis: +\end_layout + +\begin_layout LyX-Code +SUBROUTINE xios_set_current_context(context_handle) +\end_layout + +\begin_layout LyX-Code +TYPE(xios_context),INTENT(IN) :: context_handle +\end_layout + +\begin_layout Standard +or +\end_layout + +\begin_layout LyX-Code +SUBROUTINE xios_set_current_context(context_id) +\end_layout + +\begin_layout LyX-Code +CHARACTER(LEN=*),INTENT(IN) :: context_id +\end_layout + +\begin_layout Subsubsection* +Arguments: +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +context_handle +\end_layout + +\end_inset + +: handle of the context +\end_layout + +\begin_layout Standard +or +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +context_id +\end_layout + +\end_inset + +: string context identifier +\end_layout + +\begin_layout Subsubsection* +Description: +\end_layout + +\begin_layout Standard +These subroutines set the current active context. + All following XIOS calls will refer to this active context. + If only one context is defined, it will be set automatically as the active + context. + +\end_layout + +\begin_layout Subsection* +Closing definition +\end_layout + +\begin_layout Subsubsection* +Synopsis: +\end_layout + +\begin_layout LyX-Code +SUBROUTINE xios_close_context_definition() +\end_layout + +\begin_layout Subsubsection* +Arguments: +\end_layout + +\begin_layout Standard +None +\end_layout + +\begin_layout Subsubsection* +Description: +\end_layout + +\begin_layout Standard +This subroutine must be called when all definitions of a context are finished + at the end of the initialization and before entering to the time loop. + A lot of operations are performed internally (inheritance, grid definition, + contacting servers,...) so this call is mandatory. + Any call related to the tree management definition done after will have + an undefined effect. +\end_layout + +\begin_layout Section* +Calendar management interface +\end_layout + +\begin_layout Subsection* +Creating the calendar +\end_layout + +\begin_layout Subsubsection* +Synopsis: +\end_layout + +\begin_layout LyX-Code +SUBROUTINE xios_define_calendar(type, timestep, start_date, time_origin, + & +\begin_inset Newline newline +\end_inset + + day_length, month_lengths, year_length, + & +\begin_inset Newline newline +\end_inset + + leap_year_month, leap_year_drift, & +\begin_inset Newline newline +\end_inset + + leap_year_drift_offset) +\begin_inset Newline newline +\end_inset + +CHARACTER(len = *), INTENT(IN) :: type +\begin_inset Newline newline +\end_inset + +TYPE(xios_duration), OPTIONAL, INTENT(IN) :: timestep +\begin_inset Newline newline +\end_inset + +TYPE(xios_date), OPTIONAL, INTENT(IN) :: start_date +\begin_inset Newline newline +\end_inset + +TYPE(xios_date), OPTIONAL, INTENT(IN) :: time_origin +\begin_inset Newline newline +\end_inset + +INTEGER, OPTIONAL, INTENT(IN) :: day_length +\begin_inset Newline newline +\end_inset + +INTEGER, OPTIONAL, INTENT(IN) :: month_lengths(:) +\begin_inset Newline newline +\end_inset + +INTEGER, OPTIONAL, INTENT(IN) :: year_length +\begin_inset Newline newline +\end_inset + +DOUBLE PRECISION, OPTIONAL, INTENT(IN) :: leap_year_drift +\begin_inset Newline newline +\end_inset + +DOUBLE PRECISION, OPTIONAL, INTENT(IN) :: leap_year_drift_offset +\begin_inset Newline newline +\end_inset + +INTEGER, OPTIONAL, INTENT(IN) :: leap_year_month +\end_layout + +\begin_layout Subsubsection* +Arguments: +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +type +\end_layout + +\end_inset + +: the calendar type, one of +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +"Gregorian" +\end_layout + +\end_inset + +, +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +"Julian" +\end_layout + +\end_inset + +, +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +"D360" +\end_layout + +\end_inset + +, +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +"AllLeap" +\end_layout + +\end_inset + +, +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +"NoLeap" +\end_layout + +\end_inset + +, +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +"user_defined" +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +timestep +\end_layout + +\end_inset + +: the time step of the simulation (optional, can be set later) +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +start_date +\end_layout + +\end_inset + +: the start date of the simulation (optional, +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +xios_date(0000, 01, 01, 00, 00, 00) +\end_layout + +\end_inset + + is used by default) +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +time_origin +\end_layout + +\end_inset + +: the origin of the time axis (optional, +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +xios_date(0000, 01, 01, 00, 00, 00) +\end_layout + +\end_inset + + is used by default) +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +day_length +\end_layout + +\end_inset + +: the length of a day in seconds (mandatory when creating an user defined + calendar, must not be set otherwise) +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +month_lengths +\end_layout + +\end_inset + +: the length of each month of the year in days (either +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +month_lengths +\end_layout + +\end_inset + + or +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +year_length +\end_layout + +\end_inset + + must be set when creating an user defined calendar, must not be set otherwise) +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +year_length +\end_layout + +\end_inset + +: the length of a year in seconds (either +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +month_lengths +\end_layout + +\end_inset + + or +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +year_length +\end_layout + +\end_inset + + must be set when creating an user defined calendar, must not be set otherwise) +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +leap_year_drift +\end_layout + +\end_inset + +: the yearly drift between the user defined calendar and the astronomical + calendar, expressed as a fraction of day (can optionally be set when creating + an user defined calendar in which case +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +leap_year_month +\end_layout + +\end_inset + + must be set too) +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +leap_year_drift_offset +\end_layout + +\end_inset + +: the initial drift between the user defined calendar and the astronomical + calendar at the time origin, expressed as a fraction of day (can optionally + be set if +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +leap_year_drift +\end_layout + +\end_inset + + and +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +leap_year_month +\end_layout + +\end_inset + + are set) +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +leap_year_month +\end_layout + +\end_inset + +: the month to which an extra day must be added in case of leap year (can + optionally be set when creating an user defined calendar in which case + +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +leap_year_drift +\end_layout + +\end_inset + + must be set too) +\end_layout + +\begin_layout Standard +For a more detailed description of those arguments, see the description + of the corresponding attributes in section 1.2 +\begin_inset Quotes eld +\end_inset + +Calendar attribute reference +\begin_inset Quotes erd +\end_inset + +. +\end_layout + +\begin_layout Subsubsection* +Description: +\end_layout + +\begin_layout Standard +This subroutine creates the calendar for the current context. + Note that the calendar is created once and for all, either from the XML + configuration file or the Fortran interface. + If it was not created from the configuration file, then this subroutine + must be called once and only once before the context definition is closed. + The calendar features can be used immediately after the calendar was created. +\begin_inset Newline newline +\end_inset + + +\begin_inset Newline newline +\end_inset + +If an user defined calendar is created, the following arguments must also + be provided: +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +day_length +\end_layout + +\end_inset + + and either +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +month_lengths +\end_layout + +\end_inset + + or +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +year_length +\end_layout + +\end_inset + +. + Optionally it is possible to configure the user defined calendar to have + leap years. + In this case, +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +leap_year_drift +\end_layout + +\end_inset + + and +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +leap_year_month +\end_layout + +\end_inset + + must also be provided and +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +leap_year_drift_offset +\end_layout + +\end_inset + + might be used. +\end_layout + +\begin_layout Subsection* +Accessing the calendar type of the current calendar +\end_layout + +\begin_layout Subsubsection* +Synopsis: +\end_layout + +\begin_layout LyX-Code +SUBROUTINE xios_get_calendar_type(calendar_type) +\begin_inset Newline newline +\end_inset + +CHARACTER(len=*), INTENT(OUT) :: calendar_type +\end_layout + +\begin_layout Subsubsection* +Arguments: +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +calendar_type +\end_layout + +\end_inset + +: on output, the type of the calendar attached to the current context +\end_layout + +\begin_layout Subsubsection* +Description: +\end_layout + +\begin_layout Standard +This subroutine gets the calendar type associated to the current context. + It will raise an error if used before the calendar was created. +\end_layout + +\begin_layout Subsection* +Accessing and defining the time step of the current calendar +\end_layout + +\begin_layout Subsubsection* +Synopsis: +\end_layout + +\begin_layout LyX-Code +SUBROUTINE xios_get_timestep(timestep) +\begin_inset Newline newline +\end_inset + +TYPE(xios_duration), INTENT(OUT) :: timestep +\end_layout + +\begin_layout Standard +and +\end_layout + +\begin_layout LyX-Code +SUBROUTINE xios_set_timestep(timestep) +\begin_inset Newline newline +\end_inset + +TYPE(xios_duration), INTENT(IN) :: timestep +\end_layout + +\begin_layout Subsubsection* +Arguments: +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +timestep +\end_layout + +\end_inset + +: a duration corresponding to the time step of the simulation +\end_layout + +\begin_layout Subsubsection* +Description: +\end_layout + +\begin_layout Standard +Those subroutines respectively gets and sets the time step associated to + the calendar of the current context. + Note that the time step must always be set before the context definition + is closed and that an error will be raised if the getter subroutine is + used before the time step is defined. +\end_layout + +\begin_layout Subsection* +Accessing and defining the start date of the current calendar +\end_layout + +\begin_layout Subsubsection* +Synopsis: +\end_layout + +\begin_layout LyX-Code +SUBROUTINE xios_get_start_date(start_date) +\begin_inset Newline newline +\end_inset + +TYPE(xios_date), INTENT(OUT) :: start_date +\end_layout + +\begin_layout Standard +and +\end_layout + +\begin_layout LyX-Code +SUBROUTINE xios_set_start_date(start_date) +\begin_inset Newline newline +\end_inset + +TYPE(xios_date), INTENT(IN) :: start_date +\end_layout + +\begin_layout Subsubsection* +Arguments: +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +start_date +\end_layout + +\end_inset + +: a date corresponding to the beginning of the simulation +\end_layout + +\begin_layout Subsubsection* +Description: +\end_layout + +\begin_layout Standard +Those subroutines respectively gets and sets the start date associated to + the calendar of the current context. + They must not be used before the calendar was created. +\end_layout + +\begin_layout Subsection* +Accessing and defining the time origin of the current calendar +\end_layout + +\begin_layout Subsubsection* +Synopsis: +\end_layout + +\begin_layout LyX-Code +SUBROUTINE xios_get_time_origin(time_origin) +\begin_inset Newline newline +\end_inset + +TYPE(xios_date), INTENT(OUT) :: time_origin +\end_layout + +\begin_layout Standard +and +\end_layout + +\begin_layout LyX-Code +SUBROUTINE xios_set_time_date(time_origin) +\begin_inset Newline newline +\end_inset + +TYPE(xios_date), INTENT(IN) :: time_origin +\end_layout + +\begin_layout Subsubsection* +Arguments: +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +start_date +\end_layout + +\end_inset + +: a date corresponding to the origin of the time axis +\end_layout + +\begin_layout Subsubsection* +Description: +\end_layout + +\begin_layout Standard +Those subroutines respectively gets and sets the origin of time associated + to the calendar of the current context. + They must not be used before the calendar was created. +\end_layout + +\begin_layout Subsection* +Updating the current date of the current calendar +\end_layout + +\begin_layout Subsubsection* +Synopsis: +\end_layout + +\begin_layout LyX-Code +SUBROUTINE xios_update_calendar(step) +\begin_inset Newline newline +\end_inset + +INTEGER, INTENT(IN) :: step +\end_layout + +\begin_layout Subsubsection* +Arguments: +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +step +\end_layout + +\end_inset + +: the current iteration number +\end_layout + +\begin_layout Subsubsection* +Description: +\end_layout + +\begin_layout Standard +This subroutine sets the current date associated to the calendar of the + current context based on the current iteration number: +\begin_inset Formula $current\_date=start\_date+step\times timestep$ +\end_inset + +. + It must not be used before the calendar was created. +\end_layout + +\begin_layout Subsection* +Accessing the current date of the current calendar +\end_layout + +\begin_layout Subsubsection* +Synopsis: +\end_layout + +\begin_layout LyX-Code +SUBROUTINE xios_get_current_date(current_date) +\begin_inset Newline newline +\end_inset + +TYPE(xios_date), INTENT(OUT) :: current_date +\end_layout + +\begin_layout Subsubsection* +Arguments: +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +current_date +\end_layout + +\end_inset + +: on output, the current date +\end_layout + +\begin_layout Subsubsection* +Description: +\end_layout + +\begin_layout Standard +This subroutine gets the current date associated to the calendar of the + current context. + It must not be used before the calendar was created. +\end_layout + +\begin_layout Subsection* +Accessing the year length of the current calendar +\end_layout + +\begin_layout Subsubsection* +Synopsis: +\end_layout + +\begin_layout LyX-Code +INTEGER FUNCTION xios_get_year_length_in_seconds(year) +\begin_inset Newline newline +\end_inset + +INTEGER, INTENT(IN) :: year +\end_layout + +\begin_layout Subsubsection* +Arguments: +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +year +\end_layout + +\end_inset + +: the year whose length is requested +\end_layout + +\begin_layout Subsubsection* +Description: +\end_layout + +\begin_layout Standard +This function returns the duration in seconds of the specified year, taking + leap years into account based on the calendar of the current context. + It must not be used before the calendar was created. +\end_layout + +\begin_layout Subsection* +Accessing the day length of the current calendar +\end_layout + +\begin_layout Subsubsection* +Synopsis: +\end_layout + +\begin_layout LyX-Code +INTEGER FUNCTION xios_get_day_length_in_seconds() +\end_layout + +\begin_layout Subsubsection* +Arguments: None +\end_layout + +\begin_layout Subsubsection* +Description: +\end_layout + +\begin_layout Standard +This function returns the duration in seconds of a day, based on the calendar + of the current context. + It must not be used before the calendar was created. +\end_layout + +\begin_layout Section* +Duration handling interface +\end_layout + +\begin_layout Subsection* +Duration constants +\end_layout + +\begin_layout Standard +Some duration constants are available to ease duration handling: +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +xios_year +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +xios_month +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +xios_day +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +xios_hour +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +xios_minute +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +xios_second +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +xios_timestep +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Subsection* +Arithmetic operations on durations +\end_layout + +\begin_layout Standard +The following arithmetic operations on durations are available: +\end_layout + +\begin_layout Itemize +Addition: +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +xios_duration = xios_duration + xios_duration +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Itemize +Subtraction: +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +xios_duration = xios_duration - xios_duration +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Itemize +Multiplication by a scalar value: +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +xios_duration = scalar * xios_duration +\end_layout + +\end_inset + + or +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +xios_duration = xios_duration * scalar +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Itemize +Negation: +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +xios_duration = -xios_duration +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Subsection* +Comparison operations on durations +\end_layout + +\begin_layout Standard +The following comparison operations on durations are available: +\end_layout + +\begin_layout Itemize +Equality: +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +LOGICAL = xios_duration == xios_duration +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Itemize +Inequality: +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +LOGICAL = xios_duration /= xios_duration +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Section* +Interface relative to date handling +\end_layout + +\begin_layout Subsection* +Arithmetic operations on dates +\end_layout + +\begin_layout Standard +The following arithmetic operations on dates are available: +\end_layout + +\begin_layout Itemize +Addition of a duration: +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +xios_date = xios_date + xios_duration +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Itemize +Subtraction of a duration: +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +xios_date = xios_date - xios_duration +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Itemize +Subtraction of two dates: +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +xios_duration = xios_date - xios_date +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Subsection* +Comparison operations on dates +\end_layout + +\begin_layout Standard +The following comparison operations on dates are available: +\end_layout + +\begin_layout Itemize +Equality: +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +LOGICAL = xios_date == xios_date +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Itemize +Inequality: +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +LOGICAL = xios_date /= xios_date +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Itemize +Less than: +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +LOGICAL = xios_date < xios_date +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Itemize +Less or equal: +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +LOGICAL = xios_date <= xios_date +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Itemize +Greater than: +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +LOGICAL = xios_date > xios_date +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Itemize +Greater or equal: +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +LOGICAL = xios_date >= xios_date +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Subsection* +Converting a date to a number of seconds since the time origin +\end_layout + +\begin_layout Subsubsection* +Synopsis: +\end_layout + +\begin_layout LyX-Code +FUNCTION INTEGER(kind = 8) xios_date_convert_to_seconds(date) +\begin_inset Newline newline +\end_inset + +TYPE(xios_date), INTENT(IN) :: date +\end_layout + +\begin_layout Subsubsection* +Arguments: +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +date +\end_layout + +\end_inset + +: the date to convert +\end_layout + +\begin_layout Subsubsection* +Description: +\end_layout + +\begin_layout Standard +This function returns the number of seconds since the time origin for the + specified date, based on the calendar of the current context. + It must not be used before the calendar was created. +\end_layout + +\begin_layout Subsection* +Converting a date to a number of seconds since the beginning of the year +\end_layout + +\begin_layout Subsubsection* +Synopsis: +\end_layout + +\begin_layout LyX-Code +FUNCTION INTEGER xios(date_get_second_of_year)(date) +\begin_inset Newline newline +\end_inset + +TYPE(xios_date), INTENT(IN) :: date +\end_layout + +\begin_layout Subsubsection* +Arguments: +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +date +\end_layout + +\end_inset + +: the date to convert +\end_layout + +\begin_layout Subsubsection* +Description: +\end_layout + +\begin_layout Standard +This function returns the number of seconds since the beginning of the year + for the specified date, based on the calendar of the current context. + It must not be used before the calendar was created. +\end_layout + +\begin_layout Subsection* +Converting a date to a number of days since the beginning of the year +\end_layout + +\begin_layout Subsubsection* +Synopsis: +\end_layout + +\begin_layout LyX-Code +FUNCTION DOUBLE_PRECISION xios_date_get_day_of_year(date) +\begin_inset Newline newline +\end_inset + +TYPE(xios_date), INTENT(IN) :: date +\end_layout + +\begin_layout Subsubsection* +Arguments: +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +date +\end_layout + +\end_inset + +: the date to convert +\end_layout + +\begin_layout Subsubsection* +Description: +\end_layout + +\begin_layout Standard +This function returns the number of days since the beginning of the year + for the specified date, based on the calendar of the current context. + It must not be used before the calendar was created. +\end_layout + +\begin_layout Subsection* +Converting a date to a fraction of the current year +\end_layout + +\begin_layout Subsubsection* +Synopsis: +\end_layout + +\begin_layout LyX-Code +FUNCTION DOUBLE_PRECISION xios_date_get_fraction_of_year(date) +\begin_inset Newline newline +\end_inset + +TYPE(xios_date), INTENT(IN) :: date +\end_layout + +\begin_layout Subsubsection* +Arguments: +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +date +\end_layout + +\end_inset + +: the date to convert +\end_layout + +\begin_layout Subsubsection* +Description: +\end_layout + +\begin_layout Standard +This function returns the fraction of year corresponding to the specified + date, based on the calendar of the current context. + It must not be used before the calendar was created. +\end_layout + +\begin_layout Subsection* +Converting a date to a number of seconds since the beginning of the day +\end_layout + +\begin_layout Subsubsection* +Synopsis: +\end_layout + +\begin_layout LyX-Code +FUNCTION INTEGER xios(date_get_second_of_day)(date) +\begin_inset Newline newline +\end_inset + +TYPE(xios_date), INTENT(IN) :: date +\end_layout + +\begin_layout Subsubsection* +Arguments: +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +date +\end_layout + +\end_inset + +: the date to convert +\end_layout + +\begin_layout Subsubsection* +Description: +\end_layout + +\begin_layout Standard +This function returns the number of seconds since the beginning of the day + for the specified date, based on the calendar of the current context. + It should not be used before the calendar was created. +\end_layout + +\begin_layout Subsection* +Converting a date to a fraction of the current day +\end_layout + +\begin_layout Subsubsection* +Synopsis: +\end_layout + +\begin_layout LyX-Code +FUNCTION DOUBLE_PRECISION xios_date_get_fraction_of_day(date) +\begin_inset Newline newline +\end_inset + +TYPE(xios_date), INTENT(IN) :: date +\end_layout + +\begin_layout Subsubsection* +Arguments: +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +date +\end_layout + +\end_inset + +: the date to convert +\end_layout + +\begin_layout Subsubsection* +Description: +\end_layout + +\begin_layout Standard +This function returns the fraction of day corresponding to the specified + date based on the calendar of the current context. + It should not be used before the calendar was created. +\end_layout + +\end_body +\end_document diff --git a/xios_2311_src/doc/XIOS_reference_guide.pdf b/xios_2311_src/doc/XIOS_reference_guide.pdf index f9d62670c5986fdbd9c87d92bfa44fd7f754750b..1ee9fca9318222a480cbb3abbf6c6f3e56aaf3a5 100644 Binary files a/xios_2311_src/doc/XIOS_reference_guide.pdf and b/xios_2311_src/doc/XIOS_reference_guide.pdf differ diff --git a/xios_2311_src/extern/netcdf4 b/xios_2311_src/extern/netcdf4 index 781edd0bbf37b256c99e68b70949b3ed2a1e0dd1..2bb3573359428ed7fcfd35aaccf7e3d42fa13ff6 120000 --- a/xios_2311_src/extern/netcdf4 +++ b/xios_2311_src/extern/netcdf4 @@ -1 +1 @@ -/gpfs/scratch/bsc32/bsc032756/EDITO/XIOS/trunk/.void_dir \ No newline at end of file +/gpfs/scratch/bsc32/bsc032756/APPS/NEMO5_2024/xios_2311_src/.void_dir \ No newline at end of file diff --git a/xios_2311_src/extern/remap/src/circle.cpp b/xios_2311_src/extern/remap/src/circle.cpp index 9cddb8031eba32a0750899b7d801fa8d9b26e18d..afee29683d3d50de97a37b2993b97f7e5465a662 100644 --- a/xios_2311_src/extern/remap/src/circle.cpp +++ b/xios_2311_src/extern/remap/src/circle.cpp @@ -34,9 +34,9 @@ namespace sphereRemap leaf.data = &elt; } - void setCirclesAndLinks(Elt *elts, vector& nodes) + void setCirclesAndLinks(Elt *elts, vector& nodes) { for (int i = 0; i < nodes.size(); i++) - setCircleAndLink(elts[i], *nodes[i]); + setCircleAndLink(elts[i], nodes[i]); } } diff --git a/xios_2311_src/extern/remap/src/circle.hpp b/xios_2311_src/extern/remap/src/circle.hpp index 1b94c1e6ba655fa3155fff34395427c29ed150aa..314524a5f227fe4de168c398abf28bd9b89f821d 100644 --- a/xios_2311_src/extern/remap/src/circle.hpp +++ b/xios_2311_src/extern/remap/src/circle.hpp @@ -14,7 +14,7 @@ void setCircleAndLink(Elt& elt, Node& leaf); of the corresponding grid element. At this point the node is a leaf and contains only one element. */ -void setCirclesAndLinks(Elt *elts, vector& leaf); +void setCirclesAndLinks(Elt *elts, vector& leaf); } #endif diff --git a/xios_2311_src/extern/remap/src/earcut.hpp b/xios_2311_src/extern/remap/src/earcut.hpp index 75f48fbf3b2b892aaec677061fc46a4e01583578..929d485df5dd2e223e7198aaf790fc239c7a2f2b 100644 --- a/xios_2311_src/extern/remap/src/earcut.hpp +++ b/xios_2311_src/extern/remap/src/earcut.hpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include //#include //#include //#include diff --git a/xios_2311_src/extern/remap/src/intersection_ym.cpp b/xios_2311_src/extern/remap/src/intersection_ym.cpp index 8504068d62fdc33b6f0d5a112c2b7ad2f6bfc87a..bf16fe2c23a3d640d12c9331d911669d621524ef 100644 --- a/xios_2311_src/extern/remap/src/intersection_ym.cpp +++ b/xios_2311_src/extern/remap/src/intersection_ym.cpp @@ -185,12 +185,16 @@ double intersect_ym(Elt *a, Elt *b) if (dx*dx+dy*dy>fusion_vertex*fusion_vertex) { - intersectPolygon[nv]=intersectPolygon[n] ; - vect_points.push_back( array() ); - vect_points[nv][0] = intersectPolygon[n].x; - vect_points[nv][1] = intersectPolygon[n].y; - nv++ ; + intersectPolygon[nv]=intersectPolygon[n] ; + + vect_points.push_back( array() ); + vect_points[nv][0] = intersectPolygon[n].x; + vect_points[nv][1] = intersectPolygon[n].y; + + nv++ ; } + + } polyline.push_back(vect_points); @@ -204,10 +208,10 @@ double intersect_ym(Elt *a, Elt *b) double area2=0 ; for(int i=0;i -#include "client.hpp" - #include "mapper.hpp" -namespace MemTrack -{ - void TrackDumpBlocks(std::ofstream& memReport, size_t memtrack_blocks, size_t memtrack_size); -} - namespace sphereRemap { /* A subdivition of an array into N sub-arays @@ -64,7 +56,7 @@ void Mapper::setSourceMesh(const double* boundsLon, const double* boundsLat, con elt.src_id.ind = i; elt.src_id.globalId = sourceGlobalId[i]; sourceElements.push_back(elt); - sourceMesh.push_back(make_shared(elt.x, cptRadius(elt), &sourceElements.back())); + sourceMesh.push_back(Node(elt.x, cptRadius(elt), &sourceElements.back())); cptEltGeom(sourceElements[i], Coord(pole[0], pole[1], pole[2])); if (area!=NULL) sourceElements[i].given_area=area[i] ; else sourceElements[i].given_area=sourceElements[i].area ; @@ -99,7 +91,7 @@ void Mapper::setTargetMesh(const double* boundsLon, const double* boundsLat, con int offs = i*nVertex; Elt elt(boundsLon + offs, boundsLat + offs, nVertex); targetElements.push_back(elt); - targetMesh.push_back(make_shared(elt.x, cptRadius(elt), &sourceElements.back())); + targetMesh.push_back(Node(elt.x, cptRadius(elt), &sourceElements.back())); cptEltGeom(targetElements[i], Coord(pole[0], pole[1], pole[2])); if (area!=NULL) targetElements[i].given_area=area[i] ; else targetElements[i].given_area=targetElements[i].area ; @@ -128,7 +120,6 @@ vector Mapper::computeWeights(int interpOrder, bool renormalize, bool qu MPI_Comm_rank(communicator, &mpiRank); this->buildSSTree(sourceMesh, targetMesh); - if (mpiRank == 0 && verbose) cout << "Computing intersections ..." << endl; double tic = cputime(); @@ -468,11 +459,7 @@ int Mapper::remap(Elt *elements, int nbElements, int order, bool renormalize, bo delete[] sendElement; delete[] recvElement; delete[] sendValue; - delete[] sendArea ; - delete[] sendGivenArea ; delete[] recvValue; - delete[] recvArea ; - delete[] recvGivenArea ; delete[] sendGrad; delete[] recvGrad; delete[] sendNeighIds; @@ -502,7 +489,7 @@ void Mapper::buildMeshTopology() MPI_Comm_size(communicator, &mpiSize); MPI_Comm_rank(communicator, &mpiRank); - vector *routingList = new vector[mpiSize]; + vector *routingList = new vector[mpiSize]; vector > routes(sstree.localTree.leafs.size()); sstree.routeIntersections(routes, sstree.localTree.leafs); @@ -529,7 +516,7 @@ void Mapper::buildMeshTopology() sendMessageSize[rank] = 0; for (size_t j = 0; j < routingList[rank].size(); j++) { - Elt *elt = (Elt *) (routingList[rank][j]->data); + Elt *elt = (Elt *) (routingList[rank][j].data); sendMessageSize[rank] += packedPolygonSize(*elt); } } @@ -552,7 +539,7 @@ void Mapper::buildMeshTopology() pos[rank] = 0; for (size_t j = 0; j < routingList[rank].size(); j++) { - Elt *elt = (Elt *) (routingList[rank][j]->data); + Elt *elt = (Elt *) (routingList[rank][j].data); packPolygon(*elt, sendBuffer[rank], pos[rank]); } } @@ -602,8 +589,8 @@ void Mapper::buildMeshTopology() { Elt elt; unpackPolygon(elt, recvBuffer[rank], pos[rank]); - NodePtr node=make_shared(elt.x, cptRadius(elt), &elt); - findNeighbour(sstree.localTree.root, node, neighbourList); + Node node(elt.x, cptRadius(elt), &elt); + findNeighbour(sstree.localTree.root, &node, neighbourList); } nbSendNode[rank] = neighbourList.size(); for (set::iterator it = neighbourList.begin(); it != neighbourList.end(); it++) @@ -690,7 +677,6 @@ void Mapper::buildMeshTopology() /* re-compute on received elements to avoid having to send this information */ neighbourNodes.resize(nbNeighbourNodes); - for(int i=0;i() ; setCirclesAndLinks(neighbourElements, neighbourNodes); cptAllEltsGeom(neighbourElements, nbNeighbourNodes, srcGrid.pole); @@ -705,12 +691,12 @@ void Mapper::buildMeshTopology() */ for (int j = 0; j < sstree.localTree.leafs.size(); j++) { - NodePtr node = sstree.localTree.leafs[j]; + Node& node = sstree.localTree.leafs[j]; /* find all leafs whoes circles that intersect node's circle and save into node->intersectors */ - node->search(sstree.localTree.root); + node.search(sstree.localTree.root); - Elt *elt = (Elt *)(node->data); + Elt *elt = (Elt *)(node.data); for (int i = 0; i < elt->n; i++) elt->neighbour[i] = NOT_FOUND; @@ -718,7 +704,7 @@ void Mapper::buildMeshTopology() whoes circles intersect with the circle around `elt` (the SS intersectors) and check if they are neighbours in the sense that the two elements share an edge. If they do, save this information for elt */ - for (list::iterator it = (node->intersectors).begin(); it != (node->intersectors).end(); ++it) + for (list::iterator it = (node.intersectors).begin(); it != (node.intersectors).end(); ++it) { Elt *elt2 = (Elt *)((*it)->data); set_neighbour(*elt, *elt2); @@ -743,14 +729,14 @@ void Mapper::computeIntersection(Elt *elements, int nbElements) MPI_Barrier(communicator); - vector *routingList = new vector[mpiSize]; + vector *routingList = new vector[mpiSize]; - vector routeNodes; routeNodes.reserve(nbElements); + vector routeNodes; routeNodes.reserve(nbElements); for (int j = 0; j < nbElements; j++) { elements[j].id.ind = j; elements[j].id.rank = mpiRank; - routeNodes.push_back(make_shared(elements[j].x, cptRadius(elements[j]), &elements[j])); + routeNodes.push_back(Node(elements[j].x, cptRadius(elements[j]), &elements[j])); } vector > routes(routeNodes.size()); @@ -779,7 +765,7 @@ void Mapper::computeIntersection(Elt *elements, int nbElements) sentMessageSize[rank] = 0; for (size_t j = 0; j < routingList[rank].size(); j++) { - Elt *elt = (Elt *) (routingList[rank][j]->data); + Elt *elt = (Elt *) (routingList[rank][j].data); sentMessageSize[rank] += packedPolygonSize(*elt); } } @@ -810,7 +796,7 @@ void Mapper::computeIntersection(Elt *elements, int nbElements) pos[rank] = 0; for (size_t j = 0; j < routingList[rank].size(); j++) { - Elt* elt = (Elt *) (routingList[rank][j]->data); + Elt* elt = (Elt *) (routingList[rank][j].data); packPolygon(*elt, sendBuffer[rank], pos[rank]); } } @@ -854,10 +840,10 @@ void Mapper::computeIntersection(Elt *elements, int nbElements) { unpackPolygon(recvElt[j], recvBuffer[rank], pos[rank]); cptEltGeom(recvElt[j], tgtGrid.pole); - NodePtr recvNode = make_shared(recvElt[j].x, cptRadius(recvElt[j]), &recvElt[j]); - recvNode->search(sstree.localTree.root); + Node recvNode(recvElt[j].x, cptRadius(recvElt[j]), &recvElt[j]); + recvNode.search(sstree.localTree.root); /* for a node holding an element of the target, loop throught candidates for intersecting source */ - for (list::iterator it = (recvNode->intersectors).begin(); it != (recvNode->intersectors).end(); ++it) + for (list::iterator it = (recvNode.intersectors).begin(); it != (recvNode.intersectors).end(); ++it) { Elt *elt2 = (Elt *) ((*it)->data); /* recvElt is target, elt2 is source */ @@ -882,9 +868,6 @@ void Mapper::computeIntersection(Elt *elements, int nbElements) //FIXME should be deleted: recvElt[j].delete_intersections(); // intersection areas have been packed to buffer and won't be used any more } } - - for (int j = 0; j < nbRecvNode[rank]; j++) recvElt[j].delete_intersections(); - delete [] recvElt; } @@ -959,10 +942,7 @@ Mapper::~Mapper() delete [] srcAddress; delete [] srcRank; delete [] dstAddress; - delete [] sourceWeightId ; - delete [] targetWeightId ; if (neighbourElements) delete [] neighbourElements; - CTimer::release() ; - } +} } diff --git a/xios_2311_src/extern/remap/src/mapper.hpp b/xios_2311_src/extern/remap/src/mapper.hpp index ba815bb944f4cde5da0d3f9ba6593523c4965722..a3546a19b1ab0d4a73c2516dec5f3ef189f1b50f 100644 --- a/xios_2311_src/extern/remap/src/mapper.hpp +++ b/xios_2311_src/extern/remap/src/mapper.hpp @@ -2,7 +2,6 @@ #define __MAPPER_HPP__ #include "parallel_tree.hpp" #include "mpi.hpp" -#include "timerRemap.hpp" namespace sphereRemap { @@ -27,7 +26,7 @@ public: void setSourceValue(const double* val) ; void getTargetValue(double* val) ; - void buildSSTree(vector& srcMsh, vector& trgMsh) + void buildSSTree(vector& srcMsh, vector& trgMsh) { sstree.build(srcMsh, trgMsh); } @@ -61,7 +60,7 @@ private: /** Holds adaptional leaf nodes as ghost cells for gradient computations (hold neighbour elements from other ranks). They will be inserted to the local trees but not saved in its leaf array */ - vector neighbourNodes; + vector neighbourNodes; int nbNeighbourElements; Elt* neighbourElements; @@ -69,9 +68,9 @@ private: CParallelTree sstree; MPI_Comm communicator ; std::vector sourceElements ; - std::vector sourceMesh ; + std::vector sourceMesh ; std::vector targetElements ; - std::vector targetMesh ; + std::vector targetMesh ; std::vector sourceGlobalId ; std::vector targetGlobalId ; diff --git a/xios_2311_src/extern/remap/src/meshutil.cpp b/xios_2311_src/extern/remap/src/meshutil.cpp index c281fbecd28e0b5c2273c8d28d9301c4a9a26d08..d4c555d5816581b4983dbf6034ce2512c990e586 100644 --- a/xios_2311_src/extern/remap/src/meshutil.cpp +++ b/xios_2311_src/extern/remap/src/meshutil.cpp @@ -59,7 +59,6 @@ double computePolygoneArea(Elt& a, const Coord &pole) vect_points.clear(); polyline.clear(); indices_a_gno.clear(); - delete [] a_gno ; return area_a_gno ; } diff --git a/xios_2311_src/extern/remap/src/mpi_routing.cpp b/xios_2311_src/extern/remap/src/mpi_routing.cpp index 8f8d0db0d2eb86743bddcd9e535cb74aa2b64bb1..9cb1eb5940feef5c6ff47cc068c0ea7870cfaa31 100644 --- a/xios_2311_src/extern/remap/src/mpi_routing.cpp +++ b/xios_2311_src/extern/remap/src/mpi_routing.cpp @@ -234,7 +234,6 @@ destRanks.push_back(i); delete[] toSend; delete[] recvCount; - delete[] targetRankToIndex; delete[] request; delete[] status; } @@ -598,7 +597,7 @@ template void CMPIRouting::transferToTarget(int *targetElements, int *sourceElem template void CMPIRouting::transferFromSource(int *targetElements, int *sourceElements); template void CMPIRouting::transferFromSource(int *targetElements, int *sourceElements, void (*pack)(int&, char*, int&), void (* unpack)(int&, char *, int&)); -template void CMPIRouting::transferToTarget(NodePtr* targetElements, NodePtr* sourceElements, void (*pack)(NodePtr, char*, int&), void (* unpack)(NodePtr, char *, int&)); +template void CMPIRouting::transferToTarget(Node* targetElements, Node* sourceElements, void (*pack)(Node&, char*, int&), void (* unpack)(Node&, char *, int&)); template void CMPIRouting::transferToTarget(Elt **targetElements, Elt **sourceElements, void (*pack)(Elt *, char*, int&), void (* unpack)(Elt *, char *, int&)); template void CMPIRouting::transferFromSource(std::vector *targetElements, std::vector *sourceElements, void (*pack)(const std::vector&, char*, int&), void (* unpack)(std::vector&, const char *, int&)); diff --git a/xios_2311_src/extern/remap/src/node.cpp b/xios_2311_src/extern/remap/src/node.cpp index f6a45dd3e13ac8219aa07d6dd6dabe63de578c74..254e3b056acb989fa5e94b0249b9c2be6425872d 100644 --- a/xios_2311_src/extern/remap/src/node.cpp +++ b/xios_2311_src/extern/remap/src/node.cpp @@ -78,7 +78,7 @@ int compareDist(NodePtr n1, NodePtr n2) /* On level `level` find the node in our subtree that is closest to `src` and return through argument `closest`. The return value is just for recursive calling */ -void Node::findClosest(int level, NodePtr src, double& minDist2, NodePtr& closest) +void Node::findClosest(int level, NodePtr src, double& minDist2, NodePtr &closest) { double r2; @@ -88,7 +88,7 @@ void Node::findClosest(int level, NodePtr src, double& minDist2, NodePtr& closes if (r2 < minDist2 || closest == NULL) { minDist2 = r2; - closest = shared_from_this(); + closest = this; } } else if (r2 < radius*radius) @@ -220,15 +220,15 @@ void Node::output(ostream& flux, int level, int color) } }*/ -bool find_in_tree1(NodePtr node) +bool find_in_tree1(Node* node) { if (node == node->tree->root) return true; - if (node->parent.lock() == NULL) + if (node->parent == NULL) { cerr << "Cannot find!" << endl; return false; } - return find_in_tree1(node->parent.lock()); + return find_in_tree1(node->parent); } bool find_in_tree2(NodePtr node, NodePtr ref) @@ -263,9 +263,9 @@ NodePtr insert(NodePtr thIs, NodePtr node) if (la == lb - 1) { node->child.push_back(thIs); - thIs->parent = node ; + thIs->parent = node; if (node->child.size() > MAX_NODE_SZ && node->tree->canSplit() ) // with us as additional child `node` is now too large :( - return (node->reinserted || node->parent.lock() == NULL) ? split(node) : reinsert(node); + return (node->reinserted || node->parent == NULL) ? split(node) : reinsert(node); } else // la < lb - 1 { @@ -298,7 +298,7 @@ NodePtr reinsert(NodePtr thIs) /* transfere out children from us to a new node q which will be returned */ - NodePtr q = make_shared(); + NodePtr q = new Node; q->tree = thIs->tree; q->child.resize(out); for (int i = thIs->child.size() - out; i < thIs->child.size(); i++) @@ -461,12 +461,11 @@ bool transferNode(NodePtr thIs, NodePtr parent, NodePtr node) NodePtr split(NodePtr thIs) { thIs->tree->increaseLevelSize(thIs->level); - NodePtr p = make_shared(); - NodePtr q = make_shared(); + NodePtr p = new Node; + NodePtr q = new Node; p->level = q->level = thIs->level; p->reinserted = q->reinserted = false; - p->parent = thIs->parent; - q->parent = thIs->parent; + p->parent = q->parent = thIs->parent; p->tree = q->tree = thIs->tree; @@ -476,7 +475,7 @@ NodePtr split(NodePtr thIs) thIs->tree->ref = thIs->closest(thIs->child, FARTHEST); // farthest from centre std::sort(thIs->child.begin(), thIs->child.end(), compareDist); for (int i = 0; i < MAX_NODE_SZ+1; i++) - assert(thIs->child[i]->parent.lock() == thIs); + assert(thIs->child[i]->parent == thIs); for (int i = 0; i < MAX_NODE_SZ/2 + 1; i++) q->child[i] = thIs->child[i]; for (int i = MAX_NODE_SZ/2+1; ichild[i]->parent = thIs; thIs->reinserted = p->reinserted; thIs->update(); - p.reset(); + delete p; if (thIs == thIs->tree->root) // root split { @@ -593,7 +592,7 @@ void Node::checkParent(void) int childSize = child.size() ; for (int i = 0; i < childSize; i++) - assert(child[i]->parent.lock() == shared_from_this()); + assert(child[i]->parent == this); if (level>0) for (int i = 0; i < childSize; i++) child[i]->checkParent() ; } @@ -602,7 +601,7 @@ void Node::printChildren() { cout << "level " << this->level << ", centre "; cout << "level " << this->level << ", centre " << this->centre << "\t r = " << this->radius << endl; - cout << this << " p: " << this->parent.lock() << endl; + cout << this << " p: " << this->parent << endl; int n = this->child.size(); for (int i=0; iroot == shared_from_this()) + if (tree->root == this) findClosest(level, node, distMin2, closest); - if (closest != NULL && tree->root == shared_from_this()) + if (closest != NULL && tree->root == this) /* When is this point reached? if the preceeding findClosest was called and succesed to set closest findClosest sets closest if we are `level` or src is in our circle (=> belongs to child of ours) @@ -690,12 +689,12 @@ void Node::routeIntersection(vector& routes, NodePtr node) } } -void Node::routingIntersecting(vector *routingList, NodePtr node) +void Node::routingIntersecting(vector *routingList, NodePtr node) { if (level==0) { int rank = route; - routingList[rank].push_back(node); + routingList[rank].push_back(*node); } else { @@ -712,13 +711,13 @@ void Node::free_descendants() { child[i]->free_descendants(); if (child[i]->level) // do not attempt to delete leafs, they are delete through leafs vector - child[i].reset(); + delete child[i]; } } void Node::getNodeLevel(int assignLevel, std::list& NodeList) { - if (level==assignLevel) NodeList.push_back(shared_from_this()) ; + if (level==assignLevel) NodeList.push_back(this) ; else if (level>0) for (int i = 0; i < child.size(); i++) child[i]->getNodeLevel(assignLevel,NodeList) ; return ; } @@ -737,7 +736,7 @@ bool Node::removeDeletedNodes(int assignLevel) isUpdate=true ; for (int j = 0; j < child[i]->child.size(); j++) tree->push_back(child[i]->child[j]) ; tree->decreaseLevelSize(assignLevel) ; - child[i].reset() ; + delete child[i] ; } else newChild.push_back(child[i]) ; } diff --git a/xios_2311_src/extern/remap/src/node.hpp b/xios_2311_src/extern/remap/src/node.hpp index 8d619d64589f97102e5e37cbf391d493aef011ee..2704f60c88e7d5fa47e8672374cc24f6a0ff324b 100644 --- a/xios_2311_src/extern/remap/src/node.hpp +++ b/xios_2311_src/extern/remap/src/node.hpp @@ -9,7 +9,6 @@ #include #include "triple.hpp" -#include namespace sphereRemap { @@ -112,17 +111,15 @@ struct Node; //typedef Node* NodePtr; //#endif -//typedef Node* NodePtr; -typedef std::shared_ptr NodePtr; +typedef Node* NodePtr; -struct Node : public std::enable_shared_from_this +struct Node { int level; /* FIXME leafs are 0 and root is max level? */ int leafCount; /* number of leafs that are descendants of this node (the elements in it's cycle) */ Coord centre; double radius; - std::weak_ptr parent ; - NodePtr ref; + NodePtr parent, ref; std::vector child; std::list intersectors; bool reinserted; @@ -200,7 +197,7 @@ struct Node : public std::enable_shared_from_this void assignCircleAndPropagateUp(Coord *centres, double *radia, int level); void printLevel(int level); void routeNode(NodePtr node, int level); - void routingIntersecting(std::vector* routingList, NodePtr node); + void routingIntersecting(std::vector* routingList, NodePtr node); void routeIntersection(std::vector& routes, NodePtr node); void getNodeLevel(int level,std::list& NodeList) ; bool removeDeletedNodes(int assignLevel) ; diff --git a/xios_2311_src/extern/remap/src/parallel_tree.cpp b/xios_2311_src/extern/remap/src/parallel_tree.cpp index 23496bfec6c85a201906bfba58070942cb13e588..26e00aa96dd02f394b3e8aeae6ec4f3f51ae83a1 100644 --- a/xios_2311_src/extern/remap/src/parallel_tree.cpp +++ b/xios_2311_src/extern/remap/src/parallel_tree.cpp @@ -17,21 +17,21 @@ namespace sphereRemap { static const int assignLevel = 2; // only the circle is packed, rest of node will be initialized on unpacking -static void packNode(NodePtr node, char *buffer, int& index) +static void packNode(Node& node, char *buffer, int& index) { if (buffer == NULL) // compute size only index += 4 * sizeof(double); else { - *(Coord *)(&buffer[index]) = node->centre; + *(Coord *)(&buffer[index]) = node.centre; index += sizeof(Coord); - *(double *)(&buffer[index]) = node->radius; + *(double *)(&buffer[index]) = node.radius; index += sizeof(double); } } -static void unpackNode(NodePtr node, char *buffer, int& index) +static void unpackNode(Node& node, char *buffer, int& index) { Coord centre; double r; @@ -42,8 +42,8 @@ static void unpackNode(NodePtr node, char *buffer, int& index) r = *(double *)(&buffer[index]); index += sizeof(double); - node->centre = centre; - node->radius = r; + node.centre = centre; + node.radius = r; } @@ -94,7 +94,7 @@ static void assignRoute(CSampleTree& tree, const CCascadeLevel& cl) // newroot tree.root->assignRoute(rank, assignLevel); } -static void transferRoutedNodes(CMPIRouting& MPIRoute, /*const*/ vector& nodeSend, const vector& route, vector& nodeRecv) +static void transferRoutedNodes(CMPIRouting& MPIRoute, /*const*/ vector& nodeSend, const vector& route, vector& nodeRecv) { /* `route` knows what goes where */ MPIRoute.init(route); @@ -103,13 +103,13 @@ static void transferRoutedNodes(CMPIRouting& MPIRoute, /*const*/ vector MPIRoute.transferToTarget(&nodeSend[0], &nodeRecv[0], packNode, unpackNode); } -static void transferRoutedIntersections(CMPIRouting& MPIRoute, const vector& nodeSend, const vector >& route, vector& nodeRecv) +static void transferRoutedIntersections(CMPIRouting& MPIRoute, const vector& nodeSend, const vector >& route, vector& nodeRecv) { // `route` knows what goes where MPIRoute.init(route); int nRecv = MPIRoute.getTotalSourceElement(); nodeRecv.resize(nRecv); - MPIRoute.transferToTarget((NodePtr*) &nodeSend[0], &nodeRecv[0], packNode, unpackNode); + MPIRoute.transferToTarget((Node * /*mpi wants non-const*/) &nodeSend[0], &nodeRecv[0], packNode, unpackNode); //cout << MPIRoute.mpiRank << " ROUTE " << nRecv << ": " << nodeSend.size() << " " << nodeRecv.size() << " "; } @@ -121,7 +121,7 @@ CParallelTree::CParallelTree(MPI_Comm comm) : communicator(comm), cascade(MAX_NO treeCascade.push_back(CSampleTree(cascade.level[lev].group_size, assignLevel)); } -void CParallelTree::buildSampleTreeCascade(vector& sampleNodes /*route field will be modified*/, int level) +void CParallelTree::buildSampleTreeCascade(vector& sampleNodes /*route field will be modified*/, int level) { buildSampleTree(treeCascade[level], sampleNodes, cascade.level[level]); assignRoute(treeCascade[level] /*out*/, cascade.level[level] /*in*/); @@ -131,14 +131,14 @@ void CParallelTree::buildSampleTreeCascade(vector& sampleNodes /*route vector route(sampleNodes.size()); treeCascade[level].routeNodes(route, sampleNodes, assignLevel); - vector routedNodes; + vector routedNodes; CMPIRouting mpiRoute(cascade.level[level].pg_comm); transferRoutedNodes(mpiRoute, sampleNodes, route, routedNodes); buildSampleTreeCascade(routedNodes, level+1); } } -void buildSampleTree(CSampleTree& tree, const vector& node, const CCascadeLevel& comm) +void buildSampleTree(CSampleTree& tree, const vector& node, const CCascadeLevel& comm) /* In the beginning all the sample elements are distributed -> communicate to make available at each rank @@ -174,7 +174,7 @@ void buildSampleTree(CSampleTree& tree, const vector& node, const CCasc randomizeArray(randomArray); for (int i = 0; i < nsend; i++) { - const Node& no = *node[randomArray[i]]; + const Node& no = node[randomArray[i]]; *((Coord *) (sendBuffer + index)) = no.centre; index += sizeof(Coord)/sizeof(*sendBuffer); sendBuffer[index++] = no.radius; @@ -209,8 +209,6 @@ void buildSampleTree(CSampleTree& tree, const vector& node, const CCasc randomArray.resize(blocSize); randomizeArray(randomArray); tree.leafs.resize(blocSize); - for(auto& it : tree.leafs) it=make_shared() ; - index = 0; size_t s=(sizeof(Coord)/sizeof(*recvBuffer)+1)*nrecv ; @@ -221,8 +219,8 @@ void buildSampleTree(CSampleTree& tree, const vector& node, const CCasc index += sizeof(Coord)/sizeof(*recvBuffer); double radius = recvBuffer[index%s]; index++ ; - tree.leafs[randomArray[i]]->centre = x; - tree.leafs[randomArray[i]]->radius = radius; + tree.leafs[randomArray[i]].centre = x; + tree.leafs[randomArray[i]].radius = radius; } @@ -234,6 +232,7 @@ void buildSampleTree(CSampleTree& tree, const vector& node, const CCasc // cout << "SampleTree build : assign Level " << assignLevel << " nb Nodes : " << tree.levelSize[assignLevel] << endl; CTimer::get("buildSampleTree(local)").suspend(); CTimer::get("buildSampleTree(local)").print(); + /* End gracefully if sample tree could not be constructed with desired number of nodes on assignLevel */ int allok, ok = (tree.levelSize[assignLevel] == comm.group_size); if (!ok) @@ -262,7 +261,7 @@ void buildSampleTree(CSampleTree& tree, const vector& node, const CCasc } -void CParallelTree::buildLocalTree(const vector& node, const vector& route) +void CParallelTree::buildLocalTree(const vector& node, const vector& route) { CMPIRouting MPIRoute(communicator); MPI_Barrier(communicator); @@ -276,7 +275,7 @@ void CParallelTree::buildLocalTree(const vector& node, const vector ptElement(node.size()); for (int i = 0; i < node.size(); i++) - ptElement[i] = (Elt *) (node[i]->data); + ptElement[i] = (Elt *) (node[i].data); vector ptLocalElement(nbLocalElements); for (int i = 0; i < nbLocalElements; i++) @@ -297,7 +296,7 @@ void CParallelTree::buildLocalTree(const vector& node, const vector(elt.x, cptRadius(elt), &localElements[i])); + localTree.leafs.push_back(Node(elt.x, cptRadius(elt), &localElements[i])); } localTree.build(localTree.leafs); @@ -306,7 +305,7 @@ void CParallelTree::buildLocalTree(const vector& node, const vector& node, vector& node2) +void CParallelTree::build(vector& node, vector& node2) { int assignLevel = 2; @@ -332,7 +331,7 @@ void CParallelTree::build(vector& node, vector& node2) // assert(node.size() > nbSampleNodes); // assert(node2.size() > nbSampleNodes); // assert(node.size() + node2.size() > nbSampleNodes); - vector sampleNodes; sampleNodes.reserve(nbSampleNodes1+nbSampleNodes2); + vector sampleNodes; sampleNodes.reserve(nbSampleNodes1+nbSampleNodes2); vector randomArray1(node.size()); randomizeArray(randomArray1); @@ -358,8 +357,8 @@ void CParallelTree::build(vector& node, vector& node2) s2=nbSampleNodes/2 ; } */ - for (int i = 0; i (node[randomArray1[i%nb1]]->centre, node[randomArray1[i%nb1]]->radius, nullptr)); - for (int i = 0; i (node2[randomArray2[i%nb2]]->centre, node2[randomArray2[i%nb2]]->radius, nullptr)); + for (int i = 0; i & node, vector& node2) CTimer::get("buildRouteTree").print(); } -void CParallelTree::routeNodes(vector& route, vector& nodes /*route field used*/, int level) +void CParallelTree::routeNodes(vector& route, vector& nodes /*route field used*/, int level) { treeCascade[level].routeNodes(route /*assign*/, nodes, assignLevel); if (level+1 < cascade.num_levels) { - vector routedNodes; + vector routedNodes; CMPIRouting MPIRoute(cascade.level[level].pg_comm); transferRoutedNodes(MPIRoute, nodes, route /*use*/, routedNodes); vector globalRank(routedNodes.size()); @@ -438,25 +437,22 @@ void delinearize(const vector& from, vector >& to) copy(src, end = src + to[i].size(), to[i].begin()); } -void CParallelTree::routeIntersections(vector >& routes, vector& nodes, int level) +void CParallelTree::routeIntersections(vector >& routes, vector& nodes, int level) { treeCascade[level].routeIntersections(routes /*assign*/, nodes); if (level+1 < cascade.num_levels) { - vector routedNodes; + vector routedNodes; CMPIRouting MPIRoute(cascade.level[level].pg_comm); vector flattenedRoutes1; linearize(routes, flattenedRoutes1); - vector double_nodes(flattenedRoutes1.size()); + vector double_nodes(flattenedRoutes1.size()); int j = 0; for (int i = 0; i < routes.size(); ++i) for (int k = 0; k < routes[i].size(); ++k, ++j) - { - double_nodes[j] = make_shared() ; - *double_nodes[j] = *nodes[i]; - } + double_nodes[j] = nodes[i]; transferRoutedNodes(MPIRoute, double_nodes, flattenedRoutes1 /*use*/, routedNodes); vector > globalRanks(routedNodes.size()); routeIntersections(globalRanks /*out*/, routedNodes /*in*/, level + 1); diff --git a/xios_2311_src/extern/remap/src/parallel_tree.hpp b/xios_2311_src/extern/remap/src/parallel_tree.hpp index cd51193dbe7994829126266f39492fa503779eca..9800c067a5ce4f1278357a1bc812e95a959fa53b 100644 --- a/xios_2311_src/extern/remap/src/parallel_tree.hpp +++ b/xios_2311_src/extern/remap/src/parallel_tree.hpp @@ -14,10 +14,10 @@ public: CParallelTree(MPI_Comm comm); ~CParallelTree(); - void build(vector& node, vector& node2); + void build(vector& node, vector& node2); - void routeNodes(vector& route, vector& nodes, int level = 0); - void routeIntersections(vector >& route, vector& nodes, int level = 0); + void routeNodes(vector& route, vector& nodes, int level = 0); + void routeIntersections(vector >& route, vector& nodes, int level = 0); int nbLocalElements; Elt* localElements; @@ -26,8 +26,8 @@ public: private: void updateCirclesForRouting(Coord rootCentre, double rootRadius, int level = 0); - void buildSampleTreeCascade(vector& sampleNodes, int level = 0); - void buildLocalTree(const vector& node, const vector& route); + void buildSampleTreeCascade(vector& sampleNodes, int level = 0); + void buildLocalTree(const vector& node, const vector& route); void buildRouteTree(); //CSampleTree sampleTree; @@ -37,7 +37,7 @@ private: }; -void buildSampleTree(CSampleTree& tree, const vector& node, const CCascadeLevel& comm); +void buildSampleTree(CSampleTree& tree, const vector& node, const CCascadeLevel& comm); } #endif diff --git a/xios_2311_src/extern/remap/src/polyg.cpp b/xios_2311_src/extern/remap/src/polyg.cpp index 36bd92a723ad61c9d8b87e71a00e5818dba86f43..8855b66560a142585f96d38b3114eebf6f28a625 100644 --- a/xios_2311_src/extern/remap/src/polyg.cpp +++ b/xios_2311_src/extern/remap/src/polyg.cpp @@ -97,9 +97,6 @@ Coord exact_barycentre(const Coord *x, int n) else if (n == 0) return ORIGIN; else if (n == 2) return midpoint(x[0], x[1]); else if (n == 1) return x[0]; - - error_exit( "Missing return in : Coord exact_barycentre(const Coord *x, int n)" ); - return ORIGIN; } Coord sc_gc_moon_normalintegral(Coord a, Coord b, Coord pole) diff --git a/xios_2311_src/extern/remap/src/timerRemap.cpp b/xios_2311_src/extern/remap/src/timerRemap.cpp index e8f7a5424b01fb369bd73985e6f36fe6937821fc..0354b1d17c7871c57a878bda5084b89ac8a2e9b3 100644 --- a/xios_2311_src/extern/remap/src/timerRemap.cpp +++ b/xios_2311_src/extern/remap/src/timerRemap.cpp @@ -59,11 +59,4 @@ CTimer& CTimer::get(const string name) if (it==allTimer.end()) it=allTimer.insert(pair(name,new CTimer(name))).first; return *(it->second); } - -void CTimer::release(void) -{ - for(auto & it : allTimer) delete it.second ; - allTimer.clear() ; -} - } diff --git a/xios_2311_src/extern/remap/src/timerRemap.hpp b/xios_2311_src/extern/remap/src/timerRemap.hpp index 4d7b653c50c73b8ecd196673e987c75576f96829..c31e48ea8449976106d486f1244e7366d318c50d 100644 --- a/xios_2311_src/extern/remap/src/timerRemap.hpp +++ b/xios_2311_src/extern/remap/src/timerRemap.hpp @@ -1,5 +1,5 @@ -#ifndef __TIMER_REMAP_HPP__ -#define __TIMER_REMAP_HPP__ +#ifndef __TIMER_HPP__ +#define __TIMER_HPP__ #include "mpi.hpp" #include @@ -28,8 +28,9 @@ namespace sphereRemap { static map allTimer; static double getTime(void); static CTimer& get(string name); - static void release(void) ; - } ; + }; + + } #endif diff --git a/xios_2311_src/extern/remap/src/tree.cpp b/xios_2311_src/extern/remap/src/tree.cpp index d6fb676f949d9ff2302183001a675ec16258659c..79361a5e9eb86de4c22f910a82f917646a99b1e4 100644 --- a/xios_2311_src/extern/remap/src/tree.cpp +++ b/xios_2311_src/extern/remap/src/tree.cpp @@ -26,22 +26,22 @@ CBasicTree::CBasicTree() : ri(0), levelSize(MAX_LEVEL_SIZE), root(NULL) } */ -void CBasicTree::routeNodes(vector& route, vector& nodes, int assignLevel) +void CBasicTree::routeNodes(vector& route, vector& nodes, int assignLevel) { for (int i = 0; i < nodes.size(); i++) { - root->routeNode(nodes[i], assignLevel); - route[i] = nodes[i]->route; + root->routeNode(&nodes[i], assignLevel); + route[i] = nodes[i].route; } } -void CBasicTree::routeIntersections(vector >& routes, vector& nodes) +void CBasicTree::routeIntersections(vector >& routes, vector& nodes) { for (int i = 0; i < nodes.size(); i++) - root->routeIntersection(routes[i], nodes[i]); + root->routeIntersection(routes[i], &nodes[i]); } -void CBasicTree::build(vector& nodes) +void CBasicTree::build(vector& nodes) { newRoot(1); insertNodes(nodes); @@ -79,7 +79,7 @@ void CBasicTree::insertNode(NodePtr node) increaseLevelSize(0); push_back(node); - NodePtr q=make_shared(); + NodePtr q; while (pool.size()) { q = pool.front(); @@ -87,7 +87,7 @@ void CBasicTree::insertNode(NodePtr node) q = insert(q, root); if (ri) { - q.reset(); + delete q; ri = 0; } } @@ -102,7 +102,7 @@ void CBasicTree::emptyPool(void) q = insert(q, root); if (ri) { - q.reset(); + delete q; ri = 0; } } @@ -136,10 +136,10 @@ void CBasicTree::decreaseLevelSize(int level) void CBasicTree::newRoot(int level) // newroot <- root { - root = make_shared(); + root = new Node; // if (level > 1) cout << " newRoot level " << level << endl; root->level = level; - root->parent.reset() ; + root->parent = 0; root->leafCount = 0; // initialize root node on the sphere root->centre.x=1 ; root->centre.y=0 ; root->centre.z=0 ; @@ -154,16 +154,16 @@ CBasicTree::~CBasicTree() { //FIXME uncomment the next line and figure out why it segfault sometimes //root->free_descendants(); // recursively deletes all nodes in the tree - if (root) root.reset(); + if (root) delete root; } -void CTree::insertNodes(vector& nodes) +void CTree::insertNodes(vector& nodes) { int stepSlim = MAX_NODE_SZ*MAX_NODE_SZ*2; const double ratio = 1.5; for (int i = 0; i < nodes.size(); i++) { - insertNode(nodes[i]); + insertNode(&nodes[i]); if (root->leafCount > stepSlim) // time for slim down { @@ -174,7 +174,7 @@ void CTree::insertNodes(vector& nodes) } -void CSampleTree::insertNodes(vector& nodes) +void CSampleTree::insertNodes(vector& nodes) { bool first1 = true; bool first2 = true; @@ -183,9 +183,10 @@ void CSampleTree::insertNodes(vector& nodes) double ratio = 1.5 ; int i ; +// cout<<"CSampleTree::insertNodes : nb node to be inserted : "<leafCount > stepSlim && levelSize[assignLevel] < keepNodes-2) // time for slim down { diff --git a/xios_2311_src/extern/remap/src/tree.hpp b/xios_2311_src/extern/remap/src/tree.hpp index 1a75a802be58c594ec063815ea882cf0b64211d0..8fda157458724abcc52d3968229a03ed1048a0e0 100644 --- a/xios_2311_src/extern/remap/src/tree.hpp +++ b/xios_2311_src/extern/remap/src/tree.hpp @@ -19,16 +19,16 @@ public: NodePtr ref; // FIXME this reference, set by a node is odd, try to remove int ri; /** this is set to one by a node in case of reinsertion */ vector levelSize; /** e.g. levelSize[0] == leafs.size() */ - vector leafs; /** leafs are stored in vector for easy access and rest of the tree nodes as separate allocations, only reachable through tree traversal */ + vector leafs; /** leafs are stored in vector for easy access and rest of the tree nodes as separate allocations, only reachable through tree traversal */ CBasicTree() : ri(0), levelSize(MAX_LEVEL_SIZE), root(NULL), isAssignedLevel(false), okSplit(true), isActiveOkSplit(false) {} ~CBasicTree(); - void build(vector& nodes); + void build(vector& nodes); void slim(int nbIts = 1); - virtual void insertNodes(vector& node) = 0; + virtual void insertNodes(vector& node) = 0; - void routeNodes(vector& route, vector& nodes, int assignLevel); - void routeIntersections(vector >& route, vector& nodes); + void routeNodes(vector& route, vector& nodes, int assignLevel); + void routeIntersections(vector >& route, vector& nodes); void push_back(NodePtr node); void push_front(NodePtr node); @@ -62,7 +62,7 @@ protected: class CTree : public CBasicTree { public: - void insertNodes(vector& nodes); + void insertNodes(vector& nodes); }; class CSampleTree : public CBasicTree @@ -72,7 +72,7 @@ public: CSampleTree(int keepNodes_, int assignLevel_) : CBasicTree(keepNodes_,assignLevel_) {} void slimAssignedLevel() ; void removeExtraNode(void) ; - void insertNodes(vector& nodes); + void insertNodes(vector& nodes); }; } diff --git a/xios_2311_src/extern/remap/src/triple.hpp b/xios_2311_src/extern/remap/src/triple.hpp index 32ae5be0bb7750b9a39102e8b1b46d5edfcb91a4..1e58de56deead15572282ba16193a22a24790016 100644 --- a/xios_2311_src/extern/remap/src/triple.hpp +++ b/xios_2311_src/extern/remap/src/triple.hpp @@ -35,10 +35,10 @@ public: Vector& operator+=(const Vector& rhs) { - u += rhs.u; - v += rhs.v; - w += rhs.w; - return *this; + u += rhs.u; + v += rhs.v; + w += rhs.w; + return *this ; } double u, v, w; diff --git a/xios_2311_src/extern/tv_data_display/tv_data_display.c b/xios_2311_src/extern/tv_data_display/tv_data_display.c deleted file mode 100644 index d2a3c3d9a850d363f7790dfc0eeafac03afc7b8f..0000000000000000000000000000000000000000 --- a/xios_2311_src/extern/tv_data_display/tv_data_display.c +++ /dev/null @@ -1,298 +0,0 @@ -/* - * $Header$ - * $Locker$ - - Copyright (c) 2010-2012, Rogue Wave Software, Inc. - - Permission is hereby granted, free of charge, to any person obtaining a copy - of the tv_data_display.h and tv_data_display.c files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies - of the Software, and to permit persons to whom the Software is furnished to do - so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, - INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A - PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - * Update log - * - * Feb 1 2012 NYP: Updated Copyright - * Apr 18 2011 SJT: TVT-13122, comment cleanup. - * Sep 27 2010 ANB: lots of changes as part of totalview/12314. - * Reworked to reduce the dependencies on outside - * entities, both at compile and also at runtime. - * Adjusted the naming scheme. - * Jan 28 2010 SJT: Bug 12100, bump base size to 16K and recognize if it is - * resized further. - * Sep 24 2009 SJT: Remove pre/post callback to reduce function call overhead. - * Jul 1 2009 SJT: Created. - * - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "tv_data_display.h" - -#include -#include /* for size_t */ - -#define DATA_FORMAT_BUFFER_SIZE 16384 -#define TV_FORMAT_INACTIVE 0 -#define TV_FORMAT_FIRST_CALL 1 -#define TV_FORMAT_APPEND_CALL 2 - -volatile int TV_ttf_data_format_control = TV_FORMAT_INACTIVE; -int TV_ttf_data_display_api_version = TV_TTF_DATA_DISPLAY_API_VERSION; - -/* TV_ttf_data_format_buffer should not be static for icc 11, and others */ -char TV_ttf_data_format_buffer[DATA_FORMAT_BUFFER_SIZE]; -static char *TV_ttf_data_buffer_ptr = TV_ttf_data_format_buffer; - -static const char digits [] = "0123456789abcdefghijklmnopqrstuvwxyz"; -static const size_t base_bound = sizeof ( digits ); - -/* ************************************************************************ */ - -int -TV_ttf_is_format_result_ok ( TV_ttf_format_result fr ) -{ - int ret_val; - - switch ( fr ) - { - case TV_ttf_format_ok: - case TV_ttf_format_ok_elide: - ret_val = 1; - break; - default: - ret_val = 0; - break; - } - return ret_val; -} /* TV_ttf_is_format_result_ok */ - -/* ************************************************************************ */ - -static -void * -my_zeroit ( void *s, size_t n ) -{ - char *cp = (char *) s; - - /* not the most efficient of solutions. What we should do is */ - /* do the assugnments in units of int or long. The problem */ - /* with that is ensuring that the alignments of the assignments */ - /* are correct. The difficulty with that is doing arithmetic */ - /* on pointers in a portable manner. */ - while ( n > 0 ) - { - *cp++ = 0; - n--; - } - - return s; -} /* my_zeroit */ - -static -char * -my_strpbrk ( const char *str, const char *accept ) -{ - char *ret_val = NULL; - char *s, *t; - - for ( s = (char *) str; (*s) && (! ret_val); s++ ) - { - for ( t = (char *) accept; (*t) && (! ret_val); t++ ) - { - if ( *s == *t ) - ret_val = s; - } - } - - return ret_val; -} /* my_strpbrk */ - -static -int -marshal_string ( char *buffer, size_t len, const char *s, - char **nbuffer, size_t *nlen ) -{ - int ret_val = 0; - char *cursor = buffer; - - while ( *s ) - { - ret_val++; - if ( len > 1 ) - { - *cursor++ = *s++; - len--; - } - } - if ( len > 0 ) - *cursor = '\0'; - - if ( nbuffer ) - *nbuffer = cursor; - if ( nlen ) - *nlen = len; - - return ret_val; -} /* marshal_string */ - -static -int -marshal_unsigned_body ( char *buffer, size_t len, size_t val, int base, - char **nbuffer, size_t *nlen ) -{ - - int ret_val = 0; - size_t q, r; - char digit [ 2 ]; - char *my_buffer = buffer; - size_t my_len = len; - - if ( val < base ) - { - r = val; - } - else - { - q = val / base; - r = val - (q * base); - ret_val += marshal_unsigned_body ( buffer, len, q, base, - &my_buffer, &my_len ); - } - digit [ 0 ] = digits [ r ]; - digit [ 1 ] = '\0'; - ret_val += marshal_string ( my_buffer, my_len, digit, nbuffer, nlen ); - - return ret_val; -} /* marshal_unsigned_body */ - -static -int -marshal_unsigned ( char *buffer, size_t len, size_t val, int base, - char **nbuffer, size_t *nlen ) -{ - int ret_val = 0; - - if ( 0 == base ) - base = 10; - if ( base < base_bound ) - ret_val = marshal_unsigned_body ( buffer, len, val, base, nbuffer, nlen ); - else - ret_val = -1; - - return ret_val; -} /* marshal_unsigned */ - -static -int -marshal_hex ( char *buffer, size_t len, size_t hex_val, - char **nbuffer, size_t *nlen ) -{ - int ret_val = 0; - char *my_buffer; - size_t my_len; - - ret_val += marshal_string ( buffer, len, "0x", &my_buffer, &my_len ); - ret_val += marshal_unsigned ( my_buffer, my_len, hex_val, 16, nbuffer, nlen ); - - return ret_val; -} /* marshal_hex */ - -static -int -marshal_row ( char *buffer, size_t len, const char *field_name, - const char *type_name, - const void *value, - char **nbuffer, - size_t *nlen ) -{ - int ret_val = 0; - char *my_buffer; - size_t my_len; - - ret_val += marshal_string ( buffer, len, field_name, &my_buffer, &my_len ); - ret_val += marshal_string ( my_buffer, my_len, "\t", &my_buffer, &my_len ); - ret_val += marshal_string ( my_buffer, my_len, type_name, &my_buffer, &my_len ); - ret_val += marshal_string ( my_buffer, my_len, "\t", &my_buffer, &my_len ); - ret_val += marshal_hex ( my_buffer, my_len, (size_t) value, &my_buffer, &my_len ); - ret_val += marshal_string ( my_buffer, my_len, "\n", nbuffer, nlen ); - - return ret_val; -} /* marshal_row */ - -int TV_ttf_add_row(const char *field_name, - const char *type_name, - const void *value) -{ - size_t remaining; - int out; - - /* - printf ( "TV_ttf_add_row: on entry TV_ttf_data_format_control == %d\n", TV_ttf_data_format_control ); - */ - - /* Called at the wrong time */ - if (TV_ttf_data_format_control == TV_FORMAT_INACTIVE) - return TV_ttf_ec_not_active; - - if (my_strpbrk(field_name, "\n\t") != NULL) - return TV_ttf_ec_invalid_characters; - - if (my_strpbrk(type_name, "\n\t") != NULL) - return TV_ttf_ec_invalid_characters; - - if (TV_ttf_data_format_control == TV_FORMAT_FIRST_CALL) - { - /* Zero out the buffer to avoid confusion, and set the write point - to the top of the buffer. */ - - my_zeroit(TV_ttf_data_format_buffer, sizeof (TV_ttf_data_format_buffer)); - TV_ttf_data_buffer_ptr = TV_ttf_data_format_buffer; - TV_ttf_data_format_control = TV_FORMAT_APPEND_CALL; - } - - remaining = TV_ttf_data_buffer_ptr + - DATA_FORMAT_BUFFER_SIZE - TV_ttf_data_format_buffer; - -/* - out = snprintf(TV_ttf_data_buffer_ptr, - remaining, "%s\t%s\t%p\n", - field_name, type_name, value); -*/ - out = marshal_row ( TV_ttf_data_buffer_ptr, remaining, - field_name, type_name, value, 0, 0 ); - - if (out < 1) - return TV_ttf_ec_buffer_exhausted; - - TV_ttf_data_buffer_ptr += out; - - return 0; -} /* TV_ttf_add_row */ - -void TV_ttf_pre_display_callback(void) -{ - TV_ttf_data_format_control = TV_FORMAT_FIRST_CALL; -} - -void TV_ttf_post_display_callback(void) -{ - TV_ttf_data_format_control = TV_FORMAT_INACTIVE; -} - -#ifdef __cplusplus -} -#endif diff --git a/xios_2311_src/extern/tv_data_display/tv_data_display.h b/xios_2311_src/extern/tv_data_display/tv_data_display.h deleted file mode 100644 index 8b47bd4686b36012dabd90d08ec6268ba8567245..0000000000000000000000000000000000000000 --- a/xios_2311_src/extern/tv_data_display/tv_data_display.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * $Header$ - * $Locker$ - - Copyright (c) 2010-2012, Rogue Wave Software, Inc. - - Permission is hereby granted, free of charge, to any person obtaining a copy - of the tv_data_display.h and tv_data_display.c files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies - of the Software, and to permit persons to whom the Software is furnished to do - so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, - INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A - PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - * Update log - * - * Feb 1 2012 NYP: Updated Copyright - * Sep 27 2010 ANB: reworked as part of totalview/12314 - * Jun 17 2010 JVD: Added TV_elide_row. - * Sep 25 2009 SJT: Add idempotence header. - * Jul 1 2009 SJT: Created. - * - */ - -#ifndef TV_DATA_DISPLAY_H_INCLUDED -#define TV_DATA_DISPLAY_H_INCLUDED 1 - -#define TV_TTF_DATA_DISPLAY_API_VERSION 1 - -#ifdef __cplusplus -extern "C" { -#endif - -/* TV_ttf_display_type should return one of these values */ -enum TV_ttf_format_result - { - TV_ttf_format_ok, /* Type is known, and successfully converted */ - TV_ttf_format_ok_elide, /* as TV_ttf_format_ok, but elide type */ - TV_ttf_format_failed, /* Type is known, but could not convert it */ - TV_ttf_format_raw, /* Just display it as a regular type for now */ - TV_ttf_format_never /* Don't know about this type, and please don't ask again */ - }; -typedef enum TV_ttf_format_result TV_ttf_format_result; - -/* TV_ttf_add_row returns one of these values */ -enum TV_ttf_error_codes - { - TV_ttf_ec_ok = 0, /* operation succeeded */ - TV_ttf_ec_not_active, - TV_ttf_ec_invalid_characters, - TV_ttf_ec_buffer_exhausted - }; -typedef enum TV_ttf_error_codes TV_ttf_error_codes; - -#define TV_ttf_type_ascii_string "$string" -#define TV_ttf_type_int "$int" -#if 0 -#define TV_elide_row "" /* field_name to use when row elision is desired */ -#endif - -/* returns logical true (non-zero) if the TV_ttf_format_result fr represents - a format result that indicates success -*/ -extern int TV_ttf_is_format_result_ok ( TV_ttf_format_result fr ); - -/* - TV_ttf_ec_ok: Success - TV_ttf_ec_not_active: Called with no active callback to - TV_ttf_display_type - TV_ttf_ec_invalid_characters: field_name or type_name has illegal characters - TV_ttf_ec_buffer_exhausted: No more room left for display data -*/ -extern int TV_ttf_add_row(const char *field_name, - const char *type_name, - const void *value); - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/xios_2311_src/generic_testcase/context_atm.xml b/xios_2311_src/generic_testcase/context_atm.xml index a48c8341c9e2d1ee5ebad041b4f78373acd6b269..ce9d567647d12148a2fe5a67e7fc72b79a336f6e 100644 --- a/xios_2311_src/generic_testcase/context_atm.xml +++ b/xios_2311_src/generic_testcase/context_atm.xml @@ -2,35 +2,41 @@ - - - - - - - + + + + + + - + + + + + + + + + + + + + + - - - - - - - - - + + + @@ -42,17 +48,38 @@ - + + + + + + + + - - + + + + + + + + + + + + + + + + @@ -99,11 +126,6 @@ - - - - - @@ -140,23 +162,20 @@ + - + - - - - @@ -203,11 +222,6 @@ - - - - - @@ -243,18 +257,21 @@ - + - - + + + + + + + - @@ -263,18 +280,13 @@ - - - - - + @@ -284,16 +296,12 @@ - - - - + - + @@ -302,14 +310,12 @@ - - + @@ -317,190 +323,81 @@ + + - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/xios_2311_src/generic_testcase/context_grid_dynamico.xml b/xios_2311_src/generic_testcase/context_grid_dynamico.xml index c7b66403035b187861e521acf554626f3f24e927..230db1f24b948acf5c637efd4b8b9cacf18fbcf1 100644 --- a/xios_2311_src/generic_testcase/context_grid_dynamico.xml +++ b/xios_2311_src/generic_testcase/context_grid_dynamico.xml @@ -4,8 +4,8 @@ - - + + diff --git a/xios_2311_src/generic_testcase/context_oce.xml b/xios_2311_src/generic_testcase/context_oce.xml deleted file mode 100644 index bf09ec03a96bfe21c2bf4dd54b6073622531c8c6..0000000000000000000000000000000000000000 --- a/xios_2311_src/generic_testcase/context_oce.xml +++ /dev/null @@ -1,478 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @this - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/xios_2311_src/generic_testcase/iodef.xml b/xios_2311_src/generic_testcase/iodef.xml index fc0dcf7167e2ff49c1dd4562fe62ac8374544b3a..076a42b6001d4fd23569a74aa82a39de1e9d17f4 100644 --- a/xios_2311_src/generic_testcase/iodef.xml +++ b/xios_2311_src/generic_testcase/iodef.xml @@ -1,4 +1,5 @@ + @@ -7,11 +8,8 @@ 1h lmdz false - cross false - false - sparse - academic + rank 36 18 10 @@ -22,44 +20,6 @@ 2 2 --> - lmdz - false - false - academic - 30 - 15 - 10 - 0.10 - false - - - - - - - - - - - - 1h - nemo - false - false - academic - 64 - 32 - 5 - 0.10 - false - - lmdz false false @@ -77,32 +37,30 @@ - - - + + - 10000000 - performance - 0.8 + 10000000 + performance + 0.8 - true 100 true - false + true 50 - + 1 false true - true + false diff --git a/xios_2311_src/generic_testcase/param.def b/xios_2311_src/generic_testcase/param.def index 0efbe396407a05e3e7432f09330507b8d1dce6ec..81b6a884a812cdcd225256fc0589068d720cf0dd 100644 --- a/xios_2311_src/generic_testcase/param.def +++ b/xios_2311_src/generic_testcase/param.def @@ -1,5 +1,4 @@ ¶ms_run -duration='4ts' -nb_proc_atm=1 -nb_proc_oce=0 +duration='1d' +nb_proc_atm=4 / diff --git a/xios_2311_src/inputs/COMPLETE/context_atmosphere.xml b/xios_2311_src/inputs/COMPLETE/context_atmosphere.xml index 98ad5de47666d466650621cdd402b28f5785c2bd..1b3de836ab6b1e7484ceb7a44ad36376a1fb5a6b 100644 --- a/xios_2311_src/inputs/COMPLETE/context_atmosphere.xml +++ b/xios_2311_src/inputs/COMPLETE/context_atmosphere.xml @@ -7,12 +7,12 @@ - + - + - + diff --git a/xios_2311_src/inputs/COMPLETE/context_surface.xml b/xios_2311_src/inputs/COMPLETE/context_surface.xml index 121c33e1c517475b180984be7515071e51a936cc..d1bc7f6f98a7418b02241e6b4adae764d575ea3d 100644 --- a/xios_2311_src/inputs/COMPLETE/context_surface.xml +++ b/xios_2311_src/inputs/COMPLETE/context_surface.xml @@ -11,17 +11,17 @@ field_A_srf + field_C_srf - + - + surf_att 10 6.8 100.201 - + - field_A_srf_K + @field_A_srf_K @@ -31,7 +31,7 @@ file_6h - + surf_att 10 diff --git a/xios_2311_src/inputs/iodef.xml b/xios_2311_src/inputs/iodef.xml index 83b0ba5bb9f745a177e6c41ea3511d447cf849f9..0497be12cde06d41e2c353aecfbdc7a4dee079c7 100644 --- a/xios_2311_src/inputs/iodef.xml +++ b/xios_2311_src/inputs/iodef.xml @@ -6,28 +6,52 @@ - + + + + field_A+10 - - - - - + + + + + + 10*test_field_B + 100*field_A + field_A+10*test_field_B-field_C + + + + + + - + + + - - - + + + + + - + + field_A+50 + + + + field_A + field_B + field_C + + + @@ -78,7 +102,7 @@ false - 50 + 80 true diff --git a/xios_2311_src/make_xios b/xios_2311_src/make_xios index 0e78499d950e401e8a469cccf7fe527e45dc116a..4fb4535aa366a3815884835ce7ccf024775c9ed1 100755 --- a/xios_2311_src/make_xios +++ b/xios_2311_src/make_xios @@ -1,4 +1,5 @@ #!/bin/bash + install_dir=$PWD compil_full="false" use_oasis="false" @@ -16,7 +17,7 @@ arch_path=$PWD/"arch" arch_default_path=$PWD/"arch" arch_defined="FALSE" arch_path_defined="FALSE" -fcm_version=new +fcm_version=old # Traitement de la ligne de commande while (($# > 0)) @@ -41,7 +42,7 @@ while (($# > 0)) echo " [--doc] : to generate Doxygen documentation (not available yet)" echo " [--job ntasks] : to use parallel compilation with ntasks" echo " [--netcdf_lib 'netcdf4_par'/'netcdf4_seq'/'netcdf4_internal' : default netcdf4_par] : choice of netcdf library" - echo " [--memtrack full/light] : tracking memory leak - developper only" + echo " [--memtrack] : tracking memory leak - developper only" echo " [--fcm] : fcm version compatibility : 'new'/'old'" echo "Example : ./make_xios --prod --arch PW6_VARGAS" echo "Example : ./make_xios --avail" @@ -242,8 +243,9 @@ if [[ "$use_memtrack" == "true" ]] if [[ "$memtrack" == "light" ]] then XIOS_CPPKEY="$XIOS_CPPKEY XIOS_MEMTRACK_LIGHT" - elif [[ "$memtrack" == "full" ]] + elif [[ "$memtrack" == "FULL" ]] then + XIOS_LIB="$ADDR2LINE_LIBDIR $ADDR2LINE_LIB $XIOS_LIB" XIOS_CPPKEY="$XIOS_CPPKEY XIOS_MEMTRACK_FULL" else echo "Bad choice for --memtrack argument : choose between 'light','full'" diff --git a/xios_2311_src/src/addr2line.hpp b/xios_2311_src/src/addr2line.hpp deleted file mode 100755 index dbc7856ba0f79bf4c7d8c143b99bf7b8edc042b5..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/addr2line.hpp +++ /dev/null @@ -1,109 +0,0 @@ -#ifdef XIOS_MEMTRACK - -#ifndef __ADDR2LINE_HPP__ -#define __ADDR2LINE_HPP__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace xios -{ - class CAddr2line - { - public: - - CAddr2line(void) ; - ~CAddr2line() ; - - void write(const std::string& str) ; - void read(std::string& str) ; - - private: - pid_t child_pid; - int from_child, to_child; - } ; - - - CAddr2line::CAddr2line(void) - { - pid_t p; - int pipe_stdin[2], pipe_stdout[2]; - char execfile[1000] ; - ssize_t size=readlink("/proc/self/exe",execfile,1000) ; - execfile[size]='\0' ; - std::string cmdline = "addr2line -e "; - cmdline=cmdline+execfile ; - - int err ; - err=pipe(pipe_stdin) ; - // if (err) return -1; // make an exception// - err=pipe(pipe_stdout) ; - // if (err) return -1; // make an exception// - - p = fork(); - - if(p < 0) return ; // make an exception// - if(p == 0) - { /* child */ - close(pipe_stdin[1]); - dup2(pipe_stdin[0], 0); - close(pipe_stdout[0]); - dup2(pipe_stdout[1], 1); - execl("/bin/sh", "sh", "-c", cmdline.c_str(), NULL); - std::cout<<"child exit !!!"< - class CArray ; - -} - namespace xios { template @@ -32,214 +25,260 @@ namespace xios template explicit CArray(_bz_ArrayExpr expr) : Array(expr) - , initialized(true) { } + , initialized(true) + {} CArray(GeneralArrayStorage storage = T_default_storage()) : Array(storage) - , initialized(false) { } + , initialized(false) + {} explicit CArray(int length0, GeneralArrayStorage storage = T_default_storage()) : Array(length0, storage) - , initialized(true) { } + , initialized(true) + {} CArray(int length0, int length1, GeneralArrayStorage storage = T_default_storage()) : Array(length0, length1, storage) - , initialized(true) { } + , initialized(true) + {} CArray(int length0, int length1, int length2, GeneralArrayStorage storage = T_default_storage()) : Array(length0, length1, length2, storage) - , initialized(true) { } + , initialized(true) + {} CArray(int length0, int length1, int length2, int length3, GeneralArrayStorage storage = T_default_storage()) : Array(length0, length1, length2, length3, storage) - , initialized(true) { } + , initialized(true) + {} CArray(int length0, int length1, int length2, int length3, int length4, GeneralArrayStorage storage = T_default_storage()) : Array(length0,length1, length2, length3, length4, storage) - , initialized(true) { } + , initialized(true) + {} CArray(int length0, int length1, int length2, int length3, int length4, int length5, GeneralArrayStorage storage = T_default_storage()) : Array(length0, length1, length2, length3, length4, length5, storage) - , initialized(true) { } + , initialized(true) + {} CArray(int length0, int length1, int length2, int length3, int length4, int length5, int length6, GeneralArrayStorage storage = T_default_storage()) : Array(length0, length1, length2, length3, length4, length5, length6, storage) - , initialized(true) { } + , initialized(true) + {} CArray(int length0, int length1, int length2, int length3, int length4, int length5, int length6, int length7, GeneralArrayStorage storage = T_default_storage()) : Array(length0, length1, length2, length3, length4, length5, length6, length7, storage) - , initialized(true) { } + , initialized(true) + {} CArray(int length0, int length1, int length2, int length3, int length4, int length5, int length6, int length7, int length8, GeneralArrayStorage storage = T_default_storage()) : Array(length0, length1, length2, length3, length4, length5, length6, length7, length8, storage) - , initialized(true) { } + , initialized(true) + {} CArray(int length0, int length1, int length2, int length3, int length4, int length5, int length6, int length7, int length8, int length9, GeneralArrayStorage storage = T_default_storage()) : Array(length0, length1, length2, length3, length4, length5, length6, length7, length8, length9, storage) - , initialized(true) { } + , initialized(true) + {} CArray(int length0, int length1, int length2, int length3, int length4, int length5, int length6, int length7, int length8, int length9, int length10, GeneralArrayStorage storage = T_default_storage()) : Array(length0, length1, length2, length3, length4, length5, length6, length7, length8, length9, length10, storage) - , initialized(true) { } + , initialized(true) + {} CArray(T_numtype* restrict dataFirst, TinyVector shape, GeneralArrayStorage storage = T_default_storage()) : Array(dataFirst, shape, storage) - , initialized(true) { } + , initialized(true) + {} CArray(T_numtype* restrict dataFirst, TinyVector shape, TinyVector stride, GeneralArrayStorage storage = T_default_storage()) : Array(dataFirst, shape, stride, storage) - , initialized(true) { } + , initialized(true) + {} CArray(T_numtype* restrict dataFirst, TinyVector shape, preexistingMemoryPolicy deletionPolicy, GeneralArrayStorage storage = T_default_storage()) : Array(dataFirst, shape, deletionPolicy, storage) - , initialized(true) { } + , initialized(true) + {} CArray(T_numtype* restrict dataFirst, TinyVector shape, TinyVector stride, preexistingMemoryPolicy deletionPolicy, GeneralArrayStorage storage = T_default_storage()) : Array(dataFirst, shape, stride, deletionPolicy, storage) - , initialized(true) { } + , initialized(true) + {} CArray(const TinyVector& extent, GeneralArrayStorage storage = T_default_storage()) : Array(extent, storage) - , initialized(true) { } + , initialized(true) + {} CArray(const TinyVector& lbounds, const TinyVector& extent, const GeneralArrayStorage& storage) : Array(lbounds, extent, storage) - , initialized(true) { } + , initialized(true) + {} CArray(Range r0, GeneralArrayStorage storage = T_default_storage()) : Array(r0, storage) - , initialized(true) { } + , initialized(true) + {} CArray(Range r0, Range r1, GeneralArrayStorage storage = T_default_storage()) : Array(r0, r1, storage) - , initialized(true) { } + , initialized(true) + {} CArray(Range r0, Range r1, Range r2, GeneralArrayStorage storage = T_default_storage()) : Array(r0, r1, r2, storage) - , initialized(true) { } + , initialized(true) + {} CArray(Range r0, Range r1, Range r2, Range r3, GeneralArrayStorage storage = T_default_storage()) : Array(r0, r1, r2, r3, storage) - , initialized(true) { } + , initialized(true) + {} CArray(Range r0, Range r1, Range r2, Range r3, Range r4, GeneralArrayStorage storage = T_default_storage()) : Array(r0, r1, r2, r3, r4, storage) - , initialized(true) { } + , initialized(true) + {} CArray(Range r0, Range r1, Range r2, Range r3, Range r4, Range r5, GeneralArrayStorage storage = T_default_storage()) : Array(r0, r1, r2, r3, r4, r5, storage) - , initialized(true) { } + , initialized(true) + {} CArray(Range r0, Range r1, Range r2, Range r3, Range r4, Range r5, Range r6, GeneralArrayStorage storage = T_default_storage()) : Array(r0, r1, r2, r3, r4, r5, r6, storage) - , initialized(true) { } + , initialized(true) + {} CArray(Range r0, Range r1, Range r2, Range r3, Range r4, Range r5, Range r6, Range r7, GeneralArrayStorage storage = T_default_storage()) : Array(r0, r1, r2, r3, r4, r5, r6, r7, storage) - , initialized(true) { } + , initialized(true) + {} CArray(Range r0, Range r1, Range r2, Range r3, Range r4, Range r5, Range r6, Range r7, Range r8, GeneralArrayStorage storage = T_default_storage()) : Array(r0, r1, r2, r3, r4, r5, r6, r7, r8, storage) - , initialized(true) { } + , initialized(true) + {} CArray(Range r0, Range r1, Range r2, Range r3, Range r4, Range r5, Range r6, Range r7, Range r8, Range r9, GeneralArrayStorage storage = T_default_storage()) : Array(r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, storage) - , initialized(true) { } + , initialized(true) + {} CArray(Range r0, Range r1, Range r2, Range r3, Range r4, Range r5, Range r6, Range r7, Range r8, Range r9, Range r10, GeneralArrayStorage storage = T_default_storage()) : Array(r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, storage) - , initialized(true) { } + , initialized(true) + {} CArray(const CArray& array) : Array(array) - , initialized(array.initialized) { } + , initialized(array.initialized) + {} CArray(const Array& array) : Array(array) - , initialized(true) { } + , initialized(true) + {} CArray(const TinyVector& shape, int lastExtent, const GeneralArrayStorage& storage) : Array(shape, lastExtent, storage) - , initialized(true) { } + , initialized(true) + {} CArray(Array& array, Range r0) : Array(array, r0) - , initialized(true) { } + , initialized(true) + {} CArray(Array& array, Range r0, Range r1) : Array(array, r0, r1) - , initialized(true) { } + , initialized(true) + {} CArray(Array& array, Range r0, Range r1, Range r2) : Array( array, r0, r1, r2) - , initialized(true) { } + , initialized(true) + {} CArray(Array& array, Range r0, Range r1, Range r2, Range r3) : Array(array, r0, r1, r2, r3) - , initialized(true) { } + , initialized(true) + {} CArray(Array& array, Range r0, Range r1, Range r2, Range r3, Range r4) : Array(array, r0, r1, r2, r3, r4) - , initialized(true) { } + , initialized(true) + {} CArray(Array& array, Range r0, Range r1, Range r2, Range r3, Range r4, Range r5) : Array( array, r0, r1, r2, r3, r4, r5) - , initialized(true) { } + , initialized(true) + {} CArray(Array& array, Range r0, Range r1, Range r2, Range r3, Range r4, Range r5, Range r6) : Array( array, r0, r1, r2, r3, r4, r5, r6) - , initialized(true) { } + , initialized(true) + {} CArray(Array& array, Range r0, Range r1, Range r2, Range r3, Range r4, Range r5, Range r6, Range r7) : Array(array, r0, r1, r2, r3, r4, r5, r6, r7) - , initialized(true) { } + , initialized(true) + {} CArray(Array& array, Range r0, Range r1, Range r2, Range r3, Range r4, Range r5, Range r6, Range r7, Range r8) : Array(array, r0, r1, r2, r3, r4, r5, r6, r7, r8) - , initialized(true) { } + , initialized(true) + {} CArray(Array& array, Range r0, Range r1, Range r2, Range r3, Range r4, Range r5, Range r6, Range r7, Range r8, Range r9) : Array(array, r0, r1, r2, r3, r4, r5, r6, r7, r8, r9) - , initialized(true) { } + , initialized(true) + {} CArray(Array& array, Range r0, Range r1, Range r2, Range r3, Range r4, Range r5, Range r6, Range r7, Range r8, Range r9, Range r10) : Array(array, r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10) - , initialized(true) { } + , initialized(true) + {} CArray(Array& array, const RectDomain& subdomain) : Array(array, subdomain) - , initialized(true) { } + , initialized(true) + {} CArray(Array& array, const StridedDomain& subdomain) : Array(array, subdomain) - , initialized(true) { } + , initialized(true) + {} template CArray(Array& array, R0 r0, R1 r1, R2 r2, R3 r3, R4 r4, R5 r5, R6 r6, R7 r7, R8 r8, R9 r9, R10 r10) : Array(array, r0,r1, r2, r3, r4, r5, r6, r7, r8, r9, r10) , initialized(true) - { } + {} virtual ~CArray() {} @@ -507,9 +546,8 @@ namespace xios virtual void reset(void) { this->free(); initialized = false; } virtual bool isEmpty(void) const { return !initialized; } virtual size_t size(void) const { return size(this->numElements()); } - virtual std::vector getVector(void) { return vector(this->dataFirst(),this->dataFirst()+this->numElements()) ;} static size_t size(sizeType numElements) { return (N_rank + 1) * sizeof(int) + sizeof(size_t) + numElements * sizeof(T_numtype); } - + virtual CBaseType* clone(void) const { return new CArray(*this); } virtual bool toBuffer(CBufferOut& buffer) const @@ -539,11 +577,9 @@ namespace xios return ret; } - }; - #define macro(NRANK)\ \ template <>\ diff --git a/xios_2311_src/src/attribute.hpp b/xios_2311_src/src/attribute.hpp index a8d309a99f6c90441b8b047262af8d5b676c9e49..053de6cba851740c868f1833a51e372148bed3e1 100644 --- a/xios_2311_src/src/attribute.hpp +++ b/xios_2311_src/src/attribute.hpp @@ -41,7 +41,7 @@ namespace xios virtual StdString toString(void) const = 0; virtual void fromString(const StdString & str) = 0; virtual StdString dump(void) const = 0; - virtual StdString dumpGraph(void) const = 0; + virtual StdString dump4graph(void) const = 0; virtual bool isEqual(const CAttribute& ) = 0; //! Returns true if and only if the attribute should be publicly exposed in the API diff --git a/xios_2311_src/src/attribute_array.hpp b/xios_2311_src/src/attribute_array.hpp index c5b8fc6f60230948c6538d537bb674f4e6a0cde3..f4a02d4bcdc93dd0c2b17b44cd6b705b04b0a5a8 100644 --- a/xios_2311_src/src/attribute_array.hpp +++ b/xios_2311_src/src/attribute_array.hpp @@ -20,7 +20,8 @@ namespace xios class CAttributeArray : public CAttribute, public CArray { public : - using CArray::operator = ; + + using CArray::operator = ; /// Constructeurs /// explicit CAttributeArray(const StdString & id); @@ -54,7 +55,7 @@ namespace xios virtual bool toBuffer (CBufferOut& buffer) const { return _toBuffer(buffer);} virtual bool fromBuffer(CBufferIn& buffer) { return _fromBuffer(buffer); } virtual string dump(void) const { return _dump();} - virtual string dumpGraph(void) const { return _dumpGraph();} + virtual string dump4graph(void) const { return _dump4graph();} virtual void generateCInterface(ostream& oss,const string& className) ; virtual void generateFortran2003Interface(ostream& oss,const string& className) ; @@ -64,19 +65,17 @@ namespace xios virtual void generateFortranInterfaceGetDeclaration_(ostream& oss,const string& className) ; virtual void generateFortranInterfaceGetBody_(ostream& oss,const string& className) ; virtual void generateFortranInterfaceGetDeclaration(ostream& oss,const string& className) ; - + private : bool isEqual_(const CAttributeArray& attr); CArray inheritedValue ; StdString _toString(void) const; StdString _dump(void) const; - StdString _dumpGraph(void) const; + StdString _dump4graph(void) const; void _fromString(const StdString & str); bool _toBuffer (CBufferOut& buffer) const; bool _fromBuffer(CBufferIn& buffer) ; }; // class CAttributeEnum - - } // namespace xios #endif // __XIOS_ATTRIBUTE_ARRAY__ diff --git a/xios_2311_src/src/attribute_array_decl.cpp b/xios_2311_src/src/attribute_array_decl.cpp index 809301f51129a284cb0759ab1ff089a323b3fbd2..ec506be728203c086ff1b5f6fee4d40416048def 100644 --- a/xios_2311_src/src/attribute_array_decl.cpp +++ b/xios_2311_src/src/attribute_array_decl.cpp @@ -18,5 +18,4 @@ namespace xios template class CAttributeArray ; template class CAttributeArray ; template class CAttributeArray ; - } diff --git a/xios_2311_src/src/attribute_array_impl.hpp b/xios_2311_src/src/attribute_array_impl.hpp index 9b3a0740dab192792e92d2450add7a3fb18ced0a..a9e9328cd3dcdff15d3ab764b08ae7d0a47da61d 100644 --- a/xios_2311_src/src/attribute_array_impl.hpp +++ b/xios_2311_src/src/attribute_array_impl.hpp @@ -13,7 +13,7 @@ namespace xios template CAttributeArray::CAttributeArray(const StdString & id) : CAttribute(id) - { } + { /* Ne rien faire de plus */ } template CAttributeArray::CAttributeArray(const StdString & id, const CArray& value) @@ -112,9 +112,12 @@ namespace xios template bool CAttributeArray::isEqual_(const CAttributeArray& attr) { - if (this->isEmpty() && attr.isEmpty()) return true ; - if (!this->isEmpty() && !attr.isEmpty()) return (this->getValue() == attr.getValue()); - else return false; + if ((!this->hasInheritedValue() && !attr.hasInheritedValue())) + return true; + if (this->hasInheritedValue() && attr.hasInheritedValue()) + return (this->getInheritedValue() == attr.getInheritedValue()); + else + return false; } template @@ -133,9 +136,9 @@ namespace xios oss << this->getName() << "=\"" << CArray::dump() << "\""; return (oss.str()); } - + template - StdString CAttributeArray::_dumpGraph(void) const + StdString CAttributeArray::_dump4graph(void) const { StdOStringStream oss; if (! isEmpty() && this->hasId() && (this->numElements()!=0)) diff --git a/xios_2311_src/src/attribute_enum.hpp b/xios_2311_src/src/attribute_enum.hpp index 7afdaeb6a0430bcb62713d59be46d9a9144450a4..e0fb18de5f2461d94d70a4e6122a78c6a10c5577 100644 --- a/xios_2311_src/src/attribute_enum.hpp +++ b/xios_2311_src/src/attribute_enum.hpp @@ -62,7 +62,7 @@ namespace xios virtual StdString toString(void) const { return _toString();} virtual void fromString(const StdString & str) { if (str==resetInheritanceStr) { reset(); _canInherite=false ;} else _fromString(str);} virtual StdString dump(void) const { return _toString();} - virtual StdString dumpGraph(void) const { return _dumpGraph();} + virtual StdString dump4graph(void) const { return _dump4graph();} virtual bool toBuffer (CBufferOut& buffer) const { return _toBuffer(buffer);} virtual bool fromBuffer(CBufferIn& buffer) { return _fromBuffer(buffer); } @@ -79,11 +79,11 @@ namespace xios private : bool isEqual_(const CAttributeEnum& attr ); StdString _toString(void) const; + StdString _dump4graph(void) const; void _fromString(const StdString & str); bool _toBuffer (CBufferOut& buffer) const; bool _fromBuffer(CBufferIn& buffer) ; CEnum inheritedValue ; - StdString _dumpGraph(void) const; }; // class CAttributeEnum } // namespace xios diff --git a/xios_2311_src/src/attribute_enum_impl.hpp b/xios_2311_src/src/attribute_enum_impl.hpp index f9d32d907b646dd2b0fe46a3da195caf68c0cbd9..9a09755ac48adec0ea93b4a0bfca016541f0ba58 100644 --- a/xios_2311_src/src/attribute_enum_impl.hpp +++ b/xios_2311_src/src/attribute_enum_impl.hpp @@ -120,9 +120,12 @@ namespace xios template bool CAttributeEnum::isEqual_(const CAttributeEnum& attr) { - if (this->isEmpty() && attr.isEmpty()) return true ; - if (!this->isEmpty() && !attr.isEmpty()) return (this->getValue() == attr.getValue()); - else return false; + if ((!this->hasInheritedValue() && !attr.hasInheritedValue())) + return true; + if (this->hasInheritedValue() && attr.hasInheritedValue()) + return (this->getInheritedValue() == attr.getInheritedValue()); + else + return false; } //--------------------------------------------------------------- @@ -145,6 +148,15 @@ namespace xios return (oss.str()); } +template + StdString CAttributeEnum::_dump4graph(void) const + { + StdOStringStream oss; + if (!CEnum::isEmpty() && this->hasId()) + oss << this->getName() << "=" << CEnum::toString() << "
"; + return (oss.str()); + } + template void CAttributeEnum::_fromString(const StdString & str) { @@ -210,15 +222,6 @@ namespace xios { CInterface::AttributeFortranInterfaceGetDeclaration(oss, className, this->getName()); } - - template - StdString CAttributeEnum::_dumpGraph(void) const - { - StdOStringStream oss; - if (!CEnum::isEmpty() && this->hasId()) - oss << this->getName() << "=" << CEnum::toString() << "
"; - return (oss.str()); - } } // namespace xios #endif // __XIOS_ATTRIBUTE_ENUM_IMPL_HPP__ diff --git a/xios_2311_src/src/attribute_map.cpp b/xios_2311_src/src/attribute_map.cpp index 7df6015fb128f745e168b0cce62d99367a0c8273..9f3ed2fb8bdd2a8d76bf331d87036440d1825e84 100644 --- a/xios_2311_src/src/attribute_map.cpp +++ b/xios_2311_src/src/attribute_map.cpp @@ -58,12 +58,11 @@ namespace xios return str; } - ///-------------------------------------------------------------- - /*! - Record all non-empty attributes of an object (used only for field) for graph - */ - StdString CAttributeMap::recordXiosAttributes(void) const + + + StdString CAttributeMap::record4graphXiosAttributes(void) const { + int maxNbChar = 250; StdString str; typedef std::pair StdStrAttPair; auto it = SuperClassMap::begin(), end = SuperClassMap::end(); @@ -72,8 +71,15 @@ namespace xios const StdStrAttPair& att = *it; if (!att.second->isEmpty()) { - str.append(att.second->dumpGraph()); - str.append(" "); + if (str.length() < maxNbChar) + { + str.append(att.second->dump4graph()); + str.append(" "); + } + else if (str.length() == maxNbChar) + { + str.append("..."); + } } } return str; @@ -82,7 +88,7 @@ namespace xios //--------------------------------------------------------------- /* - Cleassr an attribute and reset its value + Clear an attribute and reset its value \param[in] key id of attribute */ void CAttributeMap::clearAttribute(const StdString& key) diff --git a/xios_2311_src/src/attribute_map.hpp b/xios_2311_src/src/attribute_map.hpp index 1bc07b8d3e2c96a0e536372ee6024f2347541c7b..9d5488063f58818619d3d56d34dffdbc56926b91 100644 --- a/xios_2311_src/src/attribute_map.hpp +++ b/xios_2311_src/src/attribute_map.hpp @@ -38,7 +38,7 @@ namespace xios void duplicateAttributes(const CAttributeMap* const _parent); void clearAllAttributes(void); StdString dumpXiosAttributes(void) const; - StdString recordXiosAttributes(void) const; + StdString record4graphXiosAttributes(void) const; void clearAttribute(const StdString& key); bool isEqual(const CAttributeMap& another, const vector& excludedAttrs); diff --git a/xios_2311_src/src/attribute_template.hpp b/xios_2311_src/src/attribute_template.hpp index a7b779f95180327734a75873363df4f2d2c93a08..aaab46006844052b9149fd741e4705824c6339bb 100644 --- a/xios_2311_src/src/attribute_template.hpp +++ b/xios_2311_src/src/attribute_template.hpp @@ -19,7 +19,7 @@ namespace xios \class CAttributeTemplate The class implements attribute of some basic types */ - template + template class CAttributeTemplate : public CAttribute, public CType { typedef CAttribute SuperClass; @@ -74,7 +74,7 @@ namespace xios // virtual void toBinary (StdOStream & os) const; // virtual void fromBinary(StdIStream & is); virtual StdString dump(void) const { return _dump();} - virtual StdString dumpGraph(void) const { return _dumpGraph();} + virtual StdString dump4graph(void) const { return _dump4graph();} virtual bool toBuffer (CBufferOut& buffer) const { return _toBuffer(buffer);} virtual bool fromBuffer(CBufferIn& buffer) { return _fromBuffer(buffer); } @@ -100,7 +100,7 @@ namespace xios bool isEqual_(const CAttributeTemplate& attr); StdString _toString(void) const; StdString _dump(void) const; - StdString _dumpGraph(void) const; + StdString _dump4graph(void) const; void _fromString(const StdString & str); bool _toBuffer (CBufferOut& buffer) const; bool _fromBuffer(CBufferIn& buffer) ; @@ -111,7 +111,6 @@ namespace xios template void FromBinary(StdIStream & is, T & obj); - } // namespace xios #endif // __XIOS_CAttributeTemplate__ diff --git a/xios_2311_src/src/attribute_template_decl.cpp b/xios_2311_src/src/attribute_template_decl.cpp index bfa909c983692c58af3c8330f433d06403e5b180..269c46d792d1fbbf5ada751a361b6338026df8b8 100644 --- a/xios_2311_src/src/attribute_template_decl.cpp +++ b/xios_2311_src/src/attribute_template_decl.cpp @@ -11,5 +11,4 @@ namespace xios template class CAttributeTemplate ; template class CAttributeTemplate ; template class CAttributeTemplate ; - } diff --git a/xios_2311_src/src/attribute_template_impl.hpp b/xios_2311_src/src/attribute_template_impl.hpp index bbd24292872779da20d92f37b9421f8732b7e482..cc27205ccf1d5ab64dd7eec65e382f2961b54b9f 100644 --- a/xios_2311_src/src/attribute_template_impl.hpp +++ b/xios_2311_src/src/attribute_template_impl.hpp @@ -164,9 +164,12 @@ namespace xios template bool CAttributeTemplate::isEqual_(const CAttributeTemplate& attr) { - if (this->isEmpty() && attr.isEmpty()) return true ; - if (!this->isEmpty() && !attr.isEmpty()) return (this->getValue() == attr.getValue()); - else return false; + if ((!this->hasInheritedValue() && !attr.hasInheritedValue())) + return true; + if (this->hasInheritedValue() && attr.hasInheritedValue()) + return (this->getInheritedValue() == attr.getInheritedValue()); + else + return false; } //--------------------------------------------------------------- @@ -206,9 +209,9 @@ namespace xios oss << this->getName() << "=\"" << CType::dump() << "\""; return (oss.str()); } - + template - StdString CAttributeTemplate::_dumpGraph(void) const + StdString CAttributeTemplate::_dump4graph(void) const { StdOStringStream oss; if (!CType::isEmpty() && this->hasId()) diff --git a/xios_2311_src/src/buffer_client.cpp b/xios_2311_src/src/buffer_client.cpp index f9793dccf5e25f55b0c0934c3424d74246cffbdc..bb07552f5507c9107950a00b3357f1b4baf361dc 100644 --- a/xios_2311_src/src/buffer_client.cpp +++ b/xios_2311_src/src/buffer_client.cpp @@ -6,158 +6,34 @@ #include "cxios.hpp" #include "mpi.hpp" #include "tracer.hpp" -#include "timeline_events.hpp" -#include "timer.hpp" namespace xios { size_t CClientBuffer::maxRequestSize = 0; - CClientBuffer::CClientBuffer(MPI_Comm interComm, int serverRank, StdSize bufferSize, StdSize estimatedMaxEventSize) + CClientBuffer::CClientBuffer(MPI_Comm interComm, int serverRank, StdSize bufferSize, StdSize estimatedMaxEventSize, StdSize maxBufferedEvents) : interComm(interComm) - , clientRank_(0) , serverRank(serverRank) , bufferSize(bufferSize) , estimatedMaxEventSize(estimatedMaxEventSize) , maxEventSize(0) , current(0) , count(0) + , bufferedEvents(0) + , maxBufferedEvents(maxBufferedEvents) , pending(false) - , hasWindows(false) { - /* - if (windows[0]==MPI_WIN_NULL && windows[1]==MPI_WIN_NULL) hasWindows=false ; - else hasWindows=true ; - */ - - MPI_Alloc_mem(bufferSize+headerSize_, MPI_INFO_NULL, &bufferHeader[0]) ; - MPI_Alloc_mem(bufferSize+headerSize_, MPI_INFO_NULL, &bufferHeader[1]) ; - buffer[0] = bufferHeader[0]+headerSize_ ; - buffer[1] = bufferHeader[1]+headerSize_ ; - firstTimeLine[0]=(size_t*)bufferHeader[0] + timeLineOffset_ ; - firstTimeLine[1]=(size_t*)bufferHeader[1] + timeLineOffset_ ; - bufferCount[0]=(size_t*)bufferHeader[0] + countOffset_ ; - bufferCount[1]=(size_t*)bufferHeader[1] + countOffset_ ; - control[0]=(size_t*)bufferHeader[0] + controlOffset_ ; - control[1]=(size_t*)bufferHeader[1] + controlOffset_ ; - notify[0]=(size_t*)bufferHeader[0] + notifyOffset_ ; - notify[1]=(size_t*)bufferHeader[1] + notifyOffset_ ; - - *firstTimeLine[0]=0 ; - *firstTimeLine[1]=0 ; - *bufferCount[0]=0 ; - *bufferCount[1]=0 ; - *control[0]=0 ; - *control[1]=0 ; - *notify[0]=notifyNothing_ ; - *notify[1]=notifyNothing_ ; - winState[0]=false ; - winState[1]=false ; - - - if (hasWindows) - { - - MPI_Aint buffSize=bufferSize+headerSize_ ; - MPI_Win_attach(windows_[0], bufferHeader[0], buffSize) ; - MPI_Win_attach(windows_[1], bufferHeader[1], buffSize) ; - - MPI_Group group ; - int groupSize,groupRank ; - MPI_Win_get_group(windows_[0], &group) ; - MPI_Group_size(group, &groupSize) ; - MPI_Group_rank(group, &groupRank) ; - if (groupRank!=clientRank_) ERROR("CClientBuffer::CClientBuffer",<< " ClientRank != groupRank "<& windows) - { - windows_=windows ; - if (windows_[0]==MPI_WIN_NULL && windows_[1]==MPI_WIN_NULL) hasWindows=false ; - else hasWindows=true ; - - if (hasWindows) - { - MPI_Aint buffSize=bufferSize+headerSize_ ; - MPI_Win_attach(windows_[0], bufferHeader[0], buffSize) ; - MPI_Win_attach(windows_[1], bufferHeader[1], buffSize) ; - - MPI_Group group ; - int groupSize,groupRank ; - MPI_Win_get_group(windows_[0], &group) ; - MPI_Group_size(group, &groupSize) ; - MPI_Group_rank(group, &groupRank) ; - if (groupRank!=clientRank_) ERROR("CClientBuffer::CClientBuffer",<< " ClientRank != groupRank "< 0 ) return false ; - if (size > bufferSize) - { - resizingBufferStep_=1 ; - *firstTimeLine[current]=0 ; - newBufferSize_=size ; - return false ; - } + ERROR("bool CClientBuffer::isBufferFree(StdSize size)", + << "The requested size (" << size << " bytes) is too big to fit the buffer (" << bufferSize << " bytes), please increase the client buffer size." << endl); if (size > maxEventSize) { @@ -191,29 +57,19 @@ namespace xios if (size > maxRequestSize) maxRequestSize = size; } - - if (size > remain()) - { - if (isGrowableBuffer_) - { - resizingBufferStep_ = 1 ; - *firstTimeLine[current]=0 ; - newBufferSize_ = (count+size)*growFactor_ ; - } - return false ; - } - else return true ; + + + return (size <= remain() && bufferedEvents < maxBufferedEvents); } - CBufferOut* CClientBuffer::getBuffer(size_t timeLine, StdSize size) + CBufferOut* CClientBuffer::getBuffer(StdSize size) { if (size <= remain()) { retBuffer->realloc(buffer[current] + count, size); count += size; - if (*firstTimeLine[current]==0) *firstTimeLine[current]=timeLine ; - *bufferCount[current]=count ; + bufferedEvents++; return retBuffer; } else @@ -224,31 +80,11 @@ namespace xios } } - void CClientBuffer::infoBuffer(void) - { - - char checksum=0 ; - for(size_t i=0;i<*bufferCount[current];i++) checksum=checksum+buffer[current][i] ; - - char checksumFirst=0 ; - for(size_t i=5; i<10 && i<*bufferCount[current] ;i++) checksumFirst=checksumFirst+buffer[current][i] ; - - char checksumLast=0 ; - for(size_t i=(*bufferCount[current]<10)?0:*bufferCount[current]-10; i<*bufferCount[current] ; i++) checksumLast=checksumLast+buffer[current][i] ; - - info(45)<<"CClientBuffer::infoBuffer "<<" clientRank_ "< 0) { - double time=MPI_Wtime() ; - if (time - lastCheckedWithNothing_ > latency_) - { - lockBuffer() ; - if (*bufferCount[current] > 0) - { - MPI_Issend(buffer[current], count, MPI_CHAR, serverRank, 20, interComm, &request); - if (resizingBufferStep_==4) resizingBufferStep_=0 ; - pending = true; - *firstTimeLine[current]=0 ; - *bufferCount[current]=0 ; - - unlockBuffer() ; - - if (current == 1) current = 0; - else current = 1; - count = 0; - } - else - { - unlockBuffer() ; - lastCheckedWithNothing_ = time ; - } - } - } - else - { - if (resizingBufferStep_==1) resizeBufferNotify() ; - else if (resizingBufferStep_==2) isNotifiedChangeBufferSize() ; - else if (resizingBufferStep_==3) resizeBuffer(newBufferSize_) ; + MPI_Issend(buffer[current], count, MPI_CHAR, serverRank, 20, interComm, &request); + pending = true; + if (current == 1) current = 0; + else current = 1; + count = 0; + bufferedEvents = 0; } } return pending; } - void CClientBuffer::resizeBufferNotify(void) - { - // notify server of changing buffers size - lockBuffer() ; - int size=sizeof(int)+sizeof(size_t) ; - CBufferOut* bufOut = this->getBuffer(timelineEventNotifyChangeBufferSize, size); - bufOut->put(size); - bufOut->put(timelineEventNotifyChangeBufferSize); - resizingBufferStep_ = 2 ; - unlockBuffer() ; - } - - void CClientBuffer::resizeBuffer(size_t newSize) - { - - if (hasWindows) - { - MPI_Win_detach(windows_[0], bufferHeader[0]) ; - MPI_Win_detach(windows_[1], bufferHeader[1]) ; - } - MPI_Free_mem(bufferHeader[0]) ; - MPI_Free_mem(bufferHeader[1]) ; - - bufferSize=newSize ; - MPI_Alloc_mem(bufferSize+headerSize_, MPI_INFO_NULL, &bufferHeader[0]) ; - MPI_Alloc_mem(bufferSize+headerSize_, MPI_INFO_NULL, &bufferHeader[1]) ; - buffer[0] = bufferHeader[0]+headerSize_ ; - buffer[1] = bufferHeader[1]+headerSize_ ; - firstTimeLine[0]=(size_t*)bufferHeader[0] + timeLineOffset_; - firstTimeLine[1]=(size_t*)bufferHeader[1] + timeLineOffset_; - bufferCount[0]=(size_t*)bufferHeader[0] + countOffset_ ; - bufferCount[1]=(size_t*)bufferHeader[1] + countOffset_ ; - control[0]=(size_t*)bufferHeader[0] + controlOffset_ ; // control=0 => nothing ; control=1 => changeBufferSize - control[1]=(size_t*)bufferHeader[1] + controlOffset_ ; - notify[0]=(size_t*)bufferHeader[0] + notifyOffset_ ; - notify[1]=(size_t*)bufferHeader[1] + notifyOffset_ ; - - *firstTimeLine[0]=0 ; - *firstTimeLine[1]=0 ; - *bufferCount[0]=0 ; - *bufferCount[1]=0 ; - *control[0]=0 ; - *control[1]=0 ; - *notify[0] = notifyNothing_ ; - *notify[1] = notifyNothing_ ; - winState[0]=false ; - winState[1]=false ; - current=0 ; - - if (hasWindows) - { - - MPI_Win_attach(windows_[0], bufferHeader[0], bufferSize+headerSize_) ; - MPI_Win_attach(windows_[1], bufferHeader[1], bufferSize+headerSize_) ; - - MPI_Win_lock(MPI_LOCK_EXCLUSIVE, clientRank_, 0, windows_[0]) ; - MPI_Win_lock(MPI_LOCK_EXCLUSIVE, clientRank_, 0, windows_[1]) ; - - MPI_Win_unlock(clientRank_, windows_[1]) ; - MPI_Win_unlock(clientRank_, windows_[0]) ; - } - - lockBuffer() ; - - int size=sizeof(int)+2*sizeof(size_t)+2*sizeof(MPI_Aint) ; - CBufferOut* bufOut = this->getBuffer(timelineEventChangeBufferSize, size); - bufOut->put(size); - bufOut->put(timelineEventChangeBufferSize); - bufOut->put(newBufferSize_); - bufOut->put(this->getWinAddress(0)); - bufOut->put(this->getWinAddress(1)); - - resizingBufferStep_=4; - unlockBuffer() ; - info(100)<<"CClientBuffer::resizeBuffer(size_t newSize) : resizing buffer of server "<getWinAddress(0)<<" winAdress[1] "<getWinAddress(1)< 0); } - - bool CClientBuffer::isNotifiedChangeBufferSize(void) - { - - bool ret ; - lockBuffer() ; - ret=*notify[current] == notifyResizeBuffer_ ? true : false ; - if (ret || !hasWindows) - { - *notify[current] = notifyNothing_ ; - resizingBufferStep_=3; - } - unlockBuffer() ; - - return ret; - } - - bool CClientBuffer::isNotifiedFinalized(void) - { - if (!isFinalized_) - { - double time=MPI_Wtime() ; -// if (time - lastCheckedNotify_ > latency_) - { - int flag ; - MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &flag, MPI_STATUS_IGNORE); - lockBuffer() ; - isFinalized_=*notify[current] == notifyFinalize_ ? true : false ; - unlockBuffer() ; - lastCheckedNotify_=time ; - } - } - return isFinalized_ ; - } - } diff --git a/xios_2311_src/src/buffer_client.hpp b/xios_2311_src/src/buffer_client.hpp index 7bd74b356c8a0a9e1846564a14dffe6eb4c92f1b..c32432f45053a7ad245ff356354f4a4efb94e408 100644 --- a/xios_2311_src/src/buffer_client.hpp +++ b/xios_2311_src/src/buffer_client.hpp @@ -1,7 +1,6 @@ #ifndef __BUFFER_CLIENT_HPP__ #define __BUFFER_CLIENT_HPP__ -#include "buffer_cs_base.hpp" #include "xios_spl.hpp" #include "buffer_out.hpp" #include "mpi.hpp" @@ -9,70 +8,40 @@ namespace xios { - class CClientBuffer : public CBufferClientServerBase + class CClientBuffer { public: static size_t maxRequestSize; - CClientBuffer(MPI_Comm intercomm, int serverRank, StdSize bufferSize, StdSize estimatedMaxEventSize); + CClientBuffer(MPI_Comm intercomm, int serverRank, StdSize bufferSize, StdSize estimatedMaxEventSize, StdSize maxBufferedEvents); ~CClientBuffer(); -// void createWindows(MPI_Comm oneSidedComm) ; - void freeWindows(void) ; - void lockBuffer(void) ; - void unlockBuffer(void) ; - + bool isBufferFree(StdSize size); - CBufferOut* getBuffer(size_t timeLine, StdSize size); - bool checkBuffer(bool send=false); + CBufferOut* getBuffer(StdSize size); + bool checkBuffer(void); bool hasPendingRequest(void); StdSize remain(void); - MPI_Aint getWinAddress(int numWindows) ; - void infoBuffer(void) ; - bool isNotifiedFinalized(void) ; - void setGrowableBuffer(double growFactor) { growFactor_=growFactor ; isGrowableBuffer_=true ;} - void fixBufferSize(size_t bufferSize) { newBufferSize_=bufferSize ; isGrowableBuffer_=false ; resizingBufferStep_=1 ;} - void fixBuffer(void) { isGrowableBuffer_=false ;} - void attachWindows(vector& windows) ; - private: - void resizeBuffer(size_t newSize) ; - void resizeBufferNotify(void) ; - bool isNotifiedChangeBufferSize(void) ; - + private: char* buffer[2]; - char* bufferHeader[2]; - size_t* firstTimeLine[2] ; - size_t* bufferCount[2] ; - size_t* control[2] ; - size_t* notify[2] ; - bool winState[2] ; + int current; - - double growFactor_=1.2 ; - bool isGrowableBuffer_=true ; - int resizingBufferStep_ = 0 ; - size_t newBufferSize_ ; StdSize count; + StdSize bufferedEvents; StdSize maxEventSize; - StdSize bufferSize; + const StdSize maxBufferedEvents; + const StdSize bufferSize; const StdSize estimatedMaxEventSize; - bool isFinalized_=false ; + const int serverRank; - const int clientRank_; bool pending; MPI_Request request; CBufferOut* retBuffer; const MPI_Comm interComm; - std::vector windows_ ; - bool hasWindows ; - - double latency_=0 ; - double lastCheckedWithNothing_=0 ; - double lastCheckedNotify_=0 ; }; } #endif diff --git a/xios_2311_src/src/buffer_cs_base.hpp b/xios_2311_src/src/buffer_cs_base.hpp deleted file mode 100755 index c99e00a414dd06610decd186a9af01021e10f544..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/buffer_cs_base.hpp +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef __BUFFER_CS_BASE_HPP__ -#define __BUFFER_CS_BASE_HPP__ - -namespace xios -{ - class CBufferClientServerBase - { - protected: - - static const int headerSize_= 4*sizeof(size_t); - static const int timeLineOffset_ = 0 ; // in size_t - static const int countOffset_ = 1 ; // in size_t - static const int controlOffset_ = 2 ; // in size_t - static const int notifyOffset_ = 3 ; // in size_t - - static const int notifyNothing_ = 0 ; - static const int notifyFinalize_ = 1 ; - static const int notifyResizeBuffer_ = 2 ; - - } ; - -} - -#endif \ No newline at end of file diff --git a/xios_2311_src/src/buffer_decl.cpp b/xios_2311_src/src/buffer_decl.cpp index 0f6607ea5d62599a4e66e37d767eb59c9c08e49a..bf811b24a7efe0222c71d36f5b39f0c9bdba9b76 100644 --- a/xios_2311_src/src/buffer_decl.cpp +++ b/xios_2311_src/src/buffer_decl.cpp @@ -16,11 +16,9 @@ namespace xios macro(int) macro(short) macro(long) - macro(longlong) macro(uint) macro(ushort) macro(ulong) - macro(ulonglong) macro(float) macro(double) macro(long double) diff --git a/xios_2311_src/src/buffer_impl.hpp b/xios_2311_src/src/buffer_impl.hpp index 7179b6a4c2d11c18ea59151f8b06f005505db4fe..bcaa03ca08324ed516c1a351599d608e845deea6 100644 --- a/xios_2311_src/src/buffer_impl.hpp +++ b/xios_2311_src/src/buffer_impl.hpp @@ -9,11 +9,9 @@ namespace xios template <> bool CBuffer::put(const int& data) { return put_template(data) ; } template <> bool CBuffer::put(const short& data) { return put_template(data) ; } template <> bool CBuffer::put(const long& data) { return put_template(data) ; } - template <> bool CBuffer::put(const longlong& data) { return put_template(data) ; } template <> bool CBuffer::put(const uint& data) { return put_template(data) ; } template <> bool CBuffer::put(const ushort& data) { return put_template(data) ; } template <> bool CBuffer::put(const ulong& data) { return put_template(data) ; } - template <> bool CBuffer::put(const ulonglong& data) { return put_template(data) ; } template <> bool CBuffer::put(const float& data) { return put_template(data) ; } template <> bool CBuffer::put(const double& data) { return put_template(data) ; } template <> bool CBuffer::put(const long double& data) { return put_template(data) ;} @@ -22,11 +20,9 @@ namespace xios template <> bool CBuffer::put(const int* data, size_t n) { return put_template(data,n) ; } template <> bool CBuffer::put(const short* data, size_t n) { return put_template(data,n) ; } template <> bool CBuffer::put(const long* data, size_t n) { return put_template(data,n) ; } - template <> bool CBuffer::put(const longlong* data, size_t n) { return put_template(data,n) ; } template <> bool CBuffer::put(const uint* data, size_t n) { return put_template(data,n) ; } template <> bool CBuffer::put(const ushort* data, size_t n) { return put_template(data,n) ; } template <> bool CBuffer::put(const ulong* data, size_t n) { return put_template(data,n) ; } - template <> bool CBuffer::put(const ulonglong* data, size_t n) { return put_template(data,n) ; } template <> bool CBuffer::put(const float* data, size_t n) { return put_template(data,n) ; } template <> bool CBuffer::put(const double* data, size_t n) { return put_template(data,n) ; } template <> bool CBuffer::put(const long double* data, size_t n) { return put_template(data,n) ;} @@ -36,11 +32,9 @@ namespace xios template <> bool CBuffer::put_ptr(const int*& data, size_t n) { return put_ptr_template(data,n) ; } template <> bool CBuffer::put_ptr(const short*& data, size_t n) { return put_ptr_template(data,n) ; } template <> bool CBuffer::put_ptr(const long*& data, size_t n) { return put_ptr_template(data,n) ; } - template <> bool CBuffer::put_ptr(const longlong*& data, size_t n) { return put_ptr_template(data,n) ; } template <> bool CBuffer::put_ptr(const uint*& data, size_t n) { return put_ptr_template(data,n) ; } template <> bool CBuffer::put_ptr(const ushort*& data, size_t n) { return put_ptr_template(data,n) ; } template <> bool CBuffer::put_ptr(const ulong*& data, size_t n) { return put_ptr_template(data,n) ; } - template <> bool CBuffer::put_ptr(const ulonglong*& data, size_t n) { return put_ptr_template(data,n) ; } template <> bool CBuffer::put_ptr(const float*& data, size_t n) { return put_ptr_template(data,n) ; } template <> bool CBuffer::put_ptr(const double*& data, size_t n) { return put_ptr_template(data,n) ; } template <> bool CBuffer::put_ptr(const long double*& data, size_t n) { return put_ptr_template(data,n) ;} @@ -51,11 +45,9 @@ namespace xios template <> bool CBuffer::get(int& data) { return get_template(data) ; } template <> bool CBuffer::get(short& data) { return get_template(data) ; } template <> bool CBuffer::get(long& data) { return get_template(data) ; } - template <> bool CBuffer::get(longlong& data) { return get_template(data) ; } template <> bool CBuffer::get(uint& data) { return get_template(data) ; } template <> bool CBuffer::get(ushort& data) { return get_template(data) ; } template <> bool CBuffer::get(ulong& data) { return get_template(data) ; } - template <> bool CBuffer::get(ulonglong& data) { return get_template(data) ; } template <> bool CBuffer::get(float& data) { return get_template(data) ; } template <> bool CBuffer::get(double& data) { return get_template(data) ; } template <> bool CBuffer::get(long double& data) { return get_template(data) ;} @@ -64,11 +56,9 @@ namespace xios template <> bool CBuffer::get(int* data, size_t n) { return get_template(data,n) ; } template <> bool CBuffer::get(short* data, size_t n) { return get_template(data,n) ; } template <> bool CBuffer::get(long* data, size_t n) { return get_template(data,n) ; } - template <> bool CBuffer::get(longlong* data, size_t n) { return get_template(data,n) ; } template <> bool CBuffer::get(uint* data, size_t n) { return get_template(data,n) ; } template <> bool CBuffer::get(ushort* data, size_t n) { return get_template(data,n) ; } template <> bool CBuffer::get(ulong* data, size_t n) { return get_template(data,n) ; } - template <> bool CBuffer::get(ulonglong* data, size_t n) { return get_template(data,n) ; } template <> bool CBuffer::get(float* data, size_t n) { return get_template(data,n) ; } template <> bool CBuffer::get(double* data, size_t n) { return get_template(data,n) ; } template <> bool CBuffer::get(long double* data, size_t n) { return get_template(data,n) ;} @@ -77,11 +67,9 @@ namespace xios template <> bool CBuffer::get_ptr(int*& data, size_t n) { return get_ptr_template(data,n) ; } template <> bool CBuffer::get_ptr(short*& data, size_t n) { return get_ptr_template(data,n) ; } template <> bool CBuffer::get_ptr(long*& data, size_t n) { return get_ptr_template(data,n) ; } - template <> bool CBuffer::get_ptr(longlong*& data, size_t n) { return get_ptr_template(data,n) ; } template <> bool CBuffer::get_ptr(uint*& data, size_t n) { return get_ptr_template(data,n) ; } template <> bool CBuffer::get_ptr(ushort*& data, size_t n) { return get_ptr_template(data,n) ; } template <> bool CBuffer::get_ptr(ulong*& data, size_t n) { return get_ptr_template(data,n) ; } - template <> bool CBuffer::get_ptr(ulonglong*& data, size_t n) { return get_ptr_template(data,n) ; } template <> bool CBuffer::get_ptr(float*& data, size_t n) { return get_ptr_template(data,n) ; } template <> bool CBuffer::get_ptr(double*& data, size_t n) { return get_ptr_template(data,n) ; } template <> bool CBuffer::get_ptr(long double*& data, size_t n) { return get_ptr_template(data,n) ;} diff --git a/xios_2311_src/src/buffer_in_decl.cpp b/xios_2311_src/src/buffer_in_decl.cpp index 9c0fc8217bd29fa84c36ddd64c9676de94e53cd9..d23748800bf310053d95357946df382c304ef579 100644 --- a/xios_2311_src/src/buffer_in_decl.cpp +++ b/xios_2311_src/src/buffer_in_decl.cpp @@ -13,11 +13,9 @@ namespace xios macro(int) macro(short) macro(long) - macro(longlong) macro(uint) macro(ushort) macro(ulong) - macro(ulonglong) macro(float) macro(double) macro(long double) diff --git a/xios_2311_src/src/buffer_in_impl.hpp b/xios_2311_src/src/buffer_in_impl.hpp index d2af4ecf34f04d18b451cec4066dfae71a5919a8..ff8ec8ce7b2c9c2bea5b3e8ff690d9352fd59842 100644 --- a/xios_2311_src/src/buffer_in_impl.hpp +++ b/xios_2311_src/src/buffer_in_impl.hpp @@ -11,11 +11,9 @@ namespace xios template <> bool CBufferIn::get(int& data) { return get_template(data) ; } template <> bool CBufferIn::get(short& data) { return get_template(data) ; } template <> bool CBufferIn::get(long& data) { return get_template(data) ; } - template <> bool CBufferIn::get(longlong& data) { return get_template(data) ; } template <> bool CBufferIn::get(uint& data) { return get_template(data) ; } template <> bool CBufferIn::get(ushort& data) { return get_template(data) ; } template <> bool CBufferIn::get(ulong& data) { return get_template(data) ; } - template <> bool CBufferIn::get(ulonglong& data) { return get_template(data) ; } template <> bool CBufferIn::get(float& data) { return get_template(data) ; } template <> bool CBufferIn::get(double& data) { return get_template(data) ; } template <> bool CBufferIn::get(long double& data) { return get_template(data) ;} @@ -25,11 +23,9 @@ namespace xios template <> bool CBufferIn::get(int* data, size_t n) { return get_template(data,n) ; } template <> bool CBufferIn::get(short* data, size_t n) { return get_template(data,n) ; } template <> bool CBufferIn::get(long* data, size_t n) { return get_template(data,n) ; } - template <> bool CBufferIn::get(longlong* data, size_t n) { return get_template(data,n) ; } template <> bool CBufferIn::get(uint* data, size_t n) { return get_template(data,n) ; } template <> bool CBufferIn::get(ushort* data, size_t n) { return get_template(data,n) ; } template <> bool CBufferIn::get(ulong* data, size_t n) { return get_template(data,n) ; } - template <> bool CBufferIn::get(ulonglong* data, size_t n) { return get_template(data,n) ; } template <> bool CBufferIn::get(float* data, size_t n) { return get_template(data,n) ; } template <> bool CBufferIn::get(double* data, size_t n) { return get_template(data,n) ; } template <> bool CBufferIn::get(long double* data, size_t n) { return get_template(data,n) ;} @@ -39,11 +35,9 @@ namespace xios template <> bool CBufferIn::advance(size_t n) { return advance_template(n) ; } template <> bool CBufferIn::advance(size_t n) { return advance_template(n) ; } template <> bool CBufferIn::advance(size_t n) { return advance_template(n) ; } - template <> bool CBufferIn::advance(size_t n) { return advance_template(n) ; } template <> bool CBufferIn::advance(size_t n) { return advance_template(n) ; } template <> bool CBufferIn::advance(size_t n) { return advance_template(n) ; } template <> bool CBufferIn::advance(size_t n) { return advance_template(n) ; } - template <> bool CBufferIn::advance(size_t n) { return advance_template(n) ; } template <> bool CBufferIn::advance(size_t n) { return advance_template(n) ; } template <> bool CBufferIn::advance(size_t n) { return advance_template(n) ; } template <> bool CBufferIn::advance(size_t n) { return advance_template(n) ;} diff --git a/xios_2311_src/src/buffer_out_decl.cpp b/xios_2311_src/src/buffer_out_decl.cpp index 4fd900f3a2dc52a9590e6673256ea7f6748ffb41..6621dd4b19bedaca42aaaa801dc11b8a5061a7db 100644 --- a/xios_2311_src/src/buffer_out_decl.cpp +++ b/xios_2311_src/src/buffer_out_decl.cpp @@ -14,11 +14,9 @@ namespace xios macro(int) macro(short) macro(long) - macro(longlong) macro(uint) macro(ushort) macro(ulong) - macro(ulonglong) macro(float) macro(double) macro(long double) diff --git a/xios_2311_src/src/buffer_out_impl.hpp b/xios_2311_src/src/buffer_out_impl.hpp index 90aa6b0ebb5adcd9b10431830570bf2df916db3a..a1d3a6566cf64572fdccb0c6c85a68a7adfd62be 100644 --- a/xios_2311_src/src/buffer_out_impl.hpp +++ b/xios_2311_src/src/buffer_out_impl.hpp @@ -10,11 +10,9 @@ namespace xios template <> bool CBufferOut::put(const int& data) { return put_template(data) ; } template <> bool CBufferOut::put(const short& data) { return put_template(data) ; } template <> bool CBufferOut::put(const long& data) { return put_template(data) ; } - template <> bool CBufferOut::put(const longlong& data) { return put_template(data) ; } template <> bool CBufferOut::put(const uint& data) { return put_template(data) ; } template <> bool CBufferOut::put(const ushort& data) { return put_template(data) ; } template <> bool CBufferOut::put(const ulong& data) { return put_template(data) ; } - template <> bool CBufferOut::put(const ulonglong& data) { return put_template(data) ; } template <> bool CBufferOut::put(const float& data) { return put_template(data) ; } template <> bool CBufferOut::put(const double& data) { return put_template(data) ; } template <> bool CBufferOut::put(const long double& data) { return put_template(data) ;} @@ -24,11 +22,9 @@ namespace xios template <> bool CBufferOut::put(const int* data, size_t n) { return put_template(data,n) ; } template <> bool CBufferOut::put(const short* data, size_t n) { return put_template(data,n) ; } template <> bool CBufferOut::put(const long* data, size_t n) { return put_template(data,n) ; } - template <> bool CBufferOut::put(const longlong* data, size_t n) { return put_template(data,n) ; } template <> bool CBufferOut::put(const uint* data, size_t n) { return put_template(data,n) ; } template <> bool CBufferOut::put(const ushort* data, size_t n) { return put_template(data,n) ; } template <> bool CBufferOut::put(const ulong* data, size_t n) { return put_template(data,n) ; } - template <> bool CBufferOut::put(const ulonglong* data, size_t n) { return put_template(data,n) ; } template <> bool CBufferOut::put(const float* data, size_t n) { return put_template(data,n) ; } template <> bool CBufferOut::put(const double* data, size_t n) { return put_template(data,n) ; } template <> bool CBufferOut::put(const long double* data, size_t n) { return put_template(data,n) ;} @@ -39,11 +35,9 @@ namespace xios template <> bool CBufferOut::advance(size_t n) { return advance_template(n) ; } template <> bool CBufferOut::advance(size_t n) { return advance_template(n) ; } template <> bool CBufferOut::advance(size_t n) { return advance_template(n) ; } - template <> bool CBufferOut::advance(size_t n) { return advance_template(n) ; } template <> bool CBufferOut::advance(size_t n) { return advance_template(n) ; } template <> bool CBufferOut::advance(size_t n) { return advance_template(n) ; } template <> bool CBufferOut::advance(size_t n) { return advance_template(n) ; } - template <> bool CBufferOut::advance(size_t n) { return advance_template(n) ; } template <> bool CBufferOut::advance(size_t n) { return advance_template(n) ; } template <> bool CBufferOut::advance(size_t n) { return advance_template(n) ; } template <> bool CBufferOut::advance(size_t n) { return advance_template(n) ;} diff --git a/xios_2311_src/src/buffer_server.cpp b/xios_2311_src/src/buffer_server.cpp index 568857209ee41720d2dc005f92e21cf672eee255..78874fb3d2c2a2e036aaabb3e58d3b3d1097a740 100644 --- a/xios_2311_src/src/buffer_server.cpp +++ b/xios_2311_src/src/buffer_server.cpp @@ -1,34 +1,23 @@ #include "xios_spl.hpp" #include "exception.hpp" #include "buffer_server.hpp" -#include "timer.hpp" namespace xios { - CServerBuffer::CServerBuffer(vector& windows, vector& winAddress, int windowsRank, StdSize buffSize) - : hasWindows(true), windows_(windows), windowsRank_(windowsRank), winAddress_(winAddress) + CServerBuffer::CServerBuffer(StdSize buffSize) { size = 3 * buffSize; first = 0; current = 1; end = size; - used=0 ; - MPI_Alloc_mem(size, MPI_INFO_NULL, &buffer) ; - currentWindows=1 ; - if (windows[0]==MPI_WIN_NULL && windows[1]==MPI_WIN_NULL) hasWindows=false ; + buffer = new char[size]; // use MPI_ALLOC_MEM later? } CServerBuffer::~CServerBuffer() { - MPI_Free_mem(buffer) ; - } - - void CServerBuffer::updateCurrentWindows(void) - { - if (currentWindows==0) currentWindows=1 ; - else currentWindows=0 ; + delete [] buffer ; } @@ -82,11 +71,6 @@ namespace xios return ret ; } - bool CServerBuffer::isBufferEmpty(void) - { - if (used==0) return true ; - else return false; - } void* CServerBuffer::getBuffer(size_t count) { @@ -143,7 +127,6 @@ namespace xios } } - used+=count ; return ret ; } @@ -155,7 +138,6 @@ namespace xios { first=0 ; count-- ; - used-- ; end=size ; } @@ -184,146 +166,6 @@ namespace xios <<"cannot free required size in buffer") ; } } - used-=count ; } - void CServerBuffer::popBuffer(size_t count) - { - if (count==0) return ; - - if (current==0) - { - current = end ; - end=size ; - } - - - if (first<=current) - { - if (current-count >first) - { - current-=count ; - } - else - { - ERROR("void CServerBuffer::popBuffer(size_t count)", - <<"cannot pop required size in buffer") ; - } - - } - else - { - if (current-count>=0) - { - current-=count ; - } - else - { - ERROR("void CServerBuffer::freeBuffer(size_t count)", - <<"cannot pop required size in buffer") ; - } - } - used-=count ; - } - - bool CServerBuffer::getBufferFromClient(size_t timeLine, char*& buffer, size_t& count) - { - count = -1 ; - if (!hasWindows || resizingBuffer_) return false ; - double time=MPI_Wtime() ; - if (time-bufferFromClientTime_ < bufferFromClientLatency_ ) return false; - bufferFromClientTime_ = time ; - CTimer::get("getBufferFromClient").resume() ; - size_t clientTimeline ; - size_t clientCount ; - bool ok=false ; - - MPI_Group group ; - int groupSize,groupRank ; - MPI_Win_get_group(windows_[currentWindows], &group) ; - MPI_Group_size(group, &groupSize) ; - MPI_Group_rank(group, &groupRank) ; - - lockBuffer(); - CTimer::get("getBufferFromClient_locked").resume() ; -// lock is acquired - - MPI_Get(&clientTimeline, 1, MPI_LONG_LONG_INT, windowsRank_ , MPI_Aint_add(winAddress_[currentWindows],timeLineOffset_*sizeof(size_t)), 1, MPI_LONG_LONG_INT,windows_[currentWindows]) ; - MPI_Get(&clientCount, 1, MPI_LONG_LONG_INT, windowsRank_ , MPI_Aint_add(winAddress_[currentWindows],countOffset_*sizeof(size_t)), 1, MPI_LONG_LONG_INT,windows_[currentWindows]) ; - MPI_Win_flush(windowsRank_, windows_[currentWindows]) ; - - if (timeLine==clientTimeline) - { - buffer=(char*)getBuffer(clientCount) ; - count=clientCount ; - MPI_Get(buffer, clientCount, MPI_CHAR, windowsRank_, MPI_Aint_add(winAddress_[currentWindows],4*sizeof(size_t)) , clientCount, MPI_CHAR, windows_[currentWindows]) ; - clientTimeline = 0 ; - clientCount = 0 ; - MPI_Put(&clientTimeline, 1, MPI_LONG_LONG_INT, windowsRank_ , MPI_Aint_add(winAddress_[currentWindows],timeLineOffset_*sizeof(size_t)), 1, MPI_LONG_LONG_INT,windows_[currentWindows]) ; - MPI_Put(&clientCount, 1, MPI_LONG_LONG_INT, windowsRank_ , MPI_Aint_add(winAddress_[currentWindows],countOffset_*sizeof(size_t)), 1, MPI_LONG_LONG_INT,windows_[currentWindows]) ; - -// release lock - CTimer::get("getBufferFromClient_locked").suspend() ; - unlockBuffer() ; - - ok=true ; - char checksum=0 ; - for(size_t i=0;i& windows, vector& winAddress, int windowsRank, StdSize bufSize) ; + CServerBuffer(StdSize bufSize) ; ~CServerBuffer() ; bool isBufferFree(size_t count) ; - bool isResizing(void) { return resizingBuffer_ ;} void* getBuffer(size_t count) ; void freeBuffer(size_t count) ; - void popBuffer(size_t count) ; - void createWindows(MPI_Comm oneSidedComm) ; - bool getBufferFromClient(size_t timeLine, char* & buffer, size_t& count) ; - bool isBufferEmpty(void) ; - void updateCurrentWindows(void) ; - void lockBuffer(void) ; - void unlockBuffer(void) ; - void notifyClientFinalize(void) ; - void notifyBufferResizing(void) ; - size_t getUsed(void) { return used ;} + private: char* buffer; size_t first; // first occupied element size_t current; // first free element size_t end; size_t size; - size_t used ; // count of element occupied - std::vector windows_ ; - std::vector winAddress_ ; - bool resizingBuffer_ = false ; - int currentWindows ; - bool hasWindows ; - int windowsRank_ ; - double bufferFromClientLatency_=0e-1 ; - double bufferFromClientTime_ = 0; - }; } diff --git a/xios_2311_src/src/calendar_util.cpp b/xios_2311_src/src/calendar_util.cpp index f0ae683c865ffb432ac6e80964933dc8ce5f1a8d..4eef998b54b4bc3e3677e1c2fb0f2a32b150b8c5 100644 --- a/xios_2311_src/src/calendar_util.cpp +++ b/xios_2311_src/src/calendar_util.cpp @@ -44,6 +44,77 @@ namespace xios return dur; } + bool operator<(const CDuration& dur1, const CDuration& dur2) + { + if (dur1.year < dur2.year) + return true; + else if (dur1.year == dur2.year) + { + if (dur1.month < dur2.month) + return true; + else if (dur1.month == dur2.month) + { + if (dur1.day < dur2.day) + return true; + else if (dur1.day == dur2.day) + { + if (dur1.hour < dur2.hour) + return true; + else if (dur1.hour == dur2.hour) + { + if (dur1.minute < dur2.minute) + return true; + else if (dur1.minute == dur2.minute) + { + if (dur1.second < dur2.second) + return true; + else if (dur1.second == dur2.second) + return (dur1.timestep < dur2.timestep); + } + } + } + } + } + return false; + } + + + bool operator>(const CDuration& dur1, const CDuration& dur2) + { + if (dur1.year > dur2.year) + return true; + else if (dur1.year == dur2.year) + { + if (dur1.month > dur2.month) + return true; + else if (dur1.month == dur2.month) + { + if (dur1.day > dur2.day) + return true; + else if (dur1.day == dur2.day) + { + if (dur1.hour > dur2.hour) + return true; + else if (dur1.hour == dur2.hour) + { + if (dur1.minute > dur2.minute) + return true; + else if (dur1.minute == dur2.minute) + { + if (dur1.second > dur2.second) + return true; + else if (dur1.second == dur2.second) + return (dur1.timestep > dur2.timestep); + } + } + } + } + } + return false; + } + + + //----------------------------------------------------------------- CDate operator+(const CDate& dt, const CDuration& dr) diff --git a/xios_2311_src/src/calendar_util.hpp b/xios_2311_src/src/calendar_util.hpp index 0290868576b9ee58c34ab6b28a35702c7a893b54..fdd8036746cdce5abf43682fc29214dc94e84b72 100644 --- a/xios_2311_src/src/calendar_util.hpp +++ b/xios_2311_src/src/calendar_util.hpp @@ -16,6 +16,9 @@ namespace xios CDuration operator*(const CDuration& ddr, const double& scal); CDuration operator-(const CDuration& ddr); + bool operator>(const CDuration& ddr, const CDuration& dr); + bool operator<(const CDuration& ddr, const CDuration& dr); + CDate operator+(const CDate& dt, const CDuration& dr); // Non testée. CDate operator-(const CDate& dt, const CDuration& dr); diff --git a/xios_2311_src/src/client.cpp b/xios_2311_src/src/client.cpp index cce5e3452dfefe944caf9a2f5226f26bd442932b..f49d4fa3e9b4d8714ceac4245b04bfaa72bf5d18 100644 --- a/xios_2311_src/src/client.cpp +++ b/xios_2311_src/src/client.cpp @@ -11,30 +11,18 @@ #include "timer.hpp" #include "buffer_client.hpp" #include "string_tools.hpp" -#include "ressources_manager.hpp" -#include "services_manager.hpp" -#include -#include -#include "workflow_graph.hpp" -#include "release_static_allocation.hpp" namespace xios { - const double serverPublishDefaultTimeout=10; - MPI_Comm CClient::intraComm ; MPI_Comm CClient::interComm ; - MPI_Comm CClient::clientsComm_ ; - std::list CClient::contextInterComms; int CClient::serverLeader ; bool CClient::is_MPI_Initialized ; int CClient::rank_ = INVALID_RANK; StdOFStream CClient::m_infoStream; StdOFStream CClient::m_errorStream; - CPoolRessource* CClient::poolRessource_=nullptr ; - MPI_Comm& CClient::getInterComm(void) { return (interComm); } ///--------------------------------------------------------------- @@ -48,364 +36,128 @@ namespace xios void CClient::initialize(const string& codeId, MPI_Comm& localComm, MPI_Comm& returnComm) { - - MPI_Comm clientComm ; - // initialize MPI if not initialized int initialized ; MPI_Initialized(&initialized) ; if (initialized) is_MPI_Initialized=true ; else is_MPI_Initialized=false ; - - MPI_Comm globalComm=CXios::getGlobalComm() ; + int rank ; - ///////////////////////////////////////// - ///////////// PART 1 //////////////////// - ///////////////////////////////////////// - - - // localComm isn't given - if (localComm == MPI_COMM_NULL) +// don't use OASIS + if (!CXios::usingOasis) { - - // don't use OASIS - if (!CXios::usingOasis) +// localComm isn't given + if (localComm == MPI_COMM_NULL) { - if (!is_MPI_Initialized) { MPI_Init(NULL, NULL); } CTimer::get("XIOS").resume() ; - CTimer::get("XIOS init/finalize",false).resume() ; - - // split the global communicator - // get hash from all model to attribute a unique color (int) and then split to get client communicator - // every mpi process of globalComm (MPI_COMM_WORLD) must participate - - int commRank, commSize ; - MPI_Comm_rank(globalComm,&commRank) ; - MPI_Comm_size(globalComm,&commSize) ; - - std::hash hashString ; - size_t hashClient=hashString(codeId) ; - - size_t* hashAll = new size_t[commSize] ; - MPI_Allgather(&hashClient,1,MPI_SIZE_T,hashAll,1,MPI_SIZE_T,globalComm) ; - - int color=0 ; - map listHash ; - for(int i=0 ; i<=commSize ; i++) - if (listHash.count(hashAll[i])==0) - { - listHash[hashAll[i]]=color ; - color=color+1 ; - } - color=listHash[hashClient] ; - delete[] hashAll ; - - MPI_Comm_split(globalComm, color, commRank, &clientComm) ; - } - else // using oasis to split communicator - { - if (!is_MPI_Initialized) oasis_init(codeId) ; - oasis_get_localcomm(clientComm) ; - } - } - else // localComm is given - { - MPI_Comm_dup(localComm,&clientComm) ; - } - - - ///////////////////////////////////////// - ///////////// PART 2 //////////////////// - ///////////////////////////////////////// - + CTimer::get("XIOS init/finalize").resume() ; + boost::hash hashString ; - // Create the XIOS communicator for every process which is related - // to XIOS, as well on client side as on server side - - MPI_Comm xiosGlobalComm ; - string strIds=CXios::getin("clients_code_id","") ; - vector clientsCodeId=splitRegex(strIds,"\\s*,\\s*") ; - if (strIds.empty()) - { - // no code Ids given, suppose XIOS initialisation is global - int commRank, commGlobalRank, serverLeader, clientLeader,serverRemoteLeader,clientRemoteLeader ; - MPI_Comm splitComm,interComm ; - MPI_Comm_rank(globalComm,&commGlobalRank) ; - MPI_Comm_split(globalComm, 0, commGlobalRank, &splitComm) ; - int splitCommSize, globalCommSize ; - - MPI_Comm_size(splitComm,&splitCommSize) ; - MPI_Comm_size(globalComm,&globalCommSize) ; - if (splitCommSize==globalCommSize) // no server - { - MPI_Comm_dup(globalComm,&xiosGlobalComm) ; - CXios::setXiosComm(xiosGlobalComm) ; - } - else - { - MPI_Comm_rank(splitComm,&commRank) ; - if (commRank==0) clientLeader=commGlobalRank ; - else clientLeader=0 ; - serverLeader=0 ; - MPI_Allreduce(&clientLeader,&clientRemoteLeader,1,MPI_INT,MPI_SUM,globalComm) ; - MPI_Allreduce(&serverLeader,&serverRemoteLeader,1,MPI_INT,MPI_SUM,globalComm) ; - MPI_Intercomm_create(splitComm, 0, globalComm, serverRemoteLeader,1341,&interComm) ; - MPI_Intercomm_merge(interComm,true,&xiosGlobalComm) ; - CXios::setXiosComm(xiosGlobalComm) ; - } - } - else - { + unsigned long hashClient=hashString(codeId) ; + unsigned long hashServer=hashString(CXios::xiosCodeId) ; + unsigned long* hashAll ; + int size ; + int myColor ; + int i,c ; + MPI_Comm newComm ; - xiosGlobalCommByFileExchange(clientComm, codeId) ; - - } + MPI_Comm_size(CXios::globalComm,&size) ; + MPI_Comm_rank(CXios::globalComm,&rank_); - int commRank ; - MPI_Comm_rank(CXios::getXiosComm(), &commRank) ; - MPI_Comm_split(CXios::getXiosComm(),false,commRank, &clientsComm_) ; - - // is using server or not ? - int xiosCommSize, clientsCommSize ; - MPI_Comm_size(CXios::getXiosComm(), &xiosCommSize) ; - MPI_Comm_size(clientsComm_, &clientsCommSize) ; - if (xiosCommSize==clientsCommSize) CXios::setUsingServer() ; - else CXios::setNotUsingServer() ; - - ///////////////////////////////////////// - ///////////// PART 3 //////////////////// - ///////////////////////////////////////// - - CXios::launchDaemonsManager(false) ; - poolRessource_ = new CPoolRessource(clientComm, codeId) ; + hashAll=new unsigned long[size] ; - ///////////////////////////////////////// - ///////////// PART 4 //////////////////// - ///////////////////////////////////////// - - returnComm = clientComm ; - } + MPI_Allgather(&hashClient,1,MPI_LONG,hashAll,1,MPI_LONG,CXios::globalComm) ; + map colors ; + map leaders ; - void CClient::xiosGlobalCommByFileExchange(MPI_Comm clientComm, const string& codeId) - { - - MPI_Comm globalComm=CXios::getGlobalComm() ; - MPI_Comm xiosGlobalComm ; - - string strIds=CXios::getin("clients_code_id","") ; - vector clientsCodeId=splitRegex(strIds,"\\s*,\\s*") ; - - int commRank, globalRank, clientRank, serverRank ; - MPI_Comm_rank(clientComm, &commRank) ; - MPI_Comm_rank(globalComm, &globalRank) ; - string clientFileName("__xios_publisher::"+codeId+"__to_remove__") ; - - int error ; - - if (commRank==0) // if root process publish name - { - std::ofstream ofs (clientFileName, std::ofstream::out); - ofs<("server_puplish_timeout",serverPublishDefaultTimeout) ; - double time ; - - do - { - CTimer::get("server_publish_timeout").resume() ; - ifs.clear() ; - ifs.open(fileName, std::ifstream::in) ; - CTimer::get("server_publish_timeout").suspend() ; - } while (ifs.fail() && CTimer::get("server_publish_timeout").getCumulatedTime()=timeout || ifs.fail()) - { - ifs.clear() ; - ifs.close() ; - ifs.clear() ; - error=true ; - } - else - { - ifs>>serverRank ; - ifs.close() ; - error=false ; - } + for(i=0,c=0;i clientsRank(clientsCodeId.size()) ; - - if (commRank==0) - { - for(int i=0;i>clientsRank[i] ; - ifs.close() ; + CXios::setUsingServer(); + break; + } } - } - - int client ; - MPI_Comm intraComm ; - MPI_Comm_dup(clientComm,&intraComm) ; - MPI_Comm interComm ; - - int pos=0 ; - for(int i=0 ; codeId!=clientsCodeId[i]; i++) pos=pos+1 ; - - bool high=true ; - for(int i=pos+1 ; icreateService(contextComm, id, 0, CServicesManager::CLIENT, 1) ; - getPoolRessource()->createService(contextComm, id+"_"+CXios::defaultServerId, 0, CServicesManager::IO_SERVER, 1) ; - - if (commRank==0) while (!CXios::getServicesManager()->hasService(getPoolRessource()->getId(), id, 0)) { CXios::getDaemonsManager()->eventLoop();} - - if (commRank==0) CXios::getContextsManager()->createServerContext(getPoolRessource()->getId(), id, 0, id) ; - int type=CServicesManager::CLIENT ; - string name = CXios::getContextsManager()->getServerContextName(getPoolRessource()->getId(), id, 0, type, id) ; - double time ; - double lastTime=0 ; - double latency=0 ; - bool out=false ; - while (!out) + CContext::setCurrent(id) ; + CContext* context=CContext::create(id); + StdString idServer(id); + idServer += "_server"; + + if (CXios::isServer && !context->hasServer) + // Attached mode { - time=MPI_Wtime() ; - if (time-lastTime > latency) - { - out=CXios::getContextsManager()->hasContext(name, contextComm); - lastTime=time ; - } - if (!out) CXios::getDaemonsManager()->eventLoop() ; + MPI_Comm contextInterComm ; + MPI_Comm_dup(contextComm,&contextInterComm) ; + CContext* contextServer = CContext::create(idServer); + + // Firstly, initialize context on client side + context->initClient(contextComm,contextInterComm, contextServer); + + // Secondly, initialize context on server side + contextServer->initServer(contextComm,contextInterComm, context); + + // Finally, we should return current context to context client + CContext::setCurrent(id); + + contextInterComms.push_back(contextInterComm); } + else + { + int size,rank,globalRank ; + size_t message_size ; + int leaderRank ; + MPI_Comm contextInterComm ; - } + MPI_Comm_size(contextComm,&size) ; + MPI_Comm_rank(contextComm,&rank) ; + MPI_Comm_rank(CXios::globalComm,&globalRank) ; + if (rank!=0) globalRank=0 ; + + CMessage msg ; + msg<initClient(contextComm,contextInterComm) ; + + contextInterComms.push_back(contextInterComm); + delete [] buff ; + + } + } /*! * \fn void CClient::callOasisEnddef(void) @@ -477,21 +259,32 @@ namespace xios } } + void CClient::finalize(void) { - - MPI_Barrier(clientsComm_) ; - int commRank ; - MPI_Comm_rank(clientsComm_, &commRank) ; - if (commRank==0) CXios::getRessourcesManager()->finalize() ; - - CTimer::get("XIOS init/finalize",false).suspend() ; + int rank ; + int msg=0 ; + + MPI_Comm_rank(intraComm,&rank) ; + + if (!CXios::isServer) + { + MPI_Comm_rank(intraComm,&rank) ; + if (rank==0) + { + MPI_Send(&msg,1,MPI_INT,0,0,interComm) ; + } + } + + + /* MPI_Comm_free(&interComm); */ // WARNING remove freeing communicator !! --> deadlock raised, to be checked + for (std::list::iterator it = contextInterComms.begin(); it != contextInterComms.end(); it++) + /* MPI_Comm_free(&(*it)) */ ; // WARNING remove freeing communicator !! --> deadlock raised, to be checked + MPI_Comm_free(&intraComm); + + CTimer::get("XIOS init/finalize").suspend() ; CTimer::get("XIOS").suspend() ; - CXios::finalizeDaemonsManager() ; - finalizePoolRessource() ; - CContext::removeAllContexts() ; // free memory for related context - CXios::getMpiGarbageCollector().release() ; // release unfree MPI ressources if (!is_MPI_Initialized) { if (CXios::usingOasis) oasis_finalize(); @@ -508,16 +301,7 @@ namespace xios report(0)<< " Memory report : Minimum buffer size required : " << CClientBuffer::maxRequestSize << " bytes" << endl ; report(0)<< " Memory report : increasing it by a factor will increase performance, depending of the volume of data wrote in file at each time step of the file"<open(fileNameClient.str().c_str(), std::ios::out); if (!fb->is_open()) diff --git a/xios_2311_src/src/client.hpp b/xios_2311_src/src/client.hpp index d753005a1dac63acad534882355d4a97e50d9a15..f830d56a7b74fbb032ad82301571db24d75a0c75 100644 --- a/xios_2311_src/src/client.hpp +++ b/xios_2311_src/src/client.hpp @@ -6,24 +6,19 @@ namespace xios { - class CPoolRessource ; class CClient { public: static void initialize(const string& codeId, MPI_Comm& localComm, MPI_Comm& returnComm); - static void xiosGlobalCommByFileExchange(MPI_Comm clientComm, const string& codeId) ; - static void xiosGlobalCommByPublishing(MPI_Comm clientComm, const string& codeId) ; static void finalize(void); static void registerContext(const string& id, MPI_Comm contextComm); - static void registerContext_old(const string& id, MPI_Comm contextComm); - static void callOasisEnddef(void) ; - + static void callOasisEnddef(void) ; + static MPI_Comm intraComm; static MPI_Comm interComm; static std::list contextInterComms; static int serverLeader; static bool is_MPI_Initialized ; - static MPI_Comm clientsComm_ ; static MPI_Comm& getInterComm(); @@ -43,16 +38,13 @@ namespace xios static void openErrorStream(); //! Close the error log file if it opens static void closeErrorStream(); - static CPoolRessource* getPoolRessource(void) { return poolRessource_ ; } - static void finalizePoolRessource() ; - static void openStream(const StdString& fileName, const StdString& ext, std::filebuf* fb); protected: static int rank_; //!< Rank in model intraComm static StdOFStream m_infoStream; static StdOFStream m_errorStream; - static CPoolRessource* poolRessource_ ; + static void openStream(const StdString& fileName, const StdString& ext, std::filebuf* fb); }; } diff --git a/xios_2311_src/src/config/axis_attribute.conf b/xios_2311_src/src/config/axis_attribute.conf index d27fa1452539f43627e348c134c7dc62fcc3597f..96dff81a3370329c960ce07da755a95c79c7fc47 100644 --- a/xios_2311_src/src/config/axis_attribute.conf +++ b/xios_2311_src/src/config/axis_attribute.conf @@ -5,6 +5,7 @@ DECLARE_ATTRIBUTE(StdString, long_name) DECLARE_ATTRIBUTE(StdString, comment) DECLARE_ATTRIBUTE(StdString, unit) +DECLARE_ATTRIBUTE(double, convert_from_factor) DECLARE_ATTRIBUTE(StdString, formula) DECLARE_ATTRIBUTE(StdString, formula_term) DECLARE_ATTRIBUTE(StdString, formula_bounds) @@ -21,22 +22,22 @@ DECLARE_ATTRIBUTE(StdString, dim_name) DECLARE_ATTRIBUTE(int, n_distributed_partition) /* LOCAL */ -DECLARE_ARRAY(double , 1 , value, false) -DECLARE_ATTRIBUTE(StdString, axis_ref, false) +DECLARE_ARRAY(double , 1 , value) +DECLARE_ATTRIBUTE(StdString, axis_ref) -DECLARE_ARRAY(int ,1 , index, false) +DECLARE_ARRAY(int ,1 , index) /* LOCAL */ -DECLARE_ATTRIBUTE(int, data_n, false) -DECLARE_ATTRIBUTE(int, data_begin, false) -DECLARE_ARRAY(int , 1 , data_index, false) +DECLARE_ATTRIBUTE(int, data_n) +DECLARE_ATTRIBUTE(int, data_begin) +DECLARE_ARRAY(int , 1 , data_index) /*LOCAL */ -DECLARE_ATTRIBUTE(int, begin, false) -DECLARE_ATTRIBUTE(int, n, false) +DECLARE_ATTRIBUTE(int, begin) +DECLARE_ATTRIBUTE(int, n) /* LOCAL */ -DECLARE_ARRAY(bool, 1 , mask, false) -DECLARE_ARRAY(double, 2 , bounds, false) +DECLARE_ARRAY(bool, 1 , mask) +DECLARE_ARRAY(double, 2 , bounds) DECLARE_ATTRIBUTE(int, prec) -DECLARE_ARRAY(StdString ,1 , label, false) +DECLARE_ARRAY(StdString ,1 , label) diff --git a/xios_2311_src/src/config/context_attribute.conf b/xios_2311_src/src/config/context_attribute.conf index 9bcf7262c8d09604590c31e77425a81747624fad..d1a271d6ff3c23585de8f2ec36ce56c3f8270cf1 100644 --- a/xios_2311_src/src/config/context_attribute.conf +++ b/xios_2311_src/src/config/context_attribute.conf @@ -1,2 +1 @@ DECLARE_ATTRIBUTE(StdString, output_dir) -DECLARE_ATTRIBUTE(bool, attached_mode) \ No newline at end of file diff --git a/xios_2311_src/src/config/coupler_in_attribute.conf b/xios_2311_src/src/config/coupler_in_attribute.conf deleted file mode 100755 index 80298236b9d4a31e63d5c8ca4440d9dc3dccdd4e..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/config/coupler_in_attribute.conf +++ /dev/null @@ -1,2 +0,0 @@ -DECLARE_ATTRIBUTE(StdString, context) -DECLARE_ATTRIBUTE(bool, enabled) diff --git a/xios_2311_src/src/config/coupler_out_attribute.conf b/xios_2311_src/src/config/coupler_out_attribute.conf deleted file mode 100755 index 2d3c020633b22893f28f27a48870f0d58078ce25..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/config/coupler_out_attribute.conf +++ /dev/null @@ -1,2 +0,0 @@ -DECLARE_ATTRIBUTE(StdString, context) -DECLARE_ATTRIBUTE(bool, enabled) \ No newline at end of file diff --git a/xios_2311_src/src/config/domain_attribute.conf b/xios_2311_src/src/config/domain_attribute.conf index cb37ae8274f2d4a27eca0e4d5eb98b7d661675c6..23c34b431318ac85edbaba94e14c93a73f4401b6 100644 --- a/xios_2311_src/src/config/domain_attribute.conf +++ b/xios_2311_src/src/config/domain_attribute.conf @@ -56,9 +56,21 @@ DECLARE_ARRAY(double, 2, bounds_lat_1d, false) DECLARE_ARRAY(double, 3, bounds_lon_2d, false) DECLARE_ARRAY(double, 3, bounds_lat_2d, false) -DECLARE_ARRAY(double, 2, area, false) +DECLARE_ARRAY(double, 2, area) DECLARE_ATTRIBUTE(double, radius) DECLARE_ENUM4(type,rectilinear,curvilinear,unstructured, gaussian) -DECLARE_ATTRIBUTE(StdString, domain_ref, false) +DECLARE_ATTRIBUTE(StdString, domain_ref) DECLARE_ATTRIBUTE(int, prec) + +/* LOCAL */ +DECLARE_ATTRIBUTE(int, ntiles, false) +DECLARE_ATTRIBUTE(bool, tile_only, false) +DECLARE_ARRAY(int, 1, tile_ni, false) +DECLARE_ARRAY(int, 1, tile_nj, false) +DECLARE_ARRAY(int, 1, tile_ibegin, false) +DECLARE_ARRAY(int, 1, tile_jbegin, false) +DECLARE_ARRAY(int, 1, tile_data_ibegin, false) +DECLARE_ARRAY(int, 1, tile_data_jbegin, false) +DECLARE_ARRAY(int, 1, tile_data_ni, false) +DECLARE_ARRAY(int, 1, tile_data_nj, false) diff --git a/xios_2311_src/src/config/field_attribute.conf b/xios_2311_src/src/config/field_attribute.conf index 094e4be159bf32cc66d7bf7a36521b2d95bc67e4..144ff904ab9eaa19008bde56916372cc3c1348f6 100644 --- a/xios_2311_src/src/config/field_attribute.conf +++ b/xios_2311_src/src/config/field_attribute.conf @@ -12,7 +12,7 @@ DECLARE_ATTRIBUTE(CDuration, freq_op) DECLARE_ATTRIBUTE(CDuration, freq_offset) DECLARE_ATTRIBUTE(int, level) DECLARE_ATTRIBUTE(int, prec) -DECLARE_ATTRIBUTE(StdString, expr, false) +DECLARE_ATTRIBUTE(StdString, expr) DECLARE_ATTRIBUTE(bool, enabled) DECLARE_ATTRIBUTE(bool, read_access) @@ -23,7 +23,7 @@ DECLARE_ATTRIBUTE(StdString, domain_ref, false) DECLARE_ATTRIBUTE(StdString, axis_ref, false) DECLARE_ATTRIBUTE(StdString, scalar_ref, false) DECLARE_ATTRIBUTE(StdString, grid_ref) -DECLARE_ATTRIBUTE(StdString, field_ref, false) +DECLARE_ATTRIBUTE(StdString, field_ref) DECLARE_ATTRIBUTE(StdString, grid_path) DECLARE_ATTRIBUTE(double, default_value) @@ -40,4 +40,7 @@ DECLARE_ATTRIBUTE(CDuration, ts_split_freq) DECLARE_ATTRIBUTE(StdString, cell_methods) DECLARE_ENUM4(cell_methods_mode, overwrite, prefix, suffix, none) + DECLARE_ATTRIBUTE(bool, build_workflow_graph) +DECLARE_ATTRIBUTE(CDuration, build_workflow_graph_start) +DECLARE_ATTRIBUTE(CDuration, build_workflow_graph_end) diff --git a/xios_2311_src/src/config/interpolate_axis_attribute.conf b/xios_2311_src/src/config/interpolate_axis_attribute.conf index f5f88822700d883a1cd8871463190460cc6d7cab..e2d8e311d53c2c68947af484f2bb064a201b9799 100644 --- a/xios_2311_src/src/config/interpolate_axis_attribute.conf +++ b/xios_2311_src/src/config/interpolate_axis_attribute.conf @@ -4,3 +4,5 @@ DECLARE_ATTRIBUTE(int, order) DECLARE_ATTRIBUTE(StdString, coordinate) DECLARE_ATTRIBUTE(StdString, coordinate_src) DECLARE_ATTRIBUTE(StdString, coordinate_dst) +DECLARE_ATTRIBUTE(bool, extrapolate) + diff --git a/xios_2311_src/src/config/node_type.conf b/xios_2311_src/src/config/node_type.conf index 8e47871010b653ced04686c36805408a39c957e2..b227c879a3748e82b8c35beb54db518986211ec0 100755 --- a/xios_2311_src/src/config/node_type.conf +++ b/xios_2311_src/src/config/node_type.conf @@ -14,15 +14,6 @@ DECLARE_NODE(File , file ) #endif //__XIOS_CFile__ -#ifdef __XIOS_CCouplerIn__ - DECLARE_NODE(CouplerIn , coupler_in ) -#endif //__XIOS_CCouplerIn__ - -#ifdef __XIOS_CCouplerOut__ - DECLARE_NODE(CouplerOut , coupler_out ) -#endif //__XIOS_CCouplerOut__ - - #ifdef __XIOS_CGrid__ DECLARE_NODE(Grid , grid ) #endif //__XIOS_CGrid__ diff --git a/xios_2311_src/src/config/reduce_axis_to_scalar_attribute.conf b/xios_2311_src/src/config/reduce_axis_to_scalar_attribute.conf index c5cdb465f20d83b134282480a56874a215e2970e..4c5c8ac36ae4bf998be49413ed6d183678354304 100644 --- a/xios_2311_src/src/config/reduce_axis_to_scalar_attribute.conf +++ b/xios_2311_src/src/config/reduce_axis_to_scalar_attribute.conf @@ -1,5 +1,3 @@ DECLARE_ENUM4(operation, min, max, sum, average) -DECLARE_ATTRIBUTE(bool, local) - diff --git a/xios_2311_src/src/config/scalar_attribute.conf b/xios_2311_src/src/config/scalar_attribute.conf index 9ae3c9fdf638dccb6b2ad8b71717ce95037e2abd..2ad7c1af5a395af10f7e894e5a9b4a4e8d0e3112 100644 --- a/xios_2311_src/src/config/scalar_attribute.conf +++ b/xios_2311_src/src/config/scalar_attribute.conf @@ -7,14 +7,11 @@ DECLARE_ATTRIBUTE(StdString, comment) DECLARE_ATTRIBUTE(StdString, unit) /* LOCAL and GLOBAL*/ -DECLARE_ATTRIBUTE(bool, mask, false) -DECLARE_ATTRIBUTE(double, value, false) -DECLARE_ATTRIBUTE(int, n, false) +DECLARE_ATTRIBUTE(double, value) DECLARE_ATTRIBUTE(StdString, bounds_name) DECLARE_ARRAY(double, 1 , bounds) - -DECLARE_ATTRIBUTE(StdString, scalar_ref, false) +DECLARE_ATTRIBUTE(StdString, scalar_ref) DECLARE_ATTRIBUTE(int, prec) DECLARE_ENUM4(axis_type, X, Y, Z, T) diff --git a/xios_2311_src/src/context_client.cpp b/xios_2311_src/src/context_client.cpp index 92607513410db081168240d51f9f5ae6cf63cba4..3655d9074c3dab562317fa64f6147c6654ceb13f 100644 --- a/xios_2311_src/src/context_client.cpp +++ b/xios_2311_src/src/context_client.cpp @@ -11,10 +11,6 @@ #include "timer.hpp" #include "cxios.hpp" #include "server.hpp" -#include "services.hpp" -#include -#include -#include namespace xios { @@ -25,10 +21,9 @@ namespace xios \cxtSer [in] cxtSer Pointer to context of server side. (It is only used in case of attached mode). */ CContextClient::CContextClient(CContext* parent, MPI_Comm intraComm_, MPI_Comm interComm_, CContext* cxtSer) - : mapBufferSize_(), parentServer(cxtSer), maxBufferedEvents(4), associatedServer_(nullptr) + : mapBufferSize_(), parentServer(cxtSer), maxBufferedEvents(4) { - - context_ = parent; + context = parent; intraComm = intraComm_; interComm = interComm_; MPI_Comm_rank(intraComm, &clientRank); @@ -36,30 +31,12 @@ namespace xios int flag; MPI_Comm_test_inter(interComm, &flag); - if (flag) isAttached_=false ; - else isAttached_=true ; - - pureOneSided=CXios::getin("pure_one_sided",false); // pure one sided communication (for test) - if (isAttachedModeEnabled()) pureOneSided=false ; // no one sided in attach mode - - - if (flag) MPI_Comm_remote_size(interComm, &serverSize); else MPI_Comm_size(interComm, &serverSize); computeLeader(clientRank, clientSize, serverSize, ranksServerLeader, ranksServerNotLeader); - if (flag) MPI_Intercomm_merge(interComm_,false, &interCommMerged_) ; - - MPI_Comm_split(intraComm_,clientRank,clientRank, &commSelf_) ; // for windows - - auto time=chrono::system_clock::now().time_since_epoch().count() ; - std::default_random_engine rd(time); // not reproducible from a run to another - std::uniform_int_distribution dist; - hashId_=dist(rd) ; - MPI_Bcast(&hashId_,1,MPI_SIZE_T,0,intraComm) ; // Bcast to all server of the context - - timeLine = 1; + timeLine = 0; } void CContextClient::computeLeader(int clientRank, int clientSize, int serverSize, @@ -117,101 +94,99 @@ namespace xios void CContextClient::sendEvent(CEventClient& event) { list ranks = event.getRanks(); - -// ostringstream str ; -// for(auto& rank : ranks) str<getId()<<" for ranks : "<getId()< servers(serverSize,0) ; - auto ranks=event.getRanks() ; - for(auto& rank : ranks) servers[rank]=1 ; - MPI_Allreduce(MPI_IN_PLACE, servers.data(), serverSize,MPI_INT,MPI_SUM,intraComm) ; - ostringstream osstr ; - for(int i=0;i sizes = event.getSizes(); - // We force the getBuffers call to be non-blocking on classical servers + // We force the getBuffers call to be non-blocking on classical servers list buffList; - getBuffers(timeLine, ranks, sizes, buffList) ; + bool couldBuffer = getBuffers(ranks, sizes, buffList, (!CXios::isClient && (CServer::serverLevel == 0) )); +// bool couldBuffer = getBuffers(ranks, sizes, buffList, CXios::isServer ); - event.send(timeLine, sizes, buffList); - - //for (auto itRank = ranks.begin(); itRank != ranks.end(); itRank++) buffers[*itRank]->infoBuffer() ; + if (couldBuffer) + { + event.send(timeLine, sizes, buffList); + info(100)<<"Event "<getId()<<" sent"<globalEventLoop() ; - - CXios::getDaemonsManager()->scheduleContext(hashId_) ; - while (CXios::getDaemonsManager()->isScheduledContext(hashId_)) context_->globalEventLoop() ; + checkBuffers(ranks); + + if (isAttachedModeEnabled()) // couldBuffer is always true in attached mode + { + waitEvent(ranks); + CContext::setCurrent(context->getId()); + } + } + else + { + tmpBufferedEvent.ranks = ranks; + tmpBufferedEvent.sizes = sizes; + + for (list::const_iterator it = sizes.begin(); it != sizes.end(); it++) + tmpBufferedEvent.buffers.push_back(new CBufferOut(*it)); + info(100)<<"DEBUG : temporaly event created : timeline "<getId()<<" sent"<& ranks) + * Send the temporarily buffered event (if any). + * + * \return true if a temporarily buffered event could be sent, false otherwise + */ + bool CContextClient::sendTemporarilyBufferedEvent() { - while (checkBuffers(ranks)) + bool couldSendTmpBufferedEvent = false; + + if (hasTemporarilyBufferedEvent()) { - context_->eventLoop() ; - } + list buffList; + if (getBuffers(tmpBufferedEvent.ranks, tmpBufferedEvent.sizes, buffList, true)) // Non-blocking call + { + list::iterator it, itBuffer; - MPI_Request req ; - MPI_Status status ; + for (it = tmpBufferedEvent.buffers.begin(), itBuffer = buffList.begin(); it != tmpBufferedEvent.buffers.end(); it++, itBuffer++) + (*itBuffer)->put((char*)(*it)->start(), (*it)->count()); - MPI_Ibarrier(intraComm,&req) ; - int flag=false ; + info(100)<<"DEBUG : temporaly event sent "<eventLoop() ; - MPI_Test(&req,&flag,&status) ; - } while (!flag) ; + tmpBufferedEvent.clear(); + couldSendTmpBufferedEvent = true; + } + } + return couldSendTmpBufferedEvent; } - - void CContextClient::waitEvent_old(list& ranks) + /*! + If client is also server (attached mode), after sending event, it should process right away + the incoming event. + \param [in] ranks list rank of server connected this client + */ + void CContextClient::waitEvent(list& ranks) { parentServer->server->setPendingEvent(); while (checkBuffers(ranks)) @@ -230,15 +205,13 @@ namespace xios * Get buffers for each connection to the servers. This function blocks until there is enough room in the buffers unless * it is explicitly requested to be non-blocking. * - * - * \param [in] timeLine time line of the event which will be sent to servers * \param [in] serverList list of rank of connected server * \param [in] sizeList size of message corresponding to each connection * \param [out] retBuffers list of buffers that can be used to store an event * \param [in] nonBlocking whether this function should be non-blocking * \return whether the already allocated buffers could be used */ - bool CContextClient::getBuffers(const size_t timeLine, const list& serverList, const list& sizeList, list& retBuffers, + bool CContextClient::getBuffers(const list& serverList, const list& sizeList, list& retBuffers, bool nonBlocking /*= false*/) { list::const_iterator itServer, itSize; @@ -258,45 +231,41 @@ namespace xios bufferList.push_back(it->second); } - double lastTimeBuffersNotFree=0. ; - double time ; - bool doUnlockBuffers ; CTimer::get("Blocking time").resume(); do { areBuffersFree = true; - doUnlockBuffers=false ; - time=MPI_Wtime() ; - if (time-lastTimeBuffersNotFree > latency_) - { - for (itBuffer = bufferList.begin(), itSize = sizeList.begin(); itBuffer != bufferList.end(); itBuffer++, itSize++) - { - areBuffersFree &= (*itBuffer)->isBufferFree(*itSize); - } - if (!areBuffersFree) - { - lastTimeBuffersNotFree = time ; - doUnlockBuffers=true ; - } - } - else areBuffersFree = false ; + for (itBuffer = bufferList.begin(), itSize = sizeList.begin(); itBuffer != bufferList.end(); itBuffer++, itSize++) + areBuffersFree &= (*itBuffer)->isBufferFree(*itSize); if (!areBuffersFree) { - if (doUnlockBuffers) for (itBuffer = bufferList.begin(); itBuffer != bufferList.end(); itBuffer++) (*itBuffer)->unlockBuffer(); checkBuffers(); + if (CServer::serverLevel == 0) + context->server->listen(); - context_->globalEventLoop() ; - } + else if (CServer::serverLevel == 1) + { + context->server->listen(); + for (int i = 0; i < context->serverPrimServer.size(); ++i) + context->serverPrimServer[i]->listen(); + CServer::contextEventLoop(false) ; // avoid dead-lock at finalize... + } + else if (CServer::serverLevel == 2) + context->server->listen(); + + } } while (!areBuffersFree && !nonBlocking); + CTimer::get("Blocking time").suspend(); if (areBuffersFree) { for (itBuffer = bufferList.begin(), itSize = sizeList.begin(); itBuffer != bufferList.end(); itBuffer++, itSize++) - retBuffers.push_back((*itBuffer)->getBuffer(timeLine, *itSize)); + retBuffers.push_back((*itBuffer)->getBuffer(*itSize)); } + return areBuffersFree; } @@ -312,50 +281,11 @@ namespace xios mapBufferSize_[rank] = CXios::minBufferSize; maxEventSizes[rank] = CXios::minBufferSize; } - - CClientBuffer* buffer = buffers[rank] = new CClientBuffer(interComm, rank, mapBufferSize_[rank], maxEventSizes[rank]); - if (isGrowableBuffer_) buffer->setGrowableBuffer(1.2) ; - else buffer->fixBuffer() ; + CClientBuffer* buffer = buffers[rank] = new CClientBuffer(interComm, rank, mapBufferSize_[rank], maxEventSizes[rank], maxBufferedEvents); // Notify the server - CBufferOut* bufOut = buffer->getBuffer(0, 4*sizeof(MPI_Aint)); - MPI_Aint sendBuff[4] ; - sendBuff[0]=hashId_; - sendBuff[1]=mapBufferSize_[rank]; - sendBuff[2]=buffers[rank]->getWinAddress(0); - sendBuff[3]=buffers[rank]->getWinAddress(1); - info(100)<<"CContextClient::newBuffer : rank "<getWinAddress(0)<<" winAdress[1] "<getWinAddress(1)<put(sendBuff, 4); - buffer->checkBuffer(true); - - // create windows dynamically for one-sided - if (!isAttachedModeEnabled()) - { - CTimer::get("create Windows").resume() ; - MPI_Comm interComm ; - MPI_Intercomm_create(commSelf_, 0, interCommMerged_, clientSize+rank, 0, &interComm) ; - MPI_Intercomm_merge(interComm, false, &winComm_[rank]) ; - CXios::getMpiGarbageCollector().registerCommunicator(winComm_[rank]) ; - MPI_Comm_free(&interComm) ; - windows_[rank].resize(2) ; - - MPI_Win_create_dynamic(MPI_INFO_NULL, winComm_[rank], &windows_[rank][0]); - CXios::getMpiGarbageCollector().registerWindow(windows_[rank][0]) ; - - MPI_Win_create_dynamic(MPI_INFO_NULL, winComm_[rank], &windows_[rank][1]); - CXios::getMpiGarbageCollector().registerWindow(windows_[rank][1]) ; - - CTimer::get("create Windows").suspend() ; - } - else - { - winComm_[rank] = MPI_COMM_NULL ; - windows_[rank].resize(2) ; - windows_[rank][0] = MPI_WIN_NULL ; - windows_[rank][1] = MPI_WIN_NULL ; - } - buffer->attachWindows(windows_[rank]) ; - if (!isAttachedModeEnabled()) MPI_Barrier(winComm_[rank]) ; - + CBufferOut* bufOut = buffer->getBuffer(sizeof(StdSize)); + bufOut->put(mapBufferSize_[rank]); // Stupid C++ + buffer->checkBuffer(); } /*! @@ -367,7 +297,7 @@ namespace xios map::iterator itBuff; bool pending = false; for (itBuff = buffers.begin(); itBuff != buffers.end(); itBuff++) - pending |= itBuff->second->checkBuffer(!pureOneSided); + pending |= itBuff->second->checkBuffer(); return pending; } @@ -377,45 +307,11 @@ namespace xios map::iterator itBuff; for (itBuff = buffers.begin(); itBuff != buffers.end(); itBuff++) { - delete itBuff->second; + delete itBuff->second; } buffers.clear(); - -// don't know when release windows - - //if (!isAttachedModeEnabled()) - //{ - // for(auto& it : winComm_) - // { - // int rank = it.first ; - // MPI_Win_free(&windows_[rank][0]); - // MPI_Win_free(&windows_[rank][1]); - // MPI_Comm_free(&winComm_[rank]) ; - // } - //} - } - - - /*! - Lock the buffers for one sided communications - \param [in] ranks list rank of server to which client connects to - */ - void CContextClient::lockBuffers(list& ranks) - { - list::iterator it; - for (it = ranks.begin(); it != ranks.end(); it++) buffers[*it]->lockBuffer(); } - /*! - Unlock the buffers for one sided communications - \param [in] ranks list rank of server to which client connects to - */ - void CContextClient::unlockBuffers(list& ranks) - { - list::iterator it; - for (it = ranks.begin(); it != ranks.end(); it++) buffers[*it]->unlockBuffer(); - } - /*! Verify state of buffers corresponding to a connection \param [in] ranks list rank of server to which client connects to @@ -425,7 +321,7 @@ namespace xios { list::iterator it; bool pending = false; - for (it = ranks.begin(); it != ranks.end(); it++) pending |= buffers[*it]->checkBuffer(!pureOneSided); + for (it = ranks.begin(); it != ranks.end(); it++) pending |= buffers[*it]->checkBuffer(); return pending; } @@ -435,10 +331,31 @@ namespace xios * \param [in] mapSize maps the rank of the connected servers to the size of the correspoinding buffer * \param [in] maxEventSize maps the rank of the connected servers to the size of the biggest event */ - void CContextClient::setBufferSize(const std::map& mapSize) + void CContextClient::setBufferSize(const std::map& mapSize, const std::map& maxEventSize) { - for(auto& it : mapSize) - buffers[it.first]->fixBufferSize(std::max(CXios::minBufferSize*1.0,std::min(it.second*CXios::bufferSizeFactor*1.01,CXios::maxBufferSize*1.0))); + mapBufferSize_ = mapSize; + maxEventSizes = maxEventSize; + + // Compute the maximum number of events that can be safely buffered. + double minBufferSizeEventSizeRatio = std::numeric_limits::max(); + for (std::map::const_iterator it = mapSize.begin(), ite = mapSize.end(); it != ite; ++it) + { + double ratio = double(it->second) / maxEventSizes[it->first]; + if (ratio < minBufferSizeEventSizeRatio) minBufferSizeEventSizeRatio = ratio; + } + MPI_Allreduce(MPI_IN_PLACE, &minBufferSizeEventSizeRatio, 1, MPI_DOUBLE, MPI_MIN, intraComm); + + if (minBufferSizeEventSizeRatio < 1.0) + { + ERROR("void CContextClient::setBufferSize(const std::map& mapSize, const std::map& maxEventSize)", + << "The buffer sizes and the maximum events sizes are incoherent."); + } + else if (minBufferSizeEventSizeRatio == std::numeric_limits::max()) + minBufferSizeEventSizeRatio = 1.0; // In this case, maxBufferedEvents will never be used but we want to avoid any floating point exception + + maxBufferedEvents = size_t(2 * minBufferSizeEventSizeRatio) // there is room for two local buffers on the server + + size_t(minBufferSizeEventSizeRatio) // one local buffer can always be fully used + + 1; // the other local buffer might contain only one event } /*! @@ -477,36 +394,56 @@ namespace xios return !ranksServerLeader.empty(); } + /*! + * Check if the attached mode is used. + * + * \return true if and only if attached mode is used + */ + bool CContextClient::isAttachedModeEnabled() const + { + return (parentServer != 0); + } + /*! * Finalize context client and do some reports. Function is non-blocking. */ void CContextClient::finalize(void) { map::iterator itBuff; - std::list::iterator ItServerLeader; - bool stop = false; - int* nbServerConnectionLocal = new int[serverSize] ; - int* nbServerConnectionGlobal = new int[serverSize] ; - for(int i=0;ifirst]=1 ; - for (ItServerLeader = ranksServerLeader.begin(); ItServerLeader != ranksServerLeader.end(); ItServerLeader++) nbServerConnectionLocal[*ItServerLeader]=1 ; - - MPI_Allreduce(nbServerConnectionLocal, nbServerConnectionGlobal, serverSize, MPI_INT, MPI_SUM, intraComm); - - CEventClient event(CContext::GetType(), CContext::EVENT_ID_CONTEXT_FINALIZE); - CMessage msg; - - for (int i=0;i& ranks = getRanksServerLeader(); + for (std::list::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) + { + info(100)<<"DEBUG : Sent context Finalize event to rank "<<*itRank<second->hasPendingRequest(); + } CTimer::get("Blocking time").suspend(); std::map::const_iterator itbMap = mapBufferSize_.begin(), @@ -515,12 +452,13 @@ namespace xios StdSize totalBuf = 0; for (itMap = itbMap; itMap != iteMap; ++itMap) { - report(10) << " Memory report : Context <" << context_->getId() << "> : client side : memory used for buffer of each connection to server" << endl + report(10) << " Memory report : Context <" << context->getId() << "> : client side : memory used for buffer of each connection to server" << endl << " +) To server with rank " << itMap->first << " : " << itMap->second << " bytes " << endl; totalBuf += itMap->second; } - report(0) << " Memory report : Context <" << context_->getId() << "> : client side : total memory used for buffer " << totalBuf << " bytes" << endl; + report(0) << " Memory report : Context <" << context->getId() << "> : client side : total memory used for buffer " << totalBuf << " bytes" << endl; + //releaseBuffers(); // moved to CContext::finalize() } @@ -534,24 +472,6 @@ namespace xios pending |= itBuff->second->hasPendingRequest(); return pending; } - - bool CContextClient::havePendingRequests(list& ranks) - { - list::iterator it; - bool pending = false; - for (it = ranks.begin(); it != ranks.end(); it++) pending |= buffers[*it]->hasPendingRequest(); - return pending; - } - - bool CContextClient::isNotifiedFinalized(void) - { - if (isAttachedModeEnabled()) return true ; - bool finalized = true; - map::iterator itBuff; - for (itBuff = buffers.begin(); itBuff != buffers.end(); itBuff++) - finalized &= itBuff->second->isNotifiedFinalized(); - return finalized; - } } diff --git a/xios_2311_src/src/context_client.hpp b/xios_2311_src/src/context_client.hpp index a997103cfc4e3d591ac81d012f627a1aa55f1f7a..4c40a4b010efaf81c34252b06ad061802af4a528 100644 --- a/xios_2311_src/src/context_client.hpp +++ b/xios_2311_src/src/context_client.hpp @@ -13,7 +13,7 @@ namespace xios { class CContext; - class CContextServer ; + /*! \class CContextClient A context can be both on client and on server side. In order to differenciate the role of @@ -30,29 +30,24 @@ namespace xios // Send event to server void sendEvent(CEventClient& event); + bool sendTemporarilyBufferedEvent(); void waitEvent(list& ranks); - void waitEvent_old(list& ranks); // Functions to set/get buffers - bool getBuffers(const size_t timeLine, const list& serverList, const list& sizeList, list& retBuffers, bool nonBlocking = false); + bool getBuffers(const list& serverList, const list& sizeList, list& retBuffers, bool nonBlocking = false); void newBuffer(int rank); bool checkBuffers(list& ranks); bool checkBuffers(void); void releaseBuffers(void); bool havePendingRequests(void); - bool havePendingRequests(list& ranks) ; bool isServerLeader(void) const; bool isServerNotLeader(void) const; const std::list& getRanksServerLeader(void) const; const std::list& getRanksServerNotLeader(void) const; - /*! - * Check if the attached mode is used. - * - * \return true if and only if attached mode is used - */ - bool isAttachedModeEnabled() const { return isAttached_ ; } + bool isAttachedModeEnabled() const; + bool hasTemporarilyBufferedEvent() const { return !tmpBufferedEvent.isEmpty(); }; static void computeLeader(int clientRank, int clientSize, int serverSize, std::list& rankRecvLeader, @@ -60,25 +55,12 @@ namespace xios // Close and finalize context client // void closeContext(void); Never been implemented. - bool isNotifiedFinalized(void) ; void finalize(void); - void setBufferSize(const std::map& mapSize); - - int getRemoteSize(void) {return serverSize;} - int getServerSize(void) {return serverSize;} - MPI_Comm getIntraComm(void) {return intraComm ;} - int getIntraCommSize(void) {return clientSize ;} - int getIntraCommRank(void) {return clientRank ;} + void setBufferSize(const std::map& mapSize, const std::map& maxEventSize); - /*! set the associated server (dual chanel client/server) */ - void setAssociatedServer(CContextServer* associatedServer) { associatedServer=associatedServer_;} - /*! get the associated server (dual chanel client/server) */ - CContextServer* getAssociatedServer(void) { return associatedServer_;} - void setGrowableBuffer(void) { isGrowableBuffer_=true;} - void setFixedBuffer(void) { isGrowableBuffer_=false;} public: - CContext* context_; //!< Context for client + CContext* context; //!< Context for client size_t timeLine; //!< Timeline of each event @@ -88,23 +70,13 @@ namespace xios int serverSize; //!< Size of server group - MPI_Comm interComm; //!< Communicator of server group (interCommunicator) - - MPI_Comm interCommMerged_; //!< Communicator of the client group + server group (intraCommunicator) needed for one sided communication. - MPI_Comm commSelf_ ; //!< Communicator for proc alone from interCommMerged + MPI_Comm interComm; //!< Communicator of server group MPI_Comm intraComm; //!< Communicator of client group map buffers; //!< Buffers for connection to servers - bool pureOneSided ; //!< if true, client will communicated with servers only trough one sided communication. Otherwise the hybrid mode P2P /One sided is used. - - size_t hashId_ ; //!< hash id on the context client that will be used for context server to identify the remote calling context client. - private: - void lockBuffers(list& ranks) ; - void unlockBuffers(list& ranks) ; - //! Mapping of server and buffer size for each connection to server std::map mapBufferSize_; //! Maximum event sizes estimated for each connection to server @@ -112,6 +84,22 @@ namespace xios //! Maximum number of events that can be buffered StdSize maxBufferedEvents; + struct { + std::list ranks, sizes; + std::list buffers; + + bool isEmpty() const { return ranks.empty(); }; + void clear() { + ranks.clear(); + sizes.clear(); + + for (std::list::iterator it = buffers.begin(); it != buffers.end(); it++) + delete *it; + + buffers.clear(); + }; + } tmpBufferedEvent; //! Event temporarily buffered (used only on the server) + //! Context for server (Only used in attached mode) CContext* parentServer; @@ -121,13 +109,6 @@ namespace xios //! List of server ranks for which the client is not leader std::list ranksServerNotLeader; - std::map winComm_ ; //! Window communicators - std::map >windows_ ; //! one sided mpi windows to expose client buffers to servers == windows[nbServers][2] - bool isAttached_ ; - CContextServer* associatedServer_ ; //!< The server associated to the pair client/server - bool isGrowableBuffer_ = true ; - - double latency_=0e-2 ; }; } diff --git a/xios_2311_src/src/context_server.cpp b/xios_2311_src/src/context_server.cpp index 61dc04a9fe970644cadc92e5a436f4d0fb611663..f4f3286936a695918eced11e2a43b51b86be079a 100644 --- a/xios_2311_src/src/context_server.cpp +++ b/xios_2311_src/src/context_server.cpp @@ -15,23 +15,14 @@ #include "cxios.hpp" #include "event_scheduler.hpp" #include "server.hpp" -#include "servers_ressource.hpp" -#include "pool_ressource.hpp" -#include "services.hpp" -#include "contexts_manager.hpp" -#include "timeline_events.hpp" - #include -#include -#include + namespace xios { - using namespace std ; - CContextServer::CContextServer(CContext* parent,MPI_Comm intraComm_,MPI_Comm interComm_) - : eventScheduler_(nullptr), isProcessingEvent_(false), associatedClient_(nullptr) + CContextServer::CContextServer(CContext* parent,MPI_Comm intraComm_,MPI_Comm interComm_) { context=parent; intraComm=intraComm_; @@ -41,54 +32,19 @@ namespace xios interComm=interComm_; int flag; MPI_Comm_test_inter(interComm,&flag); + if (flag) MPI_Comm_remote_size(interComm,&commSize); + else MPI_Comm_size(interComm,&commSize); - if (flag) attachedMode=false ; - else attachedMode=true ; - - if (flag) MPI_Comm_remote_size(interComm,&clientSize_); - else MPI_Comm_size(interComm,&clientSize_); - - - SRegisterContextInfo contextInfo ; - CXios::getContextsManager()->getContextInfo(context->getId(), contextInfo, intraComm) ; - - // if (contextInfo.serviceType != CServicesManager::CLIENT) // we must have an event scheduler => to be retrieve from the associated services - // { - //if (!isAttachedModeEnabled()) eventScheduler_=CXios::getPoolRessource()->getService(contextInfo.serviceId,contextInfo.partitionId)->getEventScheduler() ; - eventScheduler_=CXios::getPoolRessource()->getService(contextInfo.serviceId,contextInfo.partitionId)->getEventScheduler() ; - MPI_Comm_dup(intraComm, &processEventBarrier_) ; - // } - - - currentTimeLine=1; + currentTimeLine=0; scheduled=false; finished=false; - - // generate unique hash for server - auto time=chrono::system_clock::now().time_since_epoch().count() ; - std::default_random_engine rd(time); // not reproducible from a run to another - std::uniform_int_distribution dist; - hashId=dist(rd) ; - MPI_Bcast(&hashId,1,MPI_SIZE_T,0,intraComm) ; // Bcast to all server of the context - - - if (!isAttachedModeEnabled()) MPI_Intercomm_merge(interComm_,true,&interCommMerged_) ; - MPI_Comm_split(intraComm_, intraCommRank, intraCommRank, &commSelf_) ; // for windows - - itLastTimeLine=lastTimeLine.begin() ; - - pureOneSided=CXios::getin("pure_one_sided",false); // pure one sided communication (for test) - if (isAttachedModeEnabled()) pureOneSided=false ; // no one sided in attach mode - + boost::hash hashString; + if (CServer::serverLevel == 1) + hashId=hashString(context->getId() + boost::lexical_cast(context->clientPrimServer.size())); + else + hashId=hashString(context->getId()); } -//! Attached mode is used ? -//! \return true if attached mode is used, false otherwise - bool CContextServer::isAttachedModeEnabled() const - { - return attachedMode ; - } - void CContextServer::setPendingEvent(void) { pendingEvent=true; @@ -106,37 +62,51 @@ namespace xios bool CContextServer::eventLoop(bool enableEventsProcessing /*= true*/) { - CTimer::get("listen request").resume(); listen(); - CTimer::get("listen request").suspend(); - CTimer::get("check pending request").resume(); checkPendingRequest(); - checkPendingProbe() ; - CTimer::get("check pending request").suspend(); - CTimer::get("check event process").resume(); - if (enableEventsProcessing) processEvents(); - CTimer::get("check event process").suspend(); + if (enableEventsProcessing) + processEvents(); return finished; } - void CContextServer::listen(void) + void CContextServer::listen(void) { int rank; int flag; int count; char * addr; MPI_Status status; - MPI_Message message ; map::iterator it; bool okLoop; traceOff(); - MPI_Improbe(MPI_ANY_SOURCE, 20,interComm,&flag,&message, &status); + MPI_Iprobe(MPI_ANY_SOURCE, 20,interComm,&flag,&status); traceOn(); - if (flag==true) listenPendingRequest(message, status) ; + + if (flag==true) + { + rank=status.MPI_SOURCE ; + okLoop = true; + if (pendingRequest.find(rank)==pendingRequest.end()) + okLoop = !listenPendingRequest(status) ; + if (okLoop) + { + for(rank=0;rank winAdress(2) ; - winAdress[0]=recvBuff[2] ; winAdress[1]=recvBuff[3] ; - mapBufferSize_.insert(std::make_pair(rank, buffSize)); - - // create windows dynamically for one-sided - if (!isAttachedModeEnabled()) - { - CTimer::get("create Windows").resume() ; - MPI_Comm interComm ; - MPI_Intercomm_create(commSelf_, 0, interCommMerged_, rank, 0 , &interComm) ; - MPI_Intercomm_merge(interComm, true, &winComm_[rank]) ; - CXios::getMpiGarbageCollector().registerCommunicator(winComm_[rank]) ; - MPI_Comm_free(&interComm) ; - windows_[rank].resize(2) ; - MPI_Win_create_dynamic(MPI_INFO_NULL, winComm_[rank], &windows_[rank][0]); - CXios::getMpiGarbageCollector().registerWindow(windows_[rank][0]) ; - MPI_Win_create_dynamic(MPI_INFO_NULL, winComm_[rank], &windows_[rank][1]); - CXios::getMpiGarbageCollector().registerWindow(windows_[rank][1]) ; - CTimer::get("create Windows").suspend() ; - MPI_Barrier(winComm_[rank]) ; - } - else - { - winComm_[rank] = MPI_COMM_NULL ; - windows_[rank].resize(2) ; - windows_[rank][0] = MPI_WIN_NULL ; - windows_[rank][1] = MPI_WIN_NULL ; - } - - it=(buffers.insert(pair(rank,new CServerBuffer(windows_[rank], winAdress, 0, buffSize)))).first; - lastTimeLine[rank]=0 ; - itLastTimeLine=lastTimeLine.begin() ; - - return true; + StdSize buffSize = 0; + MPI_Recv(&buffSize, 1, MPI_LONG, rank, 20, interComm, &status); + mapBufferSize_.insert(std::make_pair(rank, buffSize)); + it=(buffers.insert(pair(rank,new CServerBuffer(buffSize)))).first; + return true; } else { - std::pair mypair(message,status) ; - pendingProbe[rank].push_back(mypair) ; - return false; - } - } - - void CContextServer::checkPendingProbe(void) - { - - list recvProbe ; - list::iterator itRecv ; - map > >::iterator itProbe; - - for(itProbe=pendingProbe.begin();itProbe!=pendingProbe.end();itProbe++) - { - int rank=itProbe->first ; - if (pendingRequest.count(rank)==0) + MPI_Get_count(&status,MPI_CHAR,&count); + if (it->second->isBufferFree(count)) { - MPI_Message& message = itProbe->second.front().first ; - MPI_Status& status = itProbe->second.front().second ; - int count ; - MPI_Get_count(&status,MPI_CHAR,&count); - map::iterator it = buffers.find(rank); - if ( (it->second->isBufferFree(count) && !it->second->isResizing()) // accept new request if buffer is free - || (it->second->isResizing() && it->second->isBufferEmpty()) ) // or if resizing wait for buffer is empty - { - char * addr; - addr=(char*)it->second->getBuffer(count); - MPI_Imrecv(addr,count,MPI_CHAR, &message, &pendingRequest[rank]); - bufferRequest[rank]=addr; - recvProbe.push_back(rank) ; - itProbe->second.pop_front() ; - } - } + addr=(char*)it->second->getBuffer(count); + MPI_Irecv(addr,count,MPI_CHAR,rank,20,interComm,&pendingRequest[rank]); + bufferRequest[rank]=addr; + return true; + } + else + return false; } - - for(itRecv=recvProbe.begin(); itRecv!=recvProbe.end(); itRecv++) if (pendingProbe[*itRecv].empty()) pendingProbe.erase(*itRecv) ; } @@ -236,9 +147,6 @@ namespace xios int flag; int count; MPI_Status status; - - if (!pendingRequest.empty()) CTimer::get("receiving requests").resume(); - else CTimer::get("receiving requests").suspend(); for(it=pendingRequest.begin();it!=pendingRequest.end();it++) { @@ -248,7 +156,6 @@ namespace xios traceOn(); if (flag==true) { - buffers[rank]->updateCurrentWindows() ; recvRequest.push_back(rank); MPI_Get_count(&status,MPI_CHAR,&count); processRequest(rank,bufferRequest[rank],count); @@ -262,41 +169,15 @@ namespace xios } } - void CContextServer::getBufferFromClient(size_t timeLine) - { - CTimer::get("CContextServer::getBufferFromClient").resume() ; - if (!isAttachedModeEnabled()) // one sided desactivated in attached mode - { - int rank ; - char *buffer ; - size_t count ; - - if (itLastTimeLine==lastTimeLine.end()) itLastTimeLine=lastTimeLine.begin() ; - for(;itLastTimeLine!=lastTimeLine.end();++itLastTimeLine) - { - rank=itLastTimeLine->first ; - if (itLastTimeLine->second < timeLine && pendingRequest.count(rank)==0 && buffers[rank]->isBufferEmpty()) - { - if (buffers[rank]->getBufferFromClient(timeLine, buffer, count)) processRequest(rank, buffer, count); - if (count >= 0) ++itLastTimeLine ; - break ; - } - } - } - CTimer::get("CContextServer::getBufferFromClient").suspend() ; - } - - void CContextServer::processRequest(int rank, char* buff,int count) { CBufferIn buffer(buff,count); char* startBuffer,endBuffer; int size, offset; - size_t timeLine=0; + size_t timeLine; map::iterator it; - CTimer::get("Process request").resume(); while(count>0) { @@ -304,37 +185,13 @@ namespace xios CBufferIn newBuffer(startBuffer,buffer.remain()); newBuffer>>size>>timeLine; - if (timeLine==timelineEventNotifyChangeBufferSize) - { - buffers[rank]->notifyBufferResizing() ; - buffers[rank]->updateCurrentWindows() ; - buffers[rank]->popBuffer(count) ; - info(100)<<"Context id "<getId()<<" : Receive NotifyChangeBufferSize from client rank "<isBufferEmpty()<<" remaining count : "<getUsed()< winAdress(2) ; - newBuffer>>newSize>>winAdress[0]>>winAdress[1] ; - buffers[rank]->freeBuffer(count) ; - delete buffers[rank] ; - buffers[rank] = new CServerBuffer(windows_[rank], winAdress, 0, newSize) ; - info(100)<<"Context id "<getId()<<" : Receive ChangeBufferSize from client rank "<getId()<<" : Receive standard event from client rank "<(timeLine,new CEventServer(this))).first; - it->second->push(rank,buffers[rank],startBuffer,size); - if (timeLine>0) lastTimeLine[rank]=timeLine ; - } + it=events.find(timeLine); + if (it==events.end()) it=events.insert(pair(timeLine,new CEventServer)).first; + it->second->push(rank,buffers[rank],startBuffer,size); + buffer.advance(size); count=buffer.remain(); } - CTimer::get("Process request").suspend(); } @@ -342,11 +199,6 @@ namespace xios { map::iterator it; CEventServer* event; - -// if (context->isProcessingEvent()) return ; - if (isProcessingEvent_) return ; - if (isAttachedModeEnabled()) - if (!CXios::getDaemonsManager()->isScheduledContext(remoteHashId_)) return ; it=events.find(currentTimeLine); if (it!=events.end()) @@ -355,92 +207,35 @@ namespace xios if (event->isFull()) { - if (!scheduled && !isAttachedModeEnabled()) // Skip event scheduling for attached mode and reception on client side + if (!scheduled && CServer::eventScheduler) // Skip event scheduling for attached mode and reception on client side { - eventScheduler_->registerEvent(currentTimeLine,hashId); + CServer::eventScheduler->registerEvent(currentTimeLine,hashId); scheduled=true; } - else if (isAttachedModeEnabled() || eventScheduler_->queryEvent(currentTimeLine,hashId) ) + else if (!CServer::eventScheduler || CServer::eventScheduler->queryEvent(currentTimeLine,hashId) ) { - - if (!eventScheduled_) - { - MPI_Ibarrier(processEventBarrier_,&processEventRequest_) ; - eventScheduled_=true ; - return ; - } - else - { - MPI_Status status ; - int flag ; - MPI_Test(&processEventRequest_, &flag, &status) ; - if (!flag) return ; - eventScheduled_=false ; - } - - if (!isAttachedModeEnabled()) eventScheduler_->popEvent() ; - //MPI_Barrier(intraComm) ; // When using attached mode, synchronise the processes to avoid that differents event be scheduled by differents processes // The best way to properly solve this problem will be to use the event scheduler also in attached mode // for now just set up a MPI barrier -//ym to be check later -// if (!eventScheduler_ && CXios::isServer) MPI_Barrier(intraComm) ; + if (!CServer::eventScheduler && CXios::isServer) MPI_Barrier(intraComm) ; -// context->setProcessingEvent() ; - isProcessingEvent_=true ; CTimer::get("Process events").resume(); - info(100)<<"Context id "<getId()<<" : Process Event "<classId<<" of type "<type<unsetProcessingEvent() ; pendingEvent=false; delete event; events.erase(it); currentTimeLine++; scheduled = false; - if (isAttachedModeEnabled()) CXios::getDaemonsManager()->unscheduleContext() ; } } - else if (pendingRequest.empty()) getBufferFromClient(currentTimeLine) ; } - else if (pendingRequest.empty()) getBufferFromClient(currentTimeLine) ; // if pure one sided check buffer even if no event recorded at current time line } CContextServer::~CContextServer() { map::iterator it; for(it=buffers.begin();it!=buffers.end();++it) delete it->second; - buffers.clear() ; - } - - void CContextServer::releaseBuffers() - { - //for(auto it=buffers.begin();it!=buffers.end();++it) delete it->second ; - //buffers.clear() ; - freeWindows() ; - } - - void CContextServer::freeWindows() - { - //if (!isAttachedModeEnabled()) - //{ - // for(auto& it : winComm_) - // { - // int rank = it.first ; - // MPI_Win_free(&windows_[rank][0]); - // MPI_Win_free(&windows_[rank][1]); - // MPI_Comm_free(&winComm_[rank]) ; - // } - //} - } - - void CContextServer::notifyClientsFinalize(void) - { - for(auto it=buffers.begin();it!=buffers.end();++it) - { - it->second->notifyClientFinalize() ; - } } void CContextServer::dispatchEvent(CEventServer& event) @@ -458,10 +253,7 @@ namespace xios { finished=true; info(20)<<" CContextServer: Receive context <"<getId()<<"> finalize."<finalize(); - std::map::const_iterator itbMap = mapBufferSize_.begin(), iteMap = mapBufferSize_.end(), itMap; for (itMap = itbMap; itMap != iteMap; ++itMap) @@ -494,10 +286,4 @@ namespace xios ERROR("void CContextServer::dispatchEvent(CEventServer& event)",<<" Bad event class Id"< buffers ; - map lastTimeLine ; //!< last event time line for a processed request - map::iterator itLastTimeLine ; //!< iterator on lastTimeLine - map > > pendingProbe; map pendingRequest ; map bufferRequest ; @@ -60,29 +43,12 @@ namespace xios bool finished ; bool pendingEvent ; bool scheduled ; /*!< event of current timeline is alreading scheduled ? */ - bool attachedMode ; //! true if attached mode is enabled otherwise false - bool pureOneSided ; //!< if true, client will communicated with servers only trough one sided communication. Otherwise the hybrid mode P2P /One sided is used. - size_t hashId ; - void setAssociatedClient(CContextClient* associatedClient) {associatedClient_=associatedClient ;} - CContextClient* getAssociatedClient(void) { return associatedClient_ ;} - ~CContextServer() ; private: - std::map mapBufferSize_; - std::map winComm_ ; //! Window communicators - std::map >windows_ ; //! one sided mpi windows to expose client buffers to servers ; No memory will be attached on server side. - CEventScheduler* eventScheduler_ ; - bool isProcessingEvent_ ; - CContextClient* associatedClient_ ; - size_t remoteHashId_; //!< the hash is of the calling context client - - MPI_Comm processEventBarrier_ ; - bool eventScheduled_=false; - MPI_Request processEventRequest_ ; } ; } diff --git a/xios_2311_src/src/cxios.cpp b/xios_2311_src/src/cxios.cpp index 31b982cd66bf4a37ad28f5f461b27c7302d6e8f9..25991bd7c7140de548bef977a99223f86649560c 100644 --- a/xios_2311_src/src/cxios.cpp +++ b/xios_2311_src/src/cxios.cpp @@ -10,10 +10,8 @@ #include #include "memtrack.hpp" #include "registry.hpp" -#include "ressources_manager.hpp" -#include "services_manager.hpp" -#include "servers_ressource.hpp" -#include "mem_checker.hpp" + +#include "graphviz.hpp" namespace xios { @@ -23,19 +21,13 @@ namespace xios string CXios::serverFile="./xios_server"; string CXios::serverPrmFile="./xios_server1"; string CXios::serverSndFile="./xios_server2"; - const string CXios::defaultPoolId="default_pool_id" ; - const string CXios::defaultServerId="default_server_id" ; - const string CXios::defaultGathererId="default_gatherer_id" ; - + bool CXios::xiosStack = true; bool CXios::systemStack = false; bool CXios::isClient ; bool CXios::isServer ; - MPI_Comm CXios::globalComm ; - MPI_Comm CXios::xiosComm ; - bool CXios::usingOasis ; bool CXios::usingServer = false; bool CXios::usingServer2 = false; @@ -43,23 +35,14 @@ namespace xios int CXios::nbPoolsServer2 = 1; double CXios::bufferSizeFactor = 1.0; const double CXios::defaultBufferSizeFactor = 1.0; - StdSize CXios::minBufferSize = 64 * sizeof(double); + StdSize CXios::minBufferSize = 1024 * sizeof(double); StdSize CXios::maxBufferSize = std::numeric_limits::max() ; bool CXios::printLogs2Files; bool CXios::isOptPerformance = true; CRegistry* CXios::globalRegistry = 0; double CXios::recvFieldTimeout = 300.0; bool CXios::checkEventSync=false ; - - CDaemonsManager* CXios::daemonsManager_=nullptr ; - CRessourcesManager* CXios::ressourcesManager_=nullptr ; - CServicesManager* CXios::servicesManager_=nullptr ; - CContextsManager* CXios::contextsManager_=nullptr ; - CCouplerManager* CXios::couplerManager_=nullptr ; - CRegistryManager* CXios::registryManager_=nullptr ; - - CMpiGarbageCollector CXios::MpiGarbageCollector_ ; - + //! Parse configuration file and create some objects from it void CXios::initialize() { @@ -125,9 +108,9 @@ namespace xios isClient = true; - //CClient::initialize(codeId,localComm,returnComm) ; CClient::initialize(codeId,localComm,returnComm) ; - + if (CClient::getRank()==0) globalRegistry = new CRegistry(returnComm) ; + // If there are no server processes then we are in attached mode // and the clients are also servers isServer = !usingServer; @@ -148,7 +131,14 @@ namespace xios void CXios::clientFinalize(void) { CClient::finalize() ; - + if (CClient::getRank()==0) + { + info(80)<<"Write data base Registry"<toString()<toFile("xios_registry.bin") ; + delete globalRegistry ; + CGraphviz::buildWorkflowGraphVisjs_with_info(); + } + #ifdef XIOS_MEMTRACK #ifdef XIOS_MEMTRACK_LIGHT @@ -157,20 +147,8 @@ namespace xios #endif #ifdef XIOS_MEMTRACK_FULL - report(0) << " Memory report : current memory used by XIOS : "<< MemTrack::getCurrentMemorySize()*1.0/(1024*1024)<<" Mbyte" << endl ; - report(0) << " Memory report : maximum memory used by XIOS : "<< MemTrack::getMaxMemorySize()*1.0/(1024*1024)<<" Mbyte" << endl ; - - ofstream memReport ; - std::filebuf* fb = memReport.rdbuf(); - CClient::openStream(clientFile, ".mem", fb); - - MemTrack::TrackListMemoryUsage() ; - size_t memtrack_blocks=0 ; - memtrack_blocks=xios::CXios::getin("memtrack_blocks",memtrack_blocks) ; - size_t memtrack_size=0 ; - memtrack_size=xios::CXios::getin("memtrack_size",memtrack_size) ; - MemTrack::TrackDumpBlocks(memReport, memtrack_blocks,memtrack_size); - memReport.close(); + MemTrack::TrackListMemoryUsage() ; + MemTrack::TrackDumpBlocks(); #endif CClient::closeInfoStream(); @@ -191,13 +169,110 @@ namespace xios //! Initialize server then put it into listening state void CXios::initServerSide(void) { - CMemChecker::get("xios").resume() ; initServer(); isClient = false; isServer = true; // Initialize all aspects MPI CServer::initialize(); + if (CServer::getRank()==0 && CServer::serverLevel != 1) globalRegistry = new CRegistry(CServer::intraComm) ; + + if (printLogs2Files) + { + if (CServer::serverLevel == 0) + { + CServer::openInfoStream(serverFile); + CServer::openErrorStream(serverFile); + } + else if (CServer::serverLevel == 1) + { + CServer::openInfoStream(serverPrmFile); + CServer::openErrorStream(serverPrmFile); + } + else + { + CServer::openInfoStream(serverSndFile); + CServer::openErrorStream(serverSndFile); + } + } + else + { + CServer::openInfoStream(); + CServer::openErrorStream(); + } + + // Enter the loop to listen message from Client + CServer::eventLoop(); + + // Finalize + if (CServer::serverLevel == 0) + { + if (CServer::getRank()==0) + { + info(80)<<"Write data base Registry"<toString()<toFile("xios_registry.bin") ; + delete globalRegistry ; + } + } + else + { + // If using two server levels: + // (1) merge registries on each pool + // (2) send merged registries to the first pool + // (3) merge received registries on the first pool + if (CServer::serverLevel == 2) + { + vector& secondaryServerGlobalRanks = CServer::getSecondaryServerGlobalRanks(); + int firstPoolGlobalRank = secondaryServerGlobalRanks[0]; + int rankGlobal; + MPI_Comm_rank(globalComm, &rankGlobal); + + // Merge registries defined on each pools + CRegistry globalRegistrySndServers (CServer::intraComm); + + // All pools (except the first): send globalRegistry to the first pool + for (int i=1; igetPoolRessource() ; - - MISSING_RETURN( "CPoolRessource* CXios::getPoolRessource()" ); - return nullptr; - } } - diff --git a/xios_2311_src/src/cxios.hpp b/xios_2311_src/src/cxios.hpp index bc26a7cb2ee664fe9446daef8f8462b2620a2565..0caa46c62db36bb45b392ebb3261aa0cfa7ecba4 100644 --- a/xios_2311_src/src/cxios.hpp +++ b/xios_2311_src/src/cxios.hpp @@ -4,13 +4,6 @@ #include "xios_spl.hpp" #include "mpi.hpp" #include "registry.hpp" -#include "ressources_manager.hpp" -#include "services_manager.hpp" -#include "contexts_manager.hpp" -#include "daemons_manager.hpp" -#include "coupler_manager.hpp" -#include "registry_manager.hpp" -#include "mpi_garbage_collector.hpp" namespace xios { @@ -47,7 +40,6 @@ namespace xios static bool isServer ; //!< Check if xios is server static MPI_Comm globalComm ; //!< Global communicator - static MPI_Comm xiosComm ; //!< Global communicator static bool printLogs2Files; //!< Printing out logs into files static bool usingOasis ; //!< Using Oasis @@ -63,62 +55,17 @@ namespace xios static CRegistry* globalRegistry ; //!< global registry which is wrote by the root process of the servers static double recvFieldTimeout; //!< Time to wait for data before issuing an error when receiving a field static bool checkEventSync; //!< For debuuging, check if event are coherent and synchrone on client side - - static const string defaultPoolId ; - static const string defaultServerId ; - static const string defaultGathererId ; - - static CRegistryManager* registryManager_ ; - static CRessourcesManager* ressourcesManager_ ; - static CCouplerManager* couplerManager_ ; - static CServicesManager* servicesManager_ ; - static CContextsManager* contextsManager_ ; - static CDaemonsManager* daemonsManager_ ; - static CMpiGarbageCollector MpiGarbageCollector_ ; - public: - static CMpiGarbageCollector& getMpiGarbageCollector(void) { return MpiGarbageCollector_ ; } public: //! Setting xios to use server mode static void setUsingServer(); //! Setting xios NOT to use server mode static void setNotUsingServer(); - - //! is using server mode - static bool isUsingServer() {return usingServer;} //! Initialize server (if any) static void initServer(); - static void launchServicesManager( bool isXiosServer) ; - static void launchContextsManager(bool isXiosServer) ; - static void launchDaemonsManager(bool isXiosServer) ; - static void launchRessourcesManager(bool isXiosServer) ; - static void launchCouplerManager(bool isXiosServer) ; - static void launchRegistryManager(bool isXiosServer) ; - - static void finalizeServicesManager() ; - static void finalizeContextsManager() ; - static void finalizeDaemonsManager() ; - static void finalizeRessourcesManager() ; - static void finalizeCouplerManager() ; - static void finalizeRegistryManager() ; - - static CRegistryManager* getRegistryManager(void) { return registryManager_ ;} - static CRessourcesManager* getRessourcesManager(void) { return ressourcesManager_ ;} - static CCouplerManager* getCouplerManager(void) { return couplerManager_ ;} - static CServicesManager* getServicesManager(void) { return servicesManager_ ;} - static CContextsManager* getContextsManager(void) { return contextsManager_ ;} - static CDaemonsManager* getDaemonsManager(void) { return daemonsManager_ ;} - static CPoolRessource* getPoolRessource(void) ; - - static MPI_Comm getGlobalComm(void) { return globalComm ;} - static MPI_Comm getXiosComm(void) { return xiosComm ;} - static void setXiosComm(MPI_Comm comm) { xiosComm=comm ;} - static CRegistry* getGlobalRegistry(void) { return globalRegistry ;} - static void setGlobalRegistry(CRegistry* registry) { globalRegistry=registry ;} - private: //! Parse only Xios part of configuration file static void parseXiosConfig(); diff --git a/xios_2311_src/src/data_input.cpp b/xios_2311_src/src/data_input.cpp index 8dea42052459061024efd091e7949e44af48f293..60df1b85cf7bde507ff38db656c94a13232d4bd5 100644 --- a/xios_2311_src/src/data_input.cpp +++ b/xios_2311_src/src/data_input.cpp @@ -18,9 +18,9 @@ namespace xios //---------------------------------------------------------------- - void CDataInput::readFieldData(CField* field, int record, CArray& data) + void CDataInput::readFieldData(CField* field) { - this->readFieldData_(field, record, data); + this->readFieldData_(field); } //---------------------------------------------------------------- diff --git a/xios_2311_src/src/data_input.hpp b/xios_2311_src/src/data_input.hpp index 303bce9ef05726735cf56269646ace3c274a0bc3..a48d71aa2d2da8d13ae1b4318e98db21d180980a 100644 --- a/xios_2311_src/src/data_input.hpp +++ b/xios_2311_src/src/data_input.hpp @@ -17,7 +17,7 @@ namespace xios /// Read methods /// StdSize getFieldNbRecords(CField* field); - void readFieldData(CField* field, int record, CArray& data); + void readFieldData(CField* field); void readFieldAttributesMetaData(CField* field); void readFieldAttributesValues(CField* field); void closeFile(void); @@ -26,7 +26,7 @@ namespace xios protected: virtual StdSize getFieldNbRecords_(CField* field) = 0; - virtual void readFieldData_(CField* field, int record, CArray& data) = 0; + virtual void readFieldData_(CField* field) = 0; virtual void readFieldAttributes_(CField* field, bool readAttributeValues) = 0; virtual void closeFile_(void) = 0; diff --git a/xios_2311_src/src/data_output.cpp b/xios_2311_src/src/data_output.cpp index 0de7ce4d011eff39493be13244c22059b26972d2..e36a5db3df124d20e3a9c9c05dc1530629ba8430 100644 --- a/xios_2311_src/src/data_output.cpp +++ b/xios_2311_src/src/data_output.cpp @@ -121,14 +121,15 @@ namespace xios CATCH //---------------------------------------------------------------- - int CDataOutput::writeFieldData(CField* field, const CArray& data, const CDate& lastWrite, const CDate& currentWrite, int nstep) + void CDataOutput::writeFieldData(CField* field) TRY { - return this->writeFieldData_(field, data, lastWrite, currentWrite, nstep); +// CGrid* grid = CGrid::get(field->grid_ref.getValue()); +// CDomain* domain = CDomain::get(grid->domain_ref.getValue()); + this->writeFieldData_(field); } CATCH - ///---------------------------------------------------------------- } // namespace xios diff --git a/xios_2311_src/src/data_output.hpp b/xios_2311_src/src/data_output.hpp index addccf90c696c10aff2b4e30504b97fd5131c787..d1e7080b91d47d72c4dd4406d1e04a23bf683c5a 100644 --- a/xios_2311_src/src/data_output.hpp +++ b/xios_2311_src/src/data_output.hpp @@ -27,7 +27,7 @@ namespace xios void writeFieldTimeAxis(CField* field) ; void writeFieldGrid(CField* field); void writeTimeDimension(void); - int writeFieldData(CField* field, const CArray& data, const CDate& lastWrite, const CDate& currentWrite, int nstep); + void writeFieldData(CField* field); virtual void definition_start(void) = 0; virtual void definition_end(void) = 0; @@ -51,7 +51,7 @@ namespace xios virtual void closeFile_ (void) = 0; virtual void syncFile_ (void) = 0; virtual void writeField_ (CField* field) = 0; - virtual int writeFieldData_ (CField* field, const CArray& data, const CDate& lastWrite, const CDate& currentWrite, int nstep) = 0; + virtual void writeFieldData_(CField* field) = 0; virtual void writeDomain_ (CDomain* domain) = 0; virtual void writeAxis_ (CAxis* axis) = 0; virtual void writeScalar_ (CScalar* scalar) = 0; diff --git a/xios_2311_src/src/declare_attribute.hpp b/xios_2311_src/src/declare_attribute.hpp index ab46661de1e78bb89db5e8cfdeaa45e54cea45d5..331c8a2bfce8cf8215e3a488cddefeaa89e2f487 100644 --- a/xios_2311_src/src/declare_attribute.hpp +++ b/xios_2311_src/src/declare_attribute.hpp @@ -41,7 +41,6 @@ { \ public : \ using CAttributeArray::operator = ; \ - bool alwaysFalse=false;\ name##_attr(void) : CAttributeArray (#name, *CAttributeMap::Current) {} \ virtual bool doSend() const { return helper(__VA_ARGS__); } \ bool helper(bool returnTrue=true) const { return returnTrue; } \ diff --git a/xios_2311_src/src/declare_ref_func.hpp b/xios_2311_src/src/declare_ref_func.hpp index b88f7f257ae71284d34f05c3c2a64b757544d625..0a22bac0faefc6fe885d6871f18de409753c16b1 100755 --- a/xios_2311_src/src/declare_ref_func.hpp +++ b/xios_2311_src/src/declare_ref_func.hpp @@ -49,8 +49,9 @@ void C##type::solveRefInheritance(bool apply) \ \ refObjects.push_back(refer_ptr); \ SuperClassAttribute::setAttributes(refer_ptr, apply); \ - if (apply) setInheritedId(refer_ptr) ; \ } \ + if (this->hasAttribute("name") && this->name.isEmpty()) \ + this->name.setValue(this->get##type##OutputName()); \ } \ \ void C##type::setAttributesReference(bool apply) \ diff --git a/xios_2311_src/src/distribution/client_client_dht_decl.cpp b/xios_2311_src/src/distribution/client_client_dht_decl.cpp deleted file mode 100644 index 6421db9a954faaf286141144f6c144194a64b836..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/client_client_dht_decl.cpp +++ /dev/null @@ -1,19 +0,0 @@ -/*! - \file client_client_dht.cpp - \author Ha NGUYEN - \since 05 Oct 2015 - \date 23 Mars 2016 - - \brief Distributed hashed table implementation. - */ -#include "client_client_dht_template_impl.hpp" - -namespace xios -{ - -template class CClientClientDHTTemplate; -template class CClientClientDHTTemplate; -template class CClientClientDHTTemplate; -template class CClientClientDHTTemplate; - -} diff --git a/xios_2311_src/src/distribution/client_client_dht_template.hpp b/xios_2311_src/src/distribution/client_client_dht_template.hpp deleted file mode 100644 index 2f8526121c94b4c8cbc1fa09f223bb8590cb2462..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/client_client_dht_template.hpp +++ /dev/null @@ -1,132 +0,0 @@ -/*! - \file client_client_dht_template.hpp - \author Ha NGUYEN - \since 01 Oct 2015 - \date 15 April 2016 - - \brief Distributed hashed table implementation. - */ - -#ifndef __XIOS_CLIENT_CLIENT_DHT_TEMPLATE_HPP__ -#define __XIOS_CLIENT_CLIENT_DHT_TEMPLATE_HPP__ - -#include "xios_spl.hpp" -#include "array_new.hpp" -#include "mpi.hpp" -#include "policy.hpp" -#include -#include "dht_data_types.hpp" - -namespace xios -{ -template class CClientClientDHTTemplate; - -/*! - \class CClientClientDHTTemplate - This class provides the similar features like \class CClientServerMappingDistributed, -which implements a simple distributed hashed table; Moreover, by extending with hierarchical structure, -it allows to reduce greatly the number of communication among processes. -*/ -template -class CClientClientDHTTemplate: public HierarchyPolicy -{ - public: - typedef T InfoType; - static const int infoTypeSize = sizeof(InfoType); -// typedef typename std::unordered_map > InfoType2IndexMap; - typedef typename std::unordered_map Index2InfoTypeMap; - typedef typename std::unordered_map > Index2VectorInfoTypeMap; - - public: - CClientClientDHTTemplate(const Index2InfoTypeMap& indexInfoInitMap, - const MPI_Comm& clientIntraComm); - - CClientClientDHTTemplate(const Index2VectorInfoTypeMap& indexInfoInitMap, - const MPI_Comm& clientIntraComm); - - void computeIndexInfoMapping(const CArray& indices); - - const Index2VectorInfoTypeMap& getInfoIndexMap() const {return indexToInfoMappingLevel_; } - Index2VectorInfoTypeMap& getInfoIndexMap() {return indexToInfoMappingLevel_; } - int getNbClient() { return nbClient_; } - - /** Default destructor */ - virtual ~CClientClientDHTTemplate(); - - protected: - CClientClientDHTTemplate(const MPI_Comm& clientIntraComm); - - protected: - - - // Redistribute index and info among clients - void computeDistributedIndex(const Index2InfoTypeMap& indexInfoInitMap, - const MPI_Comm& intraCommLevel, - int level); - - void computeDistributedIndex(const Index2VectorInfoTypeMap& indexInfoInitMap, - const MPI_Comm& intraCommLevel, - int level); - - - void computeHashIndex(std::vector& indexClientHash, int nbClient); - - void computeIndexInfoMappingLevel(const CArray& indices, - const MPI_Comm& intraCommLevel, - int level); - - void computeSendRecvRank(int level, int rank); - - void sendRecvRank(int level, - const std::vector& sendNbRank, const std::vector& sendNbElements, - std::vector& recvNbRank, std::vector& recvNbElements); - - protected: - // Send information to clients - void sendInfoToClients(int clientDestRank, unsigned char* info, int infoSize, - const MPI_Comm& clientIntraComm, - std::vector& requestSendInfo); - - void recvInfoFromClients(int clientSrcRank, unsigned char* info, int infoSize, - const MPI_Comm& clientIntraComm, - std::vector& requestRecvInfo); - - // Send global index to clients - void sendIndexToClients(int clientDestRank, size_t* indices, size_t indiceSize, - const MPI_Comm& clientIntraComm, - std::vector& requestSendIndexGlobal); - - void recvIndexFromClients(int clientSrcRank, size_t* indices, size_t indiceSize, - const MPI_Comm& clientIntraComm, - std::vector& requestRecvIndex); - - void sendRecvOnReturn(const std::vector& sendNbRank, std::vector& sendNbElements, - const std::vector& recvNbRank, std::vector& recvNbElements); - - protected: - //! Mapping of global index to the corresponding client - Index2VectorInfoTypeMap index2InfoMapping_; - - //! A mapping of index to the corresponding information in each level of hierarchy - Index2VectorInfoTypeMap indexToInfoMappingLevel_; - - //! Rank of client to send on each DHT level - std::vector > sendRank_; - - //! Rank of client to receive on each DHT level - std::vector > recvRank_; - - //! Flag to specify whether data is distributed or not - bool isDataDistributed_; - - //! Number of client - int nbClient_; -}; - -typedef CClientClientDHTTemplate CClientClientDHTInt; -typedef CClientClientDHTTemplate CClientClientDHTSizet; -typedef CClientClientDHTTemplate CClientClientDHTDouble; -typedef CClientClientDHTTemplate CClientClientDHTPairIntInt; - -} // namespace xios -#endif // __XIOS_CLIENT_CLIENT_DHT_TEMPLATE_HPP__ diff --git a/xios_2311_src/src/distribution/client_client_dht_template_impl.hpp b/xios_2311_src/src/distribution/client_client_dht_template_impl.hpp deleted file mode 100644 index 3e7d8d8c0d345200f57460136ed021148bdcdadd..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/client_client_dht_template_impl.hpp +++ /dev/null @@ -1,737 +0,0 @@ -/*! - \file client_client_dht_template_impl.hpp - \author Ha NGUYEN - \since 05 Oct 2015 - \date 23 Mars 2016 - - \brief Distributed hashed table implementation. - */ -#include "client_client_dht_template.hpp" -#include "utils.hpp" -#include "mpi_tag.hpp" - -namespace xios -{ -template -CClientClientDHTTemplate::CClientClientDHTTemplate(const MPI_Comm& clientIntraComm) - : H(clientIntraComm), index2InfoMapping_(), indexToInfoMappingLevel_(), nbClient_(0) -{ - MPI_Comm_size(clientIntraComm, &nbClient_); - this->computeMPICommLevel(); - int nbLvl = this->getNbLevel(); - sendRank_.resize(nbLvl); - recvRank_.resize(nbLvl); -} - -/*! - Constructor with initial distribution information and the corresponding index - Each client (process) holds a piece of information as well as the attached index, the index -will be redistributed (projected) into size_t space as long as the associated information. - \param [in] indexInfoMap initial index and information mapping - \param [in] clientIntraComm communicator of clients - \param [in] hierarLvl level of hierarchy -*/ -template -CClientClientDHTTemplate::CClientClientDHTTemplate(const Index2InfoTypeMap& indexInfoMap, - const MPI_Comm& clientIntraComm) - : H(clientIntraComm), index2InfoMapping_(), indexToInfoMappingLevel_(), nbClient_(0) -{ - MPI_Comm_size(clientIntraComm, &nbClient_); - this->computeMPICommLevel(); - int nbLvl = this->getNbLevel(); - sendRank_.resize(nbLvl); - recvRank_.resize(nbLvl); - Index2VectorInfoTypeMap indexToVecInfoMap; - indexToVecInfoMap.rehash(std::ceil(indexInfoMap.size()/indexToVecInfoMap.max_load_factor())); - typename Index2InfoTypeMap::const_iterator it = indexInfoMap.begin(), ite = indexInfoMap.end(); - for (; it != ite; ++it) indexToVecInfoMap[it->first].push_back(it->second); - computeDistributedIndex(indexToVecInfoMap, clientIntraComm, nbLvl-1); -} - -/*! - Constructor with initial distribution information and the corresponding index - Each client (process) holds a piece of information as well as the attached index, the index -will be redistributed (projected) into size_t space as long as the associated information. - \param [in] indexInfoMap initial index and information mapping - \param [in] clientIntraComm communicator of clients - \param [in] hierarLvl level of hierarchy -*/ -template -CClientClientDHTTemplate::CClientClientDHTTemplate(const Index2VectorInfoTypeMap& indexInfoMap, - const MPI_Comm& clientIntraComm) - : H(clientIntraComm), index2InfoMapping_(), indexToInfoMappingLevel_(), nbClient_(0) -{ - MPI_Comm_size(clientIntraComm, &nbClient_); - this->computeMPICommLevel(); - int nbLvl = this->getNbLevel(); - sendRank_.resize(nbLvl); - recvRank_.resize(nbLvl); - computeDistributedIndex(indexInfoMap, clientIntraComm, nbLvl-1); -} - -template -CClientClientDHTTemplate::~CClientClientDHTTemplate() -{ -} - -/*! - Compute mapping between indices and information corresponding to these indices - \param [in] indices indices a proc has -*/ -template -void CClientClientDHTTemplate::computeIndexInfoMapping(const CArray& indices) -{ - int nbLvl = this->getNbLevel(); - computeIndexInfoMappingLevel(indices, this->internalComm_, nbLvl-1); -} - -/*! - Compute mapping between indices and information corresponding to these indices -for each level of hierarchical DHT. Recursive function - \param [in] indices indices a proc has - \param [in] commLevel communicator of current level - \param [in] level current level -*/ -template -void CClientClientDHTTemplate::computeIndexInfoMappingLevel(const CArray& indices, - const MPI_Comm& commLevel, - int level) -{ - int clientRank; - MPI_Comm_rank(commLevel,&clientRank); - int groupRankBegin = this->getGroupBegin()[level]; - int nbClient = this->getNbInGroup()[level]; - std::vector hashedIndex; - computeHashIndex(hashedIndex, nbClient); - - size_t ssize = indices.numElements(), hashedVal; - - std::vector::const_iterator itbClientHash = hashedIndex.begin(), itClientHash, - iteClientHash = hashedIndex.end(); - std::vector sendBuff(nbClient,0); - std::vector sendNbIndexBuff(nbClient,0); - - // Number of global index whose mapping server are on other clients - int nbIndexToSend = 0; - size_t index; - HashXIOS hashGlobalIndex; - std::unordered_map nbIndices; - nbIndices.rehash(std::ceil(ssize/nbIndices.max_load_factor())); - for (int i = 0; i < ssize; ++i) - { - index = indices(i); - if (0 == nbIndices.count(index)) - { - hashedVal = hashGlobalIndex(index); - itClientHash = std::upper_bound(itbClientHash, iteClientHash, hashedVal); - int indexClient = std::distance(itbClientHash, itClientHash)-1; - ++sendNbIndexBuff[indexClient]; - nbIndices[index] = 1; - } - } - - std::unordered_map client2ClientIndex; - for (int idx = 0; idx < nbClient; ++idx) - { - if (0 != sendNbIndexBuff[idx]) - { - client2ClientIndex[idx+groupRankBegin] = new unsigned long [sendNbIndexBuff[idx]]; - nbIndexToSend += sendNbIndexBuff[idx]; - sendBuff[idx] = 1; - sendNbIndexBuff[idx] = 0; - } - } - - for (int i = 0; i < ssize; ++i) - { - index = indices(i); - if (1 == nbIndices[index]) - { - hashedVal = hashGlobalIndex(index); - itClientHash = std::upper_bound(itbClientHash, iteClientHash, hashedVal); - int indexClient = std::distance(itbClientHash, itClientHash)-1; - client2ClientIndex[indexClient+groupRankBegin][sendNbIndexBuff[indexClient]] = index; - ++sendNbIndexBuff[indexClient]; - ++nbIndices[index]; - } - } - - std::vector recvRankClient, recvNbIndexClientCount; - sendRecvRank(level, sendBuff, sendNbIndexBuff, - recvRankClient, recvNbIndexClientCount); - - int recvNbIndexCount = 0; - for (int idx = 0; idx < recvNbIndexClientCount.size(); ++idx) - recvNbIndexCount += recvNbIndexClientCount[idx]; - - unsigned long* recvIndexBuff; - if (0 != recvNbIndexCount) - recvIndexBuff = new unsigned long[recvNbIndexCount]; - - std::vector request; - std::vector::iterator itbRecvIndex = recvRankClient.begin(), itRecvIndex, - iteRecvIndex = recvRankClient.end(), - itbRecvNbIndex = recvNbIndexClientCount.begin(), - itRecvNbIndex; - int currentIndex = 0; - int nbRecvClient = recvRankClient.size(); - for (int idx = 0; idx < nbRecvClient; ++idx) - { - if (0 != recvNbIndexClientCount[idx]) - recvIndexFromClients(recvRankClient[idx], recvIndexBuff+currentIndex, recvNbIndexClientCount[idx], commLevel, request); - currentIndex += recvNbIndexClientCount[idx]; - } - - std::unordered_map::iterator itbIndex = client2ClientIndex.begin(), itIndex, - iteIndex = client2ClientIndex.end(); - for (itIndex = itbIndex; itIndex != iteIndex; ++itIndex) - sendIndexToClients(itIndex->first, (itIndex->second), sendNbIndexBuff[itIndex->first-groupRankBegin], commLevel, request); - - std::vector status(request.size()); - MPI_Waitall(request.size(), &request[0], &status[0]); - - CArray* tmpGlobalIndex; - if (0 != recvNbIndexCount) - tmpGlobalIndex = new CArray(recvIndexBuff, shape(recvNbIndexCount), neverDeleteData); - else - tmpGlobalIndex = new CArray(); - - // OK, we go to the next level and do something recursive - if (0 < level) - { - --level; - computeIndexInfoMappingLevel(*tmpGlobalIndex, this->internalComm_, level); - } - else // Now, we are in the last level where necessary mappings are. - indexToInfoMappingLevel_= (index2InfoMapping_); - - typename Index2VectorInfoTypeMap::const_iterator iteIndexToInfoMap = indexToInfoMappingLevel_.end(), itIndexToInfoMap; - std::vector sendNbIndexOnReturn(nbRecvClient,0); - currentIndex = 0; - for (int idx = 0; idx < nbRecvClient; ++idx) - { - for (int i = 0; i < recvNbIndexClientCount[idx]; ++i) - { - itIndexToInfoMap = indexToInfoMappingLevel_.find(*(recvIndexBuff+currentIndex+i)); - if (iteIndexToInfoMap != itIndexToInfoMap) - sendNbIndexOnReturn[idx] += itIndexToInfoMap->second.size(); - } - currentIndex += recvNbIndexClientCount[idx]; - } - - std::vector recvRankOnReturn(client2ClientIndex.size()); - std::vector recvNbIndexOnReturn(client2ClientIndex.size(),0); - int indexIndex = 0; - for (itIndex = itbIndex; itIndex != iteIndex; ++itIndex, ++indexIndex) - { - recvRankOnReturn[indexIndex] = itIndex->first; - } - sendRecvOnReturn(recvRankClient, sendNbIndexOnReturn, - recvRankOnReturn, recvNbIndexOnReturn); - - int recvNbIndexCountOnReturn = 0; - for (int idx = 0; idx < recvRankOnReturn.size(); ++idx) - recvNbIndexCountOnReturn += recvNbIndexOnReturn[idx]; - - unsigned long* recvIndexBuffOnReturn; - unsigned char* recvInfoBuffOnReturn; - if (0 != recvNbIndexCountOnReturn) - { - recvIndexBuffOnReturn = new unsigned long[recvNbIndexCountOnReturn]; - recvInfoBuffOnReturn = new unsigned char[recvNbIndexCountOnReturn*ProcessDHTElement::typeSize()]; - } - - std::vector requestOnReturn; - currentIndex = 0; - for (int idx = 0; idx < recvRankOnReturn.size(); ++idx) - { - if (0 != recvNbIndexOnReturn[idx]) - { - recvIndexFromClients(recvRankOnReturn[idx], recvIndexBuffOnReturn+currentIndex, recvNbIndexOnReturn[idx], commLevel, requestOnReturn); - recvInfoFromClients(recvRankOnReturn[idx], - recvInfoBuffOnReturn+currentIndex*ProcessDHTElement::typeSize(), - recvNbIndexOnReturn[idx]*ProcessDHTElement::typeSize(), - commLevel, requestOnReturn); - } - currentIndex += recvNbIndexOnReturn[idx]; - } - - std::unordered_map client2ClientInfoOnReturn; - std::unordered_map client2ClientIndexOnReturn; - currentIndex = 0; - for (int idx = 0; idx < nbRecvClient; ++idx) - { - if (0 != sendNbIndexOnReturn[idx]) - { - int rank = recvRankClient[idx]; - client2ClientIndexOnReturn[rank] = new unsigned long [sendNbIndexOnReturn[idx]]; - client2ClientInfoOnReturn[rank] = new unsigned char [sendNbIndexOnReturn[idx]*ProcessDHTElement::typeSize()]; - unsigned char* tmpInfoPtr = client2ClientInfoOnReturn[rank]; - int infoIndex = 0; - int nb = 0; - for (int i = 0; i < recvNbIndexClientCount[idx]; ++i) - { - itIndexToInfoMap = indexToInfoMappingLevel_.find(*(recvIndexBuff+currentIndex+i)); - if (iteIndexToInfoMap != itIndexToInfoMap) - { - const std::vector& infoTmp = itIndexToInfoMap->second; - for (int k = 0; k < infoTmp.size(); ++k) - { - client2ClientIndexOnReturn[rank][nb] = itIndexToInfoMap->first; - ProcessDHTElement::packElement(infoTmp[k], tmpInfoPtr, infoIndex); - ++nb; - } - } - } - - sendIndexToClients(rank, client2ClientIndexOnReturn[rank], - sendNbIndexOnReturn[idx], commLevel, requestOnReturn); - sendInfoToClients(rank, client2ClientInfoOnReturn[rank], - sendNbIndexOnReturn[idx]*ProcessDHTElement::typeSize(), commLevel, requestOnReturn); - } - currentIndex += recvNbIndexClientCount[idx]; - } - - std::vector statusOnReturn(requestOnReturn.size()); - MPI_Waitall(requestOnReturn.size(), &requestOnReturn[0], &statusOnReturn[0]); - - Index2VectorInfoTypeMap indexToInfoMapping; - indexToInfoMapping.rehash(std::ceil(recvNbIndexCountOnReturn/indexToInfoMapping.max_load_factor())); - int infoIndex = 0; - InfoType unpackedInfo; - for (int idx = 0; idx < recvNbIndexCountOnReturn; ++idx) - { - ProcessDHTElement::unpackElement(unpackedInfo, recvInfoBuffOnReturn, infoIndex); - indexToInfoMapping[recvIndexBuffOnReturn[idx]].push_back(unpackedInfo); - } - - indexToInfoMappingLevel_.swap(indexToInfoMapping); - if (0 != recvNbIndexCount) delete [] recvIndexBuff; - for (std::unordered_map::const_iterator it = client2ClientIndex.begin(); - it != client2ClientIndex.end(); ++it) - delete [] it->second; - delete tmpGlobalIndex; - - if (0 != recvNbIndexCountOnReturn) - { - delete [] recvIndexBuffOnReturn; - delete [] recvInfoBuffOnReturn; - } - - for (std::unordered_map::const_iterator it = client2ClientInfoOnReturn.begin(); - it != client2ClientInfoOnReturn.end(); ++it) - delete [] it->second; - - for (std::unordered_map::const_iterator it = client2ClientIndexOnReturn.begin(); - it != client2ClientIndexOnReturn.end(); ++it) - delete [] it->second; -} - -/*! - Compute the hash index distribution of whole size_t space then each client will have a range of this distribution -*/ -template -void CClientClientDHTTemplate::computeHashIndex(std::vector& hashedIndex, int nbClient) -{ - // Compute range of hash index for each client - hashedIndex.resize(nbClient+1); - size_t nbHashIndexMax = std::numeric_limits::max(); - size_t nbHashIndex; - hashedIndex[0] = 0; - for (int i = 1; i < nbClient; ++i) - { - nbHashIndex = nbHashIndexMax / nbClient; - if (i < (nbHashIndexMax%nbClient)) ++nbHashIndex; - hashedIndex[i] = hashedIndex[i-1] + nbHashIndex; - } - hashedIndex[nbClient] = nbHashIndexMax; -} - -/*! - Compute distribution of global index for servers - Each client already holds a piece of information and its associated index. -This information will be redistributed among processes by projecting indices into size_t space, -the corresponding information will be also distributed on size_t space. -After the redistribution, each client holds rearranged index and its corresponding information. - \param [in] indexInfoMap index and its corresponding info (usually server index) - \param [in] commLevel communicator of current level - \param [in] level current level -*/ -template -void CClientClientDHTTemplate::computeDistributedIndex(const Index2VectorInfoTypeMap& indexInfoMap, - const MPI_Comm& commLevel, - int level) -{ - int clientRank; - MPI_Comm_rank(commLevel,&clientRank); - computeSendRecvRank(level, clientRank); - - int groupRankBegin = this->getGroupBegin()[level]; - int nbClient = this->getNbInGroup()[level]; - std::vector hashedIndex; - computeHashIndex(hashedIndex, nbClient); - - std::vector sendBuff(nbClient,0); - std::vector sendNbIndexBuff(nbClient,0); - std::vector::const_iterator itbClientHash = hashedIndex.begin(), itClientHash, - iteClientHash = hashedIndex.end(); - typename Index2VectorInfoTypeMap::const_iterator itb = indexInfoMap.begin(),it, - ite = indexInfoMap.end(); - HashXIOS hashGlobalIndex; - - // Compute size of sending and receving buffer - for (it = itb; it != ite; ++it) - { - size_t hashIndex = hashGlobalIndex(it->first); - itClientHash = std::upper_bound(itbClientHash, iteClientHash, hashIndex); - int indexClient = std::distance(itbClientHash, itClientHash)-1; - sendNbIndexBuff[indexClient] += it->second.size(); - } - - std::unordered_map client2ClientIndex; - std::unordered_map client2ClientInfo; - for (int idx = 0; idx < nbClient; ++idx) - { - if (0 != sendNbIndexBuff[idx]) - { - client2ClientIndex[idx+groupRankBegin] = new unsigned long [sendNbIndexBuff[idx]]; - client2ClientInfo[idx+groupRankBegin] = new unsigned char [sendNbIndexBuff[idx]*ProcessDHTElement::typeSize()]; - sendNbIndexBuff[idx] = 0; - sendBuff[idx] = 1; - } - } - - std::vector sendNbInfo(nbClient,0); - for (it = itb; it != ite; ++it) - { - const std::vector& infoTmp = it->second; - size_t hashIndex = hashGlobalIndex(it->first); - itClientHash = std::upper_bound(itbClientHash, iteClientHash, hashIndex); - int indexClient = std::distance(itbClientHash, itClientHash)-1; - for (int idx = 0; idx < infoTmp.size(); ++idx) - { - client2ClientIndex[indexClient + groupRankBegin][sendNbIndexBuff[indexClient]] = it->first;; - // ProcessDHTElement::packElement(it->second, client2ClientInfo[indexClient + groupRankBegin], sendNbInfo[indexClient]); - ProcessDHTElement::packElement(infoTmp[idx], client2ClientInfo[indexClient + groupRankBegin], sendNbInfo[indexClient]); - ++sendNbIndexBuff[indexClient]; - } - } - - // Calculate from how many clients each client receive message. - // Calculate size of buffer for receiving message - std::vector recvRankClient, recvNbIndexClientCount; - sendRecvRank(level, sendBuff, sendNbIndexBuff, - recvRankClient, recvNbIndexClientCount); - - int recvNbIndexCount = 0; - for (int idx = 0; idx < recvNbIndexClientCount.size(); ++idx) - recvNbIndexCount += recvNbIndexClientCount[idx]; - - unsigned long* recvIndexBuff; - unsigned char* recvInfoBuff; - if (0 != recvNbIndexCount) - { - recvIndexBuff = new unsigned long[recvNbIndexCount]; - recvInfoBuff = new unsigned char[recvNbIndexCount*ProcessDHTElement::typeSize()]; - } - - // If a client holds information about index and the corresponding which don't belong to it, - // it will send a message to the correct clients. - // Contents of the message are index and its corresponding informatioin - std::vector request; - int currentIndex = 0; - int nbRecvClient = recvRankClient.size(); - for (int idx = 0; idx < nbRecvClient; ++idx) - { - if (0 != recvNbIndexClientCount[idx]) - { - recvIndexFromClients(recvRankClient[idx], recvIndexBuff+currentIndex, recvNbIndexClientCount[idx], commLevel, request); - recvInfoFromClients(recvRankClient[idx], - recvInfoBuff+currentIndex*ProcessDHTElement::typeSize(), - recvNbIndexClientCount[idx]*ProcessDHTElement::typeSize(), - commLevel, request); - } - currentIndex += recvNbIndexClientCount[idx]; - } - - std::unordered_map::iterator itbIndex = client2ClientIndex.begin(), itIndex, - iteIndex = client2ClientIndex.end(); - for (itIndex = itbIndex; itIndex != iteIndex; ++itIndex) - sendIndexToClients(itIndex->first, itIndex->second, sendNbIndexBuff[itIndex->first-groupRankBegin], commLevel, request); - std::unordered_map::iterator itbInfo = client2ClientInfo.begin(), itInfo, - iteInfo = client2ClientInfo.end(); - for (itInfo = itbInfo; itInfo != iteInfo; ++itInfo) - sendInfoToClients(itInfo->first, itInfo->second, sendNbInfo[itInfo->first-groupRankBegin], commLevel, request); - - std::vector status(request.size()); - MPI_Waitall(request.size(), &request[0], &status[0]); - - Index2VectorInfoTypeMap indexToInfoMapping; - indexToInfoMapping.rehash(std::ceil(currentIndex/indexToInfoMapping.max_load_factor())); - currentIndex = 0; - InfoType infoValue; - int infoIndex = 0; - unsigned char* infoBuff = recvInfoBuff; - for (int idx = 0; idx < nbRecvClient; ++idx) - { - size_t index; - int count = recvNbIndexClientCount[idx]; - for (int i = 0; i < count; ++i) - { - ProcessDHTElement::unpackElement(infoValue, infoBuff, infoIndex); - indexToInfoMapping[*(recvIndexBuff+currentIndex+i)].push_back(infoValue); - } - currentIndex += count; - } - - if (0 != recvNbIndexCount) - { - delete [] recvIndexBuff; - delete [] recvInfoBuff; - } - for (std::unordered_map::const_iterator it = client2ClientInfo.begin(); - it != client2ClientInfo.end(); ++it) - delete [] it->second; - - for (std::unordered_map::const_iterator it = client2ClientIndex.begin(); - it != client2ClientIndex.end(); ++it) - delete [] it->second; - - // Ok, now do something recursive - if (0 < level) - { - --level; - computeDistributedIndex(indexToInfoMapping, this->internalComm_, level); - } - else - index2InfoMapping_.swap(indexToInfoMapping); -} - -/*! - Send message containing index to clients - \param [in] clientDestRank rank of destination client - \param [in] indices index to send - \param [in] indiceSize size of index array to send - \param [in] clientIntraComm communication group of client - \param [in] requestSendIndex list of sending request -*/ -template -void CClientClientDHTTemplate::sendIndexToClients(int clientDestRank, size_t* indices, size_t indiceSize, - const MPI_Comm& clientIntraComm, - std::vector& requestSendIndex) -{ - MPI_Request request; - requestSendIndex.push_back(request); - MPI_Isend(indices, indiceSize, MPI_UNSIGNED_LONG, - clientDestRank, MPI_DHT_INDEX, clientIntraComm, &(requestSendIndex.back())); -} - -/*! - Receive message containing index to clients - \param [in] clientDestRank rank of destination client - \param [in] indices index to send - \param [in] clientIntraComm communication group of client - \param [in] requestRecvIndex list of receiving request -*/ -template -void CClientClientDHTTemplate::recvIndexFromClients(int clientSrcRank, size_t* indices, size_t indiceSize, - const MPI_Comm& clientIntraComm, - std::vector& requestRecvIndex) -{ - MPI_Request request; - requestRecvIndex.push_back(request); - MPI_Irecv(indices, indiceSize, MPI_UNSIGNED_LONG, - clientSrcRank, MPI_DHT_INDEX, clientIntraComm, &(requestRecvIndex.back())); -} - -/*! - Send message containing information to clients - \param [in] clientDestRank rank of destination client - \param [in] info info array to send - \param [in] infoSize info array size to send - \param [in] clientIntraComm communication group of client - \param [in] requestSendInfo list of sending request -*/ -template -void CClientClientDHTTemplate::sendInfoToClients(int clientDestRank, unsigned char* info, int infoSize, - const MPI_Comm& clientIntraComm, - std::vector& requestSendInfo) -{ - MPI_Request request; - requestSendInfo.push_back(request); - - MPI_Isend(info, infoSize, MPI_CHAR, - clientDestRank, MPI_DHT_INFO, clientIntraComm, &(requestSendInfo.back())); -} - -/*! - Receive message containing information from other clients - \param [in] clientDestRank rank of destination client - \param [in] info info array to receive - \param [in] infoSize info array size to receive - \param [in] clientIntraComm communication group of client - \param [in] requestRecvInfo list of sending request -*/ -template -void CClientClientDHTTemplate::recvInfoFromClients(int clientSrcRank, unsigned char* info, int infoSize, - const MPI_Comm& clientIntraComm, - std::vector& requestRecvInfo) -{ - MPI_Request request; - requestRecvInfo.push_back(request); - - MPI_Irecv(info, infoSize, MPI_CHAR, - clientSrcRank, MPI_DHT_INFO, clientIntraComm, &(requestRecvInfo.back())); -} - -/*! - Compute how many processes one process needs to send to and from how many processes it will receive. - This computation is only based on hierachical structure of distributed hash table (e.x: number of processes) -*/ -template -void CClientClientDHTTemplate::computeSendRecvRank(int level, int rank) -{ - int groupBegin = this->getGroupBegin()[level]; - int nbInGroup = this->getNbInGroup()[level]; - const std::vector& groupParentBegin = this->getGroupParentsBegin()[level]; - const std::vector& nbInGroupParents = this->getNbInGroupParents()[level]; - - std::vector hashedIndexGroup; - computeHashIndex(hashedIndexGroup, nbInGroup); - size_t a = hashedIndexGroup[rank-groupBegin]; - size_t b = hashedIndexGroup[rank-groupBegin+1]-1; - - int currentGroup, offset; - size_t e,f; - - // Do a simple math [a,b) intersect [c,d) - for (int idx = 0; idx < groupParentBegin.size(); ++idx) - { - std::vector hashedIndexGroupParent; - int nbInGroupParent = nbInGroupParents[idx]; - if (0 != nbInGroupParent) - computeHashIndex(hashedIndexGroupParent, nbInGroupParent); - for (int i = 0; i < nbInGroupParent; ++i) - { - size_t c = hashedIndexGroupParent[i]; - size_t d = hashedIndexGroupParent[i+1]-1; - - if (!((d < a) || (b ::const_iterator itbHashGroup = hashedIndexGroup.begin(), itHashGroup, - iteHashGroup = hashedIndexGroup.end(); - itHashGroup = std::lower_bound(itbHashGroup, iteHashGroup, e+1); - int begin = std::distance(itbHashGroup, itHashGroup)-1; - itHashGroup = std::upper_bound(itbHashGroup, iteHashGroup, f); - int end = std::distance(itbHashGroup, itHashGroup) -1; - sendRank_[level].resize(end-begin+1); - for (int idx = 0; idx < sendRank_[level].size(); ++idx) sendRank_[level][idx] = idx + groupBegin + begin; -} - -/*! - Compute number of clients as well as corresponding number of elements each client will receive on returning searching result - \param [in] sendNbRank Rank of clients to send to - \param [in] sendNbElements Number of elements each client to send to - \param [in] receiveNbRank Rank of clients to receive from - \param [out] recvNbElements Number of elements each client to send to -*/ -template -void CClientClientDHTTemplate::sendRecvOnReturn(const std::vector& sendNbRank, std::vector& sendNbElements, - const std::vector& recvNbRank, std::vector& recvNbElements) -{ - recvNbElements.resize(recvNbRank.size()); - std::vector request(sendNbRank.size()+recvNbRank.size()); - std::vector requestStatus(sendNbRank.size()+recvNbRank.size()); - - int nRequest = 0; - for (int idx = 0; idx < recvNbRank.size(); ++idx) - { - MPI_Irecv(&recvNbElements[0]+idx, 1, MPI_INT, - recvNbRank[idx], MPI_DHT_INDEX_1, this->internalComm_, &request[nRequest]); - ++nRequest; - } - - for (int idx = 0; idx < sendNbRank.size(); ++idx) - { - MPI_Isend(&sendNbElements[0]+idx, 1, MPI_INT, - sendNbRank[idx], MPI_DHT_INDEX_1, this->internalComm_, &request[nRequest]); - ++nRequest; - } - - MPI_Waitall(sendNbRank.size()+recvNbRank.size(), &request[0], &requestStatus[0]); -} - -/*! - Send and receive number of process each process need to listen to as well as number - of index it will receive during the initalization phase - \param [in] level current level - \param [in] sendNbRank Rank of clients to send to - \param [in] sendNbElements Number of elements each client to send to - \param [out] receiveNbRank Rank of clients to receive from - \param [out] recvNbElements Number of elements each client to send to -*/ -template -void CClientClientDHTTemplate::sendRecvRank(int level, - const std::vector& sendNbRank, const std::vector& sendNbElements, - std::vector& recvNbRank, std::vector& recvNbElements) -{ - int groupBegin = this->getGroupBegin()[level]; - - int offSet = 0; - std::vector& sendRank = sendRank_[level]; - std::vector& recvRank = recvRank_[level]; - int sendBuffSize = sendRank.size(); - std::vector sendBuff(sendBuffSize*2); - int recvBuffSize = recvRank.size(); - std::vector recvBuff(recvBuffSize*2,0); - - std::vector request(sendBuffSize+recvBuffSize); - std::vector requestStatus(sendBuffSize+recvBuffSize); - - int nRequest = 0; - for (int idx = 0; idx < recvBuffSize; ++idx) - { - MPI_Irecv(&recvBuff[0]+2*idx, 2, MPI_INT, - recvRank[idx], MPI_DHT_INDEX_0, this->internalComm_, &request[nRequest]); - ++nRequest; - } - - for (int idx = 0; idx < sendBuffSize; ++idx) - { - offSet = sendRank[idx]-groupBegin; - sendBuff[idx*2] = sendNbRank[offSet]; - sendBuff[idx*2+1] = sendNbElements[offSet]; - } - - for (int idx = 0; idx < sendBuffSize; ++idx) - { - MPI_Isend(&sendBuff[idx*2], 2, MPI_INT, - sendRank[idx], MPI_DHT_INDEX_0, this->internalComm_, &request[nRequest]); - ++nRequest; - } - - MPI_Waitall(sendBuffSize+recvBuffSize, &request[0], &requestStatus[0]); - int nbRecvRank = 0, nbRecvElements = 0; - recvNbRank.clear(); - recvNbElements.clear(); - for (int idx = 0; idx < recvBuffSize; ++idx) - { - if (0 != recvBuff[2*idx]) - { - recvNbRank.push_back(recvRank[idx]); - recvNbElements.push_back(recvBuff[2*idx+1]); - } - } -} - -} diff --git a/xios_2311_src/src/distribution/client_server_mapping.cpp b/xios_2311_src/src/distribution/client_server_mapping.cpp deleted file mode 100644 index 8fd97e566d4649f93df81b6cf920b032c4439413..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/client_server_mapping.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/*! - \file client_server_mapping.hpp - \author Ha NGUYEN - \since 04 Feb 2015 - \date 09 Mars 2015 - - \brief Mapping between index client and server. - */ -#include "client_server_mapping.hpp" - -namespace xios { - -CClientServerMapping::CClientServerMapping() - : indexGlobalOnServer_() -{ -} - -CClientServerMapping::~CClientServerMapping() -{ -} - -/*! - Compute how many clients each server will receive data from - On client can send data to several servers as well as one server can receive data originated from -some clients. In order to write data correctly, each server must know from how many clients it receives data - \param [in] nbServer number of servers - \param [in] nClient number of clients - \param [in] clientIntraComm MPI communication of clients - \param [in] connectedServerRank Rank of servers connected to the current client -*/ -std::map CClientServerMapping::computeConnectedClients(int nbServer, int nbClient, - MPI_Comm& clientIntraComm, - const std::vector& connectedServerRank) -{ - std::map connectedClients; // number of clients connected to a server - - std::vector::const_iterator itbVec, iteVec, it; - itbVec = it = connectedServerRank.begin(); - iteVec = connectedServerRank.end(); - - std::vector connectedServer; - std::vector isConnected(nbServer,false); - - for (it = itbVec; it != iteVec; ++it) - { - for (int serverNum = 0; serverNum < nbServer; ++serverNum) - if (*it == serverNum) isConnected[serverNum] = true; - } - - for(int serverNum = 0; serverNum clientRes(0,nbServer); - - for(int n=0;n - -namespace xios { - -/*! - \class CClientServerMapping - This class computes index of data which are sent to server as well as index of data -on server side. -*/ -class CClientServerMapping -{ -public: - typedef std::unordered_map > GlobalIndexMap; - public: - /** Default constructor */ - CClientServerMapping(); - - /** Default destructor */ - virtual ~CClientServerMapping(); - - // Only need global index on client to calculate mapping (supposed client has info of distribution) - virtual void computeServerIndexMapping(const CArray& globalIndexOnClient, int nbServer) = 0; - - static std::map computeConnectedClients(int nbServer, int nbClient, - MPI_Comm& clientIntraComm, - const std::vector& connectedServerRank); - - const GlobalIndexMap& getGlobalIndexOnServer() const; - - GlobalIndexMap& getGlobalIndexOnServer(); - - protected: - //! Global index of data on SERVER, which are calculated by client(s) - GlobalIndexMap indexGlobalOnServer_; -}; - -} // namespace xios -#endif // __XIOS_CLIENT_SERVER_MAPPING_HPP__ diff --git a/xios_2311_src/src/distribution/client_server_mapping_distributed.cpp b/xios_2311_src/src/distribution/client_server_mapping_distributed.cpp deleted file mode 100644 index c93d85ba6447a985ff19090a103f2c5c71ddc94c..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/client_server_mapping_distributed.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/*! - \file client_server_mapping.hpp - \author Ha NGUYEN - \since 27 Feb 2015 - \date 16 Mars 2016 - - \brief Mapping between index client and server. - Clients pre-calculate all information of server distribution. - */ -#include "client_server_mapping_distributed.hpp" -#include -#include -#include "utils.hpp" -#include "mpi_tag.hpp" -#include "context.hpp" -#include "context_client.hpp" - -namespace xios -{ - -CClientServerMappingDistributed::CClientServerMappingDistributed(const std::unordered_map& globalIndexOfServer, - const MPI_Comm& clientIntraComm, bool isDataDistributed) - : CClientServerMapping(), ccDHT_(0) -{ - ccDHT_ = new CClientClientDHTInt(globalIndexOfServer, - clientIntraComm); -} - -CClientServerMappingDistributed::~CClientServerMappingDistributed() -{ - if (0 != ccDHT_) delete ccDHT_; -} - -/*! - Compute mapping global index of server which client sends to. - \param [in] globalIndexOnClient global index client has - \param [in] nbServer size of server's intracomm -*/ -void CClientServerMappingDistributed::computeServerIndexMapping(const CArray& globalIndexOnClient, int nbServer) -{ - - ccDHT_->computeIndexInfoMapping(globalIndexOnClient); - const CClientClientDHTInt::Index2VectorInfoTypeMap& infoIndexMap = (ccDHT_->getInfoIndexMap()); - CClientClientDHTInt::Index2VectorInfoTypeMap::const_iterator itb = infoIndexMap.begin(), ite = infoIndexMap.end(), it; - std::vector nbInfoIndex(std::max(ccDHT_->getNbClient(),nbServer),0); - - for (it = itb; it != ite; ++it) - { - ++nbInfoIndex[it->second[0]]; - } - - for (int idx = 0; idx < nbInfoIndex.size(); ++idx) - { - if (0 != nbInfoIndex[idx]) - { - indexGlobalOnServer_[idx].resize(nbInfoIndex[idx]); - nbInfoIndex[idx] = 0; - } - } - - for (it = itb; it != ite; ++it) - { - indexGlobalOnServer_[it->second[0]][nbInfoIndex[it->second[0]]] = (it->first); - ++nbInfoIndex[it->second[0]]; - } -} - -} diff --git a/xios_2311_src/src/distribution/client_server_mapping_distributed.hpp b/xios_2311_src/src/distribution/client_server_mapping_distributed.hpp deleted file mode 100644 index a829177caf0d12955c6f35213a5fc758b3e53c5c..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/client_server_mapping_distributed.hpp +++ /dev/null @@ -1,50 +0,0 @@ -/*! - \file client_server_mapping.hpp - \author Ha NGUYEN - \since 27 Feb 2015 - \date 09 Mars 2015 - - \brief Mapping between index client and server. - Clients pre-calculate all information of server distribution. - */ - -#ifndef __XIOS_CLIENT_SERVER_MAPPING_DISTRIBUTED_HPP__ -#define __XIOS_CLIENT_SERVER_MAPPING_DISTRIBUTED_HPP__ - -#include -#include "xios_spl.hpp" -#include "array_new.hpp" -#include "mpi.hpp" -#include -#include "client_client_dht_template.hpp" - -namespace xios -{ -/*! - \class CClientServerMappingDistributed - This class computes index of data which are sent to server as well as index of data -on server side with a distributed alogrithm. Each client has a piece of information about the distribution -of servers. To find out all these info, first of all, all client join a discovering process in which each client -announces the others about the info they have as well as demand others info they are lacked of. After this process, -each client has enough info to decide to which client it need to send a demand for corresponding server of a global index. -The alogrithm depends on hashed index. -*/ -class CClientServerMappingDistributed : public CClientServerMapping -{ - public: - /** Default constructor */ - CClientServerMappingDistributed(const std::unordered_map& globalIndexOfServer, - const MPI_Comm& clientIntraComm, - bool isDataDistributed = true); - - virtual void computeServerIndexMapping(const CArray& globalIndexOnClientSendToServer, int nbServer); - - /** Default destructor */ - virtual ~CClientServerMappingDistributed(); - - protected: - CClientClientDHTInt* ccDHT_; -}; - -} // namespace xios -#endif // __XIOS_CLIENT_SERVER_MAPPING_DISTRIBUTED_HPP__ diff --git a/xios_2311_src/src/distribution/dht_auto_indexing.cpp b/xios_2311_src/src/distribution/dht_auto_indexing.cpp deleted file mode 100644 index fa1fb76ddb6a6d63923fc85542399d23612a54d0..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/dht_auto_indexing.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/*! - \file dht_auto_indexing.cpp - \author Ha NGUYEN - \since 6 Jul 2016 - \date 6 Jul 2016 - - \brief Auto assign global index across processes. - */ -#include "dht_auto_indexing.hpp" - -namespace xios -{ - - CDHTAutoIndexing::~CDHTAutoIndexing() - { - } - - /*! - \param [in] - \param [in] - */ - - CDHTAutoIndexing::CDHTAutoIndexing(const CArray& hashValue, - const MPI_Comm& clientIntraComm) - : CClientClientDHTTemplate(clientIntraComm) - { - - nbIndexOnProc_ = hashValue.size(); - size_t nbIndexAccum; - MPI_Scan(&nbIndexOnProc_, &nbIndexAccum, 1, MPI_UNSIGNED_LONG, MPI_SUM, clientIntraComm); - - // Broadcasting the total number of indexes - int rank, size; - MPI_Comm_rank(clientIntraComm, &rank); - MPI_Comm_size(clientIntraComm, &size); - if (rank == (size-1)) nbIndexesGlobal_ = nbIndexAccum; - MPI_Bcast(&nbIndexesGlobal_, 1, MPI_UNSIGNED_LONG, size-1, clientIntraComm); - - CArray::const_iterator itbIdx = hashValue.begin(), itIdx, - iteIdx = hashValue.end(); - - size_t idx = 0; - beginIndexOnProc_ = nbIndexAccum - nbIndexOnProc_; - globalIndex_.resize(nbIndexOnProc_); - for (itIdx = itbIdx; itIdx != iteIdx; ++itIdx) - { - globalIndex_[idx] = beginIndexOnProc_ + idx; - ++idx ; - } - } - - /*! - * \fn void CDHTAutoIndexing::CDHTAutoIndexing(Index2VectorInfoTypeMap& hashInitMap, const MPI_Comm& clientIntraComm) - * Assigns a global index to unique input indexes. - * The returned map has unique indexes as a key and global indexes as a mapped value. - * \param [in] hashInitMap map> is a map of unique indexes. - * \param [in] clientIntraComm - */ - CDHTAutoIndexing::CDHTAutoIndexing(Index2VectorInfoTypeMap& hashInitMap, - const MPI_Comm& clientIntraComm) - : CClientClientDHTTemplate(clientIntraComm) - { - - nbIndexOnProc_ = hashInitMap.size(); - size_t nbIndexAccum; - MPI_Scan(&nbIndexOnProc_, &nbIndexAccum, 1, MPI_UNSIGNED_LONG, MPI_SUM, clientIntraComm); - - int rank, size; - MPI_Comm_rank(clientIntraComm, &rank); - MPI_Comm_size(clientIntraComm, &size); - if (rank == (size-1)) nbIndexesGlobal_ = nbIndexAccum; - MPI_Bcast(&nbIndexesGlobal_, 1, MPI_UNSIGNED_LONG, size-1, clientIntraComm); - - Index2VectorInfoTypeMap::iterator itbIdx = hashInitMap.begin(), itIdx, - iteIdx = hashInitMap.end(); - size_t idx = 0; - beginIndexOnProc_ = nbIndexAccum - nbIndexOnProc_; - globalIndex_.resize(nbIndexOnProc_); - for (itIdx = itbIdx; itIdx != iteIdx; ++itIdx) - { -// (itIdx->second)[0] = beginIndexOnProc_ + idx; - (itIdx->second)[1] = beginIndexOnProc_ + idx; - globalIndex_[idx] = beginIndexOnProc_ + idx; - ++idx ; - } - } - - /*! - * \fn size_t CDHTAutoIndexing::getNbIndexesGlobal() const - * Returns the total number of global indexes. - */ - size_t CDHTAutoIndexing::getNbIndexesGlobal() const - { - return nbIndexesGlobal_; - } - - /*! - * \fn size_t CDHTAutoIndexing::getIndexStart() const - * Returns the starting global index for a proc. - */ - size_t CDHTAutoIndexing::getIndexStart() const - { - return beginIndexOnProc_; - } - - /*! - * \fn size_t CDHTAutoIndexing::getIndexCount() const - * Returns the number of global indexes on a proc. - */ - size_t CDHTAutoIndexing::getIndexCount() const - { - return nbIndexOnProc_; - } - -} diff --git a/xios_2311_src/src/distribution/dht_auto_indexing.hpp b/xios_2311_src/src/distribution/dht_auto_indexing.hpp deleted file mode 100644 index 5a962adccd59a1ec37742d5a4ace56b34243460c..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/dht_auto_indexing.hpp +++ /dev/null @@ -1,47 +0,0 @@ -/*! - \file dht_auto_indexing.hpp - \author Ha NGUYEN - \since 6 Jul 2016 - \date 6 Jul 2016 - - \brief Auto assign global index across processes. - */ - -#ifndef __XIOS_DHT_AUTO_INDEXING_HPP__ -#define __XIOS_DHT_AUTO_INDEXING_HPP__ - -#include "client_client_dht_template.hpp" - -namespace xios -{ - -/*! - \class CDHTAutoIndexing - . -*/ -class CDHTAutoIndexing: public CClientClientDHTTemplate -{ - public: - - CDHTAutoIndexing(const CArray& hashValue, - const MPI_Comm& clientIntraComm); - - CDHTAutoIndexing(Index2VectorInfoTypeMap& hashInitMap, - const MPI_Comm& clientIntraComm); - - size_t getNbIndexesGlobal() const; - size_t getIndexStart() const; - size_t getIndexCount() const; - - /** Default destructor */ - virtual ~CDHTAutoIndexing(); - - protected: - std::vector globalIndex_; - size_t nbIndexesGlobal_; - size_t nbIndexOnProc_ ; - size_t beginIndexOnProc_ ; -}; - -} // namespace xios -#endif // __XIOS_DHT_AUTO_INDEXING_HPP__ diff --git a/xios_2311_src/src/distribution/dht_data_types.hpp b/xios_2311_src/src/distribution/dht_data_types.hpp deleted file mode 100644 index 6d09f3ef0e67b1142a25406361f6cb1d0e1fc289..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/dht_data_types.hpp +++ /dev/null @@ -1,77 +0,0 @@ -/*! - \file dht_data_types.hpp - \author Ha NGUYEN - \since 17 Mars 2016 - \date 17 Mars 2016 - - \brief Customized data type for dht - */ - -#ifndef __XIOS_DHT_DATATYPES_HPP__ -#define __XIOS_DHT_DATATYPES_HPP__ - -#include "utils.hpp" - -namespace xios -{ -typedef std::pair PairIntInt; - -template -struct ProcessDHTElement -{ - typedef T Type; - static int typeSize() - { - return sizeof(Type); - } - - static void packElement(const T& inputElement, unsigned char* packedElement, int& index) - { - if (NULL == packedElement) index += sizeof(Type); - else - { - *(T *)(&packedElement[index]) = inputElement; - index+=sizeof(Type); - } - } - - static void unpackElement(T& outputElement, unsigned char* unpackedElement, int& index) - { - outputElement = *(Type*)(&unpackedElement[index]); - index+=sizeof(Type); - } -}; - -template<> -struct ProcessDHTElement -{ - typedef PairIntInt Type; - static int typeSize() - { - return (2*sizeof(int)); - } - - static void packElement(const PairIntInt& inputElement, unsigned char* packedElement, int& index) - { - if (NULL == packedElement) index +=(2*sizeof(int)); - else - { - *(int *)(&packedElement[index]) = inputElement.first; - index+=sizeof(int); - *(int *)(&packedElement[index]) = inputElement.second; - index+=sizeof(int); - } - } - - static void unpackElement(PairIntInt& outputElement, unsigned char* unpackedElement, int& index) - { - outputElement.first=*(int *)(&unpackedElement[index]); - index+=sizeof(int); - outputElement.second=*(int *)(&unpackedElement[index]); - index+=sizeof(int); - } -}; - -} - -#endif // __XIOS_DHT_DATATYPES_HPP__ diff --git a/xios_2311_src/src/distribution/distributed_view.cpp b/xios_2311_src/src/distribution/distributed_view.cpp deleted file mode 100755 index 4e539d421a53ca5231c16643a865bc87a8cd848c..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/distributed_view.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include "element_view.hpp" -#include "element.hpp" -#include "distributed_view.hpp" - -namespace xios -{ - - CDistributedView::CDistributedView(shared_ptr parent, CElementView::type, const std::map>& indexView) - : globalIndex_(parent->globalIndex_), globalSize_(parent->globalSize_), localSize_(parent->localSize_) - { - for(auto& index : indexView) - { - index_[index.first].reference(index.second.copy()) ; - size_[index.first] = index.second.numElements() ; - } - } - - CDistributedView::CDistributedView(shared_ptr parent, CElementView::type, const std::map>& maskView) - : globalIndex_(parent->globalIndex_), globalSize_(parent->globalSize_), localSize_(parent->localSize_) - { - for(auto& it : maskView) - { - int rank = it.first ; - auto& mask = it.second ; - int size = mask.numElements() ; - auto& index = index_[rank] ; - index.resize(size) ; - int pos=0 ; - for(int i=0 ; i < size ; i++) - if (mask(i)) { index(pos) = i ; pos++ ; } - if (pos==0) index.resize(pos) ; - else index.resizeAndPreserve(pos) ; - size_[rank] = pos ; - } - } -} \ No newline at end of file diff --git a/xios_2311_src/src/distribution/distributed_view.hpp b/xios_2311_src/src/distribution/distributed_view.hpp deleted file mode 100755 index 9bb2d7d59c4159b36c4e9cc31dbd492f847b2561..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/distributed_view.hpp +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef __DISTRIBUTED_VIEW_HPP__ -#define __DISTRIBUTED_VIEW_HPP__ - -#include "xios_spl.hpp" -#include "array_new.hpp" -#include "element_view.hpp" - -namespace xios -{ - class CDistributedElement; - - class CDistributedView : public CElementView - { - public: - - CDistributedView(shared_ptr parent, CElementView::type type, const std::map>& indexView) ; - CDistributedView(shared_ptr parent, CElementView::type type, const std::map>& maskView) ; - - std::map>& getIndex(void) { return index_ ;} - std::map>& getGlobalIndex(void) { return globalIndex_ ;} - std::map& getSize(void) { return size_ ;} - std::map& getLocalSize(void) { return localSize_ ;} - size_t getGlobalSize(void) { return globalSize_ ;} - - void getGlobalIndexView(map>& globalIndexView) - { - for(auto& it : globalIndex_) - { - int rank=it.first ; - auto& globalIndex = it.second; - auto& globalIndView = globalIndexView[rank] ; - auto& index = index_[rank] ; - auto& size = size_[rank] ; - auto& localSize = localSize_[rank] ; - globalIndView.resize(size) ; - int pos=0 ; - for(int i=0 ; i=0 && index(i)& globalIndex, size_t sliceIndex, size_t* sliceSize, shared_ptr* view, int pos) - { - // using map can be expensive, find an otherway later - auto& globalInd=globalIndex_[rank] ; - int localSize=globalInd.numElements() ; - auto& index=index_[rank] ; - int size=index.numElements() ; - - if (pos==0) - { - for(int i=0;i=0 && index(i)=0 && index(i)getGlobalIndex(rank, globalIndex, sliceIndex + globalInd(index(i))*sliceSize[pos], sliceSize, view , pos-1) ; - } - } - - - protected: - - std::map> index_ ; - std::map size_; - - std::map>& globalIndex_ ; - size_t& globalSize_ ; - std::map& localSize_ ; - - } ; - -} - -#endif \ No newline at end of file diff --git a/xios_2311_src/src/distribution/distribution.cpp b/xios_2311_src/src/distribution/distribution.cpp deleted file mode 100644 index 503b4b5bc22049e0dedbac1a62861c44dd90d08d..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/distribution.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/*! - \file distribution.hpp - \author Ha NGUYEN - \since 13 Jan 2015 - \date 09 Feb 2015 - - \brief Index distribution on server side. - */ -#include "distribution.hpp" - -namespace xios { - -CDistribution::CDistribution(int rank, int dims, const CArray& globalIndex) - : rank_(rank), dims_(dims), globalIndex_(globalIndex.shape()) -{ - if (0 != globalIndex.numElements()) - globalIndex_ = globalIndex; -} - -const CArray& CDistribution:: getGlobalIndex() const -{ - return globalIndex_; -} - -CDistribution::~CDistribution() -{ /* Nothing to do */ } - -int CDistribution::getDims() const -{ - return dims_; -} - -int CDistribution::getRank() const -{ - return rank_; -} - -} // namespace xios diff --git a/xios_2311_src/src/distribution/distribution.hpp b/xios_2311_src/src/distribution/distribution.hpp deleted file mode 100644 index f7feceabe8987d5c81aed0fe0124ef68bb5ba6f0..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/distribution.hpp +++ /dev/null @@ -1,49 +0,0 @@ -/*! - \file distribution.hpp - \author Ha NGUYEN - \since 13 Jan 2015 - \date 09 Feb 2015 - - \brief Index distribution on server side. - */ -#ifndef __XIOS_DISTRIBUTION_HPP__ -#define __XIOS_DISTRIBUTION_HPP__ - -#include "xios_spl.hpp" -#include "array_new.hpp" -#include - -namespace xios { -/*! - \class CDistribution - The parent class of CDistributionClient and CDistributionServer, which declares and defines -some basic methods and properties for its children. This class allows its descendants to calculate -distribution of index on client or server side. -*/ -class CDistribution -{ - public: - typedef std::unordered_map GlobalLocalMap; - - public: - /** Default constructor */ - CDistribution(int rank, int dims, const CArray& globalIndex = CArray()); - - /** Default destructor */ - virtual ~CDistribution(); - - int getDims() const; //! Get dimension size - int getRank() const; //! Get rank of current process - const CArray& getGlobalIndex() const; - - protected: - virtual void createGlobalIndex() {}; - - protected: - CArray globalIndex_; - int dims_; - int rank_; -}; - -} // namespace xios -#endif // __XIOS_DISTRIBUTION_HPP__ diff --git a/xios_2311_src/src/distribution/distribution_client.cpp b/xios_2311_src/src/distribution/distribution_client.cpp deleted file mode 100644 index 54674fafd59ef627b8579ff9cc528952789dbe4e..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/distribution_client.cpp +++ /dev/null @@ -1,610 +0,0 @@ -/*! - \file distribution_client.cpp - \author Ha NGUYEN - \since 13 Jan 2015 - \date 09 Mars 2015 - - \brief Index distribution on client side. - */ -#include "distribution_client.hpp" - -namespace xios { - -CDistributionClient::CDistributionClient(int rank, CGrid* grid) - : CDistribution(rank, 0) - , axisDomainOrder_() - , nLocal_(), nGlob_(), nBeginLocal_(), nBeginGlobal_() - , dataNIndex_(), dataDims_(), dataBegin_(), dataIndex_() - , gridMask_(), indexMap_() - , isDataDistributed_(true), axisNum_(0), domainNum_(0) - , localDataIndex_(), localMaskIndex_() - , globalLocalDataSendToServerMap_() - , infoIndex_(), isComputed_(false) - , elementLocalIndex_(), elementGlobalIndex_(), elementIndexData_() - , elementNLocal_(), elementNGlobal_() -{ - readDistributionInfo(grid); - createGlobalIndex(); -} - -CDistributionClient::~CDistributionClient() -{ /* Nothing to do */ } - -void CDistributionClient::partialClear() -{ - GlobalLocalMap void1 ; - GlobalLocalMap void2 ; - std::vector void3 ; - std::vector void4 ; - - globalLocalDataSendToServerMap_.swap(void1) ; - globalDataIndex_.swap(void2) ; - localDataIndex_.swap(void3); - localMaskIndex_.swap(void4) ; -} - -/*! - Read information of a grid to generate distribution. - Every grid is composed of several axis or/and domain(s). Their information are processed -stored and used to calculate index distribution between client and server - \param [in] grid Grid to read -*/ -void CDistributionClient::readDistributionInfo(CGrid* grid) -{ - std::vector domList = grid->getDomains(); - std::vector axisList = grid->getAxis(); - std::vector scalarList = grid->getScalars(); - CArray axisDomainOrder = grid->axis_domain_order; - - readDistributionInfo(domList, axisList, scalarList, axisDomainOrder); - - // Then check mask of grid - int gridDim = domList.size() * 2 + axisList.size(); - switch (gridDim) { - case 0: - gridMask_.resize(1); - gridMask_(0) = true; - break; - case 1: - if (!grid->mask_1d.isEmpty()) readGridMaskInfo(grid->mask_1d); - break; - case 2: - if (!grid->mask_2d.isEmpty()) readGridMaskInfo(grid->mask_2d); - break; - case 3: - if (!grid->mask_3d.isEmpty()) readGridMaskInfo(grid->mask_3d); - break; - case 4: - if (!grid->mask_4d.isEmpty()) readGridMaskInfo(grid->mask_4d); - break; - case 5: - if (!grid->mask_5d.isEmpty()) readGridMaskInfo(grid->mask_5d); - break; - case 6: - if (!grid->mask_6d.isEmpty()) readGridMaskInfo(grid->mask_6d); - break; - case 7: - if (!grid->mask_7d.isEmpty()) readGridMaskInfo(grid->mask_7d); - break; - default: - break; - } -} - -/*! - Read information from domain(s) and axis to generate distribution. - All information related to domain, e.g ibegin, jbegin, ni, nj, ni_glo, nj_glo -as well as related to axis, e.g dataNIndex, dataIndex will be stored to compute -the distribution between clients and servers. Till now, every data structure of domain has been kept -like before, e.g: data_n_index to make sure a compability, however, it should be changed? - \param [in] domList List of domains of grid - \param [in] axisList List of axis of grid - \param [in] scalarList List of scalar of grid - \param [in] axisDomainOrder order of axis and domain inside a grid. 2 if domain, 1 if axis and zero if scalar -// \param [in] gridMask Mask of grid, for now, keep it 3 dimension, but it needs changing -*/ -void CDistributionClient::readDistributionInfo(const std::vector& domList, - const std::vector& axisList, - const std::vector& scalarList, - const CArray& axisDomainOrder) -{ - domainNum_ = domList.size(); - axisNum_ = axisList.size(); - numElement_ = axisDomainOrder.numElements(); // Number of element, e.x: Axis, Domain - - axisDomainOrder_.resize(numElement_); - axisDomainOrder_ = axisDomainOrder; - - // Because domain and axis can be in any order (axis1, domain1, axis2, axis3, ) - // their position should be specified. In axisDomainOrder, domain == true, axis == false - int idx = 0; - indexMap_.resize(numElement_); - this->dims_ = numElement_; - for (int i = 0; i < numElement_; ++i) - { - indexMap_[i] = idx; - if (2 == axisDomainOrder(i)) - { - ++(this->dims_); - idx += 2; - } - else ++idx; - } - - // Size of each dimension (local and global) - nLocal_.resize(this->dims_); - nGlob_.resize(this->dims_); - nBeginLocal_.resize(this->dims_,0); - nBeginGlobal_.resize(this->dims_,0); - - // Data_n_index of domain or axis (For now, axis uses its size as data_n_index - dataNIndex_.resize(numElement_); - dataDims_.resize(numElement_); - dataBegin_.resize(this->dims_); - - // Data_*_index of each dimension - dataIndex_.resize(this->dims_); - infoIndex_.resize(this->dims_); - - // A trick to determine position of each domain in domainList - int domIndex = 0, axisIndex = 0, scalarIndex = 0; - idx = 0; - - elementLocalIndex_.resize(numElement_); - elementGlobalIndex_.resize(numElement_); - elementIndexData_.resize(numElement_); - elementNLocal_.resize(numElement_); - elementNGlobal_.resize(numElement_); - elementNLocal_[0] = 1; - elementNGlobal_[0] = 1; - size_t localSize = 1, globalSize = 1; - - isDataDistributed_ = false; - // Update all the vectors above - for (idx = 0; idx < numElement_; ++idx) - { - int eleDim = axisDomainOrder(idx); - elementNLocal_[idx] = localSize; - elementNGlobal_[idx] = globalSize; - - // If this is a domain - if (2 == eleDim) - { - // On the j axis - nLocal_.at(indexMap_[idx]+1) = domList[domIndex]->nj.getValue(); - nGlob_.at(indexMap_[idx]+1) = domList[domIndex]->nj_glo.getValue(); - nBeginLocal_.at(indexMap_[idx]+1) = 0; - nBeginGlobal_.at(indexMap_[idx]+1) = domList[domIndex]->jbegin; - - dataBegin_.at(indexMap_[idx]+1) = domList[domIndex]->data_jbegin.getValue(); - dataIndex_.at(indexMap_[idx]+1).reference(domList[domIndex]->data_j_index); - infoIndex_.at(indexMap_[idx]+1).reference(domList[domIndex]->j_index); - - // On the i axis - nLocal_.at(indexMap_[idx]) = domList[domIndex]->ni.getValue(); - nGlob_.at(indexMap_[idx]) = domList[domIndex]->ni_glo.getValue(); - nBeginLocal_.at(indexMap_[idx]) = 0; - nBeginGlobal_.at(indexMap_[idx]) = domList[domIndex]->ibegin; - - dataBegin_.at(indexMap_[idx]) = domList[domIndex]->data_ibegin.getValue(); - dataIndex_.at(indexMap_[idx]).reference(domList[domIndex]->data_i_index); - infoIndex_.at(indexMap_[idx]).reference(domList[domIndex]->i_index); - - dataNIndex_.at(idx) = domList[domIndex]->data_i_index.numElements(); - dataDims_.at(idx) = domList[domIndex]->data_dim.getValue(); - - isDataDistributed_ |= domList[domIndex]->isDistributed(); - - localSize *= nLocal_.at(indexMap_[idx]+1)* nLocal_.at(indexMap_[idx]); - globalSize *= nGlob_.at(indexMap_[idx]+1)* nGlob_.at(indexMap_[idx]); - ++domIndex; - } - else if (1 == eleDim)// So it's an axis - { - nLocal_.at(indexMap_[idx]) = axisList[axisIndex]->n.getValue(); - nGlob_.at(indexMap_[idx]) = axisList[axisIndex]->n_glo.getValue(); - nBeginLocal_.at(indexMap_[idx]) = 0; - nBeginGlobal_.at(indexMap_[idx]) = axisList[axisIndex]->begin.getValue(); - - dataBegin_.at(indexMap_[idx]) = axisList[axisIndex]->data_begin.getValue(); - dataIndex_.at(indexMap_[idx]).reference(axisList[axisIndex]->data_index); - infoIndex_.at(indexMap_[idx]).reference(axisList[axisIndex]->index); - dataNIndex_.at(idx) = axisList[axisIndex]->data_index.numElements(); - dataDims_.at(idx) = 1; - - isDataDistributed_ |= axisList[axisIndex]->isDistributed(); - - localSize *= nLocal_.at(indexMap_[idx]); - globalSize *= nGlob_.at(indexMap_[idx]); - - ++axisIndex; - } - else // scalar - { - nLocal_.at(indexMap_[idx]) = 1; - nGlob_.at(indexMap_[idx]) = 1; - nBeginLocal_.at(indexMap_[idx]) = 0; - nBeginGlobal_.at(indexMap_[idx]) = 1; - - dataBegin_.at(indexMap_[idx]) = 0; - dataIndex_.at(indexMap_[idx]).resize(1); dataIndex_.at(indexMap_[idx])(0) = 0; - infoIndex_.at(indexMap_[idx]).resize(1); infoIndex_.at(indexMap_[idx])(0) = 0; - dataNIndex_.at(idx) = 1; - dataDims_.at(idx) = 1; - - isDataDistributed_ |= false; - - localSize *= nLocal_.at(indexMap_[idx]); - globalSize *= nGlob_.at(indexMap_[idx]); - - ++scalarIndex; - } - } -} - -/*! - Create local index of domain(s). - A domain can have data index which even contains the "ghost" points. Very often, these -data surround the true data. In order to send correct data to server, -a client need to know index of the true data. -*/ -void CDistributionClient::createLocalDomainDataIndex() -{ - int idxDomain = 0; - for (int i = 0; i < axisDomainOrder_.numElements(); ++i) - { - if (2 == axisDomainOrder_(i)) - { - elementIndexData_[i].resize(dataNIndex_[i]); - elementIndexData_[i] = false; - int iIdx, jIdx = 0, count = 0, localIndex; - for (int j = 0; j < dataNIndex_[i]; ++j) - { - iIdx = getDomainIndex((dataIndex_[indexMap_[i]])(j), (dataIndex_[indexMap_[i]+1])(j), - dataBegin_[indexMap_[i]], dataBegin_[indexMap_[i]+1], - dataDims_[i], nLocal_[indexMap_[i]], jIdx); - - if ((iIdx >= nBeginLocal_[indexMap_[i]]) && (iIdx < nLocal_[indexMap_[i]]) && - (jIdx >= nBeginLocal_[indexMap_[i]+1]) && (jIdx < nLocal_[indexMap_[i]+1])) - { - ++count; - elementIndexData_[i](j) = true; - } - } - - elementLocalIndex_[i].resize(count); - elementGlobalIndex_[i].resize(count); - count = 0; - CArray& tmpIndexElementData = elementIndexData_[i]; - CArray& tmpLocalElementIndex = elementLocalIndex_[i]; - CArray& tmpGlobalElementIndex = elementGlobalIndex_[i]; - for (int j = 0; j < dataNIndex_[i]; ++j) - { - if (tmpIndexElementData(j)) - { - iIdx = getDomainIndex((dataIndex_[indexMap_[i]])(j), (dataIndex_[indexMap_[i]+1])(j), - dataBegin_[indexMap_[i]], dataBegin_[indexMap_[i]+1], - dataDims_[i], nLocal_[indexMap_[i]], jIdx); - localIndex = tmpLocalElementIndex(count) = iIdx + jIdx * nLocal_[indexMap_[i]]; - tmpGlobalElementIndex(count) = (infoIndex_[indexMap_[i]])(localIndex) + ((infoIndex_[indexMap_[i]+1])(localIndex))*nGlob_[indexMap_[i]]; - ++count; - } - } - ++idxDomain; - } - } -} - -/*! - Create local index of axis. -*/ -void CDistributionClient::createLocalAxisDataIndex() -{ - int idxAxis = 0; - for (int i = 0; i < axisDomainOrder_.numElements(); ++i) - { - if (1 == axisDomainOrder_(i)) - { - elementIndexData_[i].resize(dataNIndex_[i]); - elementIndexData_[i] = false; - int iIdx = 0, count = 0; - for (int j = 0; j < dataNIndex_[i]; ++j) - { - iIdx = getAxisIndex((dataIndex_[indexMap_[i]])(j), dataBegin_[indexMap_[i]], nLocal_[indexMap_[i]]); - if ((iIdx >= nBeginLocal_[indexMap_[i]]) && - (iIdx < nLocal_[indexMap_[i]]) )//&& (axisMasks_[idxAxis](iIdx))) - { - ++count; - elementIndexData_[i](j) = true; - } - } - - elementLocalIndex_[i].resize(count); - elementGlobalIndex_[i].resize(count); - count = 0; - CArray& tmpIndexElementData = elementIndexData_[i]; - CArray& tmpLocalElementIndex = elementLocalIndex_[i]; - CArray& tmpGlobalElementIndex = elementGlobalIndex_[i]; - for (int j = 0; j < dataNIndex_[i]; ++j) - { - if (tmpIndexElementData(j)) - { - iIdx = tmpLocalElementIndex(count) = getAxisIndex((dataIndex_[indexMap_[i]])(j), dataBegin_[indexMap_[i]], nLocal_[indexMap_[i]]); - tmpGlobalElementIndex(count) = (infoIndex_[indexMap_[i]])(iIdx); - ++count; - } - } - ++idxAxis; - } - } -} - -/*! - Create local index of scalar. -*/ -void CDistributionClient::createLocalScalarDataIndex() -{ - int idxAxis = 0; - for (int i = 0; i < axisDomainOrder_.numElements(); ++i) - { - if (0 == axisDomainOrder_(i)) - { - elementIndexData_[i].resize(dataNIndex_[i]); - elementIndexData_[i] = true; - int count = 1; - - elementLocalIndex_[i].resize(count); - elementLocalIndex_[i] = 0; - elementGlobalIndex_[i].resize(count); - elementGlobalIndex_[i] = 0; - } - } -} - -/*! - Create global index on client - In order to do the mapping between client-server, each client creates its own -global index of sending data. This global index is then used to calculate to which server -the client needs to send it data as well as which part of data belongs to the server. -So as to make clients and server coherent in order of index, global index is calculated by -take into account of C-convention, the rightmost dimension varies faster. -*/ -void CDistributionClient::createGlobalIndexSendToServer() -{ - if (isComputed_) return; - isComputed_ = true; - createLocalDomainDataIndex(); - createLocalAxisDataIndex(); - createLocalScalarDataIndex(); - - int idxDomain = 0, idxAxis = 0; - std::vector eachElementSize(numElement_); - - // Precompute size of the loop - for (int i = 0; i < numElement_; ++i) - { - eachElementSize[i] = elementLocalIndex_[i].numElements(); - } - - // Compute size of the global index on client - std::vector idxLoop(numElement_,0); - std::vector currentIndex(numElement_,0); - std::vector currentGlobalIndex(numElement_,0); - int innerLoopSize = eachElementSize[0]; - size_t idx = 0, indexLocalDataOnClientCount = 0; - size_t ssize = 1; - - for (int i = 0; i < numElement_; ++i) ssize *= eachElementSize[i]; - localDataSize_=ssize ; - - localDataIndex_.resize(ssize); - if (!gridMask_.isEmpty()) localMaskIndex_.resize(ssize); - localMaskedDataIndex_.resize(ssize); - globalDataIndex_.rehash(std::ceil(ssize/globalDataIndex_.max_load_factor())); - globalLocalDataSendToServerMap_.rehash(std::ceil(ssize/globalLocalDataSendToServerMap_.max_load_factor())); - - - // We need to loop with data index - idxLoop.assign(numElement_,0); - idx = indexLocalDataOnClientCount = 0; - ssize = 1; for (int i = 0; i < numElement_; ++i) ssize *= dataNIndex_[i]; - innerLoopSize = dataNIndex_[0]; - int countLocalData = 0; - std::vector correctIndexOfElement(numElement_,0); - bool isOuterIndexCorrect = true; - while (idx < ssize) - { - for (int i = 0; i < numElement_-1; ++i) - { - if (idxLoop[i] == dataNIndex_[i]) - { - idxLoop[i] = 0; - correctIndexOfElement[i] = 0; - ++idxLoop[i+1]; - if (isOuterIndexCorrect) ++correctIndexOfElement[i+1]; - } - } - - // Depending the inner-most element axis or domain, - // The outer loop index begins correspondingly at one (1) or zero (0) - bool isIndexElementDataCorrect = true; - for (int i = 1; i < numElement_; ++i) - { - if (elementIndexData_[i](idxLoop[i])) - { - currentIndex[i] = elementLocalIndex_[i](correctIndexOfElement[i]); - currentGlobalIndex[i] = elementGlobalIndex_[i](correctIndexOfElement[i]); - isIndexElementDataCorrect &= true; - } - else isIndexElementDataCorrect = false; - } - - isOuterIndexCorrect = isIndexElementDataCorrect; - - if (isOuterIndexCorrect) - { - // Inner most index - int correctIndexInnerElement = 0; - for (int i = 0; i < innerLoopSize; ++i) - { - bool isCurrentIndexDataCorrect = isOuterIndexCorrect; - if (elementIndexData_[0](i)) - { - currentIndex[0] = elementLocalIndex_[0](correctIndexInnerElement); - currentGlobalIndex[0] = elementGlobalIndex_[0](correctIndexInnerElement); - isCurrentIndexDataCorrect &= true; - ++correctIndexInnerElement; - } - else isCurrentIndexDataCorrect = false; - - if (isCurrentIndexDataCorrect) - { - bool maskTmp = true; - bool maskGridTmp = true; - size_t globalIndex = 0; - for (int k = 0; k < numElement_; ++k) - { - globalIndex += (currentGlobalIndex[k])*elementNGlobal_[k]; - } - globalDataIndex_[globalIndex] = indexLocalDataOnClientCount; - localDataIndex_[indexLocalDataOnClientCount] = countLocalData; - globalLocalDataSendToServerMap_[globalIndex] = indexLocalDataOnClientCount; - localMaskedDataIndex_[indexLocalDataOnClientCount] = indexLocalDataOnClientCount; - - // Grid mask: unmasked values will be replaces by NaN and then all values will be sent - if (!gridMask_.isEmpty()) - { - int gridMaskIndex = 0; - for (int k = 0; k < this->numElement_; ++k) - { - gridMaskIndex += (currentIndex[k])*elementNLocal_[k]; - } - maskGridTmp = gridMask_(gridMaskIndex); - if (maskGridTmp) - localMaskIndex_[indexLocalDataOnClientCount] = true; - else - localMaskIndex_[indexLocalDataOnClientCount] = false; - } - - ++indexLocalDataOnClientCount; - - } - ++countLocalData; - correctIndexOfElement[0] = correctIndexInnerElement;; - } - } - else countLocalData+=innerLoopSize ; - - idxLoop[0] += innerLoopSize; - idx += innerLoopSize; - } -} - -void CDistributionClient::createGlobalIndex() -{ -} - -/*! - Retrieve index i and index j of a domain from its data index - Data contains not only true data, which are sent to servers, but also ghost data, which -very often play a role of border of each local data, so does data index. Because data of a domain -can be one dimension, or two dimensions, there is a need to convert data index to domain index - \param [in] dataIIndex index of i data - \param [in] dataJIndex index of j data - \param [in] dataIBegin index begin of i data - \param [in] dataJBegin index begin of j data - \param [in] dataDim dimension of data (1 or 2) - \param [in] ni local size ni of domain - \param [out] j j index of domain - \return i index of domain -*/ -int CDistributionClient::getDomainIndex(const int& dataIIndex, const int& dataJIndex, - const int& dataIBegin, const int& dataJBegin, - const int& dataDim, const int& ni, int& j) -{ - int i; - int tempI = dataIIndex + dataIBegin, - tempJ = (dataJIndex + dataJBegin); - if (ni == 0) - { - i = -1; - j = -1; - return i; - } - if ((tempI < 0) || (tempJ < 0)) - { - i = -1; - j = -1; - return i; - } - else - { - i = (dataDim == 1) ? (tempI) % ni : (tempI) ; - j = (dataDim == 1) ? (tempI) / ni : (tempJ) ; - } - return i; -} - -/*! - Retrieve index of an axis from its data index - \param [in] dataIndex index of data - \param [in] dataBegin index begin of data - \param [in] ni local size of axis - \return index of domain -*/ -int CDistributionClient::getAxisIndex(const int& dataIndex, const int& dataBegin, const int& ni) -{ - if (ni == 0) - { - return -1; - } - int tempI = dataIndex; - if ((tempI < 0) || (tempI > ni)) - return -1; - else - return tempI; -} - -/*! - Return global local data mapping of client -*/ -CDistributionClient::GlobalLocalDataMap& CDistributionClient::getGlobalLocalDataSendToServer() -{ - if (!isComputed_) createGlobalIndexSendToServer(); - return globalLocalDataSendToServerMap_; -} - -CDistributionClient::GlobalLocalDataMap& CDistributionClient::getGlobalDataIndexOnClient() -{ - if (!isComputed_) createGlobalIndexSendToServer(); - return globalDataIndex_; -} - -/*! - Return local data index of client -*/ -const std::vector& CDistributionClient::getLocalDataIndexOnClient() -{ - if (!isComputed_) createGlobalIndexSendToServer(); - return localDataIndex_; -} - -/*! - Return local mask index of client -*/ -const std::vector& CDistributionClient::getLocalMaskIndexOnClient() -{ - if (!isComputed_) createGlobalIndexSendToServer(); - return localMaskIndex_; -} - -/*! - Return local mask index of client -*/ -const std::vector& CDistributionClient::getLocalMaskedDataIndexOnClient() -{ - if (!isComputed_) createGlobalIndexSendToServer(); - return localMaskedDataIndex_; -} - -} // namespace xios diff --git a/xios_2311_src/src/distribution/distribution_client.hpp b/xios_2311_src/src/distribution/distribution_client.hpp deleted file mode 100644 index c6e83747931c0e11ad70fa8535ca3b3119eb2fb6..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/distribution_client.hpp +++ /dev/null @@ -1,186 +0,0 @@ -/*! - \file distribution_client.hpp - \author Ha NGUYEN - \since 13 Jan 2015 - \date 09 Mars 2015 - - \brief Index distribution on client side. - */ -#ifndef __XIOS_DISTRIBUTIONCLIENT_HPP__ -#define __XIOS_DISTRIBUTIONCLIENT_HPP__ - -#include -#include "axis.hpp" -#include "domain.hpp" -#include "grid.hpp" - -namespace xios { - -class CGrid; -class CDomain; -class CAxis; -class CScalar; - -/*! - \class CDistributionClient - This class bases on the knowledge of distribution on client side (decided by users) -to calculate the global index of its local data. -*/ -class CDistributionClient : public CDistribution -{ -public: - typedef CDistribution::GlobalLocalMap GlobalLocalDataMap; - - public: - /** Default constructor */ - CDistributionClient(int rank, CGrid* grid); - - void createGlobalIndexSendToServer(); - - /** Default destructor */ - virtual ~CDistributionClient(); - - virtual const std::vector& getLocalDataIndexOnClient(); - GlobalLocalDataMap& getGlobalLocalDataSendToServer(); - GlobalLocalDataMap& getGlobalDataIndexOnClient(); - const std::vector& getLocalMaskIndexOnClient(); - const std::vector& getLocalMaskedDataIndexOnClient(); - - size_t getLocalDataSize(void) { if (!isComputed_) createGlobalIndexSendToServer(); return localDataSize_ ;} - std::vector getNGlob() { return nGlob_; } - std::vector getDataNIndex() { return dataNIndex_; } - - bool isDataDistributed() { return isDataDistributed_; } - - static int getDomainIndex(const int& dataIIndex, const int& dataJIndex, - const int& dataIBegin, const int& dataJBegin, - const int& dataDim, const int& ni, int& j); - static int getAxisIndex(const int& dataIndex, const int& dataBegin, const int& ni); - - void partialClear(void) ; //! clear heavy sized attibutes - - protected: - void createGlobalIndex(); - void readDistributionInfo(CGrid* grid); - void readDistributionInfo(const std::vector& domList, - const std::vector& axisList, - const std::vector& scalarList, - const CArray& axisDomainOrder); - private: - //! Create local index of a domain - void createLocalDomainDataIndex(); - - //! Create local index of an axis - void createLocalAxisDataIndex(); - - //! Create local index of a scalar - void createLocalScalarDataIndex(); - - template - void readGridMaskInfo(const CArray& gridMask); - - private: - //!< LocalData index on client - GlobalLocalDataMap globalLocalDataSendToServerMap_; - GlobalLocalDataMap globalDataIndex_; - - /*! Array holding masked data indexes. - * It includes: - * masking on data (data_i/j_index or data_ni/nj and data_ibegin) - * masking on grid elements (domains, axes or scalars) - * It DOES NOT include grid mask. - * The array size defines the data size entering the workflow. It is used by source filter of client or server1. - */ - std::vector localDataIndex_; - - /*! Array holding grid mask. If grid mask is not defined, its size is zero. - * It is used by source filter of client for replacing unmasked data by NaN. - */ - std::vector localMaskIndex_; - - std::vector localMaskedDataIndex_; - //!< the size of local data of the grid - size_t localDataSize_ ; - - private: - /*! Domains and axis are considered elements. - * A grid composed of 1 domain and 1 axis has 2 elements */ - int numElement_; - CArray axisDomainOrder_; //!< Order of axis and domain of a grid - - std::vector nLocal_; //!< Local size of each dimension (ni, nj, etc, ...) - std::vector nGlob_; //!< Global size of each dimension (e.x: ni_glo, nj_glo, etc, ...) - std::vector nBeginLocal_;//!< Begin index of each dimension (e.x: for domain, it's always 0, for axis, it's zoom_begin, ...) - std::vector nBeginGlobal_; //!< Begin index of each dimension (e.x: ibegin, jbegin, ...) - - // Data_n_index of domain or axis (For now, axis uses its size as data_n_index - std::vector dataNIndex_; //!< Data_n_index in case of domain - std::vector dataDims_; //!< Data_dim, domain can have data_dim == 1 or 2 - std::vector dataBegin_; //!< Data begin (data_ibegin, data_jbegin, etc) - std::vector > dataIndex_; //!< Data index - std::vector > infoIndex_; //!< i_index, j_index - - std::vector indexMap_; //!< Mapping element index to dimension index - std::vector > elementLocalIndex_; //!< Local index of each element - std::vector > elementGlobalIndex_; //!< Global index of each element - std::vector > elementIndexData_; //!< // The correct index of a domain has true value, the ghost one has false value - std::vector elementNLocal_; - std::vector elementNGlobal_; - - //!< (Only for grid with one axis or scalar)Flag to determine whether data is distributed or not - bool isDataDistributed_; - int axisNum_; - int domainNum_; - bool isComputed_; - - private: - // Just suppose that grid mask has 3 dimension. Need change - CArray gridMask_; //!< Mask of grid - - private: - CDistributionClient(const CDistributionClient& distClient); //! Not implement -}; - -/*! - A grid can have multiple dimension, so can its mask in the form of multi-dimension array. -It's not a good idea to store all multi-dimension arrays corresponding to each mask. -One of the ways is to convert this array into 1-dimension one and every process is taken place on it. - \param [in] multi-dimension array grid mask -*/ -template -void CDistributionClient::readGridMaskInfo(const CArray& gridMask) -{ - int dim = gridMask.dimensions(); - std::vector dimensionSizes(dim); - for (int i = 0; i < dim; ++i) dimensionSizes[i] = gridMask.extent(i); - - std::vector idxLoop(dim,0); - int ssize = gridMask.numElements(), idx = 0; - gridMask_.resize(ssize); - while (idx < ssize) - { - for (int i = 0; i < dim-1; ++i) - { - if (idxLoop[i] == dimensionSizes[i]) - { - idxLoop[i] = 0; - ++idxLoop[i+1]; - } - } - - int maskIndex = idxLoop[0]; - int mulDim = 1; - for (int k = 1; k < dim; ++k) - { - mulDim *= dimensionSizes[k-1]; - maskIndex += idxLoop[k]*mulDim; - } - gridMask_(maskIndex) = *(gridMask.dataFirst()+maskIndex); - - ++idxLoop[0]; - ++idx; - } -} - -} // namespace xios -#endif // __XIOS_DISTRIBUTIONCLIENT_HPP__ diff --git a/xios_2311_src/src/distribution/distribution_server.cpp b/xios_2311_src/src/distribution/distribution_server.cpp deleted file mode 100644 index 62604597f9186d9fa5499eb2bbae2d6e605cbfbb..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/distribution_server.cpp +++ /dev/null @@ -1,223 +0,0 @@ -/*! - \file distribution_server.cpp - \author Ha NGUYEN - \since 13 Jan 2015 - \date 10 Sep 2016 - - \brief Index distribution on server side. - */ -#include "distribution_server.hpp" -#include "utils.hpp" - -namespace xios { - -CDistributionServer::CDistributionServer(int rank, const std::vector& nBegin, - const std::vector& nSize, - const std::vector& nBeginGlobal, - const std::vector& nGlobal) - : CDistribution(rank, nGlobal.size()), nGlobal_(nGlobal), nBeginGlobal_(nBeginGlobal), - nSize_(nSize), nBegin_(nBegin), globalLocalIndexMap_() -{ - createGlobalIndex(); -} - -CDistributionServer::CDistributionServer(int rank, - const std::vector >& globalIndexElements, - const CArray& elementOrder, - const std::vector& nBegin, - const std::vector& nSize, - const std::vector& nBeginGlobal, - const std::vector& nGlobal) - : CDistribution(rank, nGlobal.size()), nGlobal_(nGlobal), nBeginGlobal_(nBeginGlobal), - nSize_(nSize), nBegin_(nBegin), globalLocalIndexMap_() -{ - createGlobalIndex(globalIndexElements, elementOrder); -} - -CDistributionServer::~CDistributionServer() -{ -} - -/*! - Create global index on server side - Like the similar function on client side, this function serves on creating global index -for data written by the server. The global index is used to calculating local index of data -written on each server -*/ -void CDistributionServer::createGlobalIndex() -{ - size_t idx = 0, ssize = 1; - for (int i = 0; i < nSize_.size(); ++i) ssize *= nSize_[i]; - - this->globalIndex_.resize(ssize); - std::vector idxLoop(this->getDims(),0); - std::vector currentIndex(this->getDims()); - int innerLoopSize = nSize_[0]; - - globalLocalIndexMap_.rehash(std::ceil(ssize/globalLocalIndexMap_.max_load_factor())); - while (idxdims_-1; ++i) - { - if (idxLoop[i] == nSize_[i]) - { - idxLoop[i] = 0; - ++idxLoop[i+1]; - } - } - - for (int i = 1; i < this->dims_; ++i) currentIndex[i] = idxLoop[i] + nBegin_[i]; - - size_t mulDim, globalIndex; - for (int i = 0; i < innerLoopSize; ++i) - { - mulDim = 1; - globalIndex = i + nBegin_[0]; - - for (int k = 1; k < this->dims_; ++k) - { - mulDim *= nGlobal_[k-1]; - globalIndex += (currentIndex[k])*mulDim; - } - globalLocalIndexMap_[globalIndex] = idx; - this->globalIndex_(idx) = globalIndex; - - ++idx; - } - idxLoop[0] += innerLoopSize; - } -} - -/*! - Create global index on server side - Like the similar function on client side, this function serves on creating global index -for data written by the server. The global index is used to calculating local index of data -written on each server - \param[in] globalIndexElement global index on server side of each element of grid (scalar, axis, domain) - \param[in] elementOrder the order of elements of grid (e.x: domain->axis or domain->scalar) -*/ -void CDistributionServer::createGlobalIndex(const std::vector >& globalIndexElements, - const CArray& elementOrder) -{ - int numElement = elementOrder.numElements(), elementIdx = 0; - std::vector indexMap(numElement); - for (int i = 0; i < numElement; ++i) - { - indexMap[i] = elementIdx; - if (2 == elementOrder(i)) - { - elementIdx += 2; - } - else - ++elementIdx; - } - - std::vector elementGlobalSize(numElement); - size_t globalSize = 1; - for (int i = 0; i < numElement; ++i) - { - int elementType = elementOrder(i); - elementGlobalSize[i] = globalSize; - if (2 == elementType) // domain - { - globalSize *= nGlobal_[indexMap[i]+1] * nGlobal_[indexMap[i]]; - } - else // axis or scalar - { - globalSize *= nGlobal_[indexMap[i]]; - } - } - - size_t ssize = 1; - for (int i = 0; i < globalIndexElements.size(); ++i) ssize *= globalIndexElements[i].numElements(); - this->globalIndex_.resize(ssize); - globalLocalIndexMap_.rehash(std::ceil(ssize/globalLocalIndexMap_.max_load_factor())); - - std::vector idxLoop(numElement,0); - std::vector currentIndex(numElement); - int innerLoopSize = globalIndexElements[0].numElements(); - - size_t idx = 0; - while (idxglobalIndex_(idx) = globalIndex; - ++idx; - } - idxLoop[0] += innerLoopSize; - } -} - -/*! - Compute local index for writing data on server - \param [in] globalIndex Global index received from client -*/ -void CDistributionServer::computeLocalIndex(CArray& globalIndex) -{ - size_t ssize = globalIndex.numElements(); - size_t localIndexSize = std::min(globalIndex_.numElements(), ssize); - CArray localIndex(localIndexSize); - GlobalLocalMap::const_iterator ite = globalLocalIndexMap_.end(), it; - int i = 0; - for (size_t idx = 0; idx < ssize; ++idx) - { - it = globalLocalIndexMap_.find(globalIndex(idx)); - if (ite != it) - { - localIndex(i) = it->second; - ++i; - } - } - - globalIndex.reference(localIndex); -} - -/*! - Transforms local indexes owned by the server into global indexes - \param [in/out] indexes on input, local indexes of the server, - on output, the corresponding global indexes -*/ -void CDistributionServer::computeGlobalIndex(CArray& indexes) const -{ - for (int i = 0; i < indexes.numElements(); ++i) - { - indexes(i) = globalIndex_(indexes(i)); - } -} - -/*! - Get the size of grid index in server (e.x: sizeGrid *= size of each dimensiion) -*/ -int CDistributionServer::getGridSize() const -{ - return globalLocalIndexMap_.size(); -} - -void CDistributionServer::partialClear(void) -{ - GlobalLocalMap void1 ; - globalLocalIndexMap_.swap(void1) ; -} - -} // namespace xios diff --git a/xios_2311_src/src/distribution/distribution_server.hpp b/xios_2311_src/src/distribution/distribution_server.hpp deleted file mode 100644 index 9998cb89e917dd356429dfaf524534f938907441..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/distribution_server.hpp +++ /dev/null @@ -1,68 +0,0 @@ -/*! - \file distribution_server.hpp - \author Ha NGUYEN - \since 13 Jan 2015 - \date 04 Feb 2015 - - \brief Index distribution on server side. - */ - -#ifndef __XIOS_DISTRIBUTION_SERVER_HPP__ -#define __XIOS_DISTRIBUTION_SERVER_HPP__ - -#include "distribution.hpp" - -namespace xios { - -/*! - \class CDistributionServer - The class, for now, plays a role of computing local index for writing data on server -*/ -class CDistributionServer : public CDistribution -{ - public: - /** Default constructor */ - CDistributionServer(int rank, int dims, const CArray& globalIndex = CArray()); - CDistributionServer(int rank, const std::vector& nBeginServer, - const std::vector& nSizeServer, const std::vector& nGlobal); - CDistributionServer(int rank, const std::vector& nBeginServer, - const std::vector& nSizeServer, - const std::vector& nBeginGlobal, - const std::vector& nGlobal); - - CDistributionServer(int rank, - const std::vector >& globalIndexElements, - const CArray& elementOrder, - const std::vector& nBeginServer, - const std::vector& nSizeServer, - const std::vector& nBeginGlobal, - const std::vector& nGlobal); - - /** Default destructor */ - virtual ~CDistributionServer(); - - const GlobalLocalMap& getGlobalLocalIndex() const { return globalLocalIndexMap_; } - int getGridSize() const; - - virtual void computeLocalIndex(CArray& globalIndex); - virtual void computeGlobalIndex(CArray& indexes) const; - virtual void partialClear(void); //! clear heavy sized attibutes - - protected: - virtual void createGlobalIndex(); - void createGlobalIndex(const std::vector >& globalIndexElements, - const CArray& elementOrder); - - protected: - GlobalLocalMap globalLocalIndexMap_; - - private: - std::vector nGlobal_; - std::vector nBeginGlobal_; - std::vector nSize_; - std::vector nBegin_; - -}; - -} // namespace xios -#endif // __XIOS_DISTRIBUTION_SERVER_HPP__ diff --git a/xios_2311_src/src/distribution/distribution_type.hpp b/xios_2311_src/src/distribution/distribution_type.hpp deleted file mode 100755 index b51c34038a8944a8822e43e445ad4c77660b4735..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/distribution_type.hpp +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef __DISTRIBUTION_TYPE_HPP__ -#define __DISTRIBUTION_TYPE_HPP__ - -namespace xios -{ - enum class EDistributionType { NONE=0, ROOT, BANDS, BLOCKS, COLUMNS} ; -} - -#endif \ No newline at end of file diff --git a/xios_2311_src/src/distribution/element.cpp b/xios_2311_src/src/distribution/element.cpp deleted file mode 100755 index 2bcc7905fd292024d2baf6668c9961753b53069d..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/element.cpp +++ /dev/null @@ -1,158 +0,0 @@ -#include "element.hpp" -#include "distributed_view.hpp" -#include "local_view.hpp" -#include "local_connector.hpp" -#include "context_client.hpp" -#include "context_server.hpp" -#include "mpi.hpp" - - -namespace xios -{ - - CDistributedElement::CDistributedElement(int globalSize, const map>& globalIndex) - { - globalSize_= globalSize ; - for(auto index : globalIndex) - { - globalIndex_[index.first].reference(index.second.copy()) ; - localSize_[index.first] = index.second.numElements() ; - } - } - - CDistributedElement::CDistributedElement(CEventServer& event) - { - recvFromClient(event) ; - } - - void CDistributedElement::addView(CElementView::type type, std::map>& indexView) - { - views_[type] = make_shared(shared_from_this(), type, indexView) ; - } - - void CDistributedElement::addView(CElementView::type type, std::map>& maskView) - { - views_[type] = make_shared(shared_from_this(), type, maskView) ; - } - - void CDistributedElement::addFullView(void) - { - if (views_[CElementView::FULL]!=nullptr) return ; - - std::map> indexView ; - for(auto rank : globalIndex_) - { - auto& index = indexView[rank.first] ; - int size=rank.second.numElements() ; - index.resize(size) ; - for(int i=0;igetRemoteSize() ; - vector nbSenders(remoteSize,0) ; - for(auto rank : globalIndex_) nbSenders[rank.first]=1 ; - MPI_Allreduce(MPI_IN_PLACE, nbSenders.data(), remoteSize, MPI_INT, MPI_SUM, client->getIntraComm()) ; - - list messages; - for(auto ranksData : globalIndex_) - { - int rank = ranksData.first ; - auto& data = ranksData.second ; - - messages.push_back(CMessage(messageHeader)); - messages.back()<sendEvent(event) ; - } - - void CDistributedElement::recvFromClient(CEventServer& event) - { - globalIndex_.clear(); - for (auto& subEvent : event.subEvents) - { - CBufferIn* buffer = subEvent.buffer; - int rank=subEvent.rank ; - *buffer>>globalSize_ ; - *buffer >> globalIndex_[rank]; - } - localSize_.clear() ; - for(auto& globalIndex : globalIndex_) localSize_[globalIndex.first] = globalIndex.second.numElements() ; - } - - - - CLocalElement::CLocalElement(int localRank, size_t globalSize, CArray& globalIndex) - : CDistributedElement(globalSize, {{localRank, globalIndex}}), - globalIndex_(CDistributedElement::globalIndex_[localRank]), localSize_(CDistributedElement::localSize_[localRank]), localRank_(localRank) - { - - } - - CLocalElement::CLocalElement(int localRank, CEventServer& event) : globalIndex_(CDistributedElement::globalIndex_[localRank]), localSize_(CDistributedElement::localSize_[localRank]), localRank_(localRank) - { - recvFromClient(localRank, event) ; - } - - void CLocalElement::recvFromClient(int localRank, CEventServer& event) - { - set globalIndex ; - - for (auto& subEvent : event.subEvents) - { - CBufferIn* buffer = subEvent.buffer; - int rank=subEvent.rank ; - CArray indGlo ; - *buffer >> globalSize_>> indGlo; - globalIndex.insert(indGlo.dataFirst(), indGlo.dataFirst()+indGlo.numElements()) ; - } - - localSize_ = globalIndex.size() ; - globalIndex_.resize(localSize_) ; - int i=0 ; - for(auto& ind : globalIndex) { globalIndex_(i)=ind ; i++; } - } - - void CLocalElement::addView(CElementView::type type, CArray& indexView) - { - views_[type] = make_shared(static_pointer_cast(shared_from_this()), type, indexView) ; - } - - void CLocalElement::addView(CElementView::type type, CArray& maskView) - { - views_[type] = make_shared(static_pointer_cast(shared_from_this()), type, maskView) ; - } - - void CLocalElement::addFullView(void) - { - if (views_[CElementView::FULL]!=nullptr) return ; - - CArray indexView(localSize_) ; - for(int i=0;i CLocalElement::getView(CElementView::type type) - { - if (views_[(size_t)type]==nullptr) { ERROR("CLocalElement::getView(CElementView::type type)",<<"View is not initialized");} - else return static_pointer_cast(views_[(size_t)type]) ; - } - - shared_ptr CLocalElement::getConnector(CElementView::type srcType, CElementView::type dstType) - { - auto newPair = pair(srcType,dstType); - auto it = connectors_.find(newPair) ; - if (it==connectors_.end()) - { - auto insertPair=pair, shared_ptr>(newPair,make_shared(getView(srcType),getView(dstType))) ; - it=connectors_.insert(insertPair).first ; - it->second->computeConnector() ; - } - return it->second ; - } - -} \ No newline at end of file diff --git a/xios_2311_src/src/distribution/element.hpp b/xios_2311_src/src/distribution/element.hpp deleted file mode 100755 index 18d68dfede57e87112257c827583e92cece33b9a..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/element.hpp +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef __ELEMENT_HPP__ -#define __ELEMENT_HPP__ - -#include "xios_spl.hpp" -#include "array_new.hpp" -#include "element_view.hpp" -#include "exception.hpp" -#include "context_client.hpp" -#include "context_server.hpp" - -namespace xios -{ - class CDistributedView ; - class CLocalView; - class CLocalConnector ; - - class CDistributedElement : public std::enable_shared_from_this - { - - protected: - std::map> globalIndex_ ; - std::map localSize_ ; - size_t globalSize_ ; - std::vector> views_= std::vector>(CElementView::numViewType_) ; - CDistributedElement(void) {} ; - - public: - CDistributedElement(int globalSize, const map>& globalIndex) ; - CDistributedElement(CEventServer& event) ; - void addFullView(void) ; - void sendToServer(CContextClient* client, CEventClient& event, const CMessage& messageHeader) ; - void recvFromClient(CEventServer& event) ; - size_t getGlobalSize(void) { return globalSize_;} - std::map>& getGlobalIndex(void) { return globalIndex_;} - - shared_ptr getView(CElementView::type type) - { - if (views_[(size_t)type]==nullptr) { ERROR("CDistributedElement::getView(CElementView::type type)",<<"View is not initialized");} - else return views_[(size_t)type] ; - } - - void addView(CElementView::type type, std::map>& indexView) ; - void addView(CElementView::type type, std::map>& maskView) ; - void sendToServer(CEventClient& event, const CMessage& messageHeader) ; - - friend class CDistributedView ; - } ; - - - class CLocalElement : public CDistributedElement - { - // keep local connector inside - std::map, shared_ptr> connectors_ ; - - public: - CLocalElement(int localRank, size_t globalSize, CArray& globalIndex) ; - CLocalElement(int localRank, CEventServer& event) ; - void recvFromClient(int localRank, CEventServer& event) ; - const CArray& getGlobalIndex(void) { return globalIndex_ ;} - void addView(CElementView::type type, CArray& indexView) ; - void addView(CElementView::type type, CArray& maskView) ; - void addFullView(void) ; - - shared_ptr getView(CElementView::type type) ; - /* { - if (views_[(size_t)type]==nullptr) { ERROR("CLocalElement::getView(CElementView::type type)",<<"View is not initialized");} - else return static_pointer_cast(views_[(size_t)type]) ; - } -*/ - shared_ptr getConnector(CElementView::type srcType, CElementView::type dstType) ; - - private : - int localRank_; - CArray& globalIndex_ ; - int& localSize_ ; - - friend class CLocalView ; - } ; - -} - -#endif - diff --git a/xios_2311_src/src/distribution/element_view.cpp b/xios_2311_src/src/distribution/element_view.cpp deleted file mode 100755 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/xios_2311_src/src/distribution/element_view.hpp b/xios_2311_src/src/distribution/element_view.hpp deleted file mode 100755 index 34156166ed6b6ccd34d9ba944930819c15c77f22..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/element_view.hpp +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef __ELEMENT_VIEW_HPP__ -#define __ELEMENT_VIEW_HPP__ - -#include "xios_spl.hpp" -#include "array_new.hpp" - -namespace xios -{ - class CElementView - { - public: - enum type : size_t { FULL=0, MODEL, WORKFLOW} ; - const static int numViewType_ = 3 ; - protected: - type type_; - } ; - -} - -#endif \ No newline at end of file diff --git a/xios_2311_src/src/distribution/gatherer_connector.cpp b/xios_2311_src/src/distribution/gatherer_connector.cpp deleted file mode 100755 index fd850a66a973cb73e69d73b425325ba633dd5583..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/gatherer_connector.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include "gatherer_connector.hpp" - -namespace xios -{ - void CGathererConnector::computeConnector(void) - { - dstSize_=dstView_->getSize() ; - auto& srcGlobalIndex = srcView_->getGlobalIndex() ; - auto& srcIndex = srcView_->getIndex() ; - for(auto& rankIndex : srcIndex) srcSize_[rankIndex.first] = rankIndex.second.numElements(); - auto& dstGlobalIndex = dstView_->getGlobalIndex() ; - auto& dstIndex = dstView_->getIndex() ; - dstSize_=dstIndex.numElements() ; - - unordered_map mapGlobalLocalIndex ; - int globalIndexSize=dstGlobalIndex.size() ; - //for(auto& ind : dstIndex) mapGlobalLocalIndex[dstGlobalIndex(ind)] = ind ; - for(int i=0; i=0 && dstIndex(i)=0 && index(ind)second) ; - mask.push_back(true) ; - } - else mask.push_back(false) ; - } - else mask.push_back(false) ; - } - } - } - - -} \ No newline at end of file diff --git a/xios_2311_src/src/distribution/gatherer_connector.hpp b/xios_2311_src/src/distribution/gatherer_connector.hpp deleted file mode 100755 index 427b6ab39738241fd76b92723c07ec69466e91b0..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/gatherer_connector.hpp +++ /dev/null @@ -1,371 +0,0 @@ -#ifndef __GATHERER_CONNECTOR_HPP__ -#define __GATHERER_CONNECTOR_HPP__ - -#include "xios_spl.hpp" -#include "array_new.hpp" -#include "distributed_view.hpp" -#include "mpi.hpp" -#include "local_view.hpp" -#include "distributed_view.hpp" -#include "context_client.hpp" -#include "reduction_types.hpp" - - -namespace xios -{ - - class CGathererConnector - { - private: - shared_ptr srcView_; - shared_ptr dstView_; - map> connector_ ; - map> mask_ ; // mask is on src view - int dstSize_ ; - map srcSize_ ; - - public: - CGathererConnector(shared_ptr srcView, shared_ptr dstView) : srcView_(srcView), dstView_(dstView) {} ; - void computeConnector(void) ; - - template - void transfer(int repeat, int sizeT, map>& dataIn, CArray& dataOut, EReduction op = EReduction::none) - { - // for future, make a specific transfer function for sizeT=1 to avoid multiplication (increasing performance) - - size_t dstSlice = dstSize_*sizeT ; - dataOut.resize(repeat* dstSlice) ; - - - if (op == EReduction::none) // tranfer without reduction - { - for(auto& data : dataIn) - { - T* output = dataOut.dataFirst() ; - int rank=data.first ; - auto input = data.second.dataFirst() ; - auto& connector=connector_[rank] ; - auto& mask=mask_[rank] ; - int size=mask.size() ; - size_t srcSlice = size * sizeT ; - for(int l=0; l vcount(dataOut.size(),0) ; - int* count = vcount.data() ; - T defaultValue = std::numeric_limits::quiet_NaN(); - for(auto& data : dataIn) - { - T* output = dataOut.dataFirst() ; - int rank=data.first ; - auto input = data.second.dataFirst() ; - auto& connector=connector_[rank] ; - auto& mask=mask_[rank] ; - int size=mask.size() ; - size_t srcSlice = size * sizeT ; - for(int l=0; l0) dataOut[i]/=count[i] ; - else dataOut[i] = defaultValue ; - } - else for(int i=0; i < dataOut.size() ; i++) if (count[i]==0) dataOut[i] = defaultValue ; - } - } - - template - void transfer(int sizeT, map>& dataIn, CArray& dataOut, EReduction op = EReduction::none) - { - transfer(1, sizeT, dataIn, dataOut, op) ; - } - - template - void transfer(map>& dataIn, CArray& dataOut, EReduction op = EReduction::none) - { - transfer(1,dataIn,dataOut, op) ; - } - - template - void transfer(int rank, shared_ptr* connectors, int nConnectors, const T* input, T* output, EReduction op = EReduction::none, int* count=nullptr) - { - auto& connector = connector_[rank] ; // probably costly, find a better way to avoid the map - auto& mask = mask_[rank] ; - int srcSize = mask.size() ; - - if (nConnectors==0) - { - if (op == EReduction::none) - { - for(int i=0, j=0; igetSrcSliceSize(rank, connectors-1, nConnectors-1) ; - int dstSliceSize = (*(connectors-1))->getDstSliceSize(connectors-1, nConnectors-1) ; - - const T* in = input ; - for(int i=0,j=0;itransfer(rank, connectors-1, nConnectors-1, in, output+connector[j]*dstSliceSize, op, count+connector[j]*dstSliceSize) ; // the multiplication must be avoid in further optimization - j++ ; - } - in += srcSliceSize ; - } - } - - } - - // hook for transfering mask in grid connector, maybe find an other way to doing that... - void transfer_or(int rank, shared_ptr* connectors, int nConnectors, const bool* input, bool* output) - { - auto& connector = connector_[rank] ; // probably costly, find a better way to avoid the map - auto& mask = mask_[rank] ; - int srcSize = mask.size() ; - - if (nConnectors==0) - { - for(int i=0, j=0; igetSrcSliceSize(rank, connectors-1, nConnectors-1) ; - int dstSliceSize = (*(connectors-1))->getDstSliceSize(connectors-1, nConnectors-1) ; - - const bool* in = input ; - for(int i=0,j=0;itransfer_or(rank, connectors-1, nConnectors-1, in, output+connector[j]*dstSliceSize) ; // the multiplication must be avoid in further optimization - j++ ; - } - in += srcSliceSize ; - } - } - - } - - - - template - void transfer(map>& dataIn, CArray& dataOut, T missingValue, EReduction op = EReduction::none) - { - transfer(1, 1, dataIn, dataOut, missingValue, op); - } - - template - void transfer(int sizeT, map>& dataIn, CArray& dataOut, T missingValue, EReduction op = EReduction::none) - { - transfer(1, sizeT, dataIn, dataOut, missingValue, op) ; - } - - template - void transfer(int repeat , int sizeT, map>& dataIn, CArray& dataOut, T missingValue, EReduction op = EReduction::none) - { - dataOut.resize(repeat*dstSize_*sizeT) ; - dataOut=missingValue ; - transfer(repeat, sizeT, dataIn, dataOut, op) ; - } - - template - void transfer(CEventServer& event, int sizeT, CArray& dataOut, EReduction op = EReduction::none) - { - map> dataIn ; - for (auto& subEvent : event.subEvents) - { - auto& data = dataIn[subEvent.rank]; - (*subEvent.buffer) >> data ; - } - transfer(1, sizeT, dataIn, dataOut, op) ; - } - - template - void transfer(CEventServer& event, CArray& dataOut, EReduction op = EReduction::none) - { - transfer(event, 1, dataOut, op) ; - } - - template - void transfer(CEventServer& event, int sizeT, CArray& dataOut, T missingValue, EReduction op = EReduction::none) - { - map> dataIn ; - for (auto& subEvent : event.subEvents) - { - auto& data = dataIn[subEvent.rank]; - (*subEvent.buffer) >> data ; - } - transfer(1, sizeT, dataIn, dataOut, missingValue, op) ; - } - - template - void transfer(CEventServer& event, CArray& dataOut, T missingValue, EReduction op = EReduction::none) - { - map> dataIn ; - for (auto& subEvent : event.subEvents) - { - auto& data = dataIn[subEvent.rank]; - (*subEvent.buffer) >> data ; - } - transfer(1, 1, dataIn, dataOut, missingValue, op) ; - } - - int getSrcSliceSize(int rank, shared_ptr* connectors, int nConnectors) - { if (nConnectors==0) return srcSize_[rank] ; else return srcSize_[rank] * (*(connectors-1))->getSrcSliceSize(rank, connectors-1,nConnectors-1) ; } - - int getDstSliceSize(shared_ptr* connectors, int nConnectors) - { if (nConnectors==0) return dstSize_ ; else return dstSize_ * (*(connectors-1))->getDstSliceSize(connectors-1,nConnectors-1) ; } - - int getDstSize(void) {return dstSize_ ;} - } ; - -} - -#endif diff --git a/xios_2311_src/src/distribution/grid_client_server_remote_connector.cpp b/xios_2311_src/src/distribution/grid_client_server_remote_connector.cpp deleted file mode 100755 index c3ec519de8a4c20e619769426d790fa80c899bc3..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/grid_client_server_remote_connector.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include "grid_client_server_remote_connector.hpp" - -namespace xios -{ - /** - * \brief class constructor. - * \param srcView List of sources views. - * \param dstView List of remotes views. - * \param localComm Local MPI communicator - * \param remoteSize Size of the remote communicator - */ - CGridClientServerRemoteConnector::CGridClientServerRemoteConnector( vector >& srcFullView, vector>& srcWorkflowView, - vector>& dstView, MPI_Comm localComm, int remoteSize) - : CGridRemoteConnector(srcFullView, dstView, localComm, remoteSize) , srcWorkflowView_(srcWorkflowView) - {} - - - void CGridClientServerRemoteConnector::computeConnector(bool eliminateRedondant) - { - if (eliminateRedondant) - { - auto workflowRemoteConnector=make_shared(srcWorkflowView_,dstView_,localComm_,remoteSize_) ; - workflowRemoteConnector->computeConnector() ; - computeViewDistribution() ; - - for(int i=0;igetIsSrcViewDistributed()[i] ; - computeConnectorMethods() ; - computeRedondantRanks() ; - - for(auto& rank : rankToRemove_) - if (workflowRemoteConnector->getRankToRemove().count(rank)!=0) - for(auto& element : elements_) element.erase(rank) ; - } - else - { - computeViewDistribution() ; - computeConnectorRedundant() ; - } - } - -} \ No newline at end of file diff --git a/xios_2311_src/src/distribution/grid_client_server_remote_connector.hpp b/xios_2311_src/src/distribution/grid_client_server_remote_connector.hpp deleted file mode 100755 index 29a6f7a2f6dcc13935acb1f7aa14c5f36675056b..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/grid_client_server_remote_connector.hpp +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef __GRID_CLIENT_SERVER_REMOTE_CONNECTOR_HPP__ -#define __GRID_CLIENT_SERVER_REMOTE_CONNECTOR_HPP__ - -#include "grid_remote_connector.hpp" - -namespace xios -{ - - class CGridClientServerRemoteConnector : public CGridRemoteConnector - { - - public: - - CGridClientServerRemoteConnector(vector>& srcView, vector>& worflowSrcView, vector>& dstView, MPI_Comm localComm, int remoteSize) ; - void computeConnector(bool eliminateRedondant=true) ; - vector> srcWorkflowView_ ; - } ; - -} - -#endif \ No newline at end of file diff --git a/xios_2311_src/src/distribution/grid_elements.cpp b/xios_2311_src/src/distribution/grid_elements.cpp deleted file mode 100755 index 67db821eae153143367aa7f08391129e279292d9..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/grid_elements.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include "grid_elements.hpp" -#include "grid_local_view.hpp" -#include "grid_local_connector.hpp" - -namespace xios -{ - - shared_ptr CGridLocalElements::getView(CElementView::type type) - { - if (views_[type]==nullptr) views_[type] = make_shared(shared_from_this(), type) ; - return views_[type] ; - } - - shared_ptr CGridLocalElements::getConnector(CElementView::type srcType, CElementView::type dstType, bool withMask) - { - auto newPair = pair(srcType,dstType); - auto it = connectors_.find(newPair) ; - if (it==connectors_.end()) - { - auto insertPair=pair, shared_ptr>(newPair, make_shared(shared_from_this(), srcType, dstType, withMask)) ; - it=connectors_.insert(insertPair).first ; - } - return it->second ; - } -} \ No newline at end of file diff --git a/xios_2311_src/src/distribution/grid_elements.hpp b/xios_2311_src/src/distribution/grid_elements.hpp deleted file mode 100755 index 70186467c5ed6aca96b6b641b783ca6bf0d37e16..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/grid_elements.hpp +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef __GRID_ELEMENTS_HPP__ -#define __GRID_ELEMENTS_HPP__ - -#include "xios_spl.hpp" -#include "array_new.hpp" -#include "element.hpp" - -namespace xios -{ - class CGridLocalView ; - class CGridLocalConnector ; - - class CGridLocalElements : public std::enable_shared_from_this - { - private: - std::vector> elements_ ; - std::vector> views_= std::vector>(CElementView::numViewType_) ; - std::map, shared_ptr> connectors_ ; - vector localMask_ ; - - public: - CGridLocalElements(vector > elements) : elements_(elements) {} - CGridLocalElements(vector> elements, vector& localMask) : elements_(elements), localMask_(localMask) {} - - bool hasLocalMask() { return !localMask_.empty() ;} - vector& getLocalMask(void) { return localMask_ ;} - - std::vector>& getElements(void) { return elements_ ; } - shared_ptr getView(CElementView::type type) ; - shared_ptr getConnector(CElementView::type srcType, CElementView::type dstType, bool withMask=false) ; - } ; -} - -#endif \ No newline at end of file diff --git a/xios_2311_src/src/distribution/grid_gatherer_connector.hpp b/xios_2311_src/src/distribution/grid_gatherer_connector.hpp deleted file mode 100755 index a77da0b56bc490a3326cb7e978035791c8c19468..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/grid_gatherer_connector.hpp +++ /dev/null @@ -1,117 +0,0 @@ -#ifndef __GRID_GATHERER_CONNECTOR_HPP__ -#define __GRID_GATHERER_CONNECTOR_HPP__ - -#include "xios_spl.hpp" -#include "array_new.hpp" -#include "distributed_view.hpp" -#include "mpi.hpp" -#include "local_view.hpp" -#include "distributed_view.hpp" -#include "context_client.hpp" -#include "gatherer_connector.hpp" -#include "reduction_types.hpp" - - -namespace xios -{ - - class CGridGathererConnector - { - private: - - vector> elementsConnector_ ; - int dstSize_ ; - - public: - CGridGathererConnector(vector> elementsConnector) : elementsConnector_(elementsConnector) - { - dstSize_ = 1 ; - for(auto& connector : elementsConnector_) dstSize_=dstSize_*connector->getDstSize() ; - } - - template - void transfer(const map>& input, CArray& output, EReduction op = EReduction::none) - { - int n = elementsConnector_.size()-1 ; - shared_ptr* connector = elementsConnector_.data() + n ; - output.resize(dstSize_) ; - - if (op == EReduction::none) - for(auto& rankDataIn : input) - elementsConnector_[n]->transfer(rankDataIn.first, connector, n, rankDataIn.second.dataFirst(), output.dataFirst()) ; - else - { - T defaultValue = std::numeric_limits::quiet_NaN(); - vector count(dstSize_,0) ; - for(auto& rankDataIn : input) - elementsConnector_[n]->transfer(rankDataIn.first, connector, n, rankDataIn.second.dataFirst(), output.dataFirst(), op, count.data()) ; - - for(int i=0;i - void transfer(const map>& input, CArray& output, T missingValue) - { - int n = elementsConnector_.size()-1 ; - shared_ptr* connector = elementsConnector_.data() + n ; - output.resize(dstSize_) ; - output = missingValue ; - for(auto& rankDataIn : input) - { - elementsConnector_[n]->transfer(rankDataIn.first, connector, n, rankDataIn.second.dataFirst(), output.dataFirst()) ; - } - } - - template - void transfer(CEventServer& event, CArray& dataOut, EReduction op = EReduction::none) - { - map> dataIn ; - for (auto& subEvent : event.subEvents) - { - auto& data = dataIn[subEvent.rank]; - (*subEvent.buffer) >> data ; - } - transfer(dataIn, dataOut, op) ; - } - - - void transfer_or(CEventServer& event, CArray& dataOut) - { - map> dataIn ; - for (auto& subEvent : event.subEvents) - { - auto& data = dataIn[subEvent.rank]; - (*subEvent.buffer) >> data ; - } - transfer_or(dataIn, dataOut) ; - } - - template - void transfer(CEventServer& event, CArray& dataOut, T missingValue) - { - map> dataIn ; - for (auto& subEvent : event.subEvents) - { - auto& data = dataIn[subEvent.rank]; - (*subEvent.buffer) >> data ; - } - transfer(dataIn, dataOut, missingValue) ; - } - - void transfer_or(const map>& input, CArray& output) - { - int n = elementsConnector_.size()-1 ; - shared_ptr* connector = elementsConnector_.data() + n ; - output.resize(dstSize_) ; - output = false ; - for(auto& rankDataIn : input) - { - elementsConnector_[n]->transfer_or(rankDataIn.first, connector, n, rankDataIn.second.dataFirst(), output.dataFirst()) ; - } - } - - }; -} - -#endif \ No newline at end of file diff --git a/xios_2311_src/src/distribution/grid_local_connector.cpp b/xios_2311_src/src/distribution/grid_local_connector.cpp deleted file mode 100755 index 20199f88f5281ba7ab82158f62a33d5366756bf3..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/grid_local_connector.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#include "grid_local_connector.hpp" -#include "grid_elements.hpp" -#include "element.hpp" -#include "grid_local_view.hpp" -#include "local_view.hpp" - -namespace xios -{ - - CGridLocalConnector::CGridLocalConnector(const std::vector>& elementsConnector) : elementsConnector_(elementsConnector) - { - srcSize_=1 ; - for(auto connector : elementsConnector_) srcSize_*=connector->getSrcSize() ; - dstSize_=1 ; - for(auto connector : elementsConnector_) dstSize_*=connector->getDstSize() ; - } - - CGridLocalConnector::CGridLocalConnector(shared_ptr parent, CElementView::type srcType, CElementView::type dstType, bool withMask) - { - shared_ptr srcView=parent->getView(srcType) ; - shared_ptr dstView=parent->getView(dstType) ; - - vector> srcViews = srcView->getViews() ; - vector> dstViews = dstView->getViews() ; - - vector>& elements = parent->getElements(); - for(auto element : elements) elementsConnector_.push_back(element->getConnector(srcType, dstType)) ; - srcSize_=1 ; - for(auto connector : elementsConnector_) srcSize_*=connector->getSrcSize() ; - dstSize_=1 ; - for(auto connector : elementsConnector_) dstSize_*=connector->getDstSize() ; - - if (parent->hasLocalMask() && withMask) - { - vector> elementsConnector ; - for(auto element : elements) elementsConnector.push_back(element->getConnector(CElementView::FULL, dstType)) ; - auto localToDst=make_shared(elementsConnector) ; - CArray maskIn(localToDst->getSrcSize()) ; - CArray maskOut1(localToDst->getDstSize()) ; - CArray maskOut2(localToDst->getDstSize()) ; - maskIn=true ; - localToDst->transfer(maskIn,maskOut1,false) ; - auto& localMask = parent->getLocalMask() ; - for(int i=0 ; i < maskIn.numElements() ; i++) maskIn(i)=localMask[i] ; - localToDst->transfer(maskIn,maskOut2,false) ; - mask_.assign(dstSize_,true) ; - for(int i=0;i> elementsConnector_ ; - int srcSize_ ; - int dstSize_ ; - vector mask_ ; - - public: - - CGridLocalConnector(const std::vector>& elementsConnector) ; - CGridLocalConnector(shared_ptr parent, CElementView::type srcType, CElementView::type dstType, bool withMask=false) ; - int getSrcSize(void) { return srcSize_ ;} - int getDstSize(void) { return dstSize_ ;} - - void computeMask(void) ; - bool computeMask_done_=false ; - - - template - void transfer(const CArray& input, CArray& output) - { - int n = elementsConnector_.size()-1 ; - shared_ptr* connector = elementsConnector_.data() + n ; - elementsConnector_[n]->transfer(connector, n, input.dataFirst(), output.dataFirst()) ; - } - - template - void transfer(const CArray& input, CArray& output, T missingValue) - { - int n = elementsConnector_.size()-1 ; - shared_ptr* connector = elementsConnector_.data() + n ; - elementsConnector_[n]->transfer(connector, n, input.dataFirst(), output.dataFirst(), missingValue) ; - if (!computeMask_done_) computeMask() ; - if (!mask_.empty()) - { - T* out = output.dataFirst() ; - for(auto mask : mask_) { if (!mask) *out=missingValue ; out++;} - } - } - - } ; - -} - -#endif \ No newline at end of file diff --git a/xios_2311_src/src/distribution/grid_local_view.cpp b/xios_2311_src/src/distribution/grid_local_view.cpp deleted file mode 100755 index ac7851ff3ef12f342276c9c8175099f6ffdd20d7..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/grid_local_view.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include "grid_local_view.hpp" -#include "grid_elements.hpp" - -namespace xios -{ - CGridLocalView::CGridLocalView(shared_ptr parent, CElementView::type type) : localMask_(parent->getLocalMask()) - { - size_ = 1 ; - for(auto element : parent->getElements()) - { - views_.push_back(element->getView(type)) ; - size_ *= element->getView(type)->getSize() ; - } - - } - -} \ No newline at end of file diff --git a/xios_2311_src/src/distribution/grid_local_view.hpp b/xios_2311_src/src/distribution/grid_local_view.hpp deleted file mode 100755 index 44d3cdc37407355a15ca1496959d74fb9161a7b1..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/grid_local_view.hpp +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef __GRID_LOCAL_VIEW_HPP__ -#define __GRID_LOCAL_VIEW_HPP__ - -#include "local_view.hpp" -#include "element.hpp" - -namespace xios -{ - class CGridLocalElements; - - class CGridLocalView - { - private: - std::vector> views_ ; - std::vector& localMask_ ; - int size_ ; - - public: - CGridLocalView(shared_ptr parent, CElementView::type type) ; - std::vector>& getViews(void) {return views_ ;} - shared_ptr getView(int i) {return views_[i] ;} - int getSize() { return size_ ;} - } ; -} - - -#endif \ No newline at end of file diff --git a/xios_2311_src/src/distribution/grid_mask_connector.cpp b/xios_2311_src/src/distribution/grid_mask_connector.cpp deleted file mode 100755 index 55f7c52d76363cb913089ed619117510b0cacb2b..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/grid_mask_connector.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include "grid_mask_connector.hpp" - -namespace xios -{ - void CGridMaskConnector::computeConnector(CArray& mask) - { - nViews_ = views_.size() ; - for(auto& view : views_) - { - size_.push_back(view->getLocalSize()) ; - elementsMask_.push_back(CArray(view->getLocalSize())) ; - elementsMask_.back() = false ; - } - index_.resize(nViews_,0) ; - bool* maskPtr = mask.dataFirst() ; - recursiveInternal(nViews_-1, maskPtr) ; - } - -} \ No newline at end of file diff --git a/xios_2311_src/src/distribution/grid_mask_connector.hpp b/xios_2311_src/src/distribution/grid_mask_connector.hpp deleted file mode 100755 index 89af1b686bacc17ee3f434271e53eb218cf2caeb..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/grid_mask_connector.hpp +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef __GRID_MASK_CONNECTOR_HPP__ -#define __GRID_MASK_CONNECTOR_HPP__ - -#include "xios_spl.hpp" -#include "array_new.hpp" -#include "local_view.hpp" -#include "distributed_view.hpp" - -namespace xios -{ - - class CGridMaskConnector - { - - public: - - CGridMaskConnector(vector>& views) : views_(views) {} - void computeConnector(CArray& mask) ; - - CArray& getElementMask(int pos) { return elementsMask_[pos] ;} - vector>& getElementsMask(void) ; - - private: - vector> views_ ; - vector> elementsMask_ ; - - vector size_ ; - vector index_ ; - int nViews_ ; - - private: - - void recursiveInternal(int level, bool*& mask) - { - if (level==0) - { - for(int i=0; i < size_[level] ; i++) - { - for(int j=0 ; j>& srcView, vector>& dstView, MPI_Comm localComm, int remoteSize) - : srcView_(srcView), dstView_(dstView), localComm_(localComm), remoteSize_(remoteSize) - {} - - /** - * \brief class constructor. - * \param srcView List of sources views. - * \param dstView List of remotes views. - * \param localComm Local MPI communicator - * \param remoteSize Size of the remote communicator - */ - CGridRemoteConnector::CGridRemoteConnector(vector>& srcView, vector< shared_ptr >& dstView, MPI_Comm localComm, int remoteSize) - : srcView_(srcView), localComm_(localComm), remoteSize_(remoteSize) - { - for(auto& it : dstView) dstView_.push_back((shared_ptr) it) ; - } - - - /** - * \brief Compute if each view composing the source grid and the remote grid is distributed or not. - * Result is stored on internal attributes \b isSrcViewDistributed_ and \b isDstViewDistributed_. - * \detail To compute this, a hash is computed for each array on indices. The hash must permutable, i.e. - * the order of the list of global indices doesn't influence the value of the hash. So simply a sum of - * hash of each indices is used for the whole array. After, the computed hash are compared with each other - * ranks of \b localComm_ MPI communicator using an MPI_ALLReduce. If, for each ranks, the hash is the same - * then the view is not distributed - */ - void CGridRemoteConnector::computeViewDistribution(void) - { - HashXIOS hashGlobalIndex; // hash function-object - - int nDst = dstView_.size() ; - vector hashRank(remoteSize_) ; - vector sizeRank(remoteSize_) ; - isDstViewDistributed_.resize(nDst) ; - - for(int i=0; i> globalIndexView ; - dstView_[i]->getGlobalIndexView(globalIndexView) ; - hashRank.assign(remoteSize_,0) ; // everybody ranks to 0 except rank of the remote view I have - // that would be assign to my local hash - sizeRank.assign(remoteSize_,0) ; - - for(auto& it : globalIndexView) - { - int rank=it.first ; - CArray& globalIndex = it.second ; - size_t globalIndexSize = globalIndex.numElements(); - size_t hashValue=0 ; - for(size_t ind=0;ind globalIndex ; - srcView_[i]->getGlobalIndexView(globalIndex) ; - hashRank.assign(commSize,0) ; // 0 for everybody except my rank - size_t globalIndexSize = globalIndex.numElements() ; - - size_t allEqual ; - MPI_Allreduce(&globalIndexSize, &allEqual, 1, MPI_SIZE_T, MPI_BXOR, localComm_) ; - if (allEqual!=0) - { - isSrcViewDistributed_[i]=true ; - break ; - } - - // warning : jenkins hash : 0 --> 0 : need to compare number of element for each ranks - size_t hashValue=0 ; - for(size_t ind=0;ind> srcView ; - vector> dstView ; - vector indElements ; - elements_.resize(srcView_.size()) ; - - bool srcViewsNonDistributed=true ; // not usefull now but later for optimization - for(int i=0;i ranks ; - for(auto& it : elements_[indElements[0]]) - { - if (it.second.numElements()==0) ranks[it.first] = false ; - else ranks[it.first] = true ; - } - - } - - -/** - * \brief Compute the connector, i.e. compute the \b elements_ attribute. - * \detail In order to achive better optimisation, - * we distingute the case when the grid is not distributed on source grid (\bcomputeSrcNonDistributed), - * or the remote grid (\b computeDstNonDistributed), or the both (\b computeSrcDstNonDistributed). - * Otherwise the generic method is called computeGenericMethod. Note that in the case, if one element view - * is not distributed on the source and on the remote grid, then we can used the tensorial product - * property to computing it independently using \b computeSrcDstNonDistributed method. - * After that, we call the \b removeRedondantRanks method to supress blocks of data that can be sent - * redondantly the the remote servers - */ - void CGridRemoteConnector::computeConnectorMethods(void) - { - vector> srcView ; - vector> dstView ; - vector indElements ; - elements_.resize(srcView_.size()) ; - - bool srcViewsNonDistributed=true ; - for(int i=0;i remoteRanks; - list notUsed ; - map ranks ; - computeLeaderProcess(commRank, commSize, remoteSize_, remoteRanks, notUsed) ; - for(int rank : remoteRanks) ranks[rank]=true ; - - for(int i=0; i ranks ; - for(int i=0;i ranks ; - for(auto& it : elements_[indElements[0]]) - { - if (it.second.numElements()==0) ranks[it.first] = false ; - else ranks[it.first] = true ; - } - - for(int i=0;i> globalIndexView ; - dstView_[i]->getGlobalIndexView(globalIndexView) ; - - CClientClientDHTTemplate::Index2InfoTypeMap dataInfo; - - for(auto& it : globalIndexView) - { - auto& globalIndex=it.second ; - for(size_t ind : globalIndex) dataInfo[ind]=it.first ; - } - - // First we feed the distributed hash map with key (remote global index) - // associated with the value of the remote rank - CClientClientDHTTemplate DHT(dataInfo, localComm_) ; - // after we feed the DHT with the local global indices of the source view - - int commRank, commSize ; - MPI_Comm_rank(localComm_,&commRank) ; - MPI_Comm_size(localComm_,&commSize) ; - CArray srcIndex ; - // like the source view is not distributed, then only the rank 0 need to feed the DHT - if (commRank==0) srcView_[i]->getGlobalIndexView(srcIndex) ; - - // compute the mapping - DHT.computeIndexInfoMapping(srcIndex) ; - auto& returnInfo = DHT.getInfoIndexMap() ; - - // returnInfo contains now the map for each global indices to send to a list of remote rank - // only for the rank=0 because it is the one to feed the DHT - // so it need to send the list to each server leader i.e. the local process that handle specifically one or more - // servers - - // rankIndGlo : rankIndGlo[rank][indGlo] : list of indice to send the the remote server of rank "rank" - vector> rankIndGlo(remoteSize_) ; - if (commRank==0) - for(auto& it1 : returnInfo) - for(auto& it2 : it1.second) rankIndGlo[it2].push_back(it1.first) ; - - - vector requests ; - - if (commRank==0) - { - requests.resize(remoteSize_) ; - for(int i=0 ; i remoteRanks; - list notUsed ; - // I am a server leader of which remote ranks ? - computeLeaderProcess(commRank, commSize, remoteSize_, remoteRanks, notUsed) ; - - for(auto remoteRank : remoteRanks) - { - MPI_Status status ; - int size ; - MPI_Probe(0,remoteRank,localComm_, &status); - MPI_Get_count(&status, MPI_SIZE_T, &size) ; - elements_[i][remoteRank].resize(size) ; - // for each remote ranks receive the global indices from proc 0 - MPI_Recv(elements_[i][remoteRank].dataFirst(),size, MPI_SIZE_T,0,remoteRank, localComm_,&status) ; - } - - if (commRank==0) - { - vector status(remoteSize_) ; - // asynchronous for sender, wait for completion - MPI_Waitall(remoteSize_, requests.data(), status.data()) ; - } - } - - /** - * \brief Compute the remote connector for the element \b i when the remote view is not distributed. - * After the call, element_[i] is defined. - * \param i Indice of the element composing the remote grid. - * \param ranks The list of rank for which the local proc is in charge to compute the connector - * (if leader server for exemple). if ranks[rank] == false the corresponding elements_ - * is set to void array (no data to sent) just in order to notify corresponding remote server - * that the call is collective with each other one - */ - void CGridRemoteConnector::computeDstNonDistributed(int i, map& ranks) - { - auto& element = elements_[i] ; - map> globalIndexView ; - dstView_[i]->getGlobalIndexView(globalIndexView) ; - - - CClientClientDHTTemplate::Index2InfoTypeMap dataInfo; - - // First we feed the distributed hash map with key (remote global index) - // associated with the value of the remote rank - for(auto& it : globalIndexView) - if (it.first==0) // since the remote view is not distributed, insert only the remote rank 0 - { - auto& globalIndex=it.second ; - for(size_t ind : globalIndex) dataInfo[ind]=0 ; // associated the the rank 0 - } - - CClientClientDHTTemplate DHT(dataInfo, localComm_) ; - // after we feed the DHT with the local global indices of the source view - - CArray srcIndex ; - srcView_[i]->getGlobalIndexView(srcIndex) ; - DHT.computeIndexInfoMapping(srcIndex) ; - auto& returnInfo = DHT.getInfoIndexMap() ; - - // returnInfo contains now the map for each global indices to send to a list of remote rank - // now construct the element_ list of global indices for each rank in my list except if the erray must be empty - for (auto& rank : ranks) - { - if (rank.second) // non empty array => for rank that have not any data to be received - { - int size=0 ; - for(auto& it : returnInfo) if (!it.second.empty()) size++ ; - auto& array = element[rank.first] ; - array.resize(size) ; - size=0 ; - for(auto& it : returnInfo) - if (!it.second.empty()) - { - array(size)=it.first ; - size++ ; - } - } - else element[rank.first] = CArray(0) ; // empty array => for rank that have not any data to be received - } - } - - /** - * \brief Compute the remote connector for the element \b i when the source and the remote view are not distributed. - * After the call, element_[i] is defined. - * \param i Indice of the element composing the remote grid. - * \param ranks The list of rank for which the local proc is in charge to compute the connector - * (if leader server for exemple). if ranks[rank] == false the corresponding elements_ - * is set to void array (no data to sent) just in order to notify corresponding remote server - * that the call is collective with each other one - */ - - void CGridRemoteConnector::computeSrcDstNonDistributed(int i, map& ranks) - { - auto& element = elements_[i] ; - map> globalIndexView ; - dstView_[i]->getGlobalIndexView(globalIndexView) ; - - - CClientClientDHTTemplate::Index2InfoTypeMap dataInfo; - // First we feed the distributed hash map with key (remote global index) - // associated with the value of the remote rank - - for(auto& it : globalIndexView) - if (it.first==0) // insert only the remote rank 0 since the remote view is not distributed - { - auto& globalIndex=it.second ; - for(size_t ind : globalIndex) dataInfo[ind]=0 ; // associated the the rank 0 - } - - CClientClientDHTTemplate DHT(dataInfo, localComm_) ; - // after we feed the DHT with the local global indices of the source view - - int commRank, commSize ; - MPI_Comm_rank(localComm_,&commRank) ; - MPI_Comm_size(localComm_,&commSize) ; - CArray srcIndex ; - - // like the source view is not distributed, then only the rank 0 need to feed the DHT - if (commRank==0) srcView_[i]->getGlobalIndexView(srcIndex) ; - DHT.computeIndexInfoMapping(srcIndex) ; - auto& returnInfo = DHT.getInfoIndexMap() ; - - vector indGlo ; - if (commRank==0) - for(auto& it1 : returnInfo) - for(auto& it2 : it1.second) indGlo.push_back(it1.first) ; - - // now local rank 0 know which indices to seed to remote rank 0, but all the server - // must receive the same information. So only the leader rank will sent this. - // So local rank 0 must broadcast the information to all leader. - // for this we create a new communicator composed of local process that must send data - // to a remote rank, data are broadcasted, and element_[i] is construction for each remote - // rank in charge - int color=0 ; - if (ranks.empty()) color=0 ; - else color=1 ; - if (commRank==0) color=1 ; - MPI_Comm newComm ; - MPI_Comm_split(localComm_, color, commRank, &newComm) ; - if (color==1) - { - // ok, I am part of the process that must send something to one or more remote server - // so I get the list of global indices from rank 0 - int dataSize ; - if (commRank==0) dataSize=indGlo.size() ; - MPI_Bcast(&dataSize,1,MPI_INT, 0, newComm) ; - indGlo.resize(dataSize) ; - MPI_Bcast(indGlo.data(),dataSize,MPI_SIZE_T,0,newComm) ; - } - MPI_Comm_free(&newComm) ; - - // construct element_[i] from indGlo - for(auto& rank : ranks) - { - if (rank.second) - { - int dataSize=indGlo.size(); - auto& element = elements_[i][rank.first] ; - element.resize(dataSize) ; - for(int i=0;i(0) ; - } - - } - - - /** - * \brief Generic method the compute the grid remote connector. Only distributed elements are specifed in the source view and remote view. - * Connector for non distributed elements are computed separatly to improve performance and memory consumption. After the call, - * \b elements_ is defined. - * \param srcView List of the source views composing the grid, without non distributed views - * \param dstView List of the remote views composing the grid, without non distributed views - * \param indElements Index of the view making the correspondance between all views and views distributed (that are in input) - */ - void CGridRemoteConnector::computeGenericMethod(vector>& srcView, vector>& dstView, vector& indElements) - { - // generic method, every element can be distributed - int nDst = dstView.size() ; - vector dstSliceSize(nDst) ; - dstSliceSize[0] = 1 ; - for(int i=1; igetGlobalSize()*dstSliceSize[i-1] ; - - CClientClientDHTTemplate::Index2VectorInfoTypeMap dataInfo ; - CClientClientDHTTemplate::Index2VectorInfoTypeMap info ; // info map - - // first, we need to feed the DHT with the global index of the remote server - // for that : - // First the first element insert the in a DHT with key as the rank and value the list of global index associated - // Then get the previously stored index associate with the remote rank I am in charge and reinsert the global index - // corresponding to the position of the element in the remote view suing tensorial product - // finaly we get only the list of remote global index I am in charge for the whole remote grid - - for(int pos=0; pos> globalIndexView ; - dstView[pos]->getGlobalIndexView(globalIndexView) ; - - CClientClientDHTTemplate::Index2VectorInfoTypeMap lastInfo(info) ; - - if (pos>0) - { - CArray ranks(globalIndexView.size()) ; - auto it=globalIndexView.begin() ; - for(int i=0 ; ifirst ; - CClientClientDHTTemplate dataRanks(info, localComm_) ; - dataRanks.computeIndexInfoMapping(ranks) ; - lastInfo = dataRanks.getInfoIndexMap() ; - } - - info.clear() ; - for(auto& it : globalIndexView) - { - int rank = it.first ; - auto& globalIndex = it.second ; - auto& inf = info[rank] ; - if (pos==0) for(int i=0;i dataRanks(dataInfo, localComm_) ; - - // generate list of global index for src view - int nSrc = srcView.size() ; - vector srcSliceSize(nSrc) ; - - srcSliceSize[0] = 1 ; - for(int i=1; igetGlobalSize()*srcSliceSize[i-1] ; - - vector srcGlobalIndex ; - size_t sliceIndex=0 ; - srcView[nSrc-1]->getGlobalIndex(srcGlobalIndex, sliceIndex, srcSliceSize.data(), srcView.data(), nSrc-1) ; - // now we have the global index of the source grid in srcGlobalIndex - // we feed the DHT with the src global index (if we have) - if (srcGlobalIndex.size()>0) - { - CArray srcGlobalIndexArray(srcGlobalIndex.data(), shape(srcGlobalIndex.size()),neverDeleteData) ; - dataRanks.computeIndexInfoMapping(srcGlobalIndexArray) ; - } - else - { - CArray srcGlobalIndexArray ; - dataRanks.computeIndexInfoMapping(srcGlobalIndexArray) ; - } - const auto& returnInfo = dataRanks.getInfoIndexMap() ; - // returnInfo contains now the map for each global indices to send to a list of remote rank - // but we want to use the tensorial product property to get the same information using only global - // index of element view. So the idea is to reverse the information : for a global index of the grid - // to send to the remote server, what is the global index of each element composing the grid ? - - vector>> elements(nSrc) ; // internal representation of elements composing the grid - - for(auto& indRanks : returnInfo) - { - size_t gridIndexGlo=indRanks.first ; - auto& ranks = indRanks.second ; - for(int i=nSrc-1; i>=0; i--) - { - auto& element = elements[i] ; - size_t localIndGlo = gridIndexGlo / srcSliceSize[i] ; - gridIndexGlo = gridIndexGlo % srcSliceSize[i] ; - for(int rank : ranks) element[rank].insert(localIndGlo) ; - } - } - -// elements_.resize(nSrc) ; - for(int i=0 ; i& indGlo = rankInd.second ; - CArray& indGloArray = elements_[indElements[i]][rank] ; - indGloArray.resize(indGlo.size()) ; - int j=0 ; - for (auto index : indGlo) { indGloArray(j) = index ; j++; } - } - } - - // So what about when there is some server that have no data to receive - // they must be inform they receive an event with no data. - // So find remote servers with no data, and one client will take in charge - // that it receive global index with no data (0-size) - vector ranks(remoteSize_,0) ; - for(auto& it : elements_[indElements[0]]) ranks[it.first] = 1 ; - MPI_Allreduce(MPI_IN_PLACE, ranks.data(), remoteSize_, MPI_INT, MPI_SUM, localComm_) ; - int commRank, commSize ; - MPI_Comm_rank(localComm_,&commRank) ; - MPI_Comm_size(localComm_,&commSize) ; - int pos=0 ; - for(int i=0; i(0) ; - pos++ ; - } - } - - /** - * \brief Once the connector is computed (compute \b elements_), redondant data can be avoid to be sent to the server. - * This call compute the redondant rank and store them in \b rankToRemove_ attribute. - * The goal of this method is to make a hash of each block of indice that determine wich data to send to a - * of a specific server rank using a hash method. So data to send to a rank is associated to a hash. - * After we compare hash between local rank and remove redondant data corresponding to the same hash. - */ - void CGridRemoteConnector::computeRedondantRanks(void) - { - int commRank ; - MPI_Comm_rank(localComm_,&commRank) ; - - set ranks; - for(auto& element : elements_) - for(auto& it : element) ranks.insert(it.first) ; - - for(auto& element : elements_) - for(auto& it : element) - if (ranks.count(it.first)==0) ERROR("void CGridRemoteConnector::removeRedondantRanks(void)",<<"number of ranks in elements is not coherent between each element") ; - - HashXIOS hashGlobalIndex; - - map hashRanks ; - for(auto& element : elements_) - for(auto& it : element) - { - auto& globalIndex=it.second ; - int rank=it.first ; - size_t hash ; - hash=0 ; - for(int i=0; i0) - { - if (hashRanks.count(rank)==0) hashRanks[rank]=hash ; - else hashRanks[rank]=hashGlobalIndex.hashCombine(hashRanks[rank],hash) ; - } - } - // a hash is now computed for data block I will sent to the server. - - CClientClientDHTTemplate::Index2InfoTypeMap info ; - - map hashRank ; - HashXIOS hashGlobalIndexRank; - for(auto& it : hashRanks) - { - it.second = hashGlobalIndexRank.hashCombine(it.first,it.second) ; - info[it.second]=commRank ; - hashRank[it.second]=it.first ; - } - - // we feed a DHT map with key : hash, value : myrank - CClientClientDHTTemplate dataHash(info, localComm_) ; - CArray hashList(hashRank.size()) ; - - int i=0 ; - for(auto& it : hashRank) { hashList(i)=it.first ; i++; } - - // now who are the ranks that have the same hash : feed the DHT with my list of hash - dataHash.computeIndexInfoMapping(hashList) ; - auto& hashRankList = dataHash.getInfoIndexMap() ; - - - for(auto& it : hashRankList) - { - size_t hash = it.first ; - auto& ranks = it.second ; - - bool first=true ; - // only the process with the lowest rank get in charge of sendinf data to remote server - for(int rank : ranks) if (commRank>rank) first=false ; - if (!first) rankToRemove_.insert(hashRank[hash]) ; - } - } - -} \ No newline at end of file diff --git a/xios_2311_src/src/distribution/grid_remote_connector.hpp b/xios_2311_src/src/distribution/grid_remote_connector.hpp deleted file mode 100755 index e1875b495548f0cded69092e0322ef331b191a62..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/grid_remote_connector.hpp +++ /dev/null @@ -1,94 +0,0 @@ -#ifndef __GRID_REMOTE_CONNECTOR_HPP__ -#define __GRID_REMOTE_CONNECTOR_HPP__ - -#include "xios_spl.hpp" -#include "array_new.hpp" -#include "mpi.hpp" -#include "local_view.hpp" -#include "distributed_view.hpp" -#include "context_client.hpp" - - -namespace xios -{ - - class CGridRemoteConnector - { - - public: - - CGridRemoteConnector(vector>& srcView, vector>& dstView, MPI_Comm localComm, int remoteSize) ; - CGridRemoteConnector(vector>& srcView, vector>& dstView, MPI_Comm localComm, int remoteSize) ; - void computeViewDistribution(void) ; - void computeConnector(bool eliminateRedundant=true) ; - void computeConnectorMethods(void) ; - void computeConnectorRedundant(void) ; - void computeGenericMethod(vector>& srcView, vector>& dstView, vector& indElements) ; - void computeSrcDstNonDistributed(int i, map& ranks) ; - void computeDstNonDistributed(int i, map& ranks) ; - void computeSrcNonDistributed(int i) ; - void computeRedondantRanks(void) ; - std::map>& getDistributedGlobalIndex(int pos) { return elements_[pos] ;} - const vector& getIsSrcViewDistributed(void) { return isSrcViewDistributed_ ;} - const vector& getIsDstViewDistributed(void) { return isDstViewDistributed_ ;} - const set& getRankToRemove(void) {return rankToRemove_;} - - protected: - - /** - * Source views composing the source grid. The vector store an internal copy of pointer elements composing the grid. - * It is feed at construction time - */ - vector> srcView_ ; - - /** - * Destination views composing the source grid. The vector store an internal copy of pointer elements composing the grid - * It is feed at construction time - */ - vector> dstView_ ; - - /** - * The list of global indices to send to each rank of the remote view (servers). The vector store the information for each element, and the map - * specify a list of global indices to send to each rank of the remote view. - * size of element_[] -> number of elements composing the grids (source/destination) - * element[i][rank] == CArray -> list of global indices to send to the remote process of rank \b rank for the view \b i - * The is computed when calling computeConnector internal methods - * map can be returned trough the public accessor : getDistributedGlobalIndex(int) - */ - vector>> elements_ ; - - /** - /* internal copy of the local communicator (client workflow). Feed at construction time. - */ - MPI_Comm localComm_ ; - - /** - /* size of the remote communicator (== nb of servers). Feed at consctruction time - */ - int remoteSize_ ; - - /** - /* for each view composing the source grid, the vector store the information about the distribution of the element, i.e. - * if each ranks of the local view has exactly the same global indices than each other. This is computed when calling - * \b computeViewDistribution method. - */ - vector isSrcViewDistributed_ ; - - /** - /* for each view composing the destination grid, the vector store the information about the distribution of the element, i.e. - * if each ranks of the remote view has exactly the same global indices than each other. This is computed when calling - * \b computeViewDistribution method. - */ - vector isDstViewDistributed_ ; - - /** - /* Redondant ranks of the \b elements_ are stored there by calling computeRedondantRanks(), to be removed latter or to be retrieve from elsewhere. - */ - set rankToRemove_ ; - - - } ; - -} - -#endif \ No newline at end of file diff --git a/xios_2311_src/src/distribution/grid_scatterer_connector.hpp b/xios_2311_src/src/distribution/grid_scatterer_connector.hpp deleted file mode 100755 index 4f1caa106e857f6fea75d0c44c691e336498ef33..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/grid_scatterer_connector.hpp +++ /dev/null @@ -1,99 +0,0 @@ -#ifndef __GRID_SCATTERER_CONNECTOR_HPP__ -#define __GRID_SCATTERER_CONNECTOR_HPP__ - -#include "xios_spl.hpp" -#include "array_new.hpp" -#include "distributed_view.hpp" -#include "mpi.hpp" -#include "local_view.hpp" -#include "distributed_view.hpp" -#include "context_client.hpp" -#include "scatterer_connector.hpp" - - -namespace xios -{ - - class CGridScattererConnector - { - private: - vector> elementsConnector_ ; - map nbSenders_ ; - vector ranks_ ; - map dstSize_ ; - - - public: - CGridScattererConnector(vector> elementsConnector) : elementsConnector_(elementsConnector) - { - nbSenders_ = elementsConnector[0]->getNbSenders() ; - for(auto& rank : nbSenders_) - { - ranks_.push_back(rank.first) ; - dstSize_[rank.first] = 1 ; - } - - // init dstSize_ - for(auto& connector : elementsConnector_) - { - auto& sizes = connector->getDstSize() ; - for(auto& rankSize : sizes) dstSize_[rankSize.first] = dstSize_[rankSize.first] * rankSize.second ; - } - } - - const map& getTransferedDataSize(void) {return dstSize_;} - - template - void transfer(const CArray& input, map>& output) - { - int n = elementsConnector_.size()-1 ; - shared_ptr* connector = elementsConnector_.data() + n ; - for(int rank : ranks_) - { - auto& out = output[rank] ; - out.resize(dstSize_[rank]) ; - elementsConnector_[n]->transfer(rank, connector, n, input.dataFirst(), out.dataFirst()) ; - } - } - - template - void transfer(const CArray& input, CContextClient* client, CEventClient& event, const CMessage& messageHeader) - { - map> output ; - transfer(input, output) ; - sendToServer(output, client, event, messageHeader) ; - } - - template - void sendToServer(const map>& dataOut, CContextClient* client, CEventClient& event, const CMessage& messageHeader) - { - list messages; - for(auto& ranksData : dataOut) - { - int rank = ranksData.first ; - auto& data = ranksData.second ; - - messages.push_back(CMessage(messageHeader)); - messages.back().push(data) ; - event.push(rank, nbSenders_[rank], messages.back()); - } - client->sendEvent(event) ; - } - - void transfer(CContextClient* client, CEventClient& event, const CMessage& messageHeader) - { - list messages; - for(auto& it : nbSenders_) - { - int rank = it.first ; - auto& nbSender = it.second ; - - messages.push_back(CMessage(messageHeader)); - event.push(rank, nbSenders_[rank], messages.back()); - } - client->sendEvent(event) ; - } - }; -} - -#endif \ No newline at end of file diff --git a/xios_2311_src/src/distribution/grid_transform_connector.cpp b/xios_2311_src/src/distribution/grid_transform_connector.cpp deleted file mode 100755 index ff58d44539b3bd5893e5e78f2a00ea0c1f01c824..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/grid_transform_connector.cpp +++ /dev/null @@ -1,87 +0,0 @@ -#include "grid_transform_connector.hpp" -#include "element.hpp" -#include "scatterer_connector.hpp" -#include "gatherer_connector.hpp" -#include "grid_remote_connector.hpp" - - -namespace xios -{ - void CGridTransformConnector::computeConnector(bool eliminateRedundant) - { - int commSize ; - int commRank ; - MPI_Comm_size(localComm_, &commSize) ; - MPI_Comm_rank(localComm_, &commRank) ; - int nElements = srcViews_.size() ; - - auto remoteConnector = make_shared(srcViews_, remoteViews_, localComm_, commSize) ; - remoteConnector->computeConnector(eliminateRedundant) ; - - vector> sendElements(nElements) ; - scattererConnector_.resize(nElements) ; - gathererConnector_.resize(nElements) ; - - for(int i=0;i(srcViews_[i]->getGlobalSize(), remoteConnector->getDistributedGlobalIndex(i)) ; - sendElements[i]->addFullView() ; - scattererConnector_[i] = make_shared(srcViews_[i], sendElements[i]->getView(CElementView::FULL), localComm_, commSize) ; - scattererConnector_[i]->computeConnector() ; - std::map>& sendIndex = sendElements[i]->getGlobalIndex() ; - - // how much sender ? - vector nbSenders(commSize) ; - int nbSender ; - for(auto& it : sendIndex) nbSenders[it.first]=1 ; - vector recvCounts(commSize,1) ; - MPI_Reduce_scatter(nbSenders.data(), &nbSender, recvCounts.data(), MPI_INT, MPI_SUM, localComm_) ; - - // transfer global index - // send Index - vector sendReq ; - for(auto& it : sendIndex) - { - MPI_Request req ; - MPI_Isend(it.second.dataFirst(), it.second.numElements(), MPI_SIZE_T, it.first,0, localComm_, &req) ; - sendReq.push_back(req) ; - } - - // receive index - map> recvIndex ; - - for(int j=0; j recvBuff(size) ; - MPI_Recv(recvBuff.data(), size, MPI_SIZE_T, status.MPI_SOURCE,0, localComm_,&status) ; - if (size!=0) { - CArray arrayTmp(recvBuff.data(), shape(recvBuff.size()), duplicateData) ; - recvIndex[status.MPI_SOURCE].reference(arrayTmp) ; - } - else { - CArray arrayTmp(0) ; - recvIndex[status.MPI_SOURCE].reference(arrayTmp) ; - } - if (recvRankSize_.count(status.MPI_SOURCE)==0) recvRankSize_[status.MPI_SOURCE] = size ; - else recvRankSize_[status.MPI_SOURCE] *= size ; - } - vector sendStatus(sendReq.size()) ; - MPI_Waitall(sendReq.size(),sendReq.data(),sendStatus.data()) ; - - // create gatherer connector - - auto recvElement = make_shared(remoteViews_[i]->getGlobalSize(), recvIndex) ; - recvElement->addFullView() ; - gathererConnector_[i] = make_shared(recvElement->getView(CElementView::FULL), remoteViews_[i]) ; - gathererConnector_[i]->computeConnector() ; - } - - gridScattererConnector_ = make_shared(scattererConnector_) ; - gridGathererConnector_ = make_shared(gathererConnector_) ; - } - -} diff --git a/xios_2311_src/src/distribution/grid_transform_connector.hpp b/xios_2311_src/src/distribution/grid_transform_connector.hpp deleted file mode 100755 index b23765639867dd5e6cabff32edce0810a210408e..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/grid_transform_connector.hpp +++ /dev/null @@ -1,74 +0,0 @@ -#ifndef __GRID_TRANSFORM_CONNECTOR_HPP__ -#define __GRID_TRANSFORM_CONNECTOR_HPP__ - -#include "xios_spl.hpp" -#include "array_new.hpp" -#include "distributed_view.hpp" -#include "local_view.hpp" -#include "grid_scatterer_connector.hpp" -#include "grid_gatherer_connector.hpp" -#include "reduction_types.hpp" -#include "mpi.hpp" - -namespace xios -{ - - - class CGridTransformConnector - { - - public: - CGridTransformConnector(vector> srcViews, vector> remoteViews, MPI_Comm localComm) - : srcViews_(srcViews), remoteViews_(remoteViews), localComm_(localComm) - { } - - void computeConnector(bool eliminateRedundant=true) ; - protected: - MPI_Comm localComm_ ; - vector> srcViews_ ; - vector> remoteViews_ ; - map recvRankSize_ ; - - vector> scattererConnector_ ; - vector> gathererConnector_ ; - shared_ptr gridScattererConnector_ ; - shared_ptr gridGathererConnector_ ; - - public: - template - void transfer(const CArray& dataIn, CArray& dataOut, EReduction op = EReduction::none) - { - map> tmpArrayIn ; - gridScattererConnector_->transfer(dataIn, tmpArrayIn) ; - vector requests ; - MPI_Request request ; - for(auto it : tmpArrayIn) - { - auto& array = it.second ; - MPI_Issend(array.dataFirst(), array.numElements(), MPI_GetType(), it.first, 0, localComm_, &request) ; - requests.push_back(request) ; - } - - map> tmpArrayOut ; - for(auto it : recvRankSize_) - { - auto& array = tmpArrayOut[it.first] ; - array.resize(it.second) ; - MPI_Irecv(array.dataFirst(), array.numElements(), MPI_GetType(), it.first, 0, localComm_, &request) ; - requests.push_back(request) ; - } - - vector status(requests.size()) ; - MPI_Waitall(requests.size(), requests.data(),status.data()) ; - - const double nanValue = std::numeric_limits::quiet_NaN(); - - if (op == EReduction::none) gridGathererConnector_->transfer(tmpArrayOut, dataOut, nanValue) ; - else gridGathererConnector_->transfer(tmpArrayOut, dataOut, op) ; - } - - }; - -} - -#endif \ No newline at end of file diff --git a/xios_2311_src/src/distribution/leader_process.cpp b/xios_2311_src/src/distribution/leader_process.cpp deleted file mode 100755 index 532e7967cbff1fa78eca6d7521cefdf87f3c2aa3..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/leader_process.cpp +++ /dev/null @@ -1,79 +0,0 @@ -#include "leader_process.hpp" - -namespace xios -{ - void computeLeaderProcess(int clientRank, int clientSize, int serverSize, - std::list& rankRecvLeader, - std::list& rankRecvNotLeader) - { - rankRecvLeader.clear() ; - rankRecvNotLeader.clear() ; - if ((0 == clientSize) || (0 == serverSize)) return; - - if (clientSize < serverSize) - { - int serverByClient = serverSize / clientSize; - int remain = serverSize % clientSize; - int rankStart = serverByClient * clientRank; - - if (clientRank < remain) - { - serverByClient++; - rankStart += clientRank; - } - else rankStart += remain; - - for (int i = 0; i < serverByClient; i++) - rankRecvLeader.push_back(rankStart + i); - - rankRecvNotLeader.resize(0); - } - else - { - int clientByServer = clientSize / serverSize; - int remain = clientSize % serverSize; - - if (clientRank < (clientByServer + 1) * remain) - { - if (clientRank % (clientByServer + 1) == 0) - rankRecvLeader.push_back(clientRank / (clientByServer + 1)); - else - rankRecvNotLeader.push_back(clientRank / (clientByServer + 1)); - } - else - { - int rank = clientRank - (clientByServer + 1) * remain; - if (rank % clientByServer == 0) - rankRecvLeader.push_back(remain + rank / clientByServer); - else - rankRecvNotLeader.push_back(remain + rank / clientByServer); - } - } - } - - int getLeaderRank(int clientSize, int serverSize, int serverRank) - { - int rank ; - if (clientSize > serverSize) - { - int serverByClient = clientSize / serverSize; - int remain = clientSize % serverSize; - rank=0 ; - if (remain < serverRank) rank = (serverByClient+1)*remain + serverByClient * (serverRank-remain) ; - else rank = (serverByClient+1) * serverRank ; - } - else - { - int serverByClient = serverSize / clientSize; - int remain = serverSize % clientSize; - - if (remain*(serverByClient+1) > serverRank ) rank = serverRank/(serverByClient+1) ; - else - { - serverRank = serverRank-(serverByClient+1)*remain ; - rank = remain + serverRank/serverByClient ; - } - } - return rank ; - } -} \ No newline at end of file diff --git a/xios_2311_src/src/distribution/leader_process.hpp b/xios_2311_src/src/distribution/leader_process.hpp deleted file mode 100755 index 8ca0d76769743fd2b5eb9dd2d9c5e908ad7f15c2..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/leader_process.hpp +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef __LEADER_PROCESS_HPP__ -#define __LEADER_PROCESS_HPP__ -#include - -namespace xios -{ - void computeLeaderProcess(int clientRank, int clientSize, int serverSize, - std::list& rankRecvLeader, - std::list& rankRecvNotLeader) ; - int getLeaderRank(int clientSize, int serverSize, int serverRank) ; -} - -#endif diff --git a/xios_2311_src/src/distribution/local_connector.cpp b/xios_2311_src/src/distribution/local_connector.cpp deleted file mode 100755 index a88d0fc736248a78ec5497acb8a3f0915442b239..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/local_connector.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include "local_connector.hpp" - - -namespace xios -{ - void CLocalConnector::computeConnector(void) - { - int srcLocalSize=srcView_->getLocalSize() ; - const CArray& srcIndex = srcView_->getIndex() ; - int srcSize = srcIndex.numElements() ; - - int dstLocalSize=dstView_->getLocalSize() ; - const CArray& dstIndex = dstView_->getIndex() ; - int dstSize = dstIndex.numElements() ; - - CArray local(srcLocalSize) ; - local = -1 ; - mask_.resize(dstSize) ; - - for(int i=0;i=0 && srcIndex(i) < srcLocalSize) local(srcIndex(i)) = i ; - } - - int connectorSize=0 ; - for(int i=0;i=0 && dstIndex(i) < dstLocalSize && local(dstIndex(i))!=-1) - { - mask_[i]=true ; - connectorSize++ ; - } - else mask_[i]=false ; - } - - connector_.resize(connectorSize) ; - connectorSize=0 ; - for(int i=0;i srcView_; - shared_ptr dstView_; - int srcSize_ ; - int dstSize_ ; - vector connector_ ; - vector mask_ ; - - public: - - CLocalConnector(shared_ptr srcView, shared_ptr dstView) : srcView_(srcView), dstView_(dstView), - srcSize_(srcView->getSize()), dstSize_(dstView->getSize()) {} - void computeConnector(void); - int getSrcSize(void) {return srcSize_ ;} - int getDstSize(void) {return dstSize_ ; } - - template void transfer(const CArray& input, CArray& output) - { - int size=mask_.size() ; - output.resize(size) ; - for(int i=0,j=0;i void transfer(const CArray& input, CArray& output, T missingValue) - { - int size=mask_.size() ; - output.resize(size) ; - for(int i=0,j=0;i void transfer(shared_ptr* connectors, int nConnectors, const T* input, T* output) - { - - int size=mask_.size() ; - if (nConnectors==0) - { - for(int i=0,j=0;igetSrcSliceSize(connectors-1, nConnectors-1) ; - int dstSliceSize = (*(connectors-1))->getDstSliceSize(connectors-1, nConnectors-1) ; - - T* out = output ; - for(int i=0,j=0;itransfer(connectors-1, nConnectors-1, input+connector_[j]*srcSliceSize, out) ; // the multiplication must be avoid in further optimization - j++ ; - } - out += dstSliceSize ; - } - - } - } - - template void transfer(shared_ptr* connectors, int nConnectors, const T* input, T* output, T missingValue) - { - int size=mask_.size() ; - if (nConnectors==0) - { - for(int i=0,j=0;igetSrcSliceSize(connectors-1, nConnectors-1) ; - int dstSliceSize = (*(connectors-1))->getDstSliceSize(connectors-1, nConnectors-1) ; - - T* out = output ; - for(int i=0,j=0;itransfer(connectors-1, nConnectors-1, input+connector_[j]*srcSliceSize, out, missingValue) ; // the multiplication must be avoid in further optimization - j++ ; - } - else for (int j=0 ; j* connectors, int nConnectors) - { if (nConnectors==0) return srcSize_ ; else return srcSize_ * (*(connectors-1))->getSrcSliceSize(connectors-1,nConnectors-1) ; } - - int getDstSliceSize(shared_ptr* connectors, int nConnectors) - { if (nConnectors==0) return dstSize_ ; else return dstSize_ * (*(connectors-1))->getDstSliceSize(connectors-1,nConnectors-1) ; } - - }; - -} - -#endif \ No newline at end of file diff --git a/xios_2311_src/src/distribution/local_view.cpp b/xios_2311_src/src/distribution/local_view.cpp deleted file mode 100755 index ad06a0ca7bb8555061989fb3126f87bc6ae9ad78..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/local_view.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include "local_view.hpp" -#include "element.hpp" -#include "array_new.hpp" -#include "remote_connector.hpp" - -namespace xios -{ - CLocalView::CLocalView(shared_ptr parent, CElementView::type type, const CArray& indexView) - : CDistributedView( parent, type, {{ parent->localRank_, indexView }} ), - localRank_(parent->localRank_), - globalIndex_(parent->globalIndex_), size_(CDistributedView::size_[parent->localRank_]), - index_(CDistributedView::index_[parent->localRank_]), localSize_(CDistributedView::localSize_[parent->localRank_]) - { - - } - - CLocalView::CLocalView(shared_ptr parent, CElementView::type type, const CArray& maskView) - : CDistributedView( parent, type, {{ parent->localRank_, maskView }} ), - localRank_(parent->localRank_), - globalIndex_(parent->globalIndex_), size_(CDistributedView::size_[parent->localRank_]), - index_(CDistributedView::index_[parent->localRank_]), localSize_(CDistributedView::localSize_[parent->localRank_]) - { - - } - - void CLocalView::sendRemoteElement(shared_ptr connector, CContextClient* client, CEventClient& event, const CMessage& messageHeader) - { - int n = index_.numElements() ; - int nglo=globalIndex_.numElements() ; - CArray ind(n) ; - for(int i=0; i=0 && index_(i)transferToServer(ind, client, event, message) ; - } - - -} \ No newline at end of file diff --git a/xios_2311_src/src/distribution/local_view.hpp b/xios_2311_src/src/distribution/local_view.hpp deleted file mode 100755 index c996cb030721efa6f0073dad2ab1f13f408cd24c..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/local_view.hpp +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef __LOCAL_VIEW_HPP__ -#define __LOCAL_VIEW_HPP__ - -#include "xios_spl.hpp" -#include "array_new.hpp" -#include "distributed_view.hpp" -#include "context_client.hpp" - -namespace xios -{ - - class CLocalElement ; - class CRemoteConnector ; - - class CLocalView : public CDistributedView - { - public: - CLocalView(shared_ptr parent, CElementView::type type, const CArray& indexView) ; - CLocalView(shared_ptr parent, CElementView::type type, const CArray& maskView) ; - - const CArray& getIndex(void) { return index_ ;} - const CArray& getGlobalIndex(void) { return globalIndex_ ;} - - void getGlobalIndexView(CArray& globalIndexView) - { - globalIndexView.resize(size_) ; - int pos=0 ; - for(int i=0 ; i=0 && index_(i)& globalIndex, size_t sliceIndex, size_t* sliceSize, shared_ptr* localView, int pos) - { - if (pos==0) - { - for(int i=0;i=0 && index_(i)=0 && index_(i)getGlobalIndex(globalIndex, sliceIndex + globalIndex_(index_(i))*sliceSize[pos], sliceSize, localView, pos-1) ; - } - } - - - int getLocalSize(void) {return localSize_ ;} - int getSize(void) {return size_;} - void sendRemoteElement(shared_ptr connector, CContextClient* client, CEventClient& event, const CMessage& messageHeader) ; - - CArray& globalIndex_ ; - CArray& index_ ; - int& size_ ; /** The number of index composing the view, ie the size of the corresponding data, ie the size of index_ */ - int& localRank_ ; - int& localSize_ ; /** The local size of the element, ie the size of globalIndex_ */ - } ; - -} - -#endif \ No newline at end of file diff --git a/xios_2311_src/src/distribution/reduce_transform_connector.cpp b/xios_2311_src/src/distribution/reduce_transform_connector.cpp deleted file mode 100755 index 959a6ed1b6a05b9b3c83003ff20aac4bc082a656..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/reduce_transform_connector.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#include "reduce_transform_connector.hpp" -#include "exception.hpp" - -namespace xios -{ - - CReduceTransformConnector::CReduceTransformConnector(shared_ptr srcView, shared_ptr dstView, EReduction op, - unordered_map>& indexMap, bool detectMissingValue) - : srcView_(srcView), dstView_(dstView), detectMissingValue_(detectMissingValue) - { - switch(op) - { - case EReduction::sum : - transfer_=&CReduceTransformConnector::transferSum ; - break ; - case EReduction::min : - transfer_=&CReduceTransformConnector::transferMin ; - break ; - case EReduction::max : - transfer_=&CReduceTransformConnector::transferMax ; - break ; - case EReduction::average : - transfer_=&CReduceTransformConnector::transferAverage ; - break ; - default : - ERROR("CReduceTransformConnector::CReduceTransformConnector", - <<"reduction operator "<<(int)op<<" is not defined for this operation") ; - break ; - } - - computeConnector(indexMap) ; - } - - void CReduceTransformConnector::computeConnector(unordered_map>& indexMap) - { - CArray dstGlobalIndex ; - CArray srcGlobalIndex ; - dstView_->getGlobalIndexView(dstGlobalIndex) ; - srcView_->getGlobalIndexView(srcGlobalIndex) ; - unordered_map srcMapIndex ; - srcSize_ = srcGlobalIndex.numElements() ; - dstSize_ = dstGlobalIndex.numElements() ; - - for(int i=0;i - - - -namespace xios -{ - - class CReduceTransformConnector - { - - private: - shared_ptr srcView_; - shared_ptr dstView_; - - vector connector_; // sizeof sum(nWeights_) - vector nSrc_ ; // sizeof dstSize_ - int srcSize_ ; - int dstSize_ ; - bool detectMissingValue_ ; - EReduction type_ ; - - typedef void (CReduceTransformConnector::* transferPtr)(int, int, const CArray& , CArray&) ; - transferPtr transfer_ ; - - void computeConnector(unordered_map>& indexMap) ; - - public: - - CReduceTransformConnector(shared_ptr srcView, shared_ptr dstView, EReduction op, unordered_map>& indexMap, - bool detectMissingValue=true) ; - - void transfer(const CArray& dataIn, CArray& dataOut) - { - transfer(1,1,dataIn, dataOut) ; - } - void transfer(int sizeT, const CArray& dataIn, CArray& dataOut) - { - transfer(1,sizeT, dataIn, dataOut) ; - } - - void transfer(int repeat, int sizeT, const CArray& dataIn, CArray& dataOut) - { - (this->*transfer_)(repeat, sizeT, dataIn, dataOut) ; - } - - private : - - void transferSum(int repeat, int sizeT, const CArray& dataIn, CArray& dataOut) - { - double defaultValue = std::numeric_limits::quiet_NaN(); - - int dstSlice = dstSize_*sizeT ; - int srcSlice = srcSize_*sizeT ; - dataOut.resize(repeat* dstSlice) ; - dataOut=0 ; - - const double* input = dataIn.dataFirst() ; - double* output = dataOut.dataFirst() ; - - if (detectMissingValue_) - { - vector touched(repeat* dstSlice, false) ; - int posr=0 ; - for(int r=0;r& dataIn, CArray& dataOut) - { - double defaultValue = std::numeric_limits::quiet_NaN(); - - int dstSlice = dstSize_*sizeT ; - int srcSlice = srcSize_*sizeT ; - dataOut.resize(repeat* dstSlice) ; - dataOut=0 ; - - const double* input = dataIn.dataFirst() ; - double* output = dataOut.dataFirst() ; - - if (detectMissingValue_) - { - vector touched(repeat* dstSlice, false) ; - int posr=0 ; - for(int r=0;r& dataIn, CArray& dataOut) - { - double defaultValue = std::numeric_limits::quiet_NaN(); - - int dstSlice = dstSize_*sizeT ; - int srcSlice = srcSize_*sizeT ; - dataOut.resize(repeat* dstSlice) ; - dataOut=0 ; - - const double* input = dataIn.dataFirst() ; - double* output = dataOut.dataFirst() ; - - if (detectMissingValue_) - { - vector touched(repeat* dstSlice, false) ; - int posr=0 ; - for(int r=0;r& dataIn, CArray& dataOut) - { - double defaultValue = std::numeric_limits::quiet_NaN(); - - int dstSlice = dstSize_*sizeT ; - int srcSlice = srcSize_*sizeT ; - dataOut.resize(repeat* dstSlice) ; - dataOut=0 ; - - const double* input = dataIn.dataFirst() ; - double* output = dataOut.dataFirst() ; - - if (detectMissingValue_) - { - vector touched(repeat* dstSlice, 0) ; - int posr=0 ; - for(int r=0;r::Index2VectorInfoTypeMap info ; - for(auto& dstIndex : dstView_->getIndex()) - { - int rank=dstIndex.first ; - auto& indexList=dstIndex.second ; - auto& globalIndex = dstView_->getGlobalIndex()[rank] ; - for(int i=0;i dataRanks(info, localComm_) ; - - set setGlobalIndex ; // all global index from src - auto& srcIndex = srcView_->getIndex() ; - auto& globalIndex = srcView_->getGlobalIndex() ; - int globalIndexSize = globalIndex.numElements() ; - int indexSize = srcIndex.numElements() ; - for(int i=0;i=0 & srcIndex(i) srcGlobalIndex(setGlobalIndex.size()) ; - int i=0 ; - for(auto& globalIndex : setGlobalIndex) - { - srcGlobalIndex(i) = globalIndex ; - i++ ; - } - - dataRanks.computeIndexInfoMapping(srcGlobalIndex) ; - const auto& returnInfo = dataRanks.getInfoIndexMap() ; - - // so we have the info where to send data : rank and local index. - // create the interconnector : - map> element ; - for(int i=0;i=0 & srcIndex(i) arrayTmp(rankIndex.second.data(), shape(rankIndex.second.size()), duplicateData) ; - element_[rankIndex.first].reference(arrayTmp) ; - } - - // compute the number of senders for a remote destination view - int commSize ; - MPI_Comm_size(localComm_, &commSize) ; - vector ranks(commSize,0) ; - for(auto& rank : connector_) ranks[rank.first] = 1 ; - MPI_Allreduce(MPI_IN_PLACE,ranks.data(),commSize,MPI_INT,MPI_SUM,localComm_) ; - for(auto& rank : connector_) nbSenders_[rank.first] = ranks[rank.first] ; - } - - - - - -} diff --git a/xios_2311_src/src/distribution/remote_connector.hpp b/xios_2311_src/src/distribution/remote_connector.hpp deleted file mode 100755 index e46a73c3c0194a281998d5e67218db3b8246ee00..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/remote_connector.hpp +++ /dev/null @@ -1,78 +0,0 @@ -#ifndef __REMOTE_CONNECTOR_HPP__ -#define __REMOTE_CONNECTOR_HPP__ - -#include "xios_spl.hpp" -#include "array_new.hpp" -#include "distributed_view.hpp" -#include "mpi.hpp" -#include "local_view.hpp" -#include "distributed_view.hpp" -#include "context_client.hpp" - - -namespace xios -{ - - class CRemoteConnector - { - private: - shared_ptr srcView_; - shared_ptr dstView_; - map> connector_ ; // connector[rank][srcIndex] - - MPI_Comm localComm_ ; - map nbSenders_ ; // number of participant when sending remote buffer - map> element_ ; // global index of elements to send - - public: - CRemoteConnector(shared_ptr srcView, shared_ptr dstView, MPI_Comm localComm) : srcView_(srcView), dstView_(dstView), localComm_(localComm){} ; - void computeConnector(void) ; - map>& getDistributedGlobalIndex() { return element_ ;} - - template - void transfer(const CArray& dataIn, map>& dataOut) - { - auto ptrDataIn = dataIn.dataFirst() ; - for(auto& indexRank : connector_) - { - int rank=indexRank.first ; - auto& index=indexRank.second ; - auto it = dataOut.emplace(rank, CArray(index.size())).first ; // return an iterator on the obect inserted - auto ptrDataOut = it->second.dataFirst() ; - for(auto ind : index) - { - *ptrDataOut = ptrDataIn[ind] ; - ptrDataOut++ ; - } - } - } - - template - void sendToServer(map>& dataOut, CContextClient* client, CEventClient& event, const CMessage& messageHeader) - { - list messages; - for(auto ranksData : dataOut) - { - int rank = ranksData.first ; - auto& data = ranksData.second ; - - messages.push_back(CMessage(messageHeader)); - messages.back().push(data) ; - event.push(rank, nbSenders_[rank], messages.back()); - } - client->sendEvent(event) ; - } - - template - void transferToServer(const CArray& dataIn, CContextClient* client, CEventClient& event, const CMessage& messageHeader) - { - map> dataOut ; - transfer(dataIn, dataOut) ; - sendToServer(dataOut, client, event,messageHeader) ; - } - - } ; - -} - -#endif \ No newline at end of file diff --git a/xios_2311_src/src/distribution/scatterer_connector.cpp b/xios_2311_src/src/distribution/scatterer_connector.cpp deleted file mode 100755 index 0fea68bf037b35d424e9fee9fbb400508bd5a1fe..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/scatterer_connector.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include "scatterer_connector.hpp" - - -namespace xios -{ - - void CScattererConnector::computeConnector(void) - { - auto& srcGlobalIndex = srcView_->getGlobalIndex() ; - auto& srcIndex = srcView_->getIndex() ; - srcSize_=srcIndex.numElements() ; - auto srcSize = srcView_->getSize() ; - auto srcLocalSize = srcView_->getLocalSize() ; - - auto& dstIndex = dstView_->getIndex() ; - for(auto& rankIndex : dstIndex) dstSize_[rankIndex.first]=rankIndex.second.numElements() ; - auto& dstGlobalIndex = dstView_->getGlobalIndex() ; - - unordered_map mapGlobalLocalIndex ; - int globalIndexSize=srcGlobalIndex.size() ; - - for(int i=0 ; i=0 && srcIndex(i) = 0 && index(i) < localSize) - { - const auto& it = mapGlobalLocalIndex.find(globalIndex(index(i))) ; - if (it != mapGlobalLocalIndex.end()) - { - connector.push_back(it->second) ; - mask[i] = true ; - } - else mask[i]=false ; - } - else mask[i]=false ; - } - } - - // compute the number of senders for a remote destination view - vector ranks(remoteCommSize_,0) ; - for(auto& rank : connector_) ranks[rank.first] = 1 ; - MPI_Allreduce(MPI_IN_PLACE,ranks.data(),remoteCommSize_,MPI_INT,MPI_SUM,localComm_) ; - for(auto& rank : connector_) nbSenders_[rank.first] = ranks[rank.first] ; - - } - -} \ No newline at end of file diff --git a/xios_2311_src/src/distribution/scatterer_connector.hpp b/xios_2311_src/src/distribution/scatterer_connector.hpp deleted file mode 100755 index 2d61a55bc6751ad0aa7b6211ad35062a9cf9a874..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/scatterer_connector.hpp +++ /dev/null @@ -1,210 +0,0 @@ -#ifndef __SCATTERER_CONNECTOR_HPP__ -#define __SCATTERER_CONNECTOR_HPP__ - -#include "xios_spl.hpp" -#include "array_new.hpp" -#include "distributed_view.hpp" -#include "mpi.hpp" -#include "local_view.hpp" -#include "distributed_view.hpp" -#include "context_client.hpp" - - -namespace xios -{ - - class CScattererConnector - { - - private: - map> connector_ ; - map> mask_ ; // mask is on dst view - MPI_Comm localComm_ ; - int remoteCommSize_ ; - - shared_ptr srcView_ ; - shared_ptr dstView_ ; - map nbSenders_ ; // number of participant when sending remote buffer - int srcSize_ ; - map dstSize_ ; - - public: - - CScattererConnector(shared_ptr srcView, shared_ptr dstView, MPI_Comm localComm, int remoteCommSize) - : srcView_(srcView), dstView_(dstView), localComm_(localComm), remoteCommSize_(remoteCommSize) {} - void computeConnector(void) ; - - template - void transfer(const CArray& dataIn, map>& dataOut) - { - transfer(1,1, dataIn, dataOut) ; - } - - template - void transfer(const CArray& dataIn, map>& dataOut, T missingValue) - { - transfer(1, 1, dataIn, dataOut, missingValue) ; - } - - template - void transfer(int sizeT, const CArray& dataIn, map>& dataOut) - { - transfer(1, sizeT, dataIn, dataOut); - } - - template - void transfer(int repeat, int sizeT, const CArray& dataIn, map>& dataOut) - { - // for future, make a specific transfer function for sizeT=1 to avoid multiplication (increasing performance) - size_t srcSlice = sizeT*srcSize_ ; - for(auto& rankConnector : connector_) - { - int rank = rankConnector.first ; - auto& connector = rankConnector.second ; - auto& mask = mask_[rank] ; - int dstSize = mask.size() ; - auto& data = dataOut[rank] ; - size_t dstSlice = dstSize*sizeT ; - data.resize(repeat*dstSlice) ; - T* dstData = data.dataFirst() ; - const T* srcData = dataIn.dataFirst() ; - for(int l=0; l - void transfer(int repeat, int sizeT, const CArray& dataIn, map>& dataOut, T missingValue) - { - // for future, make a specific transfer function for sizeT=1 to avoid multiplication (increasing performance) - size_t srcSlice = sizeT*srcSize_ ; - for(auto& rankConnector : connector_) - { - int rank = rankConnector.first ; - auto& connector = rankConnector.second ; - auto& mask = mask_[rank] ; - int dstSize = mask.size() ; - auto& data = dataOut[rank] ; - size_t dstSlice = dstSize*sizeT ; - data.resize(repeat * dstSlice) ; - T* dstData = data.dataFirst() ; - const T* srcData = dataIn.dataFirst() ; - for(int l=0; l - void transfer(const CArray& dataIn, CContextClient* client, CEventClient& event, const CMessage& messageHeader) - { - transfer( 1, dataIn, client, event, messageHeader) ; - } - - template - void transfer(const CArray& dataIn, T missingValue, CContextClient* client, CEventClient& event, const CMessage& messageHeader) - { - transfer( 1, dataIn, missingValue, client, event, messageHeader) ; - } - - template - void transfer(int sizeT, const CArray& dataIn, CContextClient* client, CEventClient& event, const CMessage& messageHeader) - { - map> dataOut ; - transfer(1, sizeT, dataIn, dataOut) ; - sendToServer(dataOut, client, event, messageHeader) ; - } - - template - void transfer(int sizeT, const CArray& dataIn, T missingValue, CContextClient* client, CEventClient& event, const CMessage& messageHeader) - { - map> dataOut ; - transfer(1, sizeT, dataIn, dataOut, missingValue) ; - sendToServer(dataOut, client, event, messageHeader) ; - } - - template - void transfer(int rank, shared_ptr* connectors, int nConnectors, const T* input, T* output) - { - auto& connector = connector_[rank] ; // probably costly, find a better way to avoid the map - auto& mask = mask_[rank] ; - int dstSize = mask.size() ; - if (nConnectors==0) - { - for(int i=0, j=0; igetSrcSliceSize(connectors-1, nConnectors-1) ; - int dstSliceSize = (*(connectors-1))->getDstSliceSize(rank, connectors-1, nConnectors-1) ; - - T* out = output ; - for(int i=0,j=0;itransfer(rank, connectors-1, nConnectors-1, input+connector[j]*srcSliceSize, out) ; // the multiplication must be avoid in further optimization - j++ ; - } - out += dstSliceSize ; - } - } - } - - - template - void sendToServer(const map>& dataOut, CContextClient* client, CEventClient& event, const CMessage& messageHeader) - { - list messages; - for(auto ranksData : dataOut) - { - int rank = ranksData.first ; - auto& data = ranksData.second ; - - messages.push_back(CMessage(messageHeader)); - messages.back().push(data) ; - event.push(rank, nbSenders_[rank], messages.back()); - } - client->sendEvent(event) ; - } - - int getSrcSliceSize(shared_ptr* connectors, int nConnectors) - { if (nConnectors==0) return srcSize_ ; else return srcSize_ * (*(connectors-1))->getSrcSliceSize(connectors-1,nConnectors-1) ; } - - int getDstSliceSize(int rank, shared_ptr* connectors, int nConnectors) - { if (nConnectors==0) return dstSize_[rank] ; else return dstSize_[rank] * (*(connectors-1))->getDstSliceSize(rank, connectors-1,nConnectors-1) ; } - - const map& getNbSenders(void) {return nbSenders_ ;} - const map& getDstSize(void) { return dstSize_ ;} - } ; -} - -#endif diff --git a/xios_2311_src/src/distribution/server_distribution_description.cpp b/xios_2311_src/src/distribution/server_distribution_description.cpp deleted file mode 100644 index 7618e0cc943df76697e0a2494d42f1441b97e003..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/server_distribution_description.cpp +++ /dev/null @@ -1,525 +0,0 @@ -/*! - \file server_distribution_description.hpp - \author Ha NGUYEN - \since 04 Jan 2015 - \date 11 Jan 2016 - - \brief Description of index distribution on server(s). - */ - -#include "server_distribution_description.hpp" -#include "exception.hpp" - -namespace xios -{ - /*! - \param [in] globalDimensionSize global dimension of grid - \param [in] nServer number of server - \param [in] serType type of server distribution. For now, we can distribute server by band or plan - */ -CServerDistributionDescription::CServerDistributionDescription(const std::vector& globalDimensionSize, - int nServer, - ServerDistributionType serType) - : nGlobal_(globalDimensionSize), indexBegin_(), dimensionSizes_(), globalIndex_(), - vecGlobalIndex_(), serverType_(serType), nServer_(nServer), positionDimensionDistributed_(1) -{ -} - -CServerDistributionDescription::~CServerDistributionDescription() -{ /* Nothing to do */ } - -int CServerDistributionDescription::defaultDistributedDimension(int gridDimension, - ServerDistributionType serType) -{ - switch (serType) - { - case BAND_DISTRIBUTION: - return ((1 == gridDimension) ? 0 : 1); - break; - default: - break; - } - - MISSING_RETURN( "int CServerDistributionDescription::defaultDistributedDimension(int gridDimension, ServerDistributionType serType)" ); - return -1; -} - -/*! - Compute pre-defined global index distribution of server(s). - \param [in] doComputeGlobalIndex flag to compute global index on each server. By default, false - -*/ -void CServerDistributionDescription::computeServerDistribution(bool doComputeGlobalIndex, - int positionDimensionDistributed) -{ - switch (serverType_) { - case BAND_DISTRIBUTION: - computeBandDistribution(nServer_, positionDimensionDistributed); - break; - default: - break; - } - - if (doComputeGlobalIndex) - { - vecGlobalIndex_.resize(nServer_); - int dim = nGlobal_.size(); - std::vector currentIndex(dim); - - for (int idxServer = 0; idxServer < nServer_; ++idxServer) - { - size_t ssize = 1, idx = 0; - for (int j = 0; j < dim; ++j) ssize *= dimensionSizes_[idxServer][j]; - vecGlobalIndex_[idxServer].resize(ssize); - - std::vector idxLoop(dim,0); - - int innerLoopSize = dimensionSizes_[idxServer][0]; - - while (idx CServerDistributionDescription::computeServerGlobalIndexInRange(const std::pair& indexBeginEnd, - int positionDimensionDistributed) -{ - int nBand = 0; - switch (serverType_) - { - case BAND_DISTRIBUTION: - nBand = computeBandDistribution(nServer_, positionDimensionDistributed); - break; - case ROOT_DISTRIBUTION: - nBand = computeRootDistribution(nServer_); - default: - break; - } - - size_t indexBegin = indexBeginEnd.first; - size_t indexEnd = indexBeginEnd.second; - if (indexBegin > indexEnd) - ERROR("CServerDistributionDescription::computeServerGlobalIndexInRange", - << "Index begin is larger than index end"); - - globalIndex_.rehash(std::ceil((indexEnd-indexBegin+1)/globalIndex_.max_load_factor())); - - int dim = nGlobal_.size(); - std::vector currentIndex(dim); - - for (int idxServer = 0; idxServer < nBand; ++idxServer) - { - size_t ssize = 1, idx = 0; - for (int j = 0; j < dim; ++j) ssize *= dimensionSizes_[idxServer][j]; - - std::vector idxLoop(dim,0); - int innerLoopSize = dimensionSizes_[idxServer][0]; - - while (idx zeroIndexServer(nServer_-nBand); - for (int idxServer = nBand; idxServer < nServer_; ++idxServer) - zeroIndexServer[idxServer-nBand] = idxServer; - - return zeroIndexServer; -} - -/*! - Compute the global index of grid elements (domain, axis) and their associated server rank. - Each client knows the general distribution of servers and from which they can compute the pieces of information to hold - \param [out] indexServerOnElement global index of each element as well as the corresponding server which contains these indices - \param [in] clientRank rank of client - \param [in] clientSize number of client - \param [in] axisDomainOrder the order of element in grid (2 for domain, 1 for axis, 0 for scalar) - \param [in] positionDimensionDistributed dimension of server on which we make the cut. -*/ -std::vector CServerDistributionDescription::computeServerGlobalByElement(std::vector > >& indexServerOnElement, - int clientRank, - int clientSize, - const CArray& axisDomainOrder, - int positionDimensionDistributed) -{ - int nBand = 0; - switch (serverType_) { - case BAND_DISTRIBUTION: - nBand = computeBandDistribution(nServer_, positionDimensionDistributed); - break; - default: - break; - } - - int nbElement = axisDomainOrder.numElements(); - indexServerOnElement.resize(nbElement); - int idx = 0; - std::vector idxMap(nbElement); - for (int i = 0; i < nbElement; ++i) - { - idxMap[i] = idx; - if (2 == axisDomainOrder(i)) idx += 2; - else if (1 == axisDomainOrder(i)) idx += 1; - // nothing for scalar - } - - for (int idxServer = 0; idxServer < nBand; ++idxServer) - { - std::vector elementDimension(4); - for (int i = 0; i < nbElement; ++i) - { - int elementSize = 1; - if (2 == axisDomainOrder(i)) - { - elementSize *= dimensionSizes_[idxServer][idxMap[i]] * dimensionSizes_[idxServer][idxMap[i]+1]; - elementDimension[0] = indexBegin_[idxServer][idxMap[i]]; - elementDimension[1] = indexBegin_[idxServer][idxMap[i]+1]; - elementDimension[2] = dimensionSizes_[idxServer][idxMap[i]]; - elementDimension[3] = dimensionSizes_[idxServer][idxMap[i]+1]; - } - - else if (1 == axisDomainOrder(i)) - { - elementSize *= dimensionSizes_[idxServer][idxMap[i]]; - elementDimension[0] = indexBegin_[idxServer][idxMap[i]]; - elementDimension[1] = 0; - elementDimension[2] = dimensionSizes_[idxServer][idxMap[i]]; - elementDimension[3] = 1; - } - else - { - elementSize *= dimensionSizes_[idxServer][idxMap[i]]; - elementDimension[0] = 0; - elementDimension[1] = 0; - elementDimension[2] = 1; - elementDimension[3] = 1; - } - - int rangeBegin, rangeSize; - computeRangeProcIndex(clientRank, clientSize, elementSize, rangeBegin, rangeSize); - - size_t globalIndexElement; - idx = 0; int idxRange = 0; - for (int k = 0; k < elementDimension[3]; ++k) - for (int l = 0; l < elementDimension[2]; ++l) - { - globalIndexElement = (l+elementDimension[0]) + (k+elementDimension[1])*elementDimension[2]; - if ((rangeBegin <= idx) && (idxRange < rangeSize)) - { - indexServerOnElement[i][globalIndexElement].push_back(idxServer); - ++idxRange; - } - ++idx; - } - } - } - - // List of servers without distribution (cause total number of server is greater than number of bands, for example) - std::vector zeroIndexServer(nServer_-nBand); - for (int idxServer = nBand; idxServer < nServer_; ++idxServer) - zeroIndexServer[idxServer-nBand] = idxServer; - - return zeroIndexServer; -} - -/*! - Compute a range of index on server which a client holds - For a range of index on a specific server, each client can hold a piece of the index range - If the range size is smaller than the number of client, there are some clients holding the same index - \param [in] clientRank rank of client - \param [in] clientSize number of client - \param [in] rangeProcSize index range size - \param [out] rangeBegin begin of range index a client holds - \param [out] rangeSize size of range index a client holds -*/ -void CServerDistributionDescription::computeRangeProcIndex(int clientRank, - int clientSize, - int rangeProcSize, - int& rangeBegin, - int& rangeSize) -{ - if (rangeProcSize < clientSize) - { - int rangeIndex = 0; - for (int idx = 0; idx < clientSize; ++idx) - { - if (idx == clientRank) - { - rangeBegin = rangeIndex; - rangeSize = 1; - } - ++rangeIndex; - if (rangeIndex == rangeProcSize) rangeIndex = 0; - } - return; - } - - int range, indexBegin = 0; - for (int i = 0; i < clientSize; ++i) - { - range = rangeProcSize / clientSize; - if (i < (rangeProcSize%clientSize)) ++range; - if (i == clientRank) break; - indexBegin += range; - } - rangeBegin = indexBegin; - rangeSize = range; -} - -/*! - Compute global index of servers with band distribution - \param [in] nServer number of server -*/ -int CServerDistributionDescription::computeBandDistribution(int nServer, int positionDimensionDistributed) -{ - int dim = nGlobal_.size(); - positionDimensionDistributed_ = positionDimensionDistributed; - if (1 == dim) positionDimensionDistributed_ = 0; - if (positionDimensionDistributed_ > dim) - ERROR("CServerDistributionDescription::computeBandDistribution(int nServer, int positionDimensionDistributed)", - << "Position of distributed dimension is invalid" << std::endl - << "Position of distributed dimension is " << positionDimensionDistributed_ - << "Dimension " << dim) - - indexBegin_.resize(nServer); - dimensionSizes_.resize(nServer); - - for (int i = 0; i< nServer; ++i) - { - indexBegin_[i].resize(dim); - dimensionSizes_[i].resize(dim); - } - - int njRangeSize; - int nGlobTemp = 0; - std::vector njRangeBegin(nServer,0); - std::vector njRangeEnd(nServer,0); - - int positionDistributed = (1 dim) - ERROR("CServerDistributionDescription::computeBandDistribution(int nServer, int positionDimensionDistributed)", - << "Position of distributed dimension is invalid" << std::endl - << "Position of distributed dimension is " << positionDimensionDistributed_ - << "Dimension " << dim) - - indexBegin_.resize(nServer); - dimensionSizes_.resize(nServer); - - for (int i = 0; i< nServer; ++i) - { - indexBegin_[i].resize(dim); - dimensionSizes_[i].resize(dim); - } - - int nGlobTemp = 0; - - int positionDistributed = (1 > CServerDistributionDescription::getServerDimensionSizes() const -{ - return dimensionSizes_; -} - -/*! - Get index begin of each dimension on distributed server - \return index begin of dimensions on server(s) -*/ -std::vector > CServerDistributionDescription::getServerIndexBegin() const -{ - return indexBegin_; -} - -/*! - Get global index on distributed server - \return global index on server(s) -*/ -const std::vector >& CServerDistributionDescription::getGlobalIndex() const -{ - return vecGlobalIndex_; -} - -/*! - Get global index calculated by computeServerGlobalIndexInRange -*/ -const std::unordered_map& CServerDistributionDescription::getGlobalIndexRange() const -{ - return globalIndex_; -} - -int CServerDistributionDescription::getDimensionDistributed() -{ - return ((1 - -namespace xios -{ -/*! - \class CServerDistributionDescription - This class contains information that describe distribution of servers. -*/ -class CServerDistributionDescription -{ - public: - enum ServerDistributionType - { - BAND_DISTRIBUTION, PLAN_DISTRIBUTION, ROOT_DISTRIBUTION - }; - - /** Default constructor */ - CServerDistributionDescription(const std::vector& globalDimensionSize, - int nServer, - ServerDistributionType serType=BAND_DISTRIBUTION); - - /** Default destructor */ - virtual ~CServerDistributionDescription(); - - void computeServerDistribution(bool doComputeGlobalIndex = false, int positionDimensionDistributed = 1); - std::vector computeServerGlobalIndexInRange(const std::pair& indexBeginEnd, int positionDimensionDistributed = 1); - std::vector computeServerGlobalByElement(std::vector > >& indexServerOnElement, - int rank, - int clientSize, - const CArray& axisDomainOrder, - int positionDimensionDistributed = 1); - - std::vector > getServerIndexBegin() const; - std::vector > getServerDimensionSizes() const; - const std::vector >& getGlobalIndex() const; - const std::unordered_map& getGlobalIndexRange() const; - int getDimensionDistributed(); - - static int defaultDistributedDimension(int gridDimension, - ServerDistributionType serType=BAND_DISTRIBUTION); - - protected: - int computeBandDistribution(int nServer, int positionDimensionDistributed = 1); - int computeRootDistribution(int nServer, int positionDimensionDistributed = 1); - void computePlanDistribution(int nServer); - void computeRangeProcIndex(int clientRank, - int clientSize, - int rangeProcSize, - int& rangeBegin, - int& rangeSize); - - private: - std::vector > indexBegin_; //!< Begin index of each dimension - std::vector > dimensionSizes_; //!< Size of each dimension - std::vector nGlobal_; //!< Global size of each dimension - - //!< General case, index describes distribution of each server (rarely use) - std::vector > vecGlobalIndex_; - - //!< In case we need only global index of one server with specific rank - std::unordered_map globalIndex_; - - //!< Type of distribution on server side - ServerDistributionType serverType_; - - //!< Number of server - int nServer_; - - //!< Position of dimension distributed on server side (by default, the second dimension) - int positionDimensionDistributed_; -}; - -} // namespace xios -#endif // __XIOS_SERVER_DISTRIBUTION_DESCRIPTION_HPP diff --git a/xios_2311_src/src/distribution/transfer_transform_connector.cpp b/xios_2311_src/src/distribution/transfer_transform_connector.cpp deleted file mode 100755 index 3fd3305a8ec10ebffad0040fdfe6fc24cfc7e7e7..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/transfer_transform_connector.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include "transfer_transform_connector.hpp" - -namespace xios -{ - - CTransferTransformConnector::CTransferTransformConnector(shared_ptr srcView, shared_ptr dstView, unordered_map& indexMap) - : srcView_(srcView), dstView_(dstView) - { - computeConnector(indexMap) ; - } - - void CTransferTransformConnector::computeConnector(unordered_map& indexMap) - { - CArray dstGlobalIndex ; - CArray srcGlobalIndex ; - dstView_->getGlobalIndexView(dstGlobalIndex) ; - srcView_->getGlobalIndexView(srcGlobalIndex) ; - unordered_map srcMapIndex ; - srcSize_ = srcGlobalIndex.numElements() ; - dstSize_ = dstGlobalIndex.numElements() ; - mask_.resize(dstSize_) ; - - for(int i=0;i srcView_; - shared_ptr dstView_; - - vector connector_; - vector mask_ ; // sizeof dstSize_ - int srcSize_ ; - int dstSize_ ; - - void computeConnector(unordered_map& indexMap) ; - - public: - - CTransferTransformConnector(shared_ptr srcView, shared_ptr dstView, unordered_map& indexMap) ; - - void transfer(int repeat, int sizeT, const CArray& dataIn, CArray& dataOut) - { - int dstSlice = dstSize_*sizeT ; - int srcSlice = srcSize_*sizeT ; - dataOut.resize(repeat* dstSlice) ; - dataOut=0 ; // what to do about missing value => next step ? - - const double* input = dataIn.dataFirst() ; - double* output = dataOut.dataFirst() ; - - for(int r=0;r& dataIn, CArray& dataOut) - { - transfer(1,sizeT, dataIn, dataOut) ; - } - - void transfer(const CArray& dataIn, CArray& dataOut) - { - transfer(1,1,dataIn, dataOut) ; - } - - - }; - -} - -#endif \ No newline at end of file diff --git a/xios_2311_src/src/distribution/transform_connector.cpp b/xios_2311_src/src/distribution/transform_connector.cpp deleted file mode 100755 index c34c84c328729be5d260013832254c77de768e18..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/transform_connector.cpp +++ /dev/null @@ -1,106 +0,0 @@ -#include "transform_connector.hpp" -#include "element.hpp" -#include "scatterer_connector.hpp" -#include "gatherer_connector.hpp" -#include "client_client_dht_template.hpp" - - -namespace xios -{ - void CTransformConnector::computeConnector(void) - { - CClientClientDHTTemplate::Index2VectorInfoTypeMap info ; - - // first, insert destination global index into DHT - int rank ; - MPI_Comm_rank(localComm_, &rank) ; - CArray globalIndex ; - dstView_->getGlobalIndexView(globalIndex) ; - for(int i=0;i dataRanks(info, localComm_) ; - - // get global src index from src view. - set setGlobalIndex ; // all global index from src - srcView_->getGlobalIndexView(globalIndex) ; - for(int i=0;i srcGlobalIndex(setGlobalIndex.size()) ; - int i=0 ; - for(auto& globalIndex : setGlobalIndex) - { - srcGlobalIndex(i) = globalIndex ; - i++ ; - } - - dataRanks.computeIndexInfoMapping(srcGlobalIndex) ; - const auto& returnInfo = dataRanks.getInfoIndexMap() ; - - map> vectorIndex ; - for(auto& rankIndGlo : returnInfo) - { - size_t indGlo = rankIndGlo.first ; - auto& listRank = rankIndGlo.second ; - for (auto& rank : listRank) vectorIndex[rank].push_back(indGlo); - } - - // convert vectorIndex into array - map> dstArrayIndex ; - for(auto& rankIndGlo : vectorIndex) - { - int rank = rankIndGlo.first ; - auto& indexVector = rankIndGlo.second ; - auto& arrayIndex = dstArrayIndex[rank] ; - CArray arrayTmp(indexVector.data(), shape(indexVector.size()), duplicateData) ; - dstArrayIndex[rank].reference(arrayTmp) ; - } - - // distributed element : where to send data - auto dstElement = make_shared(srcView_->getGlobalSize(), dstArrayIndex) ; - dstElement->addFullView() ; - - // create scatterer connector - int commSize ; - MPI_Comm_size(localComm_, &commSize) ; - scattererConnector_ = make_shared(srcView_, dstElement->getView(CElementView::FULL), localComm_, commSize ) ; - scattererConnector_->computeConnector() ; - - // how much sender ? - vector nbSenders(commSize) ; - int nbSender ; - for(auto& it : dstArrayIndex) nbSenders[it.first]=1 ; - vector recvCounts(commSize,1) ; - MPI_Reduce_scatter(nbSenders.data(), &nbSender, recvCounts.data(), MPI_INT, MPI_SUM, localComm_) ; - - // transfer global index - map> remoteArrayIndex ; - - vector sendReq ; - for(auto& it : dstArrayIndex) - { - MPI_Request req ; - MPI_Isend(it.second.dataFirst(), it.second.numElements(), MPI_SIZE_T, it.first,0, localComm_,&req) ; - sendReq.push_back(req) ; - } - - for(int i=0; i recvBuff(size) ; - MPI_Recv(recvBuff.data(), size, MPI_SIZE_T, status.MPI_SOURCE,0,localComm_,&status) ; - CArray arrayTmp(recvBuff.data(), shape(recvBuff.size()), duplicateData) ; - remoteArrayIndex[status.MPI_SOURCE].reference(arrayTmp) ; - recvRankSize_[status.MPI_SOURCE] = size ; - } - vector sendStatus(sendReq.size()) ; - MPI_Waitall(sendReq.size(),sendReq.data(),sendStatus.data()) ; - - auto remoteElement = make_shared(dstView_->getGlobalSize(), remoteArrayIndex) ; - remoteElement->addFullView() ; - gathererConnector_= make_shared(remoteElement->getView(CElementView::FULL),dstView_) ; - gathererConnector_->computeConnector() ; - - } -} \ No newline at end of file diff --git a/xios_2311_src/src/distribution/transform_connector.hpp b/xios_2311_src/src/distribution/transform_connector.hpp deleted file mode 100755 index d88a873a6575f12a6bd08718024757b7f766b9b1..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/transform_connector.hpp +++ /dev/null @@ -1,80 +0,0 @@ -#ifndef __TRANSFORM_CONNECTOR_HPP__ -#define __TRANSFORM_CONNECTOR_HPP__ - -#include "xios_spl.hpp" -#include "array_new.hpp" -#include "distributed_view.hpp" -#include "local_view.hpp" -#include "scatterer_connector.hpp" -#include "gatherer_connector.hpp" -#include "mpi.hpp" - -namespace xios -{ - - - class CTransformConnector - { - - public: - CTransformConnector(shared_ptr srcView, shared_ptr dstView, MPI_Comm localComm) - : srcView_(srcView), dstView_(dstView), localComm_(localComm) {} - - void computeConnector(void) ; - private: - - MPI_Comm localComm_ ; - shared_ptr srcView_ ; - shared_ptr dstView_ ; - map recvRankSize_ ; - shared_ptr scattererConnector_ ; - shared_ptr gathererConnector_ ; - - public: - template - void transfer(int repeat, int sizeT, const CArray& dataIn, CArray& dataOut) - { - map> tmpArrayIn ; - scattererConnector_->transfer(repeat, sizeT, dataIn, tmpArrayIn) ; - vector requests ; - MPI_Request request ; - for(auto it : tmpArrayIn) - { - auto& array = it.second ; - MPI_Issend(array.dataFirst(), array.numElements(), MPI_GetType(), it.first, 0, localComm_, &request) ; - requests.push_back(request) ; - } - - map> tmpArrayOut ; - for(auto it : recvRankSize_) - { - auto& array = tmpArrayOut[it.first] ; - array.resize(it.second*repeat*sizeT) ; - MPI_Irecv(array.dataFirst(), array.numElements(), MPI_GetType(), it.first, 0, localComm_, &request) ; - requests.push_back(request) ; - } - - vector status(requests.size()) ; - MPI_Waitall(requests.size(), requests.data(),status.data()) ; - - const double nanValue = std::numeric_limits::quiet_NaN(); - gathererConnector_->transfer(repeat, sizeT , tmpArrayOut, dataOut, nanValue) ; - } - - template - void transfer(int sizeT, const CArray& dataIn, CArray& dataOut) - { - transfer(1, sizeT, dataIn, dataOut) ; - } - - template - void transfer(const CArray& dataIn, CArray& dataOut) - { - transfer(1, 1, dataIn, dataOut) ; - } - - }; - -} - -#endif \ No newline at end of file diff --git a/xios_2311_src/src/distribution/weight_transform_connector.cpp b/xios_2311_src/src/distribution/weight_transform_connector.cpp deleted file mode 100755 index 677933c04df9e529472b10dc4bda05e5ec831437..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/distribution/weight_transform_connector.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include "weight_transform_connector.hpp" - -namespace xios -{ - - CWeightTransformConnector::CWeightTransformConnector(shared_ptr srcView, shared_ptr dstView, unordered_map>& indexMap, - unordered_map>& weightMap) : srcView_(srcView), dstView_(dstView) - { - computeConnector(indexMap, weightMap) ; - } - - void CWeightTransformConnector::computeConnector(unordered_map>& indexMap, - unordered_map>& weightMap) - { - CArray dstGlobalIndex ; - CArray srcGlobalIndex ; - dstView_->getGlobalIndexView(dstGlobalIndex) ; - srcView_->getGlobalIndexView(srcGlobalIndex) ; - unordered_map srcMapIndex ; - srcSize_ = srcGlobalIndex.numElements() ; - dstSize_ = dstGlobalIndex.numElements() ; - - for(int i=0;i srcView_; - shared_ptr dstView_; - - vector weights_; // sizeof sum(nWeights_) - vector connector_; // sizeof sum(nWeights_) - vector nWeights_ ; // sizeof dstSize_ - int srcSize_ ; - int dstSize_ ; - - void computeConnector(unordered_map>& indexMap, unordered_map>& weightMap) ; - - public: - - CWeightTransformConnector(shared_ptr srcView, shared_ptr dstView, unordered_map>& indexMap, - unordered_map>& weightMap) ; - - void transfer(int repeat, int sizeT, const CArray& dataIn, CArray& dataOut) - { - int dstSlice = dstSize_*sizeT ; - int srcSlice = srcSize_*sizeT ; - dataOut.resize(repeat* dstSlice) ; - dataOut=0 ; // what to do about missing value => next step ? - - const double* input = dataIn.dataFirst() ; - double* output = dataOut.dataFirst() ; - - for(int r=0;r& dataIn, CArray& dataOut) - { - transfer(1,sizeT, dataIn, dataOut) ; - } - - void transfer(const CArray& dataIn, CArray& dataOut) - { - transfer(1,1,dataIn, dataOut) ; - } - - - }; - -} - -#endif \ No newline at end of file diff --git a/xios_2311_src/src/event_scheduler.cpp b/xios_2311_src/src/event_scheduler.cpp index a7f5dce55f44acd1972e151e0c2adee69099fcce..02d413eb6bcf930b66c5f0b830fb91992b74f5a6 100644 --- a/xios_2311_src/src/event_scheduler.cpp +++ b/xios_2311_src/src/event_scheduler.cpp @@ -69,16 +69,12 @@ namespace xios CEventScheduler::~CEventScheduler() { - while (!pendingSentParentRequest.empty() || !pendingRecvParentRequest.empty() || !pendingRecvChildRequest.empty() || !pendingSentChildRequest.empty()) - { - checkEvent() ; - } + } void CEventScheduler::registerEvent(const size_t timeLine, const size_t contextHashId) { registerEvent(timeLine, contextHashId, level) ; - checkEvent() ; } void CEventScheduler::registerEvent(const size_t timeLine, const size_t contextHashId, const size_t lev) @@ -97,15 +93,15 @@ namespace xios bool CEventScheduler::queryEvent(const size_t timeLine, const size_t contextHashId) { - checkEvent() ; + if (! eventStack.empty() && eventStack.front().first==timeLine && eventStack.front().second==contextHashId) { - //eventStack.pop() ; + eventStack.pop() ; return true ; } else return false ; } - + void CEventScheduler::checkEvent(void) { traceOff() ; @@ -221,7 +217,6 @@ namespace xios else { registerEvent( timeLine,hashId,lev) ; - recvEvent.erase(itEvent) ; } } } diff --git a/xios_2311_src/src/event_scheduler.hpp b/xios_2311_src/src/event_scheduler.hpp index d2c6ff80d7f2a83ea7c9e1d13195d586745b3229..2e42b7bc44e9e7ea831127a176387d64d9a86445 100644 --- a/xios_2311_src/src/event_scheduler.hpp +++ b/xios_2311_src/src/event_scheduler.hpp @@ -51,7 +51,6 @@ namespace xios * If the event is scheduled next, it is remove from the `eventStack` queue list */ bool queryEvent(const size_t timeLine, const size_t contextHashId) ; - void popEvent() { eventStack.pop() ; } //! Public interface to give the hand to the instance to check pending or incoming message. diff --git a/xios_2311_src/src/event_server.hpp b/xios_2311_src/src/event_server.hpp index f0c0290f767cf7c2007a57973568047a5bf3f61d..fe00f291d29c93f6fea4c577bcb761861b629db1 100644 --- a/xios_2311_src/src/event_server.hpp +++ b/xios_2311_src/src/event_server.hpp @@ -7,7 +7,6 @@ namespace xios { - class CContextServer ; class CEventServer { @@ -17,11 +16,9 @@ namespace xios int type ; int nbSender ; - CEventServer(CContextServer* contextServer) : contextServer_(contextServer) {} void push(int rank,CServerBuffer* serverBuffer ,char* startBuffer,int size) ; - CContextServer* getContextServer(void) { return contextServer_ ;} - + struct SSubEvent { int rank ; @@ -34,9 +31,6 @@ namespace xios bool isFull(void) ; ~CEventServer() ; - private : - - CContextServer* contextServer_ ; } ; } diff --git a/xios_2311_src/src/exception.hpp b/xios_2311_src/src/exception.hpp index 2021874e08596fe36d46a7f223f712514596a84e..918469eaeb064735ebe05409dedcdb9c911d4bc2 100644 --- a/xios_2311_src/src/exception.hpp +++ b/xios_2311_src/src/exception.hpp @@ -78,14 +78,6 @@ namespace xios throw exc; \ } -#define MISSING_RETURN(id) \ -{ \ - xios::CException exc(id); \ - exc.getStream() << INFO("Missing return"); \ - error << exc.getMessage() << std::endl; \ - throw exc; \ -} - #ifdef __XIOS_EXCEPTION #define TRY \ { \ diff --git a/xios_2311_src/src/filter/binary_arithmetic_filter.cpp b/xios_2311_src/src/filter/binary_arithmetic_filter.cpp index 3ce560c0320c28e6316bafda58f3163761eeeabd..338500e709bad62393ec0a921a296f2a3234c4d7 100644 --- a/xios_2311_src/src/filter/binary_arithmetic_filter.cpp +++ b/xios_2311_src/src/filter/binary_arithmetic_filter.cpp @@ -1,5 +1,8 @@ #include "binary_arithmetic_filter.hpp" #include "workflow_graph.hpp" +#include "yacc_var.hpp" +#include "file.hpp" + namespace xios { @@ -7,72 +10,81 @@ namespace xios : CFilter(gc, 1, this) , op(operatorExpr.getOpScalarField(op)) , value(value) - { /* Nothing to do */ }; + { }; - std::pair CScalarFieldArithmeticFilter::buildGraph(std::vector data) + std::tuple CScalarFieldArithmeticFilter::buildGraph(std::vector data) { - bool building_graph = this->graphEnabled; + bool building_graph = this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; int unique_filter_id; - bool firstround = true; - + bool firstround; + if(building_graph) { - if(!data[0]->graphPackage) - { - data[0]->graphPackage = new CGraphDataPackage; - data[0]->graphPackage->currentField = this->graphPackage->inFields[0]; - data[0]->graphPackage->fromFilter = -1; - } - - if(!CWorkflowGraph::mapHashFilterID_) CWorkflowGraph::mapHashFilterID_ = new std::unordered_map ; + CWorkflowGraph::allocNodeEdge(); - size_t filterhash = std::hash{}(this->graphPackage->inFields[0]->content+to_string(data[0]->timestamp)+this->graphPackage->inFields[0]->getId()); + size_t filterhash = std::hash{}(this->field->content+to_string(data[0]->timestamp)+this->field->getId()); // first round - if(CWorkflowGraph::mapHashFilterID_->find(filterhash) == CWorkflowGraph::mapHashFilterID_->end()) + if(CWorkflowGraph::mapHashFilterID_ptr->find(filterhash) == CWorkflowGraph::mapHashFilterID_ptr->end()) { - this->graphPackage->filterId = CWorkflowGraph::getNodeSize(); - unique_filter_id = this->graphPackage->filterId; - CWorkflowGraph::addNode("Arithmetic filter\\n ("+this->graphPackage->inFields[0]->content+")", 4, false, 0, data[0]); + firstround = true; + this->filterID = InvalidableObject::filterIdGenerator++; + int edgeID = InvalidableObject::edgeIdGenerator++; - CWorkflowGraph::addEdge(data[0]->graphPackage->fromFilter, this->graphPackage->filterId, data[0]); - data[0]->graphPackage->fromFilter = this->graphPackage->filterId; - data[0]->graphPackage->currentField = this->graphPackage->inFields[0]; - std::rotate(this->graphPackage->inFields.begin(), this->graphPackage->inFields.begin() + 1, this->graphPackage->inFields.end()); + CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+this->field->content+")", 3, 1, 0, data[0]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_tag = this->tag; + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; - - (*CWorkflowGraph::mapHashFilterID_)[filterhash] = unique_filter_id; - + + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); + if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "
file attributes :
" +this->field->file->record4graphXiosAttributes(); + + + if(CWorkflowGraph::build_begin) + { + CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; + + (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; + } + else CWorkflowGraph::build_begin = true; + + (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash] = this->filterID; + unique_filter_id = this->filterID; } // not first round else { - unique_filter_id = (*CWorkflowGraph::mapHashFilterID_)[filterhash]; - if(data[0]->graphPackage->fromFilter != unique_filter_id) + firstround=false; + unique_filter_id = (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash]; + if(data[0]->src_filterID != unique_filter_id) { - CWorkflowGraph::addEdge(data[0]->graphPackage->fromFilter, unique_filter_id, data[0]); + int edgeID = InvalidableObject::edgeIdGenerator++; + CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[0]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; + (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; } } } - return std::make_pair(building_graph, unique_filter_id); + return std::make_tuple(building_graph, firstround, unique_filter_id); } + CDataPacketPtr CScalarFieldArithmeticFilter::apply(std::vector data) { CDataPacketPtr packet(new CDataPacket); packet->date = data[0]->date; packet->timestamp = data[0]->timestamp; packet->status = data[0]->status; - - std::pair graph = buildGraph(data); - if(std::get<0>(graph)) - { - packet->graphPackage = new CGraphDataPackage; - packet->graphPackage->fromFilter = std::get<1>(graph); - packet->graphPackage->currentField = this->graphPackage->inFields[0]; - } + std::tuple graph = buildGraph(data); + + if(std::get<0>(graph)) packet->src_filterID = std::get<2>(graph); + if(std::get<0>(graph) && std::get<1>(graph)) packet->distance = data[0]->distance+1; + if(std::get<0>(graph) && !std::get<1>(graph)) packet->distance = data[0]->distance; + + packet->field = this->field; if (packet->status == CDataPacket::NO_ERROR) packet->data.reference(op(value, data[0]->data)); @@ -84,55 +96,64 @@ namespace xios : CFilter(gc, 1, this) , op(operatorExpr.getOpFieldScalar(op)) , value(value) - { /* Nothing to do */ }; + { }; - std::pair CFieldScalarArithmeticFilter::buildGraph(std::vector data) + std::tuple CFieldScalarArithmeticFilter::buildGraph(std::vector data) { - bool building_graph = this->graphEnabled; + bool building_graph = this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; int unique_filter_id; - bool firstround = true; + bool firstround; if(building_graph) { - if(!data[0]->graphPackage) - { - data[0]->graphPackage = new CGraphDataPackage; - data[0]->graphPackage->currentField = this->graphPackage->inFields[0]; - data[0]->graphPackage->fromFilter = -1; - } + CWorkflowGraph::allocNodeEdge(); - if(!CWorkflowGraph::mapHashFilterID_) CWorkflowGraph::mapHashFilterID_ = new std::unordered_map ; - - size_t filterhash = std::hash{}(this->graphPackage->inFields[0]->content+to_string(data[0]->timestamp)+this->graphPackage->inFields[0]->getId()); + size_t filterhash = std::hash{}(this->field->content+to_string(data[0]->timestamp)+this->field->getId()); // first round - if(CWorkflowGraph::mapHashFilterID_->find(filterhash) == CWorkflowGraph::mapHashFilterID_->end()) + if(CWorkflowGraph::mapHashFilterID_ptr->find(filterhash) == CWorkflowGraph::mapHashFilterID_ptr->end()) { - this->graphPackage->filterId = CWorkflowGraph::getNodeSize(); - unique_filter_id = this->graphPackage->filterId; - CWorkflowGraph::addNode("Arithmetic filter\\n ("+this->graphPackage->inFields[0]->content+")", 4, false, 0, data[0]); + firstround = true; + this->filterID = InvalidableObject::filterIdGenerator++; + int edgeID = InvalidableObject::edgeIdGenerator++; - CWorkflowGraph::addEdge(data[0]->graphPackage->fromFilter, this->graphPackage->filterId, data[0]); - data[0]->graphPackage->fromFilter = this->graphPackage->filterId; - data[0]->graphPackage->currentField = this->graphPackage->inFields[0]; - std::rotate(this->graphPackage->inFields.begin(), this->graphPackage->inFields.begin() + 1, this->graphPackage->inFields.end()); + CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+this->field->content+")", 3, 1, 0, data[0]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_tag = this->tag; + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; - - (*CWorkflowGraph::mapHashFilterID_)[filterhash] = unique_filter_id; - + + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); + if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "
file attributes :
" +this->field->file->record4graphXiosAttributes(); + + + if(CWorkflowGraph::build_begin) + { + CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; + + (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; + } + else CWorkflowGraph::build_begin = true; + + (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash] = this->filterID; + unique_filter_id = this->filterID; } // not first round else { - unique_filter_id = (*CWorkflowGraph::mapHashFilterID_)[filterhash]; - if(data[0]->graphPackage->fromFilter != unique_filter_id) + firstround=false; + unique_filter_id = (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash]; + if(data[0]->src_filterID != unique_filter_id) { - CWorkflowGraph::addEdge(data[0]->graphPackage->fromFilter, unique_filter_id, data[0]); + int edgeID = InvalidableObject::edgeIdGenerator++; + CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[0]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; + (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; } } } - return std::make_pair(building_graph, unique_filter_id); + return std::make_tuple(building_graph, firstround, unique_filter_id); } CDataPacketPtr CFieldScalarArithmeticFilter::apply(std::vector data) @@ -142,14 +163,16 @@ namespace xios packet->timestamp = data[0]->timestamp; packet->status = data[0]->status; - std::pair graph = buildGraph(data); + std::tuple graph = buildGraph(data); if(std::get<0>(graph)) { - packet->graphPackage = new CGraphDataPackage; - packet->graphPackage->fromFilter = std::get<1>(graph); - packet->graphPackage->currentField = this->graphPackage->inFields[0]; + packet->src_filterID = std::get<2>(graph); + if(std::get<1>(graph)) packet->distance = data[0]->distance+1; + else packet->distance = data[0]->distance+1; } + + packet->field = this->field; if (packet->status == CDataPacket::NO_ERROR) packet->data.reference(op(data[0]->data, value)); @@ -160,86 +183,99 @@ namespace xios CFieldFieldArithmeticFilter::CFieldFieldArithmeticFilter(CGarbageCollector& gc, const std::string& op) : CFilter(gc, 2, this) , op(operatorExpr.getOpFieldField(op)) - { /* Nothing to do */ }; + { }; - std::pair CFieldFieldArithmeticFilter::buildGraph(std::vector data) + std::tuple CFieldFieldArithmeticFilter::buildGraph(std::vector data) { - bool building_graph = this->graphEnabled; + bool building_graph = this->tag ? ((data[0]->timestamp >= this->field->field_graph_start && data[0]->timestamp <= this->field->field_graph_end) && (data[0]->timestamp == data[1]->timestamp)) : false; + int unique_filter_id; - bool firstround = true; + + bool firstround; if(building_graph) - { - if(!data[0]->graphPackage) - { - data[0]->graphPackage = new CGraphDataPackage; - data[0]->graphPackage->currentField = this->graphPackage->inFields[0]; - data[0]->graphPackage->fromFilter = -1; - } - if(!data[1]->graphPackage) - { - data[1]->graphPackage = new CGraphDataPackage; - data[1]->graphPackage->currentField = this->graphPackage->inFields[0]; - data[1]->graphPackage->fromFilter = -1; - } + { + CWorkflowGraph::allocNodeEdge(); - if(!CWorkflowGraph::mapHashFilterID_) CWorkflowGraph::mapHashFilterID_ = new std::unordered_map ; - size_t filterhash = std::hash{}(this->graphPackage->inFields[0]->content+to_string(data[0]->timestamp)+this->graphPackage->inFields[0]->getId()); + size_t filterhash = std::hash{}(this->field->content+to_string(data[0]->timestamp)+this->field->getId()); // first round - if(CWorkflowGraph::mapHashFilterID_->find(filterhash) == CWorkflowGraph::mapHashFilterID_->end()) + if(CWorkflowGraph::mapHashFilterID_ptr->find(filterhash) == CWorkflowGraph::mapHashFilterID_ptr->end()) { - this->graphPackage->filterId = CWorkflowGraph::getNodeSize(); - unique_filter_id = this->graphPackage->filterId; - CWorkflowGraph::addNode("Arithmetic filter\\n ("+this->graphPackage->inFields[0]->content+")", 4, false, 0, data[0]); + firstround = true; + this->filterID = InvalidableObject::filterIdGenerator++; + int edgeID = InvalidableObject::edgeIdGenerator++; + + CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+this->field->content+")", 3, 1, 0, data[0]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; - CWorkflowGraph::addEdge(data[0]->graphPackage->fromFilter, this->graphPackage->filterId, data[0]); - data[0]->graphPackage->fromFilter = this->graphPackage->filterId; - data[0]->graphPackage->currentField = this->graphPackage->inFields[0]; + if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "
file attributes :
" +this->field->file->record4graphXiosAttributes(); + + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_tag = this->tag; + if(CWorkflowGraph::build_begin) + { - CWorkflowGraph::addEdge(data[1]->graphPackage->fromFilter, this->graphPackage->filterId, data[1]); - data[1]->graphPackage->fromFilter = this->graphPackage->filterId; - data[1]->graphPackage->currentField = this->graphPackage->inFields[0]; + CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; - std::rotate(this->graphPackage->inFields.begin(), this->graphPackage->inFields.begin() + 1, this->graphPackage->inFields.end()); + edgeID = InvalidableObject::edgeIdGenerator++; - (*CWorkflowGraph::mapHashFilterID_)[filterhash] = unique_filter_id; - + CWorkflowGraph::addEdge(edgeID, this->filterID, data[1]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; + + (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; + (*CWorkflowGraph::mapFilters_ptr_with_info)[data[1]->src_filterID].filter_filled = 0 ; + } + CWorkflowGraph::build_begin = true; + + (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash] = this->filterID; + unique_filter_id = this->filterID; + } // not first round else { - unique_filter_id = (*CWorkflowGraph::mapHashFilterID_)[filterhash]; - if(data[0]->graphPackage->fromFilter != unique_filter_id) + firstround = false; + unique_filter_id = (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash]; + if(data[0]->src_filterID != unique_filter_id) { - CWorkflowGraph::addEdge(data[0]->graphPackage->fromFilter, unique_filter_id, data[0]); + int edgeID = InvalidableObject::edgeIdGenerator++; + CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[0]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; + (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; + data[0]->distance=max(data[0]->distance, (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].distance); } - if(data[1]->graphPackage->fromFilter != unique_filter_id) - { - CWorkflowGraph::addEdge(data[1]->graphPackage->fromFilter, unique_filter_id, data[1]); + if(data[1]->src_filterID != unique_filter_id) + { + int edgeID = InvalidableObject::edgeIdGenerator++; + CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[1]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[data[1]->src_filterID].filter_filled = 0 ; + (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; + data[1]->distance=max(data[1]->distance, (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].distance); } + } } - return std::make_pair(building_graph, unique_filter_id); + return std::make_tuple(building_graph, firstround, unique_filter_id); } - CDataPacketPtr CFieldFieldArithmeticFilter::apply(std::vector data) { CDataPacketPtr packet(new CDataPacket); packet->date = data[0]->date; packet->timestamp = data[0]->timestamp; - std::pair graph = buildGraph(data); + std::tuple graph = buildGraph(data); - if(std::get<0>(graph)) - { - packet->graphPackage = new CGraphDataPackage; - packet->graphPackage->fromFilter = std::get<1>(graph); - packet->graphPackage->currentField = this->graphPackage->inFields[0]; - } + if(std::get<0>(graph)) packet->src_filterID = std::get<2>(graph); + if(std::get<0>(graph) && std::get<1>(graph)) packet->distance = max(data[0]->distance+1, data[1]->distance+1); + if(std::get<0>(graph) && !std::get<1>(graph)) packet->distance = max(data[0]->distance, data[1]->distance); + + packet->field = this->field; + if (data[0]->status != CDataPacket::NO_ERROR) packet->status = data[0]->status; @@ -253,4 +289,10 @@ namespace xios return packet; } + + StdString CScalarFieldArithmeticFilter::GetName(void) { return StdString("CScalarFieldArithmeticFilter"); } + StdString CFieldScalarArithmeticFilter::GetName(void) { return StdString("CFieldScalarArithmeticFilter"); } + StdString CFieldFieldArithmeticFilter::GetName(void) { return StdString("CFieldFieldArithmeticFilter"); } + + } // namespace xios diff --git a/xios_2311_src/src/filter/binary_arithmetic_filter.hpp b/xios_2311_src/src/filter/binary_arithmetic_filter.hpp index 64c1909bcc60a03f366090848232b998303140f7..00bbb4be85d69214839340ed01bd64b7ada6924d 100644 --- a/xios_2311_src/src/filter/binary_arithmetic_filter.hpp +++ b/xios_2311_src/src/filter/binary_arithmetic_filter.hpp @@ -5,6 +5,7 @@ #include #include "operator_expr.hpp" #include +#include namespace xios { @@ -22,6 +23,8 @@ namespace xios * \param value the scalar value */ CScalarFieldArithmeticFilter(CGarbageCollector& gc, const std::string& op, double value); + StdString virtual GetName(void); + protected: COperatorExpr::functionScalarField op; //!< The binary scalar-field operator attached to the binary arithmeric filter @@ -34,7 +37,9 @@ namespace xios * \return the result of the binary operation */ CDataPacketPtr virtual apply(std::vector data); - std::pair virtual buildGraph(std::vector data); + std::tuple virtual buildGraph(std::vector data); + + }; // class CScalarFieldArithmeticFilter /*! @@ -51,6 +56,8 @@ namespace xios * \param value the scalar value */ CFieldScalarArithmeticFilter(CGarbageCollector& gc, const std::string& op, double value); + StdString virtual GetName(void); + protected: COperatorExpr::functionFieldScalar op; //!< The binary field-scalar operator attached to the binary arithmeric filter @@ -63,7 +70,7 @@ namespace xios * \return the result of the binary operation */ CDataPacketPtr virtual apply(std::vector data); - std::pair virtual buildGraph(std::vector data); + std::tuple virtual buildGraph(std::vector data); }; // class CFieldScalarArithmeticFilter /*! @@ -79,6 +86,8 @@ namespace xios * \param op the string identifing the binary field-field operator */ CFieldFieldArithmeticFilter(CGarbageCollector& gc, const std::string& op); + StdString virtual GetName(void); + protected: COperatorExpr::functionFieldField op; //!< The binary field-field operator attached to the binary arithmeric filter @@ -90,8 +99,7 @@ namespace xios * \return the result of the binary operation */ CDataPacketPtr virtual apply(std::vector data); - std::pair virtual buildGraph(std::vector data); - + std::tuple virtual buildGraph(std::vector data); }; // class CFieldFieldArithmeticFilter } // namespace xios diff --git a/xios_2311_src/src/filter/client_from_client_source_filter.cpp b/xios_2311_src/src/filter/client_from_client_source_filter.cpp deleted file mode 100755 index dbda60aadc659c5b2f959ba3dffb40befefbdec6..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/filter/client_from_client_source_filter.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include "grid.hpp" -#include "exception.hpp" -#include "calendar_util.hpp" -#include "field.hpp" -#include "context.hpp" -#include "grid.hpp" -#include -#include "workflow_graph.hpp" - -namespace xios -{ - CClientFromClientSourceFilter::CClientFromClientSourceFilter(CGarbageCollector& gc, CField* field) - : COutputPin(gc, true) - { - CContext* context = CContext::getCurrent(); - field_=field ; - grid_= field-> getGrid(); - - freqOp_ = field->freq_op ; - lastDateReceived_ = context->getCalendar()->getInitDate(); - offset_ = field->freq_offset ; - } - - void CClientFromClientSourceFilter::streamData(CEventServer& event) - { - // unlikely to input from file server where data are received at ts=0 - // for coupling, it would be after the first freq_op, because for now we don't have - // restart mecanism to send the value at ts=0. It must be changed in future - - if (wasDataAlreadyReceived_) lastDateReceived_ = lastDateReceived_ + freqOp_; - else wasDataAlreadyReceived_ = true ; - - CDate date = lastDateReceived_ + offset_; // not sure is usefull check it for all filters - - CDataPacketPtr packet(new CDataPacket); - packet->date = date; - packet->status = CDataPacket::NO_ERROR; - for (auto& subEvent : event.subEvents) (*subEvent.buffer) >> packet->timestamp ; // better management of time lien later... - packet->timestamp = date; - - grid_->getClientFromClientConnector()->transfer(event,packet->data) ; - - if(this->graphEnabled) - { - this->graphPackage->filterId = CWorkflowGraph::getNodeSize(); - CWorkflowGraph::addNode("Client to Client Source filter", 1, false, 0, packet); - } - onOutputReady(packet); - } - - bool CClientFromClientSourceFilter::isDataLate(void) - { - bool isDataLate ; - CDate currentDate = CContext::getCurrent()->getCalendar()->getCurrentDate() ; - if (wasDataAlreadyReceived_) isDataLate = lastDateReceived_ + offset_ + freqOp_ <= currentDate ; - else isDataLate = CContext::getCurrent()->getCalendar()->getInitDate()+ offset_ <= currentDate ; - return isDataLate ; - } - -} // namespace xios diff --git a/xios_2311_src/src/filter/client_from_client_source_filter.hpp b/xios_2311_src/src/filter/client_from_client_source_filter.hpp deleted file mode 100755 index a8baba35c9d6fbb2d23a0a05b3c75ebacf07cb77..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/filter/client_from_client_source_filter.hpp +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef __XIOS_CLIENT_FROM_CLIENT_SOURCE_FILTER__ -#define __XIOS_CLIENT_FROM_CLIENT_SOURCE_FILTER__ - -#include "output_pin.hpp" -#include "event_server.hpp" -#include "calendar_util.hpp" - -namespace xios -{ - class CField; - class CGrid ; - - - /*! - * A source filter is the entry point of the data in the graph of filters. - */ - class CClientFromClientSourceFilter : public COutputPin - { - public: - /*! - * Constructs a source filter accepting data attached to the specified grid. - * - * \param gc the garbage collector associated with this filter - * \param field the field which the filter aply - */ - CClientFromClientSourceFilter(CGarbageCollector& gc, CField* field) ; - - /*! - * Transforms the data received from the model into a packet and send it - * in the filter graph. The array containing the data can safely be reused - * immediately after this method returns. - * - * \param event the event associated to data reception - */ - void streamData(CEventServer& event); - bool isDataLate(void) ; - - private: - CField* field_ ; - CGrid* grid_; //!< The grid attached to the data the filter can accept - CDuration freqOp_ ; - CDuration offset_ ; - - bool wasDataAlreadyReceived_= false ; - CDate lastDateReceived_ ; - }; // class CSourceFilter -} // namespace xios - -#endif //__XIOS_CLIENT_FROM_CLIENT_SOURCE_FILTER__ diff --git a/xios_2311_src/src/filter/client_from_server_source_filter.cpp b/xios_2311_src/src/filter/client_from_server_source_filter.cpp deleted file mode 100755 index 68edff87fe34d33556a8a7e79be07bb7ed41f0b7..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/filter/client_from_server_source_filter.cpp +++ /dev/null @@ -1,175 +0,0 @@ -#include "client_from_server_source_filter.hpp" -#include "grid.hpp" -#include "field.hpp" -#include "file.hpp" -#include "exception.hpp" -#include "calendar_util.hpp" -#include "context.hpp" -#include "event_client.hpp" -#include "timer.hpp" -#include "tracer.hpp" -#include -#include "workflow_graph.hpp" - -namespace xios -{ - CClientFromServerSourceFilter::CClientFromServerSourceFilter(CGarbageCollector& gc, CField* field) - : COutputPin(gc, true) - { - CContext* context = CContext::getCurrent(); - field_ = field ; - grid_= field->getSentGrid(); - freqOp_ = field->getRelFile()->output_freq ; - client_= field->getRelFile()->getContextClient() ; - lastDateReceived_ = context->getCalendar()->getInitDate(); - offset_ = field->freq_offset ; - } - - void CClientFromServerSourceFilter::streamData(CEventServer& event) - { - const bool wasEOF = isEOF_; - int record ; - for (auto& subEvent : event.subEvents) (*subEvent.buffer) >> record ; - isEOF_ = (record == int(-1)); - - - if (wasDataAlreadyReceived_) lastDateReceived_ = lastDateReceived_ + freqOp_ ; - else wasDataAlreadyReceived_ = true; - - CDataPacketPtr packet(new CDataPacket); - packet->date = lastDateReceived_ + offset_; - packet->timestamp = packet->date ; - - if (isEOF_) - { - if (!wasEOF) dateEOF_ = lastDateReceived_; - packet->status = CDataPacket::END_OF_STREAM; - info(20)<<"Receiv Data from server to client: FieldId : "<getId()<date<<" ----> EOF"<getAssociatedClient() ; - grid_->getClientFromServerConnector(client)->transfer(event, packet->data) ; // to avoid to make a search in map for corresponding client connector, - - info(20)<<"Receiv Data from server to client: FieldId : "<getId()<date<status = CDataPacket::NO_ERROR; - } - - if(this->graphEnabled) - { - this->graphPackage->filterId = CWorkflowGraph::getNodeSize(); - CWorkflowGraph::addNode("Client from Server Source filter", 1, false, 0, packet); - } - onOutputReady(packet); - - } - - int CClientFromServerSourceFilter::sendReadDataRequest(const CDate& tsDataRequested) - { - CContext* context = CContext::getCurrent(); - lastDataRequestedFromServer_ = tsDataRequested; - - // No need to send the request if we are sure that we are already at EOF - if (!isEOF_ || context->getCalendar()->getCurrentDate() <= dateEOF_) - { - CEventClient event(field_->getType(), CField::EVENT_ID_READ_DATA); - if (client_->isServerLeader()) - { - CMessage msg; - msg << field_->getId(); - for(auto& rank : client_->getRanksServerLeader()) event.push(rank, 1, msg); - client_->sendEvent(event); - } - else client_->sendEvent(event); - } - else - { - CDataPacketPtr packet(new CDataPacket); - packet->date = tsDataRequested; - packet->timestamp = packet->date ; - packet->status = CDataPacket::END_OF_STREAM; - onOutputReady(packet); - } - - wasDataRequestedFromServer_ = true; - - return !isEOF_; - } - - bool CClientFromServerSourceFilter::sendReadDataRequestIfNeeded(void) - TRY - { - const CDate& currentDate = CContext::getCurrent()->getCalendar()->getCurrentDate(); - - bool dataRequested = false; - - while (currentDate >= lastDataRequestedFromServer_) - { - info(20) << "currentDate : " << currentDate << endl ; - info(20) << "Field : " << field_->getId() << endl ; - info(20) << "lastDataRequestedFromServer : " << lastDataRequestedFromServer_ << endl ; - info(20) << "freqOp : " << freqOp_ << endl ; - info(20) << "lastDataRequestedFromServer + fileIn_->output_freq.getValue() : " << lastDataRequestedFromServer_ + freqOp_ << endl ; - - dataRequested |= sendReadDataRequest(lastDataRequestedFromServer_ + freqOp_); - } - - return dataRequested; - } - CATCH - - void CClientFromServerSourceFilter::checkForLateData(void) - TRY - { - CContext* context = CContext::getCurrent(); - // Check if data previously requested has been received as expected - if (wasDataRequestedFromServer_ && ! isEOF_) - { - CTimer timer("CClientFromServerSourceFilter::checkForLateDataFromServer"); - timer.resume(); - traceOff() ; - timer.suspend(); - - bool isLate; - do - { - isLate = isDataLate(); - if (isLate) - { - timer.resume(); - context->globalEventLoop(); - context->eventLoop() ; - timer.suspend(); - } - } - while (isLate && timer.getCumulatedTime() < CXios::recvFieldTimeout); - timer.resume(); - traceOn() ; - timer.suspend() ; - - - if (isLate) - ERROR("void CClientFromServerSourceFilter::checkForLateDataFromServer(void)", - << "Late data at timestep = " << context->getCalendar()->getCurrentDate()); - } - } - CATCH - - - bool CClientFromServerSourceFilter::isDataLate(void) - { - bool isDataLate ; - CDate currentDate = CContext::getCurrent()->getCalendar()->getCurrentDate() ; - - const CDate nextDataDue = wasDataAlreadyReceived_ ? (lastDateReceived_ + freqOp_) : CContext::getCurrent()->getCalendar()->getInitDate(); - isDataLate = (nextDataDue <= currentDate); - - return isDataLate ; - - } - - -} // namespace xios diff --git a/xios_2311_src/src/filter/client_from_server_source_filter.hpp b/xios_2311_src/src/filter/client_from_server_source_filter.hpp deleted file mode 100755 index 31adb16906cdb97f91c42b4d176395a9ad73ee0e..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/filter/client_from_server_source_filter.hpp +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef __XIOS_CLIENT_FROM_SERVER_SOURCE_FILTER__ -#define __XIOS_CLIENT_FROM_SERVER_SOURCE_FILTER__ - -#include - -#include "output_pin.hpp" -#include "event_server.hpp" -#include "context_client.hpp" -#include "calendar_util.hpp" - - -namespace xios -{ - class CGrid; - class CField; - - /*! - * A source filter is the entry point of the data in the graph of filters. - */ - class CClientFromServerSourceFilter : public COutputPin - { - public: - /*! - * Constructs a source filter accepting data attached to the specified grid. - * - * \param gc the garbage collector associated with this filter - * \param field associated to the filter - */ - CClientFromServerSourceFilter(CGarbageCollector& gc, CField* field); - - /*! - * Transforms the data received from the model into a packet and send it - * in the filter graph. The array containing the data can safely be reused - * immediately after this method returns. - * - * \param event the event coming from server with the associated data - */ - void streamData(CEventServer& event); - bool isDataLate(void) ; - bool isEOF() {return isEOF_ ;} - int sendReadDataRequest(const CDate& tsDataRequested) ; - bool sendReadDataRequestIfNeeded(void) ; - void checkForLateData(void) ; - - private: - CField* field_; - CGrid* grid_; //!< The grid attached to the data the filter can accept - CDuration freqOp_ ; - CDuration offset_ ; - CContextClient* client_ = nullptr ; - bool wasDataAlreadyReceived_= false ; - CDate lastDateReceived_ ; - bool wasDataRequestedFromServer_ = false ; - CDate lastDataRequestedFromServer_ ; - - bool isEOF_ = false ; - CDate dateEOF_ ; - }; // class CClientFromServerSourceFilter -} // namespace xios - -#endif //__XIOS_CLIENT_FROM_SERVER_SOURCE_FILTER__ \ No newline at end of file diff --git a/xios_2311_src/src/filter/client_to_model_store_filter.cpp b/xios_2311_src/src/filter/client_to_model_store_filter.cpp deleted file mode 100755 index 30a5e0d95dc88deab736d64e5ef99cb1aa64ba57..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/filter/client_to_model_store_filter.cpp +++ /dev/null @@ -1,139 +0,0 @@ -#include "client_to_model_store_filter.hpp" -#include "context.hpp" -#include "grid.hpp" -#include "timer.hpp" -#include "tracer.hpp" -#include "workflow_graph.hpp" - -namespace xios -{ - CClientToModelStoreFilter::CClientToModelStoreFilter(CGarbageCollector& gc, CField* field) - : CInputPin(gc, 1) - , gc_(gc), graphEnabled(false) - { - context_ = CContext::getCurrent() ; - grid_ = field->getGrid() ; - - detectMissingValues_ = (!field->detect_missing_value.isEmpty() && !field->default_value.isEmpty() && field->detect_missing_value == true); - hasMissingValue_ = !field->default_value.isEmpty() ; - if (hasMissingValue_) missingValue_ = field->default_value ; - detectMissingValues_ = (!field->detect_missing_value.isEmpty() && hasMissingValue_); - } - - CConstDataPacketPtr CClientToModelStoreFilter::getPacket(Time timestamp) - { - CTimer timer("CStoreFilter::getPacket"); -// timer.resume(); - info(0)<<"ENTERING CStoreFilter::getPacket"<::const_iterator it = packets_.find(timestamp); - if (it != packets_.end()) packet = it->second; - else context_->eventLoop(); // if the packet is not available yet, check if it can be received - - timer.suspend(); - } while (!packet && timer.getCumulatedTime() < timeout); -// timer.resume(); - traceOn() ; -// timer.suspend(); - - if (!packet) - { - std::map::const_iterator it ; - info(0)<<"Impossible to get the packet with timestamp = " << timestamp<first<<" "; - info(0)<timestamp, packet)); - // The packet is always destroyed by the garbage collector - // so we register but never unregister - gc_.registerObject(this, packet->timestamp); - - } - - bool CClientToModelStoreFilter::mustAutoTrigger() const - { - return false; - } - - bool CClientToModelStoreFilter::isDataExpected(const CDate& date) const - { - return true; - } - - void CClientToModelStoreFilter::invalidate(Time timestamp) - { - CInputPin::invalidate(timestamp); - packets_.erase(packets_.begin(), packets_.lower_bound(timestamp)); - } -} // namespace xios diff --git a/xios_2311_src/src/filter/client_to_model_store_filter.hpp b/xios_2311_src/src/filter/client_to_model_store_filter.hpp deleted file mode 100755 index 0dd183891a1a0f23d53b48092631d2efcc585a88..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/filter/client_to_model_store_filter.hpp +++ /dev/null @@ -1,98 +0,0 @@ -#ifndef __XIOS_CStoreFilter__ -#define __XIOS_CStoreFilter__ - -#include "input_pin.hpp" -#include "graph_package.hpp" - -namespace xios -{ - class CContext; - class CGrid; - class CField ; - - /*! - * A terminal filter which stores all the packets it receives. - */ - class CClientToModelStoreFilter : public CInputPin - { - public: - /*! - * Constructs the filter with one input slot and an associated - * garbage collector for the specified grid and context. - * - * \param gc the garbage collector associated with this input pin - * \param context the context to which the data belongs - * \param grid the grid to which the data is attached - * \param detectMissingValues whether missing values should be detected - * \param missingValue the value to use to replace missing values - */ - CClientToModelStoreFilter(CGarbageCollector& gc, CField* field); - - /*! - * Accesses the filter storage and retuns the packet corresponding - * to the specified timestamp. If there is no packet available for - * the specified timestamp, the function waits until the data is - * received or a timeout occurs. - * - * \param timestamp the timestamp of the requested packet - * \return a pointer to a read-only packet - */ - CConstDataPacketPtr getPacket(Time timestamp); - - /*! - * Accesses the filter storage and retuns the data corresponding - * to the specified timestamp. If there is no data available for - * the specified timestamp, the function waits until the data is - * received or a timeout occurs. - * - * \param timestamp the timestamp of the requested data - * \param data the array where the data is to be copied - * \return the status code associated with the data - */ - template - CDataPacket::StatusCode getData(Time timestamp, CArray& data); - - /*! - * Tests if the filter must auto-trigger. - * - * \return true if the filter must auto-trigger - */ - bool virtual mustAutoTrigger() const; - - /*! - * Tests whether data is expected for the specified date. - * - * \param date the date associated to the data - */ - bool virtual isDataExpected(const CDate& date) const; - - /*! - * Removes all pending packets which are older than the specified timestamp. - * - * \param timestamp the timestamp used for invalidation - */ - void virtual invalidate(Time timestamp); - - CGraphPackage * graphPackage; - bool graphEnabled; - - protected: - /*! - * Stores the packet for later access. - * - * \param data a vector of packets corresponding to each slot - */ - void virtual onInputReady(std::vector data); - - private: - CGarbageCollector& gc_; //!< The garbage collector associated to the filter - CContext* context_; //!< The context to which the data belongs - CGrid* grid_; //!< The grid attached to the data the filter can accept - bool detectMissingValues_; //!< Whether missing values should be detected - double missingValue_; //!< The value to use to replace missing values - bool hasMissingValue_ ; - std::map packets_; // data) - { - buildWorkflowGraph(data); - - CTimer::get("Field : send data").resume(); - CEventClient event(field_->getType(), CField::EVENT_ID_UPDATE_DATA); - CMessage message ; - message<getId() << data[0]->timestamp ; - field_->getSentGrid()->getClientToServerConnector(client_)->transfer(data[0]->data, client_, event, message) ; - CTimer::get("Field : send data").suspend(); - } - - void CClientToServerStoreFilter::buildWorkflowGraph(std::vector data) - { - if(this->graphEnabled) - { - this->graphPackage->filterId = CWorkflowGraph::getNodeSize(); - if(!data[0]->graphPackage) data[0]->graphPackage = new CGraphDataPackage; - - std::rotate(this->graphPackage->inFields.begin(), this->graphPackage->inFields.begin() + 1, this->graphPackage->inFields.end()); - - CWorkflowGraph::addNode("Client to Server Store filter", 6, true, 1, data[0]); - - CWorkflowGraph::addEdge(data[0]->graphPackage->fromFilter, this->graphPackage->filterId, data[0]); - // flux can be redirected to other filters. So don't change the 'from' parameter - data[0]->graphPackage->currentField = this->graphPackage->inFields[0]; - } - } - - CContextClient* CClientToServerStoreFilter::getTransferedDataSize(map& size) - { - size = field_->getSentGrid()->getClientToServerConnector(client_)->getTransferedDataSize() ; - return client_ ; - } - - bool CClientToServerStoreFilter::mustAutoTrigger() const - { - return true; - } - - bool CClientToServerStoreFilter::isDataExpected(const CDate& date) const - { - return true; - } -} // namespace xios diff --git a/xios_2311_src/src/filter/client_to_server_store_filter.hpp b/xios_2311_src/src/filter/client_to_server_store_filter.hpp deleted file mode 100755 index 2454dc15df4164c1bc6ec4a293840a1b149ace24..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/filter/client_to_server_store_filter.hpp +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef __XIOS_CLIENT_TO_SERVER_STORE_FILTER__ -#define __XIOS_CLIENT_TO_SERVER_STORE_FILTER__ - -#include "input_pin.hpp" -#include "graph_package.hpp" - -namespace xios -{ - class CField; - class CContextClient ; - - /*! - * A terminal filter which transmits the packets it receives to a field for writting in a file. - */ - class CClientToServerStoreFilter : public CInputPin - { - public: - /*! - * Constructs the filter (with one input slot) associated to the specified field - * and a garbage collector. - * - * \param gc the associated garbage collector - * \param field the associated field - */ - CClientToServerStoreFilter(CGarbageCollector& gc, CField* field, CContextClient* client); - /*! - * Get the size of data transfered by call. Needed for context client buffer size evaluation - * - * \param size : map returning the size for each server rank - * \return the associated context client - */ - CContextClient* getTransferedDataSize(map& size) ; - - /*! - * Tests if the filter must auto-trigger. - * - * \return true if the filter must auto-trigger - */ - bool virtual mustAutoTrigger() const; - - void buildWorkflowGraph(std::vector data); - - /*! - * Tests whether data is expected for the specified date. - * - * \param date the date associated to the data - */ - bool virtual isDataExpected(const CDate& date) const; - CGraphPackage * graphPackage; - bool graphEnabled; - - protected: - /*! - * Callbacks a field to write a packet to a file. - * - * \param data a vector of packets corresponding to each slot - */ - void virtual onInputReady(std::vector data); - - private: - CField* field_; // data; //!< Array containing the data CDate date; //!< Date associated to the data Time timestamp; //!< Timestamp of the data StatusCode status; //!< Status of the packet - + int src_filterID=0; + std::vector filterIDoutputs; + CField *field=nullptr; + int distance=-1; + /*! * Creates a deep copy of the packet. * * \return a deep copy of the packet */ - CDataPacket* copy() const - { + CDataPacket* copy() const { CDataPacket* p = new CDataPacket; p->data.resize(data.shape()); p->data = data; p->date = date; p->timestamp = timestamp; p->status = status; - p->graphPackage = graphPackage; return p; }; - - - CDataPacket() : graphPackage(nullptr) {} - }; // struct CDataPacket typedef std::shared_ptr CDataPacketPtr; diff --git a/xios_2311_src/src/filter/file_reader_source_filter.cpp b/xios_2311_src/src/filter/file_reader_source_filter.cpp deleted file mode 100755 index 6fddc6bfabcac0550eb120c079815c7baf7cf346..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/filter/file_reader_source_filter.cpp +++ /dev/null @@ -1,83 +0,0 @@ -#include "file_reader_source_filter.hpp" -#include "grid.hpp" -#include "exception.hpp" -#include "calendar_util.hpp" -#include "context.hpp" -#include "field.hpp" -#include "file.hpp" -#include "context.hpp" -#include "workflow_graph.hpp" - -namespace xios -{ - CFileReaderSourceFilter::CFileReaderSourceFilter(CGarbageCollector& gc, CField* field) - : COutputPin(gc) - { - field_ = field ; - grid_ = field->getGrid() ; - file_ = field->getFileIn() ; - if (!file_->cyclic.isEmpty()) isCyclic_ = file_->cyclic ; - if (!field_->scale_factor.isEmpty()) { hasScaleFactor_=true ; scaleFactor_ = field_->scale_factor ; } - if (!field_->add_offset.isEmpty()) { hasAddOffset_=true ; addOffset_ = field_->add_offset ; } - } - - void CFileReaderSourceFilter::streamData() - { - Time timeStamp ; - CDataPacketPtr packet(new CDataPacket); - packet->date = CContext::getCurrent()->getCalendar()->getCurrentDate(); - packet->timestamp = timeStamp; - packet->status = CDataPacket::NO_ERROR; - - if (!isInitialized_) initialize() ; - CField::EReadField readState = CField::RF_DATA; - if ( nStepMax_==0 || (nStep_ >= nStepMax_ && !isCyclic_)) readState = CField::RF_EOF; - - if (CField::RF_EOF != readState) - { - if (!file_->isEmptyZone()) readData(packet->data) ; - else readState = CField::RF_NODATA; - } - nStep_++ ; - - if (readState == CField::RF_DATA) packet->status = CDataPacket::NO_ERROR; - else packet->status = CDataPacket::END_OF_STREAM; - - info(20)<<"Read data from file : FieldId "<getId()<<" nStep "<date<graphEnabled) - { - this->graphPackage->filterId = CWorkflowGraph::getNodeSize(); - CWorkflowGraph::addNode("File Reader Source filter", 1, false, 0, packet); - } - - onOutputReady(packet); - } - - void CFileReaderSourceFilter::initialize() - { - CContext* context = CContext::getCurrent(); - file_->initRead(); - if (!file_->isEmptyZone()) - { - file_->checkReadFile(); - nStepMax_ = file_->getDataInput()->getFieldNbRecords(field_); - nStep_ = file_->record_offset.isEmpty() ? 0 : file_->record_offset; ; - } - MPI_Allreduce(MPI_IN_PLACE, &nStepMax_, 1, MPI_INT, MPI_MAX, context->getIntraComm()); - isInitialized_=true; - } - - void CFileReaderSourceFilter::readData(CArray& data) - { - shared_ptr connector = grid_->getFullToWorkflowConnector() ; - CArray dataIn(connector->getSrcSize()) ; - file_->getDataInput()->readFieldData(field_, nStep_%nStepMax_, dataIn); - data.resize(connector->getDstSize()) ; - connector->transfer(dataIn, data) ; - - if (hasScaleFactor_ || hasAddOffset_) data = data * scaleFactor_ + addOffset_; // possibility of optimization - } - - -} // namespace xios diff --git a/xios_2311_src/src/filter/file_reader_source_filter.hpp b/xios_2311_src/src/filter/file_reader_source_filter.hpp deleted file mode 100755 index 652f680821709f6771bf3a245aacba2c2f158497..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/filter/file_reader_source_filter.hpp +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef __XIOS_FILE_READER_SOURCE_FILTER_HPP__ -#define __XIOS_FILE_READER_SOURCE_FILTER_HPP__ - -#include "output_pin.hpp" - -namespace xios -{ - class CField; - class CFile ; - class CGrid ; - - /*! - * A source filter is the entry point of the data in the graph of filters. - */ - class CFileReaderSourceFilter : public COutputPin - { - public: - /*! - * Constructs a source filter accepting data attached to the specified grid. - * - * \param gc the garbage collector associated with this filter - * \param field the field to which the data is related - */ - CFileReaderSourceFilter(CGarbageCollector& gc, CField* field); - - /*! - * Transforms the data received from the model into a packet and send it - * in the filter graph. The array containing the data can safely be reused - * immediately after this method returns. - * - * \param date the date associated to the data - * \param data an array containing the data - */ - void streamData(void); - void initialize(void) ; - void readData(CArray& data) ; - - private: - CGrid* grid_; //!< The grid attached to the data the filter can accept - CField* field_ ; - CFile* file_ ; - bool hasScaleFactor_ = false; - bool hasAddOffset_ = false ; - bool isInitialized_ = false ; - bool isCyclic_ = false ; - double scaleFactor_= 1.0 ; - double addOffset_= 0. ; - int nStepMax_ ; - int nStep_ ; - - }; // class CFileReaderSourceFilter -} // namespace xios - -#endif // __XIOS_FILE_READER_SOURCE_FILTER_HPP__ \ No newline at end of file diff --git a/xios_2311_src/src/filter/file_writer_store_filter.cpp b/xios_2311_src/src/filter/file_writer_store_filter.cpp deleted file mode 100755 index 7ffb5cd4855002847b01e52c214d39249d5d0bad..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/filter/file_writer_store_filter.cpp +++ /dev/null @@ -1,100 +0,0 @@ -#include "file_writer_store_filter.hpp" -#include "exception.hpp" -#include "field.hpp" -#include "file.hpp" -#include "context.hpp" -#include "workflow_graph.hpp" - -namespace xios -{ - CFileWriterStoreFilter::CFileWriterStoreFilter(CGarbageCollector& gc, CField* field) - : CInputPin(gc, 1) - , field_(field), graphEnabled(false) - - { - CContext* context = CContext::getCurrent(); - - if (!field) ERROR("CFileWriterStoreFilter::CFileWriterStoreFilter(CField* field)", "The field cannot be null."); - file_ = field->getFileOut() ; - grid_= field->getGrid() ; - freqWrite_ = file_->output_freq ; - lastWrite_ = context->getCalendar()->getInitDate(); - if (!file_->isEmptyZone() && (field->getGrid()->doGridHaveDataToWrite() || file_->type == CFile::type_attr::one_file)) - needToWrite_=true ; - else needToWrite_=false; - lastFileSplit_ = file_->getLastSplit() ; - nstep_ = file_->record_offset.isEmpty() ? 0 : file_->record_offset; // record_offset < 0 ==> no output (debugging) - if (!field->scale_factor.isEmpty()) { scaleFactor_ = field->scale_factor ; hasScaleFactor_ = true ; } - if (!field->add_offset.isEmpty()) { addOffset_ = field->add_offset ; hasAddOffset_ = true ; } - if (!field->prec.isEmpty() && field->prec == 2) hasRounding_ = true ; - if (!field->default_value.isEmpty()) {hasDefaultValue_=true ; defaultValue_ = field->default_value ;} - } - - void CFileWriterStoreFilter::onInputReady(std::vector data) - { - const CDate currentWrite = lastWrite_ + freqWrite_; - if (needToWrite_) - { - file_->checkWriteFile(); - if (file_->getLastSplit() != lastFileSplit_) - { - nstep_ = 0 ; - lastFileSplit_ = file_->getLastSplit() ; - } - nstep_ = nstep_+1; - - CArray dataIn = data[0]->data ; - CArray fieldData ; - - if (hasAddOffset_ || hasScaleFactor_ || hasRounding_) dataIn = data[0]->data ; - else dataIn.reference(data[0]->data) ; - - if (hasAddOffset_) dataIn = dataIn - addOffset_ ; - if (hasScaleFactor_) dataIn = dataIn / scaleFactor_; - if (hasRounding_) dataIn = round(dataIn); - - if (hasDefaultValue_) - { - size_t nbData=dataIn.numElements() ; - for (size_t idx = 0; idx < nbData; ++idx) if ( NumTraits::isNan(dataIn(idx)) ) dataIn(idx)=defaultValue_ ; - } - - if (field_->getUseCompressedOutput()) fieldData.reference(dataIn) ; - else - { - fieldData.resize(grid_->getWorkflowToFullConnector()->getDstSize()); - if (hasDefaultValue_) grid_->getWorkflowToFullConnector()->transfer(dataIn, fieldData, defaultValue_ ) ; - else grid_->getWorkflowToFullConnector()->transfer(dataIn, fieldData ) ; - } - nstep_ = file_->getDataOutput()->writeFieldData(field_, fieldData, lastWrite_,currentWrite, nstep_); - if(this->graphEnabled) - { - - this->graphPackage->filterId = CWorkflowGraph::getNodeSize(); - if(!data[0]->graphPackage) data[0]->graphPackage = new CGraphDataPackage; - data[0]->graphPackage->currentField = this->graphPackage->inFields[0]; - std::rotate(this->graphPackage->inFields.begin(), this->graphPackage->inFields.begin() + 1, this->graphPackage->inFields.end()); - - CWorkflowGraph::addNode("File Writer Store filter", 5, true, 1, data[0]); - - CWorkflowGraph::addEdge(data[0]->graphPackage->fromFilter, this->graphPackage->filterId, data[0]); - data[0]->graphPackage->fromFilter = this->graphPackage->filterId; - - - } - } - - lastWrite_ = currentWrite ; - - } - - bool CFileWriterStoreFilter::mustAutoTrigger() const - { - return true; - } - - bool CFileWriterStoreFilter::isDataExpected(const CDate& date) const - { - return true; - } -} // namespace xios diff --git a/xios_2311_src/src/filter/file_writer_store_filter.hpp b/xios_2311_src/src/filter/file_writer_store_filter.hpp deleted file mode 100755 index 034393570e7049df0f470c6583cace982cd92713..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/filter/file_writer_store_filter.hpp +++ /dev/null @@ -1,73 +0,0 @@ -#ifndef __XIOS_FILE_WRITER_STORE_FILTER_HPP__ -#define __XIOS_FILE_WRITER_STORE_FILTER_HPP__ - -#include "input_pin.hpp" -#include "graph_package.hpp" - -namespace xios -{ - class CField; - class CFile; - class CGrid; - - /*! - * A terminal filter which writes the packets it receives in a file. - */ - class CFileWriterStoreFilter : public CInputPin - { - public: - /*! - * Constructs the filter (with one input slot) associated to the specified field - * and a garbage collector. - * - * \param gc the associated garbage collector - * \param field the associated field - */ - CFileWriterStoreFilter(CGarbageCollector& gc, CField* field); - - /*! - * Tests if the filter must auto-trigger. - * - * \return true if the filter must auto-trigger - */ - bool virtual mustAutoTrigger() const; - - /*! - * Tests whether data is expected for the specified date. - * - * \param date the date associated to the data - */ - bool virtual isDataExpected(const CDate& date) const; - - CGraphPackage *graphPackage; - bool graphEnabled; - - protected: - /*! - * Callbacks a field to write a packet to a file. - * - * \param data a vector of packets corresponding to each slot - */ - void virtual onInputReady(std::vector data); - - private: - CField* field_; // data) { CDataPacketPtr outputPacket = engine->apply(data); diff --git a/xios_2311_src/src/filter/filter.hpp b/xios_2311_src/src/filter/filter.hpp index 75a286934a624a485358e88e9353e36d076dc943..f6561a08a4ca50c56ce8bdef892c20acadf47a0d 100644 --- a/xios_2311_src/src/filter/filter.hpp +++ b/xios_2311_src/src/filter/filter.hpp @@ -25,6 +25,8 @@ namespace xios */ CFilter(CGarbageCollector& gc, size_t inputSlotsCount, IFilterEngine* engine); + StdString virtual GetName(void); + /*! * Sets the trigger for a specific input slot. * @@ -61,6 +63,12 @@ namespace xios */ bool virtual isDataExpected(const CDate& date) const; + + + + int filterID; + StdString expression; + protected: IFilterEngine* engine; //!< The filter engine, might be the filter itself size_t inputSlotCount; //!< Number of slot on filter diff --git a/xios_2311_src/src/filter/garbage_collector.cpp b/xios_2311_src/src/filter/garbage_collector.cpp index 8b805bf43ce0c6dbcf6dfaecafd5a2d436083c40..3d95bc81f9df2a21a8dbc9e451b1f63ab303e121 100644 --- a/xios_2311_src/src/filter/garbage_collector.cpp +++ b/xios_2311_src/src/filter/garbage_collector.cpp @@ -2,6 +2,12 @@ namespace xios { + int InvalidableObject::filterIdGenerator = 0; + + int InvalidableObject::edgeIdGenerator = 0; + + int InvalidableObject::clusterIdGenerator = 0; + void CGarbageCollector::registerObject(InvalidableObject* Object, Time timestamp) { registeredObjects[timestamp].insert(Object); diff --git a/xios_2311_src/src/filter/garbage_collector.hpp b/xios_2311_src/src/filter/garbage_collector.hpp index 4f6fb5946f226eebf4205d8465fc1ac13a09189d..036381b3a60ade3694a2d4fd0cf3c82a14a34e1f 100644 --- a/xios_2311_src/src/filter/garbage_collector.hpp +++ b/xios_2311_src/src/filter/garbage_collector.hpp @@ -19,6 +19,17 @@ namespace xios * \param timestamp the timestamp used for invalidation */ void virtual invalidate(Time timestamp) = 0; + + + + static int filterIdGenerator; + + static int edgeIdGenerator; + + static int clusterIdGenerator; + + + }; // struct InvalidableObject /*! diff --git a/xios_2311_src/src/filter/input_pin.cpp b/xios_2311_src/src/filter/input_pin.cpp index f15b58dcdc76f9f828fef3d99937c59aa7f0dcda..2a2ebe8888f5068e66bfb473d8e4d8a2d70623c6 100644 --- a/xios_2311_src/src/filter/input_pin.cpp +++ b/xios_2311_src/src/filter/input_pin.cpp @@ -2,6 +2,7 @@ #include "output_pin.hpp" #include "garbage_collector.hpp" #include "exception.hpp" +#include "workflow_graph.hpp" namespace xios { @@ -10,7 +11,12 @@ namespace xios , slotsCount(slotsCount) , triggers(slotsCount) , hasTriggers(false) - { /* Nothing to do */ } + { } + + StdString CInputPin::GetName(void) + { + return StdString("Input pin"); + } void CInputPin::setInput(size_t inputSlot, CDataPacketPtr packet) { diff --git a/xios_2311_src/src/filter/input_pin.hpp b/xios_2311_src/src/filter/input_pin.hpp index a0d38d765b781af3b6e416d53151a30c83196e35..78d9a41505172b2940d602c39ab11d4e1f7d0680 100644 --- a/xios_2311_src/src/filter/input_pin.hpp +++ b/xios_2311_src/src/filter/input_pin.hpp @@ -25,6 +25,8 @@ namespace xios * \param slotsCount the number of slots */ CInputPin(CGarbageCollector& gc, size_t slotsCount); + + StdString virtual GetName(void); /*! * Sets the trigger for a specific input slot. diff --git a/xios_2311_src/src/filter/model_to_client_source_filter.cpp b/xios_2311_src/src/filter/model_to_client_source_filter.cpp deleted file mode 100755 index f6080849530919f9e4e4a88edef609ab358e63c9..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/filter/model_to_client_source_filter.cpp +++ /dev/null @@ -1,78 +0,0 @@ -#include "model_to_client_source_filter.hpp" -#include "grid.hpp" -#include "exception.hpp" -#include "calendar_util.hpp" -#include -#include "workflow_graph.hpp" - -namespace xios -{ - CModelToClientSourceFilter::CModelToClientSourceFilter(CGarbageCollector& gc, CGrid* grid, bool hasMissingValue, double defaultValue) - : COutputPin(gc) - , grid_(grid) - , hasMissingValue_(hasMissingValue), defaultValue_(defaultValue) - { - if (!grid) - ERROR("CSourceFilter::CSourceFilter(CGrid* grid)", - "Impossible to construct a source filter without providing a grid."); - } - - template - void CModelToClientSourceFilter::streamData(CDate date, const CArray& data) - { - CDataPacketPtr packet(new CDataPacket); - packet->date = date; - packet->timestamp = date; - packet->status = CDataPacket::NO_ERROR; - - auto connector = grid_->getModelToWorkflowConnector() ; - - if (connector->getSrcSize() != data.numElements()) - ERROR("void CModelToClientSourceFilter::streamData(CDate date, const CArray& data)", - << "[ Awaiting data of size = " <getSrcSize() << ", " - << "Received data size = " << data.numElements() << " ] " - << "The data array does not have the right size! " - << "grid = " << grid_->getId()) - const double nanValue = std::numeric_limits::quiet_NaN(); - packet->data.resize(connector->getDstSize()) ; - connector->transfer(data, packet->data, nanValue) ; - - if (hasMissingValue_) - { - const double nanValue = std::numeric_limits::quiet_NaN(); - const size_t nbData = packet->data.numElements(); - for (size_t idx = 0; idx < nbData; ++idx) - if (defaultValue_ == packet->data(idx)) packet->data(idx) = nanValue; - } - - buildWorkflowGraph(packet); - onOutputReady(packet); - } - - void CModelToClientSourceFilter::buildWorkflowGraph(CDataPacketPtr packet) - { - if(this->graphEnabled) - { - this->graphPackage->filterId = CWorkflowGraph::getNodeSize(); - if(!packet->graphPackage) - { - packet->graphPackage = new CGraphDataPackage; - } - packet->graphPackage->fromFilter = this->graphPackage->filterId; - packet->graphPackage->currentField = this->graphPackage->inFields[0]; - CWorkflowGraph::addNode("Model to Client Source filter", 1, false, 0, packet); - } - } - - - - - template void CModelToClientSourceFilter::streamData<1>(CDate date, const CArray& data); - template void CModelToClientSourceFilter::streamData<2>(CDate date, const CArray& data); - template void CModelToClientSourceFilter::streamData<3>(CDate date, const CArray& data); - template void CModelToClientSourceFilter::streamData<4>(CDate date, const CArray& data); - template void CModelToClientSourceFilter::streamData<5>(CDate date, const CArray& data); - template void CModelToClientSourceFilter::streamData<6>(CDate date, const CArray& data); - template void CModelToClientSourceFilter::streamData<7>(CDate date, const CArray& data); - -} // namespace xios diff --git a/xios_2311_src/src/filter/model_to_client_source_filter.hpp b/xios_2311_src/src/filter/model_to_client_source_filter.hpp deleted file mode 100755 index 712684c33feac68e23ccd1f62748e877c542278d..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/filter/model_to_client_source_filter.hpp +++ /dev/null @@ -1,58 +0,0 @@ -#ifndef __XIOS_MODEL_TO_CLIENT_SOURCE_FILTER_HPP__ -#define __XIOS_MODEL_TO_CLIENT_SOURCE_FILTER_HPP__ - -#include - -#include "output_pin.hpp" - -namespace xios -{ - class CGrid; - - /*! - * A source filter is the entry point of the data in the graph of filters. - */ - class CModelToClientSourceFilter : public COutputPin - { - public: - /*! - * Constructs a source filter accepting data attached to the specified grid. - * - * \param gc the garbage collector associated with this filter - * \param grid the grid to which the data is attached - * \param hasMissingValue whether data has missing value - * \param defaultValue missing value to detect - */ - CModelToClientSourceFilter(CGarbageCollector& gc, CGrid* grid, bool hasMissingValue = false, double defaultValue = 0.0); - - /*! - * Transforms the data received from the model into a packet and send it - * in the filter graph. The array containing the data can safely be reused - * immediately after this method returns. - * - * \param date the date associated to the data - * \param data an array containing the data - */ - template - void streamData(CDate date, const CArray& data); - - void buildWorkflowGraph(CDataPacketPtr packet); - - - /*! - * Transforms the data received from the server into a packet and send it - * in the filter graph. The array containing the data can safely be reused - * immediately after this method returns. - * - * \param date the date associated to the data - * \param data an array containing the data - */ - - private: - CGrid* grid_; //!< The grid attached to the data the filter can accept - const bool hasMissingValue_; - const double defaultValue_; - }; // class CSourceFilter -} // namespace xios - -#endif // __XIOS_MODEL_TO_CLIENT_SOURCE_FILTER_HPP__ diff --git a/xios_2311_src/src/filter/output_pin.cpp b/xios_2311_src/src/filter/output_pin.cpp index c7a1526d7188b2f48714f5f53de6f2430be49f61..1035926b5e7a2b966bdf9266010ca63919cd9e33 100644 --- a/xios_2311_src/src/filter/output_pin.cpp +++ b/xios_2311_src/src/filter/output_pin.cpp @@ -1,12 +1,18 @@ #include "output_pin.hpp" #include "exception.hpp" +#include "workflow_graph.hpp" namespace xios { COutputPin::COutputPin(CGarbageCollector& gc, bool manualTrigger /*= false*/) : gc(gc) - , manualTrigger(manualTrigger), graphEnabled(false) - { /* Nothing to do */ } + , manualTrigger(manualTrigger) + { } + + StdString COutputPin::GetName(void) + { + return StdString("Output pin"); + } void COutputPin::connectOutput(std::shared_ptr inputPin, size_t inputSlot) { @@ -100,4 +106,26 @@ namespace xios { outputPackets.erase(outputPackets.begin(), outputPackets.lower_bound(timestamp)); } + + void COutputPin::setParentFiltersTag() + { + for(int i=0; istart_graph<0) parent_filters[i]->start_graph = start_graph; + else parent_filters[i]->start_graph = min(parent_filters[i]->start_graph, start_graph); + + + if(parent_filters[i]->end_graph<0) parent_filters[i]->end_graph = end_graph; + else parent_filters[i]->end_graph = max(parent_filters[i]->end_graph, end_graph); + + + parent_filters[i]->tag += tag; + parent_filters[i]->setParentFiltersTag(); + } + } + + + + } // namespace xios diff --git a/xios_2311_src/src/filter/output_pin.hpp b/xios_2311_src/src/filter/output_pin.hpp index 115ae5bbc71494fb8077d2aba9f909d344267533..c8c25464f0290c56e3fb61d94c79023cd957d245 100644 --- a/xios_2311_src/src/filter/output_pin.hpp +++ b/xios_2311_src/src/filter/output_pin.hpp @@ -3,16 +3,30 @@ #include "garbage_collector.hpp" #include "input_pin.hpp" -#include "graph_package.hpp" +#include "duration.hpp" namespace xios { + class CField; + class CInputPin; + class CFilter; + class CDuration; /*! * An output pin handles the connections with downstream filters. */ class COutputPin : public InvalidableObject { public: + int tag = 0; + Time start_graph = 0; + Time end_graph = 0; + CField *field = nullptr; + int distance = 0; + + + + std::vector< std::shared_ptr > parent_filters; + /*! * Constructs an ouput pin with manual or automatic trigger * and an associated garbage collector. @@ -22,6 +36,8 @@ namespace xios */ COutputPin(CGarbageCollector& gc, bool manualTrigger = false); + StdString virtual GetName(void); + /*! * Connects to a specific slot of the input pin of a downstream filter. * Note that the output pin holds a reference on the downstream filter. @@ -65,8 +81,9 @@ namespace xios * \param timestamp the timestamp used for invalidation */ void virtual invalidate(Time timestamp); - CGraphPackage *graphPackage; - bool graphEnabled; + + void virtual setParentFiltersTag(); + protected: /*! diff --git a/xios_2311_src/src/filter/pass_through_filter.cpp b/xios_2311_src/src/filter/pass_through_filter.cpp index 26af50b2ffbfcd565dfe3d6212d8eb06a6ad7419..39fa58528d38183d9743a28860d39c3167914fd3 100644 --- a/xios_2311_src/src/filter/pass_through_filter.cpp +++ b/xios_2311_src/src/filter/pass_through_filter.cpp @@ -1,60 +1,53 @@ #include "pass_through_filter.hpp" #include "workflow_graph.hpp" -#include +#include "field.hpp" +#include "file.hpp" namespace xios { CPassThroughFilter::CPassThroughFilter(CGarbageCollector& gc) : CFilter(gc, 1, this) - { /* Nothing to do */ } - - CDataPacketPtr CPassThroughFilter::apply(std::vector data) - { - buildWorkflowGraph(data); - return data[0]; + { } - void CPassThroughFilter::buildWorkflowGraph(std::vector data) + void CPassThroughFilter::buildGraph(std::vector data) { - if(this->graphEnabled) + bool building_graph = this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; + // bool building_graph = this->tag ? data[0]->timestamp >= this->field->field_graph_start && data[0]->timestamp <= this->field->field_graph_end : false; + + if(building_graph) { - if(data[0]->graphPackage && data[0]->graphPackage->currentField->getId() == this->graphPackage->inFields[0]->getId()) - { - std::cout<<"PASS THROUGH FILTER OMITTED "<graphPackage->filterId = CWorkflowGraph::getNodeSize(); - - if(!data[0]->graphPackage) - { - data[0]->graphPackage = new CGraphDataPackage; - data[0]->graphPackage->fromFilter = -1; - data[0]->graphPackage->currentField = this->graphPackage->inFields[0]; - } + // std::cout<<"CPassThroughFilter::apply field_id = "<field->getId()<<" start = "<field->getId()+")", 2, 1, 1, data[0]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; - for(int i=0; igraphPackage->filterId; i++) + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); + if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "
file attributes :
" +this->field->file->record4graphXiosAttributes(); + + + if(CWorkflowGraph::build_begin) { - if(CXios::isClient - && (*CWorkflowGraph::vectorOfNodes_)[i].label_field_id == this->label_field_id - && (*CWorkflowGraph::vectorOfNodes_)[i].timestamp == data[0]->timestamp - && (*CWorkflowGraph::vectorOfNodes_)[i].filter_name == "Pass through filter" ) - { - data[0]->graphPackage->fromFilter = i; - return; - } + CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0; } + else CWorkflowGraph::build_begin = true; - CWorkflowGraph::addNode("Pass through filter", 2, false, 1, data[0]); - if(CXios::isClient) (*CWorkflowGraph::vectorOfNodes_)[this->graphPackage->filterId].label_field_id = this->label_field_id; - CWorkflowGraph::addEdge(data[0]->graphPackage->fromFilter, this->graphPackage->filterId, data[0]); - - data[0]->graphPackage->currentField = this->graphPackage->inFields[0]; - std::rotate(this->graphPackage->inFields.begin(), this->graphPackage->inFields.begin() + 1, this->graphPackage->inFields.end()); - - data[0]->graphPackage->fromFilter = this->graphPackage->filterId; - - } - } + data[0]->src_filterID=this->filterID; + data[0]->distance++; + } + data[0]->field = this->field; + } + + CDataPacketPtr CPassThroughFilter::apply(std::vector data) + { + if(CXios::isClient) buildGraph(data); + return data[0]; + } } // namespace xios diff --git a/xios_2311_src/src/filter/pass_through_filter.hpp b/xios_2311_src/src/filter/pass_through_filter.hpp index 1ab6e7ac3b3c81d923f73bd11ec5bd5631961789..9632b8e22510963ee1a37d544e5102da4fb2710a 100644 --- a/xios_2311_src/src/filter/pass_through_filter.hpp +++ b/xios_2311_src/src/filter/pass_through_filter.hpp @@ -19,7 +19,7 @@ namespace xios */ CPassThroughFilter(CGarbageCollector& gc); - StdString label_field_id; //used for omitting redundant pass through filter in graph + inline StdString GetName(void) {return StdString("Pass through filter");}; protected: /*! @@ -29,8 +29,7 @@ namespace xios * \return the untouched source data packet */ CDataPacketPtr virtual apply(std::vector data); - void buildWorkflowGraph(std::vector data); - + void virtual buildGraph(std::vector data); }; // class CPassThroughFilter } // namespace xios diff --git a/xios_2311_src/src/filter/server_from_client_source_filter.cpp b/xios_2311_src/src/filter/server_from_client_source_filter.cpp deleted file mode 100755 index 4309ed44b889f4840d2131b4a51dc063e5159eae..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/filter/server_from_client_source_filter.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include "server_from_client_source_filter.hpp" -#include "grid.hpp" -#include "exception.hpp" -#include "calendar_util.hpp" -#include "context.hpp" -#include "workflow_graph.hpp" - -namespace xios -{ - CServerFromClientSourceFilter::CServerFromClientSourceFilter(CGarbageCollector& gc, CGrid* grid) - : COutputPin(gc) - , grid_(grid) - { - if (!grid_) - ERROR("CServerFromClientSourceFilter::CServerFromClientSourceFilter(CGarbageCollector& gc, CGrid* grid)", - "Impossible to construct a source filter without providing a grid."); - } - - void CServerFromClientSourceFilter::streamData(CEventServer& event) - { - Time timeStamp ; - for (auto& subEvent : event.subEvents) (*subEvent.buffer) >> timeStamp ; - CDataPacketPtr packet(new CDataPacket); - packet->date = CContext::getCurrent()->getCalendar()->getTimeOrigin() + timeStamp*Second; // very bad, better to pass directly the date - packet->timestamp = timeStamp; - packet->status = CDataPacket::NO_ERROR; - grid_->getServerFromClientConnector()->transfer(event,packet->data) ; - - if(this->graphEnabled) - { - this->graphPackage->filterId = CWorkflowGraph::getNodeSize(); - packet->graphPackage = new CGraphDataPackage; - packet->graphPackage->fromFilter = this->graphPackage->filterId; - packet->graphPackage->currentField = this->graphPackage->inFields[0]; - CWorkflowGraph::addNode("Server from Client Source filter", 1, false, 0, packet); - } - onOutputReady(packet); - } - - - -} // namespace xios diff --git a/xios_2311_src/src/filter/server_from_client_source_filter.hpp b/xios_2311_src/src/filter/server_from_client_source_filter.hpp deleted file mode 100755 index 58cdb5a432efb82df4cd60026d6447f4d114aa46..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/filter/server_from_client_source_filter.hpp +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef __XIOS_SERVER_FROM_CLIENT_SOURCE_FILTER__ -#define __XIOS_SERVER_FROM_CLIENT_SOURCE_FILTER__ - -#include "output_pin.hpp" -#include "event_server.hpp" - -namespace xios -{ - class CGrid; - - /*! - * A source filter is the entry point of the data in the graph of filters. - */ - class CServerFromClientSourceFilter : public COutputPin - { - public: - /*! - * Constructs a source filter accepting data attached to the specified grid. - * - * \param gc the garbage collector associated with this filter - * \param grid the grid to which the data is attached - * \param compression - * \param mask - * \param offset the offset applied to the timestamp of all packets - * \param manualTrigger whether the output should be triggered manually - * \param hasMissingValue whether data has missing value - * \param defaultValue missing value to detect - */ - CServerFromClientSourceFilter(CGarbageCollector& gc, CGrid* grid); - - /*! - * Transforms the data received from the model into a packet and send it - * in the filter graph. The array containing the data can safely be reused - * immediately after this method returns. - * - * \param date the date associated to the data - * \param data an array containing the data - */ - void streamData(CEventServer& event); - - private: - CGrid* grid_; //!< The grid attached to the data the filter can accept - - }; // class CServerFromClientSourceFilter -} // namespace xios - -#endif // __XIOS_SERVER_FROM_CLIENT_SOURCE_FILTER__ diff --git a/xios_2311_src/src/filter/server_to_client_store_filter.cpp b/xios_2311_src/src/filter/server_to_client_store_filter.cpp deleted file mode 100755 index b4ec4cd75115930ae8b24b546f37e83939569d93..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/filter/server_to_client_store_filter.cpp +++ /dev/null @@ -1,67 +0,0 @@ -#include "server_to_client_store_filter.hpp" -#include "exception.hpp" -#include "field.hpp" -#include "grid.hpp" -#include "utils.hpp" -#include "context_client.hpp" -#include "workflow_graph.hpp" - -namespace xios -{ - CServerToClientStoreFilter::CServerToClientStoreFilter(CGarbageCollector& gc, CField* field, CContextClient* client) - : CInputPin(gc, 1) - , field_(field), client_(client), graphEnabled(false) - { - if (!field) ERROR("CServerToClientFilter::CServerToClientFilter(CField* field)", "The field cannot be null."); - grid_ = field_ -> getGrid() ; - } - - void CServerToClientStoreFilter::onInputReady(std::vector packets) - { - bool isEOF ; - if (packets[0]->status == CDataPacket::NO_ERROR) isEOF = false ; - else if (packets[0]->status == CDataPacket::END_OF_STREAM) isEOF = true ; - - CEventClient event(field_->getType(), CField::EVENT_ID_READ_DATA_READY); - - auto connector = grid_->getServerToClientConnector() ; - CMessage msg ; - msg<getId() ; - - if(this->graphEnabled) - { - CWorkflowGraph::addNode("Server to Client Store filter", 5, true, 1, packets[0]); - } - - if (isEOF) - { - msg<<(int)(-1) ; - connector->transfer(client_,event, msg) ; - info(20)<<"Send Data from server to client: FieldId : "<getId()<<" step : "<EOF"<transfer(packets[0]->data, client_, event, msg) ; - info(20)<<"Send Data from server to client: FieldId : "<getId()<<" step : "<& size) - { - size = grid_->getServerToClientConnector()->getTransferedDataSize() ; - return client_ ; - } - - bool CServerToClientStoreFilter::mustAutoTrigger() const - { - return true; - } - - bool CServerToClientStoreFilter::isDataExpected(const CDate& date) const - { - return true; - } -} // namespace xios diff --git a/xios_2311_src/src/filter/server_to_client_store_filter.hpp b/xios_2311_src/src/filter/server_to_client_store_filter.hpp deleted file mode 100755 index fbe473a3419f59da45c22aba56c2608a1fd9fca3..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/filter/server_to_client_store_filter.hpp +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef __XIOS_SERVER_TO_CLIENT_FILTER_HPP__ -#define __XIOS_SERVER_TO_CLIENT_FILTER_HPP__ - -#include "input_pin.hpp" -#include "graph_package.hpp" - -namespace xios -{ - class CField; - class CGrid ; - class CContextClient ; - - /*! - * A terminal filter which transmits the packets it receives to a field for writting in a file. - */ - class CServerToClientStoreFilter : public CInputPin - { - public: - /*! - * Constructs the filter (with one input slot) associated to the specified field - * and a garbage collector. - * - * \param gc the associated garbage collector - * \param field the associated field - */ - CServerToClientStoreFilter(CGarbageCollector& gc, CField* field, CContextClient* client); - - /*! - * Get the size of data transfered by call. Needed for context client buffer size evaluation - * - * \param size : map returning the size for each server rank - * \return the associated context client - */ - CContextClient* getTransferedDataSize(map& size) ; - - /*! - * Tests if the filter must auto-trigger. - * - * \return true if the filter must auto-trigger - */ - bool virtual mustAutoTrigger() const; - - /*! - * Tests whether data is expected for the specified date. - * - * \param date the date associated to the data - */ - bool virtual isDataExpected(const CDate& date) const; - CGraphPackage * graphPackage; - bool graphEnabled; - - protected: - /*! - * Callbacks a field to write a packet to a file. - * - * \param data a vector of packets corresponding to each slot - */ - void virtual onInputReady(std::vector data); - - private: - CField* field_; // packets; //samplingOffset.hour, this->samplingOffset.minute, this->samplingOffset.second, this->samplingOffset.timestep) , initDate(initDate) -// , nextSamplingDate(initDate + (this->samplingOffset + initDate.getRelCalendar().getTimeStep())) , nextSamplingDate(initDate + offsetMonth + ( offsetAllButMonth + initDate.getRelCalendar().getTimeStep())) , nbOperationDates(1) , nbSamplingDates(0) // , nextOperationDate(initDate + opFreq + this->samplingOffset) , isFirstOperation(true) - , graphCycleCompleted(true) - , temporalOperation(opId) + , temp_op(opId) { } - std::string CTemporalFilter::getTemporalOperation() - { - return this->temporalOperation; - } + + - void CTemporalFilter::buildWorkflowGraph(std::vector data) + + bool CTemporalFilter::buildGraph(std::vector data) { - if(this->graphEnabled ) + bool building_graph=this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; + + if(building_graph) { - if(!data[0]->graphPackage) + if(this->filterIDoutputs.size()==0) this->filterID = InvalidableObject::filterIdGenerator++; + int edgeID = InvalidableObject::edgeIdGenerator++; + + // std::cout<<"CTemporalFilter::apply filter tag = "<tag<<" start = "<start_graph<<" end = "<end_graph<filterIDoutputs.size()==0) { - data[0]->graphPackage = new CGraphDataPackage; + CWorkflowGraph::addNode(this->filterID, "Temporal Filter\\n("+this->temp_op+")", 5, 1, 0, data[0]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].transform_type = this->temp_op; + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].inputs_complete = false ; + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].clusterID = 1 ; + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = (data[0]->distance); + + + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); + if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "
file attributes :
" +this->field->file->record4graphXiosAttributes(); } - - if(graphCycleCompleted) - { - this->graphPackage->filterId = CWorkflowGraph::getNodeSize(); - CWorkflowGraph::addNode("Temporal filter \\n("+getTemporalOperation()+")", 3, false, 0, data[0]); - graphCycleCompleted = false; + + if(CWorkflowGraph::build_begin) + { + + CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); + + (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb += 1 ; + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = max(data[0]->distance+1, (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance); } - - data[0]->graphPackage->currentField = this->graphPackage->inFields[0]; - std::rotate(this->graphPackage->inFields.begin(), this->graphPackage->inFields.begin() + 1, this->graphPackage->inFields.end()); - - CWorkflowGraph::addEdge(data[0]->graphPackage->fromFilter, this->graphPackage->filterId, data[0]); - data[0]->graphPackage->fromFilter = this->graphPackage->filterId; - // this->graphPackage->sourceFilterIds.push_back(data[0]->graphPackage->fromFilter); - data[0]->graphPackage->currentField = this->graphPackage->inFields[0]; - std::rotate(this->graphPackage->inFields.begin(), this->graphPackage->inFields.begin() + 1, this->graphPackage->inFields.end()); + + + this->filterIDoutputs.push_back(data[0]->src_filterID); } + return building_graph; } - + + CDataPacketPtr CTemporalFilter::apply(std::vector data) { - buildWorkflowGraph(data); - - CDataPacketPtr packet; + bool BG = buildGraph(data); + + CDataPacketPtr packet=0; if (data[0]->status != CDataPacket::END_OF_STREAM) { @@ -111,14 +125,23 @@ namespace xios packet->status = data[0]->status; packet->data.resize(tmpData.numElements()); packet->data = tmpData; - packet->graphPackage = data[0]->graphPackage; } else packet = data[0]; isFirstOperation = false; - graphCycleCompleted = true; - } + + packet->field = this->field; + + if(BG) + { + packet->src_filterID=this->filterID; + packet->distance = data[0]->distance+1; + this->filterIDoutputs.clear(); + CWorkflowGraph::build_begin=true; + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].inputs_complete = true ; + } + } } return packet; diff --git a/xios_2311_src/src/filter/temporal_filter.hpp b/xios_2311_src/src/filter/temporal_filter.hpp index 09dddb0788ab8eb1b58a41bac38bd4c5ed9e2cd7..bfc6062aa94aaf7291c9bb07a97674c5b618456c 100644 --- a/xios_2311_src/src/filter/temporal_filter.hpp +++ b/xios_2311_src/src/filter/temporal_filter.hpp @@ -30,6 +30,8 @@ namespace xios const CDate& initDate, const CDuration samplingFreq, const CDuration samplingOffset, const CDuration opFreq, bool ignoreMissingValue = false); + inline StdString GetName(void) {return StdString("Temporal filter");}; + /*! * Applies the temporal operation to the input data and returns the result when it is ready. * @@ -37,8 +39,7 @@ namespace xios * \return the result of the temporal operation or null if it is not ready yet */ CDataPacketPtr virtual apply(std::vector data); - - void buildWorkflowGraph(std::vector data); + bool virtual buildGraph(std::vector data); /*! * Tests if the filter must auto-trigger. @@ -53,8 +54,10 @@ namespace xios * \param date the date associated to the data */ bool virtual isDataExpected(const CDate& date) const; - bool graphCycleCompleted; - std::string getTemporalOperation(); + std::vector filterIDoutputs; + std::vector > filterIDoutputs_pair; + + StdString temp_op; private: // Warning the declaration order matters here, double-check the constructor before changing it @@ -73,7 +76,6 @@ namespace xios int nbSamplingDates; // CDate nextOperationDate; //!< The date of the next operation bool isFirstOperation; //!< True before the first operation was been computed - const std::string temporalOperation; }; // class CTemporalFilter } // namespace xios diff --git a/xios_2311_src/src/filter/temporal_transform_filter.cpp b/xios_2311_src/src/filter/temporal_transform_filter.cpp deleted file mode 100755 index e2f804b3d4b85f8f97bfdf14ae47091c0c975c4c..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/filter/temporal_transform_filter.cpp +++ /dev/null @@ -1,81 +0,0 @@ -#include "temporal_transform_filter.hpp" -#include "workflow_graph.hpp" - -namespace xios -{ - - CTemporalTransformFilter::CTemporalTransformFilter(CGarbageCollector& gc, int slots, shared_ptr algo, int nrecords, bool detectMissingValues, double defaultValue) - : CTransformFilter(gc, slots, algo, detectMissingValues, defaultValue), nrecords_(nrecords), graphCycleCompleted(true) - { - } - - void CTemporalTransformFilter::buildWorkflowGraph(std::vector data) - { - if(this->graphEnabled ) - { - if(!data[0]->graphPackage) - { - data[0]->graphPackage = new CGraphDataPackage; - } - - if(graphCycleCompleted) - { - this->graphPackage->filterId = CWorkflowGraph::getNodeSize(); - CWorkflowGraph::addNode("Temporal splitting filter", 7, false, 0, data[0]); - graphCycleCompleted = false; - } - - data[0]->graphPackage->currentField = this->graphPackage->inFields[0]; - std::rotate(this->graphPackage->inFields.begin(), this->graphPackage->inFields.begin() + 1, this->graphPackage->inFields.end()); - - CWorkflowGraph::addEdge(data[0]->graphPackage->fromFilter, this->graphPackage->filterId, data[0]); - data[0]->graphPackage->fromFilter = this->graphPackage->filterId; - data[0]->graphPackage->currentField = this->graphPackage->inFields[0]; - std::rotate(this->graphPackage->inFields.begin(), this->graphPackage->inFields.begin() + 1, this->graphPackage->inFields.end()); - } - - } - - CDataPacketPtr CTemporalTransformFilter::apply(std::vector data) - { - if (data[0]->status == CDataPacket::NO_ERROR) - { - buildWorkflowGraph(data); - if (record_==0) tmpData_.resize(nrecords_) ; - algorithm_->apply(data[0]->data, tmpData_[record_]); - record_++ ; - if (record_==nrecords_) - { - size_t size=0 ; - for(auto& it : tmpData_) size += it.numElements() ; - // for now, no auxilliairy field - CDataPacketPtr packet(new CDataPacket); - packet->date = data[0]->date; - packet->timestamp = data[0]->timestamp; - packet->status = data[0]->status; - packet->data.resize(size) ; - packet->graphPackage = data[0]->graphPackage; - double* out = packet->data.dataFirst() ; - for(auto& it : tmpData_) - { - size = it.numElements() ; - double* tmp = it.dataFirst() ; - for(size_t i=0 ; idate = data[0]->date; - packet->timestamp = data[0]->timestamp; - packet->status = data[0]->status; - return packet ; - } - } -} \ No newline at end of file diff --git a/xios_2311_src/src/filter/temporal_transform_filter.hpp b/xios_2311_src/src/filter/temporal_transform_filter.hpp deleted file mode 100755 index fb45029d534a241a3b497fe2eb5a46d82c05b75f..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/filter/temporal_transform_filter.hpp +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef __XIOS_TEMPORAL_TRANSFORM_FILTER_HPP__ -#define __XIOS_TEMPORAL_TRANSFORM_FILTER_HPP__ - -#include "transform_filter.hpp" - -namespace xios -{ - - /*! - * A generic filter with multiple input slots wrapping any type of spatial transformations. - */ - class CTemporalTransformFilter : public CTransformFilter - { - public: - - CTemporalTransformFilter(CGarbageCollector& gc, int slots, shared_ptr algo, int nrecords, bool detectMissingValues, double defaultValue) ; - - protected: - /*! - Overriding this function to process transformations with auxillary inputs - */ - CDataPacketPtr virtual apply(std::vector data) ; - void buildWorkflowGraph(std::vector data); - bool graphCycleCompleted; -// void apply(const CArray& dataSrc, CArray& dataDest); - - /*! - Overriding this function to process transformations with auxillary inputs - */ -// void virtual onInputReady(std::vector data); - //! Current record in the filter - int record_=0 ; - //! Maximum number of records - int nrecords_; - //! Temporary storage for output flux - vector> tmpData_; - }; // class CTransformFilter - - -} // namespace xios - -#endif //__XIOS_TEMPORAL_TRANSFORM_FILTER_HPP__ \ No newline at end of file diff --git a/xios_2311_src/src/filter/ternary_arithmetic_filter.cpp b/xios_2311_src/src/filter/ternary_arithmetic_filter.cpp index eeaf43fabf9ef79920710cf09f5b37d7cdc6ba0d..471b198e4af88f34f3d1c2d721d0d04966aaae5c 100644 --- a/xios_2311_src/src/filter/ternary_arithmetic_filter.cpp +++ b/xios_2311_src/src/filter/ternary_arithmetic_filter.cpp @@ -1,4 +1,7 @@ #include "ternary_arithmetic_filter.hpp" +#include "workflow_graph.hpp" +#include "yacc_var.hpp" +#include "file.hpp" namespace xios { @@ -7,7 +10,67 @@ namespace xios , op(operatorExpr.getOpScalarScalarField(op)) , value1(value1) , value2(value2) - { /* Nothing to do */ }; + { + /* Nothing to do */ + }; + + std::tuple CScalarScalarFieldArithmeticFilter::buildGraph(std::vector data) + { + bool building_graph = this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; + int unique_filter_id; + bool firstround; + + if(building_graph) + { + CWorkflowGraph::allocNodeEdge(); + + size_t filterhash = std::hash{}(this->field->content+to_string(data[0]->timestamp)+this->field->getId()); + + // first round + if(CWorkflowGraph::mapHashFilterID_ptr->find(filterhash) == CWorkflowGraph::mapHashFilterID_ptr->end()) + { + firstround = true; + this->filterID = InvalidableObject::filterIdGenerator++; + int edgeID = InvalidableObject::edgeIdGenerator++; + + CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+this->field->content+")", 3, 1, 0, data[0]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_tag = this->tag; + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; + + + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); + if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "
file attributes :
" +this->field->file->record4graphXiosAttributes(); + + + if(CWorkflowGraph::build_begin) + { + CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; + + (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; + } + else CWorkflowGraph::build_begin = true; + + (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash] = this->filterID; + unique_filter_id = this->filterID; + } + // not first round + else + { + firstround=false; + unique_filter_id = (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash]; + if(data[0]->src_filterID != unique_filter_id) + { + int edgeID = InvalidableObject::edgeIdGenerator++; + CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[0]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; + (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; + } + } + } + + return std::make_tuple(building_graph, firstround, unique_filter_id); + } CDataPacketPtr CScalarScalarFieldArithmeticFilter::apply(std::vector data) { @@ -15,6 +78,14 @@ namespace xios packet->date = data[0]->date; packet->timestamp = data[0]->timestamp; packet->status = data[0]->status; + + std::tuple graph = buildGraph(data); + + if(std::get<0>(graph)) packet->src_filterID = std::get<2>(graph); + if(std::get<0>(graph) && std::get<1>(graph)) packet->distance = data[0]->distance+1; + if(std::get<0>(graph) && !std::get<1>(graph)) packet->distance = data[0]->distance; + + packet->field = this->field; if (packet->status == CDataPacket::NO_ERROR) packet->data.reference(op(value1,value2, data[0]->data)); @@ -27,7 +98,67 @@ namespace xios , op(operatorExpr.getOpScalarFieldScalar(op)) , value1(value1) , value2(value2) - { /* Nothing to do */ }; + { + /* Nothing to do */ + }; + + std::tuple CScalarFieldScalarArithmeticFilter::buildGraph(std::vector data) + { + bool building_graph = this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; + int unique_filter_id; + bool firstround; + + if(building_graph) + { + CWorkflowGraph::allocNodeEdge(); + + size_t filterhash = std::hash{}(this->field->content+to_string(data[0]->timestamp)+this->field->getId()); + + // first round + if(CWorkflowGraph::mapHashFilterID_ptr->find(filterhash) == CWorkflowGraph::mapHashFilterID_ptr->end()) + { + firstround = true; + this->filterID = InvalidableObject::filterIdGenerator++; + int edgeID = InvalidableObject::edgeIdGenerator++; + + CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+this->field->content+")", 3, 1, 0, data[0]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_tag = this->tag; + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; + + + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); + if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "
file attributes :
" +this->field->file->record4graphXiosAttributes(); + + + if(CWorkflowGraph::build_begin) + { + CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; + + (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; + } + else CWorkflowGraph::build_begin = true; + + (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash] = this->filterID; + unique_filter_id = this->filterID; + } + // not first round + else + { + firstround=false; + unique_filter_id = (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash]; + if(data[0]->src_filterID != unique_filter_id) + { + int edgeID = InvalidableObject::edgeIdGenerator++; + CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[0]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; + (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; + } + } + } + + return std::make_tuple(building_graph, firstround, unique_filter_id); + } CDataPacketPtr CScalarFieldScalarArithmeticFilter::apply(std::vector data) { @@ -35,6 +166,14 @@ namespace xios packet->date = data[0]->date; packet->timestamp = data[0]->timestamp; packet->status = data[0]->status; + + std::tuple graph = buildGraph(data); + + if(std::get<0>(graph)) packet->src_filterID = std::get<2>(graph); + if(std::get<0>(graph) && std::get<1>(graph)) packet->distance = data[0]->distance+1; + if(std::get<0>(graph) && !std::get<1>(graph)) packet->distance = data[0]->distance; + + packet->field = this->field; if (packet->status == CDataPacket::NO_ERROR) packet->data.reference(op(value1, data[0]->data,value2)); @@ -46,7 +185,82 @@ namespace xios : CFilter(gc, 2, this) , op(operatorExpr.getOpScalarFieldField(op)) , value(value) - { /* Nothing to do */ }; + { + /* Nothing to do */ + }; + + std::tuple CScalarFieldFieldArithmeticFilter::buildGraph(std::vector data) + { + bool building_graph = this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; + int unique_filter_id; + + bool firstround; + + if(building_graph) + { + CWorkflowGraph::allocNodeEdge(); + + size_t filterhash = std::hash{}(this->field->content+to_string(data[0]->timestamp)+this->field->getId()); + + // first round + if(CWorkflowGraph::mapHashFilterID_ptr->find(filterhash) == CWorkflowGraph::mapHashFilterID_ptr->end()) + { + firstround = true; + this->filterID = InvalidableObject::filterIdGenerator++; + int edgeID = InvalidableObject::edgeIdGenerator++; + + CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+this->field->content+")", 3, 1, 0, data[0]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; + + if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "
file attributes :
" +this->field->file->record4graphXiosAttributes(); + + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_tag = this->tag; + if(CWorkflowGraph::build_begin) + { + + CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; + + edgeID = InvalidableObject::edgeIdGenerator++; + + CWorkflowGraph::addEdge(edgeID, this->filterID, data[1]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; + + (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; + (*CWorkflowGraph::mapFilters_ptr_with_info)[data[1]->src_filterID].filter_filled = 0 ; + } + CWorkflowGraph::build_begin = true; + + (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash] = this->filterID; + unique_filter_id = this->filterID; + + } + // not first round + else + { + firstround = false; + unique_filter_id = (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash]; + if(data[0]->src_filterID != unique_filter_id) + { + int edgeID = InvalidableObject::edgeIdGenerator++; + CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[0]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; + (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; + } + if(data[1]->src_filterID != unique_filter_id) + { + int edgeID = InvalidableObject::edgeIdGenerator++; + CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[1]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[data[1]->src_filterID].filter_filled = 0 ; + (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; + } + + } + } + + return std::make_tuple(building_graph, firstround, unique_filter_id); + } CDataPacketPtr CScalarFieldFieldArithmeticFilter::apply(std::vector data) { @@ -54,6 +268,14 @@ namespace xios packet->date = data[0]->date; packet->timestamp = data[0]->timestamp; packet->status = data[0]->status; + + std::tuple graph = buildGraph(data); + + if(std::get<0>(graph)) packet->src_filterID = std::get<2>(graph); + if(std::get<0>(graph) && std::get<1>(graph)) packet->distance = data[0]->distance+1; + if(std::get<0>(graph) && !std::get<1>(graph)) packet->distance = data[0]->distance; + + packet->field = this->field; if (data[0]->status != CDataPacket::NO_ERROR) packet->status = data[0]->status; @@ -74,7 +296,67 @@ namespace xios , op(operatorExpr.getOpFieldScalarScalar(op)) , value1(value1) , value2(value2) - { /* Nothing to do */ }; + { + /* Nothing to do */ + }; + + std::tuple CFieldScalarScalarArithmeticFilter::buildGraph(std::vector data) + { + bool building_graph = this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; + int unique_filter_id; + bool firstround; + + if(building_graph) + { + CWorkflowGraph::allocNodeEdge(); + + size_t filterhash = std::hash{}(this->field->content+to_string(data[0]->timestamp)+this->field->getId()); + + // first round + if(CWorkflowGraph::mapHashFilterID_ptr->find(filterhash) == CWorkflowGraph::mapHashFilterID_ptr->end()) + { + firstround = true; + this->filterID = InvalidableObject::filterIdGenerator++; + int edgeID = InvalidableObject::edgeIdGenerator++; + + CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+this->field->content+")", 3, 1, 0, data[0]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_tag = this->tag; + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; + + + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); + if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "
file attributes :
" +this->field->file->record4graphXiosAttributes(); + + + if(CWorkflowGraph::build_begin) + { + CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; + + (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; + } + else CWorkflowGraph::build_begin = true; + + (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash] = this->filterID; + unique_filter_id = this->filterID; + } + // not first round + else + { + firstround=false; + unique_filter_id = (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash]; + if(data[0]->src_filterID != unique_filter_id) + { + int edgeID = InvalidableObject::edgeIdGenerator++; + CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[0]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; + (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; + } + } + } + + return std::make_tuple(building_graph, firstround, unique_filter_id); + } CDataPacketPtr CFieldScalarScalarArithmeticFilter::apply(std::vector data) { @@ -83,6 +365,14 @@ namespace xios packet->timestamp = data[0]->timestamp; packet->status = data[0]->status; + std::tuple graph = buildGraph(data); + + if(std::get<0>(graph)) packet->src_filterID = std::get<2>(graph); + if(std::get<0>(graph) && std::get<1>(graph)) packet->distance = data[0]->distance+1; + if(std::get<0>(graph) && !std::get<1>(graph)) packet->distance = data[0]->distance; + + packet->field = this->field; + if (packet->status == CDataPacket::NO_ERROR) packet->data.reference(op(data[0]->data, value1, value2)); @@ -94,7 +384,82 @@ namespace xios : CFilter(gc, 2, this) , op(operatorExpr.getOpFieldScalarField(op)) , value(value) - { /* Nothing to do */ }; + { + /* Nothing to do */ + }; + + std::tuple CFieldScalarFieldArithmeticFilter::buildGraph(std::vector data) + { + bool building_graph = this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; + int unique_filter_id; + + bool firstround; + + if(building_graph) + { + CWorkflowGraph::allocNodeEdge(); + + size_t filterhash = std::hash{}(this->field->content+to_string(data[0]->timestamp)+this->field->getId()); + + // first round + if(CWorkflowGraph::mapHashFilterID_ptr->find(filterhash) == CWorkflowGraph::mapHashFilterID_ptr->end()) + { + firstround = true; + this->filterID = InvalidableObject::filterIdGenerator++; + int edgeID = InvalidableObject::edgeIdGenerator++; + + CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+this->field->content+")", 3, 1, 0, data[0]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; + + if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "
file attributes :
" +this->field->file->record4graphXiosAttributes(); + + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_tag = this->tag; + if(CWorkflowGraph::build_begin) + { + + CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; + + edgeID = InvalidableObject::edgeIdGenerator++; + + CWorkflowGraph::addEdge(edgeID, this->filterID, data[1]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; + + (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; + (*CWorkflowGraph::mapFilters_ptr_with_info)[data[1]->src_filterID].filter_filled = 0 ; + } + CWorkflowGraph::build_begin = true; + + (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash] = this->filterID; + unique_filter_id = this->filterID; + + } + // not first round + else + { + firstround = false; + unique_filter_id = (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash]; + if(data[0]->src_filterID != unique_filter_id) + { + int edgeID = InvalidableObject::edgeIdGenerator++; + CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[0]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; + (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; + } + if(data[1]->src_filterID != unique_filter_id) + { + int edgeID = InvalidableObject::edgeIdGenerator++; + CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[1]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[data[1]->src_filterID].filter_filled = 0 ; + (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; + } + + } + } + + return std::make_tuple(building_graph, firstround, unique_filter_id); + } CDataPacketPtr CFieldScalarFieldArithmeticFilter::apply(std::vector data) { @@ -102,6 +467,14 @@ namespace xios packet->date = data[0]->date; packet->timestamp = data[0]->timestamp; packet->status = data[0]->status; + + std::tuple graph = buildGraph(data); + + if(std::get<0>(graph)) packet->src_filterID = std::get<2>(graph); + if(std::get<0>(graph) && std::get<1>(graph)) packet->distance = data[0]->distance+1; + if(std::get<0>(graph) && !std::get<1>(graph)) packet->distance = data[0]->distance; + + packet->field = this->field; if (data[0]->status != CDataPacket::NO_ERROR) packet->status = data[0]->status; @@ -119,7 +492,82 @@ namespace xios : CFilter(gc, 2, this) , op(operatorExpr.getOpFieldFieldScalar(op)) , value(value) - { /* Nothing to do */ }; + { + /* Nothing to do */ + }; + + std::tuple CFieldFieldScalarArithmeticFilter::buildGraph(std::vector data) + { + bool building_graph = this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; + int unique_filter_id; + + bool firstround; + + if(building_graph) + { + CWorkflowGraph::allocNodeEdge(); + + size_t filterhash = std::hash{}(this->field->content+to_string(data[0]->timestamp)+this->field->getId()); + + // first round + if(CWorkflowGraph::mapHashFilterID_ptr->find(filterhash) == CWorkflowGraph::mapHashFilterID_ptr->end()) + { + firstround = true; + this->filterID = InvalidableObject::filterIdGenerator++; + int edgeID = InvalidableObject::edgeIdGenerator++; + + CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+this->field->content+")", 3, 1, 0, data[0]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; + + if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "
file attributes :
" +this->field->file->record4graphXiosAttributes(); + + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_tag = this->tag; + if(CWorkflowGraph::build_begin) + { + + CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; + + edgeID = InvalidableObject::edgeIdGenerator++; + + CWorkflowGraph::addEdge(edgeID, this->filterID, data[1]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; + + (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; + (*CWorkflowGraph::mapFilters_ptr_with_info)[data[1]->src_filterID].filter_filled = 0 ; + } + CWorkflowGraph::build_begin = true; + + (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash] = this->filterID; + unique_filter_id = this->filterID; + + } + // not first round + else + { + firstround = false; + unique_filter_id = (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash]; + if(data[0]->src_filterID != unique_filter_id) + { + int edgeID = InvalidableObject::edgeIdGenerator++; + CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[0]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; + (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; + } + if(data[1]->src_filterID != unique_filter_id) + { + int edgeID = InvalidableObject::edgeIdGenerator++; + CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[1]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[data[1]->src_filterID].filter_filled = 0 ; + (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; + } + + } + } + + return std::make_tuple(building_graph, firstround, unique_filter_id); + } CDataPacketPtr CFieldFieldScalarArithmeticFilter::apply(std::vector data) { @@ -127,6 +575,14 @@ namespace xios packet->date = data[0]->date; packet->timestamp = data[0]->timestamp; packet->status = data[0]->status; + + std::tuple graph = buildGraph(data); + + if(std::get<0>(graph)) packet->src_filterID = std::get<2>(graph); + if(std::get<0>(graph) && std::get<1>(graph)) packet->distance = data[0]->distance+1; + if(std::get<0>(graph) && !std::get<1>(graph)) packet->distance = data[0]->distance; + + packet->field = this->field; if (data[0]->status != CDataPacket::NO_ERROR) packet->status = data[0]->status; @@ -144,7 +600,95 @@ namespace xios CFieldFieldFieldArithmeticFilter::CFieldFieldFieldArithmeticFilter(CGarbageCollector& gc, const std::string& op) : CFilter(gc, 3, this) , op(operatorExpr.getOpFieldFieldField(op)) - { /* Nothing to do */ }; + { + /* Nothing to do */ + }; + + std::tuple CFieldFieldFieldArithmeticFilter::buildGraph(std::vector data) + { + bool building_graph = this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; + int unique_filter_id; + + bool firstround; + + if(building_graph) + { + CWorkflowGraph::allocNodeEdge(); + + size_t filterhash = std::hash{}(this->field->content+to_string(data[0]->timestamp)+this->field->getId()); + + // first round + if(CWorkflowGraph::mapHashFilterID_ptr->find(filterhash) == CWorkflowGraph::mapHashFilterID_ptr->end()) + { + firstround = true; + this->filterID = InvalidableObject::filterIdGenerator++; + int edgeID = InvalidableObject::edgeIdGenerator++; + + CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+this->field->content+")", 3, 1, 0, data[0]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; + + if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "
file attributes :
" +this->field->file->record4graphXiosAttributes(); + + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_tag = this->tag; + if(CWorkflowGraph::build_begin) + { + + CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; + + edgeID = InvalidableObject::edgeIdGenerator++; + + CWorkflowGraph::addEdge(edgeID, this->filterID, data[1]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; + + edgeID = InvalidableObject::edgeIdGenerator++; + + CWorkflowGraph::addEdge(edgeID, this->filterID, data[2]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; + + (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; + (*CWorkflowGraph::mapFilters_ptr_with_info)[data[1]->src_filterID].filter_filled = 0 ; + (*CWorkflowGraph::mapFilters_ptr_with_info)[data[2]->src_filterID].filter_filled = 0 ; + } + CWorkflowGraph::build_begin = true; + + (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash] = this->filterID; + unique_filter_id = this->filterID; + + } + // not first round + else + { + firstround = false; + unique_filter_id = (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash]; + if(data[0]->src_filterID != unique_filter_id) + { + int edgeID = InvalidableObject::edgeIdGenerator++; + CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[0]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; + (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; + } + if(data[1]->src_filterID != unique_filter_id) + { + int edgeID = InvalidableObject::edgeIdGenerator++; + CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[1]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[data[1]->src_filterID].filter_filled = 0 ; + (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; + } + if(data[2]->src_filterID != unique_filter_id) + { + int edgeID = InvalidableObject::edgeIdGenerator++; + CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[2]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[data[2]->src_filterID].filter_filled = 0 ; + (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; + } + + } + } + + return std::make_tuple(building_graph, firstround, unique_filter_id); + } CDataPacketPtr CFieldFieldFieldArithmeticFilter::apply(std::vector data) { @@ -152,6 +696,14 @@ namespace xios packet->date = data[0]->date; packet->timestamp = data[0]->timestamp; packet->status = data[0]->status; + + std::tuple graph = buildGraph(data); + + if(std::get<0>(graph)) packet->src_filterID = std::get<2>(graph); + if(std::get<0>(graph) && std::get<1>(graph)) packet->distance = data[0]->distance+1; + if(std::get<0>(graph) && !std::get<1>(graph)) packet->distance = data[0]->distance; + + packet->field = this->field; if (data[0]->status != CDataPacket::NO_ERROR) packet->status = data[0]->status; diff --git a/xios_2311_src/src/filter/ternary_arithmetic_filter.hpp b/xios_2311_src/src/filter/ternary_arithmetic_filter.hpp index 5587876327a0f680c8ad4d211995a7d23e55c356..36f6d3208ddbef19322f4d0c7144ee971f31d373 100644 --- a/xios_2311_src/src/filter/ternary_arithmetic_filter.hpp +++ b/xios_2311_src/src/filter/ternary_arithmetic_filter.hpp @@ -4,6 +4,7 @@ #include "filter.hpp" #include #include "operator_expr.hpp" +#include namespace xios { @@ -35,6 +36,7 @@ namespace xios * \return the result of the ternary operation */ CDataPacketPtr virtual apply(std::vector data); + std::tuple virtual buildGraph(std::vector data); }; // class CScalarScalarFieldArithmeticFilter @@ -66,6 +68,7 @@ namespace xios * \return the result of the ternary operation */ CDataPacketPtr virtual apply(std::vector data); + std::tuple virtual buildGraph(std::vector data); }; // class CScalarScalarFieldArithmeticFilter /*! @@ -94,6 +97,7 @@ namespace xios * \return the result of the ternary operation */ CDataPacketPtr virtual apply(std::vector data); + std::tuple virtual buildGraph(std::vector data); }; // class CScalarScalarFieldArithmeticFilter @@ -126,6 +130,7 @@ namespace xios * \return the result of the ternary operation */ CDataPacketPtr virtual apply(std::vector data); + std::tuple virtual buildGraph(std::vector data); }; // class CFieldScalarScalarArithmeticFilter @@ -155,6 +160,7 @@ namespace xios * \return the result of the ternary operation */ CDataPacketPtr virtual apply(std::vector data); + std::tuple virtual buildGraph(std::vector data); }; // class CFieldScalarFieldArithmeticFilter @@ -184,6 +190,7 @@ namespace xios * \return the result of the ternary operation */ CDataPacketPtr virtual apply(std::vector data); + std::tuple virtual buildGraph(std::vector data); }; // class CFieldFielScalardArithmeticFilter @@ -211,6 +218,7 @@ namespace xios * \return the result of the ternary operation */ CDataPacketPtr virtual apply(std::vector data); + std::tuple virtual buildGraph(std::vector data); }; // class CFieldFielFieldArithmeticFilter diff --git a/xios_2311_src/src/filter/transform_filter.cpp b/xios_2311_src/src/filter/transform_filter.cpp deleted file mode 100755 index 73f6eeb7e3e87d47fff7685d493b3034df5b6754..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/filter/transform_filter.cpp +++ /dev/null @@ -1,72 +0,0 @@ -#include "transform_filter.hpp" -#include "grid_algorithm.hpp" -#include "workflow_graph.hpp" -namespace xios -{ - - CTransformFilter::CTransformFilter( CGarbageCollector& gc, int slots, shared_ptr algo, bool detectMissingValues, double defaultValue) - : CFilter(gc, slots, this), algorithm_(algo), - detectMissingValues_(detectMissingValues), defaultValue_(defaultValue) - { - - } - - CDataPacketPtr CTransformFilter::apply(std::vector data) - { - // for now, no auxilliairy field - CDataPacketPtr packet(new CDataPacket); - packet->date = data[0]->date; - packet->timestamp = data[0]->timestamp; - packet->status = data[0]->status; - - if (packet->status == CDataPacket::NO_ERROR) - { - buildWorkflowGraph(data, packet, algorithm_); - - if (data.size()>1) - { - vector> auxData(data.size()-1); - for(int i=0;idata) ; - algorithm_->apply(data[0]->data, auxData, packet->data); - } - else algorithm_->apply(data[0]->data, packet->data); - } - return packet; - } - - void CTransformFilter::buildWorkflowGraph(std::vector data, CDataPacketPtr packet, shared_ptr algorithm) - { - if(this->graphEnabled) - { - this->graphPackage->filterId = CWorkflowGraph::getNodeSize(); - - packet->graphPackage = new CGraphDataPackage; - if(data[0]->graphPackage) - { - packet->graphPackage->fromFilter = data[0]->graphPackage->fromFilter; - } - packet->graphPackage->toFilter = data[0]->graphPackage->toFilter; - packet->graphPackage->current_filter_name = data[0]->graphPackage->current_filter_name; - packet->graphPackage->contextId = data[0]->graphPackage->contextId; - - int tmp_from = packet->graphPackage->fromFilter; - if(this->graphPackage->show) - { - packet->graphPackage->currentField = this->graphPackage->inFields[0]; - CWorkflowGraph::addNode("Spatial transform filter "+algorithm->getAlgoName(), 4, false, 1, packet); - CWorkflowGraph::addEdge(packet->graphPackage->fromFilter, this->graphPackage->filterId, packet); - packet->graphPackage->fromFilter = this->graphPackage->filterId; - packet->graphPackage->currentField = this->graphPackage->inFields[0]; - std::rotate(this->graphPackage->inFields.begin(), this->graphPackage->inFields.begin() + 1, this->graphPackage->inFields.end()); - } - else - { - packet->graphPackage->currentField = this->graphPackage->inFields[0]; - if(CXios::isClient) CWorkflowGraph::vectorOfNodes_->at(tmp_from).filter_name += algorithm->getAlgoName(); - else CWorkflowGraph::vectorOfNodes_srv_->at(tmp_from).filter_name += algorithm->getAlgoName(); - - } - } - } - -} diff --git a/xios_2311_src/src/filter/transform_filter.hpp b/xios_2311_src/src/filter/transform_filter.hpp deleted file mode 100755 index 88fb9901c8edbc67b357ecca36db37072ad96806..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/filter/transform_filter.hpp +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef __XIOS_TRANSFORM_FILTER_HPP__ -#define __XIOS_TRANSFORM_FILTER_HPP__ - -#include "filter.hpp" -#include "grid_algorithm.hpp" - -namespace xios -{ - - /*! - * A generic filter with multiple input slots wrapping any type of spatial transformations. - */ - class CTransformFilter : public CFilter, IFilterEngine - { - public: - - CTransformFilter(CGarbageCollector& gc, int slots, shared_ptr algo, bool detectMissingValues, double defaultValue) ; - - protected: - /*! - Overriding this function to process transformations with auxillary inputs - */ - CDataPacketPtr virtual apply(std::vector data) ; - void buildWorkflowGraph(std::vector data, CDataPacketPtr packet, shared_ptr algorithm); - -// void apply(const CArray& dataSrc, CArray& dataDest); - - shared_ptr algorithm_ ; - bool detectMissingValues_ ; - bool defaultValue_ ; - - }; // class CTransformFilter - - -} // namespace xios - -#endif //__XIOS_CSpatialTransformFilter__ diff --git a/xios_2311_src/src/filter/unary_arithmetic_filter.cpp b/xios_2311_src/src/filter/unary_arithmetic_filter.cpp index 52b863ef13a46e67f08b8db4db0c46505e780e4e..36f8835a02a5f16e17fa3e32e9f2a6da73a21cd0 100644 --- a/xios_2311_src/src/filter/unary_arithmetic_filter.cpp +++ b/xios_2311_src/src/filter/unary_arithmetic_filter.cpp @@ -1,64 +1,70 @@ #include "unary_arithmetic_filter.hpp" #include "workflow_graph.hpp" - +#include "yacc_var.hpp" +#include "file.hpp" namespace xios { CUnaryArithmeticFilter::CUnaryArithmeticFilter(CGarbageCollector& gc, const std::string& op) : CFilter(gc, 1, this) , op(operatorExpr.getOpField(op)) - { /* Nothing to do */ }; + { }; - std::pair CUnaryArithmeticFilter::buildGraph(std::vector data) + std::tuple CUnaryArithmeticFilter::buildGraph(std::vector data) { - bool building_graph = this->graphEnabled; + bool building_graph = this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; int unique_filter_id; - bool firstround = true; + bool firstround; if(building_graph) { - if(!data[0]->graphPackage) - { - data[0]->graphPackage = new CGraphDataPackage; - data[0]->graphPackage->currentField = this->graphPackage->inFields[0]; - data[0]->graphPackage->fromFilter = -1; - } - - if(!CWorkflowGraph::mapHashFilterID_) CWorkflowGraph::mapHashFilterID_ = new std::unordered_map ; - - size_t filterhash = std::hash{}(this->graphPackage->inFields[0]->content+to_string(data[0]->timestamp)+this->graphPackage->inFields[0]->getId()); + CWorkflowGraph::allocNodeEdge(); + size_t filterhash = std::hash{}(this->field->content+to_string(data[0]->timestamp)+this->field->getId()); // first round - if(CWorkflowGraph::mapHashFilterID_->find(filterhash) == CWorkflowGraph::mapHashFilterID_->end()) + if(CWorkflowGraph::mapHashFilterID_ptr->find(filterhash) == CWorkflowGraph::mapHashFilterID_ptr->end()) { - this->graphPackage->filterId = CWorkflowGraph::getNodeSize(); - unique_filter_id = this->graphPackage->filterId; - CWorkflowGraph::addNode("Arithmetic filter\\n ("+this->graphPackage->inFields[0]->content+")", 4, false, 0, data[0]); + firstround=true; + this->filterID = InvalidableObject::filterIdGenerator++; + int edgeID = InvalidableObject::edgeIdGenerator++; + CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+this->field->content+")", 3, 1, 0, data[0]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_tag = this->tag; + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; + + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); + if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "
file attributes :
" +this->field->file->record4graphXiosAttributes(); + + if(CWorkflowGraph::build_begin) + { - CWorkflowGraph::addEdge(data[0]->graphPackage->fromFilter, this->graphPackage->filterId, data[0]); - data[0]->graphPackage->fromFilter = this->graphPackage->filterId; - data[0]->graphPackage->currentField = this->graphPackage->inFields[0]; - std::rotate(this->graphPackage->inFields.begin(), this->graphPackage->inFields.begin() + 1, this->graphPackage->inFields.end()); + CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; - - (*CWorkflowGraph::mapHashFilterID_)[filterhash] = unique_filter_id; - + (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; + } + else CWorkflowGraph::build_begin = true; + + (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash] = this->filterID; + unique_filter_id = this->filterID; } - // not first round else { - unique_filter_id = (*CWorkflowGraph::mapHashFilterID_)[filterhash]; - if(data[0]->graphPackage->fromFilter != unique_filter_id) + firstround=false; + unique_filter_id = (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash]; + if(data[0]->src_filterID != unique_filter_id) { - CWorkflowGraph::addEdge(data[0]->graphPackage->fromFilter, unique_filter_id, data[0]); - } - } + int edgeID = InvalidableObject::edgeIdGenerator++; + CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[0]); + (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; + (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; + } + } + } - return std::make_pair(building_graph, unique_filter_id); + return std::make_tuple(building_graph, firstround, unique_filter_id); } - CDataPacketPtr CUnaryArithmeticFilter::apply(std::vector data) { CDataPacketPtr packet(new CDataPacket); @@ -66,14 +72,13 @@ namespace xios packet->timestamp = data[0]->timestamp; packet->status = data[0]->status; - std::pair graph = buildGraph(data); + std::tuple graph = buildGraph(data); - if(std::get<0>(graph)) - { - packet->graphPackage = new CGraphDataPackage; - packet->graphPackage->fromFilter = std::get<1>(graph); - packet->graphPackage->currentField = this->graphPackage->inFields[0]; - } + if(std::get<0>(graph)) packet->src_filterID = std::get<2>(graph); + if(std::get<0>(graph) && std::get<1>(graph)) packet->distance = data[0]->distance+1; + if(std::get<0>(graph) && !std::get<1>(graph)) packet->distance = data[0]->distance; + + packet->field = this->field; if (packet->status == CDataPacket::NO_ERROR) packet->data.reference(op(data[0]->data)); diff --git a/xios_2311_src/src/filter/unary_arithmetic_filter.hpp b/xios_2311_src/src/filter/unary_arithmetic_filter.hpp index a20784155b6bc6cd57e3904658805d99a7a1d288..6bab61d4dedb440496af3e42d804a8e822d79b78 100644 --- a/xios_2311_src/src/filter/unary_arithmetic_filter.hpp +++ b/xios_2311_src/src/filter/unary_arithmetic_filter.hpp @@ -33,7 +33,7 @@ namespace xios * \return the result of the unary operation */ CDataPacketPtr virtual apply(std::vector data); - std::pair virtual buildGraph(std::vector data); + std::tuple virtual buildGraph(std::vector data); }; // class CUnaryArithmeticFilter } // namespace xios diff --git a/xios_2311_src/src/graph_package.hpp b/xios_2311_src/src/graph_package.hpp deleted file mode 100644 index 04f49e6036269664348e21ef6ef02f1f916d5459..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/graph_package.hpp +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef __XIOS_CGraph_package__ -#define __XIOS_CGraph_package__ - -namespace xios -{ - class CField; - struct CGraphPackage - { - int filterId; - std::vector< int > sourceFilterIds; - std::vector< CField* > inFields; - StdString contextId; - bool show; - std::pair< Time, Time > graphInterval; - - CGraphPackage(): show(true) {} - }; - struct CGraphDataPackage - { - int fromFilter; - int toFilter; - StdString current_filter_name; - CField *currentField=nullptr; - int distanceFromStart=-1; - StdString contextId; - bool show; - - CGraphDataPackage(): fromFilter(-1), show(true) {} - }; -} // namespace xios - -#endif //__XIOS_CGraph_package__ diff --git a/xios_2311_src/src/group_factory.hpp b/xios_2311_src/src/group_factory.hpp index b20d9a48cc544eb75990fc06b8b7c9d1318d85a6..cb46e3a2b7b7efdf0bd21d63d7a2e036d7affcc8 100644 --- a/xios_2311_src/src/group_factory.hpp +++ b/xios_2311_src/src/group_factory.hpp @@ -17,7 +17,6 @@ namespace xios /// Mutateurs /// static void SetCurrentContextId(const StdString & context); - static void clearCurrentContextId() {CurrContext.clear(); CurrContext.shrink_to_fit();} template static void AddGroup(std::shared_ptr pgroup, diff --git a/xios_2311_src/src/group_factory_decl.cpp b/xios_2311_src/src/group_factory_decl.cpp index f21ad6a5d2df8065b23fe0ac0dea3417f5189e85..7b0a46fcdb45d9fe8542aee4c6e20bbec782573b 100644 --- a/xios_2311_src/src/group_factory_decl.cpp +++ b/xios_2311_src/src/group_factory_decl.cpp @@ -19,8 +19,6 @@ namespace xios macro(CFieldGroup) macro(CFileGroup) - macro(CCouplerInGroup) - macro(CCouplerOutGroup) macro(CGridGroup) macro(CAxisGroup) macro(CDomainGroup) diff --git a/xios_2311_src/src/group_template.hpp b/xios_2311_src/src/group_template.hpp index 9fcbfbe2c2c11c1f42f77b958ab2e16034c51290..2ceefef23dc3d26f8e2b8519d3b301edd7eb6e29 100644 --- a/xios_2311_src/src/group_template.hpp +++ b/xios_2311_src/src/group_template.hpp @@ -71,8 +71,9 @@ namespace xios V* createChildGroup(const string& id="") ; void addChildGroup(V* childGroup) ; static bool dispatchEvent(CEventServer& event) ; - void sendCreateChild(const string& id, CContextClient* client, const string& objectId="") ; - void sendCreateChildGroup(const string& id, CContextClient* client, const string& objectId="") ; + void sendCreateChild(const string& id="") ; + void sendCreateChild(const string& id, CContextClient* client) ; + void sendCreateChildGroup(const string& id="") ; static void recvCreateChild(CEventServer& event) ; void recvCreateChild(CBufferIn& buffer) ; static void recvCreateChildGroup(CEventServer& event) ; diff --git a/xios_2311_src/src/group_template_decl.cpp b/xios_2311_src/src/group_template_decl.cpp index 0f214048045ca4bb269781b18a4b7d103ad86b9f..f3f9d369e0896a00b97387f040fd293f470ca76f 100644 --- a/xios_2311_src/src/group_template_decl.cpp +++ b/xios_2311_src/src/group_template_decl.cpp @@ -9,8 +9,6 @@ namespace xios macro(Context) macro(Field) macro(File) - macro(CouplerIn) - macro(CouplerOut) macro(Domain) macro(Grid) macro(Axis) diff --git a/xios_2311_src/src/group_template_impl.hpp b/xios_2311_src/src/group_template_impl.hpp index b30af33fb0f312650b54cc01f4befeb97d573766..a99a8d10f3f2a8998d1d96098276c41a725f454c 100644 --- a/xios_2311_src/src/group_template_impl.hpp +++ b/xios_2311_src/src/group_template_impl.hpp @@ -368,16 +368,48 @@ namespace xios return CGroupFactory::AddGroup(this->getShared(), childGroup->getShared()) ; } + template - void CGroupTemplate::sendCreateChild(const string& id, CContextClient* client, const string& objectId) + void CGroupTemplate::sendCreateChild(const string& id) + { + CContext* context=CContext::getCurrent() ; + + if (context->hasClient) + // if (!context->hasServer ) + { + // Use correct context client to send message +// CContextClient* contextClientTmp = (0 != context->clientPrimServer) ? context->clientPrimServer : context->client; + int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; + for (int i = 0; i < nbSrvPools; ++i) + { + CContextClient* contextClientTmp = (context->hasServer) ? context->clientPrimServer[i] : context->client; + + CEventClient event(this->getType(),EVENT_ID_CREATE_CHILD) ; + if (contextClientTmp->isServerLeader()) + { + CMessage msg ; + msg<getId() ; + msg<& ranks = contextClientTmp->getRanksServerLeader(); + for (std::list::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) + event.push(*itRank,1,msg) ; + contextClientTmp->sendEvent(event) ; + } + else contextClientTmp->sendEvent(event) ; + } + } + + } + + template + void CGroupTemplate::sendCreateChild(const string& id, CContextClient* client) { CEventClient event(this->getType(),EVENT_ID_CREATE_CHILD) ; if (client->isServerLeader()) { CMessage msg ; - if (objectId.empty()) msg << this->getId(); - else msg << objectId; + msg<getId() ; msg<& ranks = client->getRanksServerLeader(); for (std::list::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) @@ -387,25 +419,35 @@ namespace xios else client->sendEvent(event) ; } + template - void CGroupTemplate::sendCreateChildGroup(const string& id, CContextClient* client, const string& objectId) + void CGroupTemplate::sendCreateChildGroup(const string& id) { - CEventClient event(this->getType(),EVENT_ID_CREATE_CHILD_GROUP) ; - if (client->isServerLeader()) - { - CMessage msg ; - if (objectId.empty()) msg << this->getId(); - else msg << objectId; - msg<& ranks = client->getRanksServerLeader(); - for (std::list::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) - event.push(*itRank,1,msg) ; - client->sendEvent(event) ; - } - else client->sendEvent(event) ; - } - - + CContext* context=CContext::getCurrent() ; + if (context->hasClient) + { + // Use correct context client to send message + // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; + int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 1) : 1; + for (int i = 0; i < nbSrvPools; ++i) + { + CContextClient* contextClientTmp = (context->hasServer) ? context->clientPrimServer[i] : context->client; + CEventClient event(this->getType(),EVENT_ID_CREATE_CHILD_GROUP) ; + if (contextClientTmp->isServerLeader()) + { + CMessage msg ; + msg<getId() ; + msg<& ranks = contextClientTmp->getRanksServerLeader(); + for (std::list::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) + event.push(*itRank,1,msg) ; + contextClientTmp->sendEvent(event) ; + } + else contextClientTmp->sendEvent(event) ; + } + } + } + template void CGroupTemplate::recvCreateChild(CEventServer& event) { diff --git a/xios_2311_src/src/interface/c/iccalendar.cpp b/xios_2311_src/src/interface/c/iccalendar.cpp index 9a26f315c9dc1b07d38d5a1f86b96ee017029cba..b8f67540ab9a0a2adc711d8ae28e7e53311a3a66 100644 --- a/xios_2311_src/src/interface/c/iccalendar.cpp +++ b/xios_2311_src/src/interface/c/iccalendar.cpp @@ -12,15 +12,11 @@ extern "C" TRY { CTimer::get("XIOS").resume(); - CTimer::get("XIOS update calendar").resume(); xios::CContext* context = CContext::getCurrent(); if (!context->hasServer && !context->client->isAttachedModeEnabled()) - context->eventLoop(); -//ym context->checkBuffersAndListen(); - + context->checkBuffersAndListen(); context->updateCalendar(step); context->sendUpdateCalendar(step); - CTimer::get("XIOS update calendar").suspend(); CTimer::get("XIOS").suspend(); } CATCH_DUMP_STACK diff --git a/xios_2311_src/src/interface/c/icdata.cpp b/xios_2311_src/src/interface/c/icdata.cpp index 3f729ee0cb10078ea24ac187109b9fa223527275..da965a99b7d04229d2d194957996b2360f09381d 100644 --- a/xios_2311_src/src/interface/c/icdata.cpp +++ b/xios_2311_src/src/interface/c/icdata.cpp @@ -64,8 +64,6 @@ extern "C" if (!cstr2string(client_id, len_client_id, str)) return; - CTimer::get("XIOS").resume(); - CTimer::get("XIOS init").resume(); int initialized; MPI_Initialized(&initialized); if (initialized) local_comm=MPI_Comm_f2c(*f_local_comm); @@ -134,7 +132,6 @@ extern "C" CTimer::get("XIOS context finalize").resume(); CContext* context = CContext::getCurrent(); context->finalize(); - CXios::getDaemonsManager()->eventLoop() ; CTimer::get("XIOS context finalize").suspend(); CTimer::get("XIOS").suspend(); } @@ -146,8 +143,6 @@ extern "C" CTimer::get("XIOS").resume(); CTimer::get("XIOS finalize").resume(); CXios::clientFinalize(); - // Delete CContext - CObjectTemplate::cleanStaticDataStructure(); } CATCH_DUMP_STACK @@ -422,7 +417,7 @@ extern "C" CTimer::get("XIOS send field").resume(); CContext* context = CContext::getCurrent(); if (!context->hasServer && !context->client->isAttachedModeEnabled()) - context->eventLoop(); + context->checkBuffersAndListen(); CArray data(data_k8, shape(data_Xsize), neverDeleteData); field->setData(data); CTimer::get("XIOS send field").suspend(); @@ -442,7 +437,7 @@ extern "C" - void cxios_write_data_k81_hdl(CField* field, double* data_k8, int data_Xsize) + void cxios_write_data_k81_hdl(CField* field, double* data_k8, int data_Xsize, int tileid) TRY { CTimer::get("XIOS").resume(); @@ -450,29 +445,29 @@ extern "C" CContext* context = CContext::getCurrent(); if (!context->hasServer && !context->client->isAttachedModeEnabled()) - context->eventLoop(); + context->checkBuffersAndListen(); CArray data(data_k8, shape(data_Xsize), neverDeleteData); - field->setData(data); + field->setData(data, tileid); CTimer::get("XIOS send field").suspend(); CTimer::get("XIOS").suspend(); } CATCH_DUMP_STACK - void cxios_write_data_k81(const char* fieldid, int fieldid_size, double* data_k8, int data_Xsize) + void cxios_write_data_k81(const char* fieldid, int fieldid_size, double* data_k8, int data_Xsize, int tileid) TRY { std::string fieldid_str; if (!cstr2string(fieldid, fieldid_size, fieldid_str)) return; - cxios_write_data_k81_hdl(CField::get(fieldid_str), data_k8, data_Xsize) ; + cxios_write_data_k81_hdl(CField::get(fieldid_str), data_k8, data_Xsize, tileid) ; } CATCH_DUMP_STACK - void cxios_write_data_k82_hdl(CField* field, double* data_k8, int data_Xsize, int data_Ysize) + void cxios_write_data_k82_hdl(CField* field, double* data_k8, int data_Xsize, int data_Ysize, int tileid) TRY { CTimer::get("XIOS").resume(); @@ -480,22 +475,22 @@ extern "C" CContext* context = CContext::getCurrent(); if (!context->hasServer && !context->client->isAttachedModeEnabled()) - context->eventLoop(); + context->checkBuffersAndListen(); CArraydata(data_k8, shape(data_Xsize, data_Ysize), neverDeleteData); - field->setData(data); + field->setData(data, tileid); CTimer::get("XIOS send field").suspend(); CTimer::get("XIOS").suspend(); } CATCH_DUMP_STACK - void cxios_write_data_k82(const char* fieldid, int fieldid_size, double* data_k8, int data_Xsize, int data_Ysize) + void cxios_write_data_k82(const char* fieldid, int fieldid_size, double* data_k8, int data_Xsize, int data_Ysize, int tileid) TRY { std::string fieldid_str; if (!cstr2string(fieldid, fieldid_size, fieldid_str)) return; - cxios_write_data_k82_hdl(CField::get(fieldid_str), data_k8, data_Xsize, data_Ysize) ; + cxios_write_data_k82_hdl(CField::get(fieldid_str), data_k8, data_Xsize, data_Ysize, tileid) ; } CATCH_DUMP_STACK @@ -504,7 +499,7 @@ extern "C" - void cxios_write_data_k83_hdl(CField* field, double* data_k8, int data_Xsize, int data_Ysize, int data_Zsize) + void cxios_write_data_k83_hdl(CField* field, double* data_k8, int data_Xsize, int data_Ysize, int data_Zsize, int tileid) TRY { CTimer::get("XIOS").resume(); @@ -512,22 +507,22 @@ extern "C" CContext* context = CContext::getCurrent(); if (!context->hasServer && !context->client->isAttachedModeEnabled()) - context->eventLoop(); + context->checkBuffersAndListen(); CArraydata(data_k8, shape(data_Xsize, data_Ysize, data_Zsize), neverDeleteData); - field->setData(data); + field->setData(data, tileid); CTimer::get("XIOS send field").suspend(); CTimer::get("XIOS").suspend(); } CATCH_DUMP_STACK - void cxios_write_data_k83(const char* fieldid, int fieldid_size, double* data_k8, int data_Xsize, int data_Ysize, int data_Zsize) + void cxios_write_data_k83(const char* fieldid, int fieldid_size, double* data_k8, int data_Xsize, int data_Ysize, int data_Zsize, int tileid) TRY { std::string fieldid_str; if (!cstr2string(fieldid, fieldid_size, fieldid_str)) return; - cxios_write_data_k83_hdl(CField::get(fieldid_str), data_k8, data_Xsize, data_Ysize, data_Zsize) ; + cxios_write_data_k83_hdl(CField::get(fieldid_str), data_k8, data_Xsize, data_Ysize, data_Zsize, tileid) ; } @@ -538,7 +533,7 @@ extern "C" - void cxios_write_data_k84_hdl(CField* field, double* data_k8, int data_0size, int data_1size, int data_2size, int data_3size) + void cxios_write_data_k84_hdl(CField* field, double* data_k8, int data_0size, int data_1size, int data_2size, int data_3size, int tileid) TRY { CTimer::get("XIOS").resume(); @@ -546,17 +541,19 @@ extern "C" CContext* context = CContext::getCurrent(); if (!context->hasServer && !context->client->isAttachedModeEnabled()) - context->eventLoop(); + context->checkBuffersAndListen(); CArraydata(data_k8, shape(data_0size, data_1size, data_2size, data_3size), neverDeleteData); - field->setData(data); + field->setData(data, tileid); CTimer::get("XIOS send field").suspend(); CTimer::get("XIOS").suspend(); } CATCH_DUMP_STACK - void cxios_write_data_k84(const char* fieldid, int fieldid_size, double* data_k8, int data_0size, int data_1size, int data_2size, int data_3size) + void cxios_write_data_k84(const char* fieldid, int fieldid_size, double* data_k8, + int data_0size, int data_1size, int data_2size, + int data_3size, int tileid) TRY { std::string fieldid_str; @@ -564,7 +561,7 @@ extern "C" CTimer::get("XIOS").resume(); CTimer::get("XIOS send field").resume(); - cxios_write_data_k84_hdl(CField::get(fieldid_str), data_k8, data_0size, data_1size, data_2size, data_3size) ; + cxios_write_data_k84_hdl(CField::get(fieldid_str), data_k8, data_0size, data_1size, data_2size, data_3size, tileid) ; } CATCH_DUMP_STACK @@ -574,7 +571,7 @@ extern "C" void cxios_write_data_k85_hdl(CField* field, double* data_k8, int data_0size, int data_1size, int data_2size, - int data_3size, int data_4size) + int data_3size, int data_4size, int tileid) TRY { CTimer::get("XIOS").resume(); @@ -582,10 +579,10 @@ extern "C" CContext* context = CContext::getCurrent(); if (!context->hasServer && !context->client->isAttachedModeEnabled()) - context->eventLoop(); + context->checkBuffersAndListen(); CArraydata(data_k8, shape(data_0size, data_1size, data_2size, data_3size, data_4size), neverDeleteData); - field->setData(data); + field->setData(data, tileid); CTimer::get("XIOS send field").suspend(); CTimer::get("XIOS").suspend(); @@ -594,12 +591,12 @@ extern "C" void cxios_write_data_k85(const char* fieldid, int fieldid_size, double* data_k8, int data_0size, int data_1size, int data_2size, - int data_3size, int data_4size) + int data_3size, int data_4size, int tileid) TRY { std::string fieldid_str; if (!cstr2string(fieldid, fieldid_size, fieldid_str)) return; - cxios_write_data_k85_hdl(CField::get(fieldid_str), data_k8, data_0size, data_1size, data_2size, data_3size, data_4size) ; + cxios_write_data_k85_hdl(CField::get(fieldid_str), data_k8, data_0size, data_1size, data_2size, data_3size, data_4size, tileid) ; } CATCH_DUMP_STACK @@ -608,7 +605,7 @@ extern "C" void cxios_write_data_k86_hdl(CField* field, double* data_k8, int data_0size, int data_1size, int data_2size, - int data_3size, int data_4size, int data_5size) + int data_3size, int data_4size, int data_5size, int tileid) TRY { @@ -617,10 +614,10 @@ extern "C" CContext* context = CContext::getCurrent(); if (!context->hasServer && !context->client->isAttachedModeEnabled()) - context->eventLoop(); + context->checkBuffersAndListen(); CArraydata(data_k8, shape(data_0size, data_1size, data_2size, data_3size, data_4size, data_5size), neverDeleteData); - field->setData(data); + field->setData(data, tileid); CTimer::get("XIOS send field").suspend(); CTimer::get("XIOS").suspend(); @@ -629,12 +626,12 @@ extern "C" void cxios_write_data_k86(const char* fieldid, int fieldid_size, double* data_k8, int data_0size, int data_1size, int data_2size, - int data_3size, int data_4size, int data_5size) + int data_3size, int data_4size, int data_5size, int tileid) TRY { std::string fieldid_str; if (!cstr2string(fieldid, fieldid_size, fieldid_str)) return; - cxios_write_data_k86_hdl(CField::get(fieldid_str), data_k8, data_0size, data_1size, data_2size, data_3size, data_4size, data_5size) ; + cxios_write_data_k86_hdl(CField::get(fieldid_str), data_k8, data_0size, data_1size, data_2size, data_3size, data_4size, data_5size, tileid) ; } CATCH_DUMP_STACK @@ -645,7 +642,7 @@ extern "C" void cxios_write_data_k87_hdl(CField* field, double* data_k8, int data_0size, int data_1size, int data_2size, int data_3size, int data_4size, int data_5size, - int data_6size) + int data_6size, int tileid) TRY { CTimer::get("XIOS").resume(); @@ -653,10 +650,10 @@ extern "C" CContext* context = CContext::getCurrent(); if (!context->hasServer && !context->client->isAttachedModeEnabled()) - context->eventLoop(); + context->checkBuffersAndListen(); CArraydata(data_k8, shape(data_0size, data_1size, data_2size, data_3size, data_4size, data_5size, data_6size), neverDeleteData); - field->setData(data); + field->setData(data, tileid); CTimer::get("XIOS send field").suspend(); CTimer::get("XIOS").suspend(); @@ -666,12 +663,13 @@ extern "C" void cxios_write_data_k87(const char* fieldid, int fieldid_size, double* data_k8, int data_0size, int data_1size, int data_2size, int data_3size, int data_4size, int data_5size, - int data_6size) + int data_6size, int tileid) TRY { std::string fieldid_str; if (!cstr2string(fieldid, fieldid_size, fieldid_str)) return; - cxios_write_data_k87_hdl(CField::get(fieldid_str), data_k8, data_0size, data_1size, data_2size, data_3size, data_4size, data_5size, data_6size) ; + cxios_write_data_k87_hdl(CField::get(fieldid_str), data_k8, data_0size, data_1size, data_2size, data_3size, data_4size, + data_5size, data_6size, tileid) ; } CATCH_DUMP_STACK @@ -686,7 +684,7 @@ extern "C" CTimer::get("XIOS send field").resume(); CContext* context = CContext::getCurrent(); if (!context->hasServer && !context->client->isAttachedModeEnabled()) - context->eventLoop(); + context->checkBuffersAndListen(); CArray data_tmp(data_k4, shape(data_Xsize), neverDeleteData); CArray data(data_Xsize) ; @@ -708,7 +706,7 @@ extern "C" CATCH_DUMP_STACK - void cxios_write_data_k41_hdl(CField* field, float* data_k4, int data_Xsize) + void cxios_write_data_k41_hdl(CField* field, float* data_k4, int data_Xsize, int tileid) TRY { CTimer::get("XIOS").resume(); @@ -716,29 +714,29 @@ extern "C" CContext* context = CContext::getCurrent(); if (!context->hasServer && !context->client->isAttachedModeEnabled()) - context->eventLoop(); + context->checkBuffersAndListen(); CArray data_tmp(data_k4, shape(data_Xsize), neverDeleteData); CArray data(data_Xsize); data = data_tmp; - field->setData(data); + field->setData(data, tileid); CTimer::get("XIOS send field").suspend(); CTimer::get("XIOS").suspend(); } CATCH_DUMP_STACK - void cxios_write_data_k41(const char* fieldid, int fieldid_size, float* data_k4, int data_Xsize) + void cxios_write_data_k41(const char* fieldid, int fieldid_size, float* data_k4, int data_Xsize, int tileid) TRY { std::string fieldid_str; if (!cstr2string(fieldid, fieldid_size, fieldid_str)) return; - cxios_write_data_k41_hdl(CField::get(fieldid_str), data_k4, data_Xsize); + cxios_write_data_k41_hdl(CField::get(fieldid_str), data_k4, data_Xsize, tileid); } CATCH_DUMP_STACK - void cxios_write_data_k42_hdl(CField* field, float* data_k4, int data_Xsize, int data_Ysize) + void cxios_write_data_k42_hdl(CField* field, float* data_k4, int data_Xsize, int data_Ysize, int tileid) TRY { CTimer::get("XIOS").resume(); @@ -746,31 +744,31 @@ extern "C" CContext* context = CContext::getCurrent(); if (!context->hasServer && !context->client->isAttachedModeEnabled()) - context->eventLoop(); + context->checkBuffersAndListen(); CArray data_tmp(data_k4, shape(data_Xsize, data_Ysize), neverDeleteData); CArray data(data_Xsize, data_Ysize); data = data_tmp; - field->setData(data); + field->setData(data, tileid); CTimer::get("XIOS send field").suspend(); CTimer::get("XIOS").suspend(); } CATCH_DUMP_STACK - void cxios_write_data_k42(const char* fieldid, int fieldid_size, float* data_k4, int data_Xsize, int data_Ysize) + void cxios_write_data_k42(const char* fieldid, int fieldid_size, float* data_k4, int data_Xsize, int data_Ysize, int tileid) TRY { std::string fieldid_str; if (!cstr2string(fieldid, fieldid_size, fieldid_str)) return; - cxios_write_data_k42_hdl(CField::get(fieldid_str), data_k4, data_Xsize,data_Ysize); + cxios_write_data_k42_hdl(CField::get(fieldid_str), data_k4, data_Xsize,data_Ysize, tileid); } CATCH_DUMP_STACK - void cxios_write_data_k43_hdl(CField* field, float* data_k4, int data_Xsize, int data_Ysize, int data_Zsize) + void cxios_write_data_k43_hdl(CField* field, float* data_k4, int data_Xsize, int data_Ysize, int data_Zsize, int tileid) TRY { CTimer::get("XIOS").resume(); @@ -778,24 +776,24 @@ extern "C" CContext* context = CContext::getCurrent(); if (!context->hasServer && !context->client->isAttachedModeEnabled()) - context->eventLoop(); + context->checkBuffersAndListen(); CArray data_tmp(data_k4, shape(data_Xsize, data_Ysize, data_Zsize), neverDeleteData); CArray data(data_Xsize, data_Ysize, data_Zsize); data = data_tmp; - field->setData(data); + field->setData(data, tileid); CTimer::get("XIOS send field").suspend(); CTimer::get("XIOS").suspend(); } CATCH_DUMP_STACK - void cxios_write_data_k43(const char* fieldid, int fieldid_size, float* data_k4, int data_Xsize, int data_Ysize, int data_Zsize) + void cxios_write_data_k43(const char* fieldid, int fieldid_size, float* data_k4, int data_Xsize, int data_Ysize, int data_Zsize, int tileid) TRY { std::string fieldid_str; if (!cstr2string(fieldid, fieldid_size, fieldid_str)) return; - cxios_write_data_k43_hdl(CField::get(fieldid_str), data_k4, data_Xsize,data_Ysize, data_Zsize); + cxios_write_data_k43_hdl(CField::get(fieldid_str), data_k4, data_Xsize,data_Ysize, data_Zsize, tileid); } CATCH_DUMP_STACK @@ -803,7 +801,7 @@ extern "C" void cxios_write_data_k44_hdl(CField* field, float* data_k4, int data_0size, int data_1size, int data_2size, - int data_3size) + int data_3size, int tileid) TRY { CTimer::get("XIOS").resume(); @@ -811,12 +809,12 @@ extern "C" CContext* context = CContext::getCurrent(); if (!context->hasServer && !context->client->isAttachedModeEnabled()) - context->eventLoop(); + context->checkBuffersAndListen(); CArray data_tmp(data_k4, shape(data_0size, data_1size, data_2size, data_3size), neverDeleteData); CArray data(data_0size, data_1size, data_2size, data_3size); data = data_tmp; - field->setData(data); + field->setData(data, tileid); CTimer::get("XIOS send field").suspend(); CTimer::get("XIOS").suspend(); @@ -825,12 +823,12 @@ extern "C" void cxios_write_data_k44(const char* fieldid, int fieldid_size, float* data_k4, int data_0size, int data_1size, int data_2size, - int data_3size) + int data_3size, int tileid) TRY { std::string fieldid_str; if (!cstr2string(fieldid, fieldid_size, fieldid_str)) return; - cxios_write_data_k44_hdl(CField::get(fieldid_str), data_k4, data_0size, data_1size, data_2size, data_3size) ; + cxios_write_data_k44_hdl(CField::get(fieldid_str), data_k4, data_0size, data_1size, data_2size, data_3size, tileid) ; } CATCH_DUMP_STACK @@ -839,7 +837,7 @@ extern "C" void cxios_write_data_k45_hdl(CField* field, float* data_k4, int data_0size, int data_1size, int data_2size, - int data_3size, int data_4size) + int data_3size, int data_4size, int tileid) TRY { CTimer::get("XIOS").resume(); @@ -847,12 +845,12 @@ extern "C" CContext* context = CContext::getCurrent(); if (!context->hasServer && !context->client->isAttachedModeEnabled()) - context->eventLoop(); + context->checkBuffersAndListen(); CArray data_tmp(data_k4, shape(data_0size, data_1size, data_2size, data_3size, data_4size), neverDeleteData); CArray data(data_0size, data_1size, data_2size, data_3size, data_4size); data = data_tmp; - field->setData(data); + field->setData(data, tileid); CTimer::get("XIOS send field").suspend(); CTimer::get("XIOS").suspend(); @@ -861,12 +859,12 @@ extern "C" void cxios_write_data_k45(const char* fieldid, int fieldid_size, float* data_k4, int data_0size, int data_1size, int data_2size, - int data_3size, int data_4size) + int data_3size, int data_4size, int tileid) TRY { std::string fieldid_str; if (!cstr2string(fieldid, fieldid_size, fieldid_str)) return; - cxios_write_data_k45_hdl(CField::get(fieldid_str), data_k4, data_0size, data_1size, data_2size, data_3size, data_4size) ; + cxios_write_data_k45_hdl(CField::get(fieldid_str), data_k4, data_0size, data_1size, data_2size, data_3size, data_4size, tileid) ; } CATCH_DUMP_STACK @@ -874,7 +872,7 @@ extern "C" void cxios_write_data_k46_hdl(CField* field, float* data_k4, int data_0size, int data_1size, int data_2size, - int data_3size, int data_4size, int data_5size) + int data_3size, int data_4size, int data_5size, int tileid) TRY { CTimer::get("XIOS").resume(); @@ -882,12 +880,12 @@ extern "C" CContext* context = CContext::getCurrent(); if (!context->hasServer && !context->client->isAttachedModeEnabled()) - context->eventLoop(); + context->checkBuffersAndListen(); CArray data_tmp(data_k4, shape(data_0size, data_1size, data_2size, data_3size, data_4size, data_5size), neverDeleteData); CArray data(data_0size, data_1size, data_2size, data_3size, data_4size, data_5size); data = data_tmp; - field->setData(data); + field->setData(data, tileid); CTimer::get("XIOS send field").suspend(); CTimer::get("XIOS").suspend(); @@ -896,12 +894,12 @@ extern "C" void cxios_write_data_k46(const char* fieldid, int fieldid_size, float* data_k4, int data_0size, int data_1size, int data_2size, - int data_3size, int data_4size, int data_5size) + int data_3size, int data_4size, int data_5size, int tileid) TRY { std::string fieldid_str; if (!cstr2string(fieldid, fieldid_size, fieldid_str)) return; - cxios_write_data_k46_hdl(CField::get(fieldid_str), data_k4, data_0size, data_1size, data_2size, data_3size, data_4size, data_5size) ; + cxios_write_data_k46_hdl(CField::get(fieldid_str), data_k4, data_0size, data_1size, data_2size, data_3size, data_4size, data_5size, tileid) ; } CATCH_DUMP_STACK @@ -909,7 +907,7 @@ extern "C" void cxios_write_data_k47_hdl(CField* field, float* data_k4, int data_0size, int data_1size, int data_2size, int data_3size, int data_4size, int data_5size, - int data_6size) + int data_6size, int tileid) TRY { CTimer::get("XIOS").resume(); @@ -917,12 +915,12 @@ extern "C" CContext* context = CContext::getCurrent(); if (!context->hasServer && !context->client->isAttachedModeEnabled()) - context->eventLoop(); + context->checkBuffersAndListen(); CArray data_tmp(data_k4, shape(data_0size, data_1size, data_2size, data_3size, data_4size, data_5size, data_6size), neverDeleteData); CArray data(data_0size, data_1size, data_2size, data_3size, data_4size, data_5size, data_6size); data = data_tmp; - field->setData(data); + field->setData(data, tileid); CTimer::get("XIOS send field").suspend(); CTimer::get("XIOS").suspend(); @@ -932,12 +930,13 @@ extern "C" void cxios_write_data_k47(const char* fieldid, int fieldid_size, float* data_k4, int data_0size, int data_1size, int data_2size, int data_3size, int data_4size, int data_5size, - int data_6size) + int data_6size, int tileid) TRY { std::string fieldid_str; if (!cstr2string(fieldid, fieldid_size, fieldid_str)) return; - cxios_write_data_k47_hdl(CField::get(fieldid_str), data_k4, data_0size, data_1size, data_2size, data_3size, data_4size, data_5size, data_6size) ; + cxios_write_data_k47_hdl(CField::get(fieldid_str), data_k4, data_0size, data_1size, data_2size, data_3size, data_4size, + data_5size, data_6size, tileid) ; } CATCH_DUMP_STACK @@ -952,7 +951,7 @@ extern "C" CContext* context = CContext::getCurrent(); if (!context->hasServer && !context->client->isAttachedModeEnabled()) - context->eventLoop(); + context->checkBuffersAndListen(); CArray data(data_k8, shape(data_Xsize), neverDeleteData); field->getData(data); @@ -980,7 +979,7 @@ extern "C" CContext* context = CContext::getCurrent(); if (!context->hasServer && !context->client->isAttachedModeEnabled()) - context->eventLoop(); + context->checkBuffersAndListen(); CArray data(data_k8, shape(data_Xsize), neverDeleteData); field->getData(data); @@ -1007,7 +1006,7 @@ extern "C" CContext* context = CContext::getCurrent(); if (!context->hasServer && !context->client->isAttachedModeEnabled()) - context->eventLoop(); + context->checkBuffersAndListen(); CArraydata(data_k8, shape(data_Xsize, data_Ysize), neverDeleteData); field->getData(data); @@ -1035,7 +1034,7 @@ extern "C" CContext* context = CContext::getCurrent(); if (!context->hasServer && !context->client->isAttachedModeEnabled()) - context->eventLoop(); + context->checkBuffersAndListen(); CArraydata(data_k8, shape(data_Xsize, data_Ysize, data_Zsize), neverDeleteData); field->getData(data); @@ -1065,7 +1064,7 @@ extern "C" CContext* context = CContext::getCurrent(); if (!context->hasServer && !context->client->isAttachedModeEnabled()) - context->eventLoop(); + context->checkBuffersAndListen(); CArraydata(data_k8, shape(data_0size, data_1size, data_2size, data_3size), neverDeleteData); field->getData(data); @@ -1096,7 +1095,7 @@ extern "C" CContext* context = CContext::getCurrent(); if (!context->hasServer && !context->client->isAttachedModeEnabled()) - context->eventLoop(); + context->checkBuffersAndListen(); CArraydata(data_k8, shape(data_0size, data_1size, data_2size, data_3size, data_4size), neverDeleteData); field->getData(data); @@ -1127,7 +1126,7 @@ extern "C" CContext* context = CContext::getCurrent(); if (!context->hasServer && !context->client->isAttachedModeEnabled()) - context->eventLoop(); + context->checkBuffersAndListen(); CArraydata(data_k8, shape(data_0size, data_1size, data_2size, data_3size, data_4size, data_5size), neverDeleteData); field->getData(data); @@ -1159,7 +1158,7 @@ extern "C" CContext* context = CContext::getCurrent(); if (!context->hasServer && !context->client->isAttachedModeEnabled()) - context->eventLoop(); + context->checkBuffersAndListen(); CArraydata(data_k8, shape(data_0size, data_1size, data_2size, data_3size, data_4size, data_5size, data_6size), neverDeleteData); field->getData(data); @@ -1194,7 +1193,7 @@ extern "C" CContext* context = CContext::getCurrent(); if (!context->hasServer && !context->client->isAttachedModeEnabled()) - context->eventLoop(); + context->checkBuffersAndListen(); CArray data(data_Xsize); field->getData(data); @@ -1225,7 +1224,7 @@ extern "C" CContext* context = CContext::getCurrent(); if (!context->hasServer && !context->client->isAttachedModeEnabled()) - context->eventLoop(); + context->checkBuffersAndListen(); CArray data(data_Xsize); field->getData(data); @@ -1257,7 +1256,7 @@ extern "C" CContext* context = CContext::getCurrent(); if (!context->hasServer && !context->client->isAttachedModeEnabled()) - context->eventLoop(); + context->checkBuffersAndListen(); CArray data(data_Xsize, data_Ysize); field->getData(data); @@ -1288,7 +1287,7 @@ extern "C" CContext* context = CContext::getCurrent(); if (!context->hasServer && !context->client->isAttachedModeEnabled()) - context->eventLoop(); + context->checkBuffersAndListen(); CArray data(data_Xsize, data_Ysize, data_Zsize); field->getData(data); @@ -1320,7 +1319,7 @@ extern "C" CContext* context = CContext::getCurrent(); if (!context->hasServer && !context->client->isAttachedModeEnabled()) - context->eventLoop(); + context->checkBuffersAndListen(); CArray data(data_0size, data_1size, data_2size, data_3size); field->getData(data); @@ -1355,7 +1354,7 @@ extern "C" CContext* context = CContext::getCurrent(); if (!context->hasServer && !context->client->isAttachedModeEnabled()) - context->eventLoop(); + context->checkBuffersAndListen(); CArray data(data_0size, data_1size, data_2size, data_3size, data_4size); field->getData(data); @@ -1389,7 +1388,7 @@ extern "C" CContext* context = CContext::getCurrent(); if (!context->hasServer && !context->client->isAttachedModeEnabled()) - context->eventLoop(); + context->checkBuffersAndListen(); CArray data(data_0size, data_1size, data_2size, data_3size, data_4size, data_5size); field->getData(data); @@ -1425,7 +1424,7 @@ extern "C" CContext* context = CContext::getCurrent(); if (!context->hasServer && !context->client->isAttachedModeEnabled()) - context->eventLoop(); + context->checkBuffersAndListen(); CArray data(data_0size, data_1size, data_2size, data_3size, data_4size, data_5size, data_6size); field->getData(data); @@ -1448,4 +1447,5 @@ extern "C" cxios_read_data_k47_hdl(CField::get(fieldid_str), data_k4, data_0size, data_1size, data_2size, data_3size, data_4size, data_5size, data_6size) ; } CATCH_DUMP_STACK + } // extern "C" diff --git a/xios_2311_src/src/interface/c/icfield.cpp b/xios_2311_src/src/interface/c/icfield.cpp index ea8873710a684f39ce53fb16a249091e00c48128..df07fe99ab4645c8b0b84ad4c6377067a567ab84 100644 --- a/xios_2311_src/src/interface/c/icfield.cpp +++ b/xios_2311_src/src/interface/c/icfield.cpp @@ -99,7 +99,7 @@ extern "C" TRY { CTimer::get("XIOS").resume() ; - *domain_hdl_ret = field_hdl->getGrid()->getDomain(domainIndex); + *domain_hdl_ret = field_hdl->grid->getDomain(domainIndex); CTimer::get("XIOS").suspend(); } CATCH_DUMP_STACK @@ -108,7 +108,7 @@ extern "C" TRY { CTimer::get("XIOS").resume() ; - *axis_hdl_ret = field_hdl->getGrid()->getAxis(axisIndex); + *axis_hdl_ret = field_hdl->grid->getAxis(axisIndex); CTimer::get("XIOS").suspend(); } CATCH_DUMP_STACK @@ -117,7 +117,7 @@ extern "C" TRY { CTimer::get("XIOS").resume() ; - *scalar_hdl_ret = field_hdl->getGrid()->getScalar(scalarIndex); + *scalar_hdl_ret = field_hdl->grid->getScalar(scalarIndex); CTimer::get("XIOS").suspend(); } CATCH_DUMP_STACK diff --git a/xios_2311_src/src/interface/c_attr/iccontext_attr.cpp b/xios_2311_src/src/interface/c_attr/iccontext_attr.cpp index d67856ee4433a48d4b831c86d6dc409c64a580e2..4d23941119f83d1339620c4dde890378b4b512d8 100644 --- a/xios_2311_src/src/interface/c_attr/iccontext_attr.cpp +++ b/xios_2311_src/src/interface/c_attr/iccontext_attr.cpp @@ -16,29 +16,6 @@ extern "C" { typedef xios::CContext* context_Ptr; - void cxios_set_context_attached_mode(context_Ptr context_hdl, bool attached_mode) - { - CTimer::get("XIOS").resume(); - context_hdl->attached_mode.setValue(attached_mode); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_context_attached_mode(context_Ptr context_hdl, bool* attached_mode) - { - CTimer::get("XIOS").resume(); - *attached_mode = context_hdl->attached_mode.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_context_attached_mode(context_Ptr context_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = context_hdl->attached_mode.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - void cxios_set_context_output_dir(context_Ptr context_hdl, const char * output_dir, int output_dir_size) { std::string output_dir_str; diff --git a/xios_2311_src/src/interface/c_attr/icdomain_attr.cpp b/xios_2311_src/src/interface/c_attr/icdomain_attr.cpp index 71eb05222b34a6f7dcf989af3bb86b19c798ee6c..d4c4fe04933ae5a65e65df231417b58a13c83c34 100644 --- a/xios_2311_src/src/interface/c_attr/icdomain_attr.cpp +++ b/xios_2311_src/src/interface/c_attr/icdomain_attr.cpp @@ -904,6 +904,29 @@ extern "C" } + void cxios_set_domain_ntiles(domain_Ptr domain_hdl, int ntiles) + { + CTimer::get("XIOS").resume(); + domain_hdl->ntiles.setValue(ntiles); + CTimer::get("XIOS").suspend(); + } + + void cxios_get_domain_ntiles(domain_Ptr domain_hdl, int* ntiles) + { + CTimer::get("XIOS").resume(); + *ntiles = domain_hdl->ntiles.getInheritedValue(); + CTimer::get("XIOS").suspend(); + } + + bool cxios_is_defined_domain_ntiles(domain_Ptr domain_hdl) + { + CTimer::get("XIOS").resume(); + bool isDefined = domain_hdl->ntiles.hasInheritedValue(); + CTimer::get("XIOS").suspend(); + return isDefined; + } + + void cxios_set_domain_nvertex(domain_Ptr domain_hdl, int nvertex) { CTimer::get("XIOS").resume(); @@ -999,6 +1022,206 @@ extern "C" } + void cxios_set_domain_tile_data_ibegin(domain_Ptr domain_hdl, int* tile_data_ibegin, int* extent) + { + CTimer::get("XIOS").resume(); + CArray tmp(tile_data_ibegin, shape(extent[0]), neverDeleteData); + domain_hdl->tile_data_ibegin.reference(tmp.copy()); + CTimer::get("XIOS").suspend(); + } + + void cxios_get_domain_tile_data_ibegin(domain_Ptr domain_hdl, int* tile_data_ibegin, int* extent) + { + CTimer::get("XIOS").resume(); + CArray tmp(tile_data_ibegin, shape(extent[0]), neverDeleteData); + tmp=domain_hdl->tile_data_ibegin.getInheritedValue(); + CTimer::get("XIOS").suspend(); + } + + bool cxios_is_defined_domain_tile_data_ibegin(domain_Ptr domain_hdl) + { + CTimer::get("XIOS").resume(); + bool isDefined = domain_hdl->tile_data_ibegin.hasInheritedValue(); + CTimer::get("XIOS").suspend(); + return isDefined; + } + + + void cxios_set_domain_tile_data_jbegin(domain_Ptr domain_hdl, int* tile_data_jbegin, int* extent) + { + CTimer::get("XIOS").resume(); + CArray tmp(tile_data_jbegin, shape(extent[0]), neverDeleteData); + domain_hdl->tile_data_jbegin.reference(tmp.copy()); + CTimer::get("XIOS").suspend(); + } + + void cxios_get_domain_tile_data_jbegin(domain_Ptr domain_hdl, int* tile_data_jbegin, int* extent) + { + CTimer::get("XIOS").resume(); + CArray tmp(tile_data_jbegin, shape(extent[0]), neverDeleteData); + tmp=domain_hdl->tile_data_jbegin.getInheritedValue(); + CTimer::get("XIOS").suspend(); + } + + bool cxios_is_defined_domain_tile_data_jbegin(domain_Ptr domain_hdl) + { + CTimer::get("XIOS").resume(); + bool isDefined = domain_hdl->tile_data_jbegin.hasInheritedValue(); + CTimer::get("XIOS").suspend(); + return isDefined; + } + + + void cxios_set_domain_tile_data_ni(domain_Ptr domain_hdl, int* tile_data_ni, int* extent) + { + CTimer::get("XIOS").resume(); + CArray tmp(tile_data_ni, shape(extent[0]), neverDeleteData); + domain_hdl->tile_data_ni.reference(tmp.copy()); + CTimer::get("XIOS").suspend(); + } + + void cxios_get_domain_tile_data_ni(domain_Ptr domain_hdl, int* tile_data_ni, int* extent) + { + CTimer::get("XIOS").resume(); + CArray tmp(tile_data_ni, shape(extent[0]), neverDeleteData); + tmp=domain_hdl->tile_data_ni.getInheritedValue(); + CTimer::get("XIOS").suspend(); + } + + bool cxios_is_defined_domain_tile_data_ni(domain_Ptr domain_hdl) + { + CTimer::get("XIOS").resume(); + bool isDefined = domain_hdl->tile_data_ni.hasInheritedValue(); + CTimer::get("XIOS").suspend(); + return isDefined; + } + + + void cxios_set_domain_tile_data_nj(domain_Ptr domain_hdl, int* tile_data_nj, int* extent) + { + CTimer::get("XIOS").resume(); + CArray tmp(tile_data_nj, shape(extent[0]), neverDeleteData); + domain_hdl->tile_data_nj.reference(tmp.copy()); + CTimer::get("XIOS").suspend(); + } + + void cxios_get_domain_tile_data_nj(domain_Ptr domain_hdl, int* tile_data_nj, int* extent) + { + CTimer::get("XIOS").resume(); + CArray tmp(tile_data_nj, shape(extent[0]), neverDeleteData); + tmp=domain_hdl->tile_data_nj.getInheritedValue(); + CTimer::get("XIOS").suspend(); + } + + bool cxios_is_defined_domain_tile_data_nj(domain_Ptr domain_hdl) + { + CTimer::get("XIOS").resume(); + bool isDefined = domain_hdl->tile_data_nj.hasInheritedValue(); + CTimer::get("XIOS").suspend(); + return isDefined; + } + + + void cxios_set_domain_tile_ibegin(domain_Ptr domain_hdl, int* tile_ibegin, int* extent) + { + CTimer::get("XIOS").resume(); + CArray tmp(tile_ibegin, shape(extent[0]), neverDeleteData); + domain_hdl->tile_ibegin.reference(tmp.copy()); + CTimer::get("XIOS").suspend(); + } + + void cxios_get_domain_tile_ibegin(domain_Ptr domain_hdl, int* tile_ibegin, int* extent) + { + CTimer::get("XIOS").resume(); + CArray tmp(tile_ibegin, shape(extent[0]), neverDeleteData); + tmp=domain_hdl->tile_ibegin.getInheritedValue(); + CTimer::get("XIOS").suspend(); + } + + bool cxios_is_defined_domain_tile_ibegin(domain_Ptr domain_hdl) + { + CTimer::get("XIOS").resume(); + bool isDefined = domain_hdl->tile_ibegin.hasInheritedValue(); + CTimer::get("XIOS").suspend(); + return isDefined; + } + + + void cxios_set_domain_tile_jbegin(domain_Ptr domain_hdl, int* tile_jbegin, int* extent) + { + CTimer::get("XIOS").resume(); + CArray tmp(tile_jbegin, shape(extent[0]), neverDeleteData); + domain_hdl->tile_jbegin.reference(tmp.copy()); + CTimer::get("XIOS").suspend(); + } + + void cxios_get_domain_tile_jbegin(domain_Ptr domain_hdl, int* tile_jbegin, int* extent) + { + CTimer::get("XIOS").resume(); + CArray tmp(tile_jbegin, shape(extent[0]), neverDeleteData); + tmp=domain_hdl->tile_jbegin.getInheritedValue(); + CTimer::get("XIOS").suspend(); + } + + bool cxios_is_defined_domain_tile_jbegin(domain_Ptr domain_hdl) + { + CTimer::get("XIOS").resume(); + bool isDefined = domain_hdl->tile_jbegin.hasInheritedValue(); + CTimer::get("XIOS").suspend(); + return isDefined; + } + + + void cxios_set_domain_tile_ni(domain_Ptr domain_hdl, int* tile_ni, int* extent) + { + CTimer::get("XIOS").resume(); + CArray tmp(tile_ni, shape(extent[0]), neverDeleteData); + domain_hdl->tile_ni.reference(tmp.copy()); + CTimer::get("XIOS").suspend(); + } + + void cxios_get_domain_tile_ni(domain_Ptr domain_hdl, int* tile_ni, int* extent) + { + CTimer::get("XIOS").resume(); + CArray tmp(tile_ni, shape(extent[0]), neverDeleteData); + tmp=domain_hdl->tile_ni.getInheritedValue(); + CTimer::get("XIOS").suspend(); + } + + bool cxios_is_defined_domain_tile_ni(domain_Ptr domain_hdl) + { + CTimer::get("XIOS").resume(); + bool isDefined = domain_hdl->tile_ni.hasInheritedValue(); + CTimer::get("XIOS").suspend(); + return isDefined; + } + + + void cxios_set_domain_tile_nj(domain_Ptr domain_hdl, int* tile_nj, int* extent) + { + CTimer::get("XIOS").resume(); + CArray tmp(tile_nj, shape(extent[0]), neverDeleteData); + domain_hdl->tile_nj.reference(tmp.copy()); + CTimer::get("XIOS").suspend(); + } + + void cxios_get_domain_tile_nj(domain_Ptr domain_hdl, int* tile_nj, int* extent) + { + CTimer::get("XIOS").resume(); + CArray tmp(tile_nj, shape(extent[0]), neverDeleteData); + tmp=domain_hdl->tile_nj.getInheritedValue(); + CTimer::get("XIOS").suspend(); + } + + bool cxios_is_defined_domain_tile_nj(domain_Ptr domain_hdl) + { + CTimer::get("XIOS").resume(); + bool isDefined = domain_hdl->tile_nj.hasInheritedValue(); + CTimer::get("XIOS").suspend(); + return isDefined; + } + + void cxios_set_domain_type(domain_Ptr domain_hdl, const char * type, int type_size) { std::string type_str; diff --git a/xios_2311_src/src/interface/c_attr/icdomaingroup_attr.cpp b/xios_2311_src/src/interface/c_attr/icdomaingroup_attr.cpp index 2eef2b8273112b03c633955e9f9cdd9d9d6cc975..acef130034d87430cf15e1f2abd637790730fc2c 100644 --- a/xios_2311_src/src/interface/c_attr/icdomaingroup_attr.cpp +++ b/xios_2311_src/src/interface/c_attr/icdomaingroup_attr.cpp @@ -930,6 +930,29 @@ extern "C" } + void cxios_set_domaingroup_ntiles(domaingroup_Ptr domaingroup_hdl, int ntiles) + { + CTimer::get("XIOS").resume(); + domaingroup_hdl->ntiles.setValue(ntiles); + CTimer::get("XIOS").suspend(); + } + + void cxios_get_domaingroup_ntiles(domaingroup_Ptr domaingroup_hdl, int* ntiles) + { + CTimer::get("XIOS").resume(); + *ntiles = domaingroup_hdl->ntiles.getInheritedValue(); + CTimer::get("XIOS").suspend(); + } + + bool cxios_is_defined_domaingroup_ntiles(domaingroup_Ptr domaingroup_hdl) + { + CTimer::get("XIOS").resume(); + bool isDefined = domaingroup_hdl->ntiles.hasInheritedValue(); + CTimer::get("XIOS").suspend(); + return isDefined; + } + + void cxios_set_domaingroup_nvertex(domaingroup_Ptr domaingroup_hdl, int nvertex) { CTimer::get("XIOS").resume(); @@ -1025,6 +1048,206 @@ extern "C" } + void cxios_set_domaingroup_tile_data_ibegin(domaingroup_Ptr domaingroup_hdl, int* tile_data_ibegin, int* extent) + { + CTimer::get("XIOS").resume(); + CArray tmp(tile_data_ibegin, shape(extent[0]), neverDeleteData); + domaingroup_hdl->tile_data_ibegin.reference(tmp.copy()); + CTimer::get("XIOS").suspend(); + } + + void cxios_get_domaingroup_tile_data_ibegin(domaingroup_Ptr domaingroup_hdl, int* tile_data_ibegin, int* extent) + { + CTimer::get("XIOS").resume(); + CArray tmp(tile_data_ibegin, shape(extent[0]), neverDeleteData); + tmp=domaingroup_hdl->tile_data_ibegin.getInheritedValue(); + CTimer::get("XIOS").suspend(); + } + + bool cxios_is_defined_domaingroup_tile_data_ibegin(domaingroup_Ptr domaingroup_hdl) + { + CTimer::get("XIOS").resume(); + bool isDefined = domaingroup_hdl->tile_data_ibegin.hasInheritedValue(); + CTimer::get("XIOS").suspend(); + return isDefined; + } + + + void cxios_set_domaingroup_tile_data_jbegin(domaingroup_Ptr domaingroup_hdl, int* tile_data_jbegin, int* extent) + { + CTimer::get("XIOS").resume(); + CArray tmp(tile_data_jbegin, shape(extent[0]), neverDeleteData); + domaingroup_hdl->tile_data_jbegin.reference(tmp.copy()); + CTimer::get("XIOS").suspend(); + } + + void cxios_get_domaingroup_tile_data_jbegin(domaingroup_Ptr domaingroup_hdl, int* tile_data_jbegin, int* extent) + { + CTimer::get("XIOS").resume(); + CArray tmp(tile_data_jbegin, shape(extent[0]), neverDeleteData); + tmp=domaingroup_hdl->tile_data_jbegin.getInheritedValue(); + CTimer::get("XIOS").suspend(); + } + + bool cxios_is_defined_domaingroup_tile_data_jbegin(domaingroup_Ptr domaingroup_hdl) + { + CTimer::get("XIOS").resume(); + bool isDefined = domaingroup_hdl->tile_data_jbegin.hasInheritedValue(); + CTimer::get("XIOS").suspend(); + return isDefined; + } + + + void cxios_set_domaingroup_tile_data_ni(domaingroup_Ptr domaingroup_hdl, int* tile_data_ni, int* extent) + { + CTimer::get("XIOS").resume(); + CArray tmp(tile_data_ni, shape(extent[0]), neverDeleteData); + domaingroup_hdl->tile_data_ni.reference(tmp.copy()); + CTimer::get("XIOS").suspend(); + } + + void cxios_get_domaingroup_tile_data_ni(domaingroup_Ptr domaingroup_hdl, int* tile_data_ni, int* extent) + { + CTimer::get("XIOS").resume(); + CArray tmp(tile_data_ni, shape(extent[0]), neverDeleteData); + tmp=domaingroup_hdl->tile_data_ni.getInheritedValue(); + CTimer::get("XIOS").suspend(); + } + + bool cxios_is_defined_domaingroup_tile_data_ni(domaingroup_Ptr domaingroup_hdl) + { + CTimer::get("XIOS").resume(); + bool isDefined = domaingroup_hdl->tile_data_ni.hasInheritedValue(); + CTimer::get("XIOS").suspend(); + return isDefined; + } + + + void cxios_set_domaingroup_tile_data_nj(domaingroup_Ptr domaingroup_hdl, int* tile_data_nj, int* extent) + { + CTimer::get("XIOS").resume(); + CArray tmp(tile_data_nj, shape(extent[0]), neverDeleteData); + domaingroup_hdl->tile_data_nj.reference(tmp.copy()); + CTimer::get("XIOS").suspend(); + } + + void cxios_get_domaingroup_tile_data_nj(domaingroup_Ptr domaingroup_hdl, int* tile_data_nj, int* extent) + { + CTimer::get("XIOS").resume(); + CArray tmp(tile_data_nj, shape(extent[0]), neverDeleteData); + tmp=domaingroup_hdl->tile_data_nj.getInheritedValue(); + CTimer::get("XIOS").suspend(); + } + + bool cxios_is_defined_domaingroup_tile_data_nj(domaingroup_Ptr domaingroup_hdl) + { + CTimer::get("XIOS").resume(); + bool isDefined = domaingroup_hdl->tile_data_nj.hasInheritedValue(); + CTimer::get("XIOS").suspend(); + return isDefined; + } + + + void cxios_set_domaingroup_tile_ibegin(domaingroup_Ptr domaingroup_hdl, int* tile_ibegin, int* extent) + { + CTimer::get("XIOS").resume(); + CArray tmp(tile_ibegin, shape(extent[0]), neverDeleteData); + domaingroup_hdl->tile_ibegin.reference(tmp.copy()); + CTimer::get("XIOS").suspend(); + } + + void cxios_get_domaingroup_tile_ibegin(domaingroup_Ptr domaingroup_hdl, int* tile_ibegin, int* extent) + { + CTimer::get("XIOS").resume(); + CArray tmp(tile_ibegin, shape(extent[0]), neverDeleteData); + tmp=domaingroup_hdl->tile_ibegin.getInheritedValue(); + CTimer::get("XIOS").suspend(); + } + + bool cxios_is_defined_domaingroup_tile_ibegin(domaingroup_Ptr domaingroup_hdl) + { + CTimer::get("XIOS").resume(); + bool isDefined = domaingroup_hdl->tile_ibegin.hasInheritedValue(); + CTimer::get("XIOS").suspend(); + return isDefined; + } + + + void cxios_set_domaingroup_tile_jbegin(domaingroup_Ptr domaingroup_hdl, int* tile_jbegin, int* extent) + { + CTimer::get("XIOS").resume(); + CArray tmp(tile_jbegin, shape(extent[0]), neverDeleteData); + domaingroup_hdl->tile_jbegin.reference(tmp.copy()); + CTimer::get("XIOS").suspend(); + } + + void cxios_get_domaingroup_tile_jbegin(domaingroup_Ptr domaingroup_hdl, int* tile_jbegin, int* extent) + { + CTimer::get("XIOS").resume(); + CArray tmp(tile_jbegin, shape(extent[0]), neverDeleteData); + tmp=domaingroup_hdl->tile_jbegin.getInheritedValue(); + CTimer::get("XIOS").suspend(); + } + + bool cxios_is_defined_domaingroup_tile_jbegin(domaingroup_Ptr domaingroup_hdl) + { + CTimer::get("XIOS").resume(); + bool isDefined = domaingroup_hdl->tile_jbegin.hasInheritedValue(); + CTimer::get("XIOS").suspend(); + return isDefined; + } + + + void cxios_set_domaingroup_tile_ni(domaingroup_Ptr domaingroup_hdl, int* tile_ni, int* extent) + { + CTimer::get("XIOS").resume(); + CArray tmp(tile_ni, shape(extent[0]), neverDeleteData); + domaingroup_hdl->tile_ni.reference(tmp.copy()); + CTimer::get("XIOS").suspend(); + } + + void cxios_get_domaingroup_tile_ni(domaingroup_Ptr domaingroup_hdl, int* tile_ni, int* extent) + { + CTimer::get("XIOS").resume(); + CArray tmp(tile_ni, shape(extent[0]), neverDeleteData); + tmp=domaingroup_hdl->tile_ni.getInheritedValue(); + CTimer::get("XIOS").suspend(); + } + + bool cxios_is_defined_domaingroup_tile_ni(domaingroup_Ptr domaingroup_hdl) + { + CTimer::get("XIOS").resume(); + bool isDefined = domaingroup_hdl->tile_ni.hasInheritedValue(); + CTimer::get("XIOS").suspend(); + return isDefined; + } + + + void cxios_set_domaingroup_tile_nj(domaingroup_Ptr domaingroup_hdl, int* tile_nj, int* extent) + { + CTimer::get("XIOS").resume(); + CArray tmp(tile_nj, shape(extent[0]), neverDeleteData); + domaingroup_hdl->tile_nj.reference(tmp.copy()); + CTimer::get("XIOS").suspend(); + } + + void cxios_get_domaingroup_tile_nj(domaingroup_Ptr domaingroup_hdl, int* tile_nj, int* extent) + { + CTimer::get("XIOS").resume(); + CArray tmp(tile_nj, shape(extent[0]), neverDeleteData); + tmp=domaingroup_hdl->tile_nj.getInheritedValue(); + CTimer::get("XIOS").suspend(); + } + + bool cxios_is_defined_domaingroup_tile_nj(domaingroup_Ptr domaingroup_hdl) + { + CTimer::get("XIOS").resume(); + bool isDefined = domaingroup_hdl->tile_nj.hasInheritedValue(); + CTimer::get("XIOS").suspend(); + return isDefined; + } + + void cxios_set_domaingroup_type(domaingroup_Ptr domaingroup_hdl, const char * type, int type_size) { std::string type_str; diff --git a/xios_2311_src/src/interface/c_attr/icscalar_attr.cpp b/xios_2311_src/src/interface/c_attr/icscalar_attr.cpp index 448199e89b35bbf9a4e27decac105392034cd540..38a3b15a7be1274cb582d988ec8af8345ca9830f 100644 --- a/xios_2311_src/src/interface/c_attr/icscalar_attr.cpp +++ b/xios_2311_src/src/interface/c_attr/icscalar_attr.cpp @@ -171,29 +171,6 @@ extern "C" } - void cxios_set_scalar_mask(scalar_Ptr scalar_hdl, bool mask) - { - CTimer::get("XIOS").resume(); - scalar_hdl->mask.setValue(mask); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_scalar_mask(scalar_Ptr scalar_hdl, bool* mask) - { - CTimer::get("XIOS").resume(); - *mask = scalar_hdl->mask.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_scalar_mask(scalar_Ptr scalar_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = scalar_hdl->mask.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - void cxios_set_scalar_name(scalar_Ptr scalar_hdl, const char * name, int name_size) { std::string name_str; diff --git a/xios_2311_src/src/interface/c_attr/icscalargroup_attr.cpp b/xios_2311_src/src/interface/c_attr/icscalargroup_attr.cpp index 1d2b1a991b7c445a586de4b5ba1ad0f30918394a..da35d9b56f39ec01344c54348e2ac60cc97e90b8 100644 --- a/xios_2311_src/src/interface/c_attr/icscalargroup_attr.cpp +++ b/xios_2311_src/src/interface/c_attr/icscalargroup_attr.cpp @@ -197,29 +197,6 @@ extern "C" } - void cxios_set_scalargroup_mask(scalargroup_Ptr scalargroup_hdl, bool mask) - { - CTimer::get("XIOS").resume(); - scalargroup_hdl->mask.setValue(mask); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_scalargroup_mask(scalargroup_Ptr scalargroup_hdl, bool* mask) - { - CTimer::get("XIOS").resume(); - *mask = scalargroup_hdl->mask.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_scalargroup_mask(scalargroup_Ptr scalargroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = scalargroup_hdl->mask.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - void cxios_set_scalargroup_name(scalargroup_Ptr scalargroup_hdl, const char * name, int name_size) { std::string name_str; diff --git a/xios_2311_src/src/interface/fortran/idata.F90 b/xios_2311_src/src/interface/fortran/idata.F90 index 2747ebdc46da117f3c093e40d499085f3a743498..0ba3b0d467b4dfdc51010b820ee3713f9fa034a8 100644 --- a/xios_2311_src/src/interface/fortran/idata.F90 +++ b/xios_2311_src/src/interface/fortran/idata.F90 @@ -67,130 +67,144 @@ MODULE IDATA INTEGER (kind = C_INT) , VALUE :: data_Xsize END SUBROUTINE cxios_write_data_k80 - SUBROUTINE cxios_write_data_k81_hdl(field_hdl, data_k8, data_Xsize) BIND(C) + SUBROUTINE cxios_write_data_k81_hdl(field_hdl, data_k8, data_Xsize, tileid) BIND(C) USE ISO_C_BINDING INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 INTEGER (kind = C_INT) , VALUE :: data_Xsize + INTEGER (kind = C_INT) , VALUE :: tileid END SUBROUTINE cxios_write_data_k81_hdl - SUBROUTINE cxios_write_data_k81(fieldid, fieldid_size, data_k8, data_Xsize) BIND(C) + SUBROUTINE cxios_write_data_k81(fieldid, fieldid_size, data_k8, data_Xsize, tileid) BIND(C) USE ISO_C_BINDING CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 INTEGER (kind = C_INT) , VALUE :: fieldid_size INTEGER (kind = C_INT) , VALUE :: data_Xsize + INTEGER (kind = C_INT) , VALUE :: tileid END SUBROUTINE cxios_write_data_k81 - SUBROUTINE cxios_write_data_k82_hdl(field_hdl, data_k8, data_Xsize, data_Ysize) BIND(C) + SUBROUTINE cxios_write_data_k82_hdl(field_hdl, data_k8, data_Xsize, data_Ysize, tileid) BIND(C) USE ISO_C_BINDING INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 INTEGER (kind = C_INT) , VALUE :: data_Xsize, data_Ysize + INTEGER (kind = C_INT) , VALUE :: tileid END SUBROUTINE cxios_write_data_k82_hdl - SUBROUTINE cxios_write_data_k82(fieldid, fieldid_size, data_k8, data_Xsize, data_Ysize) BIND(C) + SUBROUTINE cxios_write_data_k82(fieldid, fieldid_size, data_k8, data_Xsize, data_Ysize, tileid) BIND(C) USE ISO_C_BINDING CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 INTEGER (kind = C_INT) , VALUE :: fieldid_size INTEGER (kind = C_INT) , VALUE :: data_Xsize, data_Ysize + INTEGER (kind = C_INT) , VALUE :: tileid END SUBROUTINE cxios_write_data_k82 - SUBROUTINE cxios_write_data_k83_hdl(field_hdl, data_k8, data_Xsize, data_Ysize, data_Zsize) BIND(C) + SUBROUTINE cxios_write_data_k83_hdl(field_hdl, data_k8, data_Xsize, data_Ysize, data_Zsize, tileid) BIND(C) USE ISO_C_BINDING INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 INTEGER (kind = C_INT) , VALUE :: data_Xsize, data_Ysize, data_Zsize + INTEGER (kind = C_INT) , VALUE :: tileid END SUBROUTINE cxios_write_data_k83_hdl - SUBROUTINE cxios_write_data_k83(fieldid, fieldid_size, data_k8, data_Xsize, data_Ysize, data_Zsize) BIND(C) + SUBROUTINE cxios_write_data_k83(fieldid, fieldid_size, data_k8, data_Xsize, data_Ysize, data_Zsize, & + tileid) BIND(C) USE ISO_C_BINDING CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 INTEGER (kind = C_INT) , VALUE :: fieldid_size INTEGER (kind = C_INT) , VALUE :: data_Xsize, data_Ysize, data_Zsize + INTEGER (kind = C_INT) , VALUE :: tileid END SUBROUTINE cxios_write_data_k83 SUBROUTINE cxios_write_data_k84_hdl(field_hdl, data_k8, & data_0size, data_1size, data_2size, & - data_3size) BIND(C) + data_3size, tileid) BIND(C) USE ISO_C_BINDING INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size INTEGER (kind = C_INT) , VALUE :: data_3size + INTEGER (kind = C_INT) , VALUE :: tileid END SUBROUTINE cxios_write_data_k84_hdl SUBROUTINE cxios_write_data_k84(fieldid, fieldid_size, data_k8, & data_0size, data_1size, data_2size, & - data_3size) BIND(C) + data_3size, tileid) BIND(C) USE ISO_C_BINDING CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 INTEGER (kind = C_INT) , VALUE :: fieldid_size INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size INTEGER (kind = C_INT) , VALUE :: data_3size + INTEGER (kind = C_INT) , VALUE :: tileid END SUBROUTINE cxios_write_data_k84 SUBROUTINE cxios_write_data_k85_hdl(field_hdl, data_k8, & data_0size, data_1size, data_2size, & - data_3size, data_4size) BIND(C) + data_3size, data_4size, tileid) BIND(C) USE ISO_C_BINDING INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size INTEGER (kind = C_INT) , VALUE :: data_3size, data_4size + INTEGER (kind = C_INT) , VALUE :: tileid END SUBROUTINE cxios_write_data_k85_hdl SUBROUTINE cxios_write_data_k85(fieldid, fieldid_size, data_k8, & data_0size, data_1size, data_2size, & - data_3size, data_4size) BIND(C) + data_3size, data_4size, tileid) BIND(C) USE ISO_C_BINDING CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 INTEGER (kind = C_INT) , VALUE :: fieldid_size INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size INTEGER (kind = C_INT) , VALUE :: data_3size, data_4size + INTEGER (kind = C_INT) , VALUE :: tileid END SUBROUTINE cxios_write_data_k85 SUBROUTINE cxios_write_data_k86_hdl(field_hdl, data_k8, & data_0size, data_1size, data_2size, & - data_3size, data_4size, data_5size) BIND(C) + data_3size, data_4size, data_5size, tileid) BIND(C) USE ISO_C_BINDING INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size INTEGER (kind = C_INT) , VALUE :: data_3size, data_4size, data_5size + INTEGER (kind = C_INT) , VALUE :: tileid END SUBROUTINE cxios_write_data_k86_hdl SUBROUTINE cxios_write_data_k86(fieldid, fieldid_size, data_k8, & data_0size, data_1size, data_2size, & - data_3size, data_4size, data_5size) BIND(C) + data_3size, data_4size, data_5size, tileid) BIND(C) USE ISO_C_BINDING CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 INTEGER (kind = C_INT) , VALUE :: fieldid_size INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size INTEGER (kind = C_INT) , VALUE :: data_3size, data_4size, data_5size + INTEGER (kind = C_INT) , VALUE :: tileid END SUBROUTINE cxios_write_data_k86 SUBROUTINE cxios_write_data_k87_hdl(field_hdl, data_k8, & data_0size, data_1size, data_2size, & data_3size, data_4size, data_5size, & - data_6size) BIND(C) + data_6size, tileid) BIND(C) USE ISO_C_BINDING INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size INTEGER (kind = C_INT) , VALUE :: data_3size, data_4size, data_5size INTEGER (kind = C_INT) , VALUE :: data_6size + INTEGER (kind = C_INT) , VALUE :: tileid END SUBROUTINE cxios_write_data_k87_hdl SUBROUTINE cxios_write_data_k87(fieldid, fieldid_size, data_k8, & data_0size, data_1size, data_2size, & data_3size, data_4size, data_5size, & - data_6size) BIND(C) + data_6size, tileid) BIND(C) USE ISO_C_BINDING CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 @@ -198,6 +212,7 @@ MODULE IDATA INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size INTEGER (kind = C_INT) , VALUE :: data_3size, data_4size, data_5size INTEGER (kind = C_INT) , VALUE :: data_6size + INTEGER (kind = C_INT) , VALUE :: tileid END SUBROUTINE cxios_write_data_k87 SUBROUTINE cxios_write_data_k40_hdl(field_hdl, data_k4, data_Xsize) BIND(C) @@ -215,130 +230,143 @@ MODULE IDATA INTEGER (kind = C_INT) , VALUE :: data_Xsize END SUBROUTINE cxios_write_data_k40 - SUBROUTINE cxios_write_data_k41_hdl(field_hdl, data_k4, data_Xsize) BIND(C) + SUBROUTINE cxios_write_data_k41_hdl(field_hdl, data_k4, data_Xsize, tileid) BIND(C) USE ISO_C_BINDING INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 INTEGER (kind = C_INT) , VALUE :: data_Xsize + INTEGER (kind = C_INT) , VALUE :: tileid END SUBROUTINE cxios_write_data_k41_hdl - SUBROUTINE cxios_write_data_k41(fieldid, fieldid_size, data_k4, data_Xsize) BIND(C) + SUBROUTINE cxios_write_data_k41(fieldid, fieldid_size, data_k4, data_Xsize, tileid) BIND(C) USE ISO_C_BINDING CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 INTEGER (kind = C_INT) , VALUE :: fieldid_size INTEGER (kind = C_INT) , VALUE :: data_Xsize + INTEGER (kind = C_INT) , VALUE :: tileid END SUBROUTINE cxios_write_data_k41 - SUBROUTINE cxios_write_data_k42_hdl(field_hdl, data_k4, data_Xsize, data_Ysize) BIND(C) + SUBROUTINE cxios_write_data_k42_hdl(field_hdl, data_k4, data_Xsize, data_Ysize, tileid) BIND(C) USE ISO_C_BINDING INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 INTEGER (kind = C_INT) , VALUE :: data_Xsize, data_Ysize + INTEGER (kind = C_INT) , VALUE :: tileid END SUBROUTINE cxios_write_data_k42_hdl - SUBROUTINE cxios_write_data_k42(fieldid, fieldid_size, data_k4, data_Xsize, data_Ysize) BIND(C) + SUBROUTINE cxios_write_data_k42(fieldid, fieldid_size, data_k4, data_Xsize, data_Ysize, tileid) BIND(C) USE ISO_C_BINDING CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 INTEGER (kind = C_INT) , VALUE :: fieldid_size INTEGER (kind = C_INT) , VALUE :: data_Xsize, data_Ysize + INTEGER (kind = C_INT) , VALUE :: tileid END SUBROUTINE cxios_write_data_k42 - SUBROUTINE cxios_write_data_k43_hdl(field_hdl, data_k4, data_Xsize, data_Ysize, data_Zsize) BIND(C) + SUBROUTINE cxios_write_data_k43_hdl(field_hdl, data_k4, data_Xsize, data_Ysize, data_Zsize, tileid) BIND(C) USE ISO_C_BINDING INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 INTEGER (kind = C_INT) , VALUE :: data_Xsize, data_Ysize, data_Zsize + INTEGER (kind = C_INT) , VALUE :: tileid END SUBROUTINE cxios_write_data_k43_hdl - SUBROUTINE cxios_write_data_k43(fieldid, fieldid_size, data_k4, data_Xsize, data_Ysize, data_Zsize) BIND(C) + SUBROUTINE cxios_write_data_k43(fieldid, fieldid_size, data_k4, data_Xsize, data_Ysize, data_Zsize, tileid) BIND(C) USE ISO_C_BINDING CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 INTEGER (kind = C_INT) , VALUE :: fieldid_size INTEGER (kind = C_INT) , VALUE :: data_Xsize, data_Ysize, data_Zsize + INTEGER (kind = C_INT) , VALUE :: tileid END SUBROUTINE cxios_write_data_k43 SUBROUTINE cxios_write_data_k44_hdl(field_hdl, data_k4, & data_0size, data_1size, data_2size, & - data_3size) BIND(C) + data_3size, tileid) BIND(C) USE ISO_C_BINDING INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size INTEGER (kind = C_INT) , VALUE :: data_3size + INTEGER (kind = C_INT) , VALUE :: tileid END SUBROUTINE cxios_write_data_k44_hdl SUBROUTINE cxios_write_data_k44(fieldid, fieldid_size, data_k4, & data_0size, data_1size, data_2size, & - data_3size) BIND(C) + data_3size, tileid) BIND(C) USE ISO_C_BINDING CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 INTEGER (kind = C_INT) , VALUE :: fieldid_size INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size INTEGER (kind = C_INT) , VALUE :: data_3size + INTEGER (kind = C_INT) , VALUE :: tileid END SUBROUTINE cxios_write_data_k44 SUBROUTINE cxios_write_data_k45_hdl(field_hdl, data_k4, & data_0size, data_1size, data_2size, & - data_3size, data_4size) BIND(C) + data_3size, data_4size, tileid) BIND(C) USE ISO_C_BINDING INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size INTEGER (kind = C_INT) , VALUE :: data_3size, data_4size + INTEGER (kind = C_INT) , VALUE :: tileid END SUBROUTINE cxios_write_data_k45_hdl SUBROUTINE cxios_write_data_k45(fieldid, fieldid_size, data_k4, & data_0size, data_1size, data_2size, & - data_3size, data_4size) BIND(C) + data_3size, data_4size, tileid) BIND(C) USE ISO_C_BINDING CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 INTEGER (kind = C_INT) , VALUE :: fieldid_size INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size INTEGER (kind = C_INT) , VALUE :: data_3size, data_4size + INTEGER (kind = C_INT) , VALUE :: tileid END SUBROUTINE cxios_write_data_k45 SUBROUTINE cxios_write_data_k46_hdl(field_hdl, data_k4, & data_0size, data_1size, data_2size, & - data_3size, data_4size, data_5size) BIND(C) + data_3size, data_4size, data_5size, tileid) BIND(C) USE ISO_C_BINDING INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size INTEGER (kind = C_INT) , VALUE :: data_3size, data_4size, data_5size + INTEGER (kind = C_INT) , VALUE :: tileid END SUBROUTINE cxios_write_data_k46_hdl SUBROUTINE cxios_write_data_k46(fieldid, fieldid_size, data_k4, & data_0size, data_1size, data_2size, & - data_3size, data_4size, data_5size) BIND(C) + data_3size, data_4size, data_5size, tileid) BIND(C) USE ISO_C_BINDING CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 INTEGER (kind = C_INT) , VALUE :: fieldid_size INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size INTEGER (kind = C_INT) , VALUE :: data_3size, data_4size, data_5size + INTEGER (kind = C_INT) , VALUE :: tileid END SUBROUTINE cxios_write_data_k46 SUBROUTINE cxios_write_data_k47_hdl(field_hdl, data_k4, & data_0size, data_1size, data_2size, & data_3size, data_4size, data_5size, & - data_6size) BIND(C) + data_6size, tileid) BIND(C) USE ISO_C_BINDING INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size INTEGER (kind = C_INT) , VALUE :: data_3size, data_4size, data_5size INTEGER (kind = C_INT) , VALUE :: data_6size + INTEGER (kind = C_INT) , VALUE :: tileid END SUBROUTINE cxios_write_data_k47_hdl SUBROUTINE cxios_write_data_k47(fieldid, fieldid_size, data_k4, & data_0size, data_1size, data_2size, & data_3size, data_4size, data_5size, & - data_6size) BIND(C) + data_6size, tileid) BIND(C) USE ISO_C_BINDING CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 @@ -346,6 +374,7 @@ MODULE IDATA INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size INTEGER (kind = C_INT) , VALUE :: data_3size, data_4size, data_5size INTEGER (kind = C_INT) , VALUE :: data_6size + INTEGER (kind = C_INT) , VALUE :: tileid END SUBROUTINE cxios_write_data_k47 @@ -833,118 +862,202 @@ MODULE IDATA IMPLICIT NONE TYPE(txios(field)) :: field_hdl REAL (kind = 8), DIMENSION(*), INTENT(IN) :: data1d_k8(:) - CALL cxios_write_data_k81_hdl(field_hdl%daddr, data1d_k8, size(data1d_k8, 1)) + INTEGER, PARAMETER :: tileid = -1 + CALL cxios_write_data_k81_hdl(field_hdl%daddr, data1d_k8, size(data1d_k8, 1), tileid) END SUBROUTINE xios(send_field_r8_1d_hdl) SUBROUTINE xios(send_field_r8_1d)(fieldid, data1d_k8) IMPLICIT NONE CHARACTER(len = *) , INTENT(IN) :: fieldid REAL (kind = 8), DIMENSION(*), INTENT(IN) :: data1d_k8(:) - CALL cxios_write_data_k81(fieldid, len(fieldid), data1d_k8, size(data1d_k8, 1)) + INTEGER, PARAMETER :: tileid = -1 + CALL cxios_write_data_k81(fieldid, len(fieldid), data1d_k8, size(data1d_k8, 1), tileid) END SUBROUTINE xios(send_field_r8_1d) + SUBROUTINE xios(send_field_tiled_r8_1d)(fieldid, data1d_k8, tileid) + IMPLICIT NONE + CHARACTER(len = *) , INTENT(IN) :: fieldid + REAL (kind = 8), DIMENSION(*), INTENT(IN) :: data1d_k8(:) + INTEGER , INTENT(IN) :: tileid + CALL cxios_write_data_k81(fieldid, len(fieldid), data1d_k8, size(data1d_k8, 1), tileid) + END SUBROUTINE xios(send_field_tiled_r8_1d) + SUBROUTINE xios(send_field_r8_2d_hdl)(field_hdl, data2d_k8) IMPLICIT NONE TYPE(txios(field)) :: field_hdl REAL (kind = 8), DIMENSION(*), INTENT(IN) :: data2d_k8(:,:) - CALL cxios_write_data_k82_hdl(field_hdl%daddr, data2d_k8, size(data2d_k8, 1), size(data2d_k8, 2)) + INTEGER, PARAMETER :: tileid = -1 + CALL cxios_write_data_k82_hdl(field_hdl%daddr, data2d_k8, size(data2d_k8, 1), size(data2d_k8, 2), tileid) END SUBROUTINE xios(send_field_r8_2d_hdl) SUBROUTINE xios(send_field_r8_2d)(fieldid, data2d_k8) IMPLICIT NONE CHARACTER(len = *) , INTENT(IN) :: fieldid REAL (kind = 8), DIMENSION(*), INTENT(IN) :: data2d_k8(:,:) - CALL cxios_write_data_k82(fieldid, len(fieldid), data2d_k8, size(data2d_k8, 1), size(data2d_k8, 2)) + INTEGER, PARAMETER :: tileid = -1 + CALL cxios_write_data_k82(fieldid, len(fieldid), data2d_k8, size(data2d_k8, 1), & + size(data2d_k8, 2), tileid) END SUBROUTINE xios(send_field_r8_2d) + SUBROUTINE xios(send_field_tiled_r8_2d)(fieldid, data2d_k8, tileid) + IMPLICIT NONE + CHARACTER(len = *) , INTENT(IN) :: fieldid + REAL (kind = 8), DIMENSION(*), INTENT(IN) :: data2d_k8(:,:) + INTEGER , INTENT(IN) :: tileid + CALL cxios_write_data_k82(fieldid, len(fieldid), data2d_k8, size(data2d_k8, 1), & + size(data2d_k8, 2), tileid) + END SUBROUTINE xios(send_field_tiled_r8_2d) + SUBROUTINE xios(send_field_r8_3d_hdl)(field_hdl, data3d_k8) IMPLICIT NONE TYPE(txios(field)) :: field_hdl REAL (kind = 8), DIMENSION(*), INTENT(IN) :: data3d_k8(:,:,:) - CALL cxios_write_data_k83_hdl(field_hdl%daddr, data3d_k8, size(data3d_k8, 1), size(data3d_k8, 2), size(data3d_k8, 3)) + INTEGER, PARAMETER :: tileid = -1 + CALL cxios_write_data_k83_hdl(field_hdl%daddr, data3d_k8, size(data3d_k8, 1), size(data3d_k8, 2), size(data3d_k8, 3), & + tileid) END SUBROUTINE xios(send_field_r8_3d_hdl) SUBROUTINE xios(send_field_r8_3d)(fieldid, data3d_k8) IMPLICIT NONE CHARACTER(len = *) , INTENT(IN) :: fieldid REAL (kind = 8), DIMENSION(*), INTENT(IN) :: data3d_k8(:,:,:) - CALL cxios_write_data_k83(fieldid, len(fieldid), data3d_k8, size(data3d_k8, 1), size(data3d_k8, 2), size(data3d_k8, 3)) + INTEGER, PARAMETER :: tileid = -1 + CALL cxios_write_data_k83(fieldid, len(fieldid), data3d_k8, size(data3d_k8, 1), size(data3d_k8, 2), size(data3d_k8, 3), & + tileid) END SUBROUTINE xios(send_field_r8_3d) + SUBROUTINE xios(send_field_tiled_r8_3d)(fieldid, data3d_k8, tileid) + IMPLICIT NONE + CHARACTER(len = *) , INTENT(IN) :: fieldid + REAL (kind = 8), DIMENSION(*), INTENT(IN) :: data3d_k8(:,:,:) + INTEGER , INTENT(IN) :: tileid + CALL cxios_write_data_k83(fieldid, len(fieldid), data3d_k8, size(data3d_k8, 1), & + size(data3d_k8, 2), size(data3d_k8, 3), tileid) + END SUBROUTINE xios(send_field_tiled_r8_3d) + SUBROUTINE xios(send_field_r8_4d_hdl)(field_hdl, data4d_k8) IMPLICIT NONE TYPE(txios(field)) :: field_hdl REAL (kind = 8), DIMENSION(*), INTENT(IN) :: data4d_k8(:,:,:,:) + INTEGER, PARAMETER :: tileid = -1 CALL cxios_write_data_k84_hdl(field_hdl%daddr, data4d_k8, & size(data4d_k8, 1), size(data4d_k8, 2), size(data4d_k8, 3), & - size(data4d_k8, 4)) + size(data4d_k8, 4), tileid) END SUBROUTINE xios(send_field_r8_4d_hdl) SUBROUTINE xios(send_field_r8_4d)(fieldid, data4d_k8) IMPLICIT NONE CHARACTER(len = *) , INTENT(IN) :: fieldid REAL (kind = 8), DIMENSION(*), INTENT(IN) :: data4d_k8(:,:,:,:) + INTEGER, PARAMETER :: tileid = -1 CALL cxios_write_data_k84(fieldid, len(fieldid), data4d_k8, & size(data4d_k8, 1), size(data4d_k8, 2), size(data4d_k8, 3), & - size(data4d_k8, 4)) + size(data4d_k8, 4), tileid) END SUBROUTINE xios(send_field_r8_4d) + SUBROUTINE xios(send_field_tiled_r8_4d)(fieldid, data4d_k8, tileid) + IMPLICIT NONE + CHARACTER(len = *) , INTENT(IN) :: fieldid + REAL (kind = 8), DIMENSION(*), INTENT(IN) :: data4d_k8(:,:,:,:) + INTEGER , INTENT(IN) :: tileid + CALL cxios_write_data_k84(fieldid, len(fieldid), data4d_k8, & + size(data4d_k8, 1), size(data4d_k8, 2), size(data4d_k8, 3), & + size(data4d_k8, 4), tileid) + END SUBROUTINE xios(send_field_tiled_r8_4d) + SUBROUTINE xios(send_field_r8_5d_hdl)(field_hdl, data5d_k8) IMPLICIT NONE TYPE(txios(field)) :: field_hdl REAL (kind = 8), DIMENSION(*), INTENT(IN) :: data5d_k8(:,:,:,:,:) + INTEGER, PARAMETER :: tileid = -1 CALL cxios_write_data_k85_hdl(field_hdl%daddr, data5d_k8, & size(data5d_k8, 1), size(data5d_k8, 2), size(data5d_k8, 3), & - size(data5d_k8, 4), size(data5d_k8, 5)) + size(data5d_k8, 4), size(data5d_k8, 5), tileid) END SUBROUTINE xios(send_field_r8_5d_hdl) SUBROUTINE xios(send_field_r8_5d)(fieldid, data5d_k8) IMPLICIT NONE CHARACTER(len = *) , INTENT(IN) :: fieldid REAL (kind = 8), DIMENSION(*), INTENT(IN) :: data5d_k8(:,:,:,:,:) + INTEGER, PARAMETER :: tileid = -1 CALL cxios_write_data_k85(fieldid, len(fieldid), data5d_k8, & size(data5d_k8, 1), size(data5d_k8, 2), size(data5d_k8, 3), & - size(data5d_k8, 4), size(data5d_k8, 5)) + size(data5d_k8, 4), size(data5d_k8, 5), tileid) END SUBROUTINE xios(send_field_r8_5d) + SUBROUTINE xios(send_field_tiled_r8_5d)(fieldid, data5d_k8, tileid) + IMPLICIT NONE + CHARACTER(len = *) , INTENT(IN) :: fieldid + REAL (kind = 8), DIMENSION(*), INTENT(IN) :: data5d_k8(:,:,:,:,:) + INTEGER , INTENT(IN) :: tileid + CALL cxios_write_data_k85(fieldid, len(fieldid), data5d_k8, & + size(data5d_k8, 1), size(data5d_k8, 2), size(data5d_k8, 3), & + size(data5d_k8, 4), size(data5d_k8, 5), tileid) + END SUBROUTINE xios(send_field_tiled_r8_5d) + SUBROUTINE xios(send_field_r8_6d_hdl)(field_hdl, data6d_k8) IMPLICIT NONE TYPE(txios(field)) :: field_hdl REAL (kind = 8), DIMENSION(*), INTENT(IN) :: data6d_k8(:,:,:,:,:,:) + INTEGER, PARAMETER :: tileid = -1 CALL cxios_write_data_k86_hdl(field_hdl%daddr, data6d_k8, & size(data6d_k8, 1), size(data6d_k8, 2), size(data6d_k8, 3), & - size(data6d_k8, 4), size(data6d_k8, 5), size(data6d_k8, 6)) + size(data6d_k8, 4), size(data6d_k8, 5), size(data6d_k8, 6), tileid) END SUBROUTINE xios(send_field_r8_6d_hdl) SUBROUTINE xios(send_field_r8_6d)(fieldid, data6d_k8) IMPLICIT NONE CHARACTER(len = *) , INTENT(IN) :: fieldid REAL (kind = 8), DIMENSION(*), INTENT(IN) :: data6d_k8(:,:,:,:,:,:) + INTEGER, PARAMETER :: tileid = -1 CALL cxios_write_data_k86(fieldid, len(fieldid), data6d_k8, & size(data6d_k8, 1), size(data6d_k8, 2), size(data6d_k8, 3), & - size(data6d_k8, 4), size(data6d_k8, 5), size(data6d_k8, 6)) + size(data6d_k8, 4), size(data6d_k8, 5), size(data6d_k8, 6), tileid) END SUBROUTINE xios(send_field_r8_6d) + SUBROUTINE xios(send_field_tiled_r8_6d)(fieldid, data6d_k8, tileid) + IMPLICIT NONE + CHARACTER(len = *) , INTENT(IN) :: fieldid + REAL (kind = 8), DIMENSION(*), INTENT(IN) :: data6d_k8(:,:,:,:,:,:) + INTEGER , INTENT(IN) :: tileid + CALL cxios_write_data_k86(fieldid, len(fieldid), data6d_k8, & + size(data6d_k8, 1), size(data6d_k8, 2), size(data6d_k8, 3), & + size(data6d_k8, 4), size(data6d_k8, 5), size(data6d_k8, 6), tileid) + END SUBROUTINE xios(send_field_tiled_r8_6d) + SUBROUTINE xios(send_field_r8_7d_hdl)(field_hdl, data7d_k8) IMPLICIT NONE TYPE(txios(field)) :: field_hdl REAL (kind = 8), DIMENSION(*), INTENT(IN) :: data7d_k8(:,:,:,:,:,:,:) + INTEGER, PARAMETER :: tileid = -1 CALL cxios_write_data_k87_hdl(field_hdl%daddr, data7d_k8, & size(data7d_k8, 1), size(data7d_k8, 2), size(data7d_k8, 3), & size(data7d_k8, 4), size(data7d_k8, 5), size(data7d_k8, 6), & - size(data7d_k8, 7)) + size(data7d_k8, 7), tileid) END SUBROUTINE xios(send_field_r8_7d_hdl) SUBROUTINE xios(send_field_r8_7d)(fieldid, data7d_k8) IMPLICIT NONE CHARACTER(len = *) , INTENT(IN) :: fieldid REAL (kind = 8), DIMENSION(*), INTENT(IN) :: data7d_k8(:,:,:,:,:,:,:) + INTEGER, PARAMETER :: tileid = -1 CALL cxios_write_data_k87(fieldid, len(fieldid), data7d_k8, & size(data7d_k8, 1), size(data7d_k8, 2), size(data7d_k8, 3), & size(data7d_k8, 4), size(data7d_k8, 5), size(data7d_k8, 6), & - size(data7d_k8, 7)) + size(data7d_k8, 7), tileid) END SUBROUTINE xios(send_field_r8_7d) + SUBROUTINE xios(send_field_tiled_r8_7d)(fieldid, data7d_k8, tileid) + IMPLICIT NONE + CHARACTER(len = *) , INTENT(IN) :: fieldid + REAL (kind = 8), DIMENSION(*), INTENT(IN) :: data7d_k8(:,:,:,:,:,:,:) + INTEGER , INTENT(IN) :: tileid + CALL cxios_write_data_k87(fieldid, len(fieldid), data7d_k8, & + size(data7d_k8, 1), size(data7d_k8, 2), size(data7d_k8, 3), & + size(data7d_k8, 4), size(data7d_k8, 5), size(data7d_k8, 6), & + size(data7d_k8, 7), tileid) + END SUBROUTINE xios(send_field_tiled_r8_7d) + SUBROUTINE xios(send_field_r4_0d_hdl)(field_hdl, data_k4) IMPLICIT NONE TYPE(txios(field)) :: field_hdl @@ -963,118 +1076,200 @@ MODULE IDATA IMPLICIT NONE TYPE(txios(field)) :: field_hdl REAL (kind = 4), DIMENSION(*), INTENT(IN) :: data1d_k4(:) - CALL cxios_write_data_k41_hdl(field_hdl%daddr, data1d_k4, size(data1d_k4, 1)) + INTEGER, PARAMETER :: tileid = -1 + CALL cxios_write_data_k41_hdl(field_hdl%daddr, data1d_k4, size(data1d_k4, 1), tileid) END SUBROUTINE xios(send_field_r4_1d_hdl) SUBROUTINE xios(send_field_r4_1d)(fieldid, data1d_k4) IMPLICIT NONE CHARACTER(len = *) , INTENT(IN) :: fieldid REAL (kind = 4), DIMENSION(*), INTENT(IN) :: data1d_k4(:) - CALL cxios_write_data_k41(fieldid, len(fieldid), data1d_k4, size(data1d_k4, 1)) + INTEGER, PARAMETER :: tileid = -1 + CALL cxios_write_data_k41(fieldid, len(fieldid), data1d_k4, size(data1d_k4, 1), tileid) END SUBROUTINE xios(send_field_r4_1d) + SUBROUTINE xios(send_field_tiled_r4_1d)(fieldid, data1d_k4, tileid) + IMPLICIT NONE + CHARACTER(len = *) , INTENT(IN) :: fieldid + REAL (kind = 4), DIMENSION(*), INTENT(IN) :: data1d_k4(:) + INTEGER , INTENT(IN) :: tileid + CALL cxios_write_data_k41(fieldid, len(fieldid), data1d_k4, size(data1d_k4, 1), tileid) + END SUBROUTINE xios(send_field_tiled_r4_1d) + SUBROUTINE xios(send_field_r4_2d_hdl)(field_hdl, data2d_k4) IMPLICIT NONE TYPE(txios(field)) :: field_hdl REAL (kind = 4), DIMENSION(*), INTENT(IN) :: data2d_k4(:,:) - CALL cxios_write_data_k42_hdl(field_hdl%daddr, data2d_k4, size(data2d_k4, 1), size(data2d_k4, 2)) + INTEGER, PARAMETER :: tileid = -1 + CALL cxios_write_data_k42_hdl(field_hdl%daddr, data2d_k4, size(data2d_k4, 1), size(data2d_k4, 2), tileid) END SUBROUTINE xios(send_field_r4_2d_hdl) SUBROUTINE xios(send_field_r4_2d)(fieldid, data2d_k4) IMPLICIT NONE CHARACTER(len = *) , INTENT(IN) :: fieldid REAL (kind = 4), DIMENSION(*), INTENT(IN) :: data2d_k4(:,:) - CALL cxios_write_data_k42(fieldid, len(fieldid), data2d_k4, size(data2d_k4, 1), size(data2d_k4, 2)) + INTEGER, PARAMETER :: tileid = -1 + CALL cxios_write_data_k42(fieldid, len(fieldid), data2d_k4, size(data2d_k4, 1), size(data2d_k4, 2), tileid) END SUBROUTINE xios(send_field_r4_2d) + SUBROUTINE xios(send_field_tiled_r4_2d)(fieldid, data2d_k4, tileid) + IMPLICIT NONE + CHARACTER(len = *) , INTENT(IN) :: fieldid + REAL (kind = 4), DIMENSION(*), INTENT(IN) :: data2d_k4(:,:) + INTEGER , INTENT(IN) :: tileid + CALL cxios_write_data_k42(fieldid, len(fieldid), data2d_k4, size(data2d_k4, 1), size(data2d_k4, 2), tileid) + END SUBROUTINE xios(send_field_tiled_r4_2d) + SUBROUTINE xios(send_field_r4_3d_hdl)(field_hdl, data3d_k4) IMPLICIT NONE TYPE(txios(field)) :: field_hdl REAL (kind = 4), DIMENSION(*), INTENT(IN) :: data3d_k4(:,:,:) - CALL cxios_write_data_k43_hdl(field_hdl%daddr, data3d_k4, size(data3d_k4, 1), size(data3d_k4, 2), size(data3d_k4, 3)) + INTEGER, PARAMETER :: tileid = -1 + CALL cxios_write_data_k43_hdl(field_hdl%daddr, data3d_k4, size(data3d_k4, 1), size(data3d_k4, 2), size(data3d_k4, 3), & + tileid) END SUBROUTINE xios(send_field_r4_3d_hdl) SUBROUTINE xios(send_field_r4_3d)(fieldid, data3d_k4) IMPLICIT NONE CHARACTER(len = *) , INTENT(IN) :: fieldid REAL (kind = 4), DIMENSION(*), INTENT(IN) :: data3d_k4(:,:,:) - CALL cxios_write_data_k43(fieldid, len(fieldid), data3d_k4, size(data3d_k4, 1), size(data3d_k4, 2), size(data3d_k4, 3)) + INTEGER, PARAMETER :: tileid = -1 + CALL cxios_write_data_k43(fieldid, len(fieldid), data3d_k4, size(data3d_k4, 1), size(data3d_k4, 2), size(data3d_k4, 3), & + tileid) END SUBROUTINE xios(send_field_r4_3d) + SUBROUTINE xios(send_field_tiled_r4_3d)(fieldid, data3d_k4, tileid) + IMPLICIT NONE + CHARACTER(len = *) , INTENT(IN) :: fieldid + REAL (kind = 4), DIMENSION(*), INTENT(IN) :: data3d_k4(:,:,:) + INTEGER , INTENT(IN) :: tileid + CALL cxios_write_data_k43(fieldid, len(fieldid), data3d_k4, size(data3d_k4, 1), size(data3d_k4, 2), size(data3d_k4, 3), & + tileid) + END SUBROUTINE xios(send_field_tiled_r4_3d) + SUBROUTINE xios(send_field_r4_4d_hdl)(field_hdl, data4d_k4) IMPLICIT NONE TYPE(txios(field)) :: field_hdl REAL (kind = 4), DIMENSION(*), INTENT(IN) :: data4d_k4(:,:,:,:) + INTEGER, PARAMETER :: tileid = -1 CALL cxios_write_data_k44_hdl(field_hdl%daddr, data4d_k4, & size(data4d_k4, 1), size(data4d_k4, 2), size(data4d_k4, 3), & - size(data4d_k4, 4)) + size(data4d_k4, 4), tileid) END SUBROUTINE xios(send_field_r4_4d_hdl) - + SUBROUTINE xios(send_field_r4_4d)(fieldid, data4d_k4) IMPLICIT NONE CHARACTER(len = *) , INTENT(IN) :: fieldid REAL (kind = 4), DIMENSION(*), INTENT(IN) :: data4d_k4(:,:,:,:) + INTEGER, PARAMETER :: tileid = -1 CALL cxios_write_data_k44(fieldid, len(fieldid), data4d_k4, & size(data4d_k4, 1), size(data4d_k4, 2), size(data4d_k4, 3), & - size(data4d_k4, 4)) + size(data4d_k4, 4), tileid) END SUBROUTINE xios(send_field_r4_4d) + SUBROUTINE xios(send_field_tiled_r4_4d)(fieldid, data4d_k4, tileid) + IMPLICIT NONE + CHARACTER(len = *) , INTENT(IN) :: fieldid + REAL (kind = 4), DIMENSION(*), INTENT(IN) :: data4d_k4(:,:,:,:) + INTEGER , INTENT(IN) :: tileid + CALL cxios_write_data_k44(fieldid, len(fieldid), data4d_k4, & + size(data4d_k4, 1), size(data4d_k4, 2), size(data4d_k4, 3), & + size(data4d_k4, 4), tileid) + END SUBROUTINE xios(send_field_tiled_r4_4d) + SUBROUTINE xios(send_field_r4_5d_hdl)(field_hdl, data5d_k4) IMPLICIT NONE TYPE(txios(field)) :: field_hdl REAL (kind = 4), DIMENSION(*), INTENT(IN) :: data5d_k4(:,:,:,:,:) + INTEGER, PARAMETER :: tileid = -1 CALL cxios_write_data_k45_hdl(field_hdl%daddr, data5d_k4, & size(data5d_k4, 1), size(data5d_k4, 2), size(data5d_k4, 3), & - size(data5d_k4, 4), size(data5d_k4, 5)) + size(data5d_k4, 4), size(data5d_k4, 5), tileid) END SUBROUTINE xios(send_field_r4_5d_hdl) SUBROUTINE xios(send_field_r4_5d)(fieldid, data5d_k4) IMPLICIT NONE CHARACTER(len = *) , INTENT(IN) :: fieldid REAL (kind = 4), DIMENSION(*), INTENT(IN) :: data5d_k4(:,:,:,:,:) + INTEGER, PARAMETER :: tileid = -1 CALL cxios_write_data_k45(fieldid, len(fieldid), data5d_k4, & size(data5d_k4, 1), size(data5d_k4, 2), size(data5d_k4, 3), & - size(data5d_k4, 4), size(data5d_k4, 5)) + size(data5d_k4, 4), size(data5d_k4, 5), tileid) END SUBROUTINE xios(send_field_r4_5d) + SUBROUTINE xios(send_field_tiled_r4_5d)(fieldid, data5d_k4, tileid) + IMPLICIT NONE + CHARACTER(len = *) , INTENT(IN) :: fieldid + REAL (kind = 4), DIMENSION(*), INTENT(IN) :: data5d_k4(:,:,:,:,:) + INTEGER , INTENT(IN) :: tileid + CALL cxios_write_data_k45(fieldid, len(fieldid), data5d_k4, & + size(data5d_k4, 1), size(data5d_k4, 2), size(data5d_k4, 3), & + size(data5d_k4, 4), size(data5d_k4, 5), tileid) + END SUBROUTINE xios(send_field_tiled_r4_5d) + SUBROUTINE xios(send_field_r4_6d_hdl)(field_hdl, data6d_k4) IMPLICIT NONE TYPE(txios(field)) :: field_hdl REAL (kind = 4), DIMENSION(*), INTENT(IN) :: data6d_k4(:,:,:,:,:,:) + INTEGER, PARAMETER :: tileid = -1 CALL cxios_write_data_k46_hdl(field_hdl%daddr, data6d_k4, & size(data6d_k4, 1), size(data6d_k4, 2), size(data6d_k4, 3), & - size(data6d_k4, 4), size(data6d_k4, 5), size(data6d_k4, 6)) + size(data6d_k4, 4), size(data6d_k4, 5), size(data6d_k4, 6), tileid) END SUBROUTINE xios(send_field_r4_6d_hdl) SUBROUTINE xios(send_field_r4_6d)(fieldid, data6d_k4) IMPLICIT NONE CHARACTER(len = *) , INTENT(IN) :: fieldid REAL (kind = 4), DIMENSION(*), INTENT(IN) :: data6d_k4(:,:,:,:,:,:) + INTEGER, PARAMETER :: tileid = -1 CALL cxios_write_data_k46(fieldid, len(fieldid), data6d_k4, & size(data6d_k4, 1), size(data6d_k4, 2), size(data6d_k4, 3), & - size(data6d_k4, 4), size(data6d_k4, 5), size(data6d_k4, 6)) + size(data6d_k4, 4), size(data6d_k4, 5), size(data6d_k4, 6), tileid) END SUBROUTINE xios(send_field_r4_6d) + SUBROUTINE xios(send_field_tiled_r4_6d)(fieldid, data6d_k4, tileid) + IMPLICIT NONE + CHARACTER(len = *) , INTENT(IN) :: fieldid + REAL (kind = 4), DIMENSION(*), INTENT(IN) :: data6d_k4(:,:,:,:,:,:) + INTEGER , INTENT(IN) :: tileid + CALL cxios_write_data_k46(fieldid, len(fieldid), data6d_k4, & + size(data6d_k4, 1), size(data6d_k4, 2), size(data6d_k4, 3), & + size(data6d_k4, 4), size(data6d_k4, 5), size(data6d_k4, 6), tileid) + END SUBROUTINE xios(send_field_tiled_r4_6d) + SUBROUTINE xios(send_field_r4_7d_hdl)(field_hdl, data7d_k4) IMPLICIT NONE TYPE(txios(field)) :: field_hdl REAL (kind = 4), DIMENSION(*), INTENT(IN) :: data7d_k4(:,:,:,:,:,:,:) + INTEGER, PARAMETER :: tileid = -1 CALL cxios_write_data_k47_hdl(field_hdl%daddr, data7d_k4, & size(data7d_k4, 1), size(data7d_k4, 2), size(data7d_k4, 3), & size(data7d_k4, 4), size(data7d_k4, 5), size(data7d_k4, 6), & - size(data7d_k4, 7)) + size(data7d_k4, 7), tileid) END SUBROUTINE xios(send_field_r4_7d_hdl) SUBROUTINE xios(send_field_r4_7d)(fieldid, data7d_k4) IMPLICIT NONE CHARACTER(len = *) , INTENT(IN) :: fieldid REAL (kind = 4), DIMENSION(*), INTENT(IN) :: data7d_k4(:,:,:,:,:,:,:) + INTEGER, PARAMETER :: tileid = -1 CALL cxios_write_data_k47(fieldid, len(fieldid), data7d_k4, & size(data7d_k4, 1), size(data7d_k4, 2), size(data7d_k4, 3), & size(data7d_k4, 4), size(data7d_k4, 5), size(data7d_k4, 6), & - size(data7d_k4, 7)) + size(data7d_k4, 7), tileid) END SUBROUTINE xios(send_field_r4_7d) + SUBROUTINE xios(send_field_tiled_r4_7d)(fieldid, data7d_k4, tileid) + IMPLICIT NONE + CHARACTER(len = *) , INTENT(IN) :: fieldid + REAL (kind = 4), DIMENSION(*), INTENT(IN) :: data7d_k4(:,:,:,:,:,:,:) + INTEGER , INTENT(IN) :: tileid + CALL cxios_write_data_k47(fieldid, len(fieldid), data7d_k4, & + size(data7d_k4, 1), size(data7d_k4, 2), size(data7d_k4, 3), & + size(data7d_k4, 4), size(data7d_k4, 5), size(data7d_k4, 6), & + size(data7d_k4, 7), tileid) + END SUBROUTINE xios(send_field_tiled_r4_7d) + ! Receive field functions SUBROUTINE xios(recv_field_r8_0d_hdl)(field_hdl, data0d_k8) IMPLICIT NONE diff --git a/xios_2311_src/src/interface/fortran/ixios_interfaces.F90 b/xios_2311_src/src/interface/fortran/ixios_interfaces.F90 index 69d211247bdb501596f55269bbdb76f6b1eb9b13..dc99ca6adcdb685efaf2e66f745cdb532896ac66 100644 --- a/xios_2311_src/src/interface/fortran/ixios_interfaces.F90 +++ b/xios_2311_src/src/interface/fortran/ixios_interfaces.F90 @@ -14,6 +14,12 @@ USE idata, ONLY : xios(send_field_r8_0d), xios(send_field_r8_1d), xios(send_fiel xios(send_field_r8_4d_hdl), xios(send_field_r8_5d_hdl), xios(send_field_r8_6d_hdl), xios(send_field_r8_7d_hdl), & xios(send_field_r4_0d_hdl), xios(send_field_r4_1d_hdl), xios(send_field_r4_2d_hdl), xios(send_field_r4_3d_hdl), & xios(send_field_r4_4d_hdl), xios(send_field_r4_5d_hdl), xios(send_field_r4_6d_hdl), xios(send_field_r4_7d_hdl), & + xios(send_field_tiled_r8_1d), xios(send_field_tiled_r8_2d), & + xios(send_field_tiled_r8_3d), xios(send_field_tiled_r8_4d), & + xios(send_field_tiled_r8_5d), xios(send_field_tiled_r8_6d), xios(send_field_tiled_r8_7d), & + xios(send_field_tiled_r4_1d), xios(send_field_tiled_r4_2d), & + xios(send_field_tiled_r4_3d), xios(send_field_tiled_r4_4d), & + xios(send_field_tiled_r4_5d), xios(send_field_tiled_r4_6d), xios(send_field_tiled_r4_7d), & xios(recv_field_r8_0d), xios(recv_field_r8_1d), xios(recv_field_r8_2d), xios(recv_field_r8_3d), & xios(recv_field_r8_4d), xios(recv_field_r8_5d), xios(recv_field_r8_6d), xios(recv_field_r8_7d), & xios(recv_field_r4_0d), xios(recv_field_r4_1d), xios(recv_field_r4_2d), xios(recv_field_r4_3d), & @@ -250,7 +256,13 @@ INTERFACE xios(send_field) xios(send_field_r8_0d_hdl), xios(send_field_r8_1d_hdl), xios(send_field_r8_2d_hdl), xios(send_field_r8_3d_hdl), & xios(send_field_r8_4d_hdl), xios(send_field_r8_5d_hdl), xios(send_field_r8_6d_hdl), xios(send_field_r8_7d_hdl), & xios(send_field_r4_0d_hdl), xios(send_field_r4_1d_hdl), xios(send_field_r4_2d_hdl), xios(send_field_r4_3d_hdl), & - xios(send_field_r4_4d_hdl), xios(send_field_r4_5d_hdl), xios(send_field_r4_6d_hdl), xios(send_field_r4_7d_hdl) + xios(send_field_r4_4d_hdl), xios(send_field_r4_5d_hdl), xios(send_field_r4_6d_hdl), xios(send_field_r4_7d_hdl), & + xios(send_field_tiled_r8_1d), xios(send_field_tiled_r8_2d), & + xios(send_field_tiled_r8_3d), xios(send_field_tiled_r8_4d), & + xios(send_field_tiled_r8_5d), xios(send_field_tiled_r8_6d), xios(send_field_tiled_r8_7d), & + xios(send_field_tiled_r4_1d), xios(send_field_tiled_r4_2d), & + xios(send_field_tiled_r4_3d), xios(send_field_tiled_r4_4d), & + xios(send_field_tiled_r4_5d), xios(send_field_tiled_r4_6d), xios(send_field_tiled_r4_7d) END INTERFACE xios(send_field) INTERFACE xios(recv_field) diff --git a/xios_2311_src/src/interface/fortran_attr/context_interface_attr.F90 b/xios_2311_src/src/interface/fortran_attr/context_interface_attr.F90 index 9e441519d51ef16b57a2a3e6be02e86045fa9859..1c25ee81601ac5dac53029e2e2f043eedeaada54 100644 --- a/xios_2311_src/src/interface/fortran_attr/context_interface_attr.F90 +++ b/xios_2311_src/src/interface/fortran_attr/context_interface_attr.F90 @@ -9,25 +9,6 @@ MODULE context_interface_attr INTERFACE ! Do not call directly / interface FORTRAN 2003 <-> C99 - SUBROUTINE cxios_set_context_attached_mode(context_hdl, attached_mode) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: context_hdl - LOGICAL (KIND=C_BOOL) , VALUE :: attached_mode - END SUBROUTINE cxios_set_context_attached_mode - - SUBROUTINE cxios_get_context_attached_mode(context_hdl, attached_mode) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: context_hdl - LOGICAL (KIND=C_BOOL) :: attached_mode - END SUBROUTINE cxios_get_context_attached_mode - - FUNCTION cxios_is_defined_context_attached_mode(context_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_context_attached_mode - INTEGER (kind = C_INTPTR_T), VALUE :: context_hdl - END FUNCTION cxios_is_defined_context_attached_mode - - SUBROUTINE cxios_set_context_output_dir(context_hdl, output_dir, output_dir_size) BIND(C) USE ISO_C_BINDING INTEGER (kind = C_INTPTR_T), VALUE :: context_hdl diff --git a/xios_2311_src/src/interface/fortran_attr/domain_interface_attr.F90 b/xios_2311_src/src/interface/fortran_attr/domain_interface_attr.F90 index 8b0a892895cbe0e485e953826149c3bc9a4e8c6e..045704e99027cdb049dc049c7ac9180d5f65869b 100644 --- a/xios_2311_src/src/interface/fortran_attr/domain_interface_attr.F90 +++ b/xios_2311_src/src/interface/fortran_attr/domain_interface_attr.F90 @@ -743,6 +743,25 @@ MODULE domain_interface_attr END FUNCTION cxios_is_defined_domain_nj_glo + SUBROUTINE cxios_set_domain_ntiles(domain_hdl, ntiles) BIND(C) + USE ISO_C_BINDING + INTEGER (kind = C_INTPTR_T), VALUE :: domain_hdl + INTEGER (KIND=C_INT) , VALUE :: ntiles + END SUBROUTINE cxios_set_domain_ntiles + + SUBROUTINE cxios_get_domain_ntiles(domain_hdl, ntiles) BIND(C) + USE ISO_C_BINDING + INTEGER (kind = C_INTPTR_T), VALUE :: domain_hdl + INTEGER (KIND=C_INT) :: ntiles + END SUBROUTINE cxios_get_domain_ntiles + + FUNCTION cxios_is_defined_domain_ntiles(domain_hdl) BIND(C) + USE ISO_C_BINDING + LOGICAL(kind=C_BOOL) :: cxios_is_defined_domain_ntiles + INTEGER (kind = C_INTPTR_T), VALUE :: domain_hdl + END FUNCTION cxios_is_defined_domain_ntiles + + SUBROUTINE cxios_set_domain_nvertex(domain_hdl, nvertex) BIND(C) USE ISO_C_BINDING INTEGER (kind = C_INTPTR_T), VALUE :: domain_hdl @@ -821,6 +840,174 @@ MODULE domain_interface_attr END FUNCTION cxios_is_defined_domain_standard_name + SUBROUTINE cxios_set_domain_tile_data_ibegin(domain_hdl, tile_data_ibegin, extent) BIND(C) + USE ISO_C_BINDING + INTEGER (kind = C_INTPTR_T), VALUE :: domain_hdl + INTEGER (KIND=C_INT) , DIMENSION(*) :: tile_data_ibegin + INTEGER (kind = C_INT), DIMENSION(*) :: extent + END SUBROUTINE cxios_set_domain_tile_data_ibegin + + SUBROUTINE cxios_get_domain_tile_data_ibegin(domain_hdl, tile_data_ibegin, extent) BIND(C) + USE ISO_C_BINDING + INTEGER (kind = C_INTPTR_T), VALUE :: domain_hdl + INTEGER (KIND=C_INT) , DIMENSION(*) :: tile_data_ibegin + INTEGER (kind = C_INT), DIMENSION(*) :: extent + END SUBROUTINE cxios_get_domain_tile_data_ibegin + + FUNCTION cxios_is_defined_domain_tile_data_ibegin(domain_hdl) BIND(C) + USE ISO_C_BINDING + LOGICAL(kind=C_BOOL) :: cxios_is_defined_domain_tile_data_ibegin + INTEGER (kind = C_INTPTR_T), VALUE :: domain_hdl + END FUNCTION cxios_is_defined_domain_tile_data_ibegin + + + SUBROUTINE cxios_set_domain_tile_data_jbegin(domain_hdl, tile_data_jbegin, extent) BIND(C) + USE ISO_C_BINDING + INTEGER (kind = C_INTPTR_T), VALUE :: domain_hdl + INTEGER (KIND=C_INT) , DIMENSION(*) :: tile_data_jbegin + INTEGER (kind = C_INT), DIMENSION(*) :: extent + END SUBROUTINE cxios_set_domain_tile_data_jbegin + + SUBROUTINE cxios_get_domain_tile_data_jbegin(domain_hdl, tile_data_jbegin, extent) BIND(C) + USE ISO_C_BINDING + INTEGER (kind = C_INTPTR_T), VALUE :: domain_hdl + INTEGER (KIND=C_INT) , DIMENSION(*) :: tile_data_jbegin + INTEGER (kind = C_INT), DIMENSION(*) :: extent + END SUBROUTINE cxios_get_domain_tile_data_jbegin + + FUNCTION cxios_is_defined_domain_tile_data_jbegin(domain_hdl) BIND(C) + USE ISO_C_BINDING + LOGICAL(kind=C_BOOL) :: cxios_is_defined_domain_tile_data_jbegin + INTEGER (kind = C_INTPTR_T), VALUE :: domain_hdl + END FUNCTION cxios_is_defined_domain_tile_data_jbegin + + + SUBROUTINE cxios_set_domain_tile_data_ni(domain_hdl, tile_data_ni, extent) BIND(C) + USE ISO_C_BINDING + INTEGER (kind = C_INTPTR_T), VALUE :: domain_hdl + INTEGER (KIND=C_INT) , DIMENSION(*) :: tile_data_ni + INTEGER (kind = C_INT), DIMENSION(*) :: extent + END SUBROUTINE cxios_set_domain_tile_data_ni + + SUBROUTINE cxios_get_domain_tile_data_ni(domain_hdl, tile_data_ni, extent) BIND(C) + USE ISO_C_BINDING + INTEGER (kind = C_INTPTR_T), VALUE :: domain_hdl + INTEGER (KIND=C_INT) , DIMENSION(*) :: tile_data_ni + INTEGER (kind = C_INT), DIMENSION(*) :: extent + END SUBROUTINE cxios_get_domain_tile_data_ni + + FUNCTION cxios_is_defined_domain_tile_data_ni(domain_hdl) BIND(C) + USE ISO_C_BINDING + LOGICAL(kind=C_BOOL) :: cxios_is_defined_domain_tile_data_ni + INTEGER (kind = C_INTPTR_T), VALUE :: domain_hdl + END FUNCTION cxios_is_defined_domain_tile_data_ni + + + SUBROUTINE cxios_set_domain_tile_data_nj(domain_hdl, tile_data_nj, extent) BIND(C) + USE ISO_C_BINDING + INTEGER (kind = C_INTPTR_T), VALUE :: domain_hdl + INTEGER (KIND=C_INT) , DIMENSION(*) :: tile_data_nj + INTEGER (kind = C_INT), DIMENSION(*) :: extent + END SUBROUTINE cxios_set_domain_tile_data_nj + + SUBROUTINE cxios_get_domain_tile_data_nj(domain_hdl, tile_data_nj, extent) BIND(C) + USE ISO_C_BINDING + INTEGER (kind = C_INTPTR_T), VALUE :: domain_hdl + INTEGER (KIND=C_INT) , DIMENSION(*) :: tile_data_nj + INTEGER (kind = C_INT), DIMENSION(*) :: extent + END SUBROUTINE cxios_get_domain_tile_data_nj + + FUNCTION cxios_is_defined_domain_tile_data_nj(domain_hdl) BIND(C) + USE ISO_C_BINDING + LOGICAL(kind=C_BOOL) :: cxios_is_defined_domain_tile_data_nj + INTEGER (kind = C_INTPTR_T), VALUE :: domain_hdl + END FUNCTION cxios_is_defined_domain_tile_data_nj + + + SUBROUTINE cxios_set_domain_tile_ibegin(domain_hdl, tile_ibegin, extent) BIND(C) + USE ISO_C_BINDING + INTEGER (kind = C_INTPTR_T), VALUE :: domain_hdl + INTEGER (KIND=C_INT) , DIMENSION(*) :: tile_ibegin + INTEGER (kind = C_INT), DIMENSION(*) :: extent + END SUBROUTINE cxios_set_domain_tile_ibegin + + SUBROUTINE cxios_get_domain_tile_ibegin(domain_hdl, tile_ibegin, extent) BIND(C) + USE ISO_C_BINDING + INTEGER (kind = C_INTPTR_T), VALUE :: domain_hdl + INTEGER (KIND=C_INT) , DIMENSION(*) :: tile_ibegin + INTEGER (kind = C_INT), DIMENSION(*) :: extent + END SUBROUTINE cxios_get_domain_tile_ibegin + + FUNCTION cxios_is_defined_domain_tile_ibegin(domain_hdl) BIND(C) + USE ISO_C_BINDING + LOGICAL(kind=C_BOOL) :: cxios_is_defined_domain_tile_ibegin + INTEGER (kind = C_INTPTR_T), VALUE :: domain_hdl + END FUNCTION cxios_is_defined_domain_tile_ibegin + + + SUBROUTINE cxios_set_domain_tile_jbegin(domain_hdl, tile_jbegin, extent) BIND(C) + USE ISO_C_BINDING + INTEGER (kind = C_INTPTR_T), VALUE :: domain_hdl + INTEGER (KIND=C_INT) , DIMENSION(*) :: tile_jbegin + INTEGER (kind = C_INT), DIMENSION(*) :: extent + END SUBROUTINE cxios_set_domain_tile_jbegin + + SUBROUTINE cxios_get_domain_tile_jbegin(domain_hdl, tile_jbegin, extent) BIND(C) + USE ISO_C_BINDING + INTEGER (kind = C_INTPTR_T), VALUE :: domain_hdl + INTEGER (KIND=C_INT) , DIMENSION(*) :: tile_jbegin + INTEGER (kind = C_INT), DIMENSION(*) :: extent + END SUBROUTINE cxios_get_domain_tile_jbegin + + FUNCTION cxios_is_defined_domain_tile_jbegin(domain_hdl) BIND(C) + USE ISO_C_BINDING + LOGICAL(kind=C_BOOL) :: cxios_is_defined_domain_tile_jbegin + INTEGER (kind = C_INTPTR_T), VALUE :: domain_hdl + END FUNCTION cxios_is_defined_domain_tile_jbegin + + + SUBROUTINE cxios_set_domain_tile_ni(domain_hdl, tile_ni, extent) BIND(C) + USE ISO_C_BINDING + INTEGER (kind = C_INTPTR_T), VALUE :: domain_hdl + INTEGER (KIND=C_INT) , DIMENSION(*) :: tile_ni + INTEGER (kind = C_INT), DIMENSION(*) :: extent + END SUBROUTINE cxios_set_domain_tile_ni + + SUBROUTINE cxios_get_domain_tile_ni(domain_hdl, tile_ni, extent) BIND(C) + USE ISO_C_BINDING + INTEGER (kind = C_INTPTR_T), VALUE :: domain_hdl + INTEGER (KIND=C_INT) , DIMENSION(*) :: tile_ni + INTEGER (kind = C_INT), DIMENSION(*) :: extent + END SUBROUTINE cxios_get_domain_tile_ni + + FUNCTION cxios_is_defined_domain_tile_ni(domain_hdl) BIND(C) + USE ISO_C_BINDING + LOGICAL(kind=C_BOOL) :: cxios_is_defined_domain_tile_ni + INTEGER (kind = C_INTPTR_T), VALUE :: domain_hdl + END FUNCTION cxios_is_defined_domain_tile_ni + + + SUBROUTINE cxios_set_domain_tile_nj(domain_hdl, tile_nj, extent) BIND(C) + USE ISO_C_BINDING + INTEGER (kind = C_INTPTR_T), VALUE :: domain_hdl + INTEGER (KIND=C_INT) , DIMENSION(*) :: tile_nj + INTEGER (kind = C_INT), DIMENSION(*) :: extent + END SUBROUTINE cxios_set_domain_tile_nj + + SUBROUTINE cxios_get_domain_tile_nj(domain_hdl, tile_nj, extent) BIND(C) + USE ISO_C_BINDING + INTEGER (kind = C_INTPTR_T), VALUE :: domain_hdl + INTEGER (KIND=C_INT) , DIMENSION(*) :: tile_nj + INTEGER (kind = C_INT), DIMENSION(*) :: extent + END SUBROUTINE cxios_get_domain_tile_nj + + FUNCTION cxios_is_defined_domain_tile_nj(domain_hdl) BIND(C) + USE ISO_C_BINDING + LOGICAL(kind=C_BOOL) :: cxios_is_defined_domain_tile_nj + INTEGER (kind = C_INTPTR_T), VALUE :: domain_hdl + END FUNCTION cxios_is_defined_domain_tile_nj + + SUBROUTINE cxios_set_domain_type(domain_hdl, type, type_size) BIND(C) USE ISO_C_BINDING INTEGER (kind = C_INTPTR_T), VALUE :: domain_hdl diff --git a/xios_2311_src/src/interface/fortran_attr/domaingroup_interface_attr.F90 b/xios_2311_src/src/interface/fortran_attr/domaingroup_interface_attr.F90 index 52bfe79d13af2109185aa8ced1e2dd5d5c61b6e1..a2c1a010cbc4787023b62083131cbf0af2dffc8b 100644 --- a/xios_2311_src/src/interface/fortran_attr/domaingroup_interface_attr.F90 +++ b/xios_2311_src/src/interface/fortran_attr/domaingroup_interface_attr.F90 @@ -764,6 +764,25 @@ MODULE domaingroup_interface_attr END FUNCTION cxios_is_defined_domaingroup_nj_glo + SUBROUTINE cxios_set_domaingroup_ntiles(domaingroup_hdl, ntiles) BIND(C) + USE ISO_C_BINDING + INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl + INTEGER (KIND=C_INT) , VALUE :: ntiles + END SUBROUTINE cxios_set_domaingroup_ntiles + + SUBROUTINE cxios_get_domaingroup_ntiles(domaingroup_hdl, ntiles) BIND(C) + USE ISO_C_BINDING + INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl + INTEGER (KIND=C_INT) :: ntiles + END SUBROUTINE cxios_get_domaingroup_ntiles + + FUNCTION cxios_is_defined_domaingroup_ntiles(domaingroup_hdl) BIND(C) + USE ISO_C_BINDING + LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_ntiles + INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl + END FUNCTION cxios_is_defined_domaingroup_ntiles + + SUBROUTINE cxios_set_domaingroup_nvertex(domaingroup_hdl, nvertex) BIND(C) USE ISO_C_BINDING INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl @@ -842,6 +861,174 @@ MODULE domaingroup_interface_attr END FUNCTION cxios_is_defined_domaingroup_standard_name + SUBROUTINE cxios_set_domaingroup_tile_data_ibegin(domaingroup_hdl, tile_data_ibegin, extent) BIND(C) + USE ISO_C_BINDING + INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl + INTEGER (KIND=C_INT) , DIMENSION(*) :: tile_data_ibegin + INTEGER (kind = C_INT), DIMENSION(*) :: extent + END SUBROUTINE cxios_set_domaingroup_tile_data_ibegin + + SUBROUTINE cxios_get_domaingroup_tile_data_ibegin(domaingroup_hdl, tile_data_ibegin, extent) BIND(C) + USE ISO_C_BINDING + INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl + INTEGER (KIND=C_INT) , DIMENSION(*) :: tile_data_ibegin + INTEGER (kind = C_INT), DIMENSION(*) :: extent + END SUBROUTINE cxios_get_domaingroup_tile_data_ibegin + + FUNCTION cxios_is_defined_domaingroup_tile_data_ibegin(domaingroup_hdl) BIND(C) + USE ISO_C_BINDING + LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_tile_data_ibegin + INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl + END FUNCTION cxios_is_defined_domaingroup_tile_data_ibegin + + + SUBROUTINE cxios_set_domaingroup_tile_data_jbegin(domaingroup_hdl, tile_data_jbegin, extent) BIND(C) + USE ISO_C_BINDING + INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl + INTEGER (KIND=C_INT) , DIMENSION(*) :: tile_data_jbegin + INTEGER (kind = C_INT), DIMENSION(*) :: extent + END SUBROUTINE cxios_set_domaingroup_tile_data_jbegin + + SUBROUTINE cxios_get_domaingroup_tile_data_jbegin(domaingroup_hdl, tile_data_jbegin, extent) BIND(C) + USE ISO_C_BINDING + INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl + INTEGER (KIND=C_INT) , DIMENSION(*) :: tile_data_jbegin + INTEGER (kind = C_INT), DIMENSION(*) :: extent + END SUBROUTINE cxios_get_domaingroup_tile_data_jbegin + + FUNCTION cxios_is_defined_domaingroup_tile_data_jbegin(domaingroup_hdl) BIND(C) + USE ISO_C_BINDING + LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_tile_data_jbegin + INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl + END FUNCTION cxios_is_defined_domaingroup_tile_data_jbegin + + + SUBROUTINE cxios_set_domaingroup_tile_data_ni(domaingroup_hdl, tile_data_ni, extent) BIND(C) + USE ISO_C_BINDING + INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl + INTEGER (KIND=C_INT) , DIMENSION(*) :: tile_data_ni + INTEGER (kind = C_INT), DIMENSION(*) :: extent + END SUBROUTINE cxios_set_domaingroup_tile_data_ni + + SUBROUTINE cxios_get_domaingroup_tile_data_ni(domaingroup_hdl, tile_data_ni, extent) BIND(C) + USE ISO_C_BINDING + INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl + INTEGER (KIND=C_INT) , DIMENSION(*) :: tile_data_ni + INTEGER (kind = C_INT), DIMENSION(*) :: extent + END SUBROUTINE cxios_get_domaingroup_tile_data_ni + + FUNCTION cxios_is_defined_domaingroup_tile_data_ni(domaingroup_hdl) BIND(C) + USE ISO_C_BINDING + LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_tile_data_ni + INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl + END FUNCTION cxios_is_defined_domaingroup_tile_data_ni + + + SUBROUTINE cxios_set_domaingroup_tile_data_nj(domaingroup_hdl, tile_data_nj, extent) BIND(C) + USE ISO_C_BINDING + INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl + INTEGER (KIND=C_INT) , DIMENSION(*) :: tile_data_nj + INTEGER (kind = C_INT), DIMENSION(*) :: extent + END SUBROUTINE cxios_set_domaingroup_tile_data_nj + + SUBROUTINE cxios_get_domaingroup_tile_data_nj(domaingroup_hdl, tile_data_nj, extent) BIND(C) + USE ISO_C_BINDING + INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl + INTEGER (KIND=C_INT) , DIMENSION(*) :: tile_data_nj + INTEGER (kind = C_INT), DIMENSION(*) :: extent + END SUBROUTINE cxios_get_domaingroup_tile_data_nj + + FUNCTION cxios_is_defined_domaingroup_tile_data_nj(domaingroup_hdl) BIND(C) + USE ISO_C_BINDING + LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_tile_data_nj + INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl + END FUNCTION cxios_is_defined_domaingroup_tile_data_nj + + + SUBROUTINE cxios_set_domaingroup_tile_ibegin(domaingroup_hdl, tile_ibegin, extent) BIND(C) + USE ISO_C_BINDING + INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl + INTEGER (KIND=C_INT) , DIMENSION(*) :: tile_ibegin + INTEGER (kind = C_INT), DIMENSION(*) :: extent + END SUBROUTINE cxios_set_domaingroup_tile_ibegin + + SUBROUTINE cxios_get_domaingroup_tile_ibegin(domaingroup_hdl, tile_ibegin, extent) BIND(C) + USE ISO_C_BINDING + INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl + INTEGER (KIND=C_INT) , DIMENSION(*) :: tile_ibegin + INTEGER (kind = C_INT), DIMENSION(*) :: extent + END SUBROUTINE cxios_get_domaingroup_tile_ibegin + + FUNCTION cxios_is_defined_domaingroup_tile_ibegin(domaingroup_hdl) BIND(C) + USE ISO_C_BINDING + LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_tile_ibegin + INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl + END FUNCTION cxios_is_defined_domaingroup_tile_ibegin + + + SUBROUTINE cxios_set_domaingroup_tile_jbegin(domaingroup_hdl, tile_jbegin, extent) BIND(C) + USE ISO_C_BINDING + INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl + INTEGER (KIND=C_INT) , DIMENSION(*) :: tile_jbegin + INTEGER (kind = C_INT), DIMENSION(*) :: extent + END SUBROUTINE cxios_set_domaingroup_tile_jbegin + + SUBROUTINE cxios_get_domaingroup_tile_jbegin(domaingroup_hdl, tile_jbegin, extent) BIND(C) + USE ISO_C_BINDING + INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl + INTEGER (KIND=C_INT) , DIMENSION(*) :: tile_jbegin + INTEGER (kind = C_INT), DIMENSION(*) :: extent + END SUBROUTINE cxios_get_domaingroup_tile_jbegin + + FUNCTION cxios_is_defined_domaingroup_tile_jbegin(domaingroup_hdl) BIND(C) + USE ISO_C_BINDING + LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_tile_jbegin + INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl + END FUNCTION cxios_is_defined_domaingroup_tile_jbegin + + + SUBROUTINE cxios_set_domaingroup_tile_ni(domaingroup_hdl, tile_ni, extent) BIND(C) + USE ISO_C_BINDING + INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl + INTEGER (KIND=C_INT) , DIMENSION(*) :: tile_ni + INTEGER (kind = C_INT), DIMENSION(*) :: extent + END SUBROUTINE cxios_set_domaingroup_tile_ni + + SUBROUTINE cxios_get_domaingroup_tile_ni(domaingroup_hdl, tile_ni, extent) BIND(C) + USE ISO_C_BINDING + INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl + INTEGER (KIND=C_INT) , DIMENSION(*) :: tile_ni + INTEGER (kind = C_INT), DIMENSION(*) :: extent + END SUBROUTINE cxios_get_domaingroup_tile_ni + + FUNCTION cxios_is_defined_domaingroup_tile_ni(domaingroup_hdl) BIND(C) + USE ISO_C_BINDING + LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_tile_ni + INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl + END FUNCTION cxios_is_defined_domaingroup_tile_ni + + + SUBROUTINE cxios_set_domaingroup_tile_nj(domaingroup_hdl, tile_nj, extent) BIND(C) + USE ISO_C_BINDING + INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl + INTEGER (KIND=C_INT) , DIMENSION(*) :: tile_nj + INTEGER (kind = C_INT), DIMENSION(*) :: extent + END SUBROUTINE cxios_set_domaingroup_tile_nj + + SUBROUTINE cxios_get_domaingroup_tile_nj(domaingroup_hdl, tile_nj, extent) BIND(C) + USE ISO_C_BINDING + INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl + INTEGER (KIND=C_INT) , DIMENSION(*) :: tile_nj + INTEGER (kind = C_INT), DIMENSION(*) :: extent + END SUBROUTINE cxios_get_domaingroup_tile_nj + + FUNCTION cxios_is_defined_domaingroup_tile_nj(domaingroup_hdl) BIND(C) + USE ISO_C_BINDING + LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_tile_nj + INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl + END FUNCTION cxios_is_defined_domaingroup_tile_nj + + SUBROUTINE cxios_set_domaingroup_type(domaingroup_hdl, type, type_size) BIND(C) USE ISO_C_BINDING INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl diff --git a/xios_2311_src/src/interface/fortran_attr/extract_axis_interface_attr.F90 b/xios_2311_src/src/interface/fortran_attr/extract_axis_interface_attr.F90 deleted file mode 100644 index 549adcddf3545f62868861ffd1a78c1302465651..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/interface/fortran_attr/extract_axis_interface_attr.F90 +++ /dev/null @@ -1,72 +0,0 @@ -! * ************************************************************************** * -! * Interface auto generated - do not modify * -! * ************************************************************************** * -#include "../fortran/xios_fortran_prefix.hpp" - -MODULE extract_axis_interface_attr - USE, INTRINSIC :: ISO_C_BINDING - - INTERFACE - ! Do not call directly / interface FORTRAN 2003 <-> C99 - - SUBROUTINE cxios_set_extract_axis_begin(extract_axis_hdl, begin) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: extract_axis_hdl - INTEGER (KIND=C_INT) , VALUE :: begin - END SUBROUTINE cxios_set_extract_axis_begin - - SUBROUTINE cxios_get_extract_axis_begin(extract_axis_hdl, begin) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: extract_axis_hdl - INTEGER (KIND=C_INT) :: begin - END SUBROUTINE cxios_get_extract_axis_begin - - FUNCTION cxios_is_defined_extract_axis_begin(extract_axis_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_extract_axis_begin - INTEGER (kind = C_INTPTR_T), VALUE :: extract_axis_hdl - END FUNCTION cxios_is_defined_extract_axis_begin - - - SUBROUTINE cxios_set_extract_axis_index(extract_axis_hdl, index, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: extract_axis_hdl - INTEGER (KIND=C_INT) , DIMENSION(*) :: index - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_set_extract_axis_index - - SUBROUTINE cxios_get_extract_axis_index(extract_axis_hdl, index, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: extract_axis_hdl - INTEGER (KIND=C_INT) , DIMENSION(*) :: index - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_get_extract_axis_index - - FUNCTION cxios_is_defined_extract_axis_index(extract_axis_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_extract_axis_index - INTEGER (kind = C_INTPTR_T), VALUE :: extract_axis_hdl - END FUNCTION cxios_is_defined_extract_axis_index - - - SUBROUTINE cxios_set_extract_axis_n(extract_axis_hdl, n) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: extract_axis_hdl - INTEGER (KIND=C_INT) , VALUE :: n - END SUBROUTINE cxios_set_extract_axis_n - - SUBROUTINE cxios_get_extract_axis_n(extract_axis_hdl, n) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: extract_axis_hdl - INTEGER (KIND=C_INT) :: n - END SUBROUTINE cxios_get_extract_axis_n - - FUNCTION cxios_is_defined_extract_axis_n(extract_axis_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_extract_axis_n - INTEGER (kind = C_INTPTR_T), VALUE :: extract_axis_hdl - END FUNCTION cxios_is_defined_extract_axis_n - - END INTERFACE - -END MODULE extract_axis_interface_attr diff --git a/xios_2311_src/src/interface/fortran_attr/icontext_attr.F90 b/xios_2311_src/src/interface/fortran_attr/icontext_attr.F90 index a634a2086089d7ae28669ccb5bb6893333f40f86..32950a28d7cd3dd9eae67350939b6d7f4d9c2e87 100644 --- a/xios_2311_src/src/interface/fortran_attr/icontext_attr.F90 +++ b/xios_2311_src/src/interface/fortran_attr/icontext_attr.F90 @@ -11,51 +11,39 @@ MODULE icontext_attr CONTAINS SUBROUTINE xios(set_context_attr) & - ( context_id, attached_mode, output_dir ) + ( context_id, output_dir ) IMPLICIT NONE TYPE(txios(context)) :: context_hdl CHARACTER(LEN=*), INTENT(IN) ::context_id - LOGICAL , OPTIONAL, INTENT(IN) :: attached_mode - LOGICAL (KIND=C_BOOL) :: attached_mode_tmp CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: output_dir CALL xios(get_context_handle) & (context_id,context_hdl) CALL xios(set_context_attr_hdl_) & - ( context_hdl, attached_mode, output_dir ) + ( context_hdl, output_dir ) END SUBROUTINE xios(set_context_attr) SUBROUTINE xios(set_context_attr_hdl) & - ( context_hdl, attached_mode, output_dir ) + ( context_hdl, output_dir ) IMPLICIT NONE TYPE(txios(context)) , INTENT(IN) :: context_hdl - LOGICAL , OPTIONAL, INTENT(IN) :: attached_mode - LOGICAL (KIND=C_BOOL) :: attached_mode_tmp CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: output_dir CALL xios(set_context_attr_hdl_) & - ( context_hdl, attached_mode, output_dir ) + ( context_hdl, output_dir ) END SUBROUTINE xios(set_context_attr_hdl) SUBROUTINE xios(set_context_attr_hdl_) & - ( context_hdl, attached_mode_, output_dir_ ) + ( context_hdl, output_dir_ ) IMPLICIT NONE TYPE(txios(context)) , INTENT(IN) :: context_hdl - LOGICAL , OPTIONAL, INTENT(IN) :: attached_mode_ - LOGICAL (KIND=C_BOOL) :: attached_mode__tmp CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: output_dir_ - IF (PRESENT(attached_mode_)) THEN - attached_mode__tmp = attached_mode_ - CALL cxios_set_context_attached_mode & - (context_hdl%daddr, attached_mode__tmp) - ENDIF - IF (PRESENT(output_dir_)) THEN CALL cxios_set_context_output_dir & (context_hdl%daddr, output_dir_, len(output_dir_)) @@ -64,51 +52,39 @@ CONTAINS END SUBROUTINE xios(set_context_attr_hdl_) SUBROUTINE xios(get_context_attr) & - ( context_id, attached_mode, output_dir ) + ( context_id, output_dir ) IMPLICIT NONE TYPE(txios(context)) :: context_hdl CHARACTER(LEN=*), INTENT(IN) ::context_id - LOGICAL , OPTIONAL, INTENT(OUT) :: attached_mode - LOGICAL (KIND=C_BOOL) :: attached_mode_tmp CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: output_dir CALL xios(get_context_handle) & (context_id,context_hdl) CALL xios(get_context_attr_hdl_) & - ( context_hdl, attached_mode, output_dir ) + ( context_hdl, output_dir ) END SUBROUTINE xios(get_context_attr) SUBROUTINE xios(get_context_attr_hdl) & - ( context_hdl, attached_mode, output_dir ) + ( context_hdl, output_dir ) IMPLICIT NONE TYPE(txios(context)) , INTENT(IN) :: context_hdl - LOGICAL , OPTIONAL, INTENT(OUT) :: attached_mode - LOGICAL (KIND=C_BOOL) :: attached_mode_tmp CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: output_dir CALL xios(get_context_attr_hdl_) & - ( context_hdl, attached_mode, output_dir ) + ( context_hdl, output_dir ) END SUBROUTINE xios(get_context_attr_hdl) SUBROUTINE xios(get_context_attr_hdl_) & - ( context_hdl, attached_mode_, output_dir_ ) + ( context_hdl, output_dir_ ) IMPLICIT NONE TYPE(txios(context)) , INTENT(IN) :: context_hdl - LOGICAL , OPTIONAL, INTENT(OUT) :: attached_mode_ - LOGICAL (KIND=C_BOOL) :: attached_mode__tmp CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: output_dir_ - IF (PRESENT(attached_mode_)) THEN - CALL cxios_get_context_attached_mode & - (context_hdl%daddr, attached_mode__tmp) - attached_mode_ = attached_mode__tmp - ENDIF - IF (PRESENT(output_dir_)) THEN CALL cxios_get_context_output_dir & (context_hdl%daddr, output_dir_, len(output_dir_)) @@ -117,54 +93,42 @@ CONTAINS END SUBROUTINE xios(get_context_attr_hdl_) SUBROUTINE xios(is_defined_context_attr) & - ( context_id, attached_mode, output_dir ) + ( context_id, output_dir ) IMPLICIT NONE TYPE(txios(context)) :: context_hdl CHARACTER(LEN=*), INTENT(IN) ::context_id - LOGICAL, OPTIONAL, INTENT(OUT) :: attached_mode - LOGICAL(KIND=C_BOOL) :: attached_mode_tmp LOGICAL, OPTIONAL, INTENT(OUT) :: output_dir LOGICAL(KIND=C_BOOL) :: output_dir_tmp CALL xios(get_context_handle) & (context_id,context_hdl) CALL xios(is_defined_context_attr_hdl_) & - ( context_hdl, attached_mode, output_dir ) + ( context_hdl, output_dir ) END SUBROUTINE xios(is_defined_context_attr) SUBROUTINE xios(is_defined_context_attr_hdl) & - ( context_hdl, attached_mode, output_dir ) + ( context_hdl, output_dir ) IMPLICIT NONE TYPE(txios(context)) , INTENT(IN) :: context_hdl - LOGICAL, OPTIONAL, INTENT(OUT) :: attached_mode - LOGICAL(KIND=C_BOOL) :: attached_mode_tmp LOGICAL, OPTIONAL, INTENT(OUT) :: output_dir LOGICAL(KIND=C_BOOL) :: output_dir_tmp CALL xios(is_defined_context_attr_hdl_) & - ( context_hdl, attached_mode, output_dir ) + ( context_hdl, output_dir ) END SUBROUTINE xios(is_defined_context_attr_hdl) SUBROUTINE xios(is_defined_context_attr_hdl_) & - ( context_hdl, attached_mode_, output_dir_ ) + ( context_hdl, output_dir_ ) IMPLICIT NONE TYPE(txios(context)) , INTENT(IN) :: context_hdl - LOGICAL, OPTIONAL, INTENT(OUT) :: attached_mode_ - LOGICAL(KIND=C_BOOL) :: attached_mode__tmp LOGICAL, OPTIONAL, INTENT(OUT) :: output_dir_ LOGICAL(KIND=C_BOOL) :: output_dir__tmp - IF (PRESENT(attached_mode_)) THEN - attached_mode__tmp = cxios_is_defined_context_attached_mode & - (context_hdl%daddr) - attached_mode_ = attached_mode__tmp - ENDIF - IF (PRESENT(output_dir_)) THEN output_dir__tmp = cxios_is_defined_context_output_dir & (context_hdl%daddr) diff --git a/xios_2311_src/src/interface/fortran_attr/idomain_attr.F90 b/xios_2311_src/src/interface/fortran_attr/idomain_attr.F90 index 0050a1f4d26b894eb6c79bdd23a09f50d165578a..1800c31d6784b2bfcdcb2b79f09ed85109a75167 100644 --- a/xios_2311_src/src/interface/fortran_attr/idomain_attr.F90 +++ b/xios_2311_src/src/interface/fortran_attr/idomain_attr.F90 @@ -15,7 +15,8 @@ CONTAINS , bounds_lon_name, comment, data_dim, data_i_index, data_ibegin, data_j_index, data_jbegin, data_ni & , data_nj, dim_i_name, dim_j_name, domain_ref, i_index, ibegin, j_index, jbegin, lat_name, latvalue_1d & , latvalue_2d, lon_name, long_name, lonvalue_1d, lonvalue_2d, mask_1d, mask_2d, name, ni, ni_glo & - , nj, nj_glo, nvertex, prec, radius, standard_name, type ) + , nj, nj_glo, ntiles, nvertex, prec, radius, standard_name, tile_data_ibegin, tile_data_jbegin & + , tile_data_ni, tile_data_nj, tile_ibegin, tile_jbegin, tile_ni, tile_nj, type ) IMPLICIT NONE TYPE(txios(domain)) :: domain_hdl @@ -58,10 +59,19 @@ CONTAINS INTEGER , OPTIONAL, INTENT(IN) :: ni_glo INTEGER , OPTIONAL, INTENT(IN) :: nj INTEGER , OPTIONAL, INTENT(IN) :: nj_glo + INTEGER , OPTIONAL, INTENT(IN) :: ntiles INTEGER , OPTIONAL, INTENT(IN) :: nvertex INTEGER , OPTIONAL, INTENT(IN) :: prec REAL (KIND=8) , OPTIONAL, INTENT(IN) :: radius CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: standard_name + INTEGER , OPTIONAL, INTENT(IN) :: tile_data_ibegin(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_data_jbegin(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_data_ni(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_data_nj(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_ibegin(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_jbegin(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_ni(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_nj(:) CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type CALL xios(get_domain_handle) & @@ -71,7 +81,8 @@ CONTAINS , bounds_lon_name, comment, data_dim, data_i_index, data_ibegin, data_j_index, data_jbegin, data_ni & , data_nj, dim_i_name, dim_j_name, domain_ref, i_index, ibegin, j_index, jbegin, lat_name, latvalue_1d & , latvalue_2d, lon_name, long_name, lonvalue_1d, lonvalue_2d, mask_1d, mask_2d, name, ni, ni_glo & - , nj, nj_glo, nvertex, prec, radius, standard_name, type ) + , nj, nj_glo, ntiles, nvertex, prec, radius, standard_name, tile_data_ibegin, tile_data_jbegin & + , tile_data_ni, tile_data_nj, tile_ibegin, tile_jbegin, tile_ni, tile_nj, type ) END SUBROUTINE xios(set_domain_attr) @@ -80,7 +91,8 @@ CONTAINS , bounds_lon_name, comment, data_dim, data_i_index, data_ibegin, data_j_index, data_jbegin, data_ni & , data_nj, dim_i_name, dim_j_name, domain_ref, i_index, ibegin, j_index, jbegin, lat_name, latvalue_1d & , latvalue_2d, lon_name, long_name, lonvalue_1d, lonvalue_2d, mask_1d, mask_2d, name, ni, ni_glo & - , nj, nj_glo, nvertex, prec, radius, standard_name, type ) + , nj, nj_glo, ntiles, nvertex, prec, radius, standard_name, tile_data_ibegin, tile_data_jbegin & + , tile_data_ni, tile_data_nj, tile_ibegin, tile_jbegin, tile_ni, tile_nj, type ) IMPLICIT NONE TYPE(txios(domain)) , INTENT(IN) :: domain_hdl @@ -122,10 +134,19 @@ CONTAINS INTEGER , OPTIONAL, INTENT(IN) :: ni_glo INTEGER , OPTIONAL, INTENT(IN) :: nj INTEGER , OPTIONAL, INTENT(IN) :: nj_glo + INTEGER , OPTIONAL, INTENT(IN) :: ntiles INTEGER , OPTIONAL, INTENT(IN) :: nvertex INTEGER , OPTIONAL, INTENT(IN) :: prec REAL (KIND=8) , OPTIONAL, INTENT(IN) :: radius CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: standard_name + INTEGER , OPTIONAL, INTENT(IN) :: tile_data_ibegin(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_data_jbegin(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_data_ni(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_data_nj(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_ibegin(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_jbegin(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_ni(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_nj(:) CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type CALL xios(set_domain_attr_hdl_) & @@ -133,7 +154,8 @@ CONTAINS , bounds_lon_name, comment, data_dim, data_i_index, data_ibegin, data_j_index, data_jbegin, data_ni & , data_nj, dim_i_name, dim_j_name, domain_ref, i_index, ibegin, j_index, jbegin, lat_name, latvalue_1d & , latvalue_2d, lon_name, long_name, lonvalue_1d, lonvalue_2d, mask_1d, mask_2d, name, ni, ni_glo & - , nj, nj_glo, nvertex, prec, radius, standard_name, type ) + , nj, nj_glo, ntiles, nvertex, prec, radius, standard_name, tile_data_ibegin, tile_data_jbegin & + , tile_data_ni, tile_data_nj, tile_ibegin, tile_jbegin, tile_ni, tile_nj, type ) END SUBROUTINE xios(set_domain_attr_hdl) @@ -142,8 +164,9 @@ CONTAINS , bounds_lon_name_, comment_, data_dim_, data_i_index_, data_ibegin_, data_j_index_, data_jbegin_ & , data_ni_, data_nj_, dim_i_name_, dim_j_name_, domain_ref_, i_index_, ibegin_, j_index_, jbegin_ & , lat_name_, latvalue_1d_, latvalue_2d_, lon_name_, long_name_, lonvalue_1d_, lonvalue_2d_, mask_1d_ & - , mask_2d_, name_, ni_, ni_glo_, nj_, nj_glo_, nvertex_, prec_, radius_, standard_name_, type_ & - ) + , mask_2d_, name_, ni_, ni_glo_, nj_, nj_glo_, ntiles_, nvertex_, prec_, radius_, standard_name_ & + , tile_data_ibegin_, tile_data_jbegin_, tile_data_ni_, tile_data_nj_, tile_ibegin_, tile_jbegin_ & + , tile_ni_, tile_nj_, type_ ) IMPLICIT NONE TYPE(txios(domain)) , INTENT(IN) :: domain_hdl @@ -185,10 +208,19 @@ CONTAINS INTEGER , OPTIONAL, INTENT(IN) :: ni_glo_ INTEGER , OPTIONAL, INTENT(IN) :: nj_ INTEGER , OPTIONAL, INTENT(IN) :: nj_glo_ + INTEGER , OPTIONAL, INTENT(IN) :: ntiles_ INTEGER , OPTIONAL, INTENT(IN) :: nvertex_ INTEGER , OPTIONAL, INTENT(IN) :: prec_ REAL (KIND=8) , OPTIONAL, INTENT(IN) :: radius_ CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: standard_name_ + INTEGER , OPTIONAL, INTENT(IN) :: tile_data_ibegin_(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_data_jbegin_(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_data_ni_(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_data_nj_(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_ibegin_(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_jbegin_(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_ni_(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_nj_(:) CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type_ IF (PRESENT(area_)) THEN @@ -375,6 +407,11 @@ CONTAINS (domain_hdl%daddr, nj_glo_) ENDIF + IF (PRESENT(ntiles_)) THEN + CALL cxios_set_domain_ntiles & + (domain_hdl%daddr, ntiles_) + ENDIF + IF (PRESENT(nvertex_)) THEN CALL cxios_set_domain_nvertex & (domain_hdl%daddr, nvertex_) @@ -395,6 +432,46 @@ CONTAINS (domain_hdl%daddr, standard_name_, len(standard_name_)) ENDIF + IF (PRESENT(tile_data_ibegin_)) THEN + CALL cxios_set_domain_tile_data_ibegin & + (domain_hdl%daddr, tile_data_ibegin_, SHAPE(tile_data_ibegin_)) + ENDIF + + IF (PRESENT(tile_data_jbegin_)) THEN + CALL cxios_set_domain_tile_data_jbegin & + (domain_hdl%daddr, tile_data_jbegin_, SHAPE(tile_data_jbegin_)) + ENDIF + + IF (PRESENT(tile_data_ni_)) THEN + CALL cxios_set_domain_tile_data_ni & + (domain_hdl%daddr, tile_data_ni_, SHAPE(tile_data_ni_)) + ENDIF + + IF (PRESENT(tile_data_nj_)) THEN + CALL cxios_set_domain_tile_data_nj & + (domain_hdl%daddr, tile_data_nj_, SHAPE(tile_data_nj_)) + ENDIF + + IF (PRESENT(tile_ibegin_)) THEN + CALL cxios_set_domain_tile_ibegin & + (domain_hdl%daddr, tile_ibegin_, SHAPE(tile_ibegin_)) + ENDIF + + IF (PRESENT(tile_jbegin_)) THEN + CALL cxios_set_domain_tile_jbegin & + (domain_hdl%daddr, tile_jbegin_, SHAPE(tile_jbegin_)) + ENDIF + + IF (PRESENT(tile_ni_)) THEN + CALL cxios_set_domain_tile_ni & + (domain_hdl%daddr, tile_ni_, SHAPE(tile_ni_)) + ENDIF + + IF (PRESENT(tile_nj_)) THEN + CALL cxios_set_domain_tile_nj & + (domain_hdl%daddr, tile_nj_, SHAPE(tile_nj_)) + ENDIF + IF (PRESENT(type_)) THEN CALL cxios_set_domain_type & (domain_hdl%daddr, type_, len(type_)) @@ -407,7 +484,8 @@ CONTAINS , bounds_lon_name, comment, data_dim, data_i_index, data_ibegin, data_j_index, data_jbegin, data_ni & , data_nj, dim_i_name, dim_j_name, domain_ref, i_index, ibegin, j_index, jbegin, lat_name, latvalue_1d & , latvalue_2d, lon_name, long_name, lonvalue_1d, lonvalue_2d, mask_1d, mask_2d, name, ni, ni_glo & - , nj, nj_glo, nvertex, prec, radius, standard_name, type ) + , nj, nj_glo, ntiles, nvertex, prec, radius, standard_name, tile_data_ibegin, tile_data_jbegin & + , tile_data_ni, tile_data_nj, tile_ibegin, tile_jbegin, tile_ni, tile_nj, type ) IMPLICIT NONE TYPE(txios(domain)) :: domain_hdl @@ -450,10 +528,19 @@ CONTAINS INTEGER , OPTIONAL, INTENT(OUT) :: ni_glo INTEGER , OPTIONAL, INTENT(OUT) :: nj INTEGER , OPTIONAL, INTENT(OUT) :: nj_glo + INTEGER , OPTIONAL, INTENT(OUT) :: ntiles INTEGER , OPTIONAL, INTENT(OUT) :: nvertex INTEGER , OPTIONAL, INTENT(OUT) :: prec REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: radius CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: standard_name + INTEGER , OPTIONAL, INTENT(OUT) :: tile_data_ibegin(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_data_jbegin(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_data_ni(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_data_nj(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_ibegin(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_jbegin(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_ni(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_nj(:) CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type CALL xios(get_domain_handle) & @@ -463,7 +550,8 @@ CONTAINS , bounds_lon_name, comment, data_dim, data_i_index, data_ibegin, data_j_index, data_jbegin, data_ni & , data_nj, dim_i_name, dim_j_name, domain_ref, i_index, ibegin, j_index, jbegin, lat_name, latvalue_1d & , latvalue_2d, lon_name, long_name, lonvalue_1d, lonvalue_2d, mask_1d, mask_2d, name, ni, ni_glo & - , nj, nj_glo, nvertex, prec, radius, standard_name, type ) + , nj, nj_glo, ntiles, nvertex, prec, radius, standard_name, tile_data_ibegin, tile_data_jbegin & + , tile_data_ni, tile_data_nj, tile_ibegin, tile_jbegin, tile_ni, tile_nj, type ) END SUBROUTINE xios(get_domain_attr) @@ -472,7 +560,8 @@ CONTAINS , bounds_lon_name, comment, data_dim, data_i_index, data_ibegin, data_j_index, data_jbegin, data_ni & , data_nj, dim_i_name, dim_j_name, domain_ref, i_index, ibegin, j_index, jbegin, lat_name, latvalue_1d & , latvalue_2d, lon_name, long_name, lonvalue_1d, lonvalue_2d, mask_1d, mask_2d, name, ni, ni_glo & - , nj, nj_glo, nvertex, prec, radius, standard_name, type ) + , nj, nj_glo, ntiles, nvertex, prec, radius, standard_name, tile_data_ibegin, tile_data_jbegin & + , tile_data_ni, tile_data_nj, tile_ibegin, tile_jbegin, tile_ni, tile_nj, type ) IMPLICIT NONE TYPE(txios(domain)) , INTENT(IN) :: domain_hdl @@ -514,10 +603,19 @@ CONTAINS INTEGER , OPTIONAL, INTENT(OUT) :: ni_glo INTEGER , OPTIONAL, INTENT(OUT) :: nj INTEGER , OPTIONAL, INTENT(OUT) :: nj_glo + INTEGER , OPTIONAL, INTENT(OUT) :: ntiles INTEGER , OPTIONAL, INTENT(OUT) :: nvertex INTEGER , OPTIONAL, INTENT(OUT) :: prec REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: radius CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: standard_name + INTEGER , OPTIONAL, INTENT(OUT) :: tile_data_ibegin(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_data_jbegin(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_data_ni(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_data_nj(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_ibegin(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_jbegin(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_ni(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_nj(:) CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type CALL xios(get_domain_attr_hdl_) & @@ -525,7 +623,8 @@ CONTAINS , bounds_lon_name, comment, data_dim, data_i_index, data_ibegin, data_j_index, data_jbegin, data_ni & , data_nj, dim_i_name, dim_j_name, domain_ref, i_index, ibegin, j_index, jbegin, lat_name, latvalue_1d & , latvalue_2d, lon_name, long_name, lonvalue_1d, lonvalue_2d, mask_1d, mask_2d, name, ni, ni_glo & - , nj, nj_glo, nvertex, prec, radius, standard_name, type ) + , nj, nj_glo, ntiles, nvertex, prec, radius, standard_name, tile_data_ibegin, tile_data_jbegin & + , tile_data_ni, tile_data_nj, tile_ibegin, tile_jbegin, tile_ni, tile_nj, type ) END SUBROUTINE xios(get_domain_attr_hdl) @@ -534,8 +633,9 @@ CONTAINS , bounds_lon_name_, comment_, data_dim_, data_i_index_, data_ibegin_, data_j_index_, data_jbegin_ & , data_ni_, data_nj_, dim_i_name_, dim_j_name_, domain_ref_, i_index_, ibegin_, j_index_, jbegin_ & , lat_name_, latvalue_1d_, latvalue_2d_, lon_name_, long_name_, lonvalue_1d_, lonvalue_2d_, mask_1d_ & - , mask_2d_, name_, ni_, ni_glo_, nj_, nj_glo_, nvertex_, prec_, radius_, standard_name_, type_ & - ) + , mask_2d_, name_, ni_, ni_glo_, nj_, nj_glo_, ntiles_, nvertex_, prec_, radius_, standard_name_ & + , tile_data_ibegin_, tile_data_jbegin_, tile_data_ni_, tile_data_nj_, tile_ibegin_, tile_jbegin_ & + , tile_ni_, tile_nj_, type_ ) IMPLICIT NONE TYPE(txios(domain)) , INTENT(IN) :: domain_hdl @@ -577,10 +677,19 @@ CONTAINS INTEGER , OPTIONAL, INTENT(OUT) :: ni_glo_ INTEGER , OPTIONAL, INTENT(OUT) :: nj_ INTEGER , OPTIONAL, INTENT(OUT) :: nj_glo_ + INTEGER , OPTIONAL, INTENT(OUT) :: ntiles_ INTEGER , OPTIONAL, INTENT(OUT) :: nvertex_ INTEGER , OPTIONAL, INTENT(OUT) :: prec_ REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: radius_ CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: standard_name_ + INTEGER , OPTIONAL, INTENT(OUT) :: tile_data_ibegin_(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_data_jbegin_(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_data_ni_(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_data_nj_(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_ibegin_(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_jbegin_(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_ni_(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_nj_(:) CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type_ IF (PRESENT(area_)) THEN @@ -767,6 +876,11 @@ CONTAINS (domain_hdl%daddr, nj_glo_) ENDIF + IF (PRESENT(ntiles_)) THEN + CALL cxios_get_domain_ntiles & + (domain_hdl%daddr, ntiles_) + ENDIF + IF (PRESENT(nvertex_)) THEN CALL cxios_get_domain_nvertex & (domain_hdl%daddr, nvertex_) @@ -787,6 +901,46 @@ CONTAINS (domain_hdl%daddr, standard_name_, len(standard_name_)) ENDIF + IF (PRESENT(tile_data_ibegin_)) THEN + CALL cxios_get_domain_tile_data_ibegin & + (domain_hdl%daddr, tile_data_ibegin_, SHAPE(tile_data_ibegin_)) + ENDIF + + IF (PRESENT(tile_data_jbegin_)) THEN + CALL cxios_get_domain_tile_data_jbegin & + (domain_hdl%daddr, tile_data_jbegin_, SHAPE(tile_data_jbegin_)) + ENDIF + + IF (PRESENT(tile_data_ni_)) THEN + CALL cxios_get_domain_tile_data_ni & + (domain_hdl%daddr, tile_data_ni_, SHAPE(tile_data_ni_)) + ENDIF + + IF (PRESENT(tile_data_nj_)) THEN + CALL cxios_get_domain_tile_data_nj & + (domain_hdl%daddr, tile_data_nj_, SHAPE(tile_data_nj_)) + ENDIF + + IF (PRESENT(tile_ibegin_)) THEN + CALL cxios_get_domain_tile_ibegin & + (domain_hdl%daddr, tile_ibegin_, SHAPE(tile_ibegin_)) + ENDIF + + IF (PRESENT(tile_jbegin_)) THEN + CALL cxios_get_domain_tile_jbegin & + (domain_hdl%daddr, tile_jbegin_, SHAPE(tile_jbegin_)) + ENDIF + + IF (PRESENT(tile_ni_)) THEN + CALL cxios_get_domain_tile_ni & + (domain_hdl%daddr, tile_ni_, SHAPE(tile_ni_)) + ENDIF + + IF (PRESENT(tile_nj_)) THEN + CALL cxios_get_domain_tile_nj & + (domain_hdl%daddr, tile_nj_, SHAPE(tile_nj_)) + ENDIF + IF (PRESENT(type_)) THEN CALL cxios_get_domain_type & (domain_hdl%daddr, type_, len(type_)) @@ -799,7 +953,8 @@ CONTAINS , bounds_lon_name, comment, data_dim, data_i_index, data_ibegin, data_j_index, data_jbegin, data_ni & , data_nj, dim_i_name, dim_j_name, domain_ref, i_index, ibegin, j_index, jbegin, lat_name, latvalue_1d & , latvalue_2d, lon_name, long_name, lonvalue_1d, lonvalue_2d, mask_1d, mask_2d, name, ni, ni_glo & - , nj, nj_glo, nvertex, prec, radius, standard_name, type ) + , nj, nj_glo, ntiles, nvertex, prec, radius, standard_name, tile_data_ibegin, tile_data_jbegin & + , tile_data_ni, tile_data_nj, tile_ibegin, tile_jbegin, tile_ni, tile_nj, type ) IMPLICIT NONE TYPE(txios(domain)) :: domain_hdl @@ -876,6 +1031,8 @@ CONTAINS LOGICAL(KIND=C_BOOL) :: nj_tmp LOGICAL, OPTIONAL, INTENT(OUT) :: nj_glo LOGICAL(KIND=C_BOOL) :: nj_glo_tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: ntiles + LOGICAL(KIND=C_BOOL) :: ntiles_tmp LOGICAL, OPTIONAL, INTENT(OUT) :: nvertex LOGICAL(KIND=C_BOOL) :: nvertex_tmp LOGICAL, OPTIONAL, INTENT(OUT) :: prec @@ -884,6 +1041,22 @@ CONTAINS LOGICAL(KIND=C_BOOL) :: radius_tmp LOGICAL, OPTIONAL, INTENT(OUT) :: standard_name LOGICAL(KIND=C_BOOL) :: standard_name_tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_data_ibegin + LOGICAL(KIND=C_BOOL) :: tile_data_ibegin_tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_data_jbegin + LOGICAL(KIND=C_BOOL) :: tile_data_jbegin_tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_data_ni + LOGICAL(KIND=C_BOOL) :: tile_data_ni_tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_data_nj + LOGICAL(KIND=C_BOOL) :: tile_data_nj_tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_ibegin + LOGICAL(KIND=C_BOOL) :: tile_ibegin_tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_jbegin + LOGICAL(KIND=C_BOOL) :: tile_jbegin_tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_ni + LOGICAL(KIND=C_BOOL) :: tile_ni_tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_nj + LOGICAL(KIND=C_BOOL) :: tile_nj_tmp LOGICAL, OPTIONAL, INTENT(OUT) :: type LOGICAL(KIND=C_BOOL) :: type_tmp @@ -894,7 +1067,8 @@ CONTAINS , bounds_lon_name, comment, data_dim, data_i_index, data_ibegin, data_j_index, data_jbegin, data_ni & , data_nj, dim_i_name, dim_j_name, domain_ref, i_index, ibegin, j_index, jbegin, lat_name, latvalue_1d & , latvalue_2d, lon_name, long_name, lonvalue_1d, lonvalue_2d, mask_1d, mask_2d, name, ni, ni_glo & - , nj, nj_glo, nvertex, prec, radius, standard_name, type ) + , nj, nj_glo, ntiles, nvertex, prec, radius, standard_name, tile_data_ibegin, tile_data_jbegin & + , tile_data_ni, tile_data_nj, tile_ibegin, tile_jbegin, tile_ni, tile_nj, type ) END SUBROUTINE xios(is_defined_domain_attr) @@ -903,7 +1077,8 @@ CONTAINS , bounds_lon_name, comment, data_dim, data_i_index, data_ibegin, data_j_index, data_jbegin, data_ni & , data_nj, dim_i_name, dim_j_name, domain_ref, i_index, ibegin, j_index, jbegin, lat_name, latvalue_1d & , latvalue_2d, lon_name, long_name, lonvalue_1d, lonvalue_2d, mask_1d, mask_2d, name, ni, ni_glo & - , nj, nj_glo, nvertex, prec, radius, standard_name, type ) + , nj, nj_glo, ntiles, nvertex, prec, radius, standard_name, tile_data_ibegin, tile_data_jbegin & + , tile_data_ni, tile_data_nj, tile_ibegin, tile_jbegin, tile_ni, tile_nj, type ) IMPLICIT NONE TYPE(txios(domain)) , INTENT(IN) :: domain_hdl @@ -979,6 +1154,8 @@ CONTAINS LOGICAL(KIND=C_BOOL) :: nj_tmp LOGICAL, OPTIONAL, INTENT(OUT) :: nj_glo LOGICAL(KIND=C_BOOL) :: nj_glo_tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: ntiles + LOGICAL(KIND=C_BOOL) :: ntiles_tmp LOGICAL, OPTIONAL, INTENT(OUT) :: nvertex LOGICAL(KIND=C_BOOL) :: nvertex_tmp LOGICAL, OPTIONAL, INTENT(OUT) :: prec @@ -987,6 +1164,22 @@ CONTAINS LOGICAL(KIND=C_BOOL) :: radius_tmp LOGICAL, OPTIONAL, INTENT(OUT) :: standard_name LOGICAL(KIND=C_BOOL) :: standard_name_tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_data_ibegin + LOGICAL(KIND=C_BOOL) :: tile_data_ibegin_tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_data_jbegin + LOGICAL(KIND=C_BOOL) :: tile_data_jbegin_tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_data_ni + LOGICAL(KIND=C_BOOL) :: tile_data_ni_tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_data_nj + LOGICAL(KIND=C_BOOL) :: tile_data_nj_tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_ibegin + LOGICAL(KIND=C_BOOL) :: tile_ibegin_tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_jbegin + LOGICAL(KIND=C_BOOL) :: tile_jbegin_tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_ni + LOGICAL(KIND=C_BOOL) :: tile_ni_tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_nj + LOGICAL(KIND=C_BOOL) :: tile_nj_tmp LOGICAL, OPTIONAL, INTENT(OUT) :: type LOGICAL(KIND=C_BOOL) :: type_tmp @@ -995,7 +1188,8 @@ CONTAINS , bounds_lon_name, comment, data_dim, data_i_index, data_ibegin, data_j_index, data_jbegin, data_ni & , data_nj, dim_i_name, dim_j_name, domain_ref, i_index, ibegin, j_index, jbegin, lat_name, latvalue_1d & , latvalue_2d, lon_name, long_name, lonvalue_1d, lonvalue_2d, mask_1d, mask_2d, name, ni, ni_glo & - , nj, nj_glo, nvertex, prec, radius, standard_name, type ) + , nj, nj_glo, ntiles, nvertex, prec, radius, standard_name, tile_data_ibegin, tile_data_jbegin & + , tile_data_ni, tile_data_nj, tile_ibegin, tile_jbegin, tile_ni, tile_nj, type ) END SUBROUTINE xios(is_defined_domain_attr_hdl) @@ -1004,8 +1198,9 @@ CONTAINS , bounds_lon_name_, comment_, data_dim_, data_i_index_, data_ibegin_, data_j_index_, data_jbegin_ & , data_ni_, data_nj_, dim_i_name_, dim_j_name_, domain_ref_, i_index_, ibegin_, j_index_, jbegin_ & , lat_name_, latvalue_1d_, latvalue_2d_, lon_name_, long_name_, lonvalue_1d_, lonvalue_2d_, mask_1d_ & - , mask_2d_, name_, ni_, ni_glo_, nj_, nj_glo_, nvertex_, prec_, radius_, standard_name_, type_ & - ) + , mask_2d_, name_, ni_, ni_glo_, nj_, nj_glo_, ntiles_, nvertex_, prec_, radius_, standard_name_ & + , tile_data_ibegin_, tile_data_jbegin_, tile_data_ni_, tile_data_nj_, tile_ibegin_, tile_jbegin_ & + , tile_ni_, tile_nj_, type_ ) IMPLICIT NONE TYPE(txios(domain)) , INTENT(IN) :: domain_hdl @@ -1081,6 +1276,8 @@ CONTAINS LOGICAL(KIND=C_BOOL) :: nj__tmp LOGICAL, OPTIONAL, INTENT(OUT) :: nj_glo_ LOGICAL(KIND=C_BOOL) :: nj_glo__tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: ntiles_ + LOGICAL(KIND=C_BOOL) :: ntiles__tmp LOGICAL, OPTIONAL, INTENT(OUT) :: nvertex_ LOGICAL(KIND=C_BOOL) :: nvertex__tmp LOGICAL, OPTIONAL, INTENT(OUT) :: prec_ @@ -1089,6 +1286,22 @@ CONTAINS LOGICAL(KIND=C_BOOL) :: radius__tmp LOGICAL, OPTIONAL, INTENT(OUT) :: standard_name_ LOGICAL(KIND=C_BOOL) :: standard_name__tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_data_ibegin_ + LOGICAL(KIND=C_BOOL) :: tile_data_ibegin__tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_data_jbegin_ + LOGICAL(KIND=C_BOOL) :: tile_data_jbegin__tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_data_ni_ + LOGICAL(KIND=C_BOOL) :: tile_data_ni__tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_data_nj_ + LOGICAL(KIND=C_BOOL) :: tile_data_nj__tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_ibegin_ + LOGICAL(KIND=C_BOOL) :: tile_ibegin__tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_jbegin_ + LOGICAL(KIND=C_BOOL) :: tile_jbegin__tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_ni_ + LOGICAL(KIND=C_BOOL) :: tile_ni__tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_nj_ + LOGICAL(KIND=C_BOOL) :: tile_nj__tmp LOGICAL, OPTIONAL, INTENT(OUT) :: type_ LOGICAL(KIND=C_BOOL) :: type__tmp @@ -1308,6 +1521,12 @@ CONTAINS nj_glo_ = nj_glo__tmp ENDIF + IF (PRESENT(ntiles_)) THEN + ntiles__tmp = cxios_is_defined_domain_ntiles & + (domain_hdl%daddr) + ntiles_ = ntiles__tmp + ENDIF + IF (PRESENT(nvertex_)) THEN nvertex__tmp = cxios_is_defined_domain_nvertex & (domain_hdl%daddr) @@ -1332,6 +1551,54 @@ CONTAINS standard_name_ = standard_name__tmp ENDIF + IF (PRESENT(tile_data_ibegin_)) THEN + tile_data_ibegin__tmp = cxios_is_defined_domain_tile_data_ibegin & + (domain_hdl%daddr) + tile_data_ibegin_ = tile_data_ibegin__tmp + ENDIF + + IF (PRESENT(tile_data_jbegin_)) THEN + tile_data_jbegin__tmp = cxios_is_defined_domain_tile_data_jbegin & + (domain_hdl%daddr) + tile_data_jbegin_ = tile_data_jbegin__tmp + ENDIF + + IF (PRESENT(tile_data_ni_)) THEN + tile_data_ni__tmp = cxios_is_defined_domain_tile_data_ni & + (domain_hdl%daddr) + tile_data_ni_ = tile_data_ni__tmp + ENDIF + + IF (PRESENT(tile_data_nj_)) THEN + tile_data_nj__tmp = cxios_is_defined_domain_tile_data_nj & + (domain_hdl%daddr) + tile_data_nj_ = tile_data_nj__tmp + ENDIF + + IF (PRESENT(tile_ibegin_)) THEN + tile_ibegin__tmp = cxios_is_defined_domain_tile_ibegin & + (domain_hdl%daddr) + tile_ibegin_ = tile_ibegin__tmp + ENDIF + + IF (PRESENT(tile_jbegin_)) THEN + tile_jbegin__tmp = cxios_is_defined_domain_tile_jbegin & + (domain_hdl%daddr) + tile_jbegin_ = tile_jbegin__tmp + ENDIF + + IF (PRESENT(tile_ni_)) THEN + tile_ni__tmp = cxios_is_defined_domain_tile_ni & + (domain_hdl%daddr) + tile_ni_ = tile_ni__tmp + ENDIF + + IF (PRESENT(tile_nj_)) THEN + tile_nj__tmp = cxios_is_defined_domain_tile_nj & + (domain_hdl%daddr) + tile_nj_ = tile_nj__tmp + ENDIF + IF (PRESENT(type_)) THEN type__tmp = cxios_is_defined_domain_type & (domain_hdl%daddr) diff --git a/xios_2311_src/src/interface/fortran_attr/idomaingroup_attr.F90 b/xios_2311_src/src/interface/fortran_attr/idomaingroup_attr.F90 index f8123f69be86c8bae721b3222d612900fef558d0..624c436e4e6d902cf2cd2312bd4f906d9fbc922a 100644 --- a/xios_2311_src/src/interface/fortran_attr/idomaingroup_attr.F90 +++ b/xios_2311_src/src/interface/fortran_attr/idomaingroup_attr.F90 @@ -15,7 +15,9 @@ CONTAINS , bounds_lon_name, comment, data_dim, data_i_index, data_ibegin, data_j_index, data_jbegin, data_ni & , data_nj, dim_i_name, dim_j_name, domain_ref, group_ref, i_index, ibegin, j_index, jbegin, lat_name & , latvalue_1d, latvalue_2d, lon_name, long_name, lonvalue_1d, lonvalue_2d, mask_1d, mask_2d & - , name, ni, ni_glo, nj, nj_glo, nvertex, prec, radius, standard_name, type ) + , name, ni, ni_glo, nj, nj_glo, ntiles, nvertex, prec, radius, standard_name, tile_data_ibegin & + , tile_data_jbegin, tile_data_ni, tile_data_nj, tile_ibegin, tile_jbegin, tile_ni, tile_nj, type & + ) IMPLICIT NONE TYPE(txios(domaingroup)) :: domaingroup_hdl @@ -59,10 +61,19 @@ CONTAINS INTEGER , OPTIONAL, INTENT(IN) :: ni_glo INTEGER , OPTIONAL, INTENT(IN) :: nj INTEGER , OPTIONAL, INTENT(IN) :: nj_glo + INTEGER , OPTIONAL, INTENT(IN) :: ntiles INTEGER , OPTIONAL, INTENT(IN) :: nvertex INTEGER , OPTIONAL, INTENT(IN) :: prec REAL (KIND=8) , OPTIONAL, INTENT(IN) :: radius CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: standard_name + INTEGER , OPTIONAL, INTENT(IN) :: tile_data_ibegin(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_data_jbegin(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_data_ni(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_data_nj(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_ibegin(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_jbegin(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_ni(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_nj(:) CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type CALL xios(get_domaingroup_handle) & @@ -72,7 +83,9 @@ CONTAINS , bounds_lon_name, comment, data_dim, data_i_index, data_ibegin, data_j_index, data_jbegin, data_ni & , data_nj, dim_i_name, dim_j_name, domain_ref, group_ref, i_index, ibegin, j_index, jbegin, lat_name & , latvalue_1d, latvalue_2d, lon_name, long_name, lonvalue_1d, lonvalue_2d, mask_1d, mask_2d & - , name, ni, ni_glo, nj, nj_glo, nvertex, prec, radius, standard_name, type ) + , name, ni, ni_glo, nj, nj_glo, ntiles, nvertex, prec, radius, standard_name, tile_data_ibegin & + , tile_data_jbegin, tile_data_ni, tile_data_nj, tile_ibegin, tile_jbegin, tile_ni, tile_nj, type & + ) END SUBROUTINE xios(set_domaingroup_attr) @@ -81,7 +94,9 @@ CONTAINS , bounds_lon_name, comment, data_dim, data_i_index, data_ibegin, data_j_index, data_jbegin, data_ni & , data_nj, dim_i_name, dim_j_name, domain_ref, group_ref, i_index, ibegin, j_index, jbegin, lat_name & , latvalue_1d, latvalue_2d, lon_name, long_name, lonvalue_1d, lonvalue_2d, mask_1d, mask_2d & - , name, ni, ni_glo, nj, nj_glo, nvertex, prec, radius, standard_name, type ) + , name, ni, ni_glo, nj, nj_glo, ntiles, nvertex, prec, radius, standard_name, tile_data_ibegin & + , tile_data_jbegin, tile_data_ni, tile_data_nj, tile_ibegin, tile_jbegin, tile_ni, tile_nj, type & + ) IMPLICIT NONE TYPE(txios(domaingroup)) , INTENT(IN) :: domaingroup_hdl @@ -124,10 +139,19 @@ CONTAINS INTEGER , OPTIONAL, INTENT(IN) :: ni_glo INTEGER , OPTIONAL, INTENT(IN) :: nj INTEGER , OPTIONAL, INTENT(IN) :: nj_glo + INTEGER , OPTIONAL, INTENT(IN) :: ntiles INTEGER , OPTIONAL, INTENT(IN) :: nvertex INTEGER , OPTIONAL, INTENT(IN) :: prec REAL (KIND=8) , OPTIONAL, INTENT(IN) :: radius CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: standard_name + INTEGER , OPTIONAL, INTENT(IN) :: tile_data_ibegin(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_data_jbegin(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_data_ni(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_data_nj(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_ibegin(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_jbegin(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_ni(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_nj(:) CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type CALL xios(set_domaingroup_attr_hdl_) & @@ -135,7 +159,9 @@ CONTAINS , bounds_lon_name, comment, data_dim, data_i_index, data_ibegin, data_j_index, data_jbegin, data_ni & , data_nj, dim_i_name, dim_j_name, domain_ref, group_ref, i_index, ibegin, j_index, jbegin, lat_name & , latvalue_1d, latvalue_2d, lon_name, long_name, lonvalue_1d, lonvalue_2d, mask_1d, mask_2d & - , name, ni, ni_glo, nj, nj_glo, nvertex, prec, radius, standard_name, type ) + , name, ni, ni_glo, nj, nj_glo, ntiles, nvertex, prec, radius, standard_name, tile_data_ibegin & + , tile_data_jbegin, tile_data_ni, tile_data_nj, tile_ibegin, tile_jbegin, tile_ni, tile_nj, type & + ) END SUBROUTINE xios(set_domaingroup_attr_hdl) @@ -144,8 +170,9 @@ CONTAINS , bounds_lon_name_, comment_, data_dim_, data_i_index_, data_ibegin_, data_j_index_, data_jbegin_ & , data_ni_, data_nj_, dim_i_name_, dim_j_name_, domain_ref_, group_ref_, i_index_, ibegin_, j_index_ & , jbegin_, lat_name_, latvalue_1d_, latvalue_2d_, lon_name_, long_name_, lonvalue_1d_, lonvalue_2d_ & - , mask_1d_, mask_2d_, name_, ni_, ni_glo_, nj_, nj_glo_, nvertex_, prec_, radius_, standard_name_ & - , type_ ) + , mask_1d_, mask_2d_, name_, ni_, ni_glo_, nj_, nj_glo_, ntiles_, nvertex_, prec_, radius_, standard_name_ & + , tile_data_ibegin_, tile_data_jbegin_, tile_data_ni_, tile_data_nj_, tile_ibegin_, tile_jbegin_ & + , tile_ni_, tile_nj_, type_ ) IMPLICIT NONE TYPE(txios(domaingroup)) , INTENT(IN) :: domaingroup_hdl @@ -188,10 +215,19 @@ CONTAINS INTEGER , OPTIONAL, INTENT(IN) :: ni_glo_ INTEGER , OPTIONAL, INTENT(IN) :: nj_ INTEGER , OPTIONAL, INTENT(IN) :: nj_glo_ + INTEGER , OPTIONAL, INTENT(IN) :: ntiles_ INTEGER , OPTIONAL, INTENT(IN) :: nvertex_ INTEGER , OPTIONAL, INTENT(IN) :: prec_ REAL (KIND=8) , OPTIONAL, INTENT(IN) :: radius_ CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: standard_name_ + INTEGER , OPTIONAL, INTENT(IN) :: tile_data_ibegin_(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_data_jbegin_(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_data_ni_(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_data_nj_(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_ibegin_(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_jbegin_(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_ni_(:) + INTEGER , OPTIONAL, INTENT(IN) :: tile_nj_(:) CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type_ IF (PRESENT(area_)) THEN @@ -383,6 +419,11 @@ CONTAINS (domaingroup_hdl%daddr, nj_glo_) ENDIF + IF (PRESENT(ntiles_)) THEN + CALL cxios_set_domaingroup_ntiles & + (domaingroup_hdl%daddr, ntiles_) + ENDIF + IF (PRESENT(nvertex_)) THEN CALL cxios_set_domaingroup_nvertex & (domaingroup_hdl%daddr, nvertex_) @@ -403,6 +444,46 @@ CONTAINS (domaingroup_hdl%daddr, standard_name_, len(standard_name_)) ENDIF + IF (PRESENT(tile_data_ibegin_)) THEN + CALL cxios_set_domaingroup_tile_data_ibegin & + (domaingroup_hdl%daddr, tile_data_ibegin_, SHAPE(tile_data_ibegin_)) + ENDIF + + IF (PRESENT(tile_data_jbegin_)) THEN + CALL cxios_set_domaingroup_tile_data_jbegin & + (domaingroup_hdl%daddr, tile_data_jbegin_, SHAPE(tile_data_jbegin_)) + ENDIF + + IF (PRESENT(tile_data_ni_)) THEN + CALL cxios_set_domaingroup_tile_data_ni & + (domaingroup_hdl%daddr, tile_data_ni_, SHAPE(tile_data_ni_)) + ENDIF + + IF (PRESENT(tile_data_nj_)) THEN + CALL cxios_set_domaingroup_tile_data_nj & + (domaingroup_hdl%daddr, tile_data_nj_, SHAPE(tile_data_nj_)) + ENDIF + + IF (PRESENT(tile_ibegin_)) THEN + CALL cxios_set_domaingroup_tile_ibegin & + (domaingroup_hdl%daddr, tile_ibegin_, SHAPE(tile_ibegin_)) + ENDIF + + IF (PRESENT(tile_jbegin_)) THEN + CALL cxios_set_domaingroup_tile_jbegin & + (domaingroup_hdl%daddr, tile_jbegin_, SHAPE(tile_jbegin_)) + ENDIF + + IF (PRESENT(tile_ni_)) THEN + CALL cxios_set_domaingroup_tile_ni & + (domaingroup_hdl%daddr, tile_ni_, SHAPE(tile_ni_)) + ENDIF + + IF (PRESENT(tile_nj_)) THEN + CALL cxios_set_domaingroup_tile_nj & + (domaingroup_hdl%daddr, tile_nj_, SHAPE(tile_nj_)) + ENDIF + IF (PRESENT(type_)) THEN CALL cxios_set_domaingroup_type & (domaingroup_hdl%daddr, type_, len(type_)) @@ -415,7 +496,9 @@ CONTAINS , bounds_lon_name, comment, data_dim, data_i_index, data_ibegin, data_j_index, data_jbegin, data_ni & , data_nj, dim_i_name, dim_j_name, domain_ref, group_ref, i_index, ibegin, j_index, jbegin, lat_name & , latvalue_1d, latvalue_2d, lon_name, long_name, lonvalue_1d, lonvalue_2d, mask_1d, mask_2d & - , name, ni, ni_glo, nj, nj_glo, nvertex, prec, radius, standard_name, type ) + , name, ni, ni_glo, nj, nj_glo, ntiles, nvertex, prec, radius, standard_name, tile_data_ibegin & + , tile_data_jbegin, tile_data_ni, tile_data_nj, tile_ibegin, tile_jbegin, tile_ni, tile_nj, type & + ) IMPLICIT NONE TYPE(txios(domaingroup)) :: domaingroup_hdl @@ -459,10 +542,19 @@ CONTAINS INTEGER , OPTIONAL, INTENT(OUT) :: ni_glo INTEGER , OPTIONAL, INTENT(OUT) :: nj INTEGER , OPTIONAL, INTENT(OUT) :: nj_glo + INTEGER , OPTIONAL, INTENT(OUT) :: ntiles INTEGER , OPTIONAL, INTENT(OUT) :: nvertex INTEGER , OPTIONAL, INTENT(OUT) :: prec REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: radius CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: standard_name + INTEGER , OPTIONAL, INTENT(OUT) :: tile_data_ibegin(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_data_jbegin(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_data_ni(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_data_nj(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_ibegin(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_jbegin(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_ni(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_nj(:) CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type CALL xios(get_domaingroup_handle) & @@ -472,7 +564,9 @@ CONTAINS , bounds_lon_name, comment, data_dim, data_i_index, data_ibegin, data_j_index, data_jbegin, data_ni & , data_nj, dim_i_name, dim_j_name, domain_ref, group_ref, i_index, ibegin, j_index, jbegin, lat_name & , latvalue_1d, latvalue_2d, lon_name, long_name, lonvalue_1d, lonvalue_2d, mask_1d, mask_2d & - , name, ni, ni_glo, nj, nj_glo, nvertex, prec, radius, standard_name, type ) + , name, ni, ni_glo, nj, nj_glo, ntiles, nvertex, prec, radius, standard_name, tile_data_ibegin & + , tile_data_jbegin, tile_data_ni, tile_data_nj, tile_ibegin, tile_jbegin, tile_ni, tile_nj, type & + ) END SUBROUTINE xios(get_domaingroup_attr) @@ -481,7 +575,9 @@ CONTAINS , bounds_lon_name, comment, data_dim, data_i_index, data_ibegin, data_j_index, data_jbegin, data_ni & , data_nj, dim_i_name, dim_j_name, domain_ref, group_ref, i_index, ibegin, j_index, jbegin, lat_name & , latvalue_1d, latvalue_2d, lon_name, long_name, lonvalue_1d, lonvalue_2d, mask_1d, mask_2d & - , name, ni, ni_glo, nj, nj_glo, nvertex, prec, radius, standard_name, type ) + , name, ni, ni_glo, nj, nj_glo, ntiles, nvertex, prec, radius, standard_name, tile_data_ibegin & + , tile_data_jbegin, tile_data_ni, tile_data_nj, tile_ibegin, tile_jbegin, tile_ni, tile_nj, type & + ) IMPLICIT NONE TYPE(txios(domaingroup)) , INTENT(IN) :: domaingroup_hdl @@ -524,10 +620,19 @@ CONTAINS INTEGER , OPTIONAL, INTENT(OUT) :: ni_glo INTEGER , OPTIONAL, INTENT(OUT) :: nj INTEGER , OPTIONAL, INTENT(OUT) :: nj_glo + INTEGER , OPTIONAL, INTENT(OUT) :: ntiles INTEGER , OPTIONAL, INTENT(OUT) :: nvertex INTEGER , OPTIONAL, INTENT(OUT) :: prec REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: radius CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: standard_name + INTEGER , OPTIONAL, INTENT(OUT) :: tile_data_ibegin(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_data_jbegin(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_data_ni(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_data_nj(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_ibegin(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_jbegin(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_ni(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_nj(:) CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type CALL xios(get_domaingroup_attr_hdl_) & @@ -535,7 +640,9 @@ CONTAINS , bounds_lon_name, comment, data_dim, data_i_index, data_ibegin, data_j_index, data_jbegin, data_ni & , data_nj, dim_i_name, dim_j_name, domain_ref, group_ref, i_index, ibegin, j_index, jbegin, lat_name & , latvalue_1d, latvalue_2d, lon_name, long_name, lonvalue_1d, lonvalue_2d, mask_1d, mask_2d & - , name, ni, ni_glo, nj, nj_glo, nvertex, prec, radius, standard_name, type ) + , name, ni, ni_glo, nj, nj_glo, ntiles, nvertex, prec, radius, standard_name, tile_data_ibegin & + , tile_data_jbegin, tile_data_ni, tile_data_nj, tile_ibegin, tile_jbegin, tile_ni, tile_nj, type & + ) END SUBROUTINE xios(get_domaingroup_attr_hdl) @@ -544,8 +651,9 @@ CONTAINS , bounds_lon_name_, comment_, data_dim_, data_i_index_, data_ibegin_, data_j_index_, data_jbegin_ & , data_ni_, data_nj_, dim_i_name_, dim_j_name_, domain_ref_, group_ref_, i_index_, ibegin_, j_index_ & , jbegin_, lat_name_, latvalue_1d_, latvalue_2d_, lon_name_, long_name_, lonvalue_1d_, lonvalue_2d_ & - , mask_1d_, mask_2d_, name_, ni_, ni_glo_, nj_, nj_glo_, nvertex_, prec_, radius_, standard_name_ & - , type_ ) + , mask_1d_, mask_2d_, name_, ni_, ni_glo_, nj_, nj_glo_, ntiles_, nvertex_, prec_, radius_, standard_name_ & + , tile_data_ibegin_, tile_data_jbegin_, tile_data_ni_, tile_data_nj_, tile_ibegin_, tile_jbegin_ & + , tile_ni_, tile_nj_, type_ ) IMPLICIT NONE TYPE(txios(domaingroup)) , INTENT(IN) :: domaingroup_hdl @@ -588,10 +696,19 @@ CONTAINS INTEGER , OPTIONAL, INTENT(OUT) :: ni_glo_ INTEGER , OPTIONAL, INTENT(OUT) :: nj_ INTEGER , OPTIONAL, INTENT(OUT) :: nj_glo_ + INTEGER , OPTIONAL, INTENT(OUT) :: ntiles_ INTEGER , OPTIONAL, INTENT(OUT) :: nvertex_ INTEGER , OPTIONAL, INTENT(OUT) :: prec_ REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: radius_ CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: standard_name_ + INTEGER , OPTIONAL, INTENT(OUT) :: tile_data_ibegin_(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_data_jbegin_(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_data_ni_(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_data_nj_(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_ibegin_(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_jbegin_(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_ni_(:) + INTEGER , OPTIONAL, INTENT(OUT) :: tile_nj_(:) CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type_ IF (PRESENT(area_)) THEN @@ -783,6 +900,11 @@ CONTAINS (domaingroup_hdl%daddr, nj_glo_) ENDIF + IF (PRESENT(ntiles_)) THEN + CALL cxios_get_domaingroup_ntiles & + (domaingroup_hdl%daddr, ntiles_) + ENDIF + IF (PRESENT(nvertex_)) THEN CALL cxios_get_domaingroup_nvertex & (domaingroup_hdl%daddr, nvertex_) @@ -803,6 +925,46 @@ CONTAINS (domaingroup_hdl%daddr, standard_name_, len(standard_name_)) ENDIF + IF (PRESENT(tile_data_ibegin_)) THEN + CALL cxios_get_domaingroup_tile_data_ibegin & + (domaingroup_hdl%daddr, tile_data_ibegin_, SHAPE(tile_data_ibegin_)) + ENDIF + + IF (PRESENT(tile_data_jbegin_)) THEN + CALL cxios_get_domaingroup_tile_data_jbegin & + (domaingroup_hdl%daddr, tile_data_jbegin_, SHAPE(tile_data_jbegin_)) + ENDIF + + IF (PRESENT(tile_data_ni_)) THEN + CALL cxios_get_domaingroup_tile_data_ni & + (domaingroup_hdl%daddr, tile_data_ni_, SHAPE(tile_data_ni_)) + ENDIF + + IF (PRESENT(tile_data_nj_)) THEN + CALL cxios_get_domaingroup_tile_data_nj & + (domaingroup_hdl%daddr, tile_data_nj_, SHAPE(tile_data_nj_)) + ENDIF + + IF (PRESENT(tile_ibegin_)) THEN + CALL cxios_get_domaingroup_tile_ibegin & + (domaingroup_hdl%daddr, tile_ibegin_, SHAPE(tile_ibegin_)) + ENDIF + + IF (PRESENT(tile_jbegin_)) THEN + CALL cxios_get_domaingroup_tile_jbegin & + (domaingroup_hdl%daddr, tile_jbegin_, SHAPE(tile_jbegin_)) + ENDIF + + IF (PRESENT(tile_ni_)) THEN + CALL cxios_get_domaingroup_tile_ni & + (domaingroup_hdl%daddr, tile_ni_, SHAPE(tile_ni_)) + ENDIF + + IF (PRESENT(tile_nj_)) THEN + CALL cxios_get_domaingroup_tile_nj & + (domaingroup_hdl%daddr, tile_nj_, SHAPE(tile_nj_)) + ENDIF + IF (PRESENT(type_)) THEN CALL cxios_get_domaingroup_type & (domaingroup_hdl%daddr, type_, len(type_)) @@ -815,7 +977,9 @@ CONTAINS , bounds_lon_name, comment, data_dim, data_i_index, data_ibegin, data_j_index, data_jbegin, data_ni & , data_nj, dim_i_name, dim_j_name, domain_ref, group_ref, i_index, ibegin, j_index, jbegin, lat_name & , latvalue_1d, latvalue_2d, lon_name, long_name, lonvalue_1d, lonvalue_2d, mask_1d, mask_2d & - , name, ni, ni_glo, nj, nj_glo, nvertex, prec, radius, standard_name, type ) + , name, ni, ni_glo, nj, nj_glo, ntiles, nvertex, prec, radius, standard_name, tile_data_ibegin & + , tile_data_jbegin, tile_data_ni, tile_data_nj, tile_ibegin, tile_jbegin, tile_ni, tile_nj, type & + ) IMPLICIT NONE TYPE(txios(domaingroup)) :: domaingroup_hdl @@ -894,6 +1058,8 @@ CONTAINS LOGICAL(KIND=C_BOOL) :: nj_tmp LOGICAL, OPTIONAL, INTENT(OUT) :: nj_glo LOGICAL(KIND=C_BOOL) :: nj_glo_tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: ntiles + LOGICAL(KIND=C_BOOL) :: ntiles_tmp LOGICAL, OPTIONAL, INTENT(OUT) :: nvertex LOGICAL(KIND=C_BOOL) :: nvertex_tmp LOGICAL, OPTIONAL, INTENT(OUT) :: prec @@ -902,6 +1068,22 @@ CONTAINS LOGICAL(KIND=C_BOOL) :: radius_tmp LOGICAL, OPTIONAL, INTENT(OUT) :: standard_name LOGICAL(KIND=C_BOOL) :: standard_name_tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_data_ibegin + LOGICAL(KIND=C_BOOL) :: tile_data_ibegin_tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_data_jbegin + LOGICAL(KIND=C_BOOL) :: tile_data_jbegin_tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_data_ni + LOGICAL(KIND=C_BOOL) :: tile_data_ni_tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_data_nj + LOGICAL(KIND=C_BOOL) :: tile_data_nj_tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_ibegin + LOGICAL(KIND=C_BOOL) :: tile_ibegin_tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_jbegin + LOGICAL(KIND=C_BOOL) :: tile_jbegin_tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_ni + LOGICAL(KIND=C_BOOL) :: tile_ni_tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_nj + LOGICAL(KIND=C_BOOL) :: tile_nj_tmp LOGICAL, OPTIONAL, INTENT(OUT) :: type LOGICAL(KIND=C_BOOL) :: type_tmp @@ -912,7 +1094,9 @@ CONTAINS , bounds_lon_name, comment, data_dim, data_i_index, data_ibegin, data_j_index, data_jbegin, data_ni & , data_nj, dim_i_name, dim_j_name, domain_ref, group_ref, i_index, ibegin, j_index, jbegin, lat_name & , latvalue_1d, latvalue_2d, lon_name, long_name, lonvalue_1d, lonvalue_2d, mask_1d, mask_2d & - , name, ni, ni_glo, nj, nj_glo, nvertex, prec, radius, standard_name, type ) + , name, ni, ni_glo, nj, nj_glo, ntiles, nvertex, prec, radius, standard_name, tile_data_ibegin & + , tile_data_jbegin, tile_data_ni, tile_data_nj, tile_ibegin, tile_jbegin, tile_ni, tile_nj, type & + ) END SUBROUTINE xios(is_defined_domaingroup_attr) @@ -921,7 +1105,9 @@ CONTAINS , bounds_lon_name, comment, data_dim, data_i_index, data_ibegin, data_j_index, data_jbegin, data_ni & , data_nj, dim_i_name, dim_j_name, domain_ref, group_ref, i_index, ibegin, j_index, jbegin, lat_name & , latvalue_1d, latvalue_2d, lon_name, long_name, lonvalue_1d, lonvalue_2d, mask_1d, mask_2d & - , name, ni, ni_glo, nj, nj_glo, nvertex, prec, radius, standard_name, type ) + , name, ni, ni_glo, nj, nj_glo, ntiles, nvertex, prec, radius, standard_name, tile_data_ibegin & + , tile_data_jbegin, tile_data_ni, tile_data_nj, tile_ibegin, tile_jbegin, tile_ni, tile_nj, type & + ) IMPLICIT NONE TYPE(txios(domaingroup)) , INTENT(IN) :: domaingroup_hdl @@ -999,6 +1185,8 @@ CONTAINS LOGICAL(KIND=C_BOOL) :: nj_tmp LOGICAL, OPTIONAL, INTENT(OUT) :: nj_glo LOGICAL(KIND=C_BOOL) :: nj_glo_tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: ntiles + LOGICAL(KIND=C_BOOL) :: ntiles_tmp LOGICAL, OPTIONAL, INTENT(OUT) :: nvertex LOGICAL(KIND=C_BOOL) :: nvertex_tmp LOGICAL, OPTIONAL, INTENT(OUT) :: prec @@ -1007,6 +1195,22 @@ CONTAINS LOGICAL(KIND=C_BOOL) :: radius_tmp LOGICAL, OPTIONAL, INTENT(OUT) :: standard_name LOGICAL(KIND=C_BOOL) :: standard_name_tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_data_ibegin + LOGICAL(KIND=C_BOOL) :: tile_data_ibegin_tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_data_jbegin + LOGICAL(KIND=C_BOOL) :: tile_data_jbegin_tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_data_ni + LOGICAL(KIND=C_BOOL) :: tile_data_ni_tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_data_nj + LOGICAL(KIND=C_BOOL) :: tile_data_nj_tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_ibegin + LOGICAL(KIND=C_BOOL) :: tile_ibegin_tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_jbegin + LOGICAL(KIND=C_BOOL) :: tile_jbegin_tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_ni + LOGICAL(KIND=C_BOOL) :: tile_ni_tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_nj + LOGICAL(KIND=C_BOOL) :: tile_nj_tmp LOGICAL, OPTIONAL, INTENT(OUT) :: type LOGICAL(KIND=C_BOOL) :: type_tmp @@ -1015,7 +1219,9 @@ CONTAINS , bounds_lon_name, comment, data_dim, data_i_index, data_ibegin, data_j_index, data_jbegin, data_ni & , data_nj, dim_i_name, dim_j_name, domain_ref, group_ref, i_index, ibegin, j_index, jbegin, lat_name & , latvalue_1d, latvalue_2d, lon_name, long_name, lonvalue_1d, lonvalue_2d, mask_1d, mask_2d & - , name, ni, ni_glo, nj, nj_glo, nvertex, prec, radius, standard_name, type ) + , name, ni, ni_glo, nj, nj_glo, ntiles, nvertex, prec, radius, standard_name, tile_data_ibegin & + , tile_data_jbegin, tile_data_ni, tile_data_nj, tile_ibegin, tile_jbegin, tile_ni, tile_nj, type & + ) END SUBROUTINE xios(is_defined_domaingroup_attr_hdl) @@ -1024,8 +1230,9 @@ CONTAINS , bounds_lon_name_, comment_, data_dim_, data_i_index_, data_ibegin_, data_j_index_, data_jbegin_ & , data_ni_, data_nj_, dim_i_name_, dim_j_name_, domain_ref_, group_ref_, i_index_, ibegin_, j_index_ & , jbegin_, lat_name_, latvalue_1d_, latvalue_2d_, lon_name_, long_name_, lonvalue_1d_, lonvalue_2d_ & - , mask_1d_, mask_2d_, name_, ni_, ni_glo_, nj_, nj_glo_, nvertex_, prec_, radius_, standard_name_ & - , type_ ) + , mask_1d_, mask_2d_, name_, ni_, ni_glo_, nj_, nj_glo_, ntiles_, nvertex_, prec_, radius_, standard_name_ & + , tile_data_ibegin_, tile_data_jbegin_, tile_data_ni_, tile_data_nj_, tile_ibegin_, tile_jbegin_ & + , tile_ni_, tile_nj_, type_ ) IMPLICIT NONE TYPE(txios(domaingroup)) , INTENT(IN) :: domaingroup_hdl @@ -1103,6 +1310,8 @@ CONTAINS LOGICAL(KIND=C_BOOL) :: nj__tmp LOGICAL, OPTIONAL, INTENT(OUT) :: nj_glo_ LOGICAL(KIND=C_BOOL) :: nj_glo__tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: ntiles_ + LOGICAL(KIND=C_BOOL) :: ntiles__tmp LOGICAL, OPTIONAL, INTENT(OUT) :: nvertex_ LOGICAL(KIND=C_BOOL) :: nvertex__tmp LOGICAL, OPTIONAL, INTENT(OUT) :: prec_ @@ -1111,6 +1320,22 @@ CONTAINS LOGICAL(KIND=C_BOOL) :: radius__tmp LOGICAL, OPTIONAL, INTENT(OUT) :: standard_name_ LOGICAL(KIND=C_BOOL) :: standard_name__tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_data_ibegin_ + LOGICAL(KIND=C_BOOL) :: tile_data_ibegin__tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_data_jbegin_ + LOGICAL(KIND=C_BOOL) :: tile_data_jbegin__tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_data_ni_ + LOGICAL(KIND=C_BOOL) :: tile_data_ni__tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_data_nj_ + LOGICAL(KIND=C_BOOL) :: tile_data_nj__tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_ibegin_ + LOGICAL(KIND=C_BOOL) :: tile_ibegin__tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_jbegin_ + LOGICAL(KIND=C_BOOL) :: tile_jbegin__tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_ni_ + LOGICAL(KIND=C_BOOL) :: tile_ni__tmp + LOGICAL, OPTIONAL, INTENT(OUT) :: tile_nj_ + LOGICAL(KIND=C_BOOL) :: tile_nj__tmp LOGICAL, OPTIONAL, INTENT(OUT) :: type_ LOGICAL(KIND=C_BOOL) :: type__tmp @@ -1336,6 +1561,12 @@ CONTAINS nj_glo_ = nj_glo__tmp ENDIF + IF (PRESENT(ntiles_)) THEN + ntiles__tmp = cxios_is_defined_domaingroup_ntiles & + (domaingroup_hdl%daddr) + ntiles_ = ntiles__tmp + ENDIF + IF (PRESENT(nvertex_)) THEN nvertex__tmp = cxios_is_defined_domaingroup_nvertex & (domaingroup_hdl%daddr) @@ -1360,6 +1591,54 @@ CONTAINS standard_name_ = standard_name__tmp ENDIF + IF (PRESENT(tile_data_ibegin_)) THEN + tile_data_ibegin__tmp = cxios_is_defined_domaingroup_tile_data_ibegin & + (domaingroup_hdl%daddr) + tile_data_ibegin_ = tile_data_ibegin__tmp + ENDIF + + IF (PRESENT(tile_data_jbegin_)) THEN + tile_data_jbegin__tmp = cxios_is_defined_domaingroup_tile_data_jbegin & + (domaingroup_hdl%daddr) + tile_data_jbegin_ = tile_data_jbegin__tmp + ENDIF + + IF (PRESENT(tile_data_ni_)) THEN + tile_data_ni__tmp = cxios_is_defined_domaingroup_tile_data_ni & + (domaingroup_hdl%daddr) + tile_data_ni_ = tile_data_ni__tmp + ENDIF + + IF (PRESENT(tile_data_nj_)) THEN + tile_data_nj__tmp = cxios_is_defined_domaingroup_tile_data_nj & + (domaingroup_hdl%daddr) + tile_data_nj_ = tile_data_nj__tmp + ENDIF + + IF (PRESENT(tile_ibegin_)) THEN + tile_ibegin__tmp = cxios_is_defined_domaingroup_tile_ibegin & + (domaingroup_hdl%daddr) + tile_ibegin_ = tile_ibegin__tmp + ENDIF + + IF (PRESENT(tile_jbegin_)) THEN + tile_jbegin__tmp = cxios_is_defined_domaingroup_tile_jbegin & + (domaingroup_hdl%daddr) + tile_jbegin_ = tile_jbegin__tmp + ENDIF + + IF (PRESENT(tile_ni_)) THEN + tile_ni__tmp = cxios_is_defined_domaingroup_tile_ni & + (domaingroup_hdl%daddr) + tile_ni_ = tile_ni__tmp + ENDIF + + IF (PRESENT(tile_nj_)) THEN + tile_nj__tmp = cxios_is_defined_domaingroup_tile_nj & + (domaingroup_hdl%daddr) + tile_nj_ = tile_nj__tmp + ENDIF + IF (PRESENT(type_)) THEN type__tmp = cxios_is_defined_domaingroup_type & (domaingroup_hdl%daddr) diff --git a/xios_2311_src/src/interface/fortran_attr/iscalar_attr.F90 b/xios_2311_src/src/interface/fortran_attr/iscalar_attr.F90 index b275ccccef3da1bf5534ad796bd56ad10e348a98..76cc72739fe1c8cd23fdb59b94be08293a0d5e2e 100644 --- a/xios_2311_src/src/interface/fortran_attr/iscalar_attr.F90 +++ b/xios_2311_src/src/interface/fortran_attr/iscalar_attr.F90 @@ -11,8 +11,8 @@ MODULE iscalar_attr CONTAINS SUBROUTINE xios(set_scalar_attr) & - ( scalar_id, axis_type, bounds, bounds_name, comment, label, long_name, mask, name, positive & - , prec, scalar_ref, standard_name, unit, value ) + ( scalar_id, axis_type, bounds, bounds_name, comment, label, long_name, name, positive, prec & + , scalar_ref, standard_name, unit, value ) IMPLICIT NONE TYPE(txios(scalar)) :: scalar_hdl @@ -23,8 +23,6 @@ CONTAINS CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: comment CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: label CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: long_name - LOGICAL , OPTIONAL, INTENT(IN) :: mask - LOGICAL (KIND=C_BOOL) :: mask_tmp CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: positive INTEGER , OPTIONAL, INTENT(IN) :: prec @@ -36,14 +34,14 @@ CONTAINS CALL xios(get_scalar_handle) & (scalar_id,scalar_hdl) CALL xios(set_scalar_attr_hdl_) & - ( scalar_hdl, axis_type, bounds, bounds_name, comment, label, long_name, mask, name, positive & - , prec, scalar_ref, standard_name, unit, value ) + ( scalar_hdl, axis_type, bounds, bounds_name, comment, label, long_name, name, positive, prec & + , scalar_ref, standard_name, unit, value ) END SUBROUTINE xios(set_scalar_attr) SUBROUTINE xios(set_scalar_attr_hdl) & - ( scalar_hdl, axis_type, bounds, bounds_name, comment, label, long_name, mask, name, positive & - , prec, scalar_ref, standard_name, unit, value ) + ( scalar_hdl, axis_type, bounds, bounds_name, comment, label, long_name, name, positive, prec & + , scalar_ref, standard_name, unit, value ) IMPLICIT NONE TYPE(txios(scalar)) , INTENT(IN) :: scalar_hdl @@ -53,8 +51,6 @@ CONTAINS CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: comment CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: label CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: long_name - LOGICAL , OPTIONAL, INTENT(IN) :: mask - LOGICAL (KIND=C_BOOL) :: mask_tmp CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: positive INTEGER , OPTIONAL, INTENT(IN) :: prec @@ -64,14 +60,14 @@ CONTAINS REAL (KIND=8) , OPTIONAL, INTENT(IN) :: value CALL xios(set_scalar_attr_hdl_) & - ( scalar_hdl, axis_type, bounds, bounds_name, comment, label, long_name, mask, name, positive & - , prec, scalar_ref, standard_name, unit, value ) + ( scalar_hdl, axis_type, bounds, bounds_name, comment, label, long_name, name, positive, prec & + , scalar_ref, standard_name, unit, value ) END SUBROUTINE xios(set_scalar_attr_hdl) SUBROUTINE xios(set_scalar_attr_hdl_) & - ( scalar_hdl, axis_type_, bounds_, bounds_name_, comment_, label_, long_name_, mask_, name_ & - , positive_, prec_, scalar_ref_, standard_name_, unit_, value_ ) + ( scalar_hdl, axis_type_, bounds_, bounds_name_, comment_, label_, long_name_, name_, positive_ & + , prec_, scalar_ref_, standard_name_, unit_, value_ ) IMPLICIT NONE TYPE(txios(scalar)) , INTENT(IN) :: scalar_hdl @@ -81,8 +77,6 @@ CONTAINS CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: comment_ CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: label_ CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: long_name_ - LOGICAL , OPTIONAL, INTENT(IN) :: mask_ - LOGICAL (KIND=C_BOOL) :: mask__tmp CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name_ CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: positive_ INTEGER , OPTIONAL, INTENT(IN) :: prec_ @@ -121,12 +115,6 @@ CONTAINS (scalar_hdl%daddr, long_name_, len(long_name_)) ENDIF - IF (PRESENT(mask_)) THEN - mask__tmp = mask_ - CALL cxios_set_scalar_mask & - (scalar_hdl%daddr, mask__tmp) - ENDIF - IF (PRESENT(name_)) THEN CALL cxios_set_scalar_name & (scalar_hdl%daddr, name_, len(name_)) @@ -165,8 +153,8 @@ CONTAINS END SUBROUTINE xios(set_scalar_attr_hdl_) SUBROUTINE xios(get_scalar_attr) & - ( scalar_id, axis_type, bounds, bounds_name, comment, label, long_name, mask, name, positive & - , prec, scalar_ref, standard_name, unit, value ) + ( scalar_id, axis_type, bounds, bounds_name, comment, label, long_name, name, positive, prec & + , scalar_ref, standard_name, unit, value ) IMPLICIT NONE TYPE(txios(scalar)) :: scalar_hdl @@ -177,8 +165,6 @@ CONTAINS CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: comment CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: label CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: long_name - LOGICAL , OPTIONAL, INTENT(OUT) :: mask - LOGICAL (KIND=C_BOOL) :: mask_tmp CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: positive INTEGER , OPTIONAL, INTENT(OUT) :: prec @@ -190,14 +176,14 @@ CONTAINS CALL xios(get_scalar_handle) & (scalar_id,scalar_hdl) CALL xios(get_scalar_attr_hdl_) & - ( scalar_hdl, axis_type, bounds, bounds_name, comment, label, long_name, mask, name, positive & - , prec, scalar_ref, standard_name, unit, value ) + ( scalar_hdl, axis_type, bounds, bounds_name, comment, label, long_name, name, positive, prec & + , scalar_ref, standard_name, unit, value ) END SUBROUTINE xios(get_scalar_attr) SUBROUTINE xios(get_scalar_attr_hdl) & - ( scalar_hdl, axis_type, bounds, bounds_name, comment, label, long_name, mask, name, positive & - , prec, scalar_ref, standard_name, unit, value ) + ( scalar_hdl, axis_type, bounds, bounds_name, comment, label, long_name, name, positive, prec & + , scalar_ref, standard_name, unit, value ) IMPLICIT NONE TYPE(txios(scalar)) , INTENT(IN) :: scalar_hdl @@ -207,8 +193,6 @@ CONTAINS CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: comment CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: label CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: long_name - LOGICAL , OPTIONAL, INTENT(OUT) :: mask - LOGICAL (KIND=C_BOOL) :: mask_tmp CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: positive INTEGER , OPTIONAL, INTENT(OUT) :: prec @@ -218,14 +202,14 @@ CONTAINS REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: value CALL xios(get_scalar_attr_hdl_) & - ( scalar_hdl, axis_type, bounds, bounds_name, comment, label, long_name, mask, name, positive & - , prec, scalar_ref, standard_name, unit, value ) + ( scalar_hdl, axis_type, bounds, bounds_name, comment, label, long_name, name, positive, prec & + , scalar_ref, standard_name, unit, value ) END SUBROUTINE xios(get_scalar_attr_hdl) SUBROUTINE xios(get_scalar_attr_hdl_) & - ( scalar_hdl, axis_type_, bounds_, bounds_name_, comment_, label_, long_name_, mask_, name_ & - , positive_, prec_, scalar_ref_, standard_name_, unit_, value_ ) + ( scalar_hdl, axis_type_, bounds_, bounds_name_, comment_, label_, long_name_, name_, positive_ & + , prec_, scalar_ref_, standard_name_, unit_, value_ ) IMPLICIT NONE TYPE(txios(scalar)) , INTENT(IN) :: scalar_hdl @@ -235,8 +219,6 @@ CONTAINS CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: comment_ CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: label_ CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: long_name_ - LOGICAL , OPTIONAL, INTENT(OUT) :: mask_ - LOGICAL (KIND=C_BOOL) :: mask__tmp CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name_ CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: positive_ INTEGER , OPTIONAL, INTENT(OUT) :: prec_ @@ -275,12 +257,6 @@ CONTAINS (scalar_hdl%daddr, long_name_, len(long_name_)) ENDIF - IF (PRESENT(mask_)) THEN - CALL cxios_get_scalar_mask & - (scalar_hdl%daddr, mask__tmp) - mask_ = mask__tmp - ENDIF - IF (PRESENT(name_)) THEN CALL cxios_get_scalar_name & (scalar_hdl%daddr, name_, len(name_)) @@ -319,8 +295,8 @@ CONTAINS END SUBROUTINE xios(get_scalar_attr_hdl_) SUBROUTINE xios(is_defined_scalar_attr) & - ( scalar_id, axis_type, bounds, bounds_name, comment, label, long_name, mask, name, positive & - , prec, scalar_ref, standard_name, unit, value ) + ( scalar_id, axis_type, bounds, bounds_name, comment, label, long_name, name, positive, prec & + , scalar_ref, standard_name, unit, value ) IMPLICIT NONE TYPE(txios(scalar)) :: scalar_hdl @@ -337,8 +313,6 @@ CONTAINS LOGICAL(KIND=C_BOOL) :: label_tmp LOGICAL, OPTIONAL, INTENT(OUT) :: long_name LOGICAL(KIND=C_BOOL) :: long_name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: mask - LOGICAL(KIND=C_BOOL) :: mask_tmp LOGICAL, OPTIONAL, INTENT(OUT) :: name LOGICAL(KIND=C_BOOL) :: name_tmp LOGICAL, OPTIONAL, INTENT(OUT) :: positive @@ -357,14 +331,14 @@ CONTAINS CALL xios(get_scalar_handle) & (scalar_id,scalar_hdl) CALL xios(is_defined_scalar_attr_hdl_) & - ( scalar_hdl, axis_type, bounds, bounds_name, comment, label, long_name, mask, name, positive & - , prec, scalar_ref, standard_name, unit, value ) + ( scalar_hdl, axis_type, bounds, bounds_name, comment, label, long_name, name, positive, prec & + , scalar_ref, standard_name, unit, value ) END SUBROUTINE xios(is_defined_scalar_attr) SUBROUTINE xios(is_defined_scalar_attr_hdl) & - ( scalar_hdl, axis_type, bounds, bounds_name, comment, label, long_name, mask, name, positive & - , prec, scalar_ref, standard_name, unit, value ) + ( scalar_hdl, axis_type, bounds, bounds_name, comment, label, long_name, name, positive, prec & + , scalar_ref, standard_name, unit, value ) IMPLICIT NONE TYPE(txios(scalar)) , INTENT(IN) :: scalar_hdl @@ -380,8 +354,6 @@ CONTAINS LOGICAL(KIND=C_BOOL) :: label_tmp LOGICAL, OPTIONAL, INTENT(OUT) :: long_name LOGICAL(KIND=C_BOOL) :: long_name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: mask - LOGICAL(KIND=C_BOOL) :: mask_tmp LOGICAL, OPTIONAL, INTENT(OUT) :: name LOGICAL(KIND=C_BOOL) :: name_tmp LOGICAL, OPTIONAL, INTENT(OUT) :: positive @@ -398,14 +370,14 @@ CONTAINS LOGICAL(KIND=C_BOOL) :: value_tmp CALL xios(is_defined_scalar_attr_hdl_) & - ( scalar_hdl, axis_type, bounds, bounds_name, comment, label, long_name, mask, name, positive & - , prec, scalar_ref, standard_name, unit, value ) + ( scalar_hdl, axis_type, bounds, bounds_name, comment, label, long_name, name, positive, prec & + , scalar_ref, standard_name, unit, value ) END SUBROUTINE xios(is_defined_scalar_attr_hdl) SUBROUTINE xios(is_defined_scalar_attr_hdl_) & - ( scalar_hdl, axis_type_, bounds_, bounds_name_, comment_, label_, long_name_, mask_, name_ & - , positive_, prec_, scalar_ref_, standard_name_, unit_, value_ ) + ( scalar_hdl, axis_type_, bounds_, bounds_name_, comment_, label_, long_name_, name_, positive_ & + , prec_, scalar_ref_, standard_name_, unit_, value_ ) IMPLICIT NONE TYPE(txios(scalar)) , INTENT(IN) :: scalar_hdl @@ -421,8 +393,6 @@ CONTAINS LOGICAL(KIND=C_BOOL) :: label__tmp LOGICAL, OPTIONAL, INTENT(OUT) :: long_name_ LOGICAL(KIND=C_BOOL) :: long_name__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: mask_ - LOGICAL(KIND=C_BOOL) :: mask__tmp LOGICAL, OPTIONAL, INTENT(OUT) :: name_ LOGICAL(KIND=C_BOOL) :: name__tmp LOGICAL, OPTIONAL, INTENT(OUT) :: positive_ @@ -474,12 +444,6 @@ CONTAINS long_name_ = long_name__tmp ENDIF - IF (PRESENT(mask_)) THEN - mask__tmp = cxios_is_defined_scalar_mask & - (scalar_hdl%daddr) - mask_ = mask__tmp - ENDIF - IF (PRESENT(name_)) THEN name__tmp = cxios_is_defined_scalar_name & (scalar_hdl%daddr) diff --git a/xios_2311_src/src/interface/fortran_attr/iscalargroup_attr.F90 b/xios_2311_src/src/interface/fortran_attr/iscalargroup_attr.F90 index beb8beda276989ed24f6dff9502b6dd5409fe37d..339d196ae5393e49e5883c51b08388f6297814ec 100644 --- a/xios_2311_src/src/interface/fortran_attr/iscalargroup_attr.F90 +++ b/xios_2311_src/src/interface/fortran_attr/iscalargroup_attr.F90 @@ -11,8 +11,8 @@ MODULE iscalargroup_attr CONTAINS SUBROUTINE xios(set_scalargroup_attr) & - ( scalargroup_id, axis_type, bounds, bounds_name, comment, group_ref, label, long_name, mask & - , name, positive, prec, scalar_ref, standard_name, unit, value ) + ( scalargroup_id, axis_type, bounds, bounds_name, comment, group_ref, label, long_name, name & + , positive, prec, scalar_ref, standard_name, unit, value ) IMPLICIT NONE TYPE(txios(scalargroup)) :: scalargroup_hdl @@ -24,8 +24,6 @@ CONTAINS CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: group_ref CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: label CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: long_name - LOGICAL , OPTIONAL, INTENT(IN) :: mask - LOGICAL (KIND=C_BOOL) :: mask_tmp CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: positive INTEGER , OPTIONAL, INTENT(IN) :: prec @@ -37,14 +35,14 @@ CONTAINS CALL xios(get_scalargroup_handle) & (scalargroup_id,scalargroup_hdl) CALL xios(set_scalargroup_attr_hdl_) & - ( scalargroup_hdl, axis_type, bounds, bounds_name, comment, group_ref, label, long_name, mask & - , name, positive, prec, scalar_ref, standard_name, unit, value ) + ( scalargroup_hdl, axis_type, bounds, bounds_name, comment, group_ref, label, long_name, name & + , positive, prec, scalar_ref, standard_name, unit, value ) END SUBROUTINE xios(set_scalargroup_attr) SUBROUTINE xios(set_scalargroup_attr_hdl) & - ( scalargroup_hdl, axis_type, bounds, bounds_name, comment, group_ref, label, long_name, mask & - , name, positive, prec, scalar_ref, standard_name, unit, value ) + ( scalargroup_hdl, axis_type, bounds, bounds_name, comment, group_ref, label, long_name, name & + , positive, prec, scalar_ref, standard_name, unit, value ) IMPLICIT NONE TYPE(txios(scalargroup)) , INTENT(IN) :: scalargroup_hdl @@ -55,8 +53,6 @@ CONTAINS CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: group_ref CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: label CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: long_name - LOGICAL , OPTIONAL, INTENT(IN) :: mask - LOGICAL (KIND=C_BOOL) :: mask_tmp CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: positive INTEGER , OPTIONAL, INTENT(IN) :: prec @@ -66,14 +62,14 @@ CONTAINS REAL (KIND=8) , OPTIONAL, INTENT(IN) :: value CALL xios(set_scalargroup_attr_hdl_) & - ( scalargroup_hdl, axis_type, bounds, bounds_name, comment, group_ref, label, long_name, mask & - , name, positive, prec, scalar_ref, standard_name, unit, value ) + ( scalargroup_hdl, axis_type, bounds, bounds_name, comment, group_ref, label, long_name, name & + , positive, prec, scalar_ref, standard_name, unit, value ) END SUBROUTINE xios(set_scalargroup_attr_hdl) SUBROUTINE xios(set_scalargroup_attr_hdl_) & ( scalargroup_hdl, axis_type_, bounds_, bounds_name_, comment_, group_ref_, label_, long_name_ & - , mask_, name_, positive_, prec_, scalar_ref_, standard_name_, unit_, value_ ) + , name_, positive_, prec_, scalar_ref_, standard_name_, unit_, value_ ) IMPLICIT NONE TYPE(txios(scalargroup)) , INTENT(IN) :: scalargroup_hdl @@ -84,8 +80,6 @@ CONTAINS CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: group_ref_ CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: label_ CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: long_name_ - LOGICAL , OPTIONAL, INTENT(IN) :: mask_ - LOGICAL (KIND=C_BOOL) :: mask__tmp CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name_ CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: positive_ INTEGER , OPTIONAL, INTENT(IN) :: prec_ @@ -129,12 +123,6 @@ CONTAINS (scalargroup_hdl%daddr, long_name_, len(long_name_)) ENDIF - IF (PRESENT(mask_)) THEN - mask__tmp = mask_ - CALL cxios_set_scalargroup_mask & - (scalargroup_hdl%daddr, mask__tmp) - ENDIF - IF (PRESENT(name_)) THEN CALL cxios_set_scalargroup_name & (scalargroup_hdl%daddr, name_, len(name_)) @@ -173,8 +161,8 @@ CONTAINS END SUBROUTINE xios(set_scalargroup_attr_hdl_) SUBROUTINE xios(get_scalargroup_attr) & - ( scalargroup_id, axis_type, bounds, bounds_name, comment, group_ref, label, long_name, mask & - , name, positive, prec, scalar_ref, standard_name, unit, value ) + ( scalargroup_id, axis_type, bounds, bounds_name, comment, group_ref, label, long_name, name & + , positive, prec, scalar_ref, standard_name, unit, value ) IMPLICIT NONE TYPE(txios(scalargroup)) :: scalargroup_hdl @@ -186,8 +174,6 @@ CONTAINS CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: group_ref CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: label CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: long_name - LOGICAL , OPTIONAL, INTENT(OUT) :: mask - LOGICAL (KIND=C_BOOL) :: mask_tmp CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: positive INTEGER , OPTIONAL, INTENT(OUT) :: prec @@ -199,14 +185,14 @@ CONTAINS CALL xios(get_scalargroup_handle) & (scalargroup_id,scalargroup_hdl) CALL xios(get_scalargroup_attr_hdl_) & - ( scalargroup_hdl, axis_type, bounds, bounds_name, comment, group_ref, label, long_name, mask & - , name, positive, prec, scalar_ref, standard_name, unit, value ) + ( scalargroup_hdl, axis_type, bounds, bounds_name, comment, group_ref, label, long_name, name & + , positive, prec, scalar_ref, standard_name, unit, value ) END SUBROUTINE xios(get_scalargroup_attr) SUBROUTINE xios(get_scalargroup_attr_hdl) & - ( scalargroup_hdl, axis_type, bounds, bounds_name, comment, group_ref, label, long_name, mask & - , name, positive, prec, scalar_ref, standard_name, unit, value ) + ( scalargroup_hdl, axis_type, bounds, bounds_name, comment, group_ref, label, long_name, name & + , positive, prec, scalar_ref, standard_name, unit, value ) IMPLICIT NONE TYPE(txios(scalargroup)) , INTENT(IN) :: scalargroup_hdl @@ -217,8 +203,6 @@ CONTAINS CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: group_ref CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: label CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: long_name - LOGICAL , OPTIONAL, INTENT(OUT) :: mask - LOGICAL (KIND=C_BOOL) :: mask_tmp CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: positive INTEGER , OPTIONAL, INTENT(OUT) :: prec @@ -228,14 +212,14 @@ CONTAINS REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: value CALL xios(get_scalargroup_attr_hdl_) & - ( scalargroup_hdl, axis_type, bounds, bounds_name, comment, group_ref, label, long_name, mask & - , name, positive, prec, scalar_ref, standard_name, unit, value ) + ( scalargroup_hdl, axis_type, bounds, bounds_name, comment, group_ref, label, long_name, name & + , positive, prec, scalar_ref, standard_name, unit, value ) END SUBROUTINE xios(get_scalargroup_attr_hdl) SUBROUTINE xios(get_scalargroup_attr_hdl_) & ( scalargroup_hdl, axis_type_, bounds_, bounds_name_, comment_, group_ref_, label_, long_name_ & - , mask_, name_, positive_, prec_, scalar_ref_, standard_name_, unit_, value_ ) + , name_, positive_, prec_, scalar_ref_, standard_name_, unit_, value_ ) IMPLICIT NONE TYPE(txios(scalargroup)) , INTENT(IN) :: scalargroup_hdl @@ -246,8 +230,6 @@ CONTAINS CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: group_ref_ CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: label_ CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: long_name_ - LOGICAL , OPTIONAL, INTENT(OUT) :: mask_ - LOGICAL (KIND=C_BOOL) :: mask__tmp CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name_ CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: positive_ INTEGER , OPTIONAL, INTENT(OUT) :: prec_ @@ -291,12 +273,6 @@ CONTAINS (scalargroup_hdl%daddr, long_name_, len(long_name_)) ENDIF - IF (PRESENT(mask_)) THEN - CALL cxios_get_scalargroup_mask & - (scalargroup_hdl%daddr, mask__tmp) - mask_ = mask__tmp - ENDIF - IF (PRESENT(name_)) THEN CALL cxios_get_scalargroup_name & (scalargroup_hdl%daddr, name_, len(name_)) @@ -335,8 +311,8 @@ CONTAINS END SUBROUTINE xios(get_scalargroup_attr_hdl_) SUBROUTINE xios(is_defined_scalargroup_attr) & - ( scalargroup_id, axis_type, bounds, bounds_name, comment, group_ref, label, long_name, mask & - , name, positive, prec, scalar_ref, standard_name, unit, value ) + ( scalargroup_id, axis_type, bounds, bounds_name, comment, group_ref, label, long_name, name & + , positive, prec, scalar_ref, standard_name, unit, value ) IMPLICIT NONE TYPE(txios(scalargroup)) :: scalargroup_hdl @@ -355,8 +331,6 @@ CONTAINS LOGICAL(KIND=C_BOOL) :: label_tmp LOGICAL, OPTIONAL, INTENT(OUT) :: long_name LOGICAL(KIND=C_BOOL) :: long_name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: mask - LOGICAL(KIND=C_BOOL) :: mask_tmp LOGICAL, OPTIONAL, INTENT(OUT) :: name LOGICAL(KIND=C_BOOL) :: name_tmp LOGICAL, OPTIONAL, INTENT(OUT) :: positive @@ -375,14 +349,14 @@ CONTAINS CALL xios(get_scalargroup_handle) & (scalargroup_id,scalargroup_hdl) CALL xios(is_defined_scalargroup_attr_hdl_) & - ( scalargroup_hdl, axis_type, bounds, bounds_name, comment, group_ref, label, long_name, mask & - , name, positive, prec, scalar_ref, standard_name, unit, value ) + ( scalargroup_hdl, axis_type, bounds, bounds_name, comment, group_ref, label, long_name, name & + , positive, prec, scalar_ref, standard_name, unit, value ) END SUBROUTINE xios(is_defined_scalargroup_attr) SUBROUTINE xios(is_defined_scalargroup_attr_hdl) & - ( scalargroup_hdl, axis_type, bounds, bounds_name, comment, group_ref, label, long_name, mask & - , name, positive, prec, scalar_ref, standard_name, unit, value ) + ( scalargroup_hdl, axis_type, bounds, bounds_name, comment, group_ref, label, long_name, name & + , positive, prec, scalar_ref, standard_name, unit, value ) IMPLICIT NONE TYPE(txios(scalargroup)) , INTENT(IN) :: scalargroup_hdl @@ -400,8 +374,6 @@ CONTAINS LOGICAL(KIND=C_BOOL) :: label_tmp LOGICAL, OPTIONAL, INTENT(OUT) :: long_name LOGICAL(KIND=C_BOOL) :: long_name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: mask - LOGICAL(KIND=C_BOOL) :: mask_tmp LOGICAL, OPTIONAL, INTENT(OUT) :: name LOGICAL(KIND=C_BOOL) :: name_tmp LOGICAL, OPTIONAL, INTENT(OUT) :: positive @@ -418,14 +390,14 @@ CONTAINS LOGICAL(KIND=C_BOOL) :: value_tmp CALL xios(is_defined_scalargroup_attr_hdl_) & - ( scalargroup_hdl, axis_type, bounds, bounds_name, comment, group_ref, label, long_name, mask & - , name, positive, prec, scalar_ref, standard_name, unit, value ) + ( scalargroup_hdl, axis_type, bounds, bounds_name, comment, group_ref, label, long_name, name & + , positive, prec, scalar_ref, standard_name, unit, value ) END SUBROUTINE xios(is_defined_scalargroup_attr_hdl) SUBROUTINE xios(is_defined_scalargroup_attr_hdl_) & ( scalargroup_hdl, axis_type_, bounds_, bounds_name_, comment_, group_ref_, label_, long_name_ & - , mask_, name_, positive_, prec_, scalar_ref_, standard_name_, unit_, value_ ) + , name_, positive_, prec_, scalar_ref_, standard_name_, unit_, value_ ) IMPLICIT NONE TYPE(txios(scalargroup)) , INTENT(IN) :: scalargroup_hdl @@ -443,8 +415,6 @@ CONTAINS LOGICAL(KIND=C_BOOL) :: label__tmp LOGICAL, OPTIONAL, INTENT(OUT) :: long_name_ LOGICAL(KIND=C_BOOL) :: long_name__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: mask_ - LOGICAL(KIND=C_BOOL) :: mask__tmp LOGICAL, OPTIONAL, INTENT(OUT) :: name_ LOGICAL(KIND=C_BOOL) :: name__tmp LOGICAL, OPTIONAL, INTENT(OUT) :: positive_ @@ -502,12 +472,6 @@ CONTAINS long_name_ = long_name__tmp ENDIF - IF (PRESENT(mask_)) THEN - mask__tmp = cxios_is_defined_scalargroup_mask & - (scalargroup_hdl%daddr) - mask_ = mask__tmp - ENDIF - IF (PRESENT(name_)) THEN name__tmp = cxios_is_defined_scalargroup_name & (scalargroup_hdl%daddr) diff --git a/xios_2311_src/src/interface/fortran_attr/scalar_interface_attr.F90 b/xios_2311_src/src/interface/fortran_attr/scalar_interface_attr.F90 index 9d69f08d84757200faf7c8aed69d58556d317a98..1b7cdd048cf22257a6b7b46477e6f4903a9eba50 100644 --- a/xios_2311_src/src/interface/fortran_attr/scalar_interface_attr.F90 +++ b/xios_2311_src/src/interface/fortran_attr/scalar_interface_attr.F90 @@ -135,25 +135,6 @@ MODULE scalar_interface_attr END FUNCTION cxios_is_defined_scalar_long_name - SUBROUTINE cxios_set_scalar_mask(scalar_hdl, mask) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - LOGICAL (KIND=C_BOOL) , VALUE :: mask - END SUBROUTINE cxios_set_scalar_mask - - SUBROUTINE cxios_get_scalar_mask(scalar_hdl, mask) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - LOGICAL (KIND=C_BOOL) :: mask - END SUBROUTINE cxios_get_scalar_mask - - FUNCTION cxios_is_defined_scalar_mask(scalar_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_scalar_mask - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - END FUNCTION cxios_is_defined_scalar_mask - - SUBROUTINE cxios_set_scalar_name(scalar_hdl, name, name_size) BIND(C) USE ISO_C_BINDING INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl diff --git a/xios_2311_src/src/interface/fortran_attr/scalargroup_interface_attr.F90 b/xios_2311_src/src/interface/fortran_attr/scalargroup_interface_attr.F90 index b1171ec74a409fccc71fa0ea56ada7e999d1553d..875c7b102b06263c959801c54a40bf73aa35a389 100644 --- a/xios_2311_src/src/interface/fortran_attr/scalargroup_interface_attr.F90 +++ b/xios_2311_src/src/interface/fortran_attr/scalargroup_interface_attr.F90 @@ -156,25 +156,6 @@ MODULE scalargroup_interface_attr END FUNCTION cxios_is_defined_scalargroup_long_name - SUBROUTINE cxios_set_scalargroup_mask(scalargroup_hdl, mask) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: scalargroup_hdl - LOGICAL (KIND=C_BOOL) , VALUE :: mask - END SUBROUTINE cxios_set_scalargroup_mask - - SUBROUTINE cxios_get_scalargroup_mask(scalargroup_hdl, mask) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: scalargroup_hdl - LOGICAL (KIND=C_BOOL) :: mask - END SUBROUTINE cxios_get_scalargroup_mask - - FUNCTION cxios_is_defined_scalargroup_mask(scalargroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_scalargroup_mask - INTEGER (kind = C_INTPTR_T), VALUE :: scalargroup_hdl - END FUNCTION cxios_is_defined_scalargroup_mask - - SUBROUTINE cxios_set_scalargroup_name(scalargroup_hdl, name, name_size) BIND(C) USE ISO_C_BINDING INTEGER (kind = C_INTPTR_T), VALUE :: scalargroup_hdl diff --git a/xios_2311_src/src/io/inetcdf4.cpp b/xios_2311_src/src/io/inetcdf4.cpp index 8860cb43894b11a79c9dc8c88d838ff8d3179e61..a959e321cdf3f877e2b9a232cb044378f3e8ee9c 100644 --- a/xios_2311_src/src/io/inetcdf4.cpp +++ b/xios_2311_src/src/io/inetcdf4.cpp @@ -27,6 +27,7 @@ namespace xios CNetCdfInterface::open(filename, NC_NOWRITE, this->ncidp); this->timeCounterName = timeCounterName; + if (!CNetCdfInterface::isDimExisted(this->ncidp, this->timeCounterName)) this->timeCounterName=this->getUnlimitedDimensionName() ; } @@ -88,6 +89,16 @@ namespace xios return retvalue; } + + bool CINetCDF4::hasUnlimitedDimension(const CVarPath* const path) + { + int dimid = 0; + int grpid = this->getGroup(path); + CNetCdfInterface::inqUnLimDim(grpid, dimid); + if (dimid==-1) return false ; + else return true ; + } + int CINetCDF4::getUnlimitedDimension(const CVarPath* const path) { int dimid = 0; @@ -173,11 +184,6 @@ namespace xios return retvalue; } - StdSize CINetCDF4::getNbOfTimestep(const CVarPath* const path) - { - return this->getDimensions(NULL, path)[this->getUnlimitedDimensionName(path)]; - } - std::set CINetCDF4::getBoundVariables(const CVarPath* const path) { std::set retvalue; @@ -337,6 +343,32 @@ namespace xios return false; } + template + bool CINetCDF4::hasAttribute(const StdString& name, const StdString* const var, const CVarPath* const path) + { + std::list atts = this->getAttributes(var, path); + std::list::const_iterator it = atts.begin(), end = atts.end(); + for (; it != end; it++) + { + const StdString& attname = *it; + if (attname.compare(0, name.size(), name) == 0) + { + std::pair attinfos = this->getAttribute(name, var, path); + std::vector retvalue(attinfos.second); + nc_type type = CNetCdfInterface::getNcType(); + if (attinfos.first == type) return true; + else return false ; + } + } + return false; + } + + template bool CINetCDF4::hasAttribute(const StdString& name, const StdString* const var, const CVarPath* const path); + template bool CINetCDF4::hasAttribute(const StdString& name, const StdString* const var, const CVarPath* const path); + template bool CINetCDF4::hasAttribute(const StdString& name, const StdString* const var, const CVarPath* const path); + template bool CINetCDF4::hasAttribute(const StdString& name, const StdString* const var, const CVarPath* const path); + + bool CINetCDF4::hasVariable(const StdString& name, const CVarPath* const path) { @@ -707,51 +739,20 @@ namespace xios sstart.push_back(0); scount.push_back(1); it++; - - if ( it == dimlist.end()) // scalar case - { - if (start && count) - { - scount.pop_back(); - scount.push_back((*count)[0]); - array_size *= (*count)[0]; - } - return ; - } } - - if ( it == dimlist.end()) // scalar case + for (int i = 0; it != dimlist.end(); it++, i++) { if (start && count) { - sstart.push_back((*start)[0]); - scount.push_back((*count)[0]); - array_size *= (*count)[0]; + sstart.push_back((*start)[i]); + scount.push_back((*count)[i]); + array_size *= (*count)[i]; } else { sstart.push_back(0); - scount.push_back(1); - array_size *= 1; - } - - } - else - { - for (int i = 0; it != dimlist.end(); it++, i++) - { - if (start && count) - { - sstart.push_back((*start)[i]); - scount.push_back((*count)[i]); - array_size *= (*count)[i]; - } - else - { - sstart.push_back(0); - scount.push_back(dimmap[*it]); - array_size *= dimmap[*it]; - } + scount.push_back(dimmap[*it]); + array_size *= dimmap[*it]; } } } @@ -793,7 +794,7 @@ namespace xios if (this->hasAttribute(CCFKeywords::XIOS_CF_units, &(*itList), path)) { StdString unit = this->getAttributeValue(CCFKeywords::XIOS_CF_units, &(*itList), path); - if (CCFConvention::XIOS_CF_Longitude_units().end() != CCFConvention::XIOS_CF_Longitude_units().find(unit)) + if (CCFConvention::XIOS_CF_Longitude_units.end() != CCFConvention::XIOS_CF_Longitude_units.find(unit)) { lonName = *itList; return lonName; @@ -815,7 +816,7 @@ namespace xios if (this->hasAttribute(CCFKeywords::XIOS_CF_units, &(*itList), path)) { StdString unit = this->getAttributeValue(CCFKeywords::XIOS_CF_units, &(*itList), path); - if (CCFConvention::XIOS_CF_Latitude_units().end() != CCFConvention::XIOS_CF_Latitude_units().find(unit)) + if (CCFConvention::XIOS_CF_Latitude_units.end() != CCFConvention::XIOS_CF_Latitude_units.find(unit)) { latName = *itList; return latName; @@ -841,8 +842,8 @@ namespace xios if (this->hasAttribute(CCFKeywords::XIOS_CF_units, &varname, path)) { StdString unit = this->getAttributeValue(CCFKeywords::XIOS_CF_units, &varname, path); - return (CCFConvention::XIOS_CF_Latitude_units().end() != CCFConvention::XIOS_CF_Latitude_units().find(unit) - || CCFConvention::XIOS_CF_Longitude_units().end() != CCFConvention::XIOS_CF_Longitude_units().find(unit)); + return (CCFConvention::XIOS_CF_Latitude_units.end() != CCFConvention::XIOS_CF_Latitude_units.find(unit) + || CCFConvention::XIOS_CF_Longitude_units.end() != CCFConvention::XIOS_CF_Longitude_units.find(unit)); } else return false ; } diff --git a/xios_2311_src/src/io/inetcdf4.hpp b/xios_2311_src/src/io/inetcdf4.hpp index 3fd1bf7ada5693ee2ef2ff470853e8f9b7a496fd..8b91e0f2dff900c23a77977dafd527ad2874fc9f 100644 --- a/xios_2311_src/src/io/inetcdf4.hpp +++ b/xios_2311_src/src/io/inetcdf4.hpp @@ -39,7 +39,6 @@ namespace xios //------------------------------------------------------------- /// Getters /// - StdSize getNbOfTimestep(const CVarPath* const path = NULL); StdString getUnlimitedDimensionName(const CVarPath* const path = NULL); @@ -111,7 +110,9 @@ namespace xios /// Tests /// bool hasMissingValue(const StdString& name, const CVarPath* const path = NULL); - + bool hasAttribute(const StdString& name, const StdString* const var = NULL, const CVarPath* const path = NULL); + + template bool hasAttribute(const StdString& name, const StdString* const var = NULL, const CVarPath* const path = NULL); bool hasVariable(const StdString& name, const CVarPath* const path = NULL); @@ -143,6 +144,8 @@ namespace xios int getVariable(const StdString& varname, const CVarPath* const path = NULL); int getDimension(const StdString& dimname, const CVarPath* const path = NULL); int getUnlimitedDimension(const CVarPath* const path = NULL); + bool hasUnlimitedDimension(const CVarPath* const path = NULL); + int getAttributeId(const StdString& name, const StdString* const var = NULL, const CVarPath* const path = NULL); diff --git a/xios_2311_src/src/io/inetcdf4_impl.hpp b/xios_2311_src/src/io/inetcdf4_impl.hpp index 8fc71f4d4a2e441c13f5ae7b582567b4cd3221f0..eacd2705932f4ea2232ef17f61f365014c6a05e5 100644 --- a/xios_2311_src/src/io/inetcdf4_impl.hpp +++ b/xios_2311_src/src/io/inetcdf4_impl.hpp @@ -30,13 +30,8 @@ void CINetCDF4::getData(CArray& data, const StdString& var, << ", Data size = " << array_size << " ] Invalid array size"); } - - if (data.numElements()==0) - { - T data ; - CNetCdfInterface::getVaraType(ncidp, varid, &sstart[0], &scount[0], &data); // netcdf is very bad - } - else CNetCdfInterface::getVaraType(ncidp, varid, &sstart[0], &scount[0], data.dataFirst()); + + CNetCdfInterface::getVaraType(ncidp, varid, &sstart[0], &scount[0], data.dataFirst()); } } // namespace xios diff --git a/xios_2311_src/src/io/nc4_data_input.cpp b/xios_2311_src/src/io/nc4_data_input.cpp index abfd27db2da3f93d457f2d3b1cd07c6dadd4362e..79e6c898173b0dcf690426c70bd881d32bebef23 100644 --- a/xios_2311_src/src/io/nc4_data_input.cpp +++ b/xios_2311_src/src/io/nc4_data_input.cpp @@ -34,7 +34,6 @@ namespace xios if (SuperClassWriter::isTemporal(fieldId)) { -// return SuperClassWriter::getDimensions(&fieldId)[SuperClassWriter::getUnlimitedDimensionName()]; return SuperClassWriter::getDimensions(&fieldId)[SuperClassWriter::getTimeCounterName()]; } @@ -42,21 +41,26 @@ namespace xios } CATCH - void CNc4DataInput::readFieldData_(CField* field, int record, CArray& dataOut) + void CNc4DataInput::readFieldData_(CField* field) TRY { CContext* context = CContext::getCurrent(); + CContextServer* server = context->server; - CGrid* grid = field->getGrid(); + CGrid* grid = field->grid; - if (!grid->doGridHaveDataToWrite()) if (SuperClass::type==MULTI_FILE || !isCollective) return; + if (!grid->doGridHaveDataToWrite()) + if (SuperClass::type==MULTI_FILE || !isCollective) return; StdString fieldId = field->getFieldOutputName(); + CArray fieldData(grid->getWrittenDataSize()); + if (!field->default_value.isEmpty()) fieldData = field->default_value; + switch (SuperClass::type) { case MULTI_FILE: - SuperClassWriter::getData(dataOut, fieldId, isCollective, record ); + SuperClassWriter::getData(fieldData, fieldId, isCollective, (field->getNStep() - 1)%field->nstepMax ); break; case ONE_FILE: { @@ -65,9 +69,8 @@ namespace xios CArray axisDomainOrder = grid->axis_domain_order; std::vector domainList = grid->getDomainList(); std::vector axisList = grid->getAxisList(); - std::vector scalarList = grid->getScalarList(); int numElement = axisDomainOrder.numElements(); - int idxDomain = domainList.size() - 1, idxAxis = axisList.size() - 1 ; + int idxDomain = domainList.size() - 1, idxAxis = axisList.size() - 1; int idx = domainList.size() * 2 + axisList.size() - 1; start.reserve(idx+1); @@ -98,17 +101,26 @@ namespace xios { if (1 == axisDomainOrder.numElements()) { - CScalar* scalar = CScalar::get(scalarList[0]); start.push_back(0); - count.push_back(scalar->n); + count.push_back(1); } } } - SuperClassWriter::getData(dataOut, fieldId, isCollective, record, &start, &count); + SuperClassWriter::getData(fieldData, fieldId, isCollective, (field->getNStep() - 1)%field->nstepMax, &start, &count); break; } } + + field->inputField(fieldData); + + if (!field->scale_factor.isEmpty() || !field->add_offset.isEmpty()) + { + double scaleFactor = 1.0, addOffset = 0.0; + if (!field->scale_factor.isEmpty()) scaleFactor = field->scale_factor; + if (!field->add_offset.isEmpty()) addOffset = field->add_offset; + field->invertScaleFactorAddOffset(scaleFactor, addOffset); + } } CATCH @@ -117,7 +129,7 @@ namespace xios { StdString fieldId = field->getFieldOutputName(); - CGrid* grid = field->getGrid(); + CGrid* grid = field->grid; std::vector domainP = grid->getDomains(); std::vector axisP = grid->getAxis(); @@ -145,7 +157,7 @@ namespace xios // Remove unlimited dimension from the map, we dont need it anymore if (SuperClassWriter::isTemporal(fieldId)) { - dimSizeMap.erase(SuperClassWriter::getUnlimitedDimensionName()); + dimSizeMap.erase(SuperClassWriter::getTimeCounterName()); dimList.pop_front() ; // assume time dimension is first } @@ -181,6 +193,23 @@ namespace xios for (std::list::const_iterator it = dimList.begin(); it != dimList.end(); ++it) listDimSize.push_front(*dimSizeMap.find(*it)); } + + // read specific field attribute + if (field->add_offset.isEmpty()) + { + if (SuperClassWriter::hasAttribute("add_offset",&fieldId)) + field->add_offset = SuperClassWriter::getAttributeValue("add_offset",&fieldId)[0] ; + else if (SuperClassWriter::hasAttribute("add_offset",&fieldId)) + field->add_offset = SuperClassWriter::getAttributeValue("add_offset",&fieldId)[0] ; + } + + if (field->scale_factor.isEmpty()) + { + if (SuperClassWriter::hasAttribute("scale_factor",&fieldId)) + field->scale_factor = SuperClassWriter::getAttributeValue("scale_factor",&fieldId)[0] ; + else if (SuperClassWriter::hasAttribute("scale_factor",&fieldId)) + field->scale_factor = SuperClassWriter::getAttributeValue("scale_factor",&fieldId)[0] ; + } // Now process domain and axis CArray axisDomainOrder = grid->axis_domain_order; @@ -565,7 +594,9 @@ namespace xios if (!axis->begin.isEmpty()) begin = axis->begin.getValue(); if (!axis->n.isEmpty()) n = axis->n.getValue(); axis->value.resize(n); - for (int i = 0; i < n; ++i) axis->value(i) = readAxisValue(begin + i); + double convertFromFactor=1.0 ; + if (!axis->convert_from_factor.isEmpty()) convertFromFactor = axis->convert_from_factor ; + for (int i = 0; i < n; ++i) axis->value(i) = readAxisValue(begin + i)*convertFromFactor; } } } diff --git a/xios_2311_src/src/io/nc4_data_input.hpp b/xios_2311_src/src/io/nc4_data_input.hpp index 0700b753af51dd696a7256db2e1cef60611064b7..ad82d7ca7faee002cc5a9586045968c0cbe6bb71 100644 --- a/xios_2311_src/src/io/nc4_data_input.hpp +++ b/xios_2311_src/src/io/nc4_data_input.hpp @@ -36,7 +36,7 @@ namespace xios protected: // Read methods virtual StdSize getFieldNbRecords_(CField* field); - virtual void readFieldData_(CField* field, int record, CArray& data); + virtual void readFieldData_(CField* field); virtual void readFieldAttributes_(CField* field, bool readAttributeValues); virtual void closeFile_(void); diff --git a/xios_2311_src/src/io/nc4_data_output.cpp b/xios_2311_src/src/io/nc4_data_output.cpp index 1dbb554b7ead81549ec23c451c69b769e98c93de..5891a5c6709f94ae14e0f573ac74e5ce7a3a5ad9 100755 --- a/xios_2311_src/src/io/nc4_data_output.cpp +++ b/xios_2311_src/src/io/nc4_data_output.cpp @@ -56,6 +56,9 @@ namespace xios TRY { StdString lonName,latName ; + + domain->computeWrittenIndex(); + domain->computeWrittenCompressedIndex(comm_file); if (domain->type == CDomain::type_attr::unstructured) { @@ -67,6 +70,7 @@ namespace xios } CContext* context = CContext::getCurrent() ; + CContextServer* server=context->server ; if (domain->IsWritten(this->filename)) return; domain->checkAttributes(); @@ -141,6 +145,74 @@ namespace xios string lonid,latid,bounds_lonid,bounds_latid ; string areaId = "area" + appendDomid; +/* + StdString lonid_loc = (server->intraCommSize > 1) + ? StdString("lon").append(appendDomid).append("_local") + : lonid; + StdString latid_loc = (server->intraCommSize > 1) + ? StdString("lat").append(appendDomid).append("_local") + : latid; +*/ + + CArray& indexToWrite = domain->localIndexToWriteOnServer; + int nbWritten = indexToWrite.numElements(); + CArray writtenLat, writtenLon; + CArray writtenBndsLat, writtenBndsLon; + CArray writtenArea; + + if (domain->hasLonLat) + { + writtenLat.resize(nbWritten); + writtenLon.resize(nbWritten); + for (int idx = 0; idx < nbWritten; ++idx) + { + if (indexToWrite(idx) < 0) + { + writtenLat(idx) = -1.; // hole + writtenLon(idx) = -1.; + } + else + { + writtenLat(idx) = domain->latvalue(indexToWrite(idx)); + writtenLon(idx) = domain->lonvalue(indexToWrite(idx)); + } + } + + if (domain->hasBounds) + { + int nvertex = domain->nvertex, idx; + writtenBndsLat.resize(nvertex, nbWritten); + writtenBndsLon.resize(nvertex, nbWritten); + CArray& boundslat = domain->bounds_latvalue; + CArray& boundslon = domain->bounds_lonvalue; + for (idx = 0; idx < nbWritten; ++idx) + for (int nv = 0; nv < nvertex; ++nv) + { + if (indexToWrite(idx) < 0) + { + writtenBndsLat(nv, idx) = -1.; // hole + writtenBndsLon(nv, idx) = -1.; + } + else + { + writtenBndsLat(nv, idx) = boundslat(nv, int(indexToWrite(idx))); + writtenBndsLon(nv, idx) = boundslon(nv, int(indexToWrite(idx))); + } + } + } + } + + if (domain->hasArea) + { + writtenArea.resize(nbWritten); + for (int idx = 0; idx < nbWritten; ++idx) + { + if (indexToWrite(idx) < 0) + writtenArea(idx) = -1.; + else + writtenArea(idx) = domain->areavalue(indexToWrite(idx)); + } + } try { @@ -173,7 +245,11 @@ namespace xios if (domain->hasBounds) SuperClassWriter::addDimension(dimVertId, domain->nvertex); - if (context->intraCommSize_ > 1) + int commRank ; + int commSize ; + MPI_Comm_rank(comm_file,&commRank) ; + MPI_Comm_size(comm_file,&commSize) ; + if (commSize > 1) { this->writeLocalAttributes(domain->ibegin, domain->ni, @@ -188,7 +264,7 @@ namespace xios domain->jbegin, domain->nj, domain->ni_glo,domain->nj_glo, - context->intraCommRank_,context->intraCommSize_); + commRank,commSize); } if (domain->hasLonLat) @@ -226,6 +302,21 @@ namespace xios dim0.push_back(dimYid); dim0.push_back(dimXid); + + // supress mask if (server->intraCommSize > 1) + // supress mask { + // supress mask SuperClassWriter::addVariable(maskid, NC_INT, dim0); + // supress mask + // supress mask this->writeMaskAttributes(maskid, + // supress mask domain->data_dim.getValue()/*, + // supress mask domain->data_ni.getValue(), + // supress mask domain->data_nj.getValue(), + // supress mask domain->data_ibegin.getValue(), + // supress mask domain->data_jbegin.getValue()*/); + // supress mask } + + //SuperClassWriter::setDefaultValue(maskid, &dvm); + if (domain->hasArea) { SuperClassWriter::addVariable(areaId, typePrec, dim0, compressionLevel); @@ -240,27 +331,27 @@ namespace xios switch (domain->type) { case CDomain::type_attr::curvilinear : - SuperClassWriter::writeData(domain->latvalue, latid, isCollective, 0); - SuperClassWriter::writeData(domain->lonvalue, lonid, isCollective, 0); + SuperClassWriter::writeData(writtenLat, latid, isCollective, 0); + SuperClassWriter::writeData(writtenLon, lonid, isCollective, 0); break; case CDomain::type_attr::rectilinear : - CArray lat = domain->latvalue(Range(fromStart,toEnd,domain->ni)) ; + CArray lat = writtenLat(Range(fromStart,toEnd,domain->ni)) ; SuperClassWriter::writeData(CArray(lat.copy()), latid, isCollective, 0); - CArray lon = domain->lonvalue(Range(0,domain->ni-1)) ; + CArray lon = writtenLon(Range(0,domain->ni-1)) ; SuperClassWriter::writeData(CArray(lon.copy()), lonid, isCollective, 0); break; } if (domain->hasBounds) { - SuperClassWriter::writeData(domain->bounds_lonvalue, bounds_lonid, isCollective, 0); - SuperClassWriter::writeData(domain->bounds_latvalue, bounds_latid, isCollective, 0); + SuperClassWriter::writeData(writtenBndsLon, bounds_lonid, isCollective, 0); + SuperClassWriter::writeData(writtenBndsLat, bounds_latid, isCollective, 0); } } if (domain->hasArea) { - SuperClassWriter::writeData(domain->areavalue, areaId, isCollective, 0); + SuperClassWriter::writeData(writtenArea, areaId, isCollective, 0); } SuperClassWriter::definition_start(); @@ -338,14 +429,23 @@ namespace xios { std::vector start(2) ; std::vector count(2) ; - start[1]=domain->ibegin; - start[0]=domain->jbegin; - count[1]=domain->ni ; count[0]=domain->nj ; +// Comment out: it is not working for a hole +// if (domain->isEmpty()) +// { +// start[0]=0 ; start[1]=0 ; +// count[0]=0 ; count[1]=0 ; +// } +// else + { + start[1]=domain->ibegin; + start[0]=domain->jbegin; + count[1]=domain->ni ; count[0]=domain->nj ; + } if (domain->hasLonLat) { - SuperClassWriter::writeData(domain->latvalue, latid, isCollective, 0,&start,&count); - SuperClassWriter::writeData(domain->lonvalue, lonid, isCollective, 0,&start,&count); + SuperClassWriter::writeData(writtenLat, latid, isCollective, 0,&start,&count); + SuperClassWriter::writeData(writtenLon, lonid, isCollective, 0,&start,&count); } break; } @@ -355,16 +455,25 @@ namespace xios { std::vector start(1) ; std::vector count(1) ; - - start[0]=domain->jbegin; - count[0]=domain->nj; - CArray lat = domain->latvalue(Range(fromStart,toEnd,domain->ni)); - SuperClassWriter::writeData(CArray(lat.copy()), latid, isCollective, 0,&start,&count); - - start[0]=domain->ibegin; - count[0]=domain->ni; - CArray lon = domain->lonvalue(Range(0,domain->ni-1)); - SuperClassWriter::writeData(CArray(lon.copy()), lonid, isCollective, 0,&start,&count); + if (domain->isEmpty()) + { + start[0]=0 ; + count[0]=0 ; + SuperClassWriter::writeData(writtenLat, latid, isCollective, 0,&start,&count); + SuperClassWriter::writeData(writtenLon, lonid, isCollective, 0,&start,&count); + } + else + { + start[0]=domain->jbegin; + count[0]=domain->nj; + CArray lat = writtenLat(Range(fromStart,toEnd,domain->ni)); + SuperClassWriter::writeData(CArray(lat.copy()), latid, isCollective, 0,&start,&count); + + start[0]=domain->ibegin; + count[0]=domain->ni; + CArray lon = writtenLon(Range(0,domain->ni-1)); + SuperClassWriter::writeData(CArray(lon.copy()), lonid, isCollective, 0,&start,&count); + } } break; } @@ -389,8 +498,8 @@ namespace xios count[0] = domain->nj; } - SuperClassWriter::writeData(domain->bounds_lonvalue, bounds_lonid, isCollective, 0, &start, &count); // will probably not working for rectilinear - SuperClassWriter::writeData(domain->bounds_latvalue, bounds_latid, isCollective, 0, &start, &count); + SuperClassWriter::writeData(writtenBndsLon, bounds_lonid, isCollective, 0, &start, &count); + SuperClassWriter::writeData(writtenBndsLat, bounds_latid, isCollective, 0, &start, &count); } if (domain->hasArea) @@ -398,12 +507,20 @@ namespace xios std::vector start(2); std::vector count(2); - start[1] = domain->ibegin; - start[0] = domain->jbegin; - count[1] = domain->ni; - count[0] = domain->nj; + if (domain->isEmpty()) + { + start[0] = 0; start[1] = 0; + count[0] = 0; count[1] = 0; + } + else + { + start[1] = domain->ibegin; + start[0] = domain->jbegin; + count[1] = domain->ni; + count[0] = domain->nj; + } - SuperClassWriter::writeData(domain->areavalue, areaId, isCollective, 0, &start, &count); + SuperClassWriter::writeData(writtenArea, areaId, isCollective, 0, &start, &count); } SuperClassWriter::definition_start(); @@ -434,6 +551,7 @@ namespace xios void CNc4DataOutput::writeUnstructuredDomainUgrid(CDomain* domain) { CContext* context = CContext::getCurrent() ; + CContextServer* server=context->server ; if (domain->IsWritten(this->filename)) return; @@ -441,6 +559,7 @@ namespace xios // The first domain for the same mesh that will be written is that with the highest value of nvertex. // Thus the entire mesh connectivity will be generated at once. + if (isWrittenDomain(domid)) return ; else setWrittenDomain(domid); @@ -455,8 +574,6 @@ namespace xios std::vector dim0; StdString domainName = domain->name; - domain->assignMesh(domainName, domain->nvertex); - domain->mesh->createMeshEpsilon(context->intraComm_, domain->lonvalue, domain->latvalue, domain->bounds_lonvalue, domain->bounds_latvalue); StdString node_x = domainName + "_node_x"; StdString node_y = domainName + "_node_y"; @@ -486,6 +603,7 @@ namespace xios SuperClassWriter::addAttribute("topology_dimension", 2, &domainName); SuperClassWriter::addAttribute("node_coordinates", node_x + " " + node_y, &domainName); + try { switch (SuperClass::type) @@ -572,6 +690,8 @@ namespace xios { SuperClassWriter::addAttribute("edge_coordinates", edge_x + " " + edge_y, &domainName); SuperClassWriter::addAttribute("edge_node_connectivity", edge_nodes, &domainName); + SuperClassWriter::addAttribute("face_edge_connectivity", face_edges, &domainName); + SuperClassWriter::addAttribute("edge_face_connectivity", edge_faces, &domainName); SuperClassWriter::addDimension(dimEdge, domain->mesh->nbEdgesGlo); dim0.clear(); dim0.push_back(dimEdge); @@ -591,6 +711,7 @@ namespace xios SuperClassWriter::addAttribute("long_name", StdString("Maps every edge/link to two nodes that it connects."), &edge_nodes); SuperClassWriter::addAttribute("start_index", 0, &edge_nodes); } + SuperClassWriter::addAttribute("face_face_connectivity", face_faces, &domainName); SuperClassWriter::addAttribute("face_coordinates", face_x + " " + face_y, &domainName); SuperClassWriter::addAttribute("face_node_connectivity", face_nodes, &domainName); SuperClassWriter::addDimension(dimFace, domain->ni_glo); @@ -624,7 +745,7 @@ namespace xios dim0.push_back(dimEdge); dim0.push_back(dimTwo); SuperClassWriter::addVariable(edge_faces, NC_INT, dim0, compressionLevel); - SuperClassWriter::addAttribute("cf_role", StdString("edge_face connectivity"), &edge_faces); + SuperClassWriter::addAttribute("cf_role", StdString("edge_face_connectivity"), &edge_faces); SuperClassWriter::addAttribute("long_name", StdString("neighbor faces for edges"), &edge_faces); SuperClassWriter::addAttribute("start_index", 0, &edge_faces); SuperClassWriter::addAttribute("_FillValue", -999, &edge_faces); @@ -633,7 +754,7 @@ namespace xios dim0.push_back(dimFace); dim0.push_back(dimVertex); SuperClassWriter::addVariable(face_faces, NC_INT, dim0, compressionLevel); - SuperClassWriter::addAttribute("cf_role", StdString("face_face connectivity"), &face_faces); + SuperClassWriter::addAttribute("cf_role", StdString("face_face_connectivity"), &face_faces); SuperClassWriter::addAttribute("long_name", StdString("Indicates which other faces neighbor each face"), &face_faces); SuperClassWriter::addAttribute("start_index", 0, &face_faces); SuperClassWriter::addAttribute("_FillValue", 999999, &face_faces); @@ -692,6 +813,7 @@ namespace xios countEdges[0] = domain->ni; startNodes[0] = domain->mesh->node_start; countNodes[0] = domain->mesh->node_count; + if (countNodes[0]==0) startNodes[0]=0 ; // for netcdf error startEdgeNodes[0] = domain->ibegin; startEdgeNodes[1] = 0; countEdgeNodes[0] = domain->ni; @@ -728,19 +850,27 @@ namespace xios countFaces[0] = domain->ni ; startNodes[0] = domain->mesh->node_start; countNodes[0] = domain->mesh->node_count; + if (countNodes[0]==0) startNodes[0]=0; + startEdges[0] = domain->mesh->edge_start; countEdges[0] = domain->mesh->edge_count; + if (countEdges[0]==0) startEdges[0]=0 ; // for netcdf error + startEdgeNodes[0] = domain->mesh->edge_start; - startEdgeNodes[1] = 0; countEdgeNodes[0] = domain->mesh->edge_count; + if (countEdgeNodes[0]==0) startEdgeNodes[0]=0; // for netcdf error + startEdgeNodes[1] = 0; countEdgeNodes[1]= 2; + startEdgeFaces[0] = domain->mesh->edge_start; - startEdgeFaces[1]= 0; countEdgeFaces[0] = domain->mesh->edge_count; + if (countEdgeFaces[0]==0) startEdgeFaces[0]=0 ; // for netcdf error + startEdgeFaces[1]= 0; countEdgeFaces[1]= 2; + startFaceConctv[0] = domain->ibegin; - startFaceConctv[1] = 0; countFaceConctv[0] = domain->ni; + startFaceConctv[1] = 0; countFaceConctv[1] = domain->nvertex; } SuperClassWriter::writeData(domain->mesh->node_lat, node_y, isCollective, 0, &startNodes, &countNodes); @@ -793,6 +923,7 @@ namespace xios void CNc4DataOutput::writeUnstructuredDomain(CDomain* domain) { CContext* context = CContext::getCurrent() ; + CContextServer* server=context->server ; if (domain->IsWritten(this->filename)) return; domain->checkAttributes(); @@ -829,6 +960,68 @@ namespace xios int nvertex = (domain->nvertex.isEmpty()) ? 0 : domain->nvertex; + CArray& indexToWrite = domain->localIndexToWriteOnServer; + int nbWritten = indexToWrite.numElements(); + CArray writtenLat, writtenLon; + CArray writtenBndsLat, writtenBndsLon; + CArray writtenArea; + + if (domain->hasLonLat) + { + writtenLat.resize(nbWritten); + writtenLon.resize(nbWritten); + for (int idx = 0; idx < nbWritten; ++idx) + { + if (indexToWrite(idx) < 0) + { + writtenLat(idx) = -1.; + writtenLon(idx) = -1.; + } + else + { + writtenLat(idx) = domain->latvalue(indexToWrite(idx)); + writtenLon(idx) = domain->lonvalue(indexToWrite(idx)); + } + } + } + + if (domain->hasBounds) + { + int nvertex = domain->nvertex, idx; + writtenBndsLat.resize(nvertex, nbWritten); + writtenBndsLon.resize(nvertex, nbWritten); + CArray& boundslat = domain->bounds_latvalue; + CArray& boundslon = domain->bounds_lonvalue; + for (idx = 0; idx < nbWritten; ++idx) + { + for (int nv = 0; nv < nvertex; ++nv) + { + if (indexToWrite(idx) < 0) + { + writtenBndsLat(nv, idx) = -1.; + writtenBndsLon(nv, idx) = -1.; + } + else + { + writtenBndsLat(nv, idx) = boundslat(nv, int(indexToWrite(idx))); + writtenBndsLon(nv, idx) = boundslon(nv, int(indexToWrite(idx))); + } + } + } + } + + if (domain->hasArea) + { + writtenArea.resize(nbWritten); + for (int idx = 0; idx < nbWritten; ++idx) + { + if (indexToWrite(idx) < 0) + writtenArea(idx) = -1.; + else + writtenArea(idx) = domain->areavalue(indexToWrite(idx)); + } + } + try { switch (SuperClass::type) @@ -877,17 +1070,17 @@ namespace xios if (domain->hasLonLat) { - SuperClassWriter::writeData(domain->latvalue, latid, isCollective, 0); - SuperClassWriter::writeData(domain->lonvalue, lonid, isCollective, 0); + SuperClassWriter::writeData(writtenLat, latid, isCollective, 0); + SuperClassWriter::writeData(writtenLon, lonid, isCollective, 0); if (domain->hasBounds) { - SuperClassWriter::writeData(domain->bounds_lonvalue, bounds_lonid, isCollective, 0); - SuperClassWriter::writeData(domain->bounds_latvalue, bounds_latid, isCollective, 0); + SuperClassWriter::writeData(writtenBndsLon, bounds_lonid, isCollective, 0); + SuperClassWriter::writeData(writtenBndsLat, bounds_latid, isCollective, 0); } } if (domain->hasArea) - SuperClassWriter::writeData(domain->areavalue, areaId, isCollective, 0); + SuperClassWriter::writeData(writtenArea, areaId, isCollective, 0); SuperClassWriter::definition_start(); break ; @@ -959,17 +1152,17 @@ namespace xios if (domain->hasLonLat) { - SuperClassWriter::writeData(domain->latvalue, latid, isCollective, 0,&start,&count); - SuperClassWriter::writeData(domain->lonvalue, lonid, isCollective, 0,&start,&count); + SuperClassWriter::writeData(writtenLat, latid, isCollective, 0,&start,&count); + SuperClassWriter::writeData(writtenLon, lonid, isCollective, 0,&start,&count); if (domain->hasBounds) { - SuperClassWriter::writeData(domain->bounds_lonvalue, bounds_lonid, isCollective, 0,&startBounds,&countBounds); - SuperClassWriter::writeData(domain->bounds_latvalue, bounds_latid, isCollective, 0,&startBounds,&countBounds); + SuperClassWriter::writeData(writtenBndsLon, bounds_lonid, isCollective, 0,&startBounds,&countBounds); + SuperClassWriter::writeData(writtenBndsLat, bounds_latid, isCollective, 0,&startBounds,&countBounds); } } if (domain->hasArea) - SuperClassWriter::writeData(domain->areavalue, areaId, isCollective, 0, &start, &count); + SuperClassWriter::writeData(writtenArea, areaId, isCollective, 0, &start, &count); SuperClassWriter::definition_start(); @@ -999,6 +1192,9 @@ namespace xios if (axis->IsWritten(this->filename)) return; axis->checkAttributes(); + axis->computeWrittenIndex(); + axis->computeWrittenCompressedIndex(comm_file); + int size = (MULTI_FILE == SuperClass::type) ? axis->n.getValue() : axis->n_glo.getValue(); @@ -1098,7 +1294,34 @@ namespace xios } SuperClassWriter::definition_end(); - + + CArray& indexToWrite = axis->localIndexToWriteOnServer; + int nbWritten = indexToWrite.numElements(); + CArray axis_value(indexToWrite.numElements()); + if (!axis->value.isEmpty()) + { + for (int i = 0; i < nbWritten; i++) + { + if (indexToWrite(i) < 0) + axis_value(i) = -1; // Some value in case of a hole + else + axis_value(i) = axis->value(indexToWrite(i)); + } + } + CArray axis_bounds; + CArray axis_label; + if (!axis->label.isEmpty()) + { + axis_label.resize(indexToWrite.numElements()); + for (int i = 0; i < nbWritten; i++) + { + if (indexToWrite(i) < 0) + axis_label(i) = boost::lexical_cast(-1); // Some value in case of a hole + else + axis_label(i) = axis->label(indexToWrite(i)); + } + } + switch (SuperClass::type) { case MULTI_FILE: @@ -1106,13 +1329,29 @@ namespace xios if (axis->label.isEmpty()) { if (!axis->value.isEmpty()) - SuperClassWriter::writeData(axis->value, axisid, isCollective, 0); + SuperClassWriter::writeData(axis_value, axisid, isCollective, 0); if (!axis->bounds.isEmpty()) - SuperClassWriter::writeData(axis->bounds, axisBoundsId, isCollective, 0); + { + axis_bounds.resize(2, indexToWrite.numElements()); + for (int i = 0; i < nbWritten; ++i) + { + if (indexToWrite(i) < 0) + { + axis_bounds(0, i) = -1.; // Some value in case of a hole + axis_bounds(1, i) = -1.; + } + else + { + axis_bounds(0, i) = axis->bounds(0, int(indexToWrite(i))); + axis_bounds(1, i) = axis->bounds(1, int(indexToWrite(i))); + } + } + SuperClassWriter::writeData(axis_bounds, axisBoundsId, isCollective, 0); + } } else - SuperClassWriter::writeData(axis->label, axisid, isCollective, 0); + SuperClassWriter::writeData(axis_label, axisid, isCollective, 0); SuperClassWriter::definition_start(); break; @@ -1129,17 +1368,33 @@ namespace xios if (axis->label.isEmpty()) { if (!axis->value.isEmpty()) - SuperClassWriter::writeData(axis->value, axisid, isCollective, 0, &start, &count); + SuperClassWriter::writeData(axis_value, axisid, isCollective, 0, &start, &count); if (!axis->bounds.isEmpty()) - SuperClassWriter::writeData(axis->bounds, axisBoundsId, isCollective, 0, &startBounds, &countBounds); + { + axis_bounds.resize(2, indexToWrite.numElements()); + for (int i = 0; i < nbWritten; ++i) + { + if (indexToWrite(i) < 0) + { + axis_bounds(0, i) = -1.; + axis_bounds(1, i) = -1.; + } + else + { + axis_bounds(0, i) = axis->bounds(0, int(indexToWrite(i))); + axis_bounds(1, i) = axis->bounds(1, int(indexToWrite(i))); + } + } + SuperClassWriter::writeData(axis_bounds, axisBoundsId, isCollective, 0, &startBounds, &countBounds); + } } else { std::vector startLabel(2), countLabel(2); startLabel[0] = start[0]; startLabel[1] = 0; countLabel[0] = count[0]; countLabel[1] = stringArrayLen; - SuperClassWriter::writeData(axis->label, axisid, isCollective, 0, &startLabel, &countLabel); + SuperClassWriter::writeData(axis_label, axisid, isCollective, 0, &startLabel, &countLabel); } SuperClassWriter::definition_start(); @@ -1334,176 +1589,221 @@ namespace xios void CNc4DataOutput::writeGridCompressed_(CGrid* grid) { - if (grid->isScalarGrid() || grid->isWrittenCompressed(this->filename)) return; - - // NOTA : The cuurent algorithm to write compress elements of the grid - // will work pretting well when on server side you dont't get - // partial overlap on elements between differents participating process - // So the element must be totally distributed or non distributed - // If an element is partially overlaping betwwen process then the - // total compressed part will apear artificially greater than expected - // For the current implementation of writer which is decomposed only on - // one element, it will work as expected, but for future, it must be - // reconsidered again. - try - { - CArray axisDomainOrder = grid->axis_domain_order; - std::vector domainList = grid->getDomainList(); - std::vector axisList = grid->getAxisList(); - std::vector scalarList = grid->getScalarList(); - int numElement = axisDomainOrder.numElements(), idxDomain = 0, idxAxis = 0, idxScalar = 0; - int commRank ; - MPI_Comm_rank(comm_file,&commRank) ; + if (grid->isScalarGrid() || grid->isWrittenCompressed(this->filename)) return; - std::vector dims; + try + { + CArray axisDomainOrder = grid->axis_domain_order; + std::vector domainList = grid->getDomainList(); + std::vector axisList = grid->getAxisList(); + std::vector scalarList = grid->getScalarList(); + int numElement = axisDomainOrder.numElements(), idxDomain = 0, idxAxis = 0, idxScalar = 0; - for (int i = 0; i < numElement; ++i) - { - StdString varId, compress; - CArray indexes; - bool isDistributed; - size_t nbIndexes, totalNbIndexes, offset; - size_t firstGlobalIndex; - - if (2 == axisDomainOrder(i)) - { - CDomain* domain = CDomain::get(domainList[idxDomain]); - StdString domId = domain->getDomainOutputName(); - - if (!domain->isCompressible() - || domain->type == CDomain::type_attr::unstructured - || domain->isWrittenCompressed(this->filename) - || isWrittenCompressedDomain(domId)) - continue; - - // unstructured grid seems not be taken into account why ? + std::vector dims; - string lonName,latName ; + if (grid->isCompressible()) + { + StdString varId = grid->getId() + "_points"; - if (domain->lon_name.isEmpty()) - { - if (domain->type==CDomain::type_attr::curvilinear) lonName = "nav_lon"; - else lonName = "lon"; - } - else lonName = domain->lon_name; + int nbIndexes = (SuperClass::type == MULTI_FILE) ? grid->getNumberWrittenIndexes() : grid->getTotalNumberWrittenIndexes(); + SuperClassWriter::addDimension(varId, nbIndexes); - if (domain->lat_name.isEmpty()) - { - if (domain->type==CDomain::type_attr::curvilinear) latName = "nav_lat"; - else latName = "lat"; - } - else latName = domain->lat_name; - - StdString appendDomId = singleDomain ? "" : "_" + domId; - - varId = domId + "_points"; - compress = latName + appendDomId + " " + lonName + appendDomId; - - shared_ptr workflowView = domain->getLocalView(CElementView::WORKFLOW) ; - workflowView->getGlobalIndexView(indexes) ; - nbIndexes = workflowView->getSize() ; - isDistributed = domain->isDistributed(); - if (isDistributed) - { - MPI_Exscan(&nbIndexes, &offset, 1, MPI_SIZE_T, MPI_SUM, comm_file) ; - if (commRank==0) offset=0 ; - MPI_Allreduce(&nbIndexes,&totalNbIndexes,1 , MPI_SIZE_T, MPI_SUM, comm_file) ; - } - else - { - offset=0 ; - totalNbIndexes = nbIndexes ; - } + dims.push_back(varId); + SuperClassWriter::addVariable(varId, NC_INT, dims); - firstGlobalIndex = domain->ibegin + domain->jbegin * domain->ni_glo; + StdOStringStream compress; + for (int i = numElement - 1; i >= 0; --i) + { + if (2 == axisDomainOrder(i)) + { + CDomain* domain = CDomain::get(domainList[domainList.size() - idxDomain - 1]); + StdString domId = domain->getDomainOutputName(); + StdString appendDomId = singleDomain ? "" : "_" + domId; - domain->addRelFileCompressed(this->filename); - setWrittenCompressedDomain(domId); - ++idxDomain; - } - else if (1 == axisDomainOrder(i)) - { - CAxis* axis = CAxis::get(axisList[idxAxis]); - StdString axisId = axis->getAxisOutputName(); - - if (!axis->isCompressible() - || axis->isWrittenCompressed(this->filename) - || isWrittenCompressedAxis(axisId)) - continue; - - varId = axisId + "_points"; - compress = axisId; - - shared_ptr workflowView = axis->getLocalView(CElementView::WORKFLOW) ; - workflowView->getGlobalIndexView(indexes) ; - nbIndexes = workflowView->getSize() ; - isDistributed = axis->isDistributed(); - if (isDistributed) - { - MPI_Exscan(&nbIndexes, &offset, 1, MPI_SIZE_T, MPI_SUM, comm_file) ; - if (commRank==0) offset=0 ; - MPI_Allreduce(&nbIndexes,&totalNbIndexes,1 , MPI_SIZE_T, MPI_SUM, comm_file) ; - } - else - { - offset=0 ; - totalNbIndexes = nbIndexes ; - } - firstGlobalIndex = axis->begin; - - axis->addRelFileCompressed(this->filename); - setWrittenCompressedAxis(axisId); - ++idxAxis; - } - else - { - //for scalar - } + switch (domain->type) + { + case CDomain::type_attr::curvilinear: + compress << "y" << appendDomId << " x" << appendDomId; + break; + case CDomain::type_attr::rectilinear: + compress << "lat" << appendDomId << " lon" << appendDomId; + break; + case CDomain::type_attr::unstructured: + StdString cellName = (!domain->dim_i_name.isEmpty()) ? cellName=domain->dim_i_name : "cell"; + compress << cellName << appendDomId; +// compress << "cell" << appendDomId; + break; + } + ++idxDomain; + } + else if (1 == axisDomainOrder(i)) + { + CAxis* axis = CAxis::get(axisList[axisList.size() - idxAxis - 1]); + compress << axis->getAxisOutputName(); + ++idxAxis; + } + else + { + CScalar* scalar = CScalar::get(scalarList[scalarList.size() - idxScalar - 1]); + compress << scalar->getScalarOutputName(); + ++idxScalar; + } - if (!varId.empty()) - { - SuperClassWriter::addDimension(varId, (SuperClass::type == MULTI_FILE) ? nbIndexes : totalNbIndexes); + if (i != 0) compress << ' '; + } + SuperClassWriter::addAttribute("compress", compress.str(), &varId); - dims.clear(); - dims.push_back(varId); - SuperClassWriter::addVariable(varId, NC_UINT64, dims); + CArray indexes(grid->getNumberWrittenIndexes()); + indexes = grid->localIndexToWriteOnServer; - SuperClassWriter::addAttribute("compress", compress, &varId); + switch (SuperClass::type) + { + case (MULTI_FILE): + { + SuperClassWriter::writeData(indexes, varId, isCollective, 0); + break; + } + case (ONE_FILE): + { + if (grid->doGridHaveDataDistributed()) + grid->getDistributionServer()->computeGlobalIndex(indexes); - switch (SuperClass::type) - { - case (MULTI_FILE): - { - indexes -= firstGlobalIndex; - SuperClassWriter::writeData(indexes, varId, isCollective, 0); - break; - } - case (ONE_FILE): - { - std::vector start, count; - start.push_back(offset); - count.push_back(nbIndexes); + std::vector start, count; + start.push_back(grid->getOffsetWrittenIndexes()); + count.push_back(grid->getNumberWrittenIndexes()); - SuperClassWriter::writeData(indexes, varId, isCollective, 0, &start, &count); - break; - } - } + SuperClassWriter::writeData(indexes, varId, isCollective, 0, &start, &count); + break; + } + } + } + else + { + for (int i = 0; i < numElement; ++i) + { + StdString varId, compress; + CArray indexes; + bool isDistributed; + StdSize nbIndexes, totalNbIndexes, offset; + int firstGlobalIndex; + + if (2 == axisDomainOrder(i)) + { + CDomain* domain = CDomain::get(domainList[idxDomain]); + StdString domId = domain->getDomainOutputName(); + + if (!domain->isCompressible() + || domain->type == CDomain::type_attr::unstructured + || domain->isWrittenCompressed(this->filename) + || isWrittenCompressedDomain(domId)) + continue; + + StdString appendDomId = singleDomain ? "" : "_" + domId; + + varId = domId + "_points"; + switch (domain->type) + { + case CDomain::type_attr::curvilinear: + compress = "y" + appendDomId + " x" + appendDomId; + break; + case CDomain::type_attr::rectilinear: + compress = "lat" + appendDomId + " lon" + appendDomId; + break; + } + + // indexes.resize(domain->compressedIndexToWriteOnServer[comm_file].numElements()); + // indexes = domain->compressedIndexToWriteOnServer[com_file]; + indexes.resize(domain->getCompressedIndexToWriteOnServer(comm_file).numElements()); + indexes = domain->getCompressedIndexToWriteOnServer(comm_file); + + isDistributed = domain->isDistributed(); + nbIndexes = domain->getNumberWrittenIndexes(comm_file); + totalNbIndexes = domain->getTotalNumberWrittenIndexes(comm_file); + offset = domain->getOffsetWrittenIndexes(comm_file); + firstGlobalIndex = domain->ibegin + domain->jbegin * domain->ni_glo; + + domain->addRelFileCompressed(this->filename); + setWrittenCompressedDomain(domId); + ++idxDomain; + } + else if (1 == axisDomainOrder(i)) + { + CAxis* axis = CAxis::get(axisList[idxAxis]); + StdString axisId = axis->getAxisOutputName(); + + if (!axis->isCompressible() + || axis->isWrittenCompressed(this->filename) + || isWrittenCompressedAxis(axisId)) + continue; + + varId = axisId + "_points"; + compress = axisId; + + // indexes.resize(axis->compressedIndexToWriteOnServer.numElements()); + // indexes = axis->compressedIndexToWriteOnServer; + + indexes.resize(axis->getCompressedIndexToWriteOnServer(comm_file).numElements()); + indexes = axis->getCompressedIndexToWriteOnServer(comm_file); + + isDistributed = axis->isDistributed(); + nbIndexes = axis->getNumberWrittenIndexes(comm_file); + totalNbIndexes = axis->getTotalNumberWrittenIndexes(comm_file); + offset = axis->getOffsetWrittenIndexes(comm_file); + firstGlobalIndex = axis->begin; + + axis->addRelFileCompressed(this->filename); + setWrittenCompressedAxis(axisId); + ++idxAxis; + } + else + { + } + + if (!varId.empty()) + { + SuperClassWriter::addDimension(varId, (SuperClass::type == MULTI_FILE) ? nbIndexes : totalNbIndexes); + + dims.clear(); + dims.push_back(varId); + SuperClassWriter::addVariable(varId, NC_INT, dims); + + SuperClassWriter::addAttribute("compress", compress, &varId); + + switch (SuperClass::type) + { + case (MULTI_FILE): + { + indexes -= firstGlobalIndex; + SuperClassWriter::writeData(indexes, varId, isCollective, 0); + break; + } + case (ONE_FILE): + { + std::vector start, count; + start.push_back(offset); + count.push_back(nbIndexes); + + SuperClassWriter::writeData(indexes, varId, isCollective, 0, &start, &count); + break; + } + } + } } - } + } - grid->addRelFileCompressed(this->filename); - } - catch (CNetCdfException& e) - { - StdString msg("On writing compressed grid : "); - msg.append(grid->getId()); msg.append("\n"); - msg.append("In the context : "); - CContext* context = CContext::getCurrent(); - msg.append(context->getId()); msg.append("\n"); - msg.append(e.what()); - ERROR("CNc4DataOutput::writeGridCompressed_(CGrid* grid)", << msg); - } - } + grid->addRelFileCompressed(this->filename); + } + catch (CNetCdfException& e) + { + StdString msg("On writing compressed grid : "); + msg.append(grid->getId()); msg.append("\n"); + msg.append("In the context : "); + CContext* context = CContext::getCurrent(); + msg.append(context->getId()); msg.append("\n"); + msg.append(e.what()); + ERROR("CNc4DataOutput::writeGridCompressed_(CGrid* grid)", << msg); + } + } //-------------------------------------------------------------- @@ -1529,9 +1829,10 @@ namespace xios void CNc4DataOutput::writeField_(CField* field) { CContext* context = CContext::getCurrent() ; + CContextServer* server=context->server ; std::vector dims, coodinates; - CGrid* grid = field->getGrid(); + CGrid* grid = field->grid; if (!grid->doGridHaveDataToWrite()) if (SuperClass::type==MULTI_FILE) return ; @@ -1712,10 +2013,18 @@ namespace xios dims.push_back(timeid); } - while (!dimIdList.empty()) + if (compressedOutput && grid->isCompressible()) { - dims.push_back(dimIdList.back()); - dimIdList.pop_back(); + dims.push_back(grid->getId() + "_points"); + field->setUseCompressedOutput(); + } + else + { + while (!dimIdList.empty()) + { + dims.push_back(dimIdList.back()); + dimIdList.pop_back(); + } } while (!dimCoordList.empty()) @@ -1862,7 +2171,7 @@ namespace xios SuperClassWriter::setDefaultValue(fieldid, (double*)NULL); if (field->compression_level.isEmpty()) - field->compression_level = field->getRelFile()->compression_level.isEmpty() ? 0 : field->getRelFile()->compression_level; + field->compression_level = field->file->compression_level.isEmpty() ? 0 : field->file->compression_level; SuperClassWriter::setCompressionLevel(fieldid, field->compression_level); { // Ecriture des coordonnes @@ -2061,21 +2370,21 @@ namespace xios //--------------------------------------------------------------- - int CNc4DataOutput::writeFieldData_ (CField* field, const CArray& data, const CDate& lastWrite, - const CDate& currentWrite, int nstep) + void CNc4DataOutput::writeFieldData_ (CField* field) { CContext* context = CContext::getCurrent(); - CGrid* grid = field->getGrid(); - - if (nstep<1) + CContextServer* server = context->server; + CGrid* grid = field->grid; + + if (field->getNStep()<1) { - return nstep; + return; } if (!grid->doGridHaveDataToWrite()) if (SuperClass::type == MULTI_FILE || !isCollective) { - return nstep; + return; } StdString fieldid = field->getFieldOutputName(); @@ -2093,14 +2402,14 @@ namespace xios if (!field->wasWritten()) { - if (appendMode && field->getRelFile()->record_offset.isEmpty() && + if (appendMode && field->file->record_offset.isEmpty() && field->getOperationTimeType() != func::CFunctor::once) { double factorUnit; - if (!field->getRelFile()->time_units.isEmpty() && field->getRelFile()->time_units==CFile::time_units_attr::days) + if (!field->file->time_units.isEmpty() && field->file->time_units==CFile::time_units_attr::days) factorUnit=context->getCalendar()->getDayLengthInSeconds() ; else factorUnit=1 ; - nstep = getRecordFromTime(currentWrite,factorUnit) + 1; + field->resetNStep(getRecordFromTime(field->last_Write_srv,factorUnit) + 1); } field->setWritten(); @@ -2119,11 +2428,14 @@ namespace xios if (wtime) { + Time lastWrite = field->last_Write_srv; + Time lastLastWrite = field->lastlast_Write_srv; + if (field->hasTimeInstant) { - time_data(0) = time_data_bound(1) = (Time) lastWrite; - time_data_bound(0) = time_data_bound(1) = (Time) currentWrite; + time_data(0) = time_data_bound(1) = lastWrite; + time_data_bound(0) = time_data_bound(1) = lastWrite; if (timeCounterType==instant) { time_counter(0) = time_data(0); @@ -2135,9 +2447,9 @@ namespace xios } else if (field->hasTimeCentered) { - time_data(0) = ((Time)currentWrite + (Time)lastWrite) / 2; - time_data_bound(0) = (Time)lastWrite; - time_data_bound(1) = (Time)currentWrite; + time_data(0) = (lastWrite + lastLastWrite) / 2; + time_data_bound(0) = lastLastWrite; + time_data_bound(1) = lastWrite; if (timeCounterType==centered) { time_counter(0) = time_data(0) ; @@ -2150,12 +2462,12 @@ namespace xios if (timeCounterType==record) { - time_counter(0) = nstep - 1; - time_counter_bound(0) = time_counter_bound(1) = nstep - 1; + time_counter(0) = field->getNStep() - 1; + time_counter_bound(0) = time_counter_bound(1) = field->getNStep() - 1; wtimeCounter=true ; } - if (!field->getRelFile()->time_units.isEmpty() && field->getRelFile()->time_units==CFile::time_units_attr::days) + if (!field->file->time_units.isEmpty() && field->file->time_units==CFile::time_units_attr::days) { double secByDay=context->getCalendar()->getDayLengthInSeconds() ; time_data/=secByDay; @@ -2165,29 +2477,56 @@ namespace xios } } - bool isRoot = (context->intraCommRank_ == 0); + int commRank ; + MPI_Comm_rank(comm_file,&commRank) ; + bool isRoot = (commRank == 0); + + if (!field->scale_factor.isEmpty() || !field->add_offset.isEmpty()) + { + double scaleFactor = 1.0; + double addOffset = 0.0; + if (!field->scale_factor.isEmpty()) scaleFactor = field->scale_factor; + if (!field->add_offset.isEmpty()) addOffset = field->add_offset; + field->scaleFactorAddOffset(scaleFactor, addOffset); + } try { + size_t writtenSize; + if (field->getUseCompressedOutput()) + writtenSize = grid->getNumberWrittenIndexes(); + else + writtenSize = grid->getWrittenDataSize(); + + CArray fieldData(writtenSize); + if (!field->default_value.isEmpty()) fieldData = field->default_value; + + if (field->getUseCompressedOutput()) + field->outputCompressedField(fieldData); + else + field->outputField(fieldData); + + if (!field->prec.isEmpty() && field->prec == 2) fieldData = round(fieldData); + switch (SuperClass::type) { case (MULTI_FILE) : { CTimer::get("Files : writing data").resume(); - SuperClassWriter::writeData(data, fieldid, isCollective, nstep - 1); + SuperClassWriter::writeData(fieldData, fieldid, isCollective, field->getNStep() - 1); CTimer::get("Files : writing data").suspend(); if (wtime) { CTimer::get("Files : writing time axis").resume(); if ( wtimeData) { - SuperClassWriter::writeTimeAxisData(time_data, timeAxisId, isCollective, nstep - 1, isRoot); - SuperClassWriter::writeTimeAxisDataBounds(time_data_bound, timeAxisBoundId, isCollective, nstep - 1, isRoot); + SuperClassWriter::writeTimeAxisData(time_data, timeAxisId, isCollective, field->getNStep() - 1, isRoot); + SuperClassWriter::writeTimeAxisDataBounds(time_data_bound, timeAxisBoundId, isCollective, field->getNStep() - 1, isRoot); } if (wtimeCounter) { - SuperClassWriter::writeTimeAxisData(time_counter, getTimeCounterName(), isCollective, nstep - 1,isRoot); - if (timeCounterType!=record) SuperClassWriter::writeTimeAxisDataBounds(time_counter_bound, timeBoundId, isCollective, nstep - 1, isRoot); + SuperClassWriter::writeTimeAxisData(time_counter, getTimeCounterName(), isCollective, field->getNStep() - 1,isRoot); + if (timeCounterType!=record) SuperClassWriter::writeTimeAxisDataBounds(time_counter_bound, timeBoundId, isCollective, field->getNStep() - 1, isRoot); } CTimer::get("Files : writing time axis").suspend(); } @@ -2200,79 +2539,66 @@ namespace xios if (field->getUseCompressedOutput()) { - CArray axisDomainOrder = grid->axis_domain_order; - std::vector domainList = grid->getDomainList(); - std::vector axisList = grid->getAxisList(); - int numElement = axisDomainOrder.numElements(); - int idxDomain = domainList.size() - 1, idxAxis = axisList.size() - 1; - int idx = domainList.size() * 2 + axisList.size() - 1; - int commRank ; - - MPI_Comm_rank(comm_file,&commRank) ; + if (grid->isCompressible()) + { + start.push_back(grid->getOffsetWrittenIndexes()); + count.push_back(grid->getNumberWrittenIndexes()); + } + else + { + CArray axisDomainOrder = grid->axis_domain_order; + std::vector domainList = grid->getDomainList(); + std::vector axisList = grid->getAxisList(); + int numElement = axisDomainOrder.numElements(); + int idxDomain = domainList.size() - 1, idxAxis = axisList.size() - 1; + int idx = domainList.size() * 2 + axisList.size() - 1; - start.reserve(idx+1); - count.reserve(idx+1); + start.reserve(idx+1); + count.reserve(idx+1); - for (int i = numElement - 1; i >= 0; --i) - { - if (2 == axisDomainOrder(i)) + for (int i = numElement - 1; i >= 0; --i) { - CDomain* domain = CDomain::get(domainList[idxDomain]); - - if (domain->isCompressible()) + if (2 == axisDomainOrder(i)) { - size_t offset ; - size_t nbIndexes = domain->getLocalView(CElementView::WORKFLOW)->getSize() ; - if (domain->isDistributed()) + CDomain* domain = CDomain::get(domainList[idxDomain]); + + if (domain->isCompressible()) { - MPI_Exscan(&nbIndexes, &offset, 1, MPI_SIZE_T, MPI_SUM, comm_file) ; - if (commRank==0) offset=0 ; + start.push_back(domain->getOffsetWrittenIndexes(comm_file)); + count.push_back(domain->getNumberWrittenIndexes(comm_file)); + idx -= 2; } - else offset=0 ; - - start.push_back(offset); - count.push_back(nbIndexes); - idx -= 2; - } - else - { - if ((domain->type) != CDomain::type_attr::unstructured) + else { - start.push_back(domain->jbegin); - count.push_back(domain->nj); + if ((domain->type) != CDomain::type_attr::unstructured) + { + start.push_back(domain->jbegin); + count.push_back(domain->nj); + } + --idx; + start.push_back(domain->ibegin); + count.push_back(domain->ni); + --idx; } - --idx; - start.push_back(domain->ibegin); - count.push_back(domain->ni); - --idx; + --idxDomain; } - --idxDomain; - } - else if (1 == axisDomainOrder(i)) - { - CAxis* axis = CAxis::get(axisList[idxAxis]); - - if (axis->isCompressible()) + else if (1 == axisDomainOrder(i)) { - size_t offset ; - size_t nbIndexes = axis->getLocalView(CElementView::WORKFLOW)->getSize() ; - if (axis->isDistributed()) + CAxis* axis = CAxis::get(axisList[idxAxis]); + + if (axis->isCompressible()) { - MPI_Exscan(&nbIndexes, &offset, 1, MPI_SIZE_T, MPI_SUM, comm_file) ; - if (commRank==0) offset=0 ; + start.push_back(axis->getOffsetWrittenIndexes(comm_file)); + count.push_back(axis->getNumberWrittenIndexes(comm_file)); } - else offset=0 ; - - start.push_back(offset); - count.push_back(nbIndexes); - } - else - { - start.push_back(axis->begin); - count.push_back(axis->n); + else + { + start.push_back(axis->begin); + count.push_back(axis->n); + } + --idxAxis; + --idx; } - --idxAxis; - --idx; } } } @@ -2281,7 +2607,6 @@ namespace xios CArray axisDomainOrder = grid->axis_domain_order; std::vector domainList = grid->getDomainList(); std::vector axisList = grid->getAxisList(); - std::vector scalarList = grid->getScalarList() ; int numElement = axisDomainOrder.numElements(); int idxDomain = domainList.size() - 1, idxAxis = axisList.size() - 1; int idx = domainList.size() * 2 + axisList.size() - 1; @@ -2318,9 +2643,8 @@ namespace xios { if (1 == axisDomainOrder.numElements()) { - CScalar* scalar = CScalar::get(scalarList[scalarList.size()-1]); start.push_back(0); - count.push_back(scalar->n); + count.push_back(1); } --idx; } @@ -2329,7 +2653,7 @@ namespace xios CTimer::get("Files : writing data").resume(); - SuperClassWriter::writeData(data, fieldid, isCollective, nstep - 1, &start, &count); + SuperClassWriter::writeData(fieldData, fieldid, isCollective, field->getNStep() - 1, &start, &count); CTimer::get("Files : writing data").suspend(); if (wtime) @@ -2337,13 +2661,13 @@ namespace xios CTimer::get("Files : writing time axis").resume(); if ( wtimeData) { - SuperClassWriter::writeTimeAxisData(time_data, timeAxisId, isCollective, nstep - 1, isRoot); - SuperClassWriter::writeTimeAxisDataBounds(time_data_bound, timeAxisBoundId, isCollective, nstep - 1, isRoot); + SuperClassWriter::writeTimeAxisData(time_data, timeAxisId, isCollective, field->getNStep() - 1, isRoot); + SuperClassWriter::writeTimeAxisDataBounds(time_data_bound, timeAxisBoundId, isCollective, field->getNStep() - 1, isRoot); } if (wtimeCounter) { - SuperClassWriter::writeTimeAxisData(time_counter, getTimeCounterName(), isCollective, nstep - 1,isRoot); - if (timeCounterType!=record) SuperClassWriter::writeTimeAxisDataBounds(time_counter_bound, timeBoundId, isCollective, nstep - 1, isRoot); + SuperClassWriter::writeTimeAxisData(time_counter, getTimeCounterName(), isCollective, field->getNStep() - 1,isRoot); + if (timeCounterType!=record) SuperClassWriter::writeTimeAxisDataBounds(time_counter_bound, timeBoundId, isCollective, field->getNStep() - 1, isRoot); } CTimer::get("Files : writing time axis").suspend(); @@ -2352,7 +2676,6 @@ namespace xios break; } } - return nstep ; } catch (CNetCdfException& e) { @@ -2385,14 +2708,14 @@ namespace xios StdString timeBoundId("axis_nbounds"); StdString strTimeUnits ; - if (!field->getRelFile()->time_units.isEmpty() && field->getRelFile()->time_units==CFile::time_units_attr::days) strTimeUnits="days since " ; + if (!field->file->time_units.isEmpty() && field->file->time_units==CFile::time_units_attr::days) strTimeUnits="days since " ; else strTimeUnits="seconds since " ; if (field->getOperationTimeType() == func::CFunctor::instant) field->hasTimeInstant = true; if (field->getOperationTimeType() == func::CFunctor::centered) field->hasTimeCentered = true; - if (field->getRelFile()->time_counter.isEmpty()) + if (field->file->time_counter.isEmpty()) { if (timeCounterType==none) createTimeCounterAxis=true ; if (field->hasTimeCentered) @@ -2406,7 +2729,7 @@ namespace xios if (!hasTimeInstant) createInstantAxis=true ; } } - else if (field->getRelFile()->time_counter==CFile::time_counter_attr::instant) + else if (field->file->time_counter==CFile::time_counter_attr::instant) { if (field->hasTimeCentered) { @@ -2419,7 +2742,7 @@ namespace xios if (!hasTimeInstant) createInstantAxis=true ; } } - else if (field->getRelFile()->time_counter==CFile::time_counter_attr::centered) + else if (field->file->time_counter==CFile::time_counter_attr::centered) { if (field->hasTimeCentered) { @@ -2432,7 +2755,7 @@ namespace xios if (!hasTimeInstant) createInstantAxis=true ; } } - else if (field->getRelFile()->time_counter==CFile::time_counter_attr::instant_exclusive) + else if (field->file->time_counter==CFile::time_counter_attr::instant_exclusive) { if (field->hasTimeCentered) { @@ -2444,7 +2767,7 @@ namespace xios timeCounterType=instant ; } } - else if (field->getRelFile()->time_counter==CFile::time_counter_attr::centered_exclusive) + else if (field->file->time_counter==CFile::time_counter_attr::centered_exclusive) { if (field->hasTimeCentered) { @@ -2456,7 +2779,7 @@ namespace xios if (!hasTimeInstant) createInstantAxis=true ; } } - else if (field->getRelFile()->time_counter==CFile::time_counter_attr::exclusive) + else if (field->file->time_counter==CFile::time_counter_attr::exclusive) { if (field->hasTimeCentered) { @@ -2477,7 +2800,7 @@ namespace xios } } } - else if (field->getRelFile()->time_counter==CFile::time_counter_attr::none) + else if (field->file->time_counter==CFile::time_counter_attr::none) { if (field->hasTimeCentered) { @@ -2488,7 +2811,7 @@ namespace xios if (!hasTimeInstant) createInstantAxis=true ; } } - else if (field->getRelFile()->time_counter==CFile::time_counter_attr::record) + else if (field->file->time_counter==CFile::time_counter_attr::record) { if (timeCounterType==none) createTimeCounterAxis=true ; timeCounterType=record ; @@ -2559,8 +2882,8 @@ namespace xios SuperClassWriter::addVariable(axisId, NC_DOUBLE, dims); SuperClassWriter::addAttribute("axis", string("T"), &axisId); - if (field->getRelFile()->time_counter.isEmpty() || - (field->getRelFile()->time_counter != CFile::time_counter_attr::record)) + if (field->file->time_counter.isEmpty() || + (field->file->time_counter != CFile::time_counter_attr::record)) { CDate timeOrigin = cal->getTimeOrigin(); StdString strTimeOrigin = timeOrigin.toString(); @@ -2572,7 +2895,7 @@ namespace xios } // Adding time_counter_bound dimension - if (field->getRelFile()->time_counter.isEmpty() || (field->getRelFile()->time_counter != CFile::time_counter_attr::record)) + if (field->file->time_counter.isEmpty() || (field->file->time_counter != CFile::time_counter_attr::record)) { if (!SuperClassWriter::varExist(axisBoundId)) { diff --git a/xios_2311_src/src/io/nc4_data_output.hpp b/xios_2311_src/src/io/nc4_data_output.hpp index d2feeb0b6aea6293a1b32762dba88f7e34ad7be3..49690db52c6c8bdb0ff3c42149bdb5b02160a053 100644 --- a/xios_2311_src/src/io/nc4_data_output.hpp +++ b/xios_2311_src/src/io/nc4_data_output.hpp @@ -55,7 +55,7 @@ namespace xios virtual void writeField_ (CField* field); virtual void writeAttribute_(CVariable* var); virtual void writeAttribute_(CVariable* var, const string& fieldId); - virtual int writeFieldData_(CField* field, const CArray& data, const CDate& lastWrite, const CDate& currentWrite, int nstep); + virtual void writeFieldData_(CField* field); virtual void writeFile_ (CFile* file); virtual void closeFile_ (void); virtual void syncFile_ (void); diff --git a/xios_2311_src/src/io/netCdfInterface.cpp b/xios_2311_src/src/io/netCdfInterface.cpp index deefeb6f5d1516eef1ded1f33171ab20282c99fa..b456afb496247e125c2711f43ab2bbc9fd7e7b7d 100644 --- a/xios_2311_src/src/io/netCdfInterface.cpp +++ b/xios_2311_src/src/io/netCdfInterface.cpp @@ -892,12 +892,6 @@ int CNetCdfInterface::ncGetAttType(int ncid, int varid, const char* attrName, lo return nc_get_att_long(ncid, varid, attrName, data); } -template<> -int CNetCdfInterface::ncGetAttType(int ncid, int varid, const char* attrName, size_t* data) -{ - return nc_get_att_ulonglong(ncid, varid, attrName, (unsigned long long*)data); -} - template<> int CNetCdfInterface::ncGetAttType(int ncid, int varid, const char* attrName, short* data) { @@ -939,13 +933,6 @@ int CNetCdfInterface::ncPutAttType(int ncid, int varid, const char* attrName, return nc_put_att_long(ncid, varid, attrName, NC_LONG, numVal, data); } -template<> -int CNetCdfInterface::ncPutAttType(int ncid, int varid, const char* attrName, - StdSize numVal, const size_t* data) -{ - return nc_put_att_ulonglong(ncid, varid, attrName, NC_UINT64, numVal, (unsigned long long*) data); -} - template<> int CNetCdfInterface::ncPutAttType(int ncid, int varid, const char* attrName, StdSize numVal, const short* data) @@ -979,12 +966,6 @@ int CNetCdfInterface::ncGetVaraType(int ncid, int varid, const StdSize* start, c return nc_get_vara_int(ncid, varid, start, count, data); } -template<> -int CNetCdfInterface::ncGetVaraType(int ncid, int varid, const StdSize* start, const StdSize* count, size_t* data) -{ - return nc_get_vara_ulonglong(ncid, varid, start, count, (unsigned long long*) data); -} - template<> int CNetCdfInterface::ncGetVaraType(int ncid, int varid, const StdSize* start, const StdSize* count, char* data) { @@ -1010,12 +991,6 @@ int CNetCdfInterface::ncPutVaraType(int ncid, int varid, const StdSize* start, c return nc_put_vara_int(ncid, varid, start, count, data); } -template<> -int CNetCdfInterface::ncPutVaraType(int ncid, int varid, const StdSize* start, const StdSize* count, const size_t* data) -{ - return nc_put_vara_ulonglong(ncid, varid, start, count, (unsigned long long*)data); -} - template<> int CNetCdfInterface::ncPutVaraType(int ncid, int varid, const StdSize* start, const StdSize* count, const char* data) { diff --git a/xios_2311_src/src/io/netCdfInterface_decl.cpp b/xios_2311_src/src/io/netCdfInterface_decl.cpp index 5235720a5384de325265e0d84b1542ffc5ad3e19..83f9af18dc23ab116800a0ce40e2bf98ce0dc39e 100644 --- a/xios_2311_src/src/io/netCdfInterface_decl.cpp +++ b/xios_2311_src/src/io/netCdfInterface_decl.cpp @@ -19,7 +19,6 @@ namespace xios macroAtt(double) macroAtt(float) macroAtt(int) - macroAtt(size_t) macroAtt(long) macroAtt(short) macroAtt(char) @@ -33,7 +32,6 @@ namespace xios macroPutVar(double) macroPutVar(float) macroPutVar(int) - macroPutVar(size_t) macroPutVar(char) #define macroType(type, ncType) \ @@ -42,7 +40,6 @@ namespace xios macroType(double, NC_DOUBLE) macroType(float, NC_FLOAT) macroType(int, NC_INT) - macroType(size_t, NC_UINT64) macroType(long, NC_LONG) macroType(short, NC_SHORT) macroType(char, NC_CHAR) diff --git a/xios_2311_src/src/io/netCdf_cf_constant.cpp b/xios_2311_src/src/io/netCdf_cf_constant.cpp deleted file mode 100755 index 2ed32d8c171405a2d4725920198b9068d8fb4228..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/io/netCdf_cf_constant.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "netCdf_cf_constant.hpp" - -namespace xios -{ - std::set CCFConvention::XIOS_CF_Latitude_units_; - std::set CCFConvention::XIOS_CF_Longitude_units_; - const StdString CCFKeywords::XIOS_CF_units("units"); - const StdString CCFKeywords::XIOS_CF_standard_name("standard_name"); - const StdString CCFKeywords::XIOS_CF_coordinates("coordinates"); - const StdString CCFKeywords::XIOS_CF_bounds("bounds"); -} \ No newline at end of file diff --git a/xios_2311_src/src/io/netCdf_cf_constant.hpp b/xios_2311_src/src/io/netCdf_cf_constant.hpp index ffed83cda32f54084574efcfd3ecf583bb455c66..959c86e182f2aa26b6f68511386cd3140656890b 100644 --- a/xios_2311_src/src/io/netCdf_cf_constant.hpp +++ b/xios_2311_src/src/io/netCdf_cf_constant.hpp @@ -6,8 +6,8 @@ namespace xios { -//const StdString CFLatUnits[] = {"degrees_north", "degree_north", "degree_N", "degrees_N", "degreeN", "degreesN"}; -//const StdString CFLonUnits[] = {"degrees_east", "degree_east", "degree_E", "degrees_E", "degreeE", "degreesE"}; +const StdString CFLatUnits[] = {"degrees_north", "degree_north", "degree_N", "degrees_N", "degreeN", "degreesN"}; +const StdString CFLonUnits[] = {"degrees_east", "degree_east", "degree_E", "degrees_E", "degreeE", "degreesE"}; struct CCFKeywords { @@ -16,27 +16,23 @@ struct CCFKeywords static const StdString XIOS_CF_coordinates; static const StdString XIOS_CF_bounds; }; +const StdString CCFKeywords::XIOS_CF_units("units"); +const StdString CCFKeywords::XIOS_CF_standard_name("standard_name"); +const StdString CCFKeywords::XIOS_CF_coordinates("coordinates"); +const StdString CCFKeywords::XIOS_CF_bounds("bounds"); struct CCFConvention { - static const std::set& XIOS_CF_Latitude_units() - { - if (XIOS_CF_Longitude_units_.empty()) XIOS_CF_Latitude_units_= {"degrees_north", "degree_north", "degree_N", "degrees_N", "degreeN", "degreesN"}; - return XIOS_CF_Latitude_units_ ; - } - - static const std::set& XIOS_CF_Longitude_units() - { - if (XIOS_CF_Longitude_units_.empty()) XIOS_CF_Longitude_units_= {"degrees_east", "degree_east", "degree_E", "degrees_E", "degreeE", "degreesE"}; - return XIOS_CF_Longitude_units_ ; - } - static void releaseStaticAllocation(void) { XIOS_CF_Latitude_units_.clear() ; XIOS_CF_Longitude_units_.clear() ; } + static const std::set XIOS_CF_Latitude_units; + static const std::set XIOS_CF_Longitude_units; + private: CCFConvention(); - static std::set XIOS_CF_Latitude_units_; - static std::set XIOS_CF_Longitude_units_; }; +const std::set CCFConvention::XIOS_CF_Latitude_units(CFLatUnits, CFLatUnits+sizeof(CFLatUnits)/sizeof(CFLatUnits[0])); +const std::set CCFConvention::XIOS_CF_Longitude_units(CFLonUnits, CFLonUnits+sizeof(CFLonUnits)/sizeof(CFLonUnits[0])); + } // namespace xios #endif //__XIOS_INETCDF4_IMPL__ diff --git a/xios_2311_src/src/io/onetcdf4.cpp b/xios_2311_src/src/io/onetcdf4.cpp index a5fd68c23a22f92bb8542455a683451124bbbdc0..06c32cc1e6f6104bc5704c6482b4f73a34802576 100644 --- a/xios_2311_src/src/io/onetcdf4.cpp +++ b/xios_2311_src/src/io/onetcdf4.cpp @@ -476,10 +476,9 @@ namespace xios std::vector sizes = this->getDimensions(name); if (sizes.size()==0) { - - if ((start != NULL) && (count != NULL) && start->size()==1 && count->size()==1) // pur scalar case - array_size*=(*count)[0] ; - else array_size=1 ; + array_size=1 ; + sstart.push_back(0); + scount.push_back(1); } else { @@ -492,18 +491,11 @@ namespace xios { sstart.push_back(record); scount.push_back(1); - if ((start == NULL) && (count == NULL)) i++; - it++; - if (it==end) - { - if ((start != NULL) && (count != NULL) && start->size()==1 && count->size()==1) // pur scalar case - { - scount[0]=(*count)[0] ; - array_size *= (*count)[0]; - } - } + if ((start == NULL) && + (count == NULL)) i++; + it++; } - + for (;it != end; it++) { if ((start != NULL) && (count != NULL)) @@ -545,18 +537,10 @@ namespace xios } template <> - void CONetCDF4::writeData_(int grpid, int varid, - const std::vector& sstart, - const std::vector& scount, const int* data) - { - CNetCdfInterface::putVaraType(grpid, varid, &sstart[0], &scount[0], data); - } - //--------------------------------------------------------------- - template <> void CONetCDF4::writeData_(int grpid, int varid, const std::vector& sstart, - const std::vector& scount, const size_t* data) + const std::vector& scount, const int* data) { CNetCdfInterface::putVaraType(grpid, varid, &sstart[0], &scount[0], data); } @@ -576,7 +560,6 @@ namespace xios { int grpid = this->getCurrentGroup(); int varid = this->getVariable(name); - StdSize array_size = 1; std::vector sstart, scount; diff --git a/xios_2311_src/src/io/onetcdf4_decl.cpp b/xios_2311_src/src/io/onetcdf4_decl.cpp index 0e3ca2c6c917446cb0e899e98bde3c15e9d00af3..1a6494270fb60d830168f7b2be7a03b3102b7409 100644 --- a/xios_2311_src/src/io/onetcdf4_decl.cpp +++ b/xios_2311_src/src/io/onetcdf4_decl.cpp @@ -10,8 +10,6 @@ namespace xios macro(int, 1) macro(int, 2) - macro(size_t, 1) - macro(size_t, 2) macro(double, 1) macro(double, 2) macro(double, 3) diff --git a/xios_2311_src/src/io/onetcdf4_impl.hpp b/xios_2311_src/src/io/onetcdf4_impl.hpp index 3a3f4ad04aea912289acfe31abde7be1b2b11e65..34e20bb351d86ea715a4c50058959f9cbd6ab500 100644 --- a/xios_2311_src/src/io/onetcdf4_impl.hpp +++ b/xios_2311_src/src/io/onetcdf4_impl.hpp @@ -18,13 +18,16 @@ namespace xios StdSize array_size = 1; std::vector sstart, scount; - if (this->wmpi && collective) CNetCdfInterface::varParAccess(grpid, varid, NC_COLLECTIVE); - if (this->wmpi && !collective) CNetCdfInterface::varParAccess(grpid, varid, NC_INDEPENDENT); + if (this->wmpi && collective) + CNetCdfInterface::varParAccess(grpid, varid, NC_COLLECTIVE); + if (this->wmpi && !collective) + CNetCdfInterface::varParAccess(grpid, varid, NC_INDEPENDENT); CTimer::get("Files : get data infos").resume(); - this->getWriteDataInfos(name, record, array_size, sstart, scount, start, count); + this->getWriteDataInfos + (name, record, array_size, sstart, scount, start, count); CTimer::get("Files : get data infos").suspend(); - + if (data.numElements() != array_size) { ERROR("CONetCDF4::writeData(...)", @@ -32,10 +35,8 @@ namespace xios << ", intern array size = " << array_size << " ] Invalid input data !" ); } - - if (this->wmpi && sstart.size()==0) CNetCdfInterface::varParAccess(grpid, varid, NC_INDEPENDENT); // pure scalar case - if (data.numElements()==0 && sstart.size()==0) {}// pure scalar case if nothing to write, write nothing (independent access) - else this->writeData_(grpid, varid, sstart, scount, data.dataFirst()); + + this->writeData_(grpid, varid, sstart, scount, data.dataFirst()); } template <> @@ -74,7 +75,7 @@ namespace xios PtrArrayStr=new char[stringArrayLen*data.numElements()] ; memset (PtrArrayStr,' ',stringArrayLen*data.numElements()); size_t offset=0 ; - + // pb with iterator with blitz++ string array with recent compiler /* Array::const_iterator it, itb=data.begin(), ite=data.end() ; @@ -88,7 +89,7 @@ namespace xios { data(i).copy(PtrArrayStr+offset,data(i).size()) ; PtrArrayStr[offset+data(i).size()]='\0' ; - } + } CTimer::get("CONetCDF4::writeData writeData_").resume(); this->writeData_(grpid, varid, sstart, scount, PtrArrayStr); CTimer::get("CONetCDF4::writeData writeData_").suspend(); diff --git a/xios_2311_src/src/manager/contexts_manager.cpp b/xios_2311_src/src/manager/contexts_manager.cpp deleted file mode 100755 index aca8cea20d2e3e190ea9ac7db0daa202abf7b75d..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/manager/contexts_manager.cpp +++ /dev/null @@ -1,353 +0,0 @@ -#include "contexts_manager.hpp" -#include "cxios.hpp" -#include "ressources_manager.hpp" -#include "pool_ressource.hpp" -#include "services.hpp" -#include "server_context.hpp" -#include "servers_ressource.hpp" -#include "server.hpp" -#include "timer.hpp" -#include - - -namespace xios -{ - using namespace std ; - - CContextsManager::CContextsManager(bool isXiosServer) - { - xiosComm_ = CXios::getXiosComm() ; - - int commRank ; - MPI_Comm_rank(xiosComm_, &commRank) ; - if (commRank==0 && isXiosServer) MPI_Comm_rank(xiosComm_, &commRank) ; - else commRank=0 ; - MPI_Allreduce(&commRank, &managerGlobalLeader_, 1, MPI_INT, MPI_SUM, xiosComm_) ; - - MPI_Comm_rank(xiosComm_, &commRank) ; - winNotify_ = new CWindowManager(xiosComm_, maxBufferSize_) ; - - - winContexts_ = new CWindowManager(xiosComm_, maxBufferSize_) ; - winContexts_->lockWindow(commRank,0) ; - winContexts_->updateToWindow(commRank, this, &CContextsManager::contextsDumpOut) ; - winContexts_->unlockWindow(commRank,0) ; - - MPI_Barrier(xiosComm_) ; - } - - - CContextsManager::~CContextsManager() - { - delete winNotify_ ; - delete winContexts_ ; - } - - bool CContextsManager::createServerContext(const std::string& poolId, const std::string& serviceId, const int& partitionId, - const string& contextId, bool wait) - { - int serviceLeader ; - auto servicesManager = CXios::getServicesManager() ; - - bool ok=servicesManager->getServiceLeader(poolId, serviceId, partitionId, serviceLeader) ; - - info(40)<<"CContextsManager::createServerContext : waiting for service leader ; serviceId : "<servicesEventLoop() ; - ok=servicesManager->getServiceLeader(poolId, serviceId, partitionId, serviceLeader) ; - } - } - - if (ok) - { - notifyType_=NOTIFY_CREATE_CONTEXT ; - notifyCreateContext_=make_tuple(poolId, serviceId, partitionId, contextId) ; - info(40)<<"CContextsManager::createServerContext : notification create_context to service leader "<getServiceType(poolId,serviceId, 0, type) ; - if (ok) ok=getContextLeader(getServerContextName(poolId, serviceId, partitionId, type, contextId), contextLeader) ; - if (wait) - { - while (!ok) - { - CXios::getDaemonsManager()->servicesEventLoop() ; - ok=CXios::getServicesManager()->getServiceType(poolId,serviceId, 0, type) ; - if (ok) ok=getContextLeader(getServerContextName(poolId, serviceId, partitionId, type, contextId), contextLeader) ; - } - } - - if (ok) - { - notifyType_=NOTIFY_CREATE_INTERCOMM ; - notifyCreateIntercomm_=make_tuple(poolId, serviceId, partitionId, contextId, remoteLeader, sourceContext) ; - info(40)<<"CContextsManager::createServerContextIntercomm : notification create_intercomm to context leader : "<lockWindowExclusive(rank) ; - winNotify_->pushToLockedWindow(rank, this, &CContextsManager::notificationsDumpOut) ; - winNotify_->unlockWindow(rank) ; - } - - - void CContextsManager::notificationsDumpOut(CBufferOut& buffer) - { - - buffer.realloc(maxBufferSize_) ; - - if (notifyType_==NOTIFY_CREATE_CONTEXT) - { - auto& arg=notifyCreateContext_ ; - buffer << notifyType_<< get<0>(arg) << get<1>(arg) << std::get<2>(arg) << get<3>(arg) ; - } - else if (notifyType_==NOTIFY_CREATE_INTERCOMM) - { - auto& arg=notifyCreateIntercomm_ ; - buffer << notifyType_<< get<0>(arg) << get<1>(arg) << std::get<2>(arg) << get<3>(arg) << get<4>(arg)<< get<5>(arg) ; - } - } - - void CContextsManager::notificationsDumpIn(CBufferIn& buffer) - { - if (buffer.bufferSize() == 0) notifyType_= NOTIFY_NOTHING ; - else - { - buffer>>notifyType_; - if (notifyType_==NOTIFY_CREATE_CONTEXT) - { - auto& arg=notifyCreateContext_ ; - buffer >> get<0>(arg) >> get<1>(arg) >> std::get<2>(arg)>> get<3>(arg) ; - } - else if (notifyType_==NOTIFY_CREATE_INTERCOMM) - { - auto& arg=notifyCreateIntercomm_ ; - buffer >> get<0>(arg) >> get<1>(arg) >> std::get<2>(arg) >> get<3>(arg) >> get<4>(arg) >> get<5>(arg); - } - } - - } - - void CContextsManager::eventLoop(void) - { - CTimer::get("CContextsManager::eventLoop").resume(); - int flag ; - MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &flag, MPI_STATUS_IGNORE); - double time=MPI_Wtime() ; - if (time-lastEventLoop_ > eventLoopLatency_) - { - checkNotifications() ; - lastEventLoop_=time ; - } - CTimer::get("CContextsManager::eventLoop").suspend(); - } - - void CContextsManager::checkNotifications(void) - { - int commRank ; - MPI_Comm_rank(xiosComm_, &commRank) ; - winNotify_->lockWindowExclusive(commRank) ; - winNotify_->popFromLockedWindow(commRank, this, &CContextsManager::notificationsDumpIn) ; - winNotify_->unlockWindow(commRank) ; - if (notifyType_==NOTIFY_CREATE_CONTEXT) createServerContext() ; - else if (notifyType_==NOTIFY_CREATE_INTERCOMM) createServerContextIntercomm() ; - - } - - void CContextsManager::createServerContext(void) - { - info(40)<<"CContextsManager::createServerContext : receive create server context notification"<getService(get<1>(arg), get<2>(arg)) - ->createContext(get<0>(arg), get<1>(arg), get<2>(arg), get<3>(arg)) ; - - } - - void CContextsManager::createServerContextIntercomm(void) - { - info(40)<<"CContextsManager::createServerContext : receive create intercomm context notification"<getService(get<1>(arg), get<2>(arg)) - ->getServerContext(get<3>(arg)) - ->createIntercomm(get<4>(arg), get<5>(arg)) ; - } - - string CContextsManager::getServerContextName(const string& poolId, const string& serviceId, const int& partitionId, - const int& type, const string& contextId) - { - if (type==CServicesManager::CLIENT) return contextId; - else - { - ostringstream oss; - oss<lockWindowExclusive(managerGlobalLeader_) ; - winContexts_->updateFromLockedWindow(managerGlobalLeader_, this, &CContextsManager::contextsDumpIn) ; - winContexts_->flushWindow(managerGlobalLeader_) ; - contexts_[fullContextId] = contextInfo ; - winContexts_->updateToLockedWindow(managerGlobalLeader_, this, &CContextsManager::contextsDumpOut) ; - winContexts_->unlockWindow(managerGlobalLeader_) ; - } - - bool CContextsManager::getContextInfo(const string& fullContextId, SRegisterContextInfo& contextInfo, MPI_Comm comm) - { - bool ret ; - int commRank=0 ; - if (comm!=MPI_COMM_NULL) MPI_Comm_rank(comm, &commRank) ; - - if (commRank==0) - { - - winContexts_->lockWindowShared(managerGlobalLeader_) ; - winContexts_->updateFromLockedWindow(managerGlobalLeader_, this, &CContextsManager::contextsDumpIn) ; - winContexts_->unlockWindow(managerGlobalLeader_) ; - - auto it=contexts_.find(fullContextId) ; - if ( it == contexts_.end()) ret=false ; - else - { - contextInfo=it->second ; - ret=true ; - } - } - - if (comm!=MPI_COMM_NULL) - { - MPI_Bcast(&ret,1,MPI_INT,0,comm) ; - if (ret) - { - MPI_Bcast(&contextInfo.leader,1,MPI_INT,0,comm) ; - MPI_Bcast(&contextInfo.size,1,MPI_INT,0,comm) ; - MPI_Bcast_string(contextInfo.poolId,0,comm) ; - MPI_Bcast_string(contextInfo.serviceId,0,comm) ; - MPI_Bcast(&contextInfo.serviceType,1,MPI_INT,0,comm) ; - MPI_Bcast(&contextInfo.partitionId,1,MPI_INT,0,comm) ; - MPI_Bcast_string(contextInfo.id,0,comm) ; - } - } - return ret ; - } - - bool CContextsManager::getContextLeader(const string& fullContextId, int& leader, MPI_Comm comm) - { - SRegisterContextInfo contextInfo ; - bool ret=getContextInfo(fullContextId, contextInfo) ; - if (ret) leader=contextInfo.leader ; - return ret ; - } - - bool CContextsManager::getContextSize(const string& fullContextId, int& size, MPI_Comm comm) - { - - SRegisterContextInfo contextInfo ; - bool ret=getContextInfo(fullContextId, contextInfo) ; - if (ret) size=contextInfo.size ; - return ret ; - } - - bool CContextsManager::getContextPoolId(const string& fullContextId, string& poolId, MPI_Comm comm) - { - SRegisterContextInfo contextInfo ; - bool ret=getContextInfo(fullContextId, contextInfo) ; - if (ret) poolId=contextInfo.poolId ; - return ret ; - } - - bool CContextsManager::getContextServiceId(const string& fullContextId, string& serviceId, MPI_Comm comm) - { - SRegisterContextInfo contextInfo ; - bool ret=getContextInfo(fullContextId, contextInfo) ; - if (ret) serviceId=contextInfo.serviceId ; - return ret ; - } - - bool CContextsManager::getContextPartitionId(const string& fullContextId, int& partitionId, MPI_Comm comm) - { - SRegisterContextInfo contextInfo ; - bool ret=getContextInfo(fullContextId, contextInfo) ; - if (ret) partitionId=contextInfo.partitionId ; - return ret ; - } - - bool CContextsManager::getContextServiceType(const string& fullContextId, int& serviceType, MPI_Comm comm) - { - SRegisterContextInfo contextInfo ; - bool ret=getContextInfo(fullContextId, contextInfo) ; - if (ret) serviceType=contextInfo.serviceType ; - return ret ; - } - - bool CContextsManager::getContextId(const string& fullContextId, string& contextId, MPI_Comm comm) - { - SRegisterContextInfo contextInfo ; - bool ret=getContextInfo(fullContextId, contextInfo) ; - if (ret) contextId=contextInfo.id ; - return ret ; - } - - - bool CContextsManager::hasContext(const string& fullContextId, MPI_Comm comm) - { - SRegisterContextInfo contextInfo ; - return getContextInfo(fullContextId, contextInfo) ; - } - - void CContextsManager::contextsDumpOut(CBufferOut& buffer) - { - buffer.realloc(maxBufferSize_) ; - buffer<<(int)contexts_.size(); - - for(auto it=contexts_.begin();it!=contexts_.end(); ++it) - { - auto key = it->first ; - auto val = it->second ; - buffer << key << val.poolId<>nbContexts ; - for(int i=0;i>contextId>>ci.poolId>>ci.serviceId>>ci.partitionId>>ci.serviceType>>ci.id>>ci.size>>ci.leader ; - contexts_[contextId]=ci ; - } - - } -} diff --git a/xios_2311_src/src/manager/contexts_manager.hpp b/xios_2311_src/src/manager/contexts_manager.hpp deleted file mode 100755 index 80cb06d1d7fefd40d024d979eebbf2c0985bbc0b..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/manager/contexts_manager.hpp +++ /dev/null @@ -1,96 +0,0 @@ -#ifndef __CONTEXTS_MANAGER_HPP__ -#define __CONTEXTS_MANAGER_HPP__ - -#include "xios_spl.hpp" -#include "mpi.hpp" -#include "buffer_in.hpp" -#include "buffer_out.hpp" - -#include -#include -#include "window_manager.hpp" -#include "register_context_info.hpp" - - -namespace xios -{ - - class CContextsManager - { - private: - - const int NOTIFY_NOTHING=0 ; - const int NOTIFY_CREATE_CONTEXT=1 ; - const int NOTIFY_CREATE_INTERCOMM=2 ; - - - public: - - CContextsManager(bool isXiosServer) ; - ~CContextsManager() ; - - bool createServerContext(const std::string& poolId, const std::string& serviceId, const int& partitionId, const string& contextId, bool wait=true) ; - - bool createServerContextIntercomm(const std::string& poolId, const std::string& serviceId, const int& partitionId, - const std::string& contextId, const string& sourceContext, bool wait=true) ; - - string getServerContextName(const std::string& poolId, const std::string& serviceId, const int& partitionId, - const int& type, const string& contextId) ; - - - void sendNotification(int rank); - void checkNotifications(void) ; - - void eventLoop(void) ; - void notificationsDumpOut(CBufferOut& buffer) ; - void notificationsDumpIn(CBufferIn& buffer) ; - - void registerContext(const std::string& fullContextId, const SRegisterContextInfo& contextInfo) ; - - bool getContextInfo(const std::string& fullContextId, SRegisterContextInfo& contextInfo, MPI_Comm comm=MPI_COMM_NULL) ; - bool getContextPoolId(const string& fullContextId, string& poolId, MPI_Comm comm=MPI_COMM_NULL) ; - bool getContextServiceId(const string& fullContextId, string& serviceId, MPI_Comm comm=MPI_COMM_NULL) ; - bool getContextPartitionId(const string& fullContextId, int& partitionId, MPI_Comm comm=MPI_COMM_NULL) ; - bool getContextId(const string& fullContextId, string& contextId, MPI_Comm comm=MPI_COMM_NULL) ; - bool getContextLeader(const string& fullContextId, int& leader, MPI_Comm comm=MPI_COMM_NULL) ; - bool getContextSize(const string& fullContextId, int& size, MPI_Comm comm=MPI_COMM_NULL) ; - bool getContextServiceType(const string& fullContextId, int& serviceType, MPI_Comm comm=MPI_COMM_NULL) ; - - bool hasContext(const std::string& fullContextId, MPI_Comm comm=MPI_COMM_NULL) ; - - void contextsDumpOut(CBufferOut& buffer) ; - void contextsDumpIn(CBufferIn& buffer) ; - - void createServerContext(void) ; //private - void createServerContextIntercomm(void) ; //private - - private : - - CWindowManager* winContexts_ ; - CWindowManager* winNotify_ ; - - - const size_t maxBufferSize_=1024*1024 ; - - MPI_Comm xiosComm_ ; - - int notifyType_ ; - tuple notifyCreateContext_ ; - tuple notifyCreateIntercomm_ ; - - std::map contexts_ ; - - int managerGlobalLeader_ ; - - const double eventLoopLatency_=0; - double lastEventLoop_=0. ; - - friend class CWindowManager ; - - } ; - -} - - - -#endif diff --git a/xios_2311_src/src/manager/coupler_manager.cpp b/xios_2311_src/src/manager/coupler_manager.cpp deleted file mode 100755 index 04517c210b6a4a54d248dc1e61cfd2a98de3f805..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/manager/coupler_manager.cpp +++ /dev/null @@ -1,131 +0,0 @@ -#include "coupler_manager.hpp" -#include "cxios.hpp" -#include -#include - - - -namespace xios -{ - CCouplerManager::CCouplerManager(bool isXiosServer) - { - auto xiosComm_ = CXios::getXiosComm() ; - - int commRank ; - MPI_Comm_rank(xiosComm_, &commRank) ; - if (commRank==0 && isXiosServer) MPI_Comm_rank(xiosComm_, &commRank) ; - else commRank=0 ; - MPI_Allreduce(&commRank, &managerGlobalLeader_, 1, MPI_INT, MPI_SUM, xiosComm_) ; - MPI_Comm_rank(xiosComm_, &commRank) ; - - winRegistredCoupling_ = new CWindowManager(xiosComm_, maxBufferSize_) ; - winNextCoupling_ = new CWindowManager(xiosComm_, maxBufferSize_) ; - if (commRank==managerGlobalLeader_) - { - winRegistredCoupling_->lockWindow(managerGlobalLeader_,0) ; - winRegistredCoupling_->updateToWindow(managerGlobalLeader_, this, &CCouplerManager::registredCouplingDumpOut) ; - winRegistredCoupling_->unlockWindow(managerGlobalLeader_,0) ; - - winNextCoupling_->lockWindow(managerGlobalLeader_,0) ; - winNextCoupling_->updateToWindow(managerGlobalLeader_, this, &CCouplerManager::nextCouplingDumpOut) ; - winNextCoupling_->unlockWindow(managerGlobalLeader_,0) ; - } - - MPI_Barrier(xiosComm_) ; - } - - CCouplerManager::~CCouplerManager() - { - delete winRegistredCoupling_ ; - delete winNextCoupling_ ; - } - - - void CCouplerManager::registerCoupling(string srcCoupling, string dstCoupling) - { - hash strHash ; - size_t key = strHash(getStrCoupling(srcCoupling,dstCoupling)) ; - - winRegistredCoupling_->lockWindow(managerGlobalLeader_,0) ; - winRegistredCoupling_->updateFromWindow(managerGlobalLeader_, this, &CCouplerManager::registredCouplingDumpIn) ; - if (registredCoupling_.count(key)==1) - { - registredCoupling_.erase(key) ; - winRegistredCoupling_->updateToWindow(managerGlobalLeader_, this, &CCouplerManager::registredCouplingDumpOut) ; - winNextCoupling_->lockWindow(managerGlobalLeader_,0) ; - winNextCoupling_->updateFromWindow(managerGlobalLeader_, this, &CCouplerManager::nextCouplingDumpIn) ; - nextCoupling_.push_back(pair(key,2)) ; - winNextCoupling_->updateToWindow(managerGlobalLeader_, this, &CCouplerManager::nextCouplingDumpOut) ; - winNextCoupling_->unlockWindow(managerGlobalLeader_,0) ; - } - else - { - registredCoupling_.insert(key) ; - winRegistredCoupling_->updateToWindow(managerGlobalLeader_, this, &CCouplerManager::registredCouplingDumpOut) ; - } - winRegistredCoupling_->unlockWindow(managerGlobalLeader_,0) ; - } - - bool CCouplerManager::isNextCoupling(string srcCoupling, string dstCoupling) - { - bool ret ; - hash strHash ; - size_t key = strHash(getStrCoupling(srcCoupling,dstCoupling)) ; - - winNextCoupling_->lockWindow(managerGlobalLeader_,0) ; - winNextCoupling_->updateFromWindow(managerGlobalLeader_, this, &CCouplerManager::nextCouplingDumpIn) ; - if (nextCoupling_.front().first==key) - { - ret=true ; - if (nextCoupling_.front().second==1) nextCoupling_.pop_front() ; - else nextCoupling_.front().second=1 ; - winNextCoupling_->updateToWindow(managerGlobalLeader_, this, &CCouplerManager::nextCouplingDumpOut) ; - } - else ret=false ; - winNextCoupling_->unlockWindow(managerGlobalLeader_,0) ; - return ret ; - } - void CCouplerManager::registredCouplingDumpOut(CBufferOut& buffer) - { - buffer.realloc(maxBufferSize_) ; - buffer<<(int)registredCoupling_.size(); - - for(auto hash : registredCoupling_) buffer << hash ; - } - - void CCouplerManager::registredCouplingDumpIn(CBufferIn& buffer) - { - registredCoupling_.clear() ; - size_t hash ; - int nbHash ; - buffer>>nbHash ; - for(int i=0;i>hash ; - registredCoupling_.insert(hash) ; - } - } - - void CCouplerManager::nextCouplingDumpOut(CBufferOut& buffer) - { - buffer.realloc(maxBufferSize_) ; - buffer<<(int)nextCoupling_.size(); - - for(auto hash : nextCoupling_) buffer << hash.first<>nbHash ; - for(int i=0;i>hash>>count ; - nextCoupling_.push_back(pair(hash,count)) ; - } - } - -} \ No newline at end of file diff --git a/xios_2311_src/src/manager/coupler_manager.hpp b/xios_2311_src/src/manager/coupler_manager.hpp deleted file mode 100755 index 4467dee4ffdbbbf54dd9c01fb33fff579c67b763..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/manager/coupler_manager.hpp +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef __COUPLER_MANAGER_HPP__ -#define __COUPLER_MANAGER_HPP__ - -#include "xios_spl.hpp" -#include "mpi.hpp" -#include "buffer_in.hpp" -#include "buffer_out.hpp" - -#include -#include -#include "window_manager.hpp" - - -namespace xios -{ - // the rule of this manager is to schedule intercommunicator creation between two or more coupling context - - class CCouplerManager - { - - public: - CCouplerManager(bool isXiosServer); - ~CCouplerManager() ; - void registerCoupling(std::string srcCoupling, std::string dstCoupling) ; - bool isNextCoupling(string srcCoupling, string dstCoupling) ; - private : - void registredCouplingDumpOut(CBufferOut& buffer) ; - void registredCouplingDumpIn(CBufferIn& buffer) ; - void nextCouplingDumpOut(CBufferOut& buffer); - void nextCouplingDumpIn(CBufferIn& buffer); - - const std::string getStrCoupling(std::string srcCoupling, std::string dstCoupling) { return std::string("__"+srcCoupling+"__to__"+dstCoupling+"__") ; } - /** windows containing a set of coupling (hash) registred by at least one context */ - CWindowManager* winRegistredCoupling_ ; - - /** windows containing a list of coupling fully registred by two context. The first coupling of the list will be the next candidate for intercommunicator creation */ - CWindowManager* winNextCoupling_ ; - - /** size of the windows, ie around 1024 coupling context can be registred at the time */ - const size_t maxBufferSize_=1024*8 ; - - std::set registredCoupling_ ; - std::list> nextCoupling_ ; - - /** the rank of the mpi proc where the data are kept in memory*/ - int managerGlobalLeader_ ; - } ; - - -} - -#endif \ No newline at end of file diff --git a/xios_2311_src/src/manager/daemons_manager.cpp b/xios_2311_src/src/manager/daemons_manager.cpp deleted file mode 100755 index 8420f61471a6faab7e5fa77c39b16c353b09e0b8..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/manager/daemons_manager.cpp +++ /dev/null @@ -1,74 +0,0 @@ -#include "daemons_manager.hpp" -#include "cxios.hpp" -#include "ressources_manager.hpp" -#include "services_manager.hpp" -#include "contexts_manager.hpp" -#include "servers_ressource.hpp" -#include "server.hpp" - -namespace xios -{ - using namespace std ; - - CDaemonsManager::CDaemonsManager(bool isXiosServer) : isServer_(isXiosServer) - { - MPI_Comm xiosComm = CXios::getXiosComm() ; - int commRank ; - MPI_Comm_rank(xiosComm,&commRank) ; - MPI_Comm splitComm ; - MPI_Comm_split(xiosComm,isXiosServer,commRank,&splitComm) ; - - CXios::launchRegistryManager(isXiosServer) ; - CXios::launchRessourcesManager(isXiosServer) ; - CXios::launchServicesManager(isXiosServer) ; - CXios::launchContextsManager(isXiosServer) ; - CXios::launchCouplerManager(isXiosServer) ; - - if (isXiosServer) CServer::launchServersRessource(splitComm) ; - MPI_Barrier(xiosComm) ; - MPI_Comm_free(&splitComm) ; - } - - CDaemonsManager::~CDaemonsManager() - { - finalize() ; - } - - bool CDaemonsManager::eventLoop(void) - { - - CXios::getRessourcesManager()->eventLoop() ; - CXios::getServicesManager()->eventLoop() ; - CXios::getContextsManager()->eventLoop() ; - if (isServer_) return CServer::getServersRessource()->eventLoop(false) ; - else return CXios::getPoolRessource()->eventLoop(false) ; - } - - bool CDaemonsManager::servicesEventLoop(void) - { - CXios::getRessourcesManager()->eventLoop() ; - CXios::getServicesManager()->eventLoop() ; - CXios::getContextsManager()->eventLoop() ; - if (isServer_) return CServer::getServersRessource()->eventLoop(true) ; - else return CXios::getPoolRessource()->eventLoop(true) ; - } - - bool CDaemonsManager::finalize(void) - { - if (!isFinalized_) - { - if (isServer_) CServer::getServersRessource()->finalizeSignal() ; - else CXios::getPoolRessource()->finalizeSignal() ; - while(!eventLoop()) ; - MPI_Barrier( CXios::getXiosComm()) ; - CXios::finalizeContextsManager() ; - CXios::finalizeCouplerManager() ; - CXios::finalizeServicesManager() ; - CXios::finalizeRessourcesManager() ; - CXios::finalizeRegistryManager() ; - isFinalized_=true ; - } - return isFinalized_; - } - -} diff --git a/xios_2311_src/src/manager/daemons_manager.hpp b/xios_2311_src/src/manager/daemons_manager.hpp deleted file mode 100755 index d9b3475b3b7c2b4727b7e1fcbafb77cf19432d72..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/manager/daemons_manager.hpp +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef __DAEMONS_MANAGER_HPP__ -#define __DAEMONS_MANAGER_HPP__ -#include - -namespace xios -{ - - - class CDaemonsManager - { - public: - - CDaemonsManager(bool isXiosServer) ; - ~CDaemonsManager() ; - - bool eventLoop(void) ; - bool servicesEventLoop(void) ; - - void scheduleContext(size_t hashId) { scheduledContext_=hashId ;} //!< for attached mode, give the hand to the associated context server - bool isScheduledContext(size_t hashId) { return scheduledContext_==hashId ;} //!< for attached mode, return true if context server is sceduled - void unscheduleContext(void) { scheduledContext_=0 ;} //!< for attached mode : unschedule context - bool finalize(void) ; - private: - bool isServer_ ; - size_t scheduledContext_ = 0 ; //!< Hash id of the next scehduled context for attached mode - bool isFinalized_=false ; - } ; -} - -#endif \ No newline at end of file diff --git a/xios_2311_src/src/manager/pool_ressource.cpp b/xios_2311_src/src/manager/pool_ressource.cpp deleted file mode 100755 index 4292110dbf16e5d1f5d2ab2ee9107c5929449ab3..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/manager/pool_ressource.cpp +++ /dev/null @@ -1,206 +0,0 @@ -#include "pool_ressource.hpp" -#include "services.hpp" -#include "buffer_in.hpp" -#include "buffer_out.hpp" -#include "message.hpp" -#include "type.hpp" -#include "cxios.hpp" -#include "timer.hpp" - -namespace xios -{ - CPoolRessource::CPoolRessource(MPI_Comm poolComm, const std::string& Id) : Id_(Id), finalizeSignal_(false) - { - int commRank, commSize ; - MPI_Comm_dup(poolComm, &poolComm_) ; - winNotify_ = new CWindowManager(poolComm_, maxBufferSize_) ; - MPI_Comm_rank(poolComm, &commRank) ; - MPI_Comm_size(poolComm, &commSize) ; - info(40)<<"CPoolRessource::CPoolRessource : creating new pool : "<(0,i)) ; - int globalLeaderRank ; - MPI_Comm_rank(CXios::getXiosComm(),&globalLeaderRank) ; - CXios::getRessourcesManager()->registerPool(Id, commSize, globalLeaderRank) ; - } - - winNotify_->lockWindow(commRank,0) ; - winNotify_->updateToWindow(commRank, this, &CPoolRessource::createServiceDumpOut) ; - winNotify_->unlockWindow(commRank,0) ; - MPI_Barrier(poolComm_) ; - } - - void CPoolRessource::createService(const std::string& serviceId, int type, int size, int nbPartitions) - { - // for now suppose nbPartitions=1 - - auto it=occupancy_.begin() ; - int commSize ; - MPI_Comm_size(poolComm_, &commSize) ; - vector procs_in(commSize,false) ; - vector> procs_update ; - - for(int i=0; isecond]=true ; - procs_update.push_back(std::pair(it->first+1,it->second)) ; - ++it ; - } - - occupancy_.erase(occupancy_.begin(),it) ; - occupancy_.insert(procs_update.begin(),procs_update.end()) ; - - info(40)<<"CPoolRessource::createService : notify createService to all pool members ; serviceId : "<lockWindow(rank,0) ; - winNotify_->updateFromWindow(rank, this, &CPoolRessource::createServiceDumpIn) ; - notifications_.push_back(std::make_tuple(serviceId,type,size,nbPartitions,in)) ; - winNotify_->updateToWindow(rank, this, &CPoolRessource::createServiceDumpOut) ; - winNotify_->unlockWindow(rank,0) ; - } - - - void CPoolRessource::createServiceDumpOut(CBufferOut& buffer) - { - buffer.realloc(maxBufferSize_) ; - - buffer << (int) (notifications_.size()); - - for(auto it=notifications_.begin();it!=notifications_.end(); ++it) - buffer << std::get<0>(*it) << static_cast(std::get<1>(*it))<< std::get<2>(*it)<< std::get<3>(*it) << std::get<4>(*it) ; - } - - - void CPoolRessource::createServiceDumpIn(CBufferIn& buffer) - { - std::string serviceId ; - int type ; - int size; - int nbPartitions; - bool in ; - - notifications_.clear() ; - int nbNotifications ; - buffer>>nbNotifications ; - for(int i=0;i>serviceId>>type>>size>>nbPartitions>>in ; - notifications_.push_back(std::make_tuple(serviceId,type,size,nbPartitions,in)) ; - } - } - - bool CPoolRessource::eventLoop(bool serviceOnly) - { - CTimer::get("CPoolRessource::eventLoop").resume(); - - double time=MPI_Wtime() ; - int flag ; - MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &flag, MPI_STATUS_IGNORE); - if (time-lastEventLoop_ > eventLoopLatency_) - { - checkCreateServiceNotification() ; - lastEventLoop_=time ; - } - - for (auto it=services_.begin(); it!=services_.end() ; ++it) - { - if (it->second->eventLoop(serviceOnly)) - { - delete it->second ; - services_.erase(it) ; - // don't forget to free service later - break ; - } - } - CTimer::get("CPoolRessource::eventLoop").suspend(); - if (services_.empty() && finalizeSignal_) return true ; - else return false ; - } - - void CPoolRessource::checkCreateServiceNotification(void) - { - int commRank ; - MPI_Comm_rank(poolComm_, &commRank) ; - winNotify_->lockWindow(commRank,0) ; - winNotify_->updateFromWindow(commRank, this, &CPoolRessource::createServiceDumpIn) ; - - if (!notifications_.empty()) - { - auto info = notifications_.front() ; - createNewService(get<0>(info), get<1>(info), get<2>(info), get<3>(info), get<4>(info)) ; - notifications_.pop_front() ; - winNotify_->updateToWindow(commRank, this, &CPoolRessource::createServiceDumpOut) ; - } - winNotify_->unlockWindow(commRank,0) ; - - } - - void CPoolRessource::createNewService(const std::string& serviceId, int type, int size, int nbPartitions, bool in) - { - - info(40)<<"CPoolRessource::createNewService : receive createService notification ; serviceId : "<= (serviceCommSize/nbPartitions+1)*(serviceCommSize%nbPartitions) ) - { - int rank = serviceCommRank - (serviceCommSize/nbPartitions+1)*(serviceCommSize%nbPartitions) ; - partitionId = serviceCommSize%nbPartitions + rank / (serviceCommSize/nbPartitions) ; - } - else partitionId = serviceCommRank / (serviceCommSize/nbPartitions + 1) ; - - MPI_Comm_split(serviceComm, partitionId, commRank, &newServiceComm) ; - - MPI_Comm_size(newServiceComm,&serviceCommSize) ; - MPI_Comm_rank(newServiceComm,&serviceCommRank) ; - info(10)<<"Service "<second->finalizeSignal() ; - } - - CPoolRessource::~CPoolRessource() - { - delete winNotify_ ; - for(auto& service : services_) delete service.second ; - } -} \ No newline at end of file diff --git a/xios_2311_src/src/manager/pool_ressource.hpp b/xios_2311_src/src/manager/pool_ressource.hpp deleted file mode 100755 index 6eed3404e324baf110b01c95c26a5b6eba72d2c1..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/manager/pool_ressource.hpp +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef __POOL_RESSOURCE_HPP__ -#define __POOL_RESSOURCE_HPP__ - -#include "mpi.hpp" -#include "window_manager.hpp" -#include "services_manager.hpp" - - -namespace xios -{ - - class CService ; - - class CPoolRessource - { - private: - - const size_t maxBufferSize_=1024*1024 ; - const int localLeader_ = 0 ; - - CWindowManager* winNotify_ ; - - public: - CPoolRessource(MPI_Comm poolComm, const std::string& Id) ; - ~CPoolRessource() ; - - void createService(const std::string& serviceId, int type, int size, int nbPartition) ; - void createService(MPI_Comm serviceComm, const std::string& serviceId, int partitionId, int type, int nbPartitions) ; - void createServiceNotify(int rank, const std::string& serviceId, int type, int size, int nbPartitions, bool in) ; - void createServiceDumpOut(CBufferOut& buffer) ; - void createServiceDumpIn(CBufferIn& buffer) ; - void checkCreateServiceNotification(void) ; - void createNewService(const std::string& serviceId, int type, int size, int nbPartitions, bool in) ; - bool eventLoop(bool serviceOnly=false) ; - CService* getService(const std::string serviceId, int partitionId) { return services_[make_tuple(serviceId,partitionId)]; } - void finalizeSignal(void) ; - string getId(void) { return Id_; } - - private: - MPI_Comm poolComm_ ; - - std::multimap occupancy_ ; - std::list > notifications_; - std::map< std::tuple, CService*> services_ ; - std::string Id_ ; - bool finalizeSignal_ ; - - const double eventLoopLatency_=0; - double lastEventLoop_=0. ; - }; - -} - - - -#endif \ No newline at end of file diff --git a/xios_2311_src/src/manager/register_context_info.hpp b/xios_2311_src/src/manager/register_context_info.hpp deleted file mode 100755 index e6518207305a70cc5d046af393de366832a3db1a..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/manager/register_context_info.hpp +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef __CONTEXT_INFO_HPP__ -#define __CONTEXT_INFO_HPP__ - -#include "services_manager.hpp" - -namespace xios -{ - struct SRegisterContextInfo - { - string poolId ; - string serviceId; - int partitionId ; - int serviceType ; - string id ; - int size ; - int leader ; - } ; -} - - -#endif \ No newline at end of file diff --git a/xios_2311_src/src/manager/registry_manager.cpp b/xios_2311_src/src/manager/registry_manager.cpp deleted file mode 100755 index 6890f5b1142b1245d6b2804690f008f195c9fc9b..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/manager/registry_manager.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "registry_manager.hpp" -#include "cxios.hpp" - -namespace xios -{ - CRegistryManager::CRegistryManager(bool isXiosServer) - { - - int commRank ; - xiosComm_ = CXios::getXiosComm() ; - MPI_Comm_rank(xiosComm_, &commRank) ; - managerGlobalLeader_ = 0 ; - if (commRank==managerGlobalLeader_) isManagerGlobalLeader_=true; - else isManagerGlobalLeader_=false; - registryIn_ = new CRegistry(xiosComm_) ; - if (commRank==managerGlobalLeader_) registryIn_->fromFile(registryInFileName) ; - registryIn_->bcastRegistry() ; - registryOut_= new CRegistry(xiosComm_) ; - } - - void CRegistryManager::finalize(void) - { - delete registryIn_ ; - registryOut_->hierarchicalGatherRegistry() ; - if (isManagerGlobalLeader_) registryOut_->toFile(registryOutFileName) ; - delete registryOut_ ; - } -} \ No newline at end of file diff --git a/xios_2311_src/src/manager/registry_manager.hpp b/xios_2311_src/src/manager/registry_manager.hpp deleted file mode 100755 index bf693017e2761938f3967e9bb0f7e07ab13d3721..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/manager/registry_manager.hpp +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef __REGISTRY_MANAGER_HPP__ -#define __REGISTRY_MANAGER_HPP__ - -#include "xios_spl.hpp" -#include "registry.hpp" -#include "mpi.hpp" - -namespace xios -{ - class CRegistryManager - { - - public: - - CRegistryManager(bool isXiosServer) ; - ~CRegistryManager() { finalize() ;} - const CRegistry& getRegistryIn(void) {return *registryIn_ ;} - const CRegistry& getRegistryOut(void) {return *registryOut_ ;} - - void merge(const CRegistry& inRegistry) { registryOut_->mergeRegistry(inRegistry) ;} - - private: - void finalize(void) ; - - const std::string registryInFileName {"registry.bin"} ; - const std::string registryOutFileName {"registry.bin"} ; - MPI_Comm xiosComm_ ; - int managerGlobalLeader_ ; - bool isManagerGlobalLeader_ ; - CRegistry* registryIn_ ; - CRegistry* registryOut_ ; - } ; -} - -#endif \ No newline at end of file diff --git a/xios_2311_src/src/manager/ressources_manager.cpp b/xios_2311_src/src/manager/ressources_manager.cpp deleted file mode 100755 index 3592eff6e802ed0705bc21578d3580067cce1b88..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/manager/ressources_manager.cpp +++ /dev/null @@ -1,274 +0,0 @@ -#include "ressources_manager.hpp" -#include "server.hpp" -#include "servers_ressource.hpp" -#include "timer.hpp" - - - - - -namespace xios -{ - using namespace std; - - CRessourcesManager::CRessourcesManager(bool isXiosServer) - { - - xiosComm_ = CXios::getXiosComm() ; - - int commRank ; - MPI_Comm_rank(xiosComm_, &commRank) ; - if (commRank==0 && isXiosServer) MPI_Comm_rank(xiosComm_, &commRank) ; - else commRank=0 ; - MPI_Allreduce(&commRank, &managerGlobalLeader_, 1, MPI_INT, MPI_SUM, xiosComm_) ; - - MPI_Comm_rank(xiosComm_, &commRank) ; - winNotify_ = new CWindowManager(xiosComm_, maxBufferSize_) ; - - - winRessources_ = new CWindowManager(xiosComm_, maxBufferSize_) ; - winRessources_->lockWindow(commRank,0) ; - serverLeader_=-1 ; - winRessources_->updateToWindow(commRank, this, &CRessourcesManager::ressourcesDumpOut) ; - winRessources_->unlockWindow(commRank,0) ; - - MPI_Barrier(xiosComm_) ; - } - - CRessourcesManager::~CRessourcesManager() - { - delete winNotify_ ; - delete winRessources_ ; - } - - void CRessourcesManager::createPool(const string& poolId, int size) - { - info(40)<<"CRessourcesManager::createPool : calling createPool : "<lockWindow(managerGlobalLeader_,0) ; - winRessources_->updateFromWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ; - winRessources_->unlockWindow(managerGlobalLeader_,0) ; - - notifyType_=NOTIFY_CREATE_POOL ; - notifyCreatePool_=make_tuple(poolId, size) ; - info(40)<<"CRessourcesManager::createPool : send notification creating pool to server leader "<lockWindow(managerGlobalLeader_,0) ; - winRessources_->updateFromWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ; - winRessources_->unlockWindow(managerGlobalLeader_,0) ; - - if (serverLeader_!=-1) - { - notifyType_=NOTIFY_FINALIZE ; - info(40)<<"CRessourcesManager::finalize : send notification finalize to server leader "<lockWindowExclusive(rank) ; - winNotify_->pushToLockedWindow(rank, this, &CRessourcesManager::notificationsDumpOut) ; - winNotify_->unlockWindow(rank) ; - } - - - void CRessourcesManager::notificationsDumpOut(CBufferOut& buffer) - { - - buffer.realloc(maxBufferSize_) ; - - if (notifyType_==NOTIFY_CREATE_POOL) - { - auto& arg=notifyCreatePool_ ; - buffer << notifyType_<< get<0>(arg) << get<1>(arg) ; - } - else if (notifyType_==NOTIFY_FINALIZE) - { - buffer << notifyType_ ; - } - } - - void CRessourcesManager::notificationsDumpIn(CBufferIn& buffer) - { - if (buffer.bufferSize() == 0) notifyType_= NOTIFY_NOTHING ; - else - { - buffer>>notifyType_; - if (notifyType_==NOTIFY_CREATE_POOL) - { - auto& arg=notifyCreatePool_ ; - buffer >> get<0>(arg) >> get<1>(arg) ; - } - else if (notifyType_==NOTIFY_FINALIZE) { /*nothing to do*/ } - } - - } - - void CRessourcesManager::eventLoop(void) - { - CTimer::get("CRessourcesManager::eventLoop").resume(); - int flag ; - MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &flag, MPI_STATUS_IGNORE); - double time=MPI_Wtime() ; - if (time-lastEventLoop_ > eventLoopLatency_) - { - checkNotifications() ; - lastEventLoop_=time ; - } - - CTimer::get("CRessourcesManager::eventLoop").suspend(); - } - - void CRessourcesManager::checkNotifications(void) - { - int commRank ; - MPI_Comm_rank(xiosComm_, &commRank) ; - CTimer::get("CRessourcesManager::checkNotifications lock").resume(); - winNotify_->lockWindowExclusive(commRank) ; - CTimer::get("CRessourcesManager::checkNotifications lock").suspend(); - CTimer::get("CRessourcesManager::checkNotifications pop").resume(); - winNotify_->popFromLockedWindow(commRank, this, &CRessourcesManager::notificationsDumpIn) ; - CTimer::get("CRessourcesManager::checkNotifications pop").suspend(); - CTimer::get("CRessourcesManager::checkNotifications unlock").resume(); - winNotify_->unlockWindow(commRank) ; - CTimer::get("CRessourcesManager::checkNotifications unlock").suspend(); - if (notifyType_==NOTIFY_CREATE_POOL) createPool() ; - else if (notifyType_==NOTIFY_FINALIZE) finalizeSignal() ; - } - - void CRessourcesManager::createPool(void) - { - - auto& arg=notifyCreatePool_ ; - string poolId=get<0>(arg) ; - int size=get<1>(arg) ; - info(40)<<"CRessourcesManager::createPool : receive create pool notification : "<< poolId<<" of size "<createPool(poolId,size) ; - } - - void CRessourcesManager::finalizeSignal(void) - { - info(40)<<"CRessourcesManager::createPool : receive finalize notification"<finalize() ; - } - - void CRessourcesManager::ressourcesDumpOut(CBufferOut& buffer) - { - - buffer.realloc(maxBufferSize_) ; - - buffer<first ; - auto val = it->second ; - buffer << key<(val) << std::get<1>(val) ; - } - } - - void CRessourcesManager::ressourcesDumpIn(CBufferIn& buffer) - { - std::string poolId ; - int size ; - int leader ; - - buffer>>serverLeader_ ; - pools_.clear() ; - int nbPools ; - buffer>>nbPools ; - for(int i=0;i>poolId>>size>>leader ; - pools_[poolId]=std::make_tuple(size,leader) ; - } - } - - void CRessourcesManager::registerServerLeader(int serverLeaderRank) - { - winRessources_->lockWindow(managerGlobalLeader_,0) ; - winRessources_->updateFromWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ; - serverLeader_ = serverLeaderRank ; - winRessources_->updateToWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpOut) ; - winRessources_->unlockWindow(managerGlobalLeader_,0) ; - } - - void CRessourcesManager::registerRessourcesSize(int size) - { - winRessources_->lockWindow(managerGlobalLeader_,0) ; - winRessources_->updateFromWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ; - ressourcesSize_ = size ; - freeRessourcesSize_ = size ; - winRessources_->updateToWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpOut) ; - winRessources_->unlockWindow(managerGlobalLeader_,0) ; - } - - - void CRessourcesManager::registerPool(const string& poolId, int size, int leader) - { - winRessources_->lockWindow(managerGlobalLeader_,0) ; - winRessources_->updateFromWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ; - pools_[poolId] = make_tuple(size,leader) ; - freeRessourcesSize_-=size ; - winRessources_->updateToWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpOut) ; - winRessources_->unlockWindow(managerGlobalLeader_,0) ; - } - - - bool CRessourcesManager::getPoolInfo(const string& poolId, int& size, int& leader) - { - winRessources_->lockWindow(managerGlobalLeader_,0) ; - winRessources_->updateFromWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ; - winRessources_->unlockWindow(managerGlobalLeader_,0) ; - - auto it=pools_.find(poolId) ; - if ( it == pools_.end()) return false ; - else - { - size=get<0>(it->second) ; - leader=get<1>(it->second) ; - return true ; - } - } - - int CRessourcesManager::getRessourcesSize(void) - { - winRessources_->lockWindow(managerGlobalLeader_,0) ; - winRessources_->updateFromWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ; - winRessources_->unlockWindow(managerGlobalLeader_,0) ; - - return ressourcesSize_ ; - } - - int CRessourcesManager::getFreeRessourcesSize(void) - { - winRessources_->lockWindow(managerGlobalLeader_,0) ; - winRessources_->updateFromWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ; - winRessources_->unlockWindow(managerGlobalLeader_,0) ; - - return freeRessourcesSize_ ; - } - - bool CRessourcesManager::getPoolLeader(const string& poolId, int& leader) - { - int size ; - return getPoolInfo(poolId, size, leader) ; - } - - bool CRessourcesManager::getPoolSize(const string& poolId, int& size) - { - int leader ; - return getPoolInfo(poolId, size, leader) ; - } - - bool CRessourcesManager::hasPool(const string& poolId) - { - int leader,size ; - return getPoolInfo(poolId, size, leader) ; - } -} \ No newline at end of file diff --git a/xios_2311_src/src/manager/ressources_manager.hpp b/xios_2311_src/src/manager/ressources_manager.hpp deleted file mode 100755 index 1b5dd24ff0aa5d4238a085813c27266a7410619d..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/manager/ressources_manager.hpp +++ /dev/null @@ -1,81 +0,0 @@ -#ifndef __RESSOURCES_MANAGER_HPP__ -#define __RESSOURCES_MANAGER_HPP__ - -#include "xios_spl.hpp" -#include "mpi.hpp" -#include "buffer_in.hpp" -#include "buffer_out.hpp" - -#include -#include -#include "window_manager.hpp" -#include "pool_ressource.hpp" - - - -namespace xios -{ - - - class CRessourcesManager - { - - const int NOTIFY_NOTHING=0 ; - const int NOTIFY_CREATE_POOL=1 ; - const int NOTIFY_FINALIZE=2 ; - - public: - - CRessourcesManager(bool isXiosServer) ; - ~CRessourcesManager() ; - - void eventLoop(void) ; - void createPool(const std::string& id, int size) ; - void createPool(void) ; - void finalize(void) ; - void finalizeSignal(void) ; - void sendNotification(int rank); - void checkNotifications(void) ; - void notificationsDumpOut(CBufferOut& buffer) ; - void notificationsDumpIn(CBufferIn& buffer) ; - - void ressourcesDumpOut(CBufferOut& buffer) ; - void ressourcesDumpIn(CBufferIn& buffer) ; - - int getRessourcesSize(void) ; - int getFreeRessourcesSize(void) ; - bool getPoolInfo(const string& poolId, int& size, int& leader) ; - bool getPoolLeader(const string& poolId, int& leader) ; - bool getPoolSize(const string& poolId, int& size) ; - bool hasPool(const string& poolId) ; - - void registerServerLeader(int leaderRank) ; - void registerRessourcesSize(int size) ; - void registerPool(const std::string& poolId,int size,int leader) ; - - int managerGlobalLeader_ ; - - CWindowManager* winRessources_ ; - - CWindowManager* winNotify_ ; - - const size_t maxBufferSize_=1024*1024 ; - - MPI_Comm xiosComm_ ; - - int notifyType_ ; - tuple notifyCreatePool_ ; - - std::map> pools_ ; - int serverLeader_ ; - int ressourcesSize_ ; - int freeRessourcesSize_ ; - - const double eventLoopLatency_=0; - double lastEventLoop_=0. ; - - friend class CWindowManager ; - } ; - -} -#endif \ No newline at end of file diff --git a/xios_2311_src/src/manager/server_context.cpp b/xios_2311_src/src/manager/server_context.cpp deleted file mode 100755 index 0d4d4a17b5828bc442d50c31db270596c6b12d11..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/manager/server_context.cpp +++ /dev/null @@ -1,326 +0,0 @@ -#include "server_context.hpp" -#include "contexts_manager.hpp" -#include "cxios.hpp" -#include "mpi.hpp" -#include "context.hpp" -#include "register_context_info.hpp" -#include "services.hpp" -#include "timer.hpp" - - -namespace xios -{ - using namespace std ; - - map > CServerContext::overlapedComm_ ; - - CServerContext::CServerContext(CService* parentService, MPI_Comm contextComm, const std::string& poolId, const std::string& serviceId, - const int& partitionId, const std::string& contextId) : finalizeSignal_(false), parentService_(parentService), - hasNotification_(false) - { - info(40)<<"CCServerContext::CServerContext : new context creation ; contextId : "<getServiceType(poolId,serviceId, 0, type) ; - SRegisterContextInfo contextInfo = {poolId, serviceId, partitionId, type, contextId, commSize, globalLeader_} ; - name_ = CXios::getContextsManager()->getServerContextName(poolId, serviceId, partitionId, type, contextId) ; - CXios::getContextsManager()->registerContext(name_, contextInfo) ; - } - MPI_Bcast(&type, 1, MPI_INT, localLeader_,contextComm_) ; - name_ = CXios::getContextsManager()->getServerContextName(poolId, serviceId, partitionId, type, contextId) ; - context_=CContext::create(name_); - - context_->init(this, contextComm, type) ; - - info(10)<<"Context "<< CXios::getContextsManager()->getServerContextName(poolId, serviceId, partitionId, type, contextId)<<" created, on local rank "<(false, newInterCommClient, newInterCommServer) ; - MPI_Barrier(contextComm_) ; - - if (intraCommRank==0) - { - ok=CXios::getContextsManager()->createServerContextIntercomm(poolId, serviceId, partitionId, contextId, name_, wait) ; - if (ok) - { - CXios::getServicesManager()->getServiceType(poolId,serviceId, 0, type) ; - string name=CXios::getContextsManager()->getServerContextName(poolId, serviceId, partitionId, type, contextId) ; - CXios::getContextsManager()->getContextLeader(name, contextLeader) ; - } - } - - MPI_Request req ; - MPI_Status status ; - MPI_Ibarrier(intraComm,&req) ; - - int flag=false ; - while(!flag) - { - CXios::getDaemonsManager()->servicesEventLoop() ; - MPI_Test(&req,&flag,&status) ; - } - - MPI_Bcast(&ok, 1, MPI_INT, 0, intraComm) ; - - if (ok) - { - int globalRank ; - MPI_Comm_rank(xiosComm_,&globalRank) ; - MPI_Bcast(&contextLeader, 1, MPI_INT, 0, intraComm) ; - - int overlap, nOverlap ; - if (contextLeader==globalRank) overlap=1 ; - else overlap=0 ; - MPI_Allreduce(&overlap, &nOverlap, 1, MPI_INT, MPI_SUM, contextComm_) ; -/* - int overlap ; - if (get<0>(overlapedComm_[name_])) overlap=1 ; - else overlap=0 ; - - int nOverlap ; - MPI_Allreduce(&overlap, &nOverlap, 1, MPI_INT, MPI_SUM, contextComm_) ; - int commSize ; - MPI_Comm_size(contextComm_,&commSize ) ; -*/ - if (nOverlap> 0 ) - { - while (get<0>(overlapedComm_[name_])==false) CXios::getDaemonsManager()->servicesEventLoop() ; - isAttachedMode_=true ; - cout<<"CServerContext::createIntercomm : total overlap ==> context in attached mode"< context in server mode"< not managed"<lockWindowExclusive(rank) ; - winNotify_->pushToLockedWindow(rank, this, &CServerContext::notificationsDumpOut) ; - winNotify_->unlockWindow(rank) ; - } - - - void CServerContext::notificationsDumpOut(CBufferOut& buffer) - { - - buffer.realloc(maxBufferSize_) ; - - if (notifyOutType_==NOTIFY_CREATE_INTERCOMM) - { - auto& arg=notifyOutCreateIntercomm_ ; - buffer << notifyOutType_ << std::get<0>(arg)<(arg) ; - } - } - - void CServerContext::notificationsDumpIn(CBufferIn& buffer) - { - if (buffer.bufferSize() == 0) notifyInType_= NOTIFY_NOTHING ; - else - { - buffer>>notifyInType_; - if (notifyInType_==NOTIFY_CREATE_INTERCOMM) - { - auto& arg=notifyInCreateIntercomm_ ; - buffer >> std::get<0>(arg)>> std::get<1>(arg) ; - } - } - } - - void CServerContext::checkNotifications(void) - { - if (!hasNotification_) - { - double time=MPI_Wtime() ; - if (time-lastEventLoop_ > eventLoopLatency_) - { - int commRank ; - MPI_Comm_rank(contextComm_, &commRank) ; - winNotify_->lockWindowExclusive(commRank) ; - winNotify_->popFromLockedWindow(commRank, this, &CServerContext::notificationsDumpIn) ; - winNotify_->unlockWindow(commRank) ; - - if (notifyInType_!= NOTIFY_NOTHING) - { - hasNotification_=true ; - auto eventScheduler=parentService_->getEventScheduler() ; - std::hash hashString ; - size_t hashId = hashString(name_) ; - size_t currentTimeLine=0 ; - eventScheduler->registerEvent(currentTimeLine,hashId); - } - lastEventLoop_=time ; - } - } - - if (hasNotification_) - { - auto eventScheduler=parentService_->getEventScheduler() ; - std::hash hashString ; - size_t hashId = hashString(name_) ; - size_t currentTimeLine=0 ; - if (eventScheduler->queryEvent(currentTimeLine,hashId)) - { - eventScheduler->popEvent() ; - if (notifyInType_==NOTIFY_CREATE_INTERCOMM) createIntercomm() ; - hasNotification_=false ; - } - } - } - - bool CServerContext::eventLoop(bool serviceOnly) - { - CTimer::get("CServerContext::eventLoop").resume(); - bool finished=false ; - int flag ; - MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &flag, MPI_STATUS_IGNORE); - -// double time=MPI_Wtime() ; -// if (time-lastEventLoop_ > eventLoopLatency_) -// { - if (winNotify_!=nullptr) checkNotifications() ; -// lastEventLoop_=time ; -// } - - - if (!serviceOnly && context_!=nullptr) - { - if (context_->eventLoop()) - { - info(100)<<"Remove context server with id "<getId()<getId()) ; - context_=nullptr ; - // destroy context ??? --> later - } - } - CTimer::get("CServerContext::eventLoop").suspend(); - if (context_==nullptr && finalizeSignal_) finished=true ; - return finished ; - } - - void CServerContext::createIntercomm(void) - { - info(40)<<"CServerContext::createIntercomm : received createIntercomm notification"<(arg) ; - string sourceContext=get<1>(arg) ; - - auto it=overlapedComm_.find(sourceContext) ; - int overlap=0 ; - if (it!=overlapedComm_.end()) - { - get<0>(it->second)=true ; - overlap=1 ; - } - int nOverlap ; - MPI_Allreduce(&overlap, &nOverlap, 1, MPI_INT, MPI_SUM, contextComm_) ; - int commSize ; - MPI_Comm_size(contextComm_,&commSize ) ; - - if (nOverlap==commSize) - { - info(10)<<"CServerContext::createIntercomm : total overlap ==> context in attached mode"<(it->second) ; - interCommServer=get<1>(it->second) ; - context_ -> createClientInterComm(interCommClient, interCommServer ) ; - clientsInterComm_.push_back(interCommClient) ; - clientsInterComm_.push_back(interCommServer) ; - } - else if (nOverlap==0) - { - info(10)<<"CServerContext::createIntercomm : No overlap ==> context in server mode"< createClientInterComm(interCommClient,interCommServer) ; - clientsInterComm_.push_back(interCommClient) ; - clientsInterComm_.push_back(interCommServer) ; - } - else - { - ERROR("void CServerContext::createIntercomm(void)",<<"CServerContext::createIntercomm : partial overlap ==> not managed") ; - } - - } - - void CServerContext::freeComm(void) - { - delete winNotify_ ; - winNotify_=nullptr ; - MPI_Comm_free(&contextComm_) ; - // don't forget intercomm -> later - } - - void CServerContext::finalizeSignal(void) - { - finalizeSignal_=true ; - } - -} \ No newline at end of file diff --git a/xios_2311_src/src/manager/server_context.hpp b/xios_2311_src/src/manager/server_context.hpp deleted file mode 100755 index d00502a337866d6048d0092fdb99f1cbe8ad9d94..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/manager/server_context.hpp +++ /dev/null @@ -1,72 +0,0 @@ -#ifndef __SERVER_CONTEXT_HPP__ -#define __SERVER_CONTEXT_HPP__ -#include "xios_spl.hpp" -#include "window_manager.hpp" -#include "mpi.hpp" - -namespace xios -{ - class CContext ; - class CService ; - - class CServerContext - { - const int NOTIFY_NOTHING=0 ; - const int NOTIFY_CREATE_INTERCOMM=1 ; - - public: - CServerContext(CService* parentService, MPI_Comm contextComm, const std::string& poolId, const std::string& serviceId, - const int& partitionId, const std::string& contextId) ; - ~CServerContext() ; - static void releaseStaticAllocation(void) { overlapedComm_.clear() ;} - - bool createIntercomm(const string& poolId, const string& serviceId, const int& partitionId, const string& contextId, - const MPI_Comm& intraComm, MPI_Comm& interCommClient, MPI_Comm& interCommServer, bool wait=true) ; - void createIntercomm(int remoteLeader, const string& sourceContext) ; - - void sendNotification(int rank); - void checkNotifications(void) ; - - bool eventLoop(bool serviceOnly=false) ; - void notificationsDumpOut(CBufferOut& buffer) ; - void notificationsDumpIn(CBufferIn& buffer) ; - void finalizeSignal(void) ; - void freeComm(void) ; - bool isAttachedMode(void) { return isAttachedMode_ ;} - CService* getParentService(void) {return parentService_ ; } - - private: - void createIntercomm(void) ; - - static std::map > overlapedComm_ ; - - MPI_Comm contextComm_ ; - MPI_Comm xiosComm_ ; - - CContext* context_ ; - CService* parentService_ ; - std::string name_ ; - - vector clientsInterComm_ ; - - - const size_t maxBufferSize_=1024*1024 ; - CWindowManager* winNotify_ ; - int notifyInType_, notifyOutType_ ; - tuple notifyInCreateIntercomm_, notifyOutCreateIntercomm_ ; - - const int localLeader_=0 ; - int globalLeader_ ; - bool finalizeSignal_ ; - bool hasNotification_ ; - bool isAttachedMode_ ; - - const double eventLoopLatency_=0; - double lastEventLoop_=0. ; - - friend class CWindowManager ; - } ; - -} - -#endif diff --git a/xios_2311_src/src/manager/servers_ressource.cpp b/xios_2311_src/src/manager/servers_ressource.cpp deleted file mode 100755 index 90a835d2b01763e5c7da46944329f9d2aa1c9fed..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/manager/servers_ressource.cpp +++ /dev/null @@ -1,196 +0,0 @@ -#include "servers_ressource.hpp" -#include "window_manager.hpp" -#include "ressources_manager.hpp" -#include "pool_ressource.hpp" -#include "cxios.hpp" -#include "mpi.hpp" -#include "timer.hpp" -#include -#include - - - - -namespace xios -{ - using namespace std ; - - CServersRessource::CServersRessource(MPI_Comm serverComm) : poolRessource_(nullptr), finalizeSignal_(false) - { - - MPI_Comm_dup(serverComm, &serverComm_) ; - MPI_Comm xiosComm=CXios::getXiosComm() ; - - int localRank, globalRank ; - MPI_Comm_rank(xiosComm,&globalRank) ; - MPI_Comm_rank(serverComm_,&localRank) ; - - winNotify_ = new CWindowManager(serverComm_, maxBufferSize_) ; - MPI_Barrier(serverComm_) ; - if (localRank==localLeader_) - { - int commSize ; - MPI_Comm_size(serverComm_,&commSize) ; - CXios::getRessourcesManager()->registerServerLeader(globalRank) ; - CXios::getRessourcesManager()->registerRessourcesSize(commSize) ; - freeRessourcesRank_.resize(commSize) ; - for(int i=0;i newFreeRessourcesRank(freeRessourcesRank_.size()-size) ; - - bool isPartOf ; - - for(int i=0; ilockWindow(rank,0) ; - winNotify_->pushToWindow(rank, this, &CServersRessource::notificationsDumpOut) ; - winNotify_->unlockWindow(rank,0) ; - } - - - void CServersRessource::notificationsDumpOut(CBufferOut& buffer) - { - - buffer.realloc(maxBufferSize_) ; - - if (notifyOutType_==NOTIFY_CREATE_POOL) - { - auto& arg=notifyOutCreatePool_ ; - buffer << notifyOutType_ << std::get<0>(arg) << std::get<1>(arg) ; - } - else if (notifyOutType_==NOTIFY_FINALIZE) buffer << notifyOutType_ ; - } - - void CServersRessource::notificationsDumpIn(CBufferIn& buffer) - { - if (buffer.bufferSize() == 0) notifyInType_= NOTIFY_NOTHING ; - else - { - buffer>>notifyInType_; - if (notifyInType_==NOTIFY_CREATE_POOL) - { - auto& arg=notifyInCreatePool_ ; - buffer >> std::get<0>(arg) >> std::get<1>(arg) ; - } - else if (notifyInType_==NOTIFY_FINALIZE) { /*nothing to do*/} - } - } - - bool CServersRessource::eventLoop(bool serviceOnly) - { - CTimer::get("CServersRessource::eventLoop").resume(); - double time=MPI_Wtime() ; - int flag ; - MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &flag, MPI_STATUS_IGNORE); - - if (time-lastEventLoop_ > eventLoopLatency_) - { - checkNotifications() ; - lastEventLoop_=time ; - } - - if (poolRessource_!=nullptr) - { - if (poolRessource_->eventLoop(serviceOnly)) - { - delete poolRessource_ ; - poolRessource_=nullptr ; - // don't forget to free pool ressource later - } - } - CTimer::get("CServersRessource::eventLoop").suspend(); - if (poolRessource_==nullptr && finalizeSignal_) return true ; - else return false ; - } - - void CServersRessource::checkNotifications(void) - { - int commRank ; - MPI_Comm_rank(serverComm_, &commRank) ; - winNotify_->lockWindow(commRank,0) ; - winNotify_->popFromWindow(commRank, this, &CServersRessource::notificationsDumpIn) ; - winNotify_->unlockWindow(commRank,0) ; - if (notifyInType_==NOTIFY_CREATE_POOL) createPool() ; - else if (notifyInType_==NOTIFY_FINALIZE) finalizeSignal() ; - } - - void CServersRessource::createPool(void) - { - auto& arg=notifyInCreatePool_ ; - string poolId=get<0>(arg) ; - bool isPartOf=get<1>(arg) ; - - int commRank ; - MPI_Comm poolComm ; - MPI_Comm_rank(freeRessourcesComm_,&commRank) ; - MPI_Comm_split(freeRessourcesComm_, isPartOf, commRank, &poolComm) ; - - if (isPartOf) - { - poolRessource_ = new CPoolRessource(poolComm, poolId) ; - MPI_Comm_free(&poolComm) ; - } - else - { - MPI_Comm_free(&freeRessourcesComm_) ; - freeRessourcesComm_=poolComm ; - } - - } - - void CServersRessource::finalizeSignal(void) - { - finalizeSignal_=true ; - if (poolRessource_!=nullptr) poolRessource_->finalizeSignal() ; - } - - bool CServersRessource::isServerLeader(void) - { - int commRank ; - MPI_Comm_rank(serverComm_,&commRank) ; - if (commRank==localLeader_) return true ; - else return false ; - } - - CServersRessource::~CServersRessource() - { - delete winNotify_ ; - } -} \ No newline at end of file diff --git a/xios_2311_src/src/manager/servers_ressource.hpp b/xios_2311_src/src/manager/servers_ressource.hpp deleted file mode 100755 index e8c880d6c2682bb1d8409c8bd691d1386d191ba4..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/manager/servers_ressource.hpp +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef __SERVERS_RESSOURCE_HPP__ -#define __SERVERS_RESSOURCE_HPP__ - -#include "window_manager.hpp" -#include "mpi.hpp" -#include -#include - - - -namespace xios -{ - - class CPoolRessource ; - - class CServersRessource - { - - const int NOTIFY_NOTHING=0 ; - const int NOTIFY_CREATE_POOL=1 ; - const int NOTIFY_FINALIZE=2 ; - - public: - - CServersRessource(MPI_Comm serverComm) ; - ~CServersRessource() ; - void createPool(const string& poolId, const int size) ; - void createPool(void) ; - bool eventLoop(bool serviceOnly=false) ; - void sendNotification(int rank) ; - void notificationsDumpOut(CBufferOut& buffer) ; - void notificationsDumpIn(CBufferIn& buffer) ; - void checkNotifications(void) ; - CPoolRessource* getPoolRessource(void) { return poolRessource_; } - bool isServerLeader(void) ; - void finalize(void) ; - void finalizeSignal(void) ; - - const int localLeader_=0 ; - vector freeRessourcesRank_ ; // only for leader - MPI_Comm serverComm_ ; - MPI_Comm freeRessourcesComm_ ; - - - const size_t maxBufferSize_=1024*1024 ; - CWindowManager* winNotify_ ; - - int notifyInType_,notifyOutType_ ; - std::tuple notifyInCreatePool_,notifyOutCreatePool_ ; - CPoolRessource* poolRessource_ ; - bool finalizeSignal_ ; - - const double eventLoopLatency_=0; - double lastEventLoop_=0. ; - - friend class CWindowManager ; - } ; - -} - - - -#endif \ No newline at end of file diff --git a/xios_2311_src/src/manager/services.cpp b/xios_2311_src/src/manager/services.cpp deleted file mode 100755 index 87996fcb718fc32280bc10cfd844e64d51b43b05..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/manager/services.cpp +++ /dev/null @@ -1,268 +0,0 @@ -#include "services.hpp" -#include "services_manager.hpp" -#include "mpi.hpp" -#include "cxios.hpp" -#include "server_context.hpp" -#include "event_scheduler.hpp" -#include "timer.hpp" - -namespace xios -{ - CService::CService(MPI_Comm serviceComm, const std::string& poolId, const std::string& serviceId, const int& partitionId, - int type, int nbPartitions) : finalizeSignal_(false), eventScheduler_(nullptr), poolId_(poolId), serviceId_(serviceId), - partitionId_(partitionId), type_(type), nbPartitions_(nbPartitions), hasNotification_(false) - - - { - info(40)<<"CService::CService : new service created ; serviceId : "<lockWindow(localRank,0) ; - winNotify_->updateToWindow(localRank, this, &CService::createContextDumpOut) ; - winNotify_->unlockWindow(localRank,0) ; - MPI_Barrier(serviceComm_) ; - if (localRank==localLeader_) - { - globalLeader_=globalRank ; - MPI_Comm_rank(serviceComm_,&commSize) ; - CXios::getServicesManager()->registerService(poolId, serviceId, partitionId, type, commSize, nbPartitions, globalLeader_) ; - } - eventScheduler_ = new CEventScheduler(serviceComm_) ; - - ostringstream oss; - oss<lockWindow(rank,0) ; - winNotify_->updateFromWindow(rank, this, &CService::createContextDumpIn) ; - notifications_.push_back(std::make_tuple(poolId, serviceId, partitionId, contextId)) ; - winNotify_->updateToWindow(rank, this, &CService::createContextDumpOut) ; - winNotify_->unlockWindow(rank,0) ; - } - - - void CService::createContextDumpOut(CBufferOut& buffer) - { - buffer.realloc(maxBufferSize_) ; - - buffer << (int) (notifications_.size()); - - for(auto it=notifications_.begin();it!=notifications_.end(); ++it) - buffer << std::get<0>(*it) << std::get<1>(*it) << std::get<2>(*it) << std::get<3>(*it) ; - } - - - void CService::createContextDumpIn(CBufferIn& buffer) - { - std::string poolId ; - std::string serviceId ; - int partitionId ; - std::string contextId ; - - notifications_.clear() ; - int nbNotifications ; - buffer>>nbNotifications ; - for(int i=0;i>poolId>>serviceId>>partitionId>>contextId ; - notifications_.push_back(std::make_tuple(poolId, serviceId, partitionId, contextId)) ; - } - } - - bool CService::eventLoop(bool serviceOnly) - { - //checkCreateContextNotification() ; - CTimer::get("CService::eventLoop").resume(); - int flag ; - MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &flag, MPI_STATUS_IGNORE); - -// double time=MPI_Wtime() ; -// if (time-lastEventLoop_ > eventLoopLatency_) -// { - checkNotifications() ; -// lastEventLoop_=time ; -// } - - - eventScheduler_->checkEvent() ; - for(auto it=contexts_.begin();it!=contexts_.end();++it) - { - if (it->second->eventLoop(serviceOnly)) - { - delete it->second ; - contexts_.erase(it) ; - // destroy server_context -> to do later - break ; - } ; - } - CTimer::get("CService::eventLoop").suspend(); - if (contexts_.empty() && finalizeSignal_) return true ; - else return false ; - } - - void CService::sendNotification(int rank) - { - winNotify_->lockWindowExclusive(rank) ; - winNotify_->pushToLockedWindow(rank, this, &CService::notificationsDumpOut) ; - winNotify_->unlockWindow(rank) ; - } - - - void CService::notificationsDumpOut(CBufferOut& buffer) - { - - buffer.realloc(maxBufferSize_) ; - - if (notifyOutType_==NOTIFY_CREATE_CONTEXT) - { - auto& arg=notifyOutCreateContext_ ; - buffer << notifyOutType_ << std::get<0>(arg)<(arg) << std::get<2>(arg)<(arg) ; - } - } - - void CService::notificationsDumpIn(CBufferIn& buffer) - { - if (buffer.bufferSize() == 0) notifyInType_= NOTIFY_NOTHING ; - else - { - buffer>>notifyInType_; - if (notifyInType_==NOTIFY_CREATE_CONTEXT) - { - auto& arg=notifyInCreateContext_ ; - buffer >> std::get<0>(arg)>> std::get<1>(arg) >> std::get<2>(arg)>> std::get<3>(arg); - } - } - } - - - - - void CService::checkNotifications(void) - { - if (!hasNotification_) - { - double time=MPI_Wtime() ; - if (time-lastEventLoop_ > eventLoopLatency_) - { - int commRank ; - MPI_Comm_rank(serviceComm_, &commRank) ; - winNotify_->lockWindowExclusive(commRank) ; - winNotify_->popFromLockedWindow(commRank, this, &CService::notificationsDumpIn) ; - winNotify_->unlockWindow(commRank) ; - - if (notifyInType_!= NOTIFY_NOTHING) - { - hasNotification_=true ; - std::hash hashString ; - size_t hashId = hashString(name_) ; - size_t currentTimeLine=0 ; - info(40)<<"CService::checkNotifications(void) : receive notification => event scheduler"<registerEvent(currentTimeLine,hashId); - } - lastEventLoop_=time ; - } - } - - if (hasNotification_) - { - std::hash hashString ; - size_t hashId = hashString(name_) ; - size_t currentTimeLine=0 ; - info(40)<<"CService::checkNotifications(void) : receive notification => event scheduler : eventIsReceived ?"<queryEvent(currentTimeLine,hashId)) - { - eventScheduler_->popEvent() ; - info(40)<<"CService::checkNotifications(void) : receive notification => event scheduler : RECEIVED"<lockWindow(commRank,0) ; - winNotify_->updateFromWindow(commRank, this, &CService::createContextDumpIn) ; - - if (!notifications_.empty()) - { - auto info = notifications_.front() ; - createNewContext(get<0>(info), get<1>(info), get<2>(info), get<3>(info)) ; - notifications_.pop_front() ; - winNotify_->updateToWindow(commRank, this, &CService::createContextDumpOut) ; - } - winNotify_->unlockWindow(commRank,0) ; - } - - void CService::createContext(void) - { - info(40)<<"CService::createContext(void) : receive createContext notification"<(arg) ; - string serviceId = get<1>(arg) ; - int partitionId = get<2>(arg) ; - string contextId = get<3>(arg) ; - contexts_[contextId] = new CServerContext(this, serviceComm_, poolId, serviceId, partitionId, contextId) ; - } - - //to remove, not used anymore - void CService::createNewContext(const std::string& poolId, const std::string& serviceId, const int& partitionId, const std::string& contextId) - { - contexts_[contextId] = new CServerContext(this, serviceComm_, poolId, serviceId, partitionId, contextId) ; - } - - void CService::finalizeSignal(void) - { - finalizeSignal_=true ; - for(auto it=contexts_.begin();it!=contexts_.end();++it) it->second->finalizeSignal() ; - } - - CEventScheduler* CService::getEventScheduler(void) - { - return eventScheduler_ ; - } -} diff --git a/xios_2311_src/src/manager/services.hpp b/xios_2311_src/src/manager/services.hpp deleted file mode 100755 index 27e54de9998189fe6052b94199617a803014a3fe..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/manager/services.hpp +++ /dev/null @@ -1,84 +0,0 @@ -#ifndef __SERVICE_HPP__ -#define __SERVICE_HPP__ - -#include "xios_spl.hpp" -#include "mpi.hpp" -#include "services_manager.hpp" -#include "event_scheduler.hpp" - -namespace xios -{ - - class CServerContext ; - - class CService - { - public: - - const int NOTIFY_NOTHING=0 ; - const int NOTIFY_CREATE_CONTEXT=1 ; - - CService(MPI_Comm serviceComm, const std::string& poolId, const std::string& serviceId, const int& partitionId, - int type, int nbPartitions) ; - ~CService() ; - - bool eventLoop(bool serviceOnly=false) ; - void createContext(const std::string& poolId, const std::string& serviceId, const int& partitionId, const std::string& contextId) ; - void checkCreateContextNotification(void) ; - void createContextNotify(int rank, const std::string& poolId, const std::string& serviceId, const int& partitionId, const std::string& contextId) ; - void createContextDumpOut(CBufferOut& buffer) ; - void createContextDumpIn(CBufferIn& buffer) ; - void createNewContext(const std::string& poolId, const std::string& serviceId, const int& partitionId, const std::string& contextId) ; - CServerContext* getServerContext(const std::string& contextId) { return contexts_[contextId]; } - void finalizeSignal(void) ; - CEventScheduler* getEventScheduler(void) ; - - std::string getPoolId(void) {return poolId_;} - std::string getServiceId(void) {return serviceId_;} - int getPartitionId(void) {return partitionId_;} - int getType(void) {return type_;} - int getNbPartitions(void) {return nbPartitions_;} - - private: - void sendNotification(int rank) ; - void notificationsDumpOut(CBufferOut& buffer) ; - void notificationsDumpIn(CBufferIn& buffer) ; - void checkNotifications(void) ; - void createContext(void) ; - - MPI_Comm serviceComm_ ; - MPI_Comm globalComm_ ; - - const size_t maxBufferSize_=1024*1024 ; - const int localLeader_=0 ; - int globalLeader_ ; - CWindowManager* winNotify_ ; - - std::string name_ ; - - std::list> notifications_; - - bool hasNotification_ ; - int notifyInType_,notifyOutType_ ; - std::tuple notifyInCreateContext_, notifyOutCreateContext_ ; - - std::map contexts_ ; - bool finalizeSignal_ ; - CEventScheduler* eventScheduler_ ; - - std::string poolId_ ; - std::string serviceId_ ; - int partitionId_ ; - int type_ ; - int nbPartitions_ ; - - const double eventLoopLatency_=0; - double lastEventLoop_=0. ; - - }; - -} - - - -#endif \ No newline at end of file diff --git a/xios_2311_src/src/manager/services_manager.cpp b/xios_2311_src/src/manager/services_manager.cpp deleted file mode 100755 index 88dbc6fbe404a83cb459b4c0285596e339252f29..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/manager/services_manager.cpp +++ /dev/null @@ -1,266 +0,0 @@ -#include "daemons_manager.hpp" -#include "services_manager.hpp" -#include "ressources_manager.hpp" -#include "cxios.hpp" -#include "pool_ressource.hpp" -#include "type.hpp" -#include "server.hpp" -#include "servers_ressource.hpp" -#include "timer.hpp" - -namespace xios -{ - - - - CServicesManager::CServicesManager(bool isXiosServer) - { - - int commRank ; - xiosComm_ = CXios::getXiosComm() ; - MPI_Comm_rank(xiosComm_, &commRank) ; - - - // The global manager leader will be the process of rank 0 - // By "xiosComm" communicator construction - // - if servers exits it will be the root process of the servers communicator - // - otherwise the root process of the first model - - managerGlobalLeader_ = 0 ; - - MPI_Comm_rank(xiosComm_, &commRank) ; - winNotify_ = new CWindowManager(xiosComm_, maxBufferSize_) ; - winNotify_->lockWindow(commRank,0) ; - winNotify_->updateToWindow(commRank, this, &CServicesManager::notificationsDumpOut) ; - winNotify_->unlockWindow(commRank,0) ; - - winServices_ = new CWindowManager(xiosComm_, maxBufferSize_) ; - winServices_->lockWindow(commRank,0) ; - winServices_->updateToWindow(commRank, this, &CServicesManager::servicesDumpOut) ; - winServices_->unlockWindow(commRank,0) ; - - MPI_Barrier(xiosComm_) ; - } - - CServicesManager::~CServicesManager() - { - delete winNotify_ ; - delete winServices_ ; - } - - bool CServicesManager::createServices(const std::string& poolId, const std::string& serviceId, - int type, int size, int nbPartitions, bool wait) - { - - int leader ; - int poolSize ; - - info(40)<<"CServicesManager : waiting for pool info : "<getPoolInfo(poolId, poolSize, leader) ; - if (wait) - { - while (!ok) - { - CXios::getDaemonsManager()->eventLoop() ; - ok=CXios::getRessourcesManager()->getPoolInfo(poolId, poolSize, leader) ; - } - } - - if (ok) - { - info(40)<<"CServicesManager : create service notification to leader "<lockWindow(rank,0) ; - winNotify_->updateFromWindow(rank, this, &CServicesManager::notificationsDumpIn) ; - notifications_.push_back(std::make_tuple(serviceId,type,size,nbPartitions)) ; - winNotify_->updateToWindow(rank, this, &CServicesManager::notificationsDumpOut) ; - winNotify_->unlockWindow(rank,0) ; - } - - - void CServicesManager::checkCreateServicesNotification(void) - { - int commRank ; - MPI_Comm_rank(xiosComm_,&commRank) ; - winNotify_->lockWindow(commRank,0) ; - winNotify_->updateFromWindow(commRank, this, &CServicesManager::notificationsDumpIn) ; - - if (!notifications_.empty()) - { - auto info = notifications_.front() ; - xios::info(40)<<"CServicesManager : receive create service notification : "<(info)<getPoolRessource()->createService(get<0>(info), get<1>(info), get<2>(info), get<3>(info)) ; - notifications_.pop_front() ; - winNotify_->updateToWindow(commRank, this, &CServicesManager::notificationsDumpOut) ; - } - winNotify_->unlockWindow(commRank,0) ; - - } - - void CServicesManager::eventLoop(void) - { - CTimer::get("CServicesManager::eventLoop").resume(); - int flag ; - MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &flag, MPI_STATUS_IGNORE); - double time=MPI_Wtime() ; - if (time-lastEventLoop_ > eventLoopLatency_) - { - checkCreateServicesNotification() ; - lastEventLoop_=time ; - } - CTimer::get("CServicesManager::eventLoop").suspend(); - } - - - void CServicesManager::notificationsDumpOut(CBufferOut& buffer) - { - - buffer.realloc(maxBufferSize_) ; - - buffer<<(int)notifications_.size(); - - for(auto it=notifications_.begin();it!=notifications_.end(); ++it) - buffer << std::get<0>(*it) << static_cast(std::get<1>(*it))<< std::get<2>(*it) << std::get<3>(*it) ; - } - - void CServicesManager::notificationsDumpIn(CBufferIn& buffer) - { - std::string id ; - int type ; - int size; - int nbPartitions ; - - notifications_.clear() ; - int nbNotifications ; - buffer>>nbNotifications ; - for(int i=0;i>id>>type>>size>>nbPartitions ; - notifications_.push_back(std::make_tuple(id,type,size,nbPartitions)) ; - } - } - - - void CServicesManager::servicesDumpOut(CBufferOut& buffer) - { - - buffer.realloc(maxBufferSize_) ; - - buffer<<(int)services_.size(); - - for(auto it=services_.begin();it!=services_.end(); ++it) - { - auto key = it->first ; - auto val = it->second ; - buffer << std::get<0>(key) << std::get<1>(key) << std::get<2>(key) - << static_cast(std::get<0>(val)) << std::get<1>(val) << std::get<2>(val) << std::get<3>(val) ; - } - } - - void CServicesManager::servicesDumpIn(CBufferIn& buffer) - { - std::string poolId, serviceId ; - int partitionId ; - int type ; - int size; - int nbPartitions ; - int leader ; - - services_.clear() ; - int nbServices ; - buffer>>nbServices ; - for(int i=0;i>poolId>>serviceId>>partitionId>>type>>size>>nbPartitions>>leader ; - services_[std::tuple(poolId,serviceId,partitionId)]=std::make_tuple(type,size,nbPartitions,leader) ; - } - } - - void CServicesManager::registerService(const std::string& poolId, const std::string& serviceId, const int& partitionId, int type, - int size, int nbPartitions, int leader) - { - - info(40)<<"CServicesManager : registering service, poolId : "<lockWindowExclusive(managerGlobalLeader_) ; - winServices_->updateFromLockedWindow(managerGlobalLeader_, this, &CServicesManager::servicesDumpIn) ; - winServices_->flushWindow(managerGlobalLeader_) ; - services_[std::tuple(poolId,serviceId,partitionId)]=std::make_tuple(type,size,nbPartitions,leader) ; - winServices_->updateToLockedWindow(managerGlobalLeader_, this, &CServicesManager::servicesDumpOut) ; - winServices_->unlockWindow(managerGlobalLeader_) ; - -/* - winServices_->lockWindow(managerGlobalLeader_,0) ; - winServices_->updateFromWindow(managerGlobalLeader_, this, &CServicesManager::servicesDumpIn) ; - services_[std::tuple(poolId,serviceId,partitionId)]=std::make_tuple(type,size,nbPartitions,leader) ; - winServices_->updateToWindow(managerGlobalLeader_, this, &CServicesManager::servicesDumpOut) ; - winServices_->unlockWindow(managerGlobalLeader_,0) ;*/ - } - - bool CServicesManager::getServiceInfo(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& type, - int& size, int& nbPartitions, int& leader) - { - - winServices_->lockWindowShared(managerGlobalLeader_) ; - winServices_->updateFromLockedWindow(managerGlobalLeader_, this, &CServicesManager::servicesDumpIn) ; - winServices_->unlockWindow(managerGlobalLeader_) ; -/* - winServices_->lockWindow(managerGlobalLeader_,0) ; - winServices_->updateFromWindow(managerGlobalLeader_, this, &CServicesManager::servicesDumpIn) ; - winServices_->unlockWindow(managerGlobalLeader_,0) ;*/ - - auto it=services_.find(std::tuple(poolId,serviceId,partitionId)) ; - if ( it == services_.end()) return false ; - else - { - type= std::get<0>(it->second); - size= std::get<1>(it->second); - nbPartitions = std::get<2>(it->second); - leader = std::get<3>(it->second); - return true ; - } - } - - bool CServicesManager::getServiceLeader(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& leader) - { - int type; - int size ; - int nbPartitions; - return getServiceInfo(poolId, serviceId, partitionId, type, size, nbPartitions, leader) ; - } - - bool CServicesManager::getServiceType(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& type) - { - int size ; - int nbPartitions; - int leader; - return getServiceInfo(poolId, serviceId, partitionId, type, size, nbPartitions, leader) ; - } - - bool CServicesManager::getServiceNbPartitions(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& nbPartitions) - { - int size ; - int type; - int leader; - return getServiceInfo(poolId, serviceId, partitionId, type, size, nbPartitions, leader) ; - } - - bool CServicesManager::hasService(const std::string& poolId, const std::string& serviceId, const int& partitionId) - { - winServices_->lockWindow(managerGlobalLeader_,0) ; - winServices_->updateFromWindow(managerGlobalLeader_, this, &CServicesManager::servicesDumpIn) ; - winServices_->unlockWindow(managerGlobalLeader_,0) ; - auto it=services_.find(std::tuple(poolId, serviceId, partitionId)) ; - if ( it == services_.end()) return false ; - else return true ; - } - -} \ No newline at end of file diff --git a/xios_2311_src/src/manager/services_manager.hpp b/xios_2311_src/src/manager/services_manager.hpp deleted file mode 100755 index 218f8553c8d6a054cbc8ec30280b2d9a73221668..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/manager/services_manager.hpp +++ /dev/null @@ -1,73 +0,0 @@ -#ifndef __SERVICES_MANAGER_HPP__ -#define __SERVICES_MANAGER_HPP__ - -#include "xios_spl.hpp" -#include "mpi.hpp" -#include "buffer_in.hpp" -#include "buffer_out.hpp" - -#include -#include -#include "window_manager.hpp" - - - -namespace xios -{ - class CServicesManager - { - - public: - static const int CLIENT=0 ; - static const int GATHERER=1 ; - static const int IO_SERVER=2 ; - static const int OUT_SERVER=3 ; - - public: - - CServicesManager(bool isXiosServer) ; - ~CServicesManager() ; - - bool createServices(const std::string& poolId, const std::string& serviceId, int type, int size, int nbPartition, bool wait=true) ; - void createServicesNotify(int rank, const string& serviceId, int type, int size, int nbPartitions) ; - void checkCreateServicesNotification(void) ; - void eventLoop(void) ; - void notificationsDumpOut(CBufferOut& buffer) ; - void notificationsDumpIn(CBufferIn& buffer) ; - - void registerService(const std::string& poolId, const std::string& serviceId, const int& partitionId, int type, int size, int nbPartitions, int leader) ; - bool getServiceInfo(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& type, int& size, int& nbPartition, int& leader) ; - bool getServiceLeader(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& leader) ; - bool getServiceType(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& type) ; - bool getServiceNbPartitions(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& nbPartition) ; - bool hasService(const std::string& poolId, const std::string& serviceId, const int& partitionId) ; - void servicesDumpOut(CBufferOut& buffer) ; - void servicesDumpIn(CBufferIn& buffer) ; - - - private : - - CWindowManager* winServices_ ; - CWindowManager* winNotify_ ; - const size_t maxBufferSize_=1024*1024 ; - - MPI_Comm xiosComm_ ; - - std::list > notifications_; - - std::map, std::tuple > services_ ; - - int managerGlobalLeader_ ; - - const double eventLoopLatency_=0; - double lastEventLoop_=0. ; - - friend class CWindowManager ; - } ; - - -} - - - -#endif \ No newline at end of file diff --git a/xios_2311_src/src/manager/window_manager.cpp b/xios_2311_src/src/manager/window_manager.cpp deleted file mode 100755 index 66cbb8731c67440283289d6fd4f9567b7bf75b55..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/manager/window_manager.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "window_manager.hpp" -#include "mpi.hpp" - - - -namespace xios -{ - - -} - diff --git a/xios_2311_src/src/manager/window_manager.hpp b/xios_2311_src/src/manager/window_manager.hpp deleted file mode 100755 index a97f421e6f7b9e73ee3e4ee8a77a68dfa5a55c26..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/manager/window_manager.hpp +++ /dev/null @@ -1,376 +0,0 @@ -#ifndef __WINDOW_MANAGER_HPP__ -#define __WINDOW_MANAGER_HPP__ - -#include -#include "mpi.hpp" -#include "buffer_in.hpp" -#include "buffer_out.hpp" -#include "message.hpp" - -namespace xios -{ - - - class CWindowManager - { - - private : - const MPI_Aint OFFSET_LOCK=0 ; - const int SIZE_LOCK=sizeof(int) ; - const MPI_Aint OFFSET_BUFFER_SIZE=OFFSET_LOCK+SIZE_LOCK ; - const int SIZE_BUFFER_SIZE=sizeof(size_t) ; - const MPI_Aint OFFSET_BUFFER=OFFSET_BUFFER_SIZE+SIZE_BUFFER_SIZE ; - const int WINDOWS_LOCKED=-1 ; - - MPI_Win window_ ; - void * winBuffer_ ; - map lastTimeLock_ ; - const double latency_=0e-2 ; - - public : - - CWindowManager(MPI_Comm winComm, size_t bufferSize) - { - const MPI_Aint windowSize=bufferSize+OFFSET_BUFFER ; - MPI_Win_allocate(windowSize, 1, MPI_INFO_NULL, winComm, &winBuffer_, &window_) ; - int lock=0 ; - size_t size=0 ; - int commRank ; - MPI_Comm_rank(winComm, &commRank) ; - MPI_Win_lock(MPI_LOCK_EXCLUSIVE, commRank, 0, window_) ; - MPI_Put(&lock, SIZE_LOCK, MPI_CHAR, commRank, OFFSET_LOCK, SIZE_LOCK, MPI_CHAR, window_) ; - MPI_Put(&size, SIZE_BUFFER_SIZE, MPI_CHAR, commRank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; - MPI_Win_unlock(commRank, window_) ; - MPI_Barrier(winComm) ; - } - - void lockWindow(int rank, int state ) - { - int lock=state ; - double time ; - auto it=lastTimeLock_.find(rank) ; - if (it == lastTimeLock_.end()) - { - lastTimeLock_[rank] = 0. ; - it=lastTimeLock_.find(rank) ; - } - double& lastTime = it->second ; - - do - { - time=MPI_Wtime() ; - while(time-lastTime < latency_) time=MPI_Wtime() ; - int flag ; - MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &flag, MPI_STATUS_IGNORE); - MPI_Win_lock(MPI_LOCK_EXCLUSIVE, rank, 0, window_) ; - MPI_Compare_and_swap(&WINDOWS_LOCKED, &state, &lock, MPI_INT, rank, OFFSET_LOCK, window_) ; - MPI_Win_unlock(rank, window_) ; - lastTime=MPI_Wtime() ; - } while (lock!=state) ; - - - } - - void lockWindowExclusive(int rank, int state ) - { - int lock=state ; - double time ; - auto it=lastTimeLock_.find(rank) ; - if (it == lastTimeLock_.end()) - { - lastTimeLock_[rank] = 0. ; - it=lastTimeLock_.find(rank) ; - } - double& lastTime = it->second ; - - do - { - time=MPI_Wtime() ; - while(time-lastTime < latency_) time=MPI_Wtime() ; - int flag ; - MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &flag, MPI_STATUS_IGNORE); - MPI_Win_lock(MPI_LOCK_EXCLUSIVE, rank, 0, window_) ; - MPI_Compare_and_swap(&WINDOWS_LOCKED, &state, &lock, MPI_INT, rank, OFFSET_LOCK, window_) ; - MPI_Win_unlock(rank, window_) ; - lastTime=MPI_Wtime() ; - } while (lock!=state) ; - } - - void lockWindowExclusive(int rank) - { - MPI_Win_lock(MPI_LOCK_EXCLUSIVE, rank, 0, window_) ; - } - - void lockWindowShared(int rank) - { - MPI_Win_lock(MPI_LOCK_SHARED, rank, 0, window_) ; - } - - void unlockWindow(int rank) - { - MPI_Win_unlock(rank, window_) ; - } - - void flushWindow(int rank) - { - MPI_Win_flush(rank, window_) ; - } - - void unlockWindow(int rank, int state ) - { - int lock ; - MPI_Win_lock(MPI_LOCK_EXCLUSIVE, rank, 0, window_) ; - MPI_Compare_and_swap(&state, &WINDOWS_LOCKED, &lock, MPI_INT, rank, OFFSET_LOCK, window_) ; - MPI_Win_unlock(rank, window_) ; - } - - template< class T > - void updateToWindow(int rank, T* object, void (T::*dumpOut)(CBufferOut&) ) - { - CBufferOut buffer ; - (object->*dumpOut)(buffer) ; - size_t size=buffer.count() ; - MPI_Win_lock(MPI_LOCK_EXCLUSIVE, rank, 0, window_) ; - MPI_Put(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; - MPI_Put(buffer.start(), size, MPI_CHAR, rank,OFFSET_BUFFER, size, MPI_CHAR, window_) ; - MPI_Win_unlock(rank, window_) ; - } - - template< class T > - void updateToExclusiveWindow(int rank, T* object, void (T::*dumpOut)(CBufferOut&) ) - { - CBufferOut buffer ; - (object->*dumpOut)(buffer) ; - size_t size=buffer.count() ; - MPI_Win_lock(MPI_LOCK_EXCLUSIVE, rank, 0, window_) ; - MPI_Put(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; - MPI_Put(buffer.start(), size, MPI_CHAR, rank,OFFSET_BUFFER, size, MPI_CHAR, window_) ; - MPI_Win_unlock(rank, window_) ; - } - - template< class T > - void updateTosharedWindow(int rank, T* object, void (T::*dumpOut)(CBufferOut&) ) - { - CBufferOut buffer ; - (object->*dumpOut)(buffer) ; - size_t size=buffer.count() ; - MPI_Win_lock(MPI_LOCK_SHARED, rank, 0, window_) ; - MPI_Put(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; - MPI_Put(buffer.start(), size, MPI_CHAR, rank,OFFSET_BUFFER, size, MPI_CHAR, window_) ; - MPI_Win_unlock(rank, window_) ; - } - - template< class T > - void updateToLockedWindow(int rank, T* object, void (T::*dumpOut)(CBufferOut&) ) - { - CBufferOut buffer ; - (object->*dumpOut)(buffer) ; - size_t size=buffer.count() ; -// MPI_Win_lock(MPI_LOCK_EXCLUSIVE, rank, 0, window_) ; - MPI_Put(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; - MPI_Put(buffer.start(), size, MPI_CHAR, rank,OFFSET_BUFFER, size, MPI_CHAR, window_) ; - MPI_Win_flush(rank, window_) ; -// MPI_Win_unlock(rank, window_) ; - } - - template< typename T > - void updateFromWindow(int rank, T* object, void (T::*dumpIn)(CBufferIn&) ) - { - size_t size ; - MPI_Win_lock(MPI_LOCK_EXCLUSIVE, rank, 0, window_) ; - MPI_Get(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; - MPI_Win_flush(rank,window_) ; - CBufferIn buffer(size) ; - MPI_Get(buffer.start(), size, MPI_CHAR, rank,OFFSET_BUFFER, size, MPI_CHAR, window_) ; - MPI_Win_unlock(rank, window_) ; - (object->*dumpIn)(buffer) ; - } - - template< typename T > - void updateFromExclusiveWindow(int rank, T* object, void (T::*dumpIn)(CBufferIn&) ) - { - size_t size ; - MPI_Win_lock(MPI_LOCK_EXCLUSIVE, rank, 0, window_) ; - MPI_Get(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; - MPI_Win_flush(rank,window_) ; - CBufferIn buffer(size) ; - MPI_Get(buffer.start(), size, MPI_CHAR, rank,OFFSET_BUFFER, size, MPI_CHAR, window_) ; - MPI_Win_unlock(rank, window_) ; - (object->*dumpIn)(buffer) ; - } - - template< typename T > - void updateFromSharedWindow(int rank, T* object, void (T::*dumpIn)(CBufferIn&) ) - { - size_t size ; - MPI_Win_lock(MPI_LOCK_SHARED, rank, 0, window_) ; - MPI_Get(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; - MPI_Win_flush(rank,window_) ; - CBufferIn buffer(size) ; - MPI_Get(buffer.start(), size, MPI_CHAR, rank,OFFSET_BUFFER, size, MPI_CHAR, window_) ; - MPI_Win_unlock(rank, window_) ; - (object->*dumpIn)(buffer) ; - } - - template< typename T > - void updateFromLockedWindow(int rank, T* object, void (T::*dumpIn)(CBufferIn&) ) - { - size_t size ; -// MPI_Win_lock(MPI_LOCK_SHARED, rank, 0, window_) ; - MPI_Get(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; - MPI_Win_flush(rank,window_) ; - CBufferIn buffer(size) ; - MPI_Get(buffer.start(), size, MPI_CHAR, rank,OFFSET_BUFFER, size, MPI_CHAR, window_) ; -// MPI_Win_unlock(rank, window_) ; - MPI_Win_flush(rank, window_) ; - (object->*dumpIn)(buffer) ; - } - - - template< class T > - void pushToWindow(int rank, T* object, void (T::*dumpOut)(CBufferOut&) ) - { - size_t size ; - MPI_Win_lock(MPI_LOCK_EXCLUSIVE, rank, 0, window_) ; - MPI_Get(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; - MPI_Win_flush(rank,window_) ; - CBufferOut buffer ; - (object->*dumpOut)(buffer) ; - size_t bufferSize=buffer.count() ; - size_t newSize = size + bufferSize; - MPI_Put(&newSize, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; - MPI_Put(buffer.start(), bufferSize, MPI_CHAR, rank, OFFSET_BUFFER+size, bufferSize, MPI_CHAR, window_) ; - MPI_Win_unlock(rank, window_) ; - } - - template< class T > - void pushToExclusiveWindow(int rank, T* object, void (T::*dumpOut)(CBufferOut&) ) - { - size_t size ; - MPI_Win_lock(MPI_LOCK_EXCLUSIVE, rank, 0, window_) ; - MPI_Get(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; - MPI_Win_flush(rank,window_) ; - CBufferOut buffer ; - (object->*dumpOut)(buffer) ; - size_t bufferSize=buffer.count() ; - size_t newSize = size + bufferSize; - MPI_Put(&newSize, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; - MPI_Put(buffer.start(), bufferSize, MPI_CHAR, rank, OFFSET_BUFFER+size, bufferSize, MPI_CHAR, window_) ; - MPI_Win_unlock(rank, window_) ; - } - - template< class T > - void pushToSharedWindow(int rank, T* object, void (T::*dumpOut)(CBufferOut&) ) - { - size_t size ; - MPI_Win_lock(MPI_LOCK_SHARED, rank, 0, window_) ; - MPI_Get(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; - MPI_Win_flush(rank,window_) ; - CBufferOut buffer ; - (object->*dumpOut)(buffer) ; - size_t bufferSize=buffer.count() ; - size_t newSize = size + bufferSize; - MPI_Put(&newSize, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; - MPI_Put(buffer.start(), bufferSize, MPI_CHAR, rank, OFFSET_BUFFER+size, bufferSize, MPI_CHAR, window_) ; - MPI_Win_unlock(rank, window_) ; - } - - template< class T > - void pushToLockedWindow(int rank, T* object, void (T::*dumpOut)(CBufferOut&) ) - { - size_t size ; - MPI_Get(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; - MPI_Win_flush(rank,window_) ; - CBufferOut buffer ; - (object->*dumpOut)(buffer) ; - size_t bufferSize=buffer.count() ; - size_t newSize = size + bufferSize; - MPI_Put(&newSize, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; - MPI_Put(buffer.start(), bufferSize, MPI_CHAR, rank, OFFSET_BUFFER+size, bufferSize, MPI_CHAR, window_) ; - MPI_Win_flush(rank, window_) ; - } - - template< typename T > - void popFromWindow(int rank, T* object, void (T::*dumpIn)(CBufferIn&) ) - { - size_t size ; - MPI_Win_lock(MPI_LOCK_EXCLUSIVE, rank, 0, window_) ; - MPI_Get(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; - MPI_Win_flush(rank,window_) ; - CBufferIn buffer(size) ; - MPI_Get(buffer.start(), size, MPI_CHAR, rank,OFFSET_BUFFER, size, MPI_CHAR, window_) ; - MPI_Win_flush(rank,window_) ; - (object->*dumpIn)(buffer) ; - - size=buffer.remain() ; - MPI_Put(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; - MPI_Put(buffer.ptr(),buffer.remain(), MPI_CHAR, rank, OFFSET_BUFFER, buffer.remain(), MPI_CHAR, window_) ; - MPI_Win_unlock(rank, window_) ; - - } - - template< typename T > - void popFromExclusiveWindow(int rank, T* object, void (T::*dumpIn)(CBufferIn&) ) - { - size_t size ; - MPI_Win_lock(MPI_LOCK_EXCLUSIVE, rank, 0, window_) ; - MPI_Get(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; - MPI_Win_flush(rank,window_) ; - CBufferIn buffer(size) ; - MPI_Get(buffer.start(), size, MPI_CHAR, rank,OFFSET_BUFFER, size, MPI_CHAR, window_) ; - MPI_Win_flush(rank,window_) ; - (object->*dumpIn)(buffer) ; - - size=buffer.remain() ; - MPI_Put(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; - MPI_Put(buffer.ptr(),buffer.remain(), MPI_CHAR, rank, OFFSET_BUFFER, buffer.remain(), MPI_CHAR, window_) ; - MPI_Win_unlock(rank, window_) ; - - } - - template< typename T > - void popFromSharedWindow(int rank, T* object, void (T::*dumpIn)(CBufferIn&) ) - { - size_t size ; - MPI_Win_lock(MPI_LOCK_SHARED, rank, 0, window_) ; - MPI_Get(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; - MPI_Win_flush(rank,window_) ; - CBufferIn buffer(size) ; - MPI_Get(buffer.start(), size, MPI_CHAR, rank,OFFSET_BUFFER, size, MPI_CHAR, window_) ; - MPI_Win_flush(rank,window_) ; - (object->*dumpIn)(buffer) ; - - size=buffer.remain() ; - MPI_Put(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; - MPI_Put(buffer.ptr(),buffer.remain(), MPI_CHAR, rank, OFFSET_BUFFER, buffer.remain(), MPI_CHAR, window_) ; - MPI_Win_unlock(rank, window_) ; - - } - - template< typename T > - void popFromLockedWindow(int rank, T* object, void (T::*dumpIn)(CBufferIn&) ) - { - size_t size ; - MPI_Get(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; - MPI_Win_flush(rank,window_) ; - CBufferIn buffer(size) ; - MPI_Get(buffer.start(), size, MPI_CHAR, rank,OFFSET_BUFFER, size, MPI_CHAR, window_) ; - MPI_Win_flush(rank,window_) ; - (object->*dumpIn)(buffer) ; - - size=buffer.remain() ; - MPI_Put(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; - MPI_Put(buffer.ptr(),buffer.remain(), MPI_CHAR, rank, OFFSET_BUFFER, buffer.remain(), MPI_CHAR, window_) ; - MPI_Win_flush(rank, window_) ; - } - - ~CWindowManager() - { - MPI_Win_free(&window_) ; - } - } ; -} - - - -#endif \ No newline at end of file diff --git a/xios_2311_src/src/mem_checker.cpp b/xios_2311_src/src/mem_checker.cpp deleted file mode 100755 index 1d5f5b3355e12bdd8d12aaf1681a77e10acc5014..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/mem_checker.cpp +++ /dev/null @@ -1,105 +0,0 @@ -#include "mem_checker.hpp" -#include "mpi.hpp" -#include -#include -#include -#include -#include - -namespace xios -{ - CMemChecker CMemChecker::dummy_("") ; - std::map CMemChecker::allMemChecker_; - bool CMemChecker::enabled_=true; - bool CMemChecker::first_=true; - - CMemChecker::CMemChecker(const std::string& name) : name_(name) - { - if (first_) check() ; - reset(); - } - - void CMemChecker::check(void) - { - std::ifstream statStream("/proc/self/stat",std::ios_base::in); - enabled_ &= statStream.good() ; - first_=false ; - } - double CMemChecker::getMem(void) - { - if (first_) check() ; - if (!enabled_) return 0; - std::ifstream statStream("/proc/self/stat",std::ios_base::in); - std::string dummy ; - for(int i=1;i<=22;i++) statStream>>dummy ; - unsigned long vsize; - statStream>>vsize ; - return vsize ; - } - - void CMemChecker::suspend(void) - { - if (first_) check() ; - if (!enabled_) return ; - if (!suspended_) cumulatedMem_ += getMem() - lastMem_; - suspended_ = true; - } - - void CMemChecker::resume(void) - { - if (first_) check() ; - if (!enabled_) return ; - if (suspended_) lastMem_ = getMem(); - suspended_ = false; - } - - void CMemChecker::reset(void) - { - if (first_) check() ; - if (!enabled_) return ; - cumulatedMem_ = 0.; - suspended_ = true; - } - - double CMemChecker::getCumulatedMem(void) - { - if (first_) check() ; - if (!enabled_) return 0; - return cumulatedMem_; - } - - CMemChecker& CMemChecker::get(const std::string name) - { - if (first_) check() ; - if (!enabled_) return dummy_ ; - else - { - std::map::iterator it = allMemChecker_.find(name); - if (it == allMemChecker_.end()) - it = allMemChecker_.insert(std::make_pair(name, CMemChecker(name))).first; - return it->second; - } - } - - std::string CMemChecker::getAllCumulatedMem(void) - { - if (first_) check() ; - if (!enabled_) return std::string(" MemChecker : memory consumption report not available") ; - std::ostringstream strOut ; - const double Kb=1024 ; - const double Mb=Kb*1024 ; - const double Gb=Mb*1024 ; - const double Tb=Gb*1024 ; - for(std::map::iterator it=allMemChecker_.begin();it!=allMemChecker_.end();++it) - { - strOut<<"MemChecker : "<first<<" --> consumed memory : " ; - double mem=it->second.getCumulatedMem() ; - if (mem>=Tb) strOut<< mem / Tb<<" Tb"<=Gb) strOut<< mem / Gb<<" Gb"<=Mb) strOut<< mem / Mb<<" Mb"<=Kb) strOut<< mem / Kb<<" Kb"< -#include - -namespace xios -{ - class CMemChecker - { - public: - CMemChecker(const std::string& name); - void suspend(void); - void resume(void); - void reset(void); - double getCumulatedMem(void); - static double getMem(void); - static CMemChecker& get(std::string name); - static std::string getAllCumulatedMem(void) ; - static void disable(void) { enabled_=false ;} - static void enable(void) {enabled_=true ;} - static void release(void) {allMemChecker_.clear();} - private: - static void check(void) ; - double cumulatedMem_; - double lastMem_; - bool suspended_; - std::string name_; - - static std::map allMemChecker_; - static CMemChecker dummy_ ; - static bool first_ ; - static bool enabled_ ; - }; -} - - - -#endif diff --git a/xios_2311_src/src/memtrack.cpp b/xios_2311_src/src/memtrack.cpp index da9d37c74268b9a1f7020c5a49afd41779ee76ab..f014f4a1b977c5cfa4175500e2bcfbab6d6ea68b 100644 --- a/xios_2311_src/src/memtrack.cpp +++ b/xios_2311_src/src/memtrack.cpp @@ -44,16 +44,17 @@ OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include -#include -#include -#include -#include + #include "memtrack.hpp" -#include "log.hpp" -#include "addr2line.hpp" #undef new // IMPORTANT! - +extern "C" +{ + void addr2line(const char *file_name, char** addr, int naddr) ; +#ifdef XIOS_MEMTRACK_LIGHT + void addr2line(const char *file_name, char** addr, int naddr) {} +#endif +} /* ------------------------------------------------------------ */ /* -------------------- namespace MemTrack -------------------- */ /* ------------------------------------------------------------ */ @@ -96,9 +97,8 @@ namespace MemTrack char const *GetTypeName() const { return myTypeName; } void Stamp(char const *filename, int lineNum, char const *typeName); - void backTrace(std::ofstream& memReport, xios::CAddr2line& addr2line) ; - void backTrace(std::ofstream& memReport) ; - + void backTrace(void) ; + static void AddNode(BlockHeader *node); static void RemoveNode(BlockHeader *node); static size_t CountBlocks(); @@ -138,51 +138,20 @@ namespace MemTrack myTypeName = typeName; } - - void BlockHeader::backTrace(std::ofstream& memReport) - { - char** strings ; - strings = backtrace_symbols(stackArray, this->stackSize); - int stackSize=this->stackSize-3 ; - char* buffer ; - char* outputBuffer ; - size_t length=10 ; - outputBuffer = (char*) malloc(length) ; - int status ; - Dl_info info; + void BlockHeader::backTrace(void) + { + +// oss<<"addr2line -C -f -i -s -e ../bin/test_client.exe " ; + char *addr ; + char buffer[20] ; + addr=buffer ; for(int i=0;istackSize-3 ; - - for(int i=0;i> orderedBlocks ; + printf("\n"); + printf("=====================\n"); + printf("Current Memory Blocks\n"); + printf("=====================\n"); + printf("\n"); for (size_t i = 0; i < numBlocks; i++) { - BlockHeader *pBlockHeader = ppBlockHeader[i]; - size_t size = pBlockHeader->GetRequestedSize(); - orderedBlocks.insert({size,pBlockHeader}) ; - } - - xios::CAddr2line myaddr2line ; - size_t i = 0 ; - for(auto& it : orderedBlocks) - { - BlockHeader *pBlockHeader = it.second ; + BlockHeader *pBlockHeader = ppBlockHeader[i]; char const *typeName = pBlockHeader->GetTypeName(); size_t size = pBlockHeader->GetRequestedSize(); char const *fileName = pBlockHeader->GetFilename(); int lineNum = pBlockHeader->GetLineNum(); - if (memtrack_blocks>0 && i>memtrack_blocks) break ; - if (memtrack_size>0 && sizebackTrace(memReport, myaddr2line); - pBlockHeader->backTrace(memReport); - i++ ; + printf("*** #%-6d %5d bytes %-50s\n", i, size, typeName); + printf("... %s:%d\n", fileName, lineNum); + pBlockHeader->backTrace(); } + // Clean up. free(ppBlockHeader); } diff --git a/xios_2311_src/src/memtrack.hpp b/xios_2311_src/src/memtrack.hpp index f0cfd34913ade0d9317576f1b01c51bd75268857..0fc2504cb52900aaf2773bb407545d3fc0146195 100644 --- a/xios_2311_src/src/memtrack.hpp +++ b/xios_2311_src/src/memtrack.hpp @@ -37,7 +37,6 @@ OF THE POSSIBILITY OF SUCH DAMAGE. #include #include -#include namespace MemTrack { @@ -59,7 +58,7 @@ namespace MemTrack void *TrackMalloc(size_t size); void TrackFree(void *p); void TrackStamp(void *p, const MemStamp &stamp, char const *typeName); - void TrackDumpBlocks(std::ofstream& memReport, size_t memtrack_blocks, size_t memtrack_size); + void TrackDumpBlocks(); void TrackListMemoryUsage(); size_t getCurrentMemorySize(void) ; size_t getMaxMemorySize(void) ; diff --git a/xios_2311_src/src/mpi.hpp b/xios_2311_src/src/mpi.hpp index 73f962683011bda9f3c1cccfe076bd2dbf7a10a1..2850efaee269032bffc55680d61514deaa48b594 100644 --- a/xios_2311_src/src/mpi.hpp +++ b/xios_2311_src/src/mpi.hpp @@ -11,23 +11,5 @@ #define OMPI_SKIP_MPICXX #include -#include -#include - -#if SIZE_MAX == UCHAR_MAX - #define MPI_SIZE_T MPI_UNSIGNED_CHAR -#elif SIZE_MAX == USHRT_MAX - #define MPI_SIZE_T MPI_UNSIGNED_SHORT -#elif SIZE_MAX == UINT_MAX - #define MPI_SIZE_T MPI_UNSIGNED -#elif SIZE_MAX == ULONG_MAX - #define MPI_SIZE_T MPI_UNSIGNED_LONG -#elif SIZE_MAX == ULLONG_MAX - #define MPI_SIZE_T MPI_UNSIGNED_LONG_LONG -#else - #error "Unable to find MPI_SIZE_T equivalent type" -#endif - -#include "mpi_tools.hpp" #endif diff --git a/xios_2311_src/src/mpi_garbage_collector.hpp b/xios_2311_src/src/mpi_garbage_collector.hpp deleted file mode 100755 index 621a77043dd7e10a6e05c70c0c2c539321d841eb..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/mpi_garbage_collector.hpp +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef __MPI_GARBAGE_COLLECTOR_HPP__ -#define __MPI_GARBAGE_COLLECTOR_HPP__ -#include "mpi.hpp" -namespace xios -{ - class CMpiGarbageCollector - { - - private: - - struct SType - { - enum {COMM, WIN} type ; - MPI_Comm comm ; - MPI_Win win ; - std::string str; - } ; - std::list stack_ ; - - public: - - void registerCommunicator(MPI_Comm& comm, std::string str="") { stack_.push_back(SType{SType::COMM, comm, MPI_WIN_NULL, str}) ;} - void registerWindow(MPI_Win& win, std::string str="") { stack_.push_back(SType{SType::WIN, MPI_COMM_NULL, win, str}) ;} - void release(void) - { - for( auto& it : stack_) - if (it.type==SType::COMM) MPI_Comm_free(&it.comm); - else if (it.type==SType::WIN) MPI_Win_free(&it.win); - } - } ; - -} - -#endif \ No newline at end of file diff --git a/xios_2311_src/src/mpi_tag.hpp b/xios_2311_src/src/mpi_tag.hpp index 4b9e7ab1ea7ca2fb4e33a88f109d85750a0a00d0..3f5586a42cd53ae879e8555cc8a48378c382b5c0 100644 --- a/xios_2311_src/src/mpi_tag.hpp +++ b/xios_2311_src/src/mpi_tag.hpp @@ -43,6 +43,7 @@ /* Tag for mpi communication to send and receive info of DOMAIN in domain interpolation*/ #define MPI_DOMAIN_INTERPOLATION_WEIGHT 9 - +/* Tag for mpi communication to send and receive info of DOMAIN in domain interpolation*/ +#define MPI_DOMAIN_INTERPOLATION_SOURCE_RANK 10 #endif diff --git a/xios_2311_src/src/mpi_tools.cpp b/xios_2311_src/src/mpi_tools.cpp deleted file mode 100755 index 1daeac7536c35acfcf445b9684a47063587aa5da..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/mpi_tools.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include "mpi.hpp" -#include "mpi_tools.hpp" - - -#include - -namespace xios -{ - int MPI_Bcast_string(std::string& str, int root, MPI_Comm comm) - { - int commRank ; - int ret ; - MPI_Comm_rank(comm,&commRank) ; - int strSize ; - if (commRank==root) strSize=str.size() ; - MPI_Bcast(&strSize,1,MPI_INT,root,comm) ; - - if (commRank==root) ret=MPI_Bcast((char*)str.data(), strSize, MPI_CHAR, root, comm) ; - else - { - char* tmp=new char[strSize] ; - ret=MPI_Bcast(tmp, strSize, MPI_CHAR, root, comm) ; - str=std::string(tmp,strSize) ; - delete [] tmp ; - } - return ret ; - } - - template<> - MPI_Datatype MPI_GetType(void) { return MPI_CHAR ;} - - template<> - MPI_Datatype MPI_GetType(void) { return MPI_SHORT ;} - - template<> - MPI_Datatype MPI_GetType(void) { return MPI_INT ;} - - template<> - MPI_Datatype MPI_GetType(void) { return MPI_SIZE_T ;} - - template<> - MPI_Datatype MPI_GetType(void) { return MPI_FLOAT ;} - - template<> - MPI_Datatype MPI_GetType(void) { return MPI_DOUBLE ;} - - template<> - MPI_Datatype MPI_GetType(void) { return MPI_LONG_DOUBLE ;} - -} diff --git a/xios_2311_src/src/mpi_tools.hpp b/xios_2311_src/src/mpi_tools.hpp deleted file mode 100755 index c2b414d13327f89d4aec4cbff267007318e43215..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/mpi_tools.hpp +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef __XIOS_MPI_TOOLS_HPP__ -#define __XIOS_MPI_TOOLS_HPP__ - -#include - -namespace xios -{ - - int MPI_Bcast_string(std::string& str, int root, MPI_Comm comm) ; - - template - MPI_Datatype MPI_GetType(void) ; - - template<> - MPI_Datatype MPI_GetType(void); - - template<> - MPI_Datatype MPI_GetType(void); - - template<> - MPI_Datatype MPI_GetType(void); - - template<> - MPI_Datatype MPI_GetType(void); - - template<> - MPI_Datatype MPI_GetType(void); - - template<> - MPI_Datatype MPI_GetType(void); - - template<> - MPI_Datatype MPI_GetType(void); - - -} -#endif diff --git a/xios_2311_src/src/node/axis.cpp b/xios_2311_src/src/node/axis.cpp index 4f068d9919fd490cfa2a8b90d8c2519551905ba9..4d1625f62d72aebe13643a5d4238715bfd4aea6d 100755 --- a/xios_2311_src/src/node/axis.cpp +++ b/xios_2311_src/src/node/axis.cpp @@ -13,28 +13,31 @@ #include "client_server_mapping_distributed.hpp" #include "distribution_client.hpp" -#include -#include - namespace xios { /// ////////////////////// Definitions ////////////////////// /// CAxis::CAxis(void) : CObjectTemplate() - , CAxisAttributes(), isChecked(false), relFiles() + , CAxisAttributes(), isChecked(false), relFiles(), areClientAttributesChecked_(false) + , isClientAfterTransformationChecked(false) , hasBounds(false), isCompressible_(false) + , numberWrittenIndexes_(), totalNumberWrittenIndexes_(), offsetWrittenIndexes_() , transformationMap_(), hasValue(false), hasLabel(false) - , clients() + , computedWrittenIndex_(false) + , clients() { } CAxis::CAxis(const StdString & id) : CObjectTemplate(id) - , CAxisAttributes(), isChecked(false), relFiles() + , CAxisAttributes(), isChecked(false), relFiles(), areClientAttributesChecked_(false) + , isClientAfterTransformationChecked(false) , hasBounds(false), isCompressible_(false) + , numberWrittenIndexes_(), totalNumberWrittenIndexes_(), offsetWrittenIndexes_() , transformationMap_(), hasValue(false), hasLabel(false) - , clients() + , computedWrittenIndex_(false) + , clients() { } @@ -55,16 +58,11 @@ namespace xios { m["extract_domain"] = TRANS_EXTRACT_DOMAIN_TO_AXIS; m["temporal_splitting"] = TRANS_TEMPORAL_SPLITTING; m["duplicate_scalar"] = TRANS_DUPLICATE_SCALAR_TO_AXIS; - return true; + + return true ; + } CATCH - - void CAxis::releaseStaticAllocation(void) - { - transformationMapList_.clear() ; - CTransformation::unregisterAllTransformations() ; - CGridTransformationFactory::unregisterAllTransformations() ; - } ///--------------------------------------------------------------- @@ -96,27 +94,20 @@ namespace xios { (!this->n.isEmpty() && (this->n != this->n_glo)); // A condition to make sure that if there is only one client, axis // should be considered to be distributed. This should be a temporary solution - distributed |= (1 == CContext::getCurrent()->intraCommSize_); + distributed |= (1 == CContext::getCurrent()->client->clientSize); return distributed; } CATCH /*! - * Compute if the axis can be ouput in a compressed way. - * In this case the workflow view on server side must be the same - * than the full view for all context rank. The result is stored on - * internal isCompressible_ attribute. + * Test whether the data defined on the axis can be outputted in a compressed way. + * + * \return true if and only if a mask was defined for this axis */ - void CAxis::computeIsCompressible(void) + bool CAxis::isCompressible(void) const TRY { - // mesh is compressible contains some masked or indexed value, ie if full view is different of workflow view. - // But now assume that the size of the 2 view must be equal for everybody. True on server side - int isSameView = getLocalView(CElementView::FULL)->getSize() == getLocalView(CElementView::WORKFLOW)->getSize(); - MPI_Allreduce(MPI_IN_PLACE, &isSameView, 1, MPI_INT, MPI_LAND, CContext::getCurrent()->getIntraComm()) ; - if (isSameView) isCompressible_ = false ; - else isCompressible_ = true ; - isCompressibleComputed_=true ; + return isCompressible_; } CATCH @@ -134,7 +125,57 @@ namespace xios { } CATCH_DUMP_ATTR - //---------------------------------------------------------------- + //---------------------------------------------------------------- + + /*! + Returns the number of indexes written by each server. + \return the number of indexes written by each server + */ + int CAxis::getNumberWrittenIndexes(MPI_Comm writtenCom) + TRY + { + int writtenSize; + MPI_Comm_size(writtenCom, &writtenSize); + return numberWrittenIndexes_[writtenSize]; + } + CATCH_DUMP_ATTR + + /*! + Returns the total number of indexes written by the servers. + \return the total number of indexes written by the servers + */ + int CAxis::getTotalNumberWrittenIndexes(MPI_Comm writtenCom) + TRY + { + int writtenSize; + MPI_Comm_size(writtenCom, &writtenSize); + return totalNumberWrittenIndexes_[writtenSize]; + } + CATCH_DUMP_ATTR + + /*! + Returns the offset of indexes written by each server. + \return the offset of indexes written by each server + */ + int CAxis::getOffsetWrittenIndexes(MPI_Comm writtenCom) + TRY + { + int writtenSize; + MPI_Comm_size(writtenCom, &writtenSize); + return offsetWrittenIndexes_[writtenSize]; + } + CATCH_DUMP_ATTR + + CArray& CAxis::getCompressedIndexToWriteOnServer(MPI_Comm writtenCom) + TRY + { + int writtenSize; + MPI_Comm_size(writtenCom, &writtenSize); + return compressedIndexToWriteOnServer[writtenSize]; + } + CATCH_DUMP_ATTR + + //---------------------------------------------------------------- /*! * Compute the minimum buffer size required to send the attributes to the server(s). @@ -227,135 +268,19 @@ namespace xios { } CATCH - CAxis* CAxis::get(const string& id, bool noError) - { - const regex r("::"); - smatch m; - if (regex_search(id, m, r)) - { - if (m.size()!=1) ERROR("CAxis* CAxis::get(string& id)", <<" id = "< bad format id, separator :: append more than one time"); - string fieldId=m.prefix() ; - if (fieldId.empty()) ERROR("CAxis* CAxis::get(string& id)", <<" id = "< bad format id, field name is empty"); - string suffix=m.suffix() ; - if (!CField::has(fieldId)) - if (noError) return nullptr ; - else ERROR("CAxis* CAxis::get(string& id, bool noError)", <<" id = "< field Id : < "< doesn't exist"); - CField* field=CField::get(fieldId) ; - return field->getAssociatedAxis(suffix, noError) ; - } - { - if (noError) if(!CObjectFactory::HasObject(id)) return nullptr ; - return CObjectFactory::GetObject(id).get(); - } - } - - bool CAxis::has(const string& id) - { - if (CAxis::get(id,true)==nullptr) return false ; - else return true ; - } - - CField* CAxis::getFieldFromId(const string& id) - { - const regex r("::"); - smatch m; - if (regex_search(id, m, r)) - { - if (m.size()!=1) ERROR("CField* CAxis::getFieldFromId(const string& id)", <<" id = "< bad format id, separator :: append more than one time"); - string fieldId=m.prefix() ; - if (fieldId.empty()) ERROR("CField* CAxis::getFieldFromId(const string& id)", <<" id = "< bad format id, field name is empty"); - string suffix=m.suffix() ; - CField* field=CField::get(fieldId) ; - return field ; - } - else return nullptr; - } - /*! Check common attributes of an axis. This check should be done in the very beginning of work flow */ - void CAxis::checkAttributes(void) - { - if (checkAttributes_done_) return ; - checkGeometricAttributes(true) ; - initializeLocalElement() ; - addFullView() ; - addWorkflowView() ; - addModelView() ; - - checkAttributes_done_ = true ; - } - - void CAxis::resetGeometricAttributes(void) - { - n_glo.reset(); - index.reset(); - n.reset(); - begin.reset(); - mask.reset(); - data_index.reset(); - data_n.reset(); - data_begin.reset(); - value.reset(); - bounds.reset(); - label.reset() ; - } - - void CAxis::setGeometricAttributes(const CAxis& axisSrc) - { - resetGeometricAttributes() ; - n_glo=axisSrc.n_glo; - if (!axisSrc.index.isEmpty()) - { - index.resize(axisSrc.index.shape()) ; - index=axisSrc.index; - } - - n=axisSrc.n; - begin=axisSrc.begin; - if (!axisSrc.mask.isEmpty()) - { - mask.resize(axisSrc.mask.shape()) ; - mask=axisSrc.mask; - } - if (!axisSrc.data_index.isEmpty()) - { - data_index.resize(axisSrc.data_index.shape()) ; - data_index=axisSrc.data_index; - } - data_n=axisSrc.data_n; - data_begin=axisSrc.data_begin; - if (!axisSrc.value.isEmpty()) - { - value.resize(axisSrc.value.shape()) ; - value=axisSrc.value; - } - - if (!axisSrc.bounds.isEmpty()) - { - bounds.resize(axisSrc.bounds.shape()) ; - bounds=axisSrc.bounds; - } - if (!axisSrc.label.isEmpty()) - { - label.resize(axisSrc.label.shape()) ; - label=axisSrc.label; - } - - } - - bool CAxis::checkGeometricAttributes(bool generateError) TRY { CContext* context=CContext::getCurrent(); if (this->n_glo.isEmpty()) - if (generateError) ERROR("CAxis::checkAttributes(void)", - << "[ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] " - << "The axis is wrongly defined, attribute 'n_glo' must be specified") - else return false ; + ERROR("CAxis::checkAttributes(void)", + << "[ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] " + << "The axis is wrongly defined, attribute 'n_glo' must be specified"); StdSize size = this->n_glo.getValue(); if (!this->index.isEmpty()) @@ -371,22 +296,18 @@ namespace xios { if (!this->begin.isEmpty()) { if (begin < 0 || begin > size - 1) - if (generateError) ERROR("CAxis::checkAttributes(void)", - << "[ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] " - << "The axis is wrongly defined, attribute 'begin' (" - << begin.getValue() << ") must be non-negative and smaller than size-1 (" << size - 1 << ").") - else return false ; + ERROR("CAxis::checkAttributes(void)", + << "[ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] " + << "The axis is wrongly defined, attribute 'begin' (" << begin.getValue() << ") must be non-negative and smaller than size-1 (" << size - 1 << ")."); } else this->begin.setValue(0); if (!this->n.isEmpty()) { if (n < 0 || n > size) - if (generateError) ERROR("CAxis::checkAttributes(void)", - << "[ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] " - << "The axis is wrongly defined, attribute 'n' (" << n.getValue() << ") must be non-negative and smaller than size (" - << size << ").") - else return false ; + ERROR("CAxis::checkAttributes(void)", + << "[ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] " + << "The axis is wrongly defined, attribute 'n' (" << n.getValue() << ") must be non-negative and smaller than size (" << size << ")."); } else this->n.setValue(size); @@ -398,30 +319,34 @@ namespace xios { if (!this->value.isEmpty()) { - StdSize true_size = value.numElements(); - if (this->n.getValue() != true_size) - if (generateError) ERROR("CAxis::checkAttributes(void)", - << "[ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] " - << "The axis is wrongly defined, attribute 'value' has a different size (" << true_size - << ") than the one defined by the \'size\' attribute (" << n.getValue() << ").") - else return false ; + // Avoid this check at writing because it fails in case of a hole + if (context->hasClient) + { + StdSize true_size = value.numElements(); + if (this->n.getValue() != true_size) + ERROR("CAxis::checkAttributes(void)", + << "[ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] " + << "The axis is wrongly defined, attribute 'value' has a different size (" << true_size + << ") than the one defined by the \'size\' attribute (" << n.getValue() << ")."); + } this->hasValue = true; } - if (!this->checkBounds(generateError)) return false; - if (!this->checkMask(generateError)) return false; - if (!this->checkData(generateError)) return false; - if (!this->checkLabel(generateError)) return false; - - return true ; + this->checkBounds(); + + if (context->hasClient) + { + this->checkMask(); + this->checkData(); + this->checkLabel(); + } } CATCH_DUMP_ATTR - /*! Check the validity of data, fill in values if any, and apply mask. */ - bool CAxis::checkData(bool generateError) + void CAxis::checkData() TRY { if (data_begin.isEmpty()) data_begin.setValue(0); @@ -432,10 +357,9 @@ namespace xios { } else if (data_n.getValue() < 0) { - if (generateError) ERROR("CAxis::checkData(void)", - << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " - << "The data size should be strictly positive ('data_n' = " << data_n.getValue() << ").") - else return false ; + ERROR("CAxis::checkData(void)", + << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " + << "The data size should be strictly positive ('data_n' = " << data_n.getValue() << ")."); } if (data_index.isEmpty()) @@ -458,38 +382,40 @@ namespace xios { { if (data_index.numElements() != data_n) { - if (generateError) ERROR("CAxis::checkData(void)", - << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " - << "The size of data_index = "<< data_index.numElements() << "is not equal to the data size data_n = " - << data_n.getValue() << ").") - else return false ; + ERROR("CAxis::checkData(void)", + << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " + << "The size of data_index = "<< data_index.numElements() << "is not equal to the data size data_n = " << data_n.getValue() << ")."); } for (int i = 0; i < data_n; ++i) { - if (data_index(i) >= 0 && data_index(i)& globalDim, int orderPositionInGrid, const string& fieldId, int posInGrid) + /*! + Check attributes on client side (This name is still adequate???) + */ + void CAxis::checkAttributesOnClient() + TRY { - if (sendAxisToCouplerOut_done_.count(client)!=0) return ; - else sendAxisToCouplerOut_done_.insert(client) ; - - string axisId="_axis["+std::to_string(posInGrid)+"]_of_"+fieldId ; + if (this->areClientAttributesChecked_) return; - } + CContext* context=CContext::getCurrent(); + if (context->hasClient && !context->hasServer) this->checkAttributes(); - string CAxis::getCouplingAlias(const string& fieldId, int posInGrid) - { - return "_axis["+std::to_string(posInGrid)+"]_of_"+fieldId ; - } + this->areClientAttributesChecked_ = true; + } + CATCH_DUMP_ATTR + + /* + The (spatial) transformation sometimes can change attributes of an axis (e.g zoom can change mask or generate can change whole attributes) + Therefore, we should recheck them. + */ + void CAxis::checkAttributesOnClientAfterTransformation(const std::vector& globalDim, int orderPositionInGrid, + CServerDistributionDescription::ServerDistributionType distType) + TRY + { + CContext* context=CContext::getCurrent() ; + + if (this->isClientAfterTransformationChecked) return; + if (context->hasClient) + { + if (orderPositionInGrid == CServerDistributionDescription::defaultDistributedDimension(globalDim.size(), distType)) + computeConnectedClients(globalDim, orderPositionInGrid, distType); + else if (index.numElements() != n_glo) computeConnectedClients(globalDim, orderPositionInGrid, CServerDistributionDescription::ROOT_DISTRIBUTION); + } + + this->isClientAfterTransformationChecked = true; + } + CATCH_DUMP_ATTR + + /* + Send all checked attributes to server? (We dont have notion of server any more so client==server) + \param [in] globalDim global dimension of grid containing this axis + \param [in] orderPositionInGrid the relative order of this axis in the grid (e.g grid composed of domain+axis -> orderPositionInGrid is 2) + \param [in] distType distribution type of the server. For now, we only have band distribution. + + */ + void CAxis::sendCheckedAttributes(const std::vector& globalDim, int orderPositionInGrid, + CServerDistributionDescription::ServerDistributionType distType) + TRY + { + if (!this->areClientAttributesChecked_) checkAttributesOnClient(); + if (!this->isClientAfterTransformationChecked) checkAttributesOnClientAfterTransformation(globalDim, orderPositionInGrid, distType); + CContext* context = CContext::getCurrent(); + + if (this->isChecked) return; + if (context->hasClient) sendAttributes(globalDim, orderPositionInGrid, distType); + + this->isChecked = true; + } + CATCH_DUMP_ATTR - void CAxis::makeAliasForCoupling(const string& fieldId, int posInGrid) + /*! + Send attributes from one client to other clients + \param[in] globalDim global dimension of grid which contains this axis + \param[in] order + */ + void CAxis::sendAttributes(const std::vector& globalDim, int orderPositionInGrid, + CServerDistributionDescription::ServerDistributionType distType) + TRY { - const string axisId = getCouplingAlias(fieldId,posInGrid) ; - this->createAlias(axisId) ; + sendDistributionAttribute(globalDim, orderPositionInGrid, distType); + + // if (index.numElements() == n_glo.getValue()) + if ((orderPositionInGrid == CServerDistributionDescription::defaultDistributedDimension(globalDim.size(), distType)) + || (index.numElements() != n_glo)) + { + sendDistributedAttributes(); + } + else + { + sendNonDistributedAttributes(); + } } + CATCH_DUMP_ATTR - - /*! - Compare two axis objects. - They are equal if only if they have identical attributes as well as their values. - Moreover, they must have the same transformations. - \param [in] axis Compared axis - \return result of the comparison + /* + Compute the connection between group of clients (or clients/servers). + (E.g: Suppose we have 2 group of clients in two model: A (client role) connect to B (server role), + this function calculate number of clients B connect to one client of A) + \param [in] globalDim global dimension of grid containing this axis + \param [in] orderPositionInGrid the relative order of this axis in the grid (e.g grid composed of domain+axis -> orderPositionInGrid is 2) + \param [in] distType distribution type of the server. For now, we only have band distribution. */ - bool CAxis::isEqual(CAxis* obj) + void CAxis::computeConnectedClients(const std::vector& globalDim, int orderPositionInGrid, + CServerDistributionDescription::ServerDistributionType distType) TRY { - vector excludedAttr; - excludedAttr.push_back("axis_ref"); + CContext* context = CContext::getCurrent(); - bool objEqual = SuperClass::isEqual(obj, excludedAttr); - if (!objEqual) return objEqual; + int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 1) : 1; - TransMapTypes thisTrans = this->getAllTransformations(); - TransMapTypes objTrans = obj->getAllTransformations(); + connectedServerRank_.clear(); + nbSenders.clear(); - TransMapTypes::const_iterator it, itb, ite; - std::vector thisTransType, objTransType; - for (it = thisTrans.begin(); it != thisTrans.end(); ++it) - thisTransType.push_back(it->first); - for (it = objTrans.begin(); it != objTrans.end(); ++it) - objTransType.push_back(it->first); + for (int p = 0; p < nbSrvPools; ++p) + { + CContextClient* client = (0 != context->clientPrimServer.size()) ? context->clientPrimServer[p] : context->client; + int nbServer = client->serverSize; + int range, clientSize = client->clientSize; + int rank = client->clientRank; - if (thisTransType.size() != objTransType.size()) return false; - for (int idx = 0; idx < thisTransType.size(); ++idx) - objEqual &= (thisTransType[idx] == objTransType[idx]); + if (connectedServerRank_.find(nbServer) == connectedServerRank_.end()) + { + size_t ni = this->n.getValue(); + size_t ibegin = this->begin.getValue(); + size_t nbIndex = index.numElements(); - return objEqual; + // First of all, we should compute the mapping of the global index and local index of the current client + if (globalLocalIndexMap_.empty()) + { + for (size_t idx = 0; idx < nbIndex; ++idx) + { + globalLocalIndexMap_[index(idx)] = idx; + } + } + + // Calculate the compressed index if any +// std::set writtenInd; +// if (isCompressible_) +// { +// for (int idx = 0; idx < data_index.numElements(); ++idx) +// { +// int ind = CDistributionClient::getAxisIndex(data_index(idx), data_begin, ni); +// +// if (ind >= 0 && ind < ni && mask(ind)) +// { +// ind += ibegin; +// writtenInd.insert(ind); +// } +// } +// } + + // Compute the global index of the current client (process) hold + std::vector nGlobAxis(1); + nGlobAxis[0] = n_glo.getValue(); + + size_t globalSizeIndex = 1, indexBegin, indexEnd; + for (int i = 0; i < nGlobAxis.size(); ++i) globalSizeIndex *= nGlobAxis[i]; + indexBegin = 0; + if (globalSizeIndex <= clientSize) + { + indexBegin = rank%globalSizeIndex; + indexEnd = indexBegin; + } + else + { + for (int i = 0; i < clientSize; ++i) + { + range = globalSizeIndex / clientSize; + if (i < (globalSizeIndex%clientSize)) ++range; + if (i == client->clientRank) break; + indexBegin += range; + } + indexEnd = indexBegin + range - 1; + } + + CArray globalIndex(index.numElements()); + for (size_t idx = 0; idx < globalIndex.numElements(); ++idx) + globalIndex(idx) = index(idx); + + // Describe the distribution of server side + + CServerDistributionDescription serverDescription(nGlobAxis, nbServer, distType); + + std::vector serverZeroIndex; + serverZeroIndex = serverDescription.computeServerGlobalIndexInRange(std::make_pair(indexBegin, indexEnd), 0); + + std::list serverZeroIndexLeader; + std::list serverZeroIndexNotLeader; + CContextClient::computeLeader(client->clientRank, client->clientSize, serverZeroIndex.size(), serverZeroIndexLeader, serverZeroIndexNotLeader); + for (std::list::iterator it = serverZeroIndexLeader.begin(); it != serverZeroIndexLeader.end(); ++it) + *it = serverZeroIndex[*it]; + + // Find out the connection between client and server side + CClientServerMapping* clientServerMap = new CClientServerMappingDistributed(serverDescription.getGlobalIndexRange(), client->intraComm); + clientServerMap->computeServerIndexMapping(globalIndex, nbServer); + CClientServerMapping::GlobalIndexMap& globalIndexAxisOnServer = clientServerMap->getGlobalIndexOnServer(); + + indSrv_[nbServer].swap(globalIndexAxisOnServer); + + if (distType==CServerDistributionDescription::ROOT_DISTRIBUTION) + { + for(int i=1; i >(i,indSrv_[nbServer][0]) ) ; + serverZeroIndexLeader.clear() ; + } + + CClientServerMapping::GlobalIndexMap::const_iterator it = indSrv_[nbServer].begin(), + ite = indSrv_[nbServer].end(); + + for (it = indSrv_[nbServer].begin(); it != ite; ++it) connectedServerRank_[nbServer].push_back(it->first); + + for (std::list::const_iterator it = serverZeroIndexLeader.begin(); it != serverZeroIndexLeader.end(); ++it) + connectedServerRank_[nbServer].push_back(*it); + + // Even if a client has no index, it must connect to at least one server and + // send an "empty" data to this server + if (connectedServerRank_[nbServer].empty()) + connectedServerRank_[nbServer].push_back(client->clientRank % client->serverSize); + + nbSenders[nbServer] = CClientServerMapping::computeConnectedClients(client->serverSize, client->clientSize, client->intraComm, connectedServerRank_[nbServer]); + + delete clientServerMap; + } + } } CATCH_DUMP_ATTR /* - Add transformation into axis. This function only servers for Fortran interface - \param [in] transType transformation type - \param [in] id identifier of the transformation object + Compute the index of data to write into file + (Different from the previous version, this version of XIOS allows data be written into file (classical role), + or transfered to another clients) */ - CTransformation* CAxis::addTransformation(ETranformationType transType, const StdString& id) + void CAxis::computeWrittenIndex() + TRY + { + if (computedWrittenIndex_) return; + computedWrittenIndex_ = true; + + CContext* context=CContext::getCurrent(); + CContextServer* server = context->server; + + // We describe the distribution of client (server) on which data are written + std::vector nBegin(1), nSize(1), nBeginGlobal(1), nGlob(1); + nBegin[0] = begin; + nSize[0] = n; + nBeginGlobal[0] = 0; + nGlob[0] = n_glo; + CDistributionServer srvDist(server->intraCommSize, nBegin, nSize, nBeginGlobal, nGlob); + const CArray& writtenGlobalIndex = srvDist.getGlobalIndex(); + + // Because all written data are local on a client, + // we need to compute the local index on the server from its corresponding global index + size_t nbWritten = 0, indGlo; + std::unordered_map::const_iterator itb = globalLocalIndexMap_.begin(), + ite = globalLocalIndexMap_.end(), it; + CArray::const_iterator itSrvb = writtenGlobalIndex.begin(), + itSrve = writtenGlobalIndex.end(), itSrv; + + localIndexToWriteOnServer.resize(writtenGlobalIndex.numElements()); + nbWritten = 0; + for (itSrv = itSrvb; itSrv != itSrve; ++itSrv) + { + indGlo = *itSrv; + if (ite != globalLocalIndexMap_.find(indGlo)) + { + localIndexToWriteOnServer(nbWritten) = globalLocalIndexMap_[indGlo]; + } + else + { + localIndexToWriteOnServer(nbWritten) = -1; + } + ++nbWritten; + } + + } + CATCH_DUMP_ATTR + + void CAxis::computeWrittenCompressedIndex(MPI_Comm writtenComm) TRY { - transformationMap_.push_back(std::make_pair(transType, CTransformation::createTransformation(transType,id))); - return transformationMap_.back().second; + int writtenCommSize; + MPI_Comm_size(writtenComm, &writtenCommSize); + if (compressedIndexToWriteOnServer.find(writtenCommSize) != compressedIndexToWriteOnServer.end()) + return; + + if (isCompressible()) + { + size_t nbWritten = 0, indGlo; + CContext* context=CContext::getCurrent(); + CContextServer* server = context->server; + + // We describe the distribution of client (server) on which data are written + std::vector nBegin(1), nSize(1), nBeginGlobal(1), nGlob(1); + nBegin[0] = 0; + nSize[0] = n; + nBeginGlobal[0] = 0; + nGlob[0] = n_glo; + CDistributionServer srvDist(server->intraCommSize, nBegin, nSize, nBeginGlobal, nGlob); + const CArray& writtenGlobalIndex = srvDist.getGlobalIndex(); + std::unordered_map::const_iterator itb = globalLocalIndexMap_.begin(), + ite = globalLocalIndexMap_.end(), it; + + CArray::const_iterator itSrvb = writtenGlobalIndex.begin(), + itSrve = writtenGlobalIndex.end(), itSrv; + std::unordered_map localGlobalIndexMap; + for (itSrv = itSrvb; itSrv != itSrve; ++itSrv) + { + indGlo = *itSrv; + if (ite != globalLocalIndexMap_.find(indGlo)) + { + localGlobalIndexMap[localIndexToWriteOnServer(nbWritten)] = indGlo; + ++nbWritten; + } + } +// +// nbWritten = 0; +// for (int idx = 0; idx < data_index.numElements(); ++idx) +// { +// if (localGlobalIndexMap.end() != localGlobalIndexMap.find(data_index(idx))) +// { +// ++nbWritten; +// } +// } +// +// compressedIndexToWriteOnServer[writtenCommSize].resize(nbWritten); +// nbWritten = 0; +// for (int idx = 0; idx < data_index.numElements(); ++idx) +// { +// if (localGlobalIndexMap.end() != localGlobalIndexMap.find(data_index(idx))) +// { +// compressedIndexToWriteOnServer[writtenCommSize](nbWritten) = localGlobalIndexMap[data_index(idx)]; +// ++nbWritten; +// } +// } + + nbWritten = 0; + for (int idx = 0; idx < data_index.numElements(); ++idx) + { + if (localGlobalIndexMap.end() != localGlobalIndexMap.find(data_index(idx))) + { + ++nbWritten; + } + } + + compressedIndexToWriteOnServer[writtenCommSize].resize(nbWritten); + nbWritten = 0; + for (int idx = 0; idx < data_index.numElements(); ++idx) + { + if (localGlobalIndexMap.end() != localGlobalIndexMap.find(data_index(idx))) + { + compressedIndexToWriteOnServer[writtenCommSize](nbWritten) = localGlobalIndexMap[data_index(idx)]; + ++nbWritten; + } + } + + numberWrittenIndexes_[writtenCommSize] = nbWritten; + + bool distributed_glo, distributed=isDistributed() ; + MPI_Allreduce(&distributed,&distributed_glo, 1, MPI_INT, MPI_LOR, writtenComm) ; + if (distributed_glo) + { + + MPI_Allreduce(&numberWrittenIndexes_[writtenCommSize], &totalNumberWrittenIndexes_[writtenCommSize], 1, MPI_INT, MPI_SUM, writtenComm); + MPI_Scan(&numberWrittenIndexes_[writtenCommSize], &offsetWrittenIndexes_[writtenCommSize], 1, MPI_INT, MPI_SUM, writtenComm); + offsetWrittenIndexes_[writtenCommSize] -= numberWrittenIndexes_[writtenCommSize]; + } + else + totalNumberWrittenIndexes_[writtenCommSize] = numberWrittenIndexes_[writtenCommSize]; + } } CATCH_DUMP_ATTR - /* - Check whether an axis has (spatial) transformation + /*! + Send distribution information from a group of client (client role) to another group of client (server role) + The distribution of a group of client (server role) is imposed by the group of client (client role) + \param [in] globalDim global dimension of grid containing this axis + \param [in] orderPositionInGrid the relative order of this axis in the grid (e.g grid composed of domain+axis -> orderPositionInGrid is 2) + \param [in] distType distribution type of the server. For now, we only have band distribution. */ - bool CAxis::hasTransformation() + void CAxis::sendDistributionAttribute(const std::vector& globalDim, int orderPositionInGrid, + CServerDistributionDescription::ServerDistributionType distType) TRY { - return (!transformationMap_.empty()); + std::list::iterator it; + for (it=clients.begin(); it!=clients.end(); ++it) + { + CContextClient* client = *it; + int nbServer = client->serverSize; + + CServerDistributionDescription serverDescription(globalDim, nbServer); + serverDescription.computeServerDistribution(); + + std::vector > serverIndexBegin = serverDescription.getServerIndexBegin(); + std::vector > serverDimensionSizes = serverDescription.getServerDimensionSizes(); + + CEventClient event(getType(),EVENT_ID_DISTRIBUTION_ATTRIBUTE); + if (client->isServerLeader()) + { + std::list msgs; + + const std::list& ranks = client->getRanksServerLeader(); + for (std::list::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) + { + // Use const int to ensure CMessage holds a copy of the value instead of just a reference + const int begin = serverIndexBegin[*itRank][orderPositionInGrid]; + const int ni = serverDimensionSizes[*itRank][orderPositionInGrid]; + + msgs.push_back(CMessage()); + CMessage& msg = msgs.back(); + msg << this->getId(); + msg << ni << begin; + msg << isCompressible_; + + event.push(*itRank,1,msg); + } + client->sendEvent(event); + } + else client->sendEvent(event); + } } CATCH_DUMP_ATTR /* - Set transformation - \param [in] axisTrans transformation to set + Receive distribution attribute from another client + \param [in] event event containing data of these attributes */ - void CAxis::setTransformations(const TransMapTypes& axisTrans) + void CAxis::recvDistributionAttribute(CEventServer& event) TRY { - transformationMap_ = axisTrans; + CBufferIn* buffer = event.subEvents.begin()->buffer; + string axisId; + *buffer >> axisId; + get(axisId)->recvDistributionAttribute(*buffer); } - CATCH_DUMP_ATTR + CATCH /* - Return all transformation held by the axis - \return transformation the axis has + Receive distribution attribute from another client + \param [in] buffer buffer containing data of these attributes */ - CAxis::TransMapTypes CAxis::getAllTransformations(void) + void CAxis::recvDistributionAttribute(CBufferIn& buffer) TRY { - return transformationMap_; + int ni_srv, begin_srv; + buffer >> ni_srv >> begin_srv; + buffer >> isCompressible_; + + // Set up new local size of axis on the receiving clients + n.setValue(ni_srv); + begin.setValue(begin_srv); } CATCH_DUMP_ATTR /* - Duplicate transformation of another axis - \param [in] src axis whose transformations are copied + Send attributes of axis from a group of client to other group of clients/servers + on supposing that these attributes are not distributed among the sending group + In the future, if new attributes are added, they should also be processed in this function */ - void CAxis::duplicateTransformation(CAxis* src) + void CAxis::sendNonDistributedAttributes() TRY { - if (src->hasTransformation()) - { - this->setTransformations(src->getAllTransformations()); + std::list::iterator it; + for (it=clients.begin(); it!=clients.end(); ++it) + { + CContextClient* client = *it; + + CEventClient event(getType(), EVENT_ID_NON_DISTRIBUTED_ATTRIBUTES); + size_t nbIndex = index.numElements(); + size_t nbDataIndex = 0; + + for (int idx = 0; idx < data_index.numElements(); ++idx) + { + int ind = data_index(idx); + if (ind >= 0 && ind < nbIndex) ++nbDataIndex; + } + + CArray dataIndex(nbDataIndex); + nbDataIndex = 0; + for (int idx = 0; idx < data_index.numElements(); ++idx) + { + int ind = data_index(idx); + if (ind >= 0 && ind < nbIndex) + { + dataIndex(nbDataIndex) = ind; + ++nbDataIndex; + } + } + + if (client->isServerLeader()) + { + std::list msgs; + + const std::list& ranks = client->getRanksServerLeader(); + for (std::list::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) + { + msgs.push_back(CMessage()); + CMessage& msg = msgs.back(); + msg << this->getId(); + msg << index.getValue() << dataIndex << mask.getValue(); + msg << hasValue; + if (hasValue) msg << value.getValue(); + msg << hasBounds; + if (hasBounds) msg << bounds.getValue(); + msg << hasLabel; + if (hasLabel) msg << label.getValue(); + + event.push(*itRank, 1, msg); + } + client->sendEvent(event); + } + else client->sendEvent(event); } } CATCH_DUMP_ATTR - /*! - * Go through the hierarchy to find the axis from which the transformations must be inherited - */ - void CAxis::solveInheritanceTransformation_old() + /* + Receive the non-distributed attributes from another group of clients + \param [in] event event containing data of these attributes + */ + void CAxis::recvNonDistributedAttributes(CEventServer& event) TRY { - if (hasTransformation() || !hasDirectAxisReference()) - return; - - CAxis* axis = this; - std::vector refAxis; - while (!axis->hasTransformation() && axis->hasDirectAxisReference()) + list::iterator it; + for (it = event.subEvents.begin(); it != event.subEvents.end(); ++it) { - refAxis.push_back(axis); - axis = axis->getDirectAxisReference(); + CBufferIn* buffer = it->buffer; + string axisId; + *buffer >> axisId; + get(axisId)->recvNonDistributedAttributes(it->rank, *buffer); } - - if (axis->hasTransformation()) - for (size_t i = 0; i < refAxis.size(); ++i) - refAxis[i]->setTransformations(axis->getAllTransformations()); } - CATCH_DUMP_ATTR + CATCH - void CAxis::solveInheritanceTransformation() + /* + Receive the non-distributed attributes from another group of clients + \param [in] rank rank of the sender + \param [in] buffer buffer containing data sent from the sender + */ + void CAxis::recvNonDistributedAttributes(int rank, CBufferIn& buffer) TRY - { - if (solveInheritanceTransformation_done_) return; - else solveInheritanceTransformation_done_=true ; + { + CArray tmp_index, tmp_data_index; + CArray tmp_mask; + CArray tmp_val; + CArray tmp_bnds; + CArray tmp_label; + + buffer >> tmp_index; + index.reference(tmp_index); + buffer >> tmp_data_index; + data_index.reference(tmp_data_index); + buffer >> tmp_mask; + mask.reference(tmp_mask); + + buffer >> hasValue; + if (hasValue) + { + buffer >> tmp_val; + value.reference(tmp_val); + } - CAxis* axis = this; - std::list refAxis; - bool out=false ; - vector excludedAttr; - excludedAttr.push_back("axis_ref"); - - refAxis.push_front(axis) ; - while (axis->hasDirectAxisReference() && !out) + buffer >> hasBounds; + if (hasBounds) { - CAxis* lastAxis=axis ; - axis = axis->getDirectAxisReference(); - axis->solveRefInheritance() ; - if (!axis->SuperClass::isEqual(lastAxis,excludedAttr)) out=true ; - refAxis.push_front(axis) ; + buffer >> tmp_bnds; + bounds.reference(tmp_bnds); } - CTransformationPaths::TPath path ; - auto& pathList = std::get<2>(path) ; - std::get<0>(path) = EElement::AXIS ; - std::get<1>(path) = refAxis.front()->getId() ; - for (auto& axis : refAxis) + buffer >> hasLabel; + if (hasLabel) { - CAxis::TransMapTypes transformations = axis->getAllTransformations(); - for(auto& transformation : transformations) pathList.push_back({transformation.second->getTransformationType(), - transformation.second->getId()}) ; + buffer >> tmp_label; + label.reference(tmp_label); } - transformationPaths_.addPath(path) ; + // Some value should be reset here + data_begin.setValue(0); + globalLocalIndexMap_.rehash(std::ceil(index.numElements()/globalLocalIndexMap_.max_load_factor())); +// for (int idx = 0; idx < index.numElements(); ++idx) globalLocalIndexMap_[idx] = index(idx); + for (int idx = 0; idx < index.numElements(); ++idx) globalLocalIndexMap_[index(idx)] = idx; } CATCH_DUMP_ATTR - bool CAxis::activateFieldWorkflow(CGarbageCollector& gc) + /* + Send axis attributes from a group of clients to another group of clients/servers + supposing that these attributes are distributed among the clients of the sending group + In future, if new attributes are added, they should also be processed in this function + */ + void CAxis::sendDistributedAttributes(void) TRY { - if (!axis_ref.isEmpty()) + int ind, idx; + std::list::iterator it; + + for (it=clients.begin(); it!=clients.end(); ++it) { - CField* field=getFieldFromId(axis_ref) ; - if (field!=nullptr) + CContextClient* client = *it; + int nbServer = client->serverSize; + + CEventClient eventData(getType(), EVENT_ID_DISTRIBUTED_ATTRIBUTES); + + list listData; + list > list_indi, list_dataInd; + list > list_val; + list > list_bounds; + list > list_label; + + // Cut off the ghost points + int nbIndex = index.numElements(); + CArray dataIndex(nbIndex); + dataIndex = -1; + for (idx = 0; idx < data_index.numElements(); ++idx) { - bool ret = field->buildWorkflowGraph(gc) ; - if (!ret) return false ; // cannot build workflow graph at this state + if (0 <= data_index(idx) && data_index(idx) < nbIndex) + dataIndex(data_index(idx)) = 1; } - else + + std::unordered_map >::const_iterator it, iteMap; + iteMap = indSrv_[nbServer].end(); + for (int k = 0; k < connectedServerRank_[nbServer].size(); ++k) { - CAxis* axis = get(axis_ref) ; - bool ret = axis->activateFieldWorkflow(gc) ; - if (!ret) return false ; // cannot build workflow graph at this state - axis_ref=axis->getId() ; // replace domain_ref by solved reference + int nbData = 0, nbDataCount = 0; + int rank = connectedServerRank_[nbServer][k]; + it = indSrv_[nbServer].find(rank); + if (iteMap != it) + nbData = it->second.size(); + + list_indi.push_back(CArray(nbData)); + list_dataInd.push_back(CArray(nbData)); + + if (hasValue) + list_val.push_back(CArray(nbData)); + + if (hasBounds) + list_bounds.push_back(CArray(2,nbData)); + + if (hasLabel) + list_label.push_back(CArray(nbData)); + + CArray& indi = list_indi.back(); + CArray& dataIndi = list_dataInd.back(); + dataIndi = -1; + + for (int n = 0; n < nbData; ++n) + { + idx = static_cast(it->second[n]); + indi(n) = idx; + + ind = globalLocalIndexMap_[idx]; + dataIndi(n) = dataIndex(ind); + + if (hasValue) + { + CArray& val = list_val.back(); + val(n) = value(ind); + } + + if (hasBounds) + { + CArray& boundsVal = list_bounds.back(); + boundsVal(0, n) = bounds(0,ind); + boundsVal(1, n) = bounds(1,ind); + } + + if (hasLabel) + { + CArray& labelVal = list_label.back(); + labelVal(n) = label(ind); + } + } + + listData.push_back(CMessage()); + listData.back() << this->getId() + << list_indi.back() << list_dataInd.back(); + + listData.back() << hasValue; + if (hasValue) + listData.back() << list_val.back(); + + listData.back() << hasBounds; + if (hasBounds) + listData.back() << list_bounds.back(); + + listData.back() << hasLabel; + if (hasLabel) + listData.back() << list_label.back(); + + eventData.push(rank, nbSenders[nbServer][rank], listData.back()); } + + client->sendEvent(eventData); } - activateFieldWorkflow_done_=true ; - return true ; } CATCH_DUMP_ATTR - - void CAxis::setContextClient(CContextClient* contextClient) + /* + Receive the distributed attributes from another group of clients + \param [in] event event containing data of these attributes + */ + void CAxis::recvDistributedAttributes(CEventServer& event) TRY { - if (clientsSet.find(contextClient)==clientsSet.end()) + string axisId; + vector ranks; + vector buffers; + + list::iterator it; + for (it = event.subEvents.begin(); it != event.subEvents.end(); ++it) { - clients.push_back(contextClient) ; - clientsSet.insert(contextClient); + ranks.push_back(it->rank); + CBufferIn* buffer = it->buffer; + *buffer >> axisId; + buffers.push_back(buffer); } + get(axisId)->recvDistributedAttributes(ranks, buffers); } - CATCH_DUMP_ATTR + CATCH - void CAxis::parse(xml::CXMLNode & node) + /* + Receive the non-distributed attributes from another group of clients + \param [in] ranks rank of the sender + \param [in] buffers buffer containing data sent from the sender + */ + void CAxis::recvDistributedAttributes(vector& ranks, vector buffers) TRY { - SuperClass::parse(node); + int nbReceived = ranks.size(), idx, ind, gloInd, locInd; + vector > vec_indi(nbReceived), vec_dataInd(nbReceived); + vector > vec_val(nbReceived); + vector > vec_bounds(nbReceived); + vector > vec_label(nbReceived); + + for (idx = 0; idx < nbReceived; ++idx) + { + CBufferIn& buffer = *buffers[idx]; + buffer >> vec_indi[idx]; + buffer >> vec_dataInd[idx]; + + buffer >> hasValue; + if (hasValue) + buffer >> vec_val[idx]; + + buffer >> hasBounds; + if (hasBounds) + buffer >> vec_bounds[idx]; + + buffer >> hasLabel; + if (hasLabel) + buffer >> vec_label[idx]; + } - if (node.goToChildElement()) + // Estimate size of index array + int nbIndexGlob = 0; + for (idx = 0; idx < nbReceived; ++idx) { - StdString nodeElementName; - do - { - StdString nodeId(""); - if (node.getAttributes().end() != node.getAttributes().find("id")) - { nodeId = node.getAttributes()["id"]; } - - nodeElementName = node.getElementName(); - std::map::const_iterator ite = transformationMapList_.end(), it; - it = transformationMapList_.find(nodeElementName); - if (ite != it) - { - transformationMap_.push_back(std::make_pair(it->second, CTransformation::createTransformation(it->second, - nodeId, - &node))); - } - else - { - ERROR("void CAxis::parse(xml::CXMLNode & node)", - << "The transformation " << nodeElementName << " has not been supported yet."); - } - } while (node.goToNextElement()) ; - node.goToParentElement(); + nbIndexGlob += vec_indi[idx].numElements(); } - } - CATCH_DUMP_ATTR - - ////////////////////////////////////////////////////////////////////////////////////// - // this part is related to distribution, element definition, views and connectors // - ////////////////////////////////////////////////////////////////////////////////////// - - void CAxis::initializeLocalElement(void) - { - // after checkAttribute index of size n - int rank = CContext::getCurrent()->getIntraCommRank() ; - - CArray ind(n) ; - for (int i=0;i(rank, n_glo, ind) ; - } - - void CAxis::addFullView(void) - { - CArray index(n) ; - for(int i=0; i addView(CElementView::FULL, index) ; - } + // Recompute global index + // Take account of the overlapped index + index.resize(nbIndexGlob); + globalLocalIndexMap_.rehash(std::ceil(index.numElements()/globalLocalIndexMap_.max_load_factor())); + nbIndexGlob = 0; + int nbIndLoc = 0; + for (idx = 0; idx < nbReceived; ++idx) + { + CArray& tmp = vec_indi[idx]; + for (ind = 0; ind < tmp.numElements(); ++ind) + { + gloInd = tmp(ind); + nbIndLoc = (gloInd % n_glo)-begin; + if (0 == globalLocalIndexMap_.count(gloInd)) + { + index(nbIndexGlob) = gloInd % n_glo; + globalLocalIndexMap_[gloInd] = nbIndexGlob; + ++nbIndexGlob; + } + } + } - void CAxis::addWorkflowView(void) - { - // mask + data are included into data_index - int nk=data_index.numElements() ; - int nMask=0 ; - for(int k=0;k=0 && data_index(k) index(nMask) ; - nMask=0 ; - for(int k=0;k=0 && data_index(k) addView(CElementView::WORKFLOW, index) ; - } + // Resize index to its real size + if (nbIndexGlob==0) index.resize(nbIndexGlob) ; + else index.resizeAndPreserve(nbIndexGlob); - void CAxis::addModelView(void) - { - // information for model view is stored in data_index - localElement_->addView(CElementView::MODEL, data_index) ; - } + int nbData = nbIndexGlob; + CArray nonCompressedData(nbData); + nonCompressedData = -1; + // Mask is incorporated into data_index and is not sent/received anymore + mask.resize(0); + if (hasValue) + value.resize(nbData); + if (hasBounds) + bounds.resize(2,nbData); + if (hasLabel) + label.resize(nbData); - void CAxis::computeModelToWorkflowConnector(void) - { - shared_ptr srcView=getLocalView(CElementView::MODEL) ; - shared_ptr dstView=getLocalView(CElementView::WORKFLOW) ; - modelToWorkflowConnector_ = make_shared(srcView, dstView); - modelToWorkflowConnector_->computeConnector() ; - } + nbData = 0; + for (idx = 0; idx < nbReceived; ++idx) + { + CArray& indi = vec_indi[idx]; + CArray& dataIndi = vec_dataInd[idx]; + int nb = indi.numElements(); + for (int n = 0; n < nb; ++n) + { + locInd = globalLocalIndexMap_[size_t(indi(n))]; + nonCompressedData(locInd) = (-1 == nonCompressedData(locInd)) ? dataIndi(n) : nonCompressedData(locInd); - void CAxis::computeRemoteElement(CContextClient* client, EDistributionType type) - { - CContext* context = CContext::getCurrent(); - map> globalIndex ; + if (hasValue) + value(locInd) = vec_val[idx](n); - if (type==EDistributionType::BANDS) // Bands distribution to send to file server - { - int nbServer = client->serverSize; - int nbClient = client->clientSize ; - int rankClient = client->clientRank ; - int size = nbServer / nbClient ; - int start ; - if (nbServer%nbClient > rankClient) - { - start = (size+1) * rankClient ; - size++ ; - } - else start = size*rankClient + nbServer%nbClient ; - - for(int i=0; i rank) + if (hasBounds) { - indStart = (indSize+1) * rank ; - indSize++ ; + bounds(0,locInd) = vec_bounds[idx](0,n); + bounds(1,locInd) = vec_bounds[idx](1,n); } - else indStart = indSize*rank + n_glo%nbServer ; - - auto& globalInd = globalIndex[rank] ; - globalInd.resize(indSize) ; - for(size_t n = 0 ; nserverSize; - size_t nglo=n_glo ; - CArray indGlo(nglo) ; - for(size_t i=0;igetRanksServerLeader()) globalIndex[rankServer].reference(indGlo.copy()); - } - remoteElement_[client] = make_shared(n_glo, globalIndex) ; - remoteElement_[client]->addFullView() ; - } - - void CAxis::distributeToServer(CContextClient* client, std::map>& globalIndexOut, std::map>& globalIndexIn, - shared_ptr &scattererConnector, const string& axisId) - { - string serverAxisId = axisId.empty() ? this->getId() : axisId ; - CContext* context = CContext::getCurrent(); - - this->sendAllAttributesToServer(client, serverAxisId) ; - - auto scatteredElement = make_shared(n_glo,globalIndexOut) ; - scatteredElement->addFullView() ; - scattererConnector = make_shared(localElement_->getView(CElementView::FULL), scatteredElement->getView(CElementView::FULL), - context->getIntraComm(), client->getRemoteSize()) ; - scattererConnector->computeConnector() ; - - // phase 0 - // send remote element to construct the full view on server, ie without hole - CEventClient event0(getType(), EVENT_ID_AXIS_DISTRIBUTION); - CMessage message0 ; - message0<sendToServer(client,event0,message0) ; - // phase 1 - // send the full view of element to construct the connector which connect distributed data coming from client to the full local view - CEventClient event1(getType(), EVENT_ID_AXIS_DISTRIBUTION); - CMessage message1 ; - message1<getView(CElementView::FULL)->getGlobalSize() ; - scattererConnector->transfer(localElement_->getView(CElementView::FULL)->getGlobalIndex(),client,event1,message1) ; - - sendDistributedAttributes(client, scattererConnector, axisId) ; - - // phase 2 send the mask : data index + mask2D + int nbCompressedData = 0; + for (idx = 0; idx < nonCompressedData.numElements(); ++idx) { - CArray maskIn(localElement_->getView(CElementView::WORKFLOW)->getSize()); - CArray maskOut ; - auto workflowToFull = make_shared(localElement_->getView(CElementView::WORKFLOW), localElement_->getView(CElementView::FULL)) ; - workflowToFull->computeConnector() ; - maskIn=true ; - workflowToFull->transfer(maskIn,maskOut,false) ; - - // prepare grid scatterer connector to send data from client to server - map> workflowGlobalIndex ; - map> maskOut2 ; - scattererConnector->transfer(maskOut, maskOut2) ; - scatteredElement->addView(CElementView::WORKFLOW, maskOut2) ; - scatteredElement->getView(CElementView::WORKFLOW)->getGlobalIndexView(workflowGlobalIndex) ; - // create new workflow view for scattered element - auto clientToServerElement = make_shared(scatteredElement->getGlobalSize(), workflowGlobalIndex) ; - clientToServerElement->addFullView() ; - CEventClient event2(getType(), EVENT_ID_AXIS_DISTRIBUTION); - CMessage message2 ; - message2<sendToServer(client, event2, message2) ; - clientToServerConnector_[client] = make_shared(localElement_->getView(CElementView::WORKFLOW), clientToServerElement->getView(CElementView::FULL), - context->getIntraComm(), client->getRemoteSize()) ; - clientToServerConnector_[client]->computeConnector() ; + if (0 <= nonCompressedData(idx)) + ++nbCompressedData; } - //////////// - // phase 3 : compute connector to receive from server - //////////// + data_index.resize(nbCompressedData); + nbCompressedData = 0; + for (idx = 0; idx < nonCompressedData.numElements(); ++idx) { - auto scatteredElement = make_shared(n_glo, globalIndexIn) ; - scatteredElement->addFullView() ; - auto scattererConnector = make_shared(localElement_->getView(CElementView::FULL), scatteredElement->getView(CElementView::FULL), - context->getIntraComm(), client->getRemoteSize()) ; - scattererConnector->computeConnector() ; - CArray maskIn(localElement_->getView(CElementView::WORKFLOW)->getSize()); - CArray maskOut ; - auto workflowToFull = make_shared(localElement_->getView(CElementView::WORKFLOW), localElement_->getView(CElementView::FULL)) ; - workflowToFull->computeConnector() ; - maskIn=true ; - workflowToFull->transfer(maskIn,maskOut,false) ; - - map> workflowGlobalIndex ; - map> maskOut2 ; - scattererConnector->transfer(maskOut, maskOut2, false) ; - scatteredElement->addView(CElementView::WORKFLOW, maskOut2) ; - scatteredElement->getView(CElementView::WORKFLOW)->getGlobalIndexView(workflowGlobalIndex) ; - auto clientToServerElement = make_shared(scatteredElement->getGlobalSize(), workflowGlobalIndex) ; - clientToServerElement->addFullView() ; - CEventClient event3(getType(), EVENT_ID_AXIS_DISTRIBUTION); - CMessage message3 ; - message3<sendToServer(client, event3, message3) ; - - clientFromServerConnector_[client] = make_shared(clientToServerElement->getView(CElementView::FULL), localElement_->getView(CElementView::WORKFLOW)); - clientFromServerConnector_[client]->computeConnector() ; + if (0 <= nonCompressedData(idx)) + { + data_index(nbCompressedData) = idx % n; + ++nbCompressedData; + } } -// clientFromServerConnector_[client] = make_shared(clientToServerElement->getView(CElementView::FULL), localElement_->getView(CElementView::WORKFLOW)); -// clientFromServerConnector_[client]->computeConnector() ; + data_begin.setValue(0); + data_n.setValue(data_index.numElements()); + } + CATCH_DUMP_ATTR + + /*! + Compare two axis objects. + They are equal if only if they have identical attributes as well as their values. + Moreover, they must have the same transformations. + \param [in] axis Compared axis + \return result of the comparison + */ + bool CAxis::isEqual(CAxis* obj) + TRY + { + vector excludedAttr; + excludedAttr.push_back("axis_ref"); + + bool objEqual = SuperClass::isEqual(obj, excludedAttr); + if (!objEqual) return objEqual; + + TransMapTypes thisTrans = this->getAllTransformations(); + TransMapTypes objTrans = obj->getAllTransformations(); + TransMapTypes::const_iterator it, itb, ite; + std::vector thisTransType, objTransType; + for (it = thisTrans.begin(); it != thisTrans.end(); ++it) + thisTransType.push_back(it->first); + for (it = objTrans.begin(); it != objTrans.end(); ++it) + objTransType.push_back(it->first); + if (thisTransType.size() != objTransType.size()) return false; + for (int idx = 0; idx < thisTransType.size(); ++idx) + objEqual &= (thisTransType[idx] == objTransType[idx]); + + return objEqual; } + CATCH_DUMP_ATTR - void CAxis::recvAxisDistribution(CEventServer& event) + /* + Add transformation into axis. This function only servers for Fortran interface + \param [in] transType transformation type + \param [in] id identifier of the transformation object + */ + CTransformation* CAxis::addTransformation(ETranformationType transType, const StdString& id) TRY { - string axisId; - int phasis ; - for (auto& subEvent : event.subEvents) (*subEvent.buffer) >> axisId >> phasis ; - get(axisId)->receivedAxisDistribution(event, phasis); + transformationMap_.push_back(std::make_pair(transType, CTransformation::createTransformation(transType,id))); + return transformationMap_.back().second; } - CATCH - + CATCH_DUMP_ATTR - void CAxis::receivedAxisDistribution(CEventServer& event, int phasis) + /* + Check whether an axis has (spatial) transformation + */ + bool CAxis::hasTransformation() TRY { - CContext* context = CContext::getCurrent(); - if (phasis==0) // receive the remote element to construct the full view - { - localElement_ = make_shared(context->getIntraCommRank(),event) ; - localElement_->addFullView() ; - // construct the local dimension and indexes - auto& globalIndex=localElement_->getGlobalIndex() ; - int nk=globalIndex.numElements() ; - int minK=n_glo,maxK=-1 ; - int nGlo=n_glo ; - int indGlo ; - for(int k=0;kmaxK) maxK=indGlo ; - } - if (maxK>=minK) { begin=minK ; n=maxK-minK+1 ; } - else {begin=0; n=0 ;} - - } - else if (phasis==1) // receive the sent view from client to construct the full distributed full view on server - { - CContext* context = CContext::getCurrent(); - shared_ptr elementFrom = make_shared(event) ; - elementFrom->addFullView() ; - gathererConnector_ = make_shared(elementFrom->getView(CElementView::FULL), localElement_->getView(CElementView::FULL)) ; - gathererConnector_->computeConnector() ; - } - else if (phasis==2) - { -// delete gathererConnector_ ; - elementFrom_ = make_shared(event) ; - elementFrom_->addFullView() ; -// gathererConnector_ = make_shared(elementFrom_->getView(CElementView::FULL), localElement_->getView(CElementView::FULL)) ; -// gathererConnector_ -> computeConnector() ; - } - else if (phasis==3) - { - elementTo_ = make_shared(event) ; - elementTo_->addFullView() ; - } + return (!transformationMap_.empty()); } - CATCH + CATCH_DUMP_ATTR - void CAxis::setServerMask(CArray& serverMask, CContextClient* client) + /* + Set transformation + \param [in] axisTrans transformation to set + */ + void CAxis::setTransformations(const TransMapTypes& axisTrans) TRY { - CContext* context = CContext::getCurrent(); - localElement_->addView(CElementView::WORKFLOW, serverMask) ; - mask.reference(serverMask.copy()) ; - - serverFromClientConnector_ = make_shared(elementFrom_->getView(CElementView::FULL), localElement_->getView(CElementView::WORKFLOW)) ; - serverFromClientConnector_->computeConnector() ; - - serverToClientConnector_ = make_shared(localElement_->getView(CElementView::WORKFLOW), elementTo_->getView(CElementView::FULL), - context->getIntraComm(), client->getRemoteSize()) ; - serverToClientConnector_->computeConnector() ; + transformationMap_ = axisTrans; } CATCH_DUMP_ATTR - void CAxis::sendDistributedAttributes(CContextClient* client, shared_ptr scattererConnector, const string& axisId) + /* + Return all transformation held by the axis + \return transformation the axis has + */ + CAxis::TransMapTypes CAxis::getAllTransformations(void) + TRY { - string serverAxisId = axisId.empty() ? this->getId() : axisId ; - CContext* context = CContext::getCurrent(); + return transformationMap_; + } + CATCH_DUMP_ATTR - if (hasValue) + /* + Duplicate transformation of another axis + \param [in] src axis whose transformations are copied + */ + void CAxis::duplicateTransformation(CAxis* src) + TRY + { + if (src->hasTransformation()) { - { // send level value - CEventClient event(getType(), EVENT_ID_SEND_DISTRIBUTED_ATTRIBUTE); - CMessage message ; - message<transfer(value, client, event,message) ; - } + this->setTransformations(src->getAllTransformations()); } + } + CATCH_DUMP_ATTR - if (hasBounds) - { - { // send bounds level value - CEventClient event(getType(), EVENT_ID_SEND_DISTRIBUTED_ATTRIBUTE); - CMessage message ; - message<transfer(2, bounds, client, event,message) ; - } - } + /*! + * Go through the hierarchy to find the axis from which the transformations must be inherited + */ + void CAxis::solveInheritanceTransformation() + TRY + { + if (hasTransformation() || !hasDirectAxisReference()) + return; - if (hasLabel) + CAxis* axis = this; + std::vector refAxis; + while (!axis->hasTransformation() && axis->hasDirectAxisReference()) { - { // send label - // need to transform array of string (no fixed size for string) into array of array of char - // to use connector to transfer - // the strings must have fixed size which the maximum lenght over the string label. - int maxSize=0 ; - for(int i=0; igetIntraComm()) ; - maxSize=maxSize+1 ; - CArray charArray(maxSize,label.numElements()) ; - for(int j=0; jtransfer(maxSize, charArray, client, event,message) ; - } + refAxis.push_back(axis); + axis = axis->getDirectAxisReference(); } + + if (axis->hasTransformation()) + for (size_t i = 0; i < refAxis.size(); ++i) + refAxis[i]->setTransformations(axis->getAllTransformations()); } + CATCH_DUMP_ATTR - void CAxis::recvDistributedAttributes(CEventServer& event) + void CAxis::setContextClient(CContextClient* contextClient) TRY { - string axisId; - string type ; - for (auto& subEvent : event.subEvents) (*subEvent.buffer) >> axisId >> type ; - get(axisId)->recvDistributedAttributes(event, type); + if (clientsSet.find(contextClient)==clientsSet.end()) + { + clients.push_back(contextClient) ; + clientsSet.insert(contextClient); + } } - CATCH + CATCH_DUMP_ATTR - void CAxis::recvDistributedAttributes(CEventServer& event, const string& type) + void CAxis::parse(xml::CXMLNode & node) TRY { - if (type=="value") - { - gathererConnector_->transfer(event, value, 0.); - } - else if (type=="bounds") - { - CArray value ; - gathererConnector_->transfer(event, 2, value, 0.); - bounds.resize(2,n) ; - if (bounds.numElements() > 0 ) bounds=CArray(value.dataFirst(),shape(2,n),neverDeleteData) ; - } - else if (type=="label") + SuperClass::parse(node); + + if (node.goToChildElement()) { - int maxSize ; - for (auto& subEvent : event.subEvents) (*subEvent.buffer) >> maxSize ; - CArray value ; - gathererConnector_->transfer(event, maxSize, value, '\0'); - CArray charArray(maxSize,n) ; - label.resize(n) ; - if (n>0) + StdString nodeElementName; + do { - charArray=CArray(value.dataFirst(),shape(maxSize,n),neverDeleteData) ; - for(int j=0;j::const_iterator ite = transformationMapList_.end(), it; + it = transformationMapList_.find(nodeElementName); + if (ite != it) + { + transformationMap_.push_back(std::make_pair(it->second, CTransformation::createTransformation(it->second, + nodeId, + &node))); + } + else { - int strSize ; - for(int i=0;i::TransformationMapTypes TransMapTypes; public: /// Constructeurs /// @@ -68,16 +61,17 @@ namespace xios explicit CAxis(const StdString & id); CAxis(const CAxis & axis); // Not implemented yet. CAxis(const CAxis * const axis); // Not implemented yet. - static void releaseStaticAllocation(void) ; // release static allocation on heap static CAxis* createAxis(); - static CAxis* get(const string& id, bool noError=false) ; // & getRelFiles(void) const; - + + int getNumberWrittenIndexes(MPI_Comm writtenCom); + int getTotalNumberWrittenIndexes(MPI_Comm writtenCom); + int getOffsetWrittenIndexes(MPI_Comm writtenCom); + CArray& getCompressedIndexToWriteOnServer(MPI_Comm writtenCom); + std::map getAttributesBufferSize(CContextClient* client, const std::vector& globalDim, int orderPositionInGrid, CServerDistributionDescription::ServerDistributionType disType = CServerDistributionDescription::BAND_DISTRIBUTION); @@ -85,26 +79,14 @@ namespace xios bool IsWritten(const StdString & filename) const; bool isWrittenCompressed(const StdString& filename) const; bool isDistributed(void) const; - - public: - /*! - \brief return if the axis can be written or not in a compressed way. - ie if there are some masked or indexed point on the domain. Valid only on server side. - \return true if domain can be writtedn in a compressed way - */ - bool isCompressible(void) { if (!isCompressibleComputed_) computeIsCompressible() ; return isCompressible_ ;} - private: - bool isCompressible_ ; /** specify if the domain can be written in a compressed way */ - bool isCompressibleComputed_=false ; /** Indicate if compressability has been computed*/ - void computeIsCompressible() ; - - public: + bool isCompressible(void) const; /// Mutateur /// void addRelFile(const StdString & filename); void addRelFileCompressed(const StdString& filename); - + /// Vérifications /// + void checkAttributes(void); /// Destructeur /// virtual ~CAxis(void); @@ -119,54 +101,23 @@ namespace xios static ENodeType GetType(void); static bool dispatchEvent(CEventServer& event); - - /// Vérifications /// - void checkAttributes(void); - bool checkAttributes_done_ = false ; - bool checkGeometricAttributes(bool generateError) ; - void setGeometricAttributes(const CAxis& axisSrc) ; - void resetGeometricAttributes(void) ; + + void checkAttributesOnClient(); + void checkAttributesOnClientAfterTransformation(const std::vector& globalDim, int orderPositionInGrid, + CServerDistributionDescription::ServerDistributionType distType = CServerDistributionDescription::BAND_DISTRIBUTION); + void sendCheckedAttributes(const std::vector& globalDim, int orderPositionInGrid, + CServerDistributionDescription::ServerDistributionType disType = CServerDistributionDescription::BAND_DISTRIBUTION); + void checkEligibilityForCompressedOutput(); size_t getGlobalWrittenSize(void) ; - ////////////////////////// - ///// transformations //// - ////////////////////////// - public: - typedef CTransformation::TransformationMapTypes TransMapTypes; - private: - static bool initializeTransformationMap(std::map& m); - static std::map transformationMapList_; - static bool dummyTransformationMapList_; - TransMapTypes transformationMap_; - - public: - CTransformation* addTransformation(ETranformationType transType, const StdString& id=""); - CTransformation* addTransformation(ETranformationType transType, CTransformation* transformation) ; - void setTransformations(const TransMapTypes&); - void duplicateTransformation(CAxis*); - TransMapTypes getAllTransformations(); - bool hasTransformation(); - void solveInheritanceTransformation_old(); // to remove later - void solveInheritanceTransformation(); - private: - bool solveInheritanceTransformation_done_= false ; - public: - bool activateFieldWorkflow(CGarbageCollector& gc) ; - private: - bool activateFieldWorkflow_done_=false ; - private: - shared_ptr transformationAlgorithm_ = nullptr ; - public: - void setTransformationAlgorithm(shared_ptr transformationAlgorithm) { transformationAlgorithm_=transformationAlgorithm ;} - shared_ptr getTransformationAlgorithm(void) { return transformationAlgorithm_ ;} - private: - CTransformationPaths transformationPaths_ ; - public: - CTransformationPaths getTransformationPaths(void) {return transformationPaths_;} - void setTransformationPaths(const CTransformationPaths& transformationPaths) { transformationPaths_=transformationPaths ;} - - //////////////////////////// + void computeWrittenIndex(); + void computeWrittenCompressedIndex(MPI_Comm); + bool hasTransformation(); + void solveInheritanceTransformation(); + TransMapTypes getAllTransformations(); + void duplicateTransformation(CAxis*); + CTransformation* addTransformation(ETranformationType transType, const StdString& id=""); bool isEqual(CAxis* axis); public: @@ -174,116 +125,59 @@ namespace xios bool hasBounds; bool hasLabel; + CArray localIndexToWriteOnServer; + private: - bool checkData(bool generateError); - bool checkMask(bool generateError); - bool checkBounds(bool generateError); - bool checkLabel(bool generateError); - - public: - void sendAxisToCouplerOut(CContextClient* client, const std::vector& globalDim, int orderPositionInGrid, const string& fieldId, int posInGrid) ; - private: - std::set sendAxisToCouplerOut_done_ ; - - public: - void makeAliasForCoupling(const string& fieldId, int posInGrid) ; - string getCouplingAlias(const string& fieldId, int posInGrid) ; + void checkData(); + void checkMask(); + void checkBounds(); + void checkLabel(); + void sendAttributes(const std::vector& globalDim, int orderPositionInGrid, + CServerDistributionDescription::ServerDistributionType distType); + void sendDistributionAttribute(const std::vector& globalDim, int orderPositionInGrid, + CServerDistributionDescription::ServerDistributionType distType); + void computeConnectedClients(const std::vector& globalDim, int orderPositionInGrid, + CServerDistributionDescription::ServerDistributionType distType); + + void sendNonDistributedAttributes(void); + void sendDistributedAttributes(void); + + static void recvNonDistributedAttributes(CEventServer& event); + static void recvDistributedAttributes(CEventServer& event); + static void recvDistributionAttribute(CEventServer& event); + void recvNonDistributedAttributes(int rank, CBufferIn& buffer); + void recvDistributedAttributes(vector& rank, vector buffers); + void recvDistributionAttribute(CBufferIn& buffer); + + void setTransformations(const TransMapTypes&); private: -/** Clients that have to send a axis. There can be multiple clients in case of secondary server, otherwise only one client. */ +/** Clients that have to send a domain. There can be multiple clients in case of secondary server, otherwise only one client. */ std::list clients; std::set clientsSet; - private: - /** define if the axis is completed or not ie all attributes have been received before in case - of grid reading from file or coupling */ - bool isCompleted_=true ; - public: - /*! - \brief Check if a axis is completed - Before make any axis processing, we must be sure that all axis informations have - been sent, for exemple when reading a grid in a file or when grid elements are sent by an - other context (coupling). So all direct reference of the axis (axis_ref) must be also completed - \return true if axis and axis reference are completed - */ - bool isCompleted(void) - { - if (hasDirectAxisReference()) if (!getDirectAxisReference()->isCompleted()) return false; - else return isCompleted_ ; - - MISSING_RETURN( "bool CAxis::isCompleted() " ); - return true; - } - void setCompleted(void) { isCompleted_=true ; } - void unsetCompleted(void) { isCompleted_=false ; } - - private: bool isChecked; + bool areClientAttributesChecked_; + bool isClientAfterTransformationChecked; std::set relFiles, relFilesCompressed; - std::map > > indSrv_; // Global index of each client sent to server + TransMapTypes transformationMap_; + //! True if and only if the data defined on the axis can be outputted in a compressed way + bool isCompressible_; + std::map > nbSenders; // Mapping of number of communicating client to a server + std::map > > indSrv_; // Global index of each client sent to server + // std::map > indWrittenSrv_; // Global written index of each client sent to server + std::unordered_map globalLocalIndexMap_; + std::vector indexesToWrite; + std::map numberWrittenIndexes_, totalNumberWrittenIndexes_, offsetWrittenIndexes_; + std::map > compressedIndexToWriteOnServer; std::map > connectedServerRank_; - - ////////////////////////////////////////////////////////////////////////////////////// - // this part is related to distribution, element definition, views and connectors // - ////////////////////////////////////////////////////////////////////////////////////// - - private: - shared_ptr localElement_ ; - void initializeLocalElement(void) ; - public: - shared_ptr getLocalElement(void) { if (localElement_==nullptr) initializeLocalElement() ; return localElement_ ; } - shared_ptr getLocalView(CElementView::type type) { return getLocalElement()->getView(type) ;} - private: - void addFullView(void) ; - void addWorkflowView(void) ; - void addModelView(void) ; - - private: - shared_ptr modelToWorkflowConnector_ ; - void computeModelToWorkflowConnector(void) ; - public: - shared_ptr getModelToWorkflowConnector(void) { if (modelToWorkflowConnector_==nullptr) computeModelToWorkflowConnector() ; return modelToWorkflowConnector_ ;} - - public: - void computeRemoteElement(CContextClient* client, EDistributionType) ; - void distributeToServer(CContextClient* client, std::map>& globalIndexOut, std::map>& globalIndexIn, - shared_ptr& scattererConnector, const string& axisId="") ; - - static void recvAxisDistribution(CEventServer& event) ; - void receivedAxisDistribution(CEventServer& event, int phasis) ; - void setServerMask(CArray& serverMask, CContextClient* client ) ; - void sendDistributedAttributes(CContextClient* client, shared_ptr scattererConnector, const string& axisId) ; - static void recvDistributedAttributes(CEventServer& event) ; - void recvDistributedAttributes(CEventServer& event, const string& type) ; - private: - map> remoteElement_ ; - public: - shared_ptr getRemoteElement(CContextClient* client) {return remoteElement_[client] ;} - private: - map> clientToServerConnector_ ; - public: - shared_ptr getClientToServerConnector(CContextClient* client) { return clientToServerConnector_[client] ;} - private: - shared_ptr gathererConnector_ ; - public: - shared_ptr getGathererConnector(void) { return gathererConnector_ ;} - private: - shared_ptr serverFromClientConnector_ ; - shared_ptr elementFrom_ ; - public: - shared_ptr getServerFromClientConnector(void) { return serverFromClientConnector_ ;} - - private: - shared_ptr serverToClientConnector_ = nullptr ; - shared_ptr elementTo_ ; - public: - shared_ptr getServerToClientConnector(void) { return serverToClientConnector_ ;} + bool computedWrittenIndex_; private: - map> clientFromServerConnector_ ; - public: - shared_ptr getClientFromServerConnector(CContextClient* client) { return clientFromServerConnector_[client] ;} + static bool initializeTransformationMap(std::map& m); + static std::map transformationMapList_; + static bool dummyTransformationMapList_; DECLARE_REF_FUNC(Axis,axis) }; // class CAxis diff --git a/xios_2311_src/src/node/calendar_wrapper.hpp b/xios_2311_src/src/node/calendar_wrapper.hpp index 02b46decc45dc6114b590d8f7e8a9ddd4d1b45c0..11a90bbc4045f7d085e54c8d08751d90e9f72ffc 100644 --- a/xios_2311_src/src/node/calendar_wrapper.hpp +++ b/xios_2311_src/src/node/calendar_wrapper.hpp @@ -81,7 +81,6 @@ namespace xios { }; // class CCalendarWrapper - typedef CCalendarWrapper CCalendarWrapperGroup; typedef CCalendarWrapper CCalendarWrapperDefinition; } // namespace xios diff --git a/xios_2311_src/src/node/compute_connectivity_domain.cpp b/xios_2311_src/src/node/compute_connectivity_domain.cpp index 5a972e74917f79f5752de24830698661426145ac..e1f449c29e163eaaa07ea18b6e1fa546762c00f4 100644 --- a/xios_2311_src/src/node/compute_connectivity_domain.cpp +++ b/xios_2311_src/src/node/compute_connectivity_domain.cpp @@ -1,5 +1,4 @@ #include "compute_connectivity_domain.hpp" -#include "domain_algorithm_compute_connectivity.hpp" #include "type.hpp" namespace xios { @@ -27,7 +26,7 @@ namespace xios { bool CComputeConnectivityDomain::_dummyRegistered = CComputeConnectivityDomain::registerTrans(); bool CComputeConnectivityDomain::registerTrans() { - return registerTransformation(TRANS_COMPUTE_CONNECTIVITY_DOMAIN, {create, getTransformation}); + return registerTransformation(TRANS_COMPUTE_CONNECTIVITY_DOMAIN, CComputeConnectivityDomain::create); } //---------------------------------------------------------------- @@ -51,18 +50,4 @@ namespace xios { if (local_neighbor.isEmpty()) local_neighbor.resize(1,1); } - shared_ptr CComputeConnectivityDomain::createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) - { - return CDomainAlgorithmComputeConnectivity::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, - elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, - elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition) ; - } } diff --git a/xios_2311_src/src/node/compute_connectivity_domain.hpp b/xios_2311_src/src/node/compute_connectivity_domain.hpp index c2f78fc46dc122fef5dc8476ed8ab17671020c1c..137eaf0ffe3949aefafeb153dd9fe4a4800075c2 100644 --- a/xios_2311_src/src/node/compute_connectivity_domain.hpp +++ b/xios_2311_src/src/node/compute_connectivity_domain.hpp @@ -19,8 +19,6 @@ namespace xios { class CComputeConnectivityDomainAttributes; class CComputeConnectivityDomain; class CDomain; - class CGenericAlgorithmTransformation ; - class CGrid; ///-------------------------------------------------------------- @@ -42,8 +40,6 @@ namespace xios { public : typedef CObjectTemplate SuperClass; typedef CComputeConnectivityDomainAttributes SuperClassAttribute; - typedef CComputeConnectivityDomain MyClass ; - typedef CTransformation SuperTransform ; public : /// Constructeurs /// @@ -59,25 +55,11 @@ namespace xios { static StdString GetName(void); static StdString GetDefName(void); static ENodeType GetType(void); - const string& getId(void) { return this->SuperClass::getId();} - ETranformationType getTransformationType(void) { return TRANS_COMPUTE_CONNECTIVITY_DOMAIN ;} - static CTransformation* getTransformation(const StdString& id) { return SuperClass::get(id);} - virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} - virtual shared_ptr createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) ; private: static bool registerTrans(); static CTransformation* create(const StdString& id, xml::CXMLNode* node); static bool _dummyRegistered; - public: - }; // class CComputeConnectivityDomain + }; // class CComputeConnectivityDomain DECLARE_GROUP(CComputeConnectivityDomain); } // namespace xios diff --git a/xios_2311_src/src/node/context.cpp b/xios_2311_src/src/node/context.cpp index 99bc5d8ff4385ed25e118292c45a37ba2d8e95ba..a33e23ca2bd301572dc76a1a078eb7ec4319f786 100644 --- a/xios_2311_src/src/node/context.cpp +++ b/xios_2311_src/src/node/context.cpp @@ -19,21 +19,8 @@ #include #include "server.hpp" #include "distribute_file_server2.hpp" -#include "services_manager.hpp" -#include "contexts_manager.hpp" -#include "cxios.hpp" -#include "client.hpp" -#include "coupler_in.hpp" -#include "coupler_out.hpp" -#include "servers_ressource.hpp" -#include "pool_ressource.hpp" -#include "services.hpp" -#include "contexts_manager.hpp" -#include -#include - -namespace xios -{ + +namespace xios { std::shared_ptr CContext::root; @@ -43,8 +30,8 @@ namespace xios : CObjectTemplate(), CContextAttributes() , calendar(), hasClient(false), hasServer(false) , isPostProcessed(false), finalized(false) - , client(nullptr), server(nullptr) - , allProcessed(false), countChildContextFinalized_(0), isProcessingEvent_(false) + , idServer_(), client(0), server(0) + , allProcessed(false), countChildCtx_(0) { /* Ne rien faire de plus */ } @@ -52,8 +39,8 @@ namespace xios : CObjectTemplate(id), CContextAttributes() , calendar(), hasClient(false), hasServer(false) , isPostProcessed(false), finalized(false) - , client(nullptr), server(nullptr) - , allProcessed(false), countChildContextFinalized_(0), isProcessingEvent_(false) + , idServer_(), client(0), server(0) + , allProcessed(false), countChildCtx_(0) { /* Ne rien faire de plus */ } CContext::~CContext(void) @@ -62,8 +49,7 @@ namespace xios delete server; for (std::vector::iterator it = clientPrimServer.begin(); it != clientPrimServer.end(); it++) delete *it; for (std::vector::iterator it = serverPrimServer.begin(); it != serverPrimServer.end(); it++) delete *it; - if (registryIn!=nullptr) delete registryIn ; - if (registryOut!=nullptr) delete registryOut ; + } //---------------------------------------------------------------- @@ -74,20 +60,6 @@ namespace xios //---------------------------------------------------------------- - void CContext::initEventScheduler(void) - { - SRegisterContextInfo contextInfo ; - CXios::getContextsManager()->getContextInfo(this->getId(), contextInfo, getIntraComm()) ; - - eventScheduler_=CXios::getPoolRessource()->getService(contextInfo.serviceId,contextInfo.partitionId)->getEventScheduler() ; - - // generate unique hash for server - auto time=chrono::system_clock::now().time_since_epoch().count() ; - std::default_random_engine rd(time); // not reproducible from a run to another - std::uniform_int_distribution dist; - hashId_=dist(rd) ; - MPI_Bcast(&hashId_,1,MPI_SIZE_T,0,getIntraComm()) ; // Bcast to all server of the context - } /*! \brief Get context group (context root) \return Context root @@ -100,16 +72,6 @@ namespace xios } CATCH - void CContext::releaseStaticAllocation(void) - TRY - { - CDomain::releaseStaticAllocation(); - CAxis::releaseStaticAllocation(); - CScalar::releaseStaticAllocation(); - if (root) root.reset() ; - } - CATCH - //---------------------------------------------------------------- /*! @@ -299,143 +261,119 @@ namespace xios } CATCH -void CContext::removeContext(const string& contextId) -{ - #define DECLARE_NODE(Name_, name_) CObjectFactory::deleteContext< C##Name_ >(contextId); - #define DECLARE_NODE_PAR(Name_, name_) CObjectFactory::deleteContext< C##Name_ >(contextId); - #include "node_type.conf" - #define DECLARE_NODE(Name_, name_) CObjectFactory::deleteContext< C##Name_##Group >(contextId); - #define DECLARE_NODE_PAR(Name_, name_) - #include "node_type.conf" - -/* - #define DECLARE_NODE(Name_, name_) CObjectFactory::dumpObjects< C##Name_##Group >(); - #define DECLARE_NODE_PAR(Name_, name_) - #include "node_type.conf" - - #define DECLARE_NODE(Name_, name_) CObjectFactory::dumpObjects< C##Name_>(); - #define DECLARE_NODE_PAR(Name_, name_) - #include "node_type.conf" -*/ -} - -void CContext::removeAllContexts(void) -{ - #define DECLARE_NODE(Name_, name_) CObjectFactory::deleteAllContexts< C##Name_ >(); - #define DECLARE_NODE_PAR(Name_, name_) CObjectFactory::deleteAllContexts< C##Name_ >(); - #include "node_type.conf" - #define DECLARE_NODE(Name_, name_) CObjectFactory::deleteAllContexts< C##Name_##Group >(); - #define DECLARE_NODE_PAR(Name_, name_) - #include "node_type.conf" -/* - #define DECLARE_NODE(Name_, name_) CObjectFactory::dumpObjects< C##Name_##Group >(); - #define DECLARE_NODE_PAR(Name_, name_) - #include "node_type.conf" - - #define DECLARE_NODE(Name_, name_) CObjectFactory::dumpObjects< C##Name_>(); - #define DECLARE_NODE_PAR(Name_, name_) - #include "node_type.conf" -*/ - CObjectFactory::deleteAllContexts() ; - CObjectFactory::deleteAllContexts() ; - CObjectFactory::clearCurrentContextId(); - CGroupFactory::clearCurrentContextId(); -} ///--------------------------------------------------------------- - - /*! - * Compute the required buffer size to send the fields data. - * \param maxEventSize [in/out] the size of the bigger event for each connected server - * \param [in] contextClient - * \param [in] bufferForWriting True if buffers are used for sending data for writing - This flag is only true for client and server-1 for communication with server-2 - */ - std::map CContext::getDataBufferSize(std::map& maxEventSize, - CContextClient* contextClient, bool bufferForWriting /*= "false"*/) + //! Initialize client side + void CContext::initClient(MPI_Comm intraComm, MPI_Comm interComm, CContext* cxtServer /*= 0*/) TRY { - std::map dataSize; - // Find all reference domain and axis of all active fields - std::vector& fileList = bufferForWriting ? this->enabledWriteModeFiles : this->enabledReadModeFiles; - size_t numEnabledFiles = fileList.size(); - for (size_t i = 0; i < numEnabledFiles; ++i) + hasClient = true; + MPI_Comm intraCommServer, interCommServer; + + + if (CServer::serverLevel != 1) + // initClient is called by client { - CFile* file = fileList[i]; - if (file->getContextClient() == contextClient) + client = new CContextClient(this, intraComm, interComm, cxtServer); + if (cxtServer) // Attached mode { - std::vector enabledFields = file->getEnabledFields(); - size_t numEnabledFields = enabledFields.size(); - for (size_t j = 0; j < numEnabledFields; ++j) - { - // const std::vector > mapSize = enabledFields[j]->getGridDataBufferSize(contextClient); - const std::map mapSize = enabledFields[j]->getGridDataBufferSize(contextClient,bufferForWriting); - std::map::const_iterator it = mapSize.begin(), itE = mapSize.end(); - for (; it != itE; ++it) - { - // If dataSize[it->first] does not exist, it will be zero-initialized - // so we can use it safely without checking for its existance - if (CXios::isOptPerformance) - dataSize[it->first] += it->second; - else if (dataSize[it->first] < it->second) - dataSize[it->first] = it->second; - - if (maxEventSize[it->first] < it->second) - maxEventSize[it->first] = it->second; - } - } + intraCommServer = intraComm; + interCommServer = interComm; + } + else + { + MPI_Comm_dup(intraComm, &intraCommServer); + comms.push_back(intraCommServer); + MPI_Comm_dup(interComm, &interCommServer); + comms.push_back(interCommServer); } +/* for registry take the id of client context */ +/* for servers, supress the _server_ from id */ + string contextRegistryId=getId() ; + size_t pos=contextRegistryId.find("_server_") ; + if (pos!=std::string::npos) contextRegistryId=contextRegistryId.substr(0,pos) ; + + registryIn=new CRegistry(intraComm); + registryIn->setPath(contextRegistryId) ; + if (client->clientRank==0) registryIn->fromFile("xios_registry.bin") ; + registryIn->bcastRegistry() ; + registryOut=new CRegistry(intraComm) ; + + registryOut->setPath(contextRegistryId) ; + + server = new CContextServer(this, intraCommServer, interCommServer); + } + else + // initClient is called by primary server + { + clientPrimServer.push_back(new CContextClient(this, intraComm, interComm)); + MPI_Comm_dup(intraComm, &intraCommServer); + comms.push_back(intraCommServer); + MPI_Comm_dup(interComm, &interCommServer); + comms.push_back(interCommServer); + serverPrimServer.push_back(new CContextServer(this, intraCommServer, interCommServer)); } - return dataSize; } CATCH_DUMP_ATTR -/*! - * Compute the required buffer size to send the attributes (mostly those grid related). - * \param maxEventSize [in/out] the size of the bigger event for each connected server - * \param [in] contextClient - * \param [in] bufferForWriting True if buffers are used for sending data for writing - This flag is only true for client and server-1 for communication with server-2 - */ - std::map CContext::getAttributesBufferSize(std::map& maxEventSize, - CContextClient* contextClient, bool bufferForWriting /*= "false"*/) + /*! + Sets client buffers. + \param [in] contextClient + \param [in] bufferForWriting True if buffers are used for sending data for writing + This flag is only true for client and server-1 for communication with server-2 + */ + void CContext::setClientServerBuffer(CContextClient* contextClient, bool bufferForWriting) TRY { - // As calendar attributes are sent even if there are no active files or fields, maps are initialized according the size of calendar attributes - std::map attributesSize = CCalendarWrapper::get(CCalendarWrapper::GetDefName())->getMinimumBufferSizeForAttributes(contextClient); - maxEventSize = CCalendarWrapper::get(CCalendarWrapper::GetDefName())->getMinimumBufferSizeForAttributes(contextClient); + // Estimated minimum event size for small events (10 is an arbitrary constant just for safety) + const size_t minEventSize = CEventClient::headerSize + getIdServer().size() + 10 * sizeof(int); - std::vector& fileList = this->enabledFiles; - size_t numEnabledFiles = fileList.size(); - for (size_t i = 0; i < numEnabledFiles; ++i) + // Ensure there is at least some room for 20 of such events in the buffers + size_t minBufferSize = std::max(CXios::minBufferSize, 20 * minEventSize); + +#define DECLARE_NODE(Name_, name_) \ + if (minBufferSize < sizeof(C##Name_##Definition)) minBufferSize = sizeof(C##Name_##Definition); +#define DECLARE_NODE_PAR(Name_, name_) +#include "node_type.conf" +#undef DECLARE_NODE +#undef DECLARE_NODE_PAR + + // Compute the buffer sizes needed to send the attributes and data corresponding to fields + std::map maxEventSize; + std::map bufferSize = getAttributesBufferSize(maxEventSize, contextClient, bufferForWriting); + std::map dataBufferSize = getDataBufferSize(maxEventSize, contextClient, bufferForWriting); + + std::map::iterator it, ite = dataBufferSize.end(); + for (it = dataBufferSize.begin(); it != ite; ++it) + if (it->second > bufferSize[it->first]) bufferSize[it->first] = it->second; + + // Apply the buffer size factor, check that we are above the minimum buffer size and below the maximum size + ite = bufferSize.end(); + for (it = bufferSize.begin(); it != ite; ++it) { -// CFile* file = this->enabledWriteModeFiles[i]; - CFile* file = fileList[i]; - std::vector enabledFields = file->getEnabledFields(); - size_t numEnabledFields = enabledFields.size(); - for (size_t j = 0; j < numEnabledFields; ++j) - { - const std::map mapSize = enabledFields[j]->getGridAttributesBufferSize(contextClient, bufferForWriting); - std::map::const_iterator it = mapSize.begin(), itE = mapSize.end(); - for (; it != itE; ++it) - { - // If attributesSize[it->first] does not exist, it will be zero-initialized - // so we can use it safely without checking for its existence - if (attributesSize[it->first] < it->second) - attributesSize[it->first] = it->second; + it->second *= CXios::bufferSizeFactor; + if (it->second < minBufferSize) it->second = minBufferSize; + if (it->second > CXios::maxBufferSize) it->second = CXios::maxBufferSize; + } - if (maxEventSize[it->first] < it->second) - maxEventSize[it->first] = it->second; - } - } + // Leaders will have to send some control events so ensure there is some room for those in the buffers + if (contextClient->isServerLeader()) + { + const std::list& ranks = contextClient->getRanksServerLeader(); + for (std::list::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) + { + if (!bufferSize.count(*itRank)) + { + bufferSize[*itRank] = minBufferSize; + maxEventSize[*itRank] = minEventSize; + } + } } - return attributesSize; + contextClient->setBufferSize(bufferSize, maxEventSize); } CATCH_DUMP_ATTR - - //! Verify whether a context is initialized bool CContext::isInitialized(void) TRY @@ -444,395 +382,176 @@ void CContext::removeAllContexts(void) } CATCH_DUMP_ATTR - - void CContext::init(CServerContext* parentServerContext, MPI_Comm intraComm, int serviceType) - TRY - { - parentServerContext_ = parentServerContext ; - if (serviceType==CServicesManager::CLIENT) - initClient(intraComm, serviceType) ; - else - initServer(intraComm, serviceType) ; - initEventScheduler() ; - } - CATCH_DUMP_ATTR - - - -//! Initialize client side - void CContext::initClient(MPI_Comm intraComm, int serviceType) - TRY - { - intraComm_=intraComm ; - MPI_Comm_rank(intraComm_, &intraCommRank_) ; - MPI_Comm_size(intraComm_, &intraCommSize_) ; - - serviceType_ = CServicesManager::CLIENT ; - if (serviceType_==CServicesManager::CLIENT) - { - hasClient=true ; - hasServer=false ; - } - contextId_ = getId() ; - - attached_mode=true ; - if (!CXios::isUsingServer()) attached_mode=false ; - - - string contextRegistryId=getId() ; - registryIn=new CRegistry(CXios::getRegistryManager()->getRegistryIn()); - registryIn->setPath(contextRegistryId) ; - - registryOut=new CRegistry(intraComm_) ; - registryOut->setPath(contextRegistryId) ; - - } - CATCH_DUMP_ATTR - - - void CContext::initServer(MPI_Comm intraComm, int serviceType) + void CContext::initServer(MPI_Comm intraComm, MPI_Comm interComm, CContext* cxtClient /*= 0*/) TRY { hasServer=true; - intraComm_=intraComm ; - MPI_Comm_rank(intraComm_, &intraCommRank_) ; - MPI_Comm_size(intraComm_, &intraCommSize_) ; + server = new CContextServer(this,intraComm,interComm); - serviceType_=serviceType ; +/* for registry take the id of client context */ +/* for servers, supress the _server_ from id */ + string contextRegistryId=getId() ; + size_t pos=contextRegistryId.find("_server_") ; + if (pos!=std::string::npos) contextRegistryId=contextRegistryId.substr(0,pos) ; + + registryIn=new CRegistry(intraComm); + registryIn->setPath(contextRegistryId) ; + if (server->intraCommRank==0) registryIn->fromFile("xios_registry.bin") ; + registryIn->bcastRegistry() ; + registryOut=new CRegistry(intraComm) ; + registryOut->setPath(contextRegistryId) ; - if (serviceType_==CServicesManager::GATHERER) + MPI_Comm intraCommClient, interCommClient; + if (cxtClient) // Attached mode { - hasClient=true ; - hasServer=true ; + intraCommClient = intraComm; + interCommClient = interComm; } - else if (serviceType_==CServicesManager::IO_SERVER || serviceType_==CServicesManager::OUT_SERVER) + else { - hasClient=false ; - hasServer=true ; + MPI_Comm_dup(intraComm, &intraCommClient); + comms.push_back(intraCommClient); + MPI_Comm_dup(interComm, &interCommClient); + comms.push_back(interCommClient); } - - CXios::getContextsManager()->getContextId(getId(), contextId_, intraComm) ; - - string contextRegistryId=getId() ; - registryIn=new CRegistry(CXios::getRegistryManager()->getRegistryIn()); - registryIn->setPath(contextRegistryId) ; - - registryOut=new CRegistry(intraComm_) ; - registryOut->setPath(contextRegistryId) ; - + client = new CContextClient(this,intraCommClient,interCommClient, cxtClient); } CATCH_DUMP_ATTR - - void CContext::createClientInterComm(MPI_Comm interCommClient, MPI_Comm interCommServer) // for servers - TRY - { - MPI_Comm intraCommClient ; - MPI_Comm_dup(intraComm_, &intraCommClient); - comms.push_back(intraCommClient); - // attached_mode=parentServerContext_->isAttachedMode() ; //ym probably inherited from source context - server = new CContextServer(this,intraComm_, interCommServer); // check if we need to dupl. intraComm_ ? - client = new CContextClient(this,intraCommClient,interCommClient); - client->setAssociatedServer(server) ; - server->setAssociatedClient(client) ; - - } - CATCH_DUMP_ATTR - - void CContext::createServerInterComm(void) + //! Try to send the buffers and receive possible answers + bool CContext::checkBuffersAndListen(bool enableEventsProcessing /*= true*/) TRY { - - MPI_Comm interCommClient, interCommServer ; + bool clientReady, serverFinished; - if (serviceType_ == CServicesManager::CLIENT) + // Only classical servers are non-blocking + if (CServer::serverLevel == 0) { - - int commRank ; - MPI_Comm_rank(intraComm_,&commRank) ; - if (commRank==0) - { - if (attached_mode) CXios::getContextsManager()->createServerContext(CClient::getPoolRessource()->getId(), getContextId()+"_"+CXios::defaultServerId, 0, getContextId()) ; - else if (CXios::usingServer2) CXios::getContextsManager()->createServerContext(CXios::defaultPoolId, CXios::defaultGathererId, 0, getContextId()) ; - else CXios::getContextsManager()->createServerContext(CXios::defaultPoolId, CXios::defaultServerId, 0, getContextId()) ; - } - - MPI_Comm interComm ; - - if (attached_mode) - { - parentServerContext_->createIntercomm(CClient::getPoolRessource()->getId(), getContextId()+"_"+CXios::defaultServerId, 0, getContextId(), intraComm_, - interCommClient, interCommServer) ; - int type ; - if (commRank==0) CXios::getServicesManager()->getServiceType(CClient::getPoolRessource()->getId(), CXios::defaultServerId, 0, type) ; - MPI_Bcast(&type,1,MPI_INT,0,intraComm_) ; - setCurrent(getId()) ; // getCurrent/setCurrent may be supress, it can cause a lot of trouble - } - else if (CXios::usingServer2) - { -// CXios::getContextsManager()->createServerContextIntercomm(CXios::defaultPoolId, CXios::defaultGathererId, 0, getContextId(), intraComm_, interComm) ; - parentServerContext_->createIntercomm(CXios::defaultPoolId, CXios::defaultGathererId, 0, getContextId(), intraComm_, - interCommClient, interCommServer) ; - int type ; - if (commRank==0) CXios::getServicesManager()->getServiceType(CXios::defaultPoolId, CXios::defaultGathererId, 0, type) ; - MPI_Bcast(&type,1,MPI_INT,0,intraComm_) ; - } - else - { - //CXios::getContextsManager()->createServerContextIntercomm(CXios::defaultPoolId, CXios::defaultServerId, 0, getContextId(), intraComm_, interComm) ; - parentServerContext_->createIntercomm(CXios::defaultPoolId, CXios::defaultServerId, 0, getContextId(), intraComm_, - interCommClient, interCommServer) ; - int type ; - if (commRank==0) CXios::getServicesManager()->getServiceType(CXios::defaultPoolId, CXios::defaultServerId, 0, type) ; - MPI_Bcast(&type,1,MPI_INT,0,intraComm_) ; - } - - // intraComm client is not duplicated. In all the code we use client->intraComm for MPI - // in future better to replace it by intracommuncator associated to the context - - MPI_Comm intraCommClient, intraCommServer ; - intraCommClient=intraComm_ ; - MPI_Comm_dup(intraComm_, &intraCommServer) ; - client = new CContextClient(this, intraCommClient, interCommClient); - server = new CContextServer(this, intraCommServer, interCommServer); - client->setAssociatedServer(server) ; - server->setAssociatedClient(client) ; + client->checkBuffers(); + bool hasTmpBufferedEvent = client->hasTemporarilyBufferedEvent(); + if (hasTmpBufferedEvent) + hasTmpBufferedEvent = !client->sendTemporarilyBufferedEvent(); + // Don't process events if there is a temporarily buffered event + return server->eventLoop(!hasTmpBufferedEvent || !enableEventsProcessing); } - - if (serviceType_ == CServicesManager::GATHERER) + else if (CServer::serverLevel == 1) { - int commRank ; - MPI_Comm_rank(intraComm_,&commRank) ; - - int nbPartitions ; - if (commRank==0) - { - CXios::getServicesManager()->getServiceNbPartitions(CXios::defaultPoolId, CXios::defaultServerId, 0, nbPartitions) ; - for(int i=0 ; icreateServerContext(CXios::defaultPoolId, CXios::defaultServerId, i, getContextId()) ; - } - MPI_Bcast(&nbPartitions, 1, MPI_INT, 0, intraComm_) ; - - MPI_Comm interComm ; - for(int i=0 ; icheckBuffers(); + bool serverFinished = true; + if (!finalized) + serverFinished = server->eventLoop(enableEventsProcessing); + bool serverPrimFinished = true; + for (int i = 0; i < clientPrimServer.size(); ++i) { - parentServerContext_->createIntercomm(CXios::defaultPoolId, CXios::defaultServerId, i, getContextId(), intraComm_, interCommClient, interCommServer) ; - int type ; - if (commRank==0) CXios::getServicesManager()->getServiceType(CXios::defaultPoolId, CXios::defaultServerId, 0, type) ; - MPI_Bcast(&type,1,MPI_INT,0,intraComm_) ; - primServerId_.push_back(CXios::getContextsManager()->getServerContextName(CXios::defaultPoolId, CXios::defaultServerId, i, type, getContextId())) ; - - // intraComm client is not duplicated. In all the code we use client->intraComm for MPI - // in future better to replace it by intracommuncator associated to the context - - MPI_Comm intraCommClient, intraCommServer ; - - intraCommClient=intraComm_ ; - MPI_Comm_dup(intraComm_, &intraCommServer) ; - - CContextClient* client = new CContextClient(this, intraCommClient, interCommClient) ; - CContextServer* server = new CContextServer(this, intraCommServer, interCommServer) ; - client->setAssociatedServer(server) ; - server->setAssociatedClient(client) ; - clientPrimServer.push_back(client); - serverPrimServer.push_back(server); - - + if (!finalized) + clientPrimServer[i]->checkBuffers(); + if (!finalized) + serverPrimFinished *= serverPrimServer[i]->eventLoop(enableEventsProcessing); } + return ( serverFinished && serverPrimFinished); } - } - CATCH_DUMP_ATTR - void CContext::globalEventLoop(void) - { - lockContext() ; - CXios::getDaemonsManager()->eventLoop() ; - unlockContext() ; - setCurrent(getId()) ; - } - - bool CContext::scheduledEventLoop(bool enableEventsProcessing) - { - bool out, finished; - size_t timeLine=timeLine_ ; - if (serviceType_==CServicesManager::CLIENT) + else if (CServer::serverLevel == 2) { - timeLine_++ ; - eventScheduler_->registerEvent(timeLine, hashId_) ; + client->checkBuffers(); + return server->eventLoop(enableEventsProcessing); } - - do - { - finished=eventLoop(enableEventsProcessing) ; - if (serviceType_==CServicesManager::CLIENT) - { - out = eventScheduler_->queryEvent(timeLine,hashId_) ; - if (out) eventScheduler_->popEvent() ; - } - - else out=true ; - } while(!out) ; - - return finished ; - } - - bool CContext::eventLoop(bool enableEventsProcessing) - { - bool finished(true); - if (isLockedContext()) return false; - - setCurrent(getId()) ; - - if (client!=nullptr && !finalized) client->checkBuffers(); - - for (int i = 0; i < clientPrimServer.size(); ++i) - { - if (!finalized) clientPrimServer[i]->checkBuffers(); - if (!finalized) finished &= serverPrimServer[i]->eventLoop(enableEventsProcessing); - } - - for (auto couplerOut : couplerOutClient_) - if (!finalized) couplerOut.second->checkBuffers(); - - for (auto couplerIn : couplerInClient_) - if (!finalized) couplerIn.second->checkBuffers(); - - for (auto couplerOut : couplerOutServer_) - if (!finalized) couplerOut.second->eventLoop(enableEventsProcessing); - - for (auto couplerIn : couplerInServer_) - if (!finalized) couplerIn.second->eventLoop(enableEventsProcessing); - - if (server!=nullptr) if (!finalized) finished &= server->eventLoop(enableEventsProcessing); - setCurrent(getId()) ; - return finalized && finished ; } + CATCH_DUMP_ATTR - void CContext::addCouplingChanel(const std::string& fullContextId, bool out) - { - int contextLeader ; - - if (out) - { - if (couplerOutClient_.find(fullContextId)==couplerOutClient_.end()) - { - bool ok=CXios::getContextsManager()->getContextLeader(fullContextId, contextLeader, getIntraComm()) ; - - MPI_Comm interComm, interCommClient, interCommServer ; - MPI_Comm intraCommClient, intraCommServer ; - - if (ok) MPI_Intercomm_create(getIntraComm(), 0, CXios::getXiosComm(), contextLeader, 0, &interComm) ; - - MPI_Comm_dup(intraComm_, &intraCommClient) ; - MPI_Comm_dup(intraComm_, &intraCommServer) ; - MPI_Comm_dup(interComm, &interCommClient) ; - MPI_Comm_dup(interComm, &interCommServer) ; - CContextClient* client = new CContextClient(this, intraCommClient, interCommClient); - CContextServer* server = new CContextServer(this, intraCommServer, interCommServer); - client->setAssociatedServer(server) ; - server->setAssociatedClient(client) ; - MPI_Comm_free(&interComm) ; - couplerOutClient_[fullContextId] = client ; - couplerOutServer_[fullContextId] = server ; - } - } - else if (couplerInClient_.find(fullContextId)==couplerInClient_.end()) - { - bool ok=CXios::getContextsManager()->getContextLeader(fullContextId, contextLeader, getIntraComm()) ; - - MPI_Comm interComm, interCommClient, interCommServer ; - MPI_Comm intraCommClient, intraCommServer ; - - if (ok) MPI_Intercomm_create(getIntraComm(), 0, CXios::getXiosComm(), contextLeader, 0, &interComm) ; - - MPI_Comm_dup(intraComm_, &intraCommClient) ; - MPI_Comm_dup(intraComm_, &intraCommServer) ; - MPI_Comm_dup(interComm, &interCommServer) ; - MPI_Comm_dup(interComm, &interCommClient) ; - CContextServer* server = new CContextServer(this, intraCommServer, interCommServer); - CContextClient* client = new CContextClient(this, intraCommClient, interCommClient); - client->setAssociatedServer(server) ; - server->setAssociatedClient(client) ; - MPI_Comm_free(&interComm) ; - - couplerInClient_[fullContextId] = client ; - couplerInServer_[fullContextId] = server ; - } - } - + //! Terminate a context void CContext::finalize(void) TRY { - registryOut->hierarchicalGatherRegistry() ; - if (server->intraCommRank==0) CXios::getRegistryManager()->merge(*registryOut) ; - - if (serviceType_==CServicesManager::CLIENT) + if (hasClient && !hasServer) // For now we only use server level 1 to read data { -//ym doPreTimestepOperationsForEnabledReadModeFiles(); // For now we only use server level 1 to read data + doPreTimestepOperationsForEnabledReadModeFiles(); + } + // Send registry upon calling the function the first time + if (countChildCtx_ == 0) + if (hasClient) sendRegistry() ; + + // Client: + // (1) blocking send context finalize to its server + // (2) blocking receive context finalize from its server + // (3) some memory deallocations + if (CXios::isClient) + { + // Make sure that client (model) enters the loop only once + if (countChildCtx_ < 1) + { + ++countChildCtx_; - triggerLateFields() ; + client->finalize(); + while (client->havePendingRequests()) + client->checkBuffers(); - // inform couplerIn that I am finished - for(auto& couplerInClient : couplerInClient_) sendCouplerInContextFinalized(couplerInClient.second) ; + while (!server->hasFinished()) + server->eventLoop(); - // wait until received message from couplerOut that they have finished - bool couplersInFinalized ; - do - { - couplersInFinalized=true ; - for(auto& couplerOutClient : couplerOutClient_) couplersInFinalized &= isCouplerInContextFinalized(couplerOutClient.second) ; - globalEventLoop() ; - } while (!couplersInFinalized) ; - - info(100)<<"DEBUG: context "<finalize(); - info(100)<<"DEBUG: context "<havePendingRequests()) client->checkBuffers(); - info(100)<<"DEBUG: context "<isNotifiedFinalized() ; - } while (!notifiedFinalized) ; + if (hasServer) // Mode attache + { + closeAllFile(); + registryOut->hierarchicalGatherRegistry() ; + if (server->intraCommRank==0) CXios::globalRegistry->mergeRegistry(*registryOut) ; + } - server->releaseBuffers(); - client->releaseBuffers(); - info(100)<<"DEBUG: context "<releaseBuffers(); + + //! Free internally allocated communicators + for (std::list::iterator it = comms.begin(); it != comms.end(); ++it) + /* MPI_Comm_free(&(*it)) */ ; // WARNING remove freeing communicator !! --> deadlock raised, to be checked + comms.clear(); + + info(20)<<"CContext: Context <"< is finalized."<finalize(); - bool bufferReleased; - do - { - clientPrimServer[i]->checkBuffers(); - bufferReleased = !clientPrimServer[i]->havePendingRequests(); - } while (!bufferReleased); - - bool notifiedFinalized=false ; - do - { - notifiedFinalized=clientPrimServer[i]->isNotifiedFinalized() ; - } while (!notifiedFinalized) ; - clientPrimServer[i]->releaseBuffers(); + + // (Last) context finalized message received + if (countChildCtx_ == clientPrimServer.size()) + { + // Blocking send of context finalize message to its client (e.g. primary server or model) + info(100)<<"DEBUG: context "<finalize(); + bool bufferReleased; + do + { + client->checkBuffers(); + bufferReleased = !client->havePendingRequests(); + } while (!bufferReleased); + finalized = true; + + closeAllFile(); // Just move to here to make sure that server-level 1 can close files + if (hasServer && !hasClient) + { + registryOut->hierarchicalGatherRegistry() ; + if (server->intraCommRank==0) CXios::globalRegistry->mergeRegistry(*registryOut) ; } - closeAllFile(); - } - else if (serviceType_==CServicesManager::IO_SERVER || serviceType_==CServicesManager::OUT_SERVER) - { - closeAllFile(); - client->releaseBuffers(); - server->releaseBuffers(); - } + //! Deallocate client buffers + client->releaseBuffers(); + for (int i = 0; i < clientPrimServer.size(); ++i) + clientPrimServer[i]->releaseBuffers(); - freeComms() ; - - parentServerContext_->freeComm() ; - finalized = true; - info(20)<<"CContext: Context <"< is finalized."<::iterator it = comms.begin(); it != comms.end(); ++it) + /* MPI_Comm_free(&(*it)) */; // WARNING remove freeing communicator !! --> deadlock raised, to be checked + comms.clear(); + + info(20)<<"CContext: Context <"< is finalized."<::iterator it = comms.begin(); it != comms.end(); ++it) - MPI_Comm_free(&(*it)); + /* MPI_Comm_free(&(*it)) */ ; // WARNING remove freeing communicator !! --> deadlock raised, to be checked comms.clear(); } CATCH_DUMP_ATTR @@ -856,367 +575,279 @@ void CContext::removeAllContexts(void) } CATCH_DUMP_ATTR - - /*! - \brief Close all the context defintion and do processing data - After everything is well defined on client side, they will be processed and sent to server - From the version 2.0, sever and client work no more on the same database. Moreover, client(s) will send - all necessary information to server, from which each server can build its own database. - Because the role of server is to write out field data on a specific netcdf file, - the only information that it needs is the enabled files - and the active fields (fields will be written onto active files) - */ - void CContext::closeDefinition(void) + void CContext::postProcessingGlobalAttributes() TRY { - CTimer::get("Context : close definition").resume() ; + if (allProcessed) return; - // create intercommunicator with servers. - // not sure it is the good place to be called here - createServerInterComm() ; - - // After xml is parsed, there are some more works with post processing -// postProcessing(); + postProcessing(); - - // Make sure the calendar was correctly created - if (serviceType_!=CServicesManager::CLIENT) CCalendarWrapper::get(CCalendarWrapper::GetDefName())->createCalendar(); - if (!calendar) - ERROR("CContext::postProcessing()", << "A calendar must be defined for the context \"" << getId() << "!\"") - else if (calendar->getTimeStep() == NoneDu) - ERROR("CContext::postProcessing()", << "A timestep must be defined for the context \"" << getId() << "!\"") - // Calendar first update to set the current date equals to the start date - calendar->update(0); - - // Résolution des héritages descendants (càd des héritages de groupes) - // pour chacun des contextes. - solveDescInheritance(true); + // Check grid and calculate its distribution + checkGridEnabledFields(); - // Solve inheritance for field to know if enabled or not. - for (auto field : CField::getAll()) field->solveRefInheritance(); + // Distribute files between secondary servers according to the data size + distributeFiles(); - // Check if some axis, domains or grids are eligible to for compressed indexed output. - // Warning: This must be done after solving the inheritance and before the rest of post-processing - // --> later ???? checkAxisDomainsGridsEligibilityForCompressedOutput(); - - // Check if some automatic time series should be generated - // Warning: This must be done after solving the inheritance and before the rest of post-processing - - // The timeseries should only be prepared in client - prepareTimeseries(); - - //Initialisation du vecteur 'enabledFiles' contenant la liste des fichiers à sortir. - findEnabledFiles(); - findEnabledWriteModeFiles(); - findEnabledReadModeFiles(); - findEnabledCouplerIn(); - findEnabledCouplerOut(); - createCouplerInterCommunicator() ; - - // Find all enabled fields of each file - vector&& fileOutField = findAllEnabledFieldsInFileOut(this->enabledWriteModeFiles); - vector&& fileInField = findAllEnabledFieldsInFileIn(this->enabledReadModeFiles); - vector&& couplerOutField = findAllEnabledFieldsCouplerOut(this->enabledCouplerOut); - vector&& couplerInField = findAllEnabledFieldsCouplerIn(this->enabledCouplerIn); - findFieldsWithReadAccess(); - vector& fieldWithReadAccess = fieldsWithReadAccess_ ; - vector fieldModelIn ; // fields potentially from model - - // define if files are on clientSied or serverSide - if (serviceType_==CServicesManager::CLIENT) - { - for (auto& file : enabledWriteModeFiles) file->setClientSide() ; - for (auto& file : enabledReadModeFiles) file->setClientSide() ; - } - else - { - for (auto& file : enabledWriteModeFiles) file->setServerSide() ; - for (auto& file : enabledReadModeFiles) file->setServerSide() ; - } - - - for (auto& field : couplerInField) - { - field->unsetGridCompleted() ; - } -// find all field potentially at workflow end - vector endWorkflowFields ; - endWorkflowFields.reserve(fileOutField.size()+couplerOutField.size()+fieldWithReadAccess.size()) ; - endWorkflowFields.insert(endWorkflowFields.end(),fileOutField.begin(), fileOutField.end()) ; - endWorkflowFields.insert(endWorkflowFields.end(),couplerOutField.begin(), couplerOutField.end()) ; - endWorkflowFields.insert(endWorkflowFields.end(),fieldWithReadAccess.begin(), fieldWithReadAccess.end()) ; - - bool workflowGraphIsCompleted ; - - bool first=true ; - - do - { - workflowGraphIsCompleted=true; - for(auto endWorkflowField : endWorkflowFields) - { - workflowGraphIsCompleted &= endWorkflowField->buildWorkflowGraph(garbageCollector) ; - } - - for(auto couplerIn : enabledCouplerIn) couplerIn->assignContext() ; - for(auto field : couplerInField) field->makeGridAliasForCoupling(); - for(auto field : couplerInField) this->sendCouplerInReady(field->getContextClient()) ; - - - // assign context to coupler out and related fields - for(auto couplerOut : enabledCouplerOut) couplerOut->assignContext() ; - // for now supose that all coupling out endpoint are succesfull. The difficultie is client/server buffer evaluation - for(auto field : couplerOutField) - { - // connect to couplerOut -> to do - } - - bool couplersReady ; - do - { - couplersReady=true ; - for(auto field : couplerOutField) - { - bool ready = isCouplerInReady(field->getContextClient()) ; - if (ready) field->sendFieldToCouplerOut() ; - couplersReady &= ready ; - } - this->scheduledEventLoop() ; + setClientServerBuffer(client, (hasClient && !hasServer)); + for (int i = 0; i < clientPrimServer.size(); ++i) + setClientServerBuffer(clientPrimServer[i], true); - } while (!couplersReady) ; + if (hasClient) + { + // Send all attributes of current context to server + this->sendAllAttributesToServer(); + + // Send all attributes of current calendar + CCalendarWrapper::get(CCalendarWrapper::GetDefName())->sendAllAttributesToServer(); + + // We have enough information to send to server + // First of all, send all enabled files + sendEnabledFiles(this->enabledWriteModeFiles); + // We only use server-level 1 (for now) to read data + if (!hasServer) + sendEnabledFiles(this->enabledReadModeFiles); + + // Then, send all enabled fields + sendEnabledFieldsInFiles(this->enabledWriteModeFiles); + if (!hasServer) + sendEnabledFieldsInFiles(this->enabledReadModeFiles); + + // Then, check whether we have domain_ref, axis_ref or scalar_ref attached to the enabled fields + // If any, so send them to server + sendRefDomainsAxisScalars(this->enabledWriteModeFiles); + if (!hasServer) + sendRefDomainsAxisScalars(this->enabledReadModeFiles); + + // Check whether enabled fields have grid_ref, if any, send this info to server + sendRefGrid(this->enabledFiles); + // This code may be useful in the future when we want to seperate completely read and write + // sendRefGrid(this->enabledWriteModeFiles); + // if (!hasServer) + // sendRefGrid(this->enabledReadModeFiles); - first=false ; - this->scheduledEventLoop() ; - - } while (!workflowGraphIsCompleted) ; - + // A grid of enabled fields composed of several components which must be checked then their + // checked attributes should be sent to server + sendGridComponentEnabledFieldsInFiles(this->enabledFiles); // This code can be seperated in two (one for reading, another for writing) - for( auto field : couplerInField) couplerInFields_.push_back(field) ; + // We have a xml tree on the server side and now, it should be also processed + sendPostProcessing(); + + // Finally, we send information of grid itself to server + sendGridEnabledFieldsInFiles(this->enabledWriteModeFiles); + if (!hasServer) + sendGridEnabledFieldsInFiles(this->enabledReadModeFiles); + } + allProcessed = true; + } + CATCH_DUMP_ATTR - // get all field coming potentially from model - for (auto field : CField::getAll() ) if (field->getModelIn()) fieldModelIn.push_back(field) ; + void CContext::sendPostProcessingGlobalAttributes() + TRY + { + // Use correct context client to send message + // int nbSrvPools = (hasServer) ? clientPrimServer.size() : 1; + int nbSrvPools = (this->hasServer) ? (this->hasClient ? this->clientPrimServer.size() : 0) : 1; + for (int i = 0; i < nbSrvPools; ++i) + { + CContextClient* contextClientTmp = (0 != clientPrimServer.size()) ? clientPrimServer[i] : client; + CEventClient event(getType(),EVENT_ID_POST_PROCESS_GLOBAL_ATTRIBUTES); - // Distribute files between secondary servers according to the data size => assign a context to a file and then to fields - if (serviceType_==CServicesManager::GATHERER) distributeFiles(this->enabledWriteModeFiles); - else if (serviceType_==CServicesManager::CLIENT) for(auto file : this->enabledWriteModeFiles) file->setContextClient(client) ; + if (contextClientTmp->isServerLeader()) + { + CMessage msg; + if (hasServer) + msg<getIdServer(i); + else + msg<getIdServer(); + const std::list& ranks = contextClientTmp->getRanksServerLeader(); + for (std::list::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) + event.push(*itRank,1,msg); + contextClientTmp->sendEvent(event); + } + else contextClientTmp->sendEvent(event); + } + } + CATCH_DUMP_ATTR - // client side, assign context for file reading - if (serviceType_==CServicesManager::CLIENT) for(auto file : this->enabledReadModeFiles) file->setContextClient(client) ; - - // server side, assign context where to send file data read - if (serviceType_==CServicesManager::CServicesManager::GATHERER || serviceType_==CServicesManager::IO_SERVER) - for(auto file : this->enabledReadModeFiles) file->setContextClient(client) ; - - // workflow endpoint => sent to IO/SERVER - if (serviceType_==CServicesManager::CLIENT || serviceType_==CServicesManager::GATHERER) - { - for(auto field : fileOutField) - { - field->connectToFileServer(garbageCollector) ; // connect the field to server filter - } - for(auto field : fileOutField) field->sendFieldToFileServer() ; - } + void CContext::recvPostProcessingGlobalAttributes(CEventServer& event) + TRY + { + CBufferIn* buffer=event.subEvents.begin()->buffer; + string id; + *buffer>>id; + get(id)->recvPostProcessingGlobalAttributes(*buffer); + } + CATCH - // workflow endpoint => write to file - if (serviceType_==CServicesManager::IO_SERVER || serviceType_==CServicesManager::OUT_SERVER) - { - for(auto field : fileOutField) - { - field->connectToFileWriter(garbageCollector) ; // connect the field to server filter - } - } - - // workflow endpoint => Send data from server to client - if (serviceType_==CServicesManager::IO_SERVER || serviceType_==CServicesManager::GATHERER) - { - for(auto field : fileInField) - { - field->connectToServerToClient(garbageCollector) ; - } - } + void CContext::recvPostProcessingGlobalAttributes(CBufferIn& buffer) + TRY + { + postProcessingGlobalAttributes(); + } + CATCH_DUMP_ATTR - // workflow endpoint => sent to model on client side - if (serviceType_==CServicesManager::CLIENT) - { - for(auto field : fieldWithReadAccess) field->connectToModelOutput(garbageCollector) ; - } + /*! + \brief Close all the context defintion and do processing data + After everything is well defined on client side, they will be processed and sent to server + From the version 2.0, sever and client work no more on the same database. Moreover, client(s) will send + all necessary information to server, from which each server can build its own database. + Because the role of server is to write out field data on a specific netcdf file, + the only information that it needs is the enabled files + and the active fields (fields will be written onto active files) + */ + void CContext::closeDefinition(void) + TRY + { + CTimer::get("Context : close definition").resume() ; + postProcessingGlobalAttributes(); - // workflow startpoint => data from model - if (serviceType_==CServicesManager::CLIENT) - { - for(auto field : fieldModelIn) - { - field->connectToModelInput(garbageCollector) ; // connect the field to server filter - // grid index will be computed on the fly - } - } - - // workflow startpoint => data from client on server side - if (serviceType_==CServicesManager::IO_SERVER || serviceType_==CServicesManager::GATHERER || serviceType_==CServicesManager::OUT_SERVER) - { - for(auto field : fieldModelIn) - { - field->connectToClientInput(garbageCollector) ; // connect the field to server filter - } - } + if (hasClient) sendPostProcessingGlobalAttributes(); + // There are some processings that should be done after all of above. For example: check mask or index + this->buildFilterGraphOfEnabledFields(); - for(auto field : couplerInField) + if (hasClient && !hasServer) { - field->connectToCouplerIn(garbageCollector) ; // connect the field to server filter + buildFilterGraphOfFieldsWithReadAccess(); + postProcessFilterGraph(); } - - for(auto field : couplerOutField) - { - field->connectToCouplerOut(garbageCollector) ; // for now the same kind of filter that for file server - } - - // workflow startpoint => data from server on client side - if (serviceType_==CServicesManager::CLIENT) - { - for(auto field : fileInField) - { - field->sendFieldToInputFileServer() ; - field->connectToServerInput(garbageCollector) ; // connect the field to server filter - fileInFields_.push_back(field) ; - } - } + checkGridEnabledFields(); - // workflow startpoint => data read from file on server side - if (serviceType_==CServicesManager::IO_SERVER || serviceType_==CServicesManager::GATHERER) - { - for(auto field : fileInField) - { - field->connectToFileReader(garbageCollector) ; - } - } - - // construct slave server list - if (serviceType_==CServicesManager::CLIENT || serviceType_==CServicesManager::GATHERER) - { - for(auto field : fileOutField) slaveServers_.insert(field->getContextClient()) ; - for(auto field : fileInField) slaveServers_.insert(field->getContextClient()) ; - } + if (hasClient) this->sendProcessingGridOfEnabledFields(); + if (hasClient) this->sendCloseDefinition(); - for(auto& slaveServer : slaveServers_) sendCloseDefinition(slaveServer) ; + // Nettoyage de l'arborescence + if (hasClient) CleanTree(); // Only on client side?? - if (serviceType_==CServicesManager::IO_SERVER || serviceType_==CServicesManager::OUT_SERVER) + if (hasClient) { - createFileHeader(); + sendCreateFileHeader(); + if (!hasServer) startPrefetchingOfEnabledReadModeFiles(); } + CTimer::get("Context : close definition").suspend() ; + } + CATCH_DUMP_ATTR - if (serviceType_==CServicesManager::CLIENT) startPrefetchingOfEnabledReadModeFiles(); - - // send signal to couplerIn context that definition phasis is done - - for(auto& couplerInClient : couplerInClient_) sendCouplerInCloseDefinition(couplerInClient.second) ; - - // wait until all couplerIn signal that closeDefition is done. - bool ok; - do - { - ok = true ; - for(auto& couplerOutClient : couplerOutClient_) ok &= isCouplerInCloseDefinition(couplerOutClient.second) ; - this->scheduledEventLoop() ; - } while (!ok) ; - - // Now evaluate the size of the context client buffers - map> fieldBufferEvaluation ; - for(auto field : fileOutField) field->evaluateBufferSize(fieldBufferEvaluation, CXios::isOptPerformance) ; // output to server - for(auto field : couplerOutField) field->evaluateBufferSize(fieldBufferEvaluation, CXios::isOptPerformance) ; // output to coupler - for(auto field : fieldModelIn) field->evaluateBufferSize(fieldBufferEvaluation, CXios::isOptPerformance) ; // server to client (for io servers) - - // fix size for each context client - for(auto& it : fieldBufferEvaluation) it.first->setBufferSize(it.second) ; + void CContext::findAllEnabledFieldsInFiles(const std::vector& activeFiles) + TRY + { + for (unsigned int i = 0; i < activeFiles.size(); i++) + (void)activeFiles[i]->getEnabledFields(); + } + CATCH_DUMP_ATTR + void CContext::readAttributesOfEnabledFieldsInReadModeFiles() + TRY + { + for (unsigned int i = 0; i < this->enabledReadModeFiles.size(); ++i) + (void)this->enabledReadModeFiles[i]->readAttributesOfEnabledFieldsInReadMode(); + } + CATCH_DUMP_ATTR - CTimer::get("Context : close definition").suspend() ; - } - CATCH_DUMP_ATTR + void CContext::sendGridComponentEnabledFieldsInFiles(const std::vector& activeFiles) + TRY + { + int size = activeFiles.size(); + for (int i = 0; i < size; ++i) + { + activeFiles[i]->sendGridComponentOfEnabledFields(); + } + } + CATCH_DUMP_ATTR + /*! + Send active (enabled) fields in file from a client to others + \param [in] activeFiles files contains enabled fields to send + */ + void CContext::sendGridEnabledFieldsInFiles(const std::vector& activeFiles) + TRY + { + int size = activeFiles.size(); + for (int i = 0; i < size; ++i) + { + activeFiles[i]->sendGridOfEnabledFields(); + } + } + CATCH_DUMP_ATTR - vector CContext::findAllEnabledFieldsInFileOut(const std::vector& activeFiles) + void CContext::checkGridEnabledFields() TRY { - vector fields ; - for(auto file : activeFiles) + int size = enabledFiles.size(); + for (int i = 0; i < size; ++i) { - const vector&& fieldList=file->getEnabledFields() ; - for(auto field : fieldList) field->setFileOut(file) ; - fields.insert(fields.end(),fieldList.begin(),fieldList.end()); + enabledFiles[i]->checkGridOfEnabledFields(); } - return fields ; } CATCH_DUMP_ATTR - vector CContext::findAllEnabledFieldsInFileIn(const std::vector& activeFiles) + /*! + Check grid of active (enabled) fields in file + \param [in] activeFiles files contains enabled fields whose grid needs checking + */ + void CContext::checkGridEnabledFieldsInFiles(const std::vector& activeFiles) TRY { - vector fields ; - for(auto file : activeFiles) + int size = activeFiles.size(); + for (int i = 0; i < size; ++i) { - const vector&& fieldList=file->getEnabledFields() ; - for(auto field : fieldList) field->setFileIn(file) ; - fields.insert(fields.end(),fieldList.begin(),fieldList.end()); + activeFiles[i]->checkGridOfEnabledFields(); } - return fields ; } CATCH_DUMP_ATTR - vector CContext::findAllEnabledFieldsCouplerOut(const std::vector& activeCouplerOut) + /*! + Go up the hierachical tree via field_ref and do check of attributes of fields + This can be done in a client then all computed information will be sent from this client to others + \param [in] sendToServer Flag to indicate whether calculated information will be sent + */ + void CContext::solveOnlyRefOfEnabledFields(bool sendToServer) TRY { - vector fields ; - for (auto couplerOut :activeCouplerOut) + int size = this->enabledFiles.size(); + for (int i = 0; i < size; ++i) + { + this->enabledFiles[i]->solveOnlyRefOfEnabledFields(sendToServer); + } + + for (int i = 0; i < size; ++i) { - const vector&& fieldList=couplerOut->getEnabledFields() ; - for(auto field : fieldList) field->setCouplerOut(couplerOut) ; - fields.insert(fields.end(),fieldList.begin(),fieldList.end()); + this->enabledFiles[i]->generateNewTransformationGridDest(); } - return fields ; } CATCH_DUMP_ATTR - vector CContext::findAllEnabledFieldsCouplerIn(const std::vector& activeCouplerIn) + /*! + Go up the hierachical tree via field_ref and do check of attributes of fields. + The transformation can be done in this step. + All computed information will be sent from this client to others. + \param [in] sendToServer Flag to indicate whether calculated information will be sent + */ + void CContext::solveAllRefOfEnabledFieldsAndTransform(bool sendToServer) TRY { - vector fields ; - for (auto couplerIn :activeCouplerIn) + int size = this->enabledFiles.size(); + for (int i = 0; i < size; ++i) { - const vector&& fieldList=couplerIn->getEnabledFields() ; - for(auto field : fieldList) field->setCouplerIn(couplerIn) ; - fields.insert(fields.end(),fieldList.begin(),fieldList.end()); + this->enabledFiles[i]->solveAllRefOfEnabledFieldsAndTransform(sendToServer); } - return fields ; } CATCH_DUMP_ATTR - /*! - * Send context attribute and calendar to file server, it must be done once by context file server - * \param[in] client : context client to send - */ - void CContext::sendContextToFileServer(CContextClient* client) - { - if (sendToFileServer_done_.count(client)!=0) return ; - else sendToFileServer_done_.insert(client) ; - - this->sendAllAttributesToServer(client); // Send all attributes of current context to server - CCalendarWrapper::get(CCalendarWrapper::GetDefName())->sendAllAttributesToServer(client); // Send all attributes of current cale - } - - - void CContext::readAttributesOfEnabledFieldsInReadModeFiles() + void CContext::buildFilterGraphOfEnabledFields() TRY { - for (unsigned int i = 0; i < this->enabledReadModeFiles.size(); ++i) - (void)this->enabledReadModeFiles[i]->readAttributesOfEnabledFieldsInReadMode(); + int size = this->enabledFiles.size(); + for (int i = 0; i < size; ++i) + { + this->enabledFiles[i]->buildFilterGraphOfEnabledFields(garbageCollector); + } } CATCH_DUMP_ATTR - void CContext::postProcessFilterGraph() TRY { @@ -1264,21 +895,36 @@ void CContext::removeAllContexts(void) void CContext::findFieldsWithReadAccess(void) TRY { - fieldsWithReadAccess_.clear(); + fieldsWithReadAccess.clear(); const vector allFields = CField::getAll(); for (size_t i = 0; i < allFields.size(); ++i) { CField* field = allFields[i]; - if (!field->read_access.isEmpty() && field->read_access && (field->enabled.isEmpty() || field->enabled)) - { - fieldsWithReadAccess_.push_back(field); - field->setModelOut() ; - } + + if (field->file && !field->file->mode.isEmpty() && field->file->mode == CFile::mode_attr::read) + field->read_access = true; + else if (!field->read_access.isEmpty() && field->read_access && (field->enabled.isEmpty() || field->enabled)) + fieldsWithReadAccess.push_back(field); } } CATCH_DUMP_ATTR - + void CContext::solveAllRefOfFieldsWithReadAccess() + TRY + { + for (size_t i = 0; i < fieldsWithReadAccess.size(); ++i) + fieldsWithReadAccess[i]->solveAllReferenceEnabledField(false); + } + CATCH_DUMP_ATTR + + void CContext::buildFilterGraphOfFieldsWithReadAccess() + TRY + { + for (size_t i = 0; i < fieldsWithReadAccess.size(); ++i) + fieldsWithReadAccess[i]->buildFilterGraph(garbageCollector, true); + } + CATCH_DUMP_ATTR + void CContext::solveAllInheritance(bool apply) TRY { @@ -1288,26 +934,19 @@ void CContext::removeAllContexts(void) // Résolution des héritages par référence au niveau des fichiers. const vector allFiles=CFile::getAll(); - const vector allCouplerIn=CCouplerIn::getAll(); - const vector allCouplerOut=CCouplerOut::getAll(); const vector allGrids= CGrid::getAll(); - if (serviceType_==CServicesManager::CLIENT) + if (hasClient && !hasServer) + //if (hasClient) { for (unsigned int i = 0; i < allFiles.size(); i++) allFiles[i]->solveFieldRefInheritance(apply); - - for (unsigned int i = 0; i < allCouplerIn.size(); i++) - allCouplerIn[i]->solveFieldRefInheritance(apply); - - for (unsigned int i = 0; i < allCouplerOut.size(); i++) - allCouplerOut[i]->solveFieldRefInheritance(apply); } unsigned int vecSize = allGrids.size(); unsigned int i = 0; for (i = 0; i < vecSize; ++i) - allGrids[i]->solveElementsRefInheritance(apply); + allGrids[i]->solveDomainAxisRefInheritance(apply); } CATCH_DUMP_ATTR @@ -1364,194 +1003,192 @@ void CContext::removeAllContexts(void) } CATCH_DUMP_ATTR - void CContext::findEnabledCouplerIn(void) - TRY - { - const std::vector allCouplerIn = CCouplerIn::getAll(); - bool enabled ; - for (size_t i = 0; i < allCouplerIn.size(); i++) - { - if (allCouplerIn[i]->enabled.isEmpty()) enabled=true ; - else enabled=allCouplerIn[i]->enabled ; - if (enabled) enabledCouplerIn.push_back(allCouplerIn[i]) ; - } - } - CATCH_DUMP_ATTR - - void CContext::findEnabledCouplerOut(void) - TRY - { - const std::vector allCouplerOut = CCouplerOut::getAll(); - bool enabled ; - for (size_t i = 0; i < allCouplerOut.size(); i++) - { - if (allCouplerOut[i]->enabled.isEmpty()) enabled=true ; - else enabled=allCouplerOut[i]->enabled ; - if (enabled) enabledCouplerOut.push_back(allCouplerOut[i]) ; - } - } - CATCH_DUMP_ATTR - - - - - void CContext::distributeFiles(const vector& files) + void CContext::distributeFiles(void) TRY { bool distFileMemory=false ; distFileMemory=CXios::getin("server2_dist_file_memory", distFileMemory); - if (distFileMemory) distributeFileOverMemoryBandwith(files) ; - else distributeFileOverBandwith(files) ; + if (distFileMemory) distributeFileOverMemoryBandwith() ; + else distributeFileOverBandwith() ; } CATCH_DUMP_ATTR - void CContext::distributeFileOverBandwith(const vector& files) + void CContext::distributeFileOverBandwith(void) TRY { double eps=std::numeric_limits::epsilon()*10 ; - std::ofstream ofs(("distribute_file_"+getId()+".dat").c_str(), std::ofstream::out); - int nbPools = clientPrimServer.size(); - - // (1) Find all enabled files in write mode - // for (int i = 0; i < this->enabledFiles.size(); ++i) - // { - // if (enabledFiles[i]->mode.isEmpty() || (!enabledFiles[i]->mode.isEmpty() && enabledFiles[i]->mode.getValue() == CFile::mode_attr::write )) - // enabledWriteModeFiles.push_back(enabledFiles[i]); - // } - - // (2) Estimate the data volume for each file - int size = files.size(); - std::vector > dataSizeMap; - double dataPerPool = 0; - int nfield=0 ; - ofs<getId()< enabledFields = file->getEnabledFields(); - size_t numEnabledFields = enabledFields.size(); - ofs<enabledFiles.size(); ++i) + // { + // if (enabledFiles[i]->mode.isEmpty() || (!enabledFiles[i]->mode.isEmpty() && enabledFiles[i]->mode.getValue() == CFile::mode_attr::write )) + // enabledWriteModeFiles.push_back(enabledFiles[i]); + // } + + // (2) Estimate the data volume for each file + int size = this->enabledWriteModeFiles.size(); + std::vector > dataSizeMap; + double dataPerPool = 0; + int nfield=0 ; + ofs<getGlobalWrittenSize() ; - ofs<getGrid()->getId()<getGlobalWrittenSize()<getCurrentDate()+file->output_freq)-(Time)(calendar->getCurrentDate()) ; - double dataSizeSec= dataSize/ outFreqSec; - ofs<enabledWriteModeFiles[i]; + ofs<getId()< enabledFields = file->getEnabledFields(); + size_t numEnabledFields = enabledFields.size(); + ofs<getGlobalWrittenSize() ; + ofs<grid->getId()<getGlobalWrittenSize()<getCurrentDate()+file->output_freq)-(Time)(calendar->getCurrentDate()) ; + double dataSizeSec= dataSize/ outFreqSec; + ofs< poolDataSize ; + std::multimap poolDataSize ; // multimap is not garanty to preserve stable sorting in c++98 but it seems it does for c++11 - int j; - double dataSize ; - for (j = 0 ; j < nbPools ; ++j) poolDataSize.insert(std::pair(0.,j)) ; - - for (int i = dataSizeMap.size()-1; i >= 0; --i) + int j; + double dataSize ; + for (j = 0 ; j < nbPools ; ++j) poolDataSize.insert(std::pair(0.,j)) ; + + for (int i = dataSizeMap.size()-1; i >= 0; --i) + { + dataSize=(*poolDataSize.begin()).first ; + j=(*poolDataSize.begin()).second ; + dataSizeMap[i].second->setContextClient(clientPrimServer[j]); + dataSize+=dataSizeMap[i].first; + poolDataSize.erase(poolDataSize.begin()) ; + poolDataSize.insert(std::pair(dataSize,j)) ; + } + + for (std::multimap:: iterator it=poolDataSize.begin() ; it!=poolDataSize.end(); ++it) info(30)<<"Load Balancing for servers (perfect=1) : "<second<<" : ratio "<first*1./dataPerPool<enabledReadModeFiles.size(); ++i) + { + enabledReadModeFiles[i]->setContextClient(client); + } + } + else { - dataSize=(*poolDataSize.begin()).first ; - j=(*poolDataSize.begin()).second ; - dataSizeMap[i].second->setContextClient(clientPrimServer[j]); - dataSize+=dataSizeMap[i].first; - poolDataSize.erase(poolDataSize.begin()) ; - poolDataSize.insert(std::pair(dataSize,j)) ; + for (int i = 0; i < this->enabledFiles.size(); ++i) + enabledFiles[i]->setContextClient(client); } - - for (std::multimap:: iterator it=poolDataSize.begin() ; it!=poolDataSize.end(); ++it) info(30)<<"Load Balancing for servers (perfect=1) : "<second<<" : ratio "<first*1./dataPerPool<& filesList) + void CContext::distributeFileOverMemoryBandwith(void) TRY { - int nbPools = clientPrimServer.size(); - double ratio=0.5 ; - ratio=CXios::getin("server2_dist_file_memory_ratio", ratio); - - int nFiles = filesList.size(); - vector files(nFiles); - vector grids; - map gridMap ; - string gridId; - int gridIndex=0 ; - - for (size_t i = 0; i < nFiles; ++i) + // If primary server + if (hasServer && hasClient) { - StdSize dataSize=0; - CFile* file = filesList[i]; - std::vector enabledFields = file->getEnabledFields(); - size_t numEnabledFields = enabledFields.size(); - - files[i].id_=file->getId() ; - files[i].nbGrids_=numEnabledFields; - files[i].assignedGrid_ = new int[files[i].nbGrids_] ; - - for (size_t j = 0; j < numEnabledFields; ++j) + int nbPools = clientPrimServer.size(); + double ratio=0.5 ; + ratio=CXios::getin("server2_dist_file_memory_ratio", ratio); + + int nFiles = this->enabledWriteModeFiles.size(); + vector files(nFiles); + vector grids; + map gridMap ; + string gridId; + int gridIndex=0 ; + + for (size_t i = 0; i < nFiles; ++i) { - gridId=enabledFields[j]->getGrid()->getId() ; - if (gridMap.find(gridId)==gridMap.end()) + StdSize dataSize=0; + CFile* file = this->enabledWriteModeFiles[i]; + std::vector enabledFields = file->getEnabledFields(); + size_t numEnabledFields = enabledFields.size(); + + files[i].id_=file->getId() ; + files[i].nbGrids_=numEnabledFields; + files[i].assignedGrid_ = new int[files[i].nbGrids_] ; + + for (size_t j = 0; j < numEnabledFields; ++j) { - gridMap[gridId]=gridIndex ; - SDistGrid newGrid; - grids.push_back(newGrid) ; - gridIndex++ ; + gridId=enabledFields[j]->grid->getId() ; + if (gridMap.find(gridId)==gridMap.end()) + { + gridMap[gridId]=gridIndex ; + SDistGrid newGrid; + grids.push_back(newGrid) ; + gridIndex++ ; + } + files[i].assignedGrid_[j]=gridMap[gridId] ; + grids[files[i].assignedGrid_[j]].size_=enabledFields[j]->getGlobalWrittenSize() ; + dataSize += enabledFields[j]->getGlobalWrittenSize() ; // usefull } - files[i].assignedGrid_[j]=gridMap[gridId] ; - grids[files[i].assignedGrid_[j]].size_=enabledFields[j]->getGlobalWrittenSize() ; - dataSize += enabledFields[j]->getGlobalWrittenSize() ; // usefull + double outFreqSec = (Time)(calendar->getCurrentDate()+file->output_freq)-(Time)(calendar->getCurrentDate()) ; + files[i].bandwith_= dataSize/ outFreqSec ; } - double outFreqSec = (Time)(calendar->getCurrentDate()+file->output_freq)-(Time)(calendar->getCurrentDate()) ; - files[i].bandwith_= dataSize/ outFreqSec ; - } - double bandwith=0 ; - double memory=0 ; + double bandwith=0 ; + double memory=0 ; - for(int i=0; i memorySize(nbPools,0.) ; - vector< set > serverGrids(nbPools) ; - vector bandwithSize(nbPools,0.) ; + vector memorySize(nbPools,0.) ; + vector< set > serverGrids(nbPools) ; + vector bandwithSize(nbPools,0.) ; - for (size_t i = 0; i < nFiles; ++i) - { - bandwithSize[files[i].assignedServer_] += files[i].bandwith_* bandwith /ratio ; - for(int j=0 ; jsetContextClient(clientPrimServer[files[i].assignedServer_]) ; + delete [] files[i].assignedGrid_ ; } - filesList[i]->setContextClient(clientPrimServer[files[i].assignedServer_]) ; - delete [] files[i].assignedGrid_ ; - } - for (int i = 0; i < nbPools; ++i) info(100)<<"Pool server level2 "<enabledReadModeFiles.size(); ++i) + { + enabledReadModeFiles[i]->setContextClient(client); + } } + else + { + for (int i = 0; i < this->enabledFiles.size(); ++i) + enabledFiles[i]->setContextClient(client); + } +} CATCH_DUMP_ATTR /*! @@ -1627,18 +1264,21 @@ void CContext::removeAllContexts(void) recvCreateFileHeader(event); return true; break; - case EVENT_ID_COUPLER_IN_READY: - recvCouplerInReady(event); + case EVENT_ID_POST_PROCESS: + recvPostProcessing(event); + return true; + case EVENT_ID_SEND_REGISTRY: + recvRegistry(event); return true; break; - case EVENT_ID_COUPLER_IN_CLOSE_DEFINITION: - recvCouplerInCloseDefinition(event); + case EVENT_ID_POST_PROCESS_GLOBAL_ATTRIBUTES: + recvPostProcessingGlobalAttributes(event); return true; break; - case EVENT_ID_COUPLER_IN_CONTEXT_FINALIZED: - recvCouplerInContextFinalized(event); + case EVENT_ID_PROCESS_GRID_ENABLED_FIELDS: + recvProcessingGridOfEnabledFields(event); return true; - break; + break; default : ERROR("bool CContext::dispatchEvent(CEventServer& event)", <<"Unknown Event"); @@ -1649,24 +1289,22 @@ void CContext::removeAllContexts(void) CATCH //! Client side: Send a message to server to make it close - // ym obsolete void CContext::sendCloseDefinition(void) TRY { - int nbSrvPools ; - if (serviceType_==CServicesManager::CLIENT) nbSrvPools = 1 ; - else if (serviceType_==CServicesManager::GATHERER) nbSrvPools = this->clientPrimServer.size() ; - else nbSrvPools = 0 ; - CContextClient* contextClientTmp ; - - for (int i = 0; i < nbSrvPools; ++i) + // Use correct context client to send message + int nbSrvPools = (this->hasServer) ? (this->hasClient ? this->clientPrimServer.size() : 0) : 1; + for (int i = 0; i < nbSrvPools; ++i) { - if (serviceType_==CServicesManager::CLIENT) contextClientTmp = client ; - else if (serviceType_==CServicesManager::GATHERER ) contextClientTmp = clientPrimServer[i] ; + CContextClient* contextClientTmp = (hasServer) ? clientPrimServer[i] : client; CEventClient event(getType(),EVENT_ID_CLOSE_DEFINITION); if (contextClientTmp->isServerLeader()) { CMessage msg; + if (hasServer) + msg<getIdServer(i); + else + msg<getIdServer(); const std::list& ranks = contextClientTmp->getRanksServerLeader(); for (std::list::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) event.push(*itRank,1,msg); @@ -1676,98 +1314,178 @@ void CContext::removeAllContexts(void) } } CATCH_DUMP_ATTR - - // ! Client side: Send a message to server to make it close - void CContext::sendCloseDefinition(CContextClient* client) + + //! Server side: Receive a message of client announcing a context close + void CContext::recvCloseDefinition(CEventServer& event) TRY { - if (sendCloseDefinition_done_.count(client)!=0) return ; - else sendCloseDefinition_done_.insert(client) ; + CBufferIn* buffer=event.subEvents.begin()->buffer; + string id; + *buffer>>id; + get(id)->closeDefinition(); + } + CATCH - CEventClient event(getType(),EVENT_ID_CLOSE_DEFINITION); - if (client->isServerLeader()) - { - CMessage msg; - for(auto rank : client->getRanksServerLeader()) event.push(rank,1,msg); - client->sendEvent(event); - } - else client->sendEvent(event); + //! Client side: Send a message to update calendar in each time step + void CContext::sendUpdateCalendar(int step) + TRY + { + // Use correct context client to send message + int nbSrvPools = (this->hasServer) ? (this->hasClient ? this->clientPrimServer.size() : 0) : 1; + for (int i = 0; i < nbSrvPools; ++i) + { + CContextClient* contextClientTmp = (hasServer) ? clientPrimServer[i] : client; + CEventClient event(getType(),EVENT_ID_UPDATE_CALENDAR); + + if (contextClientTmp->isServerLeader()) + { + CMessage msg; + if (hasServer) + msg<getIdServer(i)<getIdServer()<& ranks = contextClientTmp->getRanksServerLeader(); + for (std::list::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) + event.push(*itRank,1,msg); + contextClientTmp->sendEvent(event); + } + else contextClientTmp->sendEvent(event); + } } CATCH_DUMP_ATTR - //! Server side: Receive a message of client announcing a context close - void CContext::recvCloseDefinition(CEventServer& event) + //! Server side: Receive a message of client annoucing calendar update + void CContext::recvUpdateCalendar(CEventServer& event) TRY { CBufferIn* buffer=event.subEvents.begin()->buffer; - getCurrent()->closeDefinition(); + string id; + *buffer>>id; + get(id)->recvUpdateCalendar(*buffer); } CATCH - //! Client side: Send a message to update calendar in each time step - void CContext::sendUpdateCalendar(int step) + //! Server side: Receive a message of client annoucing calendar update + void CContext::recvUpdateCalendar(CBufferIn& buffer) + TRY + { + int step; + buffer>>step; + updateCalendar(step); + if (hasClient && hasServer) + { + sendUpdateCalendar(step); + } + } + CATCH_DUMP_ATTR + + //! Client side: Send a message to create header part of netcdf file + void CContext::sendCreateFileHeader(void) TRY { - CEventClient event(getType(),EVENT_ID_UPDATE_CALENDAR); - for(auto client : slaveServers_) + // Use correct context client to send message + // int nbSrvPools = (hasServer) ? clientPrimServer.size() : 1; + int nbSrvPools = (this->hasServer) ? (this->hasClient ? this->clientPrimServer.size() : 0) : 1; + for (int i = 0; i < nbSrvPools; ++i) { - if (client->isServerLeader()) + CContextClient* contextClientTmp = (hasServer) ? clientPrimServer[i] : client; + CEventClient event(getType(),EVENT_ID_CREATE_FILE_HEADER); + + if (contextClientTmp->isServerLeader()) { CMessage msg; - msg<getRanksServerLeader() ) event.push(rank,1,msg); - client->sendEvent(event); + if (hasServer) + msg<getIdServer(i); + else + msg<getIdServer(); + const std::list& ranks = contextClientTmp->getRanksServerLeader(); + for (std::list::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) + event.push(*itRank,1,msg) ; + contextClientTmp->sendEvent(event); } - else client->sendEvent(event); + else contextClientTmp->sendEvent(event); } } CATCH_DUMP_ATTR - //! Server side: Receive a message of client annoucing calendar update - void CContext::recvUpdateCalendar(CEventServer& event) + //! Server side: Receive a message of client annoucing the creation of header part of netcdf file + void CContext::recvCreateFileHeader(CEventServer& event) TRY { CBufferIn* buffer=event.subEvents.begin()->buffer; - getCurrent()->recvUpdateCalendar(*buffer); + string id; + *buffer>>id; + get(id)->recvCreateFileHeader(*buffer); } CATCH - //! Server side: Receive a message of client annoucing calendar update - void CContext::recvUpdateCalendar(CBufferIn& buffer) + //! Server side: Receive a message of client annoucing the creation of header part of netcdf file + void CContext::recvCreateFileHeader(CBufferIn& buffer) + TRY + { + createFileHeader(); + } + CATCH_DUMP_ATTR + + //! Client side: Send a message to do some post processing on server + void CContext::sendProcessingGridOfEnabledFields() + TRY + { + // Use correct context client to send message + int nbSrvPools = (this->hasServer) ? (this->hasClient ? this->clientPrimServer.size() : 0) : 1; + for (int i = 0; i < nbSrvPools; ++i) + { + CContextClient* contextClientTmp = (0 != clientPrimServer.size()) ? clientPrimServer[i] : client; + CEventClient event(getType(),EVENT_ID_PROCESS_GRID_ENABLED_FIELDS); + + if (contextClientTmp->isServerLeader()) + { + CMessage msg; + if (hasServer) + msg<getIdServer(i); + else + msg<getIdServer(); + const std::list& ranks = contextClientTmp->getRanksServerLeader(); + for (std::list::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) + event.push(*itRank,1,msg); + contextClientTmp->sendEvent(event); + } + else contextClientTmp->sendEvent(event); + } + } + CATCH_DUMP_ATTR + + //! Server side: Receive a message to do some post processing + void CContext::recvProcessingGridOfEnabledFields(CEventServer& event) TRY { - int step; - buffer>>step; - updateCalendar(step); - if (serviceType_==CServicesManager::GATHERER) - { - sendUpdateCalendar(step); - } + CBufferIn* buffer=event.subEvents.begin()->buffer; + string id; + *buffer>>id; } - CATCH_DUMP_ATTR + CATCH - //! Client side: Send a message to create header part of netcdf file - void CContext::sendCreateFileHeader(void) + //! Client side: Send a message to do some post processing on server + void CContext::sendPostProcessing() TRY { - int nbSrvPools ; - if (serviceType_==CServicesManager::CLIENT) nbSrvPools = 1 ; - else if (serviceType_==CServicesManager::GATHERER) nbSrvPools = this->clientPrimServer.size() ; - else nbSrvPools = 0 ; - CContextClient* contextClientTmp ; - + // Use correct context client to send message + // int nbSrvPools = (hasServer) ? clientPrimServer.size() : 1; + int nbSrvPools = (this->hasServer) ? (this->hasClient ? this->clientPrimServer.size() : 0) : 1; for (int i = 0; i < nbSrvPools; ++i) { - if (serviceType_==CServicesManager::CLIENT) contextClientTmp = client ; - else if (serviceType_==CServicesManager::GATHERER ) contextClientTmp = clientPrimServer[i] ; - CEventClient event(getType(),EVENT_ID_CREATE_FILE_HEADER); - + CContextClient* contextClientTmp = (hasServer) ? clientPrimServer[i] : client; + CEventClient event(getType(),EVENT_ID_POST_PROCESS); if (contextClientTmp->isServerLeader()) { CMessage msg; + if (hasServer) + msg<getIdServer(i); + else + msg<getIdServer(); const std::list& ranks = contextClientTmp->getRanksServerLeader(); for (std::list::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) - event.push(*itRank,1,msg) ; + event.push(*itRank,1,msg); contextClientTmp->sendEvent(event); } else contextClientTmp->sendEvent(event); @@ -1775,75 +1493,212 @@ void CContext::removeAllContexts(void) } CATCH_DUMP_ATTR - //! Server side: Receive a message of client annoucing the creation of header part of netcdf file - void CContext::recvCreateFileHeader(CEventServer& event) + //! Server side: Receive a message to do some post processing + void CContext::recvPostProcessing(CEventServer& event) TRY { CBufferIn* buffer=event.subEvents.begin()->buffer; - getCurrent()->recvCreateFileHeader(*buffer); + string id; + *buffer>>id; + get(id)->recvPostProcessing(*buffer); } CATCH - //! Server side: Receive a message of client annoucing the creation of header part of netcdf file - void CContext::recvCreateFileHeader(CBufferIn& buffer) + //! Server side: Receive a message to do some post processing + void CContext::recvPostProcessing(CBufferIn& buffer) + TRY + { + CCalendarWrapper::get(CCalendarWrapper::GetDefName())->createCalendar(); + postProcessing(); + } + CATCH_DUMP_ATTR + + const StdString& CContext::getIdServer() + TRY + { + if (hasClient) + { + idServer_ = this->getId(); + idServer_ += "_server"; + return idServer_; + } + if (hasServer) return (this->getId()); + } + CATCH_DUMP_ATTR + + const StdString& CContext::getIdServer(const int i) TRY { - if (serviceType_==CServicesManager::IO_SERVER || serviceType_==CServicesManager::OUT_SERVER) - createFileHeader(); + idServer_ = this->getId(); + idServer_ += "_server_"; + idServer_ += std::to_string(static_cast(i)); + return idServer_; } CATCH_DUMP_ATTR - void CContext::createCouplerInterCommunicator(void) + /*! + \brief Do some simple post processings after parsing xml file + After the xml file (iodef.xml) is parsed, it is necessary to build all relations among + created object, e.g: inhertance among fields, domain, axis. After that, all fiels as well as their parents (reference fields), + which will be written out into netcdf files, are processed + */ + void CContext::postProcessing() TRY { - int rank=this->getIntraCommRank() ; - map> listCouplerOut ; - map> listCouplerIn ; + if (isPostProcessed) return; + + // Make sure the calendar was correctly created + if (!calendar) + ERROR("CContext::postProcessing()", << "A calendar must be defined for the context \"" << getId() << "!\"") + else if (calendar->getTimeStep() == NoneDu) + ERROR("CContext::postProcessing()", << "A timestep must be defined for the context \"" << getId() << "!\"") + // Calendar first update to set the current date equals to the start date + calendar->update(0); + + // Find all inheritance in xml structure + this->solveAllInheritance(); + +// ShowTree(info(10)); + + // Check if some axis, domains or grids are eligible to for compressed indexed output. + // Warning: This must be done after solving the inheritance and before the rest of post-processing + checkAxisDomainsGridsEligibilityForCompressedOutput(); - for(auto couplerOut : enabledCouplerOut) listCouplerOut[couplerOut->getCouplingContextId()].push_back(couplerOut) ; - for(auto couplerIn : enabledCouplerIn) listCouplerIn[couplerIn->getCouplingContextId()].push_back(couplerIn) ; + // Check if some automatic time series should be generated + // Warning: This must be done after solving the inheritance and before the rest of post-processing + + // The timeseries should only be prepared in client + if (hasClient && !hasServer) prepareTimeseries(); + + //Initialisation du vecteur 'enabledFiles' contenant la liste des fichiers à sortir. + findEnabledFiles(); + findEnabledWriteModeFiles(); + findEnabledReadModeFiles(); - CCouplerManager* couplerManager = CXios::getCouplerManager() ; - if (rank==0) + // For now, only read files with client and only one level server + // if (hasClient && !hasServer) findEnabledReadModeFiles(); + + // Find all enabled fields of each file + findAllEnabledFieldsInFiles(this->enabledWriteModeFiles); + findAllEnabledFieldsInFiles(this->enabledReadModeFiles); + + // For now, only read files with client and only one level server + // if (hasClient && !hasServer) + // findAllEnabledFieldsInFiles(this->enabledReadModeFiles); + + if (hasClient && !hasServer) { - for(auto couplerOut : listCouplerOut) couplerManager->registerCoupling(this->getContextId(),couplerOut.first) ; - for(auto couplerIn : listCouplerIn) couplerManager->registerCoupling(couplerIn.first,this->getContextId()) ; + initReadFiles(); + // Try to read attributes of fields in file then fill in corresponding grid (or domain, axis) + this->readAttributesOfEnabledFieldsInReadModeFiles(); } - do - { - for(auto couplerOut : listCouplerOut) - { - bool isNextCoupling ; - if (rank==0) isNextCoupling = couplerManager->isNextCoupling(this->getContextId(),couplerOut.first) ; - MPI_Bcast(&isNextCoupling,1,MPI_C_BOOL, 0, getIntraComm()) ; - if (isNextCoupling) - { - addCouplingChanel(couplerOut.first, true) ; - listCouplerOut.erase(couplerOut.first) ; - break ; - } - } - for(auto couplerIn : listCouplerIn) + // Only search and rebuild all reference objects of enable fields, don't transform + this->solveOnlyRefOfEnabledFields(false); + + // Search and rebuild all reference object of enabled fields, and transform + this->solveAllRefOfEnabledFieldsAndTransform(false); + + // Find all fields with read access from the public API + if (hasClient && !hasServer) findFieldsWithReadAccess(); + // and solve the all reference for them + if (hasClient && !hasServer) solveAllRefOfFieldsWithReadAccess(); + + isPostProcessed = true; + } + CATCH_DUMP_ATTR + + /*! + * Compute the required buffer size to send the attributes (mostly those grid related). + * \param maxEventSize [in/out] the size of the bigger event for each connected server + * \param [in] contextClient + * \param [in] bufferForWriting True if buffers are used for sending data for writing + This flag is only true for client and server-1 for communication with server-2 + */ + std::map CContext::getAttributesBufferSize(std::map& maxEventSize, + CContextClient* contextClient, bool bufferForWriting /*= "false"*/) + TRY + { + // As calendar attributes are sent even if there are no active files or fields, maps are initialized according the size of calendar attributes + std::map attributesSize = CCalendarWrapper::get(CCalendarWrapper::GetDefName())->getMinimumBufferSizeForAttributes(contextClient); + maxEventSize = CCalendarWrapper::get(CCalendarWrapper::GetDefName())->getMinimumBufferSizeForAttributes(contextClient); + + std::vector& fileList = this->enabledFiles; + size_t numEnabledFiles = fileList.size(); + for (size_t i = 0; i < numEnabledFiles; ++i) + { +// CFile* file = this->enabledWriteModeFiles[i]; + CFile* file = fileList[i]; + std::vector enabledFields = file->getEnabledFields(); + size_t numEnabledFields = enabledFields.size(); + for (size_t j = 0; j < numEnabledFields; ++j) { - bool isNextCoupling ; - if (rank==0) isNextCoupling = couplerManager->isNextCoupling(couplerIn.first,this->getContextId()); - MPI_Bcast(&isNextCoupling,1,MPI_C_BOOL, 0, getIntraComm()) ; - if (isNextCoupling) + const std::map mapSize = enabledFields[j]->getGridAttributesBufferSize(contextClient, bufferForWriting); + std::map::const_iterator it = mapSize.begin(), itE = mapSize.end(); + for (; it != itE; ++it) { - addCouplingChanel(couplerIn.first, false) ; - listCouplerIn.erase(couplerIn.first) ; - break ; - } + // If attributesSize[it->first] does not exist, it will be zero-initialized + // so we can use it safely without checking for its existence + if (attributesSize[it->first] < it->second) + attributesSize[it->first] = it->second; + + if (maxEventSize[it->first] < it->second) + maxEventSize[it->first] = it->second; + } } + } + return attributesSize; + } + CATCH_DUMP_ATTR + + /*! + * Compute the required buffer size to send the fields data. + * \param maxEventSize [in/out] the size of the bigger event for each connected server + * \param [in] contextClient + * \param [in] bufferForWriting True if buffers are used for sending data for writing + This flag is only true for client and server-1 for communication with server-2 + */ + std::map CContext::getDataBufferSize(std::map& maxEventSize, + CContextClient* contextClient, bool bufferForWriting /*= "false"*/) + TRY + { + std::map dataSize; - } while (!listCouplerOut.empty() || !listCouplerIn.empty()) ; + // Find all reference domain and axis of all active fields + std::vector& fileList = bufferForWriting ? this->enabledWriteModeFiles : this->enabledReadModeFiles; + size_t numEnabledFiles = fileList.size(); + for (size_t i = 0; i < numEnabledFiles; ++i) + { + CFile* file = fileList[i]; + if (file->getContextClient() == contextClient) + { + std::vector enabledFields = file->getEnabledFields(); + size_t numEnabledFields = enabledFields.size(); + for (size_t j = 0; j < numEnabledFields; ++j) + { + // const std::vector > mapSize = enabledFields[j]->getGridDataBufferSize(contextClient); + const std::map mapSize = enabledFields[j]->getGridDataBufferSize(contextClient,bufferForWriting); + std::map::const_iterator it = mapSize.begin(), itE = mapSize.end(); + for (; it != itE; ++it) + { + // If dataSize[it->first] does not exist, it will be zero-initialized + // so we can use it safely without checking for its existance + if (CXios::isOptPerformance) + dataSize[it->first] += it->second; + else if (dataSize[it->first] < it->second) + dataSize[it->first] = it->second; + if (maxEventSize[it->first] < it->second) + maxEventSize[it->first] = it->second; + } + } + } + } + return dataSize; } CATCH_DUMP_ATTR - - //! Client side: Send infomation of active files (files are enabled to write out) + //! Client side: Send infomation of active files (files are enabled to write out) void CContext::sendEnabledFiles(const std::vector& activeFiles) TRY { @@ -1877,11 +1732,32 @@ void CContext::removeAllContexts(void) } CATCH_DUMP_ATTR - + //! Client side: Check if the defined axis, domains and grids are eligible for compressed indexed output + void CContext::checkAxisDomainsGridsEligibilityForCompressedOutput() + TRY + { + if (!hasClient) return; + + const vector allAxis = CAxis::getAll(); + for (vector::const_iterator it = allAxis.begin(); it != allAxis.end(); it++) + (*it)->checkEligibilityForCompressedOutput(); + + const vector allDomains = CDomain::getAll(); + for (vector::const_iterator it = allDomains.begin(); it != allDomains.end(); it++) + (*it)->checkEligibilityForCompressedOutput(); + + const vector allGrids = CGrid::getAll(); + for (vector::const_iterator it = allGrids.begin(); it != allGrids.end(); it++) + (*it)->checkEligibilityForCompressedOutput(); + } + CATCH_DUMP_ATTR + //! Client side: Prepare the timeseries by adding the necessary files void CContext::prepareTimeseries() TRY { + if (!hasClient) return; + const std::vector allFiles = CFile::getAll(); for (size_t i = 0; i < allFiles.size(); i++) { @@ -1978,12 +1854,44 @@ void CContext::removeAllContexts(void) } CATCH_DUMP_ATTR - + //! Client side: Send information of reference grid of active fields + void CContext::sendRefGrid(const std::vector& activeFiles) + TRY + { + std::set gridIds; + int sizeFile = activeFiles.size(); + CFile* filePtr(NULL); + + // Firstly, find all reference grids of all active fields + for (int i = 0; i < sizeFile; ++i) + { + filePtr = activeFiles[i]; + std::vector enabledFields = filePtr->getEnabledFields(); + int sizeField = enabledFields.size(); + for (int numField = 0; numField < sizeField; ++numField) + { + if (0 != enabledFields[numField]->getRelGrid()) + gridIds.insert(CGrid::get(enabledFields[numField]->getRelGrid())->getId()); + } + } + + // Create all reference grids on server side + StdString gridDefRoot("grid_definition"); + CGridGroup* gridPtr = CGridGroup::get(gridDefRoot); + std::set::const_iterator it, itE = gridIds.end(); + for (it = gridIds.begin(); it != itE; ++it) + { + gridPtr->sendCreateChild(*it); + CGrid::get(*it)->sendGrid() ; + } + } + CATCH_DUMP_ATTR + //! Client side: Send information of reference domain, axis and scalar of active fields void CContext::sendRefDomainsAxisScalars(const std::vector& activeFiles) TRY { - std::set> domainIds, axisIds, scalarIds; + std::set domainIds, axisIds, scalarIds; // Find all reference domain and axis of all active fields int numEnabledFiles = activeFiles.size(); @@ -1993,11 +1901,10 @@ void CContext::removeAllContexts(void) int numEnabledFields = enabledFields.size(); for (int j = 0; j < numEnabledFields; ++j) { - CContextClient* contextClient=enabledFields[j]->getContextClient() ; const std::vector& prDomAxisScalarId = enabledFields[j]->getRefDomainAxisIds(); - if ("" != prDomAxisScalarId[0]) domainIds.insert(make_pair(prDomAxisScalarId[0],contextClient)); - if ("" != prDomAxisScalarId[1]) axisIds.insert(make_pair(prDomAxisScalarId[1],contextClient)); - if ("" != prDomAxisScalarId[2]) scalarIds.insert(make_pair(prDomAxisScalarId[2],contextClient)); + if ("" != prDomAxisScalarId[0]) domainIds.insert(prDomAxisScalarId[0]); + if ("" != prDomAxisScalarId[1]) axisIds.insert(prDomAxisScalarId[1]); + if ("" != prDomAxisScalarId[2]) scalarIds.insert(prDomAxisScalarId[2]); } } @@ -2007,50 +1914,42 @@ void CContext::removeAllContexts(void) StdString scalarDefRoot("scalar_definition"); CScalarGroup* scalarPtr = CScalarGroup::get(scalarDefRoot); - - for (auto itScalar = scalarIds.begin(); itScalar != scalarIds.end(); ++itScalar) + itE = scalarIds.end(); + for (itScalar = scalarIds.begin(); itScalar != itE; ++itScalar) { - if (!itScalar->first.empty()) + if (!itScalar->empty()) { - scalarPtr->sendCreateChild(itScalar->first,itScalar->second); - CScalar::get(itScalar->first)->sendAllAttributesToServer(itScalar->second); + scalarPtr->sendCreateChild(*itScalar); + CScalar::get(*itScalar)->sendAllAttributesToServer(); } } StdString axiDefRoot("axis_definition"); CAxisGroup* axisPtr = CAxisGroup::get(axiDefRoot); - - for (auto itAxis = axisIds.begin(); itAxis != axisIds.end(); ++itAxis) + itE = axisIds.end(); + for (itAxis = axisIds.begin(); itAxis != itE; ++itAxis) { - if (!itAxis->first.empty()) + if (!itAxis->empty()) { - axisPtr->sendCreateChild(itAxis->first, itAxis->second); - CAxis::get(itAxis->first)->sendAllAttributesToServer(itAxis->second); + axisPtr->sendCreateChild(*itAxis); + CAxis::get(*itAxis)->sendAllAttributesToServer(); } } // Create all reference domains on server side StdString domDefRoot("domain_definition"); CDomainGroup* domPtr = CDomainGroup::get(domDefRoot); - - for (auto itDom = domainIds.begin(); itDom != domainIds.end(); ++itDom) + itE = domainIds.end(); + for (itDom = domainIds.begin(); itDom != itE; ++itDom) { - if (!itDom->first.empty()) { - domPtr->sendCreateChild(itDom->first, itDom->second); - CDomain::get(itDom->first)->sendAllAttributesToServer(itDom->second); + if (!itDom->empty()) { + domPtr->sendCreateChild(*itDom); + CDomain::get(*itDom)->sendAllAttributesToServer(); } } } CATCH_DUMP_ATTR - void CContext::triggerLateFields(void) - TRY - { - for(auto& field : fileInFields_) field->triggerLateField() ; - for(auto& field : couplerInFields_) field->triggerLateField() ; - } - CATCH_DUMP_ATTR - //! Update calendar in each time step void CContext::updateCalendar(int step) TRY @@ -2059,9 +1958,9 @@ void CContext::removeAllContexts(void) if (prevStep < step) { - if (serviceType_==CServicesManager::CLIENT) // For now we only use server level 1 to read data + if (hasClient && !hasServer) // For now we only use server level 1 to read data { - triggerLateFields(); + doPreTimestepOperationsForEnabledReadModeFiles(); } info(50) << "updateCalendar : before : " << calendar->getCurrentDate() << endl; @@ -2071,7 +1970,7 @@ void CContext::removeAllContexts(void) info(50) << " Current memory used by XIOS : "<< MemTrack::getCurrentMemorySize()*1.0/(1024*1024)<<" Mbyte, at timestep "<getId()<getCurrentDate()); @@ -2102,12 +2001,10 @@ void CContext::removeAllContexts(void) TRY { vector::const_iterator it; - - //for (it=enabledFiles.begin(); it != enabledFiles.end(); it++) - for (it=enabledWriteModeFiles.begin(); it != enabledWriteModeFiles.end(); it++) - { - (*it)->initWrite(); - } + if (!hasClient && hasServer) + for (it=enabledFiles.begin(); it != enabledFiles.end(); it++) (*it)->initWrite(); + else if (hasClient && hasServer) + for (it=enabledReadModeFiles.begin(); it != enabledReadModeFiles.end(); it++) (*it)->initWrite(); } CATCH_DUMP_ATTR @@ -2155,171 +2052,57 @@ void CContext::removeAllContexts(void) } CATCH - - void CContext::sendFinalizeClient(CContextClient* contextClient, const string& contextClientId) - TRY - { - CEventClient event(getType(),EVENT_ID_CONTEXT_FINALIZE_CLIENT); - if (contextClient->isServerLeader()) - { - CMessage msg; - msg<& ranks = contextClient->getRanksServerLeader(); - for (std::list::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) - event.push(*itRank,1,msg); - contextClient->sendEvent(event); - } - else contextClient->sendEvent(event); - } - CATCH_DUMP_ATTR - - - void CContext::recvFinalizeClient(CEventServer& event) + //! Server side: Receive a message to do some post processing + void CContext::recvRegistry(CEventServer& event) TRY { CBufferIn* buffer=event.subEvents.begin()->buffer; string id; *buffer>>id; - get(id)->recvFinalizeClient(*buffer); + get(id)->recvRegistry(*buffer); } CATCH - void CContext::recvFinalizeClient(CBufferIn& buffer) + void CContext::recvRegistry(CBufferIn& buffer) TRY { - countChildContextFinalized_++ ; + if (server->intraCommRank==0) + { + CRegistry registry(server->intraComm) ; + registry.fromBuffer(buffer) ; + registryOut->mergeRegistry(registry) ; + } } CATCH_DUMP_ATTR + void CContext::sendRegistry(void) + TRY + { + registryOut->hierarchicalGatherRegistry() ; - - - //! Client side: Send a message announcing that context can receive grid definition from coupling - void CContext::sendCouplerInReady(CContextClient* client) - TRY - { - if (sendCouplerInReady_done_.count(client)!=0) return ; - else sendCouplerInReady_done_.insert(client) ; - - CEventClient event(getType(),EVENT_ID_COUPLER_IN_READY); - - if (client->isServerLeader()) - { - CMessage msg; - msg<getId(); - for (auto& rank : client->getRanksServerLeader()) event.push(rank,1,msg); - client->sendEvent(event); - } - else client->sendEvent(event); - } - CATCH_DUMP_ATTR - - //! Server side: Receive a message announcing that context can send grid definition for context coupling - void CContext::recvCouplerInReady(CEventServer& event) - TRY - { - CBufferIn* buffer=event.subEvents.begin()->buffer; - getCurrent()->recvCouplerInReady(*buffer); - } - CATCH - - //! Server side: Receive a message announcing that context can send grid definition for context coupling - void CContext::recvCouplerInReady(CBufferIn& buffer) - TRY - { - string contextId ; - buffer>>contextId; - couplerInReady_.insert(getCouplerOutClient(contextId)) ; - } - CATCH_DUMP_ATTR - - - - - - //! Client side: Send a message announcing that a coupling context have done it closeDefinition, so data can be sent now. - void CContext::sendCouplerInCloseDefinition(CContextClient* client) - TRY - { - if (sendCouplerInCloseDefinition_done_.count(client)!=0) return ; - else sendCouplerInCloseDefinition_done_.insert(client) ; - - CEventClient event(getType(),EVENT_ID_COUPLER_IN_CLOSE_DEFINITION); - - if (client->isServerLeader()) - { - CMessage msg; - msg<getId(); - for (auto& rank : client->getRanksServerLeader()) event.push(rank,1,msg); - client->sendEvent(event); - } - else client->sendEvent(event); - } - CATCH_DUMP_ATTR - - //! Server side: Receive a message announcing that a coupling context have done it closeDefinition, so data can be sent now. - void CContext::recvCouplerInCloseDefinition(CEventServer& event) - TRY - { - CBufferIn* buffer=event.subEvents.begin()->buffer; - getCurrent()->recvCouplerInCloseDefinition(*buffer); - } - CATCH - - //! Server side: Receive a message announcing that a coupling context have done it closeDefinition, so data can be sent now. - void CContext::recvCouplerInCloseDefinition(CBufferIn& buffer) - TRY - { - string contextId ; - buffer>>contextId; - couplerInCloseDefinition_.insert(getCouplerOutClient(contextId)) ; - } - CATCH_DUMP_ATTR - - - - -//! Client side: Send a message announcing that a coupling context have done it contextFinalize, so it can also close it own context. - void CContext::sendCouplerInContextFinalized(CContextClient* client) - TRY - { - if (sendCouplerInContextFinalized_done_.count(client)!=0) return ; - else sendCouplerInContextFinalized_done_.insert(client) ; - - CEventClient event(getType(),EVENT_ID_COUPLER_IN_CONTEXT_FINALIZED); - - if (client->isServerLeader()) - { - CMessage msg; - msg<getId(); - for (auto& rank : client->getRanksServerLeader()) event.push(rank,1,msg); - client->sendEvent(event); - } - else client->sendEvent(event); - } - CATCH_DUMP_ATTR - - //! Server side: Receive a message announcing that a coupling context have done it contextFinalize, so it can also close it own context. - void CContext::recvCouplerInContextFinalized(CEventServer& event) - TRY - { - CBufferIn* buffer=event.subEvents.begin()->buffer; - getCurrent()->recvCouplerInContextFinalized(*buffer); - } - CATCH - - //! Server side: Receive a message announcing that a coupling context have done it contextFinalize, so it can also close it own context. - void CContext::recvCouplerInContextFinalized(CBufferIn& buffer) - TRY - { - string contextId ; - buffer>>contextId; - couplerInContextFinalized_.insert(getCouplerOutClient(contextId)) ; - } - CATCH_DUMP_ATTR - - - + // Use correct context client to send message + int nbSrvPools = (this->hasServer) ? (this->hasClient ? this->clientPrimServer.size() : 0) : 1; + for (int i = 0; i < nbSrvPools; ++i) + { + CContextClient* contextClientTmp = (hasServer) ? clientPrimServer[i] : client; + CEventClient event(CContext::GetType(), CContext::EVENT_ID_SEND_REGISTRY); + if (contextClientTmp->isServerLeader()) + { + CMessage msg ; + if (hasServer) + msg<getIdServer(i); + else + msg<getIdServer(); + if (contextClientTmp->clientRank==0) msg<<*registryOut ; + const std::list& ranks = contextClientTmp->getRanksServerLeader(); + for (std::list::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) + event.push(*itRank,1,msg); + contextClientTmp->sendEvent(event); + } + else contextClientTmp->sendEvent(event); + } + } + CATCH_DUMP_ATTR /*! * \fn bool CContext::isFinalized(void) diff --git a/xios_2311_src/src/node/context.hpp b/xios_2311_src/src/node/context.hpp index 2974effdfb7034a4fe9c7716bab4f38b6e34e00b..bb921f8a1207986bb0ad45809762fa7d4e4ad348 100644 --- a/xios_2311_src/src/node/context.hpp +++ b/xios_2311_src/src/node/context.hpp @@ -11,13 +11,9 @@ #include "garbage_collector.hpp" #include "registry.hpp" #include "mpi.hpp" -#include "services_manager.hpp" -#include "server_context.hpp" -#include "event_scheduler.hpp" -namespace xios -{ +namespace xios { class CContextClient; class CContextServer; @@ -27,8 +23,6 @@ namespace xios class CContextAttributes; class CContext; class CFile; - class CCouplerIn ; - class CCouplerOut ; ///-------------------------------------------------------------- // Declare/Define CFileAttribute @@ -54,10 +48,9 @@ namespace xios { EVENT_ID_CLOSE_DEFINITION,EVENT_ID_UPDATE_CALENDAR, EVENT_ID_CREATE_FILE_HEADER,EVENT_ID_CONTEXT_FINALIZE, - EVENT_ID_CONTEXT_FINALIZE_CLIENT, - EVENT_ID_COUPLER_IN_READY, - EVENT_ID_COUPLER_IN_CLOSE_DEFINITION, - EVENT_ID_COUPLER_IN_CONTEXT_FINALIZED, + EVENT_ID_POST_PROCESS, EVENT_ID_SEND_REGISTRY, + EVENT_ID_POST_PROCESS_GLOBAL_ATTRIBUTES, + EVENT_ID_PROCESS_GRID_ENABLED_FIELDS }; /// typedef /// @@ -82,8 +75,6 @@ namespace xios /// Destructeur /// virtual ~CContext(void); - static void releaseStaticAllocation(void) ; - //--------------------------------------------------------- public : @@ -96,89 +87,80 @@ namespace xios public : // Initialize server or client - void init(CServerContext* parentServerContext, MPI_Comm intraComm, int serviceType); - void initClient(MPI_Comm intraComm, int serviceType); - - void initServer(MPI_Comm intraComm, int serviceType ); - void createClientInterComm(MPI_Comm interCommClient, MPI_Comm interCommServer) ; - void createServerInterComm(void) ; - + void initClient(MPI_Comm intraComm, MPI_Comm interComm, CContext* cxtServer = 0); + void initServer(MPI_Comm intraComm, MPI_Comm interComm, CContext* cxtClient = 0); bool isInitialized(void); StdString dumpClassAttributes(void); // Put sever or client into loop state - bool eventLoop(bool enableEventsProcessing=true); - bool scheduledEventLoop(bool enableEventsProcessing=true) ; - void globalEventLoop(void); + bool checkBuffersAndListen(bool enableEventsProcessing=true); // Finalize a context void finalize(void); - bool isFinalized(void); void closeDefinition(void); - // to be removed - std::vector findAllEnabledFieldsInFiles(const std::vector& activeFiles); // Some functions to process context - std::vector findAllEnabledFieldsInFileOut(const std::vector& activeFiles); - std::vector findAllEnabledFieldsInFileIn(const std::vector& activeFiles); - std::vector findAllEnabledFieldsCouplerOut(const std::vector& activeCouplerOut); - std::vector findAllEnabledFieldsCouplerIn(const std::vector& activeCouplerIn); + void findAllEnabledFieldsInFiles(const std::vector& activeFiles); // void findAllEnabledFields(void); // void findAllEnabledFieldsInReadModeFiles(void); void readAttributesOfEnabledFieldsInReadModeFiles(); void solveAllInheritance(bool apply=true); void findEnabledFiles(void); - void findEnabledCouplerIn(void); - void findEnabledCouplerOut(void); - void createCouplerInterCommunicator(void) ; void findEnabledWriteModeFiles(void); void findEnabledReadModeFiles(void); void closeAllFile(void); void updateCalendar(int step); void createFileHeader(void); void initReadFiles(void); + void checkAxisDomainsGridsEligibilityForCompressedOutput(); void prepareTimeseries(void); + void solveOnlyRefOfEnabledFields(bool sendToServer); + void buildFilterGraphOfEnabledFields(); void postProcessFilterGraph(); void startPrefetchingOfEnabledReadModeFiles(); void doPreTimestepOperationsForEnabledReadModeFiles(); void doPostTimestepOperationsForEnabledReadModeFiles(); void findFieldsWithReadAccess(void); - void triggerLateFields(void) ; - + void solveAllRefOfFieldsWithReadAccess(); + void buildFilterGraphOfFieldsWithReadAccess(); + void postProcessing(); + void postProcessingGlobalAttributes(); + + void solveAllRefOfEnabledFieldsAndTransform(bool sendToServer); + void checkGridEnabledFields(); + void checkGridEnabledFieldsInFiles(const std::vector& activeFiles); + void sendGridEnabledFieldsInFiles(const std::vector& activeFiles); + void sendGridComponentEnabledFieldsInFiles(const std::vector& activeFiles) ; + std::map getAttributesBufferSize(std::map& maxEventSize, CContextClient* contextClient, bool bufferForWriting = false); std::map getDataBufferSize(std::map& maxEventSize, CContextClient* contextClient, bool bufferForWriting = false); + void setClientServerBuffer(CContextClient* contextClient, bool bufferForWriting = false); // Distribute files (in write mode) among secondary-server pools according to the estimated data flux - void distributeFiles(const std::vector& files); - void distributeFileOverBandwith(const std::vector& files) ; - void distributeFileOverMemoryBandwith(const std::vector& files) ; + void distributeFiles(void); + void distributeFileOverBandwith() ; + void distributeFileOverMemoryBandwith() ; // Send context close definition void sendCloseDefinition(void); - public: - void sendCloseDefinition(CContextClient* client) ; - private: - set sendCloseDefinition_done_ ; - public: // There are something to send on closing context defintion void sendUpdateCalendar(int step); void sendCreateFileHeader(void); void sendEnabledFiles(const std::vector& activeFiles); void sendEnabledFieldsInFiles(const std::vector& activeFiles); void sendRefDomainsAxisScalars(const std::vector& activeFiles); + void sendRefGrid(const std::vector& activeFiles); + void sendPostProcessing(); + void sendPostProcessingGlobalAttributes(); + void sendProcessingGridOfEnabledFields(); //!< after be gathered to the root process of the context, merged registry is sent to the root process of the servers - void sendFinalizeClient(CContextClient* contextClient, const string& contextClientId); - - public: - void sendContextToFileServer(CContextClient* client) ; - private: - std::set sendToFileServer_done_ ; - - public: - std::string getContextId() {return contextId_;} + void sendRegistry(void) ; + + const StdString& getIdServer(); + const StdString& getIdServer(const int srvPoolNb); // Client side: Receive and process messages static void recvUpdateCalendar(CEventServer& event); @@ -188,38 +170,16 @@ namespace xios void recvCreateFileHeader(CBufferIn& buffer); static void recvSolveInheritanceContext(CEventServer& event); void recvSolveInheritanceContext(CBufferIn& buffer); - static void recvFinalizeClient(CEventServer& event) ; - void recvFinalizeClient(CBufferIn& buffer); - - public: - void sendCouplerInReady(CContextClient* client); - private: - set sendCouplerInReady_done_; - public: - static void recvCouplerInReady(CEventServer& event) ; - void recvCouplerInReady(CBufferIn& buffer) ; //!< coupler is ready to receive grid definition. - set couplerInReady_; - bool isCouplerInReady(CContextClient* client) { return couplerInReady_.count(client)!=0 ;} - - public: - void sendCouplerInCloseDefinition(CContextClient* client) ; - set sendCouplerInCloseDefinition_done_; - static void recvCouplerInCloseDefinition(CEventServer& event) ; - void recvCouplerInCloseDefinition(CBufferIn& buffer) ; //!< coupler has finished it defintion, data can be sent - set couplerInCloseDefinition_ ; - bool isCouplerInCloseDefinition(CContextClient* client) { return couplerInCloseDefinition_.count(client)!=0 ;} - - public: - void sendCouplerInContextFinalized(CContextClient* client) ; - set sendCouplerInContextFinalized_done_; - static void recvCouplerInContextFinalized(CEventServer& event) ; - void recvCouplerInContextFinalized(CBufferIn& buffer) ; //!< coupler has finished it defintion, data can be sent - set couplerInContextFinalized_ ; - bool isCouplerInContextFinalized(CContextClient* client) { return couplerInContextFinalized_.count(client)!=0 ;} - - public: - void freeComms(void); //!< Free internally allcoated communicators - void releaseClientBuffers(void); //! Deallocate buffers allocated by clientContexts + static void recvPostProcessing(CEventServer& event); + void recvPostProcessing(CBufferIn& buffer); + static void recvProcessingGridOfEnabledFields(CEventServer& event); + static void recvPostProcessingGlobalAttributes(CEventServer& event); + void recvPostProcessingGlobalAttributes(CBufferIn& buffer); + static void recvRegistry(CEventServer& event) ; + void recvRegistry(CBufferIn& buffer) ; //!< registry is received by the servers + + void freeComms(void); //!< Free internally allcoated communicators + void releaseClientBuffers(void); //! Deallocate buffers allocated by clientContexts // dispatch event static bool dispatchEvent(CEventServer& event); @@ -230,7 +190,7 @@ namespace xios // Get context root static CContextGroup* getRoot(void); - + // Set current context static void setCurrent(const string& id); @@ -247,9 +207,6 @@ namespace xios // Some functions to visualize structure of current context static void ShowTree(StdOStream & out = std::clog); static void CleanTree(void); - static void removeContext(const std::string& contextId); - static void removeAllContexts(void) ; - int getServiceType(void) {return serviceType_;} public : // Parse xml node and write all info into context @@ -265,14 +222,6 @@ namespace xios // Verify if all root definition in a context have children virtual bool hasChild(void) const; - bool isProcessingEvent(void) {return isProcessingEvent_;} - bool setProcessingEvent(void) {isProcessingEvent_=true ;} - bool unsetProcessingEvent(void) {isProcessingEvent_=false ;} - MPI_Comm getIntraComm(void) {return intraComm_ ;} - int getIntraCommRank(void) {return intraCommRank_;} - int getIntraCommSize(void) {return intraCommSize_;} - - void addCouplingChanel(const std::string& contextId, bool out) ; public : // Calendar of context @@ -285,16 +234,9 @@ namespace xios // List of all enabled files in write mode std::vector enabledWriteModeFiles; - std::vector enabledCouplerIn; - std::vector enabledCouplerOut; - - // List of all enabled fields whose instant data is accessible from the public API // but which are not part of a file - std::vector fieldsWithReadAccess_; - std::vector couplerInFields_; - std::vector fileInFields_; - + std::vector fieldsWithReadAccess; // Context root static std::shared_ptr root; @@ -310,60 +252,18 @@ namespace xios std::vector serverPrimServer; std::vector clientPrimServer; - // list of slave servers (IO server or others) - set slaveServers_ ; - private: - // the map containing context client associated to it string id for coupling out ; - std::map couplerOutClient_ ; - // the map containing context server associated to it string id for coupling out ; - std::map couplerOutServer_ ; - // the map containing context client associated to it string id for coupling in ; - std::map couplerInClient_ ; - // the map containing context server associated to it string id for coupling in ; - std::map couplerInServer_ ; - public: - CContextClient* getCouplerInClient(const string& contextId) { return couplerInClient_[contextId] ;} - CContextServer* getCouplerInServer(const string& contextId) { return couplerInServer_[contextId] ;} - CContextClient* getCouplerOutClient(const string& contextId) { return couplerOutClient_[contextId] ;} - CContextServer* getCouplerOutServer(const string& contextId) { return couplerOutServer_[contextId] ;} - - - std::vector primServerId_; - - CRegistry* registryIn=nullptr ; //!< input registry which is read from file - CRegistry* registryOut=nullptr ; //!< output registry which will be written into file at the finalize - - - MPI_Comm intraComm_ ; //! context intra communicator - int intraCommRank_ ; //! context intra communicator rank - int intraCommSize_ ; //! context intra communicator size - - private: - CEventScheduler* eventScheduler_ ; //! The local event scheduler for context - size_t hashId_ ; //! the local hashId for scheduler - size_t timeLine_=0 ; - void initEventScheduler(void) ; + CRegistry* registryIn ; //!< input registry which is read from file + CRegistry* registryOut ; //!< output registry which will be written into file at the finalize + private: bool isPostProcessed; bool allProcessed; bool finalized; - int countChildContextFinalized_; //!< Counter of child contexts (for now it is the number of secondary server pools) + int countChildCtx_; //!< Counter of child contexts (for now it is the number of secondary server pools) + StdString idServer_; CGarbageCollector garbageCollector; std::list comms; //!< Communicators allocated internally - int serviceType_; //!< service associated to the context - string contextId_ ; //!< context client id for the servers. For clients this is same as getId() - bool isProcessingEvent_ ; - private: - CServerContext* parentServerContext_ ; - public: - CServerContext* getParentServerContext(void) { return parentServerContext_; } - private: - bool lockedContext_=false; - public: - void lockContext(void) {lockedContext_=true; } - void unlockContext(void) {lockedContext_=false; } - bool isLockedContext(void) { return lockedContext_;} public: // Some function maybe removed in the near future // virtual void toBinary (StdOStream & os) const; // virtual void fromBinary(StdIStream & is); diff --git a/xios_2311_src/src/node/coupler_in.cpp b/xios_2311_src/src/node/coupler_in.cpp deleted file mode 100755 index 45be9d4cba220e52c7dc57df20c7c61c984dcf42..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/node/coupler_in.cpp +++ /dev/null @@ -1,187 +0,0 @@ -#include "coupler_in.hpp" -#include "attribute_template.hpp" -#include "object_template.hpp" -#include "group_template.hpp" -#include "object_factory.hpp" -#include "context.hpp" -#include "xios_spl.hpp" - -namespace xios -{ - - CCouplerIn::CCouplerIn(void) : CObjectTemplate(), CCouplerInAttributes(), - virtualFieldGroup(), enabledFields() - { - setVirtualFieldGroup(CFieldGroup::create(getId() + "_virtual_field_group")); - } - - CCouplerIn::CCouplerIn(const StdString & id) : CObjectTemplate(id), CCouplerInAttributes(), - virtualFieldGroup(), enabledFields() - { - setVirtualFieldGroup(CFieldGroup::create(getId() + "_virtual_field_group")); - } - - CCouplerIn::~CCouplerIn(void) - { /* Ne rien faire de plus */ } - - ///--------------------------------------------------------------- - //! Get name of coupler_in - StdString CCouplerIn::GetName(void) { return (StdString("coupler_in")); } - StdString CCouplerIn::GetDefName(void){ return (CCouplerIn::GetName()); } - ENodeType CCouplerIn::GetType(void) { return (eCouplerIn); } - - std::vector CCouplerIn::getEnabledFields(void) - TRY - { - if (enabledFields.empty()) - { - this->enabledFields = this->getAllFields(); - std::vector newEnabledFields; - bool enabled ; - for ( auto it = this->enabledFields.begin(); it != this->enabledFields.end(); it++ ) - { - if ((*it)->enabled.isEmpty()) enabled=true ; - else enabled=(*it)->enabled ; - if (enabled) newEnabledFields.push_back(*it); - } - enabledFields = newEnabledFields; - } - return (this->enabledFields); - } - CATCH_DUMP_ATTR - - const string& CCouplerIn::getCouplingContextId(void) - { - if (couplingContextId_.empty()) - { - vector vectStr=splitRegex(context,"::") ; - string poolId=vectStr[0] ; - string serviceId=poolId ; - string contextId=vectStr[1] ; - int contextLeader ; - int type = CServicesManager::CLIENT ; - couplingContextId_=CXios::getContextsManager()->getServerContextName(poolId, serviceId, 0, type, contextId) ; - } - return couplingContextId_ ; - } - - void CCouplerIn::createInterCommunicator(void) - TRY - { - if (context.isEmpty()) - { - ERROR("void CCouplerOut::createInterCommunicator(void)", - "The attribute must be defined to specify the target coupling context"); - } - CContext* contextPtr = CContext::getCurrent(); - contextPtr->addCouplingChanel(getCouplingContextId(), false) ; - } - CATCH_DUMP_ATTR - - - /*! - \brief Parse xml file and write information into coupler_in object - \param [in] node xmld node corresponding in xml coupler_in - */ - void CCouplerIn::parse(xml::CXMLNode & node) - TRY - { - SuperClass::parse(node); - - if (node.goToChildElement()) - { - do - { - if (node.getElementName()=="field" || node.getElementName()=="field_group") this->getVirtualFieldGroup()->parseChild(node); - } while (node.goToNextElement()); - node.goToParentElement(); - } - } - CATCH_DUMP_ATTR - - /*! - \brief Get virtual field group - In each CCouplerIn, there always exists a field group which is the ancestor of all - fields in the CCouplerIn. This is considered be virtual because it is created automatically during - CCouplerIn initialization and it normally doesn't appear on xml file - \return Pointer to field group - */ - CFieldGroup* CCouplerIn::getVirtualFieldGroup(void) const - TRY - { - return (this->virtualFieldGroup); - } - CATCH - - void CCouplerIn::solveDescInheritance(bool apply, const CAttributeMap * const parent) - TRY - { - SuperClassAttribute::setAttributes(parent,apply); - this->getVirtualFieldGroup()->solveDescInheritance(apply, NULL); - } - CATCH_DUMP_ATTR - - void CCouplerIn::solveFieldRefInheritance(bool apply) - TRY - { - // Rsolution des hritages par rfrence de chacun des champs contenus dans le fichier. - std::vector allF = this->getAllFields(); - for (unsigned int i = 0; i < allF.size(); i++) - allF[i]->solveRefInheritance(apply); - } - CATCH_DUMP_ATTR - /*! - \brief Get virtual variable group - In each CCouplerIn, there always exists a variable group which is the ancestor of all - variable in the CCouplerIn. This is considered be virtual because it is created automatically during - CCouplerIn initialization and it normally doesn't appear on xml file - \return Pointer to variable group - */ - - //! Get all fields of a file - std::vector CCouplerIn::getAllFields(void) const - TRY - { - return (this->virtualFieldGroup->getAllChildren()); - } - CATCH - - /*! - * assign the context associated to the coupler to the enabled fields - */ - void CCouplerIn::assignContext(void) - { - client_ = CContext::getCurrent()->getCouplerInClient(getCouplingContextId()); - for (auto& field : getEnabledFields()) field->setContextClient(client_) ; - } - - //---------------------------------------------------------------- - //! Change virtual field group to a new one - void CCouplerIn::setVirtualFieldGroup(CFieldGroup* newVirtualFieldGroup) - TRY - { - this->virtualFieldGroup = newVirtualFieldGroup; - } - CATCH_DUMP_ATTR - - ///-------------------------------------------------------------- - /*! - */ - StdString CCouplerIn::dumpClassAttributes(void) - { - StdString str; - CContext* context = CContext::getCurrent(); - str.append("context=\""); - str.append(context->getId()); - str.append("\""); - str.append(" enabled fields=\""); - int size = this->enabledFields.size(); - for (int i = 0; i < size; ++i) - { - str.append(this->enabledFields[i]->getId()); - str.append(" "); - } - str.append("\""); - return str; - } -} \ No newline at end of file diff --git a/xios_2311_src/src/node/coupler_in.hpp b/xios_2311_src/src/node/coupler_in.hpp deleted file mode 100755 index b047c9d9a3bbab70f8a488669a10a99e502c4ccd..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/node/coupler_in.hpp +++ /dev/null @@ -1,132 +0,0 @@ -#ifndef __XIOS_CCouplerIn__ -#define __XIOS_CCouplerIn__ - -/// XIOS headers /// -#include "xios_spl.hpp" -#include "field.hpp" -#include "declare_group.hpp" -#include "date.hpp" -#include "attribute_enum.hpp" -#include "attribute_enum_impl.hpp" -#include "context_client.hpp" -#include "mpi.hpp" -#include "string_tools.hpp" - -namespace xios -{ - - /// ////////////////////// Déclarations ////////////////////// /// - - class CCouplerInGroup; - class CCouplerInAttributes; - class CCouplerIn; - - class CGarbageCollector; - - ///-------------------------------------------------------------- - - // Declare/Define CCouplerInAttribute - BEGIN_DECLARE_ATTRIBUTE_MAP(CCouplerIn) -# include "coupler_in_attribute.conf" - END_DECLARE_ATTRIBUTE_MAP(CCouplerIn) - - ///-------------------------------------------------------------- - - /*! - \class CCouplerIn - This class corresponds to file component of the xml. - The class contains all the nessceary information to write data into a netcdf file: The most important thing - is the field(s) which will be written into file. Besides, there are some options to write - data into file, e.g: writting into only one file or multiple file; splitting a running into several files. - Moreover, there are some other attributes of netcdf file which are also stored in this class - */ - class CCouplerIn - : public CObjectTemplate - , public CCouplerInAttributes - { - /// typedef /// - typedef CObjectTemplate SuperClass; - typedef CCouplerInAttributes SuperClassAttribute; - - public : - enum EEventId - { - NO_EVENT - }; - - typedef CCouplerInAttributes RelAttributes; - typedef CCouplerInGroup RelGroup; - - /// Constructeurs /// - CCouplerIn(void); - explicit CCouplerIn(const StdString& id); - CCouplerIn(const CCouplerIn& couplerIn); // Not implemented yet. - CCouplerIn(const CCouplerIn* const couplerIn); // Not implemented yet. - - /// Destructeur /// - virtual ~CCouplerIn(void); - - public: - /// Accesseurs /// - CFieldGroup* getVirtualFieldGroup(void) const; - std::vector getAllFields(void) const; - std::vector getEnabledFields(void); - - StdString dumpClassAttributes(void); - - public : - void setVirtualFieldGroup(CFieldGroup* newVFieldGroup); - - // Add component into coupler - CField* addField(const string& id = ""); - CFieldGroup* addFieldGroup(const string& id = ""); - - public: - /// Accesseurs statiques /// - static StdString GetName(void); - static StdString GetDefName(void); - static ENodeType GetType(void); - public: - /// Traitements /// - virtual void parse(xml::CXMLNode& node); -// virtual StdString toString(void) const; - - public: - virtual void solveDescInheritance(bool apply, const CAttributeMap* const parent = 0); - void solveFieldRefInheritance(bool apply); - void createInterCommunicator(void) ; - void assignContext(void) ; - - private: - CContextClient* client_=nullptr ; - public: - CContextClient* getContextClient(void) {return client_; } - - private: - string couplingContextId_ ; - public: - const string& getCouplingContextId(void) ; - - private : - - CFieldGroup* virtualFieldGroup; - -// std::shared_ptr data_out; -// std::shared_ptr data_in; - std::vector enabledFields; - - - public: - - }; // class CCouplerIn - - ///-------------------------------------------------------------- - - // Declare/Define CCouplerInGroup and CCouplerInDefinition - DECLARE_GROUP(CCouplerIn); - - ///-------------------------------------------------------------- - -} // namespace xios - -#endif // __XIOS_CCouplingIn__ \ No newline at end of file diff --git a/xios_2311_src/src/node/coupler_out.cpp b/xios_2311_src/src/node/coupler_out.cpp deleted file mode 100755 index 41000094d94d7a51c3577e71f936197349bcd0c5..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/node/coupler_out.cpp +++ /dev/null @@ -1,204 +0,0 @@ -#include "coupler_out.hpp" -#include "attribute_template.hpp" -#include "object_template.hpp" -#include "group_template.hpp" -#include "object_factory.hpp" -#include "context.hpp" -#include "xios_spl.hpp" -#include "string_tools.hpp" -#include "contexts_manager.hpp" -#include "services_manager.hpp" - - -namespace xios -{ - - CCouplerOut::CCouplerOut(void) : CObjectTemplate(), CCouplerOutAttributes(), - virtualFieldGroup(), enabledFields() - { - setVirtualFieldGroup(CFieldGroup::create(getId() + "_virtual_field_group")); - } - - CCouplerOut::CCouplerOut(const StdString & id) : CObjectTemplate(id), CCouplerOutAttributes(), - virtualFieldGroup(), enabledFields() - { - setVirtualFieldGroup(CFieldGroup::create(getId() + "_virtual_field_group")); - } - - CCouplerOut::~CCouplerOut(void) - { /* Ne rien faire de plus */ } - - ///--------------------------------------------------------------- - //! Get name of file - StdString CCouplerOut::GetName(void) { return (StdString("coupler_out")); } - StdString CCouplerOut::GetDefName(void){ return (CCouplerOut::GetName()); } - ENodeType CCouplerOut::GetType(void) { return (eCouplerIn); } - - /*! - \brief Parse xml file and write information into coupler_in object - \param [in] node xmld node corresponding in xml coupler_in - */ - void CCouplerOut::parse(xml::CXMLNode & node) - TRY - { - SuperClass::parse(node); - - if (node.goToChildElement()) - { - do - { - if (node.getElementName()=="field" || node.getElementName()=="field_group") this->getVirtualFieldGroup()->parseChild(node); - } while (node.goToNextElement()); - node.goToParentElement(); - } - } - CATCH_DUMP_ATTR - - const string& CCouplerOut::getCouplingContextId(void) - { - if (couplingContextId_.empty()) - { - vector vectStr=splitRegex(context,"::") ; - string poolId=vectStr[0] ; - string serviceId=poolId ; - string contextId=vectStr[1] ; - int contextLeader ; - int type = CServicesManager::CLIENT ; - couplingContextId_=CXios::getContextsManager()->getServerContextName(poolId, serviceId, 0, type, contextId) ; - } - return couplingContextId_ ; - } - - std::vector CCouplerOut::getEnabledFields(void) - TRY - { - if (enabledFields.empty()) - { - this->enabledFields = this->getAllFields(); - std::vector newEnabledFields; - bool enabled ; - for ( auto it = this->enabledFields.begin(); it != this->enabledFields.end(); it++ ) - { - if ((*it)->enabled.isEmpty()) enabled=true ; - else enabled=(*it)->enabled ; - if (enabled) newEnabledFields.push_back(*it); - } - enabledFields = newEnabledFields; - } - return (this->enabledFields); - } - CATCH_DUMP_ATTR - - /*! - * assign the context associated to the coupler to the enabled fields - */ - void CCouplerOut::assignContext(void) - { - client_ = CContext::getCurrent()->getCouplerOutClient(getCouplingContextId()); - for (auto& field : getEnabledFields()) field->setContextClient(client_) ; - } - - /*! - \brief Get virtual field group - In each CCouplerIn, there always exists a field group which is the ancestor of all - fields in the CCouplerIn. This is considered be virtual because it is created automatically during - CCouplerIn initialization and it normally doesn't appear on xml file - \return Pointer to field group - */ - CFieldGroup* CCouplerOut::getVirtualFieldGroup(void) const - TRY - { - return (this->virtualFieldGroup); - } - CATCH - - - /*! - \brief Get virtual variable group - In each CCouplerIn, there always exists a variable group which is the ancestor of all - variable in the CCouplerIn. This is considered be virtual because it is created automatically during - CCouplerIn initialization and it normally doesn't appear on xml file - \return Pointer to variable group - */ - - //! Get all fields of a file - std::vector CCouplerOut::getAllFields(void) const - TRY - { - return (this->virtualFieldGroup->getAllChildren()); - } - CATCH - - void CCouplerOut::solveDescInheritance(bool apply, const CAttributeMap * const parent) - TRY - { - SuperClassAttribute::setAttributes(parent,apply); - this->getVirtualFieldGroup()->solveDescInheritance(apply, NULL); - } - CATCH_DUMP_ATTR - - void CCouplerOut::solveFieldRefInheritance(bool apply) - TRY - { - // Rsolution des hritages par rfrence de chacun des champs contenus dans le fichier. - std::vector allF = this->getAllFields(); - for (unsigned int i = 0; i < allF.size(); i++) - allF[i]->solveRefInheritance(apply); - } - CATCH_DUMP_ATTR - - void CCouplerOut::createInterCommunicator(void) - TRY - { - if (context.isEmpty()) - { - ERROR("void CCouplerOut::createInterCommunicator(void)", - "The attribute must be defined to specify the target coupling context"); - } - CContext* contextPtr = CContext::getCurrent(); - contextPtr->addCouplingChanel(getCouplingContextId(), true) ; - } - CATCH_DUMP_ATTR - - - void CCouplerOut::checkGridOfEnabledFields(void) - TRY - { - int size = this->enabledFields.size(); - for (int i = 0; i < size; ++i) - { - this->enabledFields[i]->checkGridOfEnabledFields(); - } - } - CATCH_DUMP_ATTR - - //---------------------------------------------------------------- - //! Change virtual field group to a new one - void CCouplerOut::setVirtualFieldGroup(CFieldGroup* newVirtualFieldGroup) - TRY - { - this->virtualFieldGroup = newVirtualFieldGroup; - } - CATCH_DUMP_ATTR - - ///-------------------------------------------------------------- - /*! - */ - StdString CCouplerOut::dumpClassAttributes(void) - { - StdString str; - CContext* context = CContext::getCurrent(); - str.append("context=\""); - str.append(context->getId()); - str.append("\""); - str.append(" enabled fields=\""); - int size = this->enabledFields.size(); - for (int i = 0; i < size; ++i) - { - str.append(this->enabledFields[i]->getId()); - str.append(" "); - } - str.append("\""); - return str; - } -} \ No newline at end of file diff --git a/xios_2311_src/src/node/coupler_out.hpp b/xios_2311_src/src/node/coupler_out.hpp deleted file mode 100755 index eca7e29f29967f27e88df4837a43df78517a0408..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/node/coupler_out.hpp +++ /dev/null @@ -1,126 +0,0 @@ -#ifndef __XIOS_CCouplerOut__ -#define __XIOS_CCouplerOut__ - -/// XIOS headers /// -#include "xios_spl.hpp" -#include "field.hpp" -#include "declare_group.hpp" -#include "date.hpp" -#include "attribute_enum.hpp" -#include "attribute_enum_impl.hpp" -#include "context_client.hpp" -#include "mpi.hpp" - -namespace xios -{ - - /// ////////////////////// Déclarations ////////////////////// /// - - class CCouplerOutGroup; - class CCouplerOutAttributes; - class CCouplerOut; - - class CGarbageCollector; - - ///-------------------------------------------------------------- - - // Declare/Define CCouplerOutAttribute - BEGIN_DECLARE_ATTRIBUTE_MAP(CCouplerOut) -# include "coupler_out_attribute.conf" - END_DECLARE_ATTRIBUTE_MAP(CCouplerOut) - - ///-------------------------------------------------------------- - - /*! - \class CCouplerOut - - */ - class CCouplerOut - : public CObjectTemplate - , public CCouplerOutAttributes - { - /// typedef /// - typedef CObjectTemplate SuperClass; - typedef CCouplerOutAttributes SuperClassAttribute; - - public : - enum EEventId - { - NO_EVENT - }; - - typedef CCouplerOutAttributes RelAttributes; - typedef CCouplerOutGroup RelGroup; - - /// Constructeurs /// - CCouplerOut(void); - explicit CCouplerOut(const StdString& id); - CCouplerOut(const CCouplerOut& couplerOut); // Not implemented yet. - CCouplerOut(const CCouplerOut* const couplerOut); // Not implemented yet. - - /// Destructeur /// - virtual ~CCouplerOut(void); - - public: - /// Accesseurs /// - CFieldGroup* getVirtualFieldGroup(void) const; - std::vector getAllFields(void) const; - std::vector getEnabledFields(void); - - StdString dumpClassAttributes(void); - - public : - void setVirtualFieldGroup(CFieldGroup* newVFieldGroup); - - // Add component into coupler - CField* addField(const string& id = ""); - CFieldGroup* addFieldGroup(const string& id = ""); - - public: - /// Accesseurs statiques /// - static StdString GetName(void); - static StdString GetDefName(void); - static ENodeType GetType(void); - public: - /// Traitements /// - virtual void parse(xml::CXMLNode& node); -// virtual StdString toString(void) const; - - public: - virtual void solveDescInheritance(bool apply, const CAttributeMap* const parent = 0); - void solveFieldRefInheritance(bool apply); - void createInterCommunicator(void) ; - void checkGridOfEnabledFields(void) ; - void assignContext(void) ; - private: - // the contextClient associated to the context Id attribute - CContextClient* client_=nullptr ; - public: - CContextClient* getContextClient(void) {return client_; } - - private: - string couplingContextId_ ; - public: - const string& getCouplingContextId(void) ; - private: - CFieldGroup* virtualFieldGroup; - -// std::shared_ptr data_out; -// std::shared_ptr data_in; - std::vector enabledFields; - - - public: - - }; // class CCouplerOut - - ///-------------------------------------------------------------- - - // Declare/Define CFileGroup and CFileDefinition - DECLARE_GROUP(CCouplerOut); - - ///-------------------------------------------------------------- - -} // namespace xios - -#endif // __XIOS_CCouplingIn__2 \ No newline at end of file diff --git a/xios_2311_src/src/node/domain.cpp b/xios_2311_src/src/node/domain.cpp index a6add8fff5f80218526162eceaf192aa8e55a16a..05fcbf70c117b9ecdfabf46ab991bf5bf0175854 100755 --- a/xios_2311_src/src/node/domain.cpp +++ b/xios_2311_src/src/node/domain.cpp @@ -1,4 +1,5 @@ #include "domain.hpp" + #include "attribute_template.hpp" #include "object_template.hpp" #include "group_template.hpp" @@ -16,19 +17,8 @@ #include "distribution_client.hpp" #include "server_distribution_description.hpp" #include "client_server_mapping_distributed.hpp" -#include "local_connector.hpp" -#include "grid_local_connector.hpp" -#include "remote_connector.hpp" -#include "gatherer_connector.hpp" -#include "scatterer_connector.hpp" -#include "grid_scatterer_connector.hpp" -#include "grid_gatherer_connector.hpp" -#include "transformation_path.hpp" -#include "grid_transformation_factory_impl.hpp" #include -#include - namespace xios { @@ -36,25 +26,29 @@ namespace xios { CDomain::CDomain(void) : CObjectTemplate(), CDomainAttributes() - , isChecked(false), relFiles(), indSrv_(), connectedServerRank_() + , isChecked(false), relFiles(), isClientChecked(false), nbSenders(), indSrv_(), connectedServerRank_() , hasBounds(false), hasArea(false), isCompressible_(false), isUnstructed_(false) - , hasLonLat(false) + , isClientAfterTransformationChecked(false), hasLonLat(false) , isRedistributed_(false), hasPole(false) , lonvalue(), latvalue(), bounds_lonvalue(), bounds_latvalue() + , globalLocalIndexMap_(), computedWrittenIndex_(false) , clients(), hasLatInReadFile_(false), hasBoundsLatInReadFile_(false) , hasLonInReadFile_(false), hasBoundsLonInReadFile_(false) + , isTiled_(false), isTiledOnly_(false) { } CDomain::CDomain(const StdString & id) : CObjectTemplate(id), CDomainAttributes() - , isChecked(false), relFiles(), indSrv_(), connectedServerRank_() + , isChecked(false), relFiles(), isClientChecked(false), nbSenders(), indSrv_(), connectedServerRank_() , hasBounds(false), hasArea(false), isCompressible_(false), isUnstructed_(false) - , hasLonLat(false) + , isClientAfterTransformationChecked(false), hasLonLat(false) , isRedistributed_(false), hasPole(false) , lonvalue(), latvalue(), bounds_lonvalue(), bounds_latvalue() + , globalLocalIndexMap_(), computedWrittenIndex_(false) , clients(), hasLatInReadFile_(false), hasBoundsLatInReadFile_(false) , hasLonInReadFile_(false), hasBoundsLonInReadFile_(false) + , isTiled_(false), isTiledOnly_(false) { } @@ -62,12 +56,6 @@ namespace xios { { } - void CDomain::releaseStaticAllocation(void) - { - transformationMapList_.clear() ; - CTransformation::unregisterAllTransformations() ; - CGridTransformationFactory::unregisterAllTransformations() ; - } ///--------------------------------------------------------------- void CDomain::assignMesh(const StdString meshName, const int nvertex) @@ -85,59 +73,80 @@ namespace xios { } CATCH - CDomain* CDomain::get(const string& id, bool noError) + std::map CDomain::transformationMapList_ = std::map(); + bool CDomain::_dummyTransformationMapList = CDomain::initializeTransformationMap(CDomain::transformationMapList_); + + bool CDomain::initializeTransformationMap(std::map& m) + TRY { - const regex r("::"); - smatch m; - if (regex_search(id, m, r)) - { - if (m.size()!=1) ERROR("CDomain* CDomain::get(string& id)", <<" id = "< bad format id, separator :: append more than one time"); - string fieldId=m.prefix() ; - if (fieldId.empty()) ERROR("CDomain* CDomain::get(string& id)", <<" id = "< bad format id, field name is empty"); - string suffix=m.suffix() ; - if (!CField::has(fieldId)) - if (noError) return nullptr ; - else ERROR("CDomain* CDomain::get(string& id)", <<" id = "< field Id : < "< doesn't exist"); - CField* field=CField::get(fieldId) ; - return field->getAssociatedDomain(suffix, noError) ; - } - else - { - if (noError) if(!CObjectFactory::HasObject(id)) return nullptr ; - return CObjectFactory::GetObject(id).get(); - } + m["zoom_domain"] = TRANS_ZOOM_DOMAIN; + m["interpolate_domain"] = TRANS_INTERPOLATE_DOMAIN; + m["generate_rectilinear_domain"] = TRANS_GENERATE_RECTILINEAR_DOMAIN; + m["compute_connectivity_domain"] = TRANS_COMPUTE_CONNECTIVITY_DOMAIN; + m["expand_domain"] = TRANS_EXPAND_DOMAIN; + m["reorder_domain"] = TRANS_REORDER_DOMAIN; + m["extract_domain"] = TRANS_EXTRACT_DOMAIN; + + return true ; } + CATCH - bool CDomain::has(const string& id) + const std::set & CDomain::getRelFiles(void) const + TRY { - if (CDomain::get(id,true)==nullptr) return false ; - else return true ; + return (this->relFiles); } - - CField* CDomain::getFieldFromId(const string& id) + CATCH + + /*! + Returns the number of indexes written by each server. + \return the number of indexes written by each server + */ + int CDomain::getNumberWrittenIndexes(MPI_Comm writtenCom) + TRY { - const regex r("::"); - smatch m; - if (regex_search(id, m, r)) - { - if (m.size()!=1) ERROR("CField* CDomain::getFieldFromId(const string& id)", <<" id = "< bad format id, separator :: append more than one time"); - string fieldId=m.prefix() ; - if (fieldId.empty()) ERROR("CField* CDomain::getFieldFromId(const string& id)", <<" id = "< bad format id, field name is empty"); - string suffix=m.suffix() ; - CField* field=CField::get(fieldId) ; - return field ; - } - else return nullptr; + int writtenSize; + MPI_Comm_size(writtenCom, &writtenSize); + return numberWrittenIndexes_[writtenSize]; } + CATCH_DUMP_ATTR - const std::set & CDomain::getRelFiles(void) const + /*! + Returns the total number of indexes written by the servers. + \return the total number of indexes written by the servers + */ + int CDomain::getTotalNumberWrittenIndexes(MPI_Comm writtenCom) TRY { - return (this->relFiles); + int writtenSize; + MPI_Comm_size(writtenCom, &writtenSize); + return totalNumberWrittenIndexes_[writtenSize]; } - CATCH + CATCH_DUMP_ATTR + + /*! + Returns the offset of indexes written by each server. + \return the offset of indexes written by each server + */ + int CDomain::getOffsetWrittenIndexes(MPI_Comm writtenCom) + TRY + { + int writtenSize; + MPI_Comm_size(writtenCom, &writtenSize); + return offsetWrittenIndexes_[writtenSize]; + } + CATCH_DUMP_ATTR + + CArray& CDomain::getCompressedIndexToWriteOnServer(MPI_Comm writtenCom) + TRY + { + int writtenSize; + MPI_Comm_size(writtenCom, &writtenSize); + return compressedIndexToWriteOnServer[writtenSize]; + } + CATCH_DUMP_ATTR - //---------------------------------------------------------------- + //---------------------------------------------------------------- /*! * Compute the minimum buffer size required to send the attributes to the server(s). @@ -221,7 +230,7 @@ namespace xios { bool distributed = !((!ni.isEmpty() && (ni == ni_glo) && !nj.isEmpty() && (nj == nj_glo)) || (!i_index.isEmpty() && i_index.numElements() == ni_glo*nj_glo)); bool distributed_glo ; - distributed |= (1 == CContext::getCurrent()->intraCommSize_); + distributed |= (1 == CContext::getCurrent()->client->clientSize); return distributed; } @@ -230,21 +239,44 @@ namespace xios { //---------------------------------------------------------------- /*! - * Compute if the domain can be ouput in a compressed way. - * In this case the workflow view on server side must be the same - * than the full view for all context rank. The result is stored on - * internal isCompressible_ attribute. + * Test whether the data defined on the domain can be outputted in a compressed way. + * + * \return true if and only if a mask was defined for this domain */ - void CDomain::computeIsCompressible(void) + bool CDomain::isCompressible(void) const + TRY + { + return isCompressible_; + } + CATCH + + bool CDomain::isTiled(void) const TRY { - // mesh is compressible contains some masked or indexed value, ie if full view is different of workflow view. - // But now assume that the size of the 2 view must be equal for everybody. True on server side - int isSameView = getLocalView(CElementView::FULL)->getSize() == getLocalView(CElementView::WORKFLOW)->getSize(); - MPI_Allreduce(MPI_IN_PLACE, &isSameView, 1, MPI_INT, MPI_LAND, CContext::getCurrent()->getIntraComm()) ; - if (isSameView) isCompressible_ = false ; - else isCompressible_ = true ; - isCompressibleComputed_=true ; + return isTiled_; + } + CATCH + + bool CDomain::isTiledOnly(void) const + TRY + { + return isTiledOnly_; + } + CATCH + + int CDomain::getTileId(int i, int j) const + TRY + { + int tileId = 0; + bool stop = false; + while (!stop) + { + if ((i >= tile_ibegin(tileId) ) && (i < tile_ni(tileId)+tile_ibegin(tileId) ) + && (j >= tile_jbegin(tileId) ) && (j < tile_nj(tileId)+tile_jbegin(tileId) ) ) + stop = true; + ++tileId; + } + return (tileId - 1); } CATCH @@ -303,8 +335,8 @@ namespace xios { CContext* context = CContext::getCurrent(); // For now the assumption is that secondary server pools consist of the same number of procs. // CHANGE the line below if the assumption changes. - - int rankClient = context->intraCommRank_; + CContextClient* client = (0 != context->clientPrimServer.size()) ? context->clientPrimServer[0] : context->client; + int rankClient = client->clientRank; int rankOnDomain = rankClient%nbLocalDomain; if (ni_glo.isEmpty() || ni_glo <= 0 ) @@ -681,27 +713,27 @@ namespace xios { CContext* context = CContext::getCurrent(); // For now the assumption is that secondary server pools consist of the same number of procs. // CHANGE the line below if the assumption changes. - int clientSize = context->intraCommSize_ ; + CContextClient* client = (0 != context->clientPrimServer.size()) ? context->clientPrimServer[0] : context->client; lon_g.resize(ni_glo) ; lat_g.resize(nj_glo) ; - int* ibegin_g = new int[clientSize] ; - int* jbegin_g = new int[clientSize] ; - int* ni_g = new int[clientSize] ; - int* nj_g = new int[clientSize] ; + int* ibegin_g = new int[client->clientSize] ; + int* jbegin_g = new int[client->clientSize] ; + int* ni_g = new int[client->clientSize] ; + int* nj_g = new int[client->clientSize] ; int v ; v=ibegin ; - MPI_Allgather(&v,1,MPI_INT,ibegin_g,1,MPI_INT,context->intraComm_) ; + MPI_Allgather(&v,1,MPI_INT,ibegin_g,1,MPI_INT,client->intraComm) ; v=jbegin ; - MPI_Allgather(&v,1,MPI_INT,jbegin_g,1,MPI_INT,context->intraComm_) ; + MPI_Allgather(&v,1,MPI_INT,jbegin_g,1,MPI_INT,client->intraComm) ; v=ni ; - MPI_Allgather(&v,1,MPI_INT,ni_g,1,MPI_INT,context->intraComm_) ; + MPI_Allgather(&v,1,MPI_INT,ni_g,1,MPI_INT,client->intraComm) ; v=nj ; - MPI_Allgather(&v,1,MPI_INT,nj_g,1,MPI_INT,context->intraComm_) ; + MPI_Allgather(&v,1,MPI_INT,nj_g,1,MPI_INT,client->intraComm) ; - MPI_Allgatherv(lon.dataFirst(),ni,MPI_DOUBLE,lon_g.dataFirst(),ni_g, ibegin_g,MPI_DOUBLE,context->intraComm_) ; - MPI_Allgatherv(lat.dataFirst(),nj,MPI_DOUBLE,lat_g.dataFirst(),nj_g, jbegin_g,MPI_DOUBLE,context->intraComm_) ; + MPI_Allgatherv(lon.dataFirst(),ni,MPI_DOUBLE,lon_g.dataFirst(),ni_g, ibegin_g,MPI_DOUBLE,client->intraComm) ; + MPI_Allgatherv(lat.dataFirst(),nj,MPI_DOUBLE,lat_g.dataFirst(),nj_g, jbegin_g,MPI_DOUBLE,client->intraComm) ; delete[] ibegin_g ; delete[] jbegin_g ; @@ -855,15 +887,12 @@ namespace xios { nj_glo = 1; nj = 1; jbegin = 0; - if (!i_index.isEmpty()) - { - ni = i_index.numElements(); - j_index.resize(ni); - for(int i=0;i to be checked why is it transposed + if (!area.isEmpty()) + area.transposeSelf(1, 0); } if (ni_glo.isEmpty()) @@ -951,13 +980,8 @@ namespace xios { if (i_index(idx) < minIndex) minIndex = i_index(idx); if (i_index(idx) > maxIndex) maxIndex = i_index(idx); } - if (i_index.numElements()) { - ni = maxIndex - minIndex + 1; - minIIndex = minIndex; - } - else { - ni = 0; - } + ni = maxIndex - minIndex + 1; + minIIndex = minIIndex; } // It's not so correct but if ibegin is not the first value of i_index @@ -1018,12 +1042,8 @@ namespace xios { if (j_index(idx) < minIndex) minIndex = j_index(idx); if (j_index(idx) > maxIndex) maxIndex = j_index(idx); } - if (j_index.numElements()) { - nj = maxIndex - minIndex + 1; - minJIndex = minIndex; - } - else - nj = 0; + nj = maxIndex - minIndex + 1; + minJIndex = minIndex; } // It's the same as checkLocalIDomain. It's not so correct but if jbegin is not the first value of j_index // then data on local domain has user-defined distribution. In this case, jbegin has no meaning. @@ -1175,7 +1195,7 @@ namespace xios { if (i>=0 && i=0 && j=0 && i < domainMask.size()) { - if ( (i<0)||(!domainMask(i)) ) - data_i_index(k) = -1; - else + if (domainMask(i)) data_i_index(k) = k; + else + data_i_index(k) = -1; } else data_i_index(k) = -1; @@ -1251,15 +1271,15 @@ namespace xios { ind=j*ni+i ; if (i>=0 && i=0 && j& dataIndexI, CArray& dataIndexJ, + CArray& infoIndexI, CArray& infoIndexJ) + TRY + { + const int dsize = ni * nj; + dataIndexI.resize(dsize); + dataIndexJ.resize(dsize); + + dataIndexJ = 0; + for (int k = 0; k < ni * nj; ++k) + dataIndexI(k) = k; + + infoIndexI.resize(ni*nj); + for (int j = 0; j < nj; ++j) + for (int i = 0; i < ni; ++i) infoIndexI(i+j*ni) = i+ibegin; + + infoIndexJ.resize(ni*nj); + for (int j = 0; j < nj; ++j) + for (int i = 0; i < ni; ++i) infoIndexJ(i+j*ni) = j+jbegin; + } + CATCH_DUMP_ATTR + //---------------------------------------------------------------- void CDomain::computeLocalMask(void) TRY @@ -1310,6 +1363,13 @@ namespace xios { } CATCH_DUMP_ATTR + void CDomain::checkEligibilityForCompressedOutput(void) + TRY + { + // We don't check if the mask or the indexes are valid here, just if they have been defined at this point. + isCompressible_ = !mask_1d.isEmpty() || !mask_2d.isEmpty() || !data_i_index.isEmpty(); + } + CATCH_DUMP_ATTR //---------------------------------------------------------------- @@ -1727,579 +1787,1220 @@ namespace xios { } CATCH_DUMP_ATTR - void CDomain::checkAttributes(void) + //---------------------------------------------------------------- + void CDomain::checkTiles() TRY { - if (this->checkAttributes_done_) return; - this->checkDomain(); - this->checkLonLat(); - this->checkBounds(); - this->checkArea(); - this->checkMask(); - this->checkDomainData(); - this->checkCompression(); - this->computeLocalMask() ; - this->completeLonLatClient(); - this->initializeLocalElement() ; - this->addFullView() ; // probably do not automatically add View, but only if requested - this->addWorkflowView() ; // probably do not automatically add View, but only if requested - this->addModelView() ; // probably do not automatically add View, but only if requested - // testing ? - /* - shared_ptr local = localElement_->getView(CElementView::WORKFLOW) ; - shared_ptr model = localElement_->getView(CElementView::MODEL) ; - - CLocalConnector test1(model, local) ; - test1.computeConnector() ; - CLocalConnector test2(local, model) ; - test2.computeConnector() ; - CGridLocalConnector gridTest1(vector{&test1}) ; - CGridLocalConnector gridTest2(vector{&test2}) ; - - - CArray out1 ; - CArray out2 ; - test1.transfer(data_i_index,out1,-111) ; - test2.transfer(out1,out2,-111) ; - - out1 = 0 ; - out2 = 0 ; - gridTest1.transfer(data_i_index,out1,-111) ; - gridTest2.transfer(out1, out2,-111) ; - */ - this->checkAttributes_done_ = true; + if (!ntiles.isEmpty() && ntiles.getValue() >=1) isTiled_ = true; + if (!tile_only.isEmpty() && tile_only.getValue() == true) { + isTiled_ = true; + isTiledOnly_ = true; + } + + if (isTiled_) + { + + // Attributes tile_ni/nj and tile_i/jbegin are mandatory for tiled domains + if (tile_ni.numElements() != ntiles || tile_ibegin.numElements() != ntiles) + ERROR("CDomain::checkTiles()", + << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " + << "'tile_ni' or 'tile_ibegin' are ill defined: these attributes must be specified for tiled domains and be of the size 'ntiles'." << std::endl + << "The number of tiles is " << ntiles.getValue() << " while the size of 'tile_ni' is " << tile_ni.numElements() + << " and the size of 'tile_ibegin' is " << tile_ibegin.numElements() << "."); + + if (tile_nj.numElements() != ntiles || tile_jbegin.numElements() != ntiles) + ERROR("CDomain::checkTiles()", + << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " + << "'tile_nj' or 'tile_jbegin' are ill defined: these attributes must be specified for tiled domains and be of the size 'ntiles'." << std::endl + << "The number of tiles is " << ntiles.getValue() << " while the size of 'tile_nj' is " << tile_nj.numElements() + << " and the size of 'tile_jbegin' is " << tile_jbegin.numElements() << "."); + + // Check on consistency of individual tile sizes and local domain size + int sizeTiles = 0; + for (int iTile = 0; iTile < ntiles.getValue(); ++iTile) + { + sizeTiles += tile_ni(iTile) * tile_nj(iTile); + } + if (sizeTiles != (ni*nj)) + ERROR("CDomain::checkTiles()", + << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " + << "tiles should cover the entire local domain and cannot overlap." << std::endl << "."); + + + // Fill in tile_data_ni/nj and tile_data_i/jbegin if they are not specified + if (tile_data_ni.numElements() == 0 || tile_data_nj.numElements() == 0) + { + tile_data_ni.resize(ntiles); + tile_data_nj.resize(ntiles); + for (int iTile = 0; iTile < ntiles.getValue(); ++iTile) + { + tile_data_ni(iTile) = tile_ni(iTile); + tile_data_nj(iTile) = tile_nj(iTile); + } + } + + if (tile_data_ibegin.numElements() == 0 || tile_data_jbegin.numElements() == 0) + { + tile_data_ibegin.resize(ntiles); + tile_data_jbegin.resize(ntiles); + tile_data_ibegin = 0; + tile_data_jbegin = 0; + } + + } // isTiled_ } CATCH_DUMP_ATTR + //---------------------------------------------------------------- + int CDomain::getTileDataISize(int tileId) const + TRY + { + int retvalue = (tile_data_ni(tileId) > tile_ni(tileId)) ? tile_data_ni(tileId) : tile_ni(tileId); + return retvalue; + } + CATCH - void CDomain::initializeLocalElement(void) + //---------------------------------------------------------------- + int CDomain::getTileDataJSize(int tileId) const + TRY { - // after checkDomain i_index and j_index of size (ni*nj) - int nij = ni*nj ; - CArray ij_index(ni*nj) ; - for(int ij=0; ijgetIntraCommRank() ; - localElement_ = make_shared(rank, ni_glo*nj_glo, ij_index) ; + int retvalue = (tile_data_nj(tileId) > tile_nj(tileId)) ? tile_data_nj(tileId) : tile_nj(tileId); + return retvalue; } + CATCH - void CDomain::addFullView(void) + void CDomain::checkAttributesOnClientAfterTransformation() + TRY { - CArray index(ni*nj) ; - int nij=ni*nj ; - for(int ij=0; ij addView(CElementView::FULL, index) ; + CContext* context=CContext::getCurrent() ; + + if (this->isClientAfterTransformationChecked) return; + if (context->hasClient) + { + this->computeConnectedClients(); + if (hasLonLat) + if (!context->hasServer) + this->completeLonLatClient(); + } + + this->isClientAfterTransformationChecked = true; } + CATCH_DUMP_ATTR - void CDomain::addWorkflowView(void) + //---------------------------------------------------------------- + // Divide function checkAttributes into 2 seperate ones + // This function only checks all attributes of current domain + void CDomain::checkAttributesOnClient() + TRY { - // information for workflow view is stored in localMask - int nij=ni*nj ; - int nMask=0 ; - for(int ij=0; ij index(nMask) ; - - nMask=0 ; - for(int ij=0; ijisClientChecked) return; + CContext* context=CContext::getCurrent(); + + if (context->hasClient && !context->hasServer) { - index(nMask)=ij ; - nMask++ ; + this->checkDomain(); + this->checkBounds(); + this->checkArea(); + this->checkLonLat(); + this->checkTiles(); + } + + if (context->hasClient && !context->hasServer) + { // Ct client uniquement + this->checkMask(); + this->checkDomainData(); + this->checkCompression(); + this->computeLocalMask() ; + } + else + { // Ct serveur uniquement } - localElement_ -> addView(CElementView::WORKFLOW, index) ; + + this->isClientChecked = true; } + CATCH_DUMP_ATTR - void CDomain::addModelView(void) + // Send all checked attributes to server + void CDomain::sendCheckedAttributes() + TRY { - // information for model view is stored in data_i_index/data_j_index - // very weird, do not mix data_i_index and data_i_begin => in future only keep data_i_index - int dataSize = data_i_index.numElements() ; - CArray index(dataSize) ; - int i,j ; - for(int k=0;kisClientChecked) checkAttributesOnClient(); + if (!this->isClientAfterTransformationChecked) checkAttributesOnClientAfterTransformation(); + CContext* context=CContext::getCurrent() ; + + if (this->isChecked) return; + if (context->hasClient) { - if (data_dim==2) - { - i=data_i_index(k)+data_ibegin ; // bad - j=data_j_index(k)+data_jbegin ; // bad - if (i>=0 && i=0 && j=0 && iaddView(CElementView::MODEL, index) ; - } - - void CDomain::computeModelToWorkflowConnector(void) - { - shared_ptr srcView=getLocalView(CElementView::MODEL) ; - shared_ptr dstView=getLocalView(CElementView::WORKFLOW) ; - modelToWorkflowConnector_ = make_shared(srcView, dstView); - modelToWorkflowConnector_->computeConnector() ; + this->isChecked = true; } + CATCH_DUMP_ATTR + void CDomain::checkAttributes(void) + TRY + { + if (this->isChecked) return; + CContext* context=CContext::getCurrent() ; - string CDomain::getCouplingAlias(const string& fieldId, int posInGrid) - { - return "_domain["+std::to_string(posInGrid)+"]_of_"+fieldId ; - } - - /* to be removed later when coupling will be reimplemented, just to not forget */ - void CDomain::sendDomainToCouplerOut(CContextClient* client, const string& fieldId, int posInGrid) - { - if (sendDomainToFileServer_done_.count(client)!=0) return ; - else sendDomainToFileServer_done_.insert(client) ; - - const string domainId = getCouplingAlias(fieldId, posInGrid) ; - - if (!domain_ref.isEmpty()) - { - auto domain_ref_tmp=domain_ref.getValue() ; - domain_ref.reset() ; // remove the reference, find an other way to do that more cleanly - this->sendAllAttributesToServer(client, domainId) ; - domain_ref = domain_ref_tmp ; - } - else this->sendAllAttributesToServer(client, domainId) ; - } + this->checkDomain(); + this->checkLonLat(); + this->checkBounds(); + this->checkArea(); + + if (context->hasClient) + { // Ct client uniquement + this->checkMask(); + this->checkDomainData(); + this->checkCompression(); + this->computeLocalMask() ; + } + else + { // Ct serveur uniquement + } + if (context->hasClient) + { + this->computeConnectedClients(); + this->completeLonLatClient(); + } + this->isChecked = true; + } + CATCH_DUMP_ATTR - void CDomain::makeAliasForCoupling(const string& fieldId, int posInGrid) - { - const string domainId = getCouplingAlias(fieldId, posInGrid); - this->createAlias(domainId) ; - } + void CDomain::initLonLatValue(void) + TRY + { + CContext* context=CContext::getCurrent() ; + if (context->hasClient) + { + this->completeLonLatClient(); + } - void CDomain::computeRemoteElement(CContextClient* client, EDistributionType distType) + } + CATCH_DUMP_ATTR + /*! + Compute the connection of a client to other clients to determine which clients to send attributes to. + The sending clients are supposed to already know the distribution of receiving clients (In simple cases, it's band) + The connection among clients is calculated by using global index. + A client connects to other clients which holds the same global index as it. + */ + void CDomain::computeConnectedClients() TRY { - CContext* context = CContext::getCurrent(); - map> globalIndex ; -/* old method - if (type==EDistributionType::BANDS) // Bands distribution to send to file server - { - int nbServer = client->serverSize; - std::vector nGlobDomain(2); - nGlobDomain[0] = this->ni_glo; - nGlobDomain[1] = this->nj_glo; + CContext* context=CContext::getCurrent() ; + + // This line should be changed soon. + int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 0) : 1; - // to be changed in future, need to rewrite more simply domain distribution - CServerDistributionDescription serverDescription(nGlobDomain, nbServer); - int distributedPosition ; - if (isUnstructed_) distributedPosition = 0 ; - else distributedPosition = 1 ; - - std::vector > serverIndexBegin = serverDescription.getServerIndexBegin(); - std::vector > serverDimensionSizes = serverDescription.getServerDimensionSizes(); - vector>> indexServerOnElement ; - CArray axisDomainOrder(1) ; axisDomainOrder(0)=2 ; - auto zeroIndex=serverDescription.computeServerGlobalByElement(indexServerOnElement, context->getIntraCommRank(), context->getIntraCommSize(), - axisDomainOrder,distributedPosition) ; - // distribution is very bad => to redo - // convert indexServerOnElement => map> - need to be changed later - map> vectGlobalIndex ; - for(auto& indexRanks : indexServerOnElement[0]) - { - size_t index=indexRanks.first ; - auto& ranks=indexRanks.second ; - for(int rank : ranks) vectGlobalIndex[rank].push_back(index) ; - } - for(auto& vect : vectGlobalIndex ) globalIndex.emplace(vect.first, CArray(vect.second.data(), shape(vect.second.size()),duplicateData)) ; - // some servers receves no index (zeroIndex array) => root process take them into account. - if (context->getIntraCommRank()==0) - for(auto& rank : zeroIndex) globalIndex[rank] = CArray() ; - } -*/ - if (distType==EDistributionType::BANDS && isUnstructed_) distType=EDistributionType::COLUMNS ; + nbSenders.clear(); + connectedServerRank_.clear(); - if (distType==EDistributionType::BANDS) // Bands distribution to send to file server + for (int p = 0; p < nbSrvPools; ++p) { + CContextClient* client = (0 != context->clientPrimServer.size()) ? context->clientPrimServer[p] : context->client; int nbServer = client->serverSize; - int nbClient = client->clientSize ; - int rankClient = client->clientRank ; - int size = nbServer / nbClient ; - int start ; - if (nbServer%nbClient > rankClient) + int nbClient = client->clientSize; + int rank = client->clientRank; + bool doComputeGlobalIndexServer = true; + + if (connectedServerRank_.find(nbServer) == connectedServerRank_.end()) { - start = (size+1) * rankClient ; - size++ ; - } - else start = size*rankClient + nbServer%nbClient ; - - for(int i=0; i rank) + + if (indSrv_.find(nbServer) == indSrv_.end()) { - indStart = (indSize+1) * rank ; - indSize++ ; + int i,j,i_ind,j_ind, nbIndex=i_index.numElements(); + int globalIndexCount = i_index.numElements(); + // Fill in index + CArray globalIndexDomain(nbIndex); + size_t globalIndex; + + for (i = 0; i < nbIndex; ++i) + { + i_ind=i_index(i); + j_ind=j_index(i); + globalIndex = i_ind + j_ind * ni_glo; + globalIndexDomain(i) = globalIndex; + } + + if (globalLocalIndexMap_.empty()) + { + for (i = 0; i < nbIndex; ++i) + globalLocalIndexMap_[globalIndexDomain(i)] = i; + } + + size_t globalSizeIndex = 1, indexBegin, indexEnd; + int range, clientSize = client->clientSize; + std::vector nGlobDomain(2); + nGlobDomain[0] = this->ni_glo; + nGlobDomain[1] = this->nj_glo; + for (int i = 0; i < nGlobDomain.size(); ++i) globalSizeIndex *= nGlobDomain[i]; + indexBegin = 0; + if (globalSizeIndex <= clientSize) + { + indexBegin = rank%globalSizeIndex; + indexEnd = indexBegin; + } + else + { + for (int i = 0; i < clientSize; ++i) + { + range = globalSizeIndex / clientSize; + if (i < (globalSizeIndex%clientSize)) ++range; + if (i == client->clientRank) break; + indexBegin += range; + } + indexEnd = indexBegin + range - 1; + } + + // Even if servers have no index, they must received something from client + // We only use several client to send "empty" message to these servers + CServerDistributionDescription serverDescription(nGlobDomain, nbServer); + std::vector serverZeroIndex; + if (isUnstructed_) serverZeroIndex = serverDescription.computeServerGlobalIndexInRange(std::make_pair(indexBegin, indexEnd), 0); + else serverZeroIndex = serverDescription.computeServerGlobalIndexInRange(std::make_pair(indexBegin, indexEnd), 1); + + std::list serverZeroIndexLeader; + std::list serverZeroIndexNotLeader; + CContextClient::computeLeader(client->clientRank, client->clientSize, serverZeroIndex.size(), serverZeroIndexLeader, serverZeroIndexNotLeader); + for (std::list::iterator it = serverZeroIndexLeader.begin(); it != serverZeroIndexLeader.end(); ++it) + *it = serverZeroIndex[*it]; + + CClientServerMapping* clientServerMap = new CClientServerMappingDistributed(serverDescription.getGlobalIndexRange(), client->intraComm); + clientServerMap->computeServerIndexMapping(globalIndexDomain, nbServer); + CClientServerMapping::GlobalIndexMap& globalIndexDomainOnServer = clientServerMap->getGlobalIndexOnServer(); + + CClientServerMapping::GlobalIndexMap::const_iterator it = globalIndexDomainOnServer.begin(), + ite = globalIndexDomainOnServer.end(); + indSrv_[nbServer].swap(globalIndexDomainOnServer); + connectedServerRank_[nbServer].clear(); + for (it = indSrv_[nbServer].begin(); it != ite; ++it) + connectedServerRank_[nbServer].push_back(it->first); + + for (std::list::const_iterator it = serverZeroIndexLeader.begin(); it != serverZeroIndexLeader.end(); ++it) + connectedServerRank_[nbServer].push_back(*it); + + // Even if a client has no index, it must connect to at least one server and + // send an "empty" data to this server + if (connectedServerRank_[nbServer].empty()) + connectedServerRank_[nbServer].push_back(client->clientRank % client->serverSize); + + // Now check if all servers have data to receive. If not, master client will send empty data. + // This ensures that all servers will participate in collective calls upon receiving even if they have no date to receive. + std::vector counts (clientSize); + std::vector displs (clientSize); + displs[0] = 0; + int localCount = connectedServerRank_[nbServer].size() ; + MPI_Gather(&localCount, 1, MPI_INT, &counts[0], 1, MPI_INT, 0, client->intraComm) ; + for (int i = 0; i < clientSize-1; ++i) + { + displs[i+1] = displs[i] + counts[i]; + } + std::vector allConnectedServers(displs[clientSize-1]+counts[clientSize-1]); + MPI_Gatherv(&(connectedServerRank_[nbServer])[0], localCount, MPI_INT, &allConnectedServers[0], &counts[0], &displs[0], MPI_INT, 0, client->intraComm); + + if ((allConnectedServers.size() != nbServer) && (rank == 0)) + { + std::vector isSrvConnected (nbServer, false); + for (int i = 0; i < allConnectedServers.size(); ++i) isSrvConnected[allConnectedServers[i]] = true; + for (int i = 0; i < nbServer; ++i) + { + if (!isSrvConnected[i]) connectedServerRank_[nbServer].push_back(i); + } + } + nbSenders[nbServer] = clientServerMap->computeConnectedClients(client->serverSize, client->clientSize, client->intraComm, connectedServerRank_[nbServer]); + delete clientServerMap; } - else indStart = indSize*rank + nj_glo%nbServer ; - - indStart=indStart*ni_glo ; - indSize=indSize*ni_glo ; - auto& globalInd = globalIndex[rank] ; - globalInd.resize(indSize) ; - for(size_t n = 0 ; nserverSize; - int nbClient = client->clientSize ; - int rankClient = client->clientRank ; - int size = nbServer / nbClient ; - int start ; - if (nbServer%nbClient > rankClient) + } + CATCH_DUMP_ATTR + + /*! + Compute index to write data. We only write data on the zoomed region, therefore, there should + be a map between the complete grid and the reduced grid where we write data. + By using global index we can easily create this kind of mapping. + */ + void CDomain::computeWrittenIndex() + TRY + { + if (computedWrittenIndex_) return; + computedWrittenIndex_ = true; + + CContext* context=CContext::getCurrent(); + CContextServer* server = context->server; + + std::vector nBegin(2), nSize(2), nBeginGlobal(2), nGlob(2); + nBegin[0] = ibegin; nBegin[1] = jbegin; + nSize[0] = ni; nSize[1] = nj; + nBeginGlobal[0] = 0; nBeginGlobal[1] = 0; + nGlob[0] = ni_glo; nGlob[1] = nj_glo; + CDistributionServer srvDist(server->intraCommSize, nBegin, nSize, nBeginGlobal, nGlob); + const CArray& writtenGlobalIndex = srvDist.getGlobalIndex(); + + size_t nbWritten = 0, indGlo; + std::unordered_map::const_iterator itb = globalLocalIndexMap_.begin(), + ite = globalLocalIndexMap_.end(), it; + CArray::const_iterator itSrvb = writtenGlobalIndex.begin(), + itSrve = writtenGlobalIndex.end(), itSrv; + + localIndexToWriteOnServer.resize(writtenGlobalIndex.numElements()); + nbWritten = 0; + for (itSrv = itSrvb; itSrv != itSrve; ++itSrv) { - start = (size+1) * rankClient ; - size++ ; - } - else start = size*rankClient + nbServer%nbClient ; - - for(int i=0; i rank) + indGlo = *itSrv; + if (ite != globalLocalIndexMap_.find(indGlo)) { - indStart = (indSize+1) * rank ; - indSize++ ; + localIndexToWriteOnServer(nbWritten) = globalLocalIndexMap_[indGlo]; } - else indStart = indSize*rank + ni_glo%nbServer ; - - auto& globalInd = globalIndex[rank] ; - globalInd.resize(indSize*nj_glo) ; - size_t n=0 ; - for(int j=0; jserverSize; - int nglo=ni_glo*nj_glo ; - CArray indGlo ; - for(size_t i=0;igetRanksServerLeader()) globalIndex[rankServer] = indGlo ; - } - remoteElement_[client] = make_shared(ni_glo*nj_glo, globalIndex) ; - remoteElement_[client]->addFullView() ; - } - CATCH - - + } + CATCH_DUMP_ATTR - void CDomain::distributeToServer(CContextClient* client, map>& globalIndexOut, std::map>& globalIndexIn, - shared_ptr &scattererConnector, const string& domainId) + void CDomain::computeWrittenCompressedIndex(MPI_Comm writtenComm) TRY { - string serverDomainId = domainId.empty() ? this->getId() : domainId ; - CContext* context = CContext::getCurrent(); - - this->sendAllAttributesToServer(client, serverDomainId) ; - - auto scatteredElement = make_shared(ni_glo*nj_glo, globalIndexOut) ; - scatteredElement->addFullView() ; - scattererConnector = make_shared(localElement_->getView(CElementView::FULL), scatteredElement->getView(CElementView::FULL), - context->getIntraComm(), client->getRemoteSize()) ; - scattererConnector->computeConnector() ; - - // phase 0 - // send remote element to construct the full view on server, ie without hole - CEventClient event0(getType(), EVENT_ID_DOMAIN_DISTRIBUTION); - CMessage message0 ; - message0<sendToServer(client,event0,message0) ; - - // phase 1 - // send the full view of element to construct the connector which connect distributed data coming from client to the full local view - CEventClient event1(getType(), EVENT_ID_DOMAIN_DISTRIBUTION); - CMessage message1 ; - message1<getView(CElementView::FULL)->getGlobalSize() ; - scattererConnector->transfer(localElement_->getView(CElementView::FULL)->getGlobalIndex(),client,event1,message1) ; - - sendDistributedAttributes(client, scattererConnector, domainId) ; + int writtenCommSize; + MPI_Comm_size(writtenComm, &writtenCommSize); + if (compressedIndexToWriteOnServer.find(writtenCommSize) != compressedIndexToWriteOnServer.end()) + return; - - // phase 2 send the mask : data index + mask2D - { - CArray maskIn(localElement_->getView(CElementView::WORKFLOW)->getSize()); - CArray maskOut ; - auto workflowToFull = make_shared(localElement_->getView(CElementView::WORKFLOW), localElement_->getView(CElementView::FULL)) ; - workflowToFull->computeConnector() ; - maskIn=true ; - workflowToFull->transfer(maskIn,maskOut,false) ; - - - // prepare grid scatterer connector to send data from client to server - map> workflowGlobalIndex ; - map> maskOut2 ; - scattererConnector->transfer(maskOut, maskOut2, false) ; - scatteredElement->addView(CElementView::WORKFLOW, maskOut2) ; - scatteredElement->getView(CElementView::WORKFLOW)->getGlobalIndexView(workflowGlobalIndex) ; - // create new workflow view for scattered element - auto clientToServerElement = make_shared(scatteredElement->getGlobalSize(), workflowGlobalIndex) ; - clientToServerElement->addFullView() ; - CEventClient event2(getType(), EVENT_ID_DOMAIN_DISTRIBUTION); - CMessage message2 ; - message2<sendToServer(client, event2, message2) ; - clientToServerConnector_[client] = make_shared(localElement_->getView(CElementView::WORKFLOW), clientToServerElement->getView(CElementView::FULL), - context->getIntraComm(), client->getRemoteSize()) ; - clientToServerConnector_[client]->computeConnector() ; - } - //////////// - // phase 3 : compute connector to receive from server - //////////// + if (isCompressible()) { - auto scatteredElement = make_shared(ni_glo*nj_glo, globalIndexIn) ; - scatteredElement->addFullView() ; - auto scattererConnector = make_shared(localElement_->getView(CElementView::FULL), scatteredElement->getView(CElementView::FULL), - context->getIntraComm(), client->getRemoteSize()) ; - scattererConnector->computeConnector() ; - - CArray maskIn(localElement_->getView(CElementView::WORKFLOW)->getSize()); - CArray maskOut ; - auto workflowToFull = make_shared(localElement_->getView(CElementView::WORKFLOW), localElement_->getView(CElementView::FULL)) ; - workflowToFull->computeConnector() ; - maskIn=true ; - workflowToFull->transfer(maskIn,maskOut,false) ; - - map> workflowGlobalIndex ; - map> maskOut2 ; - scattererConnector->transfer(maskOut, maskOut2, false) ; - scatteredElement->addView(CElementView::WORKFLOW, maskOut2) ; - scatteredElement->getView(CElementView::WORKFLOW)->getGlobalIndexView(workflowGlobalIndex) ; - auto clientToServerElement = make_shared(scatteredElement->getGlobalSize(), workflowGlobalIndex) ; - clientToServerElement->addFullView() ; - CEventClient event3(getType(), EVENT_ID_DOMAIN_DISTRIBUTION); - CMessage message3 ; - message3<sendToServer(client, event3, message3) ; - - clientFromServerConnector_[client] = make_shared(clientToServerElement->getView(CElementView::FULL), localElement_->getView(CElementView::WORKFLOW)); - clientFromServerConnector_[client]->computeConnector() ; - } + size_t nbWritten = 0, indGlo; + CContext* context=CContext::getCurrent(); + CContextServer* server = context->server; + + std::vector nBegin(2), nSize(2), nBeginGlobal(2), nGlob(2); + nBegin[0] = ibegin; nBegin[1] = jbegin; + nSize[0] = ni; nSize[1] = nj; + nBeginGlobal[0] = 0; nBeginGlobal[1] = 0; + nGlob[0] = ni_glo; nGlob[1] = nj_glo; + CDistributionServer srvDist(server->intraCommSize, nBegin, nSize, nBeginGlobal, nGlob); + const CArray& writtenGlobalIndex = srvDist.getGlobalIndex(); + + std::unordered_map::const_iterator itb = globalLocalIndexMap_.begin(), + ite = globalLocalIndexMap_.end(), it; + CArray::const_iterator itSrvb = writtenGlobalIndex.begin(), + itSrve = writtenGlobalIndex.end(), itSrv; + std::unordered_map localGlobalIndexMap; + for (itSrv = itSrvb; itSrv != itSrve; ++itSrv) + { + indGlo = *itSrv; + if (ite != globalLocalIndexMap_.find(indGlo)) + { + localGlobalIndexMap[localIndexToWriteOnServer(nbWritten)] = indGlo; + ++nbWritten; + } + } + + nbWritten = 0; + for (int idx = 0; idx < data_i_index.numElements(); ++idx) + { + if (localGlobalIndexMap.end() != localGlobalIndexMap.find(data_i_index(idx))) + { + ++nbWritten; + } + } + + compressedIndexToWriteOnServer[writtenCommSize].resize(nbWritten); + nbWritten = 0; + for (int idx = 0; idx < data_i_index.numElements(); ++idx) + { + if (localGlobalIndexMap.end() != localGlobalIndexMap.find(data_i_index(idx))) + { + compressedIndexToWriteOnServer[writtenCommSize](nbWritten) = localGlobalIndexMap[data_i_index(idx)]; + ++nbWritten; + } + } + + numberWrittenIndexes_[writtenCommSize] = nbWritten; + bool distributed_glo, distributed=isDistributed() ; + MPI_Allreduce(&distributed,&distributed_glo, 1, MPI_INT, MPI_LOR, writtenComm) ; + + if (distributed_glo) + { + + MPI_Allreduce(&numberWrittenIndexes_[writtenCommSize], &totalNumberWrittenIndexes_[writtenCommSize], 1, MPI_INT, MPI_SUM, writtenComm); + MPI_Scan(&numberWrittenIndexes_[writtenCommSize], &offsetWrittenIndexes_[writtenCommSize], 1, MPI_INT, MPI_SUM, writtenComm); + offsetWrittenIndexes_[writtenCommSize] -= numberWrittenIndexes_[writtenCommSize]; + } + else + totalNumberWrittenIndexes_[writtenCommSize] = numberWrittenIndexes_[writtenCommSize]; + } } - CATCH - - void CDomain::recvDomainDistribution(CEventServer& event) + CATCH_DUMP_ATTR + + /*! + Send all attributes from client to connected clients + The attributes will be rebuilt on receiving side + */ + void CDomain::sendAttributes() TRY { - string domainId; - int phasis ; - for (auto& subEvent : event.subEvents) (*subEvent.buffer) >> domainId >> phasis ; - get(domainId)->receivedDomainDistribution(event, phasis); + sendDistributionAttributes(); + sendIndex(); + sendLonLat(); + sendArea(); + sendDataIndex(); } CATCH - - void CDomain::receivedDomainDistribution(CEventServer& event, int phasis) + /*! + Send global index from client to connected client(s) + */ + void CDomain::sendIndex() TRY { - CContext* context = CContext::getCurrent(); - if (phasis==0) // receive the remote element to construct the full view + int ns, n, i, j, ind, nv, idx; + std::list::iterator it; + for (it=clients.begin(); it!=clients.end(); ++it) { - localElement_ = make_shared(context->getIntraCommRank(),event) ; - localElement_->addFullView() ; - // construct the local dimension and indexes - auto& globalIndex=localElement_->getGlobalIndex() ; - int nij=globalIndex.numElements() ; - int minI=ni_glo,maxI=-1,minJ=nj_glo,maxJ=-1 ; - int i,j ; - int niGlo=ni_glo, njGlo=njGlo ; - for(int ij=0;ijserverSize; + CEventClient eventIndex(getType(), EVENT_ID_INDEX); + + list list_msgsIndex; + list > list_indGlob; + + std::unordered_map >::const_iterator itIndex, iteIndex; + iteIndex = indSrv_[serverSize].end(); + for (int k = 0; k < connectedServerRank_[serverSize].size(); ++k) { - j=globalIndex(ij)/niGlo ; - i=globalIndex(ij)%niGlo ; - if (imaxI) maxI=i ; - if (jmaxJ) maxJ=j ; - } - if (maxI>=minI) { ibegin=minI ; ni=maxI-minI+1 ; } - else {ibegin=0; ni=0 ;} - if (maxJ>=minJ) { jbegin=minJ ; nj=maxJ-minJ+1 ; } - else {jbegin=0; nj=0 ;} + int nbIndGlob = 0; + int rank = connectedServerRank_[serverSize][k]; + itIndex = indSrv_[serverSize].find(rank); + if (iteIndex != itIndex) + nbIndGlob = itIndex->second.size(); + list_indGlob.push_back(CArray(nbIndGlob)); + + CArray& indGlob = list_indGlob.back(); + for (n = 0; n < nbIndGlob; ++n) + { + indGlob(n) = static_cast(itIndex->second[n]); + } + + list_msgsIndex.push_back(CMessage()); + list_msgsIndex.back() << this->getId() << (int)type; // enum ne fonctionne pour les message => ToFix + list_msgsIndex.back() << isCurvilinear; + list_msgsIndex.back() << list_indGlob.back(); //list_indi.back() << list_indj.back(); + + eventIndex.push(rank, nbSenders[serverSize][rank], list_msgsIndex.back()); + } + + client->sendEvent(eventIndex); } - else if (phasis==1) // receive the sent view from client to construct the full distributed full view on server - { - CContext* context = CContext::getCurrent(); - shared_ptr elementFrom = make_shared(event) ; - elementFrom->addFullView() ; - gathererConnector_ = make_shared(elementFrom->getView(CElementView::FULL), localElement_->getView(CElementView::FULL)) ; - gathererConnector_->computeConnector() ; - } - else if (phasis==2) - { - elementFrom_ = make_shared(event) ; - elementFrom_->addFullView() ; - } - else if (phasis==3) + } + CATCH_DUMP_ATTR + + /*! + Send distribution from client to other clients + Because a client in a level knows correctly the grid distribution of client on the next level + it calculates this distribution then sends it to the corresponding clients on the next level + */ + void CDomain::sendDistributionAttributes(void) + TRY + { + std::list::iterator it; + for (it=clients.begin(); it!=clients.end(); ++it) { - elementTo_ = make_shared(event) ; - elementTo_->addFullView() ; + CContextClient* client = *it; + int nbServer = client->serverSize; + std::vector nGlobDomain(2); + nGlobDomain[0] = this->ni_glo; + nGlobDomain[1] = this->nj_glo; + + CServerDistributionDescription serverDescription(nGlobDomain, nbServer); + if (isUnstructed_) serverDescription.computeServerDistribution(false, 0); + else serverDescription.computeServerDistribution(false, 1); + + std::vector > serverIndexBegin = serverDescription.getServerIndexBegin(); + std::vector > serverDimensionSizes = serverDescription.getServerDimensionSizes(); + + CEventClient event(getType(),EVENT_ID_SERVER_ATTRIBUT); + if (client->isServerLeader()) + { + std::list msgs; + + const std::list& ranks = client->getRanksServerLeader(); + for (std::list::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) + { + // Use const int to ensure CMessage holds a copy of the value instead of just a reference + const int ibegin_srv = serverIndexBegin[*itRank][0]; + const int jbegin_srv = serverIndexBegin[*itRank][1]; + const int ni_srv = serverDimensionSizes[*itRank][0]; + const int nj_srv = serverDimensionSizes[*itRank][1]; + + msgs.push_back(CMessage()); + CMessage& msg = msgs.back(); + msg << this->getId() ; + msg << isUnstructed_; + msg << ni_srv << ibegin_srv << nj_srv << jbegin_srv; + msg << ni_glo.getValue() << nj_glo.getValue(); + msg << isCompressible_; + + event.push(*itRank,1,msg); + } + client->sendEvent(event); + } + else client->sendEvent(event); } } - CATCH + CATCH_DUMP_ATTR - void CDomain::setServerMask(CArray& serverMask, CContextClient* client) + /*! + Send area from client to connected client(s) + */ + void CDomain::sendArea() TRY { - // nota : the client is needed to get the remote size for the scatterer connector. Maybe it is not the good place for this - // Later, server to client connector can be computed on demand, with "client" as argument - CContext* context = CContext::getCurrent(); - localElement_->addView(CElementView::WORKFLOW, serverMask) ; - mask_1d.reference(serverMask.copy()) ; - - serverFromClientConnector_ = make_shared(elementFrom_->getView(CElementView::FULL), localElement_->getView(CElementView::WORKFLOW)) ; - serverFromClientConnector_->computeConnector() ; - - serverToClientConnector_ = make_shared(localElement_->getView(CElementView::WORKFLOW), elementTo_->getView(CElementView::FULL), - context->getIntraComm(), client->getRemoteSize()) ; - serverToClientConnector_->computeConnector() ; + if (!hasArea) return; + + int ns, n, i, j, ind, nv, idx; + std::list::iterator it; + + for (it=clients.begin(); it!=clients.end(); ++it) + { + CContextClient* client = *it; + int serverSize = client->serverSize; + + // send area for each connected server + CEventClient eventArea(getType(), EVENT_ID_AREA); + + list list_msgsArea; + list > list_area; + + std::unordered_map >::const_iterator it, iteMap; + iteMap = indSrv_[serverSize].end(); + for (int k = 0; k < connectedServerRank_[serverSize].size(); ++k) + { + int nbData = 0; + int rank = connectedServerRank_[serverSize][k]; + it = indSrv_[serverSize].find(rank); + if (iteMap != it) + nbData = it->second.size(); + list_area.push_back(CArray(nbData)); + + const std::vector& temp = it->second; + for (n = 0; n < nbData; ++n) + { + idx = static_cast(it->second[n]); + list_area.back()(n) = areavalue(globalLocalIndexMap_[idx]); + } + + list_msgsArea.push_back(CMessage()); + list_msgsArea.back() << this->getId() << hasArea; + list_msgsArea.back() << list_area.back(); + eventArea.push(rank, nbSenders[serverSize][rank], list_msgsArea.back()); + } + client->sendEvent(eventArea); + } } CATCH_DUMP_ATTR - - void CDomain::sendDistributedAttributes(CContextClient* client, shared_ptr scattererConnector, const string& domainId) + /*! + Send longitude and latitude from client to servers + Each client send long and lat information to corresponding connected clients(s). + Because longitude and latitude are optional, this function only called if latitude and longitude exist + */ + void CDomain::sendLonLat() + TRY { - string serverDomainId = domainId.empty() ? this->getId() : domainId ; - CContext* context = CContext::getCurrent(); + if (!hasLonLat) return; - if (hasLonLat) + int ns, n, i, j, ind, nv, idx; + std::list::iterator it; + for (it=clients.begin(); it!=clients.end(); ++it) { - { // send longitude - CEventClient event(getType(), EVENT_ID_SEND_DISTRIBUTED_ATTRIBUTE); - CMessage message ; - message<transfer(lonvalue, client, event,message) ; - } - - { // send latitude - CEventClient event(getType(), EVENT_ID_SEND_DISTRIBUTED_ATTRIBUTE); - CMessage message ; - message<transfer(latvalue, client, event, message) ; + CContextClient* client = *it; + int serverSize = client->serverSize; + + // send lon lat for each connected server + CEventClient eventLon(getType(), EVENT_ID_LON); + CEventClient eventLat(getType(), EVENT_ID_LAT); + + list list_msgsLon, list_msgsLat; + list > list_lon, list_lat; + list > list_boundslon, list_boundslat; + + std::unordered_map >::const_iterator it, iteMap; + iteMap = indSrv_[serverSize].end(); + for (int k = 0; k < connectedServerRank_[serverSize].size(); ++k) + { + int nbData = 0; + int rank = connectedServerRank_[serverSize][k]; + it = indSrv_[serverSize].find(rank); + if (iteMap != it) + nbData = it->second.size(); + + list_lon.push_back(CArray(nbData)); + list_lat.push_back(CArray(nbData)); + + if (hasBounds) + { + list_boundslon.push_back(CArray(nvertex, nbData)); + list_boundslat.push_back(CArray(nvertex, nbData)); + } + + CArray& lon = list_lon.back(); + CArray& lat = list_lat.back(); + const std::vector& temp = it->second; + for (n = 0; n < nbData; ++n) + { + idx = static_cast(it->second[n]); + int localInd = globalLocalIndexMap_[idx]; + lon(n) = lonvalue(localInd); + lat(n) = latvalue(localInd); + + if (hasBounds) + { + CArray& boundslon = list_boundslon.back(); + CArray& boundslat = list_boundslat.back(); + + for (nv = 0; nv < nvertex; ++nv) + { + boundslon(nv, n) = bounds_lonvalue(nv, localInd); + boundslat(nv, n) = bounds_latvalue(nv, localInd); + } + } + } + + list_msgsLon.push_back(CMessage()); + list_msgsLat.push_back(CMessage()); + + list_msgsLon.back() << this->getId() << hasLonLat; + if (hasLonLat) + list_msgsLon.back() << list_lon.back(); + list_msgsLon.back() << hasBounds; + if (hasBounds) + { + list_msgsLon.back() << list_boundslon.back(); + } + + list_msgsLat.back() << this->getId() << hasLonLat; + if (hasLonLat) + list_msgsLat.back() << list_lat.back(); + list_msgsLat.back() << hasBounds; + if (hasBounds) + { + list_msgsLat.back() << list_boundslat.back(); + } + + eventLon.push(rank, nbSenders[serverSize][rank], list_msgsLon.back()); + eventLat.push(rank, nbSenders[serverSize][rank], list_msgsLat.back()); } + client->sendEvent(eventLon); + client->sendEvent(eventLat); } + } + CATCH_DUMP_ATTR + + /*! + Send data index to corresponding connected clients. + Data index can be compressed however, we always send decompressed data index + and they will be compressed on receiving. + The compressed index are represented with 1 and others are represented with -1 + */ + void CDomain::sendDataIndex() + TRY + { + int ns, n, i, j, ind, nv, idx; + std::list::iterator it; + for (it=clients.begin(); it!=clients.end(); ++it) + { + CContextClient* client = *it; + + int serverSize = client->serverSize; - if (hasBounds) - { - { // send longitude boudaries - CEventClient event(getType(), EVENT_ID_SEND_DISTRIBUTED_ATTRIBUTE); - CMessage message ; - message<transfer(nvertex, bounds_lonvalue, client, event, message ) ; + // send area for each connected server + CEventClient eventDataIndex(getType(), EVENT_ID_DATA_INDEX); + + list list_msgsDataIndex; + list > list_data_i_index, list_data_j_index; + + int nbIndex = i_index.numElements(); + int niByIndex = max(i_index) - min(i_index) + 1; + int njByIndex = max(j_index) - min(j_index) + 1; + int dataIindexBound = (1 == data_dim) ? (niByIndex * njByIndex) : niByIndex; + int dataJindexBound = (1 == data_dim) ? (niByIndex * njByIndex) : njByIndex; + + + CArray dataIIndex(nbIndex), dataJIndex(nbIndex); + dataIIndex = -1; + dataJIndex = -1; + ind = 0; + + for (idx = 0; idx < data_i_index.numElements(); ++idx) + { + int dataIidx = data_i_index(idx) + data_ibegin; + int dataJidx = data_j_index(idx) + data_jbegin; + if ((0 <= dataIidx) && (dataIidx < dataIindexBound) && + (0 <= dataJidx) && (dataJidx < dataJindexBound)) + { + dataIIndex((1 == data_dim) ? dataIidx : dataJidx * ni + dataIidx) = 1; //i_index(dataIidx);//dataIidx; + dataJIndex((1 == data_dim) ? dataIidx : dataJidx * ni + dataIidx) = 1; //j_index(dataJidx);// + } } - { // send latitude boudaries - CEventClient event(getType(), EVENT_ID_SEND_DISTRIBUTED_ATTRIBUTE); - CMessage message ; - message<transfer(nvertex, bounds_latvalue, client, event, message ) ; + std::unordered_map >::const_iterator it, iteMap; + iteMap = indSrv_[serverSize].end(); + for (int k = 0; k < connectedServerRank_[serverSize].size(); ++k) + { + int nbData = 0; + int rank = connectedServerRank_[serverSize][k]; + it = indSrv_[serverSize].find(rank); + if (iteMap != it) + nbData = it->second.size(); + list_data_i_index.push_back(CArray(nbData)); + list_data_j_index.push_back(CArray(nbData)); + + const std::vector& temp = it->second; + for (n = 0; n < nbData; ++n) + { + idx = static_cast(it->second[n]); + i = globalLocalIndexMap_[idx]; + list_data_i_index.back()(n) = dataIIndex(i); + list_data_j_index.back()(n) = dataJIndex(i); + } + + list_msgsDataIndex.push_back(CMessage()); + list_msgsDataIndex.back() << this->getId(); + list_msgsDataIndex.back() << list_data_i_index.back() << list_data_j_index.back(); + eventDataIndex.push(rank, nbSenders[serverSize][rank], list_msgsDataIndex.back()); } + client->sendEvent(eventDataIndex); } - - if (hasArea) - { // send area - CEventClient event(getType(), EVENT_ID_SEND_DISTRIBUTED_ATTRIBUTE); - CMessage message ; - message<transfer(areavalue, client, event,message) ; + } + CATCH + + bool CDomain::dispatchEvent(CEventServer& event) + TRY + { + if (SuperClass::dispatchEvent(event)) return true; + else + { + switch(event.type) + { + case EVENT_ID_SERVER_ATTRIBUT: + recvDistributionAttributes(event); + return true; + break; + case EVENT_ID_INDEX: + recvIndex(event); + return true; + break; + case EVENT_ID_LON: + recvLon(event); + return true; + break; + case EVENT_ID_LAT: + recvLat(event); + return true; + break; + case EVENT_ID_AREA: + recvArea(event); + return true; + break; + case EVENT_ID_DATA_INDEX: + recvDataIndex(event); + return true; + break; + default: + ERROR("bool CDomain::dispatchEvent(CEventServer& event)", + << "Unknown Event"); + return false; + } } } + CATCH - void CDomain::recvDistributedAttributes(CEventServer& event) + /*! + Receive index event from clients(s) + \param[in] event event contain info about rank and associated index + */ + void CDomain::recvIndex(CEventServer& event) TRY { string domainId; - string type ; - for (auto& subEvent : event.subEvents) (*subEvent.buffer) >> domainId >> type ; - get(domainId)->recvDistributedAttributes(event, type); + std::map rankBuffers; + + list::iterator it; + for (it = event.subEvents.begin(); it != event.subEvents.end(); ++it) + { + CBufferIn* buffer = it->buffer; + *buffer >> domainId; + rankBuffers[it->rank] = buffer; + } + get(domainId)->recvIndex(rankBuffers); } CATCH - void CDomain::recvDistributedAttributes(CEventServer& event, const string& type) + /*! + Receive index information from client(s). We use the global index for mapping index between + sending clients and receiving clients. + \param[in] rankBuffers rank of sending client and the corresponding receive buffer + */ + void CDomain::recvIndex(std::map& rankBuffers) TRY { - if (type=="lon") + int nbReceived = rankBuffers.size(), i, ind, index, type_int, iIndex, jIndex; + recvClientRanks_.resize(nbReceived); + + std::map::iterator it = rankBuffers.begin(), ite = rankBuffers.end(); + ind = 0; + for (ind = 0; it != ite; ++it, ++ind) + { + recvClientRanks_[ind] = it->first; + CBufferIn& buffer = *(it->second); + buffer >> type_int >> isCurvilinear >> indGlob_[it->first]; + type.setValue((type_attr::t_enum)type_int); // probleme des type enum avec les buffers : ToFix + } + int nbIndGlob = 0; + for (i = 0; i < nbReceived; ++i) { - CArray value ; - gathererConnector_->transfer(event, value, 0.); - lonvalue_2d.resize(ni,nj) ; - if (lonvalue_2d.numElements()>0) lonvalue_2d=CArray(value.dataFirst(),shape(ni,nj),neverDeleteData) ; + nbIndGlob += indGlob_[recvClientRanks_[i]].numElements(); } - else if (type=="lat") + + globalLocalIndexMap_.rehash(std::ceil(nbIndGlob/globalLocalIndexMap_.max_load_factor())); + i_index.resize(nbIndGlob); + j_index.resize(nbIndGlob); + int nbIndexGlobMax = nbIndGlob, nbIndLoc; + + nbIndGlob = 0; + for (i = 0; i < nbReceived; ++i) { - CArray value ; - gathererConnector_->transfer(event, value, 0.); - latvalue_2d.resize(ni,nj) ; - if (latvalue_2d.numElements()>0) latvalue_2d=CArray(value.dataFirst(),shape(ni,nj),neverDeleteData) ; + CArray& tmp = indGlob_[recvClientRanks_[i]]; + for (ind = 0; ind < tmp.numElements(); ++ind) + { + index = tmp(ind); + if (0 == globalLocalIndexMap_.count(index)) + { + iIndex = (index%ni_glo)-ibegin; + iIndex = (iIndex < 0) ? 0 : iIndex; + jIndex = (index/ni_glo)-jbegin; + jIndex = (jIndex < 0) ? 0 : jIndex; + nbIndLoc = iIndex + ni * jIndex; + i_index(nbIndGlob) = index % ni_glo; + j_index(nbIndGlob) = index / ni_glo; + globalLocalIndexMap_[index] = nbIndGlob; + ++nbIndGlob; + } + } + } + + if (nbIndGlob==0) + { + i_index.resize(nbIndGlob); + j_index.resize(nbIndGlob); } - else if (type=="boundslon") + else { - CArray value ; - gathererConnector_->transfer(event, nvertex, value, 0.); - bounds_lon_2d.resize(nvertex,ni,nj) ; - if (bounds_lon_2d.numElements()>0) bounds_lon_2d=CArray(value.dataFirst(),shape(nvertex,ni,nj),neverDeleteData) ; + i_index.resizeAndPreserve(nbIndGlob); + j_index.resizeAndPreserve(nbIndGlob); } - else if (type=="boundslat") + + domainMask.resize(0); // Mask is not defined anymore on servers + } + CATCH + + /*! + Receive attributes event from clients(s) + \param[in] event event contain info about rank and associated attributes + */ + void CDomain::recvDistributionAttributes(CEventServer& event) + TRY + { + CBufferIn* buffer=event.subEvents.begin()->buffer; + string domainId ; + *buffer>>domainId ; + get(domainId)->recvDistributionAttributes(*buffer); + } + CATCH + + /*! + Receive attributes from client(s) + \param[in] rank rank of client source + \param[in] buffer message containing attributes info + */ + void CDomain::recvDistributionAttributes(CBufferIn& buffer) + TRY + { + int ni_tmp, ibegin_tmp, nj_tmp, jbegin_tmp; + int ni_glo_tmp, nj_glo_tmp; + buffer >> isUnstructed_ >> ni_tmp >> ibegin_tmp >> nj_tmp >> jbegin_tmp + >> ni_glo_tmp >> nj_glo_tmp + >> isCompressible_; + + ni.setValue(ni_tmp); + ibegin.setValue(ibegin_tmp); + nj.setValue(nj_tmp); + jbegin.setValue(jbegin_tmp); + ni_glo.setValue(ni_glo_tmp); + nj_glo.setValue(nj_glo_tmp); + + } + CATCH_DUMP_ATTR + /*! + Receive longitude event from clients(s) + \param[in] event event contain info about rank and associated longitude + */ + void CDomain::recvLon(CEventServer& event) + TRY + { + string domainId; + std::map rankBuffers; + + list::iterator it; + for (it = event.subEvents.begin(); it != event.subEvents.end(); ++it) + { + CBufferIn* buffer = it->buffer; + *buffer >> domainId; + rankBuffers[it->rank] = buffer; + } + get(domainId)->recvLon(rankBuffers); + } + CATCH + + /*! + Receive longitude information from client(s) + \param[in] rankBuffers rank of sending client and the corresponding receive buffer + */ + void CDomain::recvLon(std::map& rankBuffers) + TRY + { + int nbReceived = rankBuffers.size(), i, ind, index, iindex, jindex, lInd; + if (nbReceived != recvClientRanks_.size()) + ERROR("void CDomain::recvLon(std::map& rankBuffers)", + << "The number of sending clients is not correct." + << "Expected number: " << recvClientRanks_.size() << " but received " << nbReceived); + + vector > recvLonValue(nbReceived); + vector > recvBoundsLonValue(nbReceived); + for (i = 0; i < recvClientRanks_.size(); ++i) { - CArray value ; - gathererConnector_->transfer(event, nvertex, value, 0.); - bounds_lat_2d.resize(nvertex,ni,nj) ; - if (bounds_lat_2d.numElements()>0) bounds_lat_2d=CArray(value.dataFirst(),shape(nvertex,ni,nj),neverDeleteData) ; + int rank = recvClientRanks_[i]; + CBufferIn& buffer = *(rankBuffers[rank]); + buffer >> hasLonLat; + if (hasLonLat) + buffer >> recvLonValue[i]; + buffer >> hasBounds; + if (hasBounds) + buffer >> recvBoundsLonValue[i]; } - else if (type=="area") + + if (hasLonLat) { - CArray value ; - gathererConnector_->transfer(event, value, 0.); - area.resize(ni,nj) ; - if (area.numElements()>0) area=CArray(value.dataFirst(),shape(ni,nj),neverDeleteData) ; + int nbLonInd = 0; + for (i = 0; i < nbReceived; ++i) + { + nbLonInd += recvLonValue[i].numElements(); + } + + if (nbLonInd != globalLocalIndexMap_.size()) + info (0) << "If domain " << this->getDomainOutputName() <<" does not have overlapped regions between processes " + << "something must be wrong with longitude index "<< std::endl; + + nbLonInd = globalLocalIndexMap_.size(); + lonvalue.resize(nbLonInd); + if (hasBounds) + { + bounds_lonvalue.resize(nvertex,nbLonInd); + bounds_lonvalue = 0.; + } + + nbLonInd = 0; + for (i = 0; i < nbReceived; ++i) + { + CArray& tmpInd = indGlob_[recvClientRanks_[i]]; + CArray& tmp = recvLonValue[i]; + for (ind = 0; ind < tmp.numElements(); ++ind) + { + lInd = globalLocalIndexMap_[size_t(tmpInd(ind))]; + lonvalue(lInd) = tmp(ind); + if (hasBounds) + { + for (int nv = 0; nv < nvertex; ++nv) + bounds_lonvalue(nv, lInd) = recvBoundsLonValue[i](nv, ind); + } + } + } } } + CATCH_DUMP_ATTR + + /*! + Receive latitude event from clients(s) + \param[in] event event contain info about rank and associated latitude + */ + void CDomain::recvLat(CEventServer& event) + TRY + { + string domainId; + std::map rankBuffers; + + list::iterator it; + for (it = event.subEvents.begin(); it != event.subEvents.end(); ++it) + { + CBufferIn* buffer = it->buffer; + *buffer >> domainId; + rankBuffers[it->rank] = buffer; + } + get(domainId)->recvLat(rankBuffers); + } CATCH - - bool CDomain::dispatchEvent(CEventServer& event) + + /*! + Receive latitude information from client(s) + \param[in] rankBuffers rank of sending client and the corresponding receive buffer + */ + void CDomain::recvLat(std::map& rankBuffers) TRY { - if (SuperClass::dispatchEvent(event)) return true; - else + int nbReceived = rankBuffers.size(), i, ind, index, iindex, jindex, lInd; + if (nbReceived != recvClientRanks_.size()) + ERROR("void CDomain::recvLat(std::map& rankBuffers)", + << "The number of sending clients is not correct." + << "Expected number: " << recvClientRanks_.size() << " but received " << nbReceived); + + vector > recvLatValue(nbReceived); + vector > recvBoundsLatValue(nbReceived); + for (i = 0; i < recvClientRanks_.size(); ++i) { - switch(event.type) + int rank = recvClientRanks_[i]; + CBufferIn& buffer = *(rankBuffers[rank]); + buffer >> hasLonLat; + if (hasLonLat) + buffer >> recvLatValue[i]; + buffer >> hasBounds; + if (hasBounds) + buffer >> recvBoundsLatValue[i]; + } + + if (hasLonLat) + { + int nbLatInd = 0; + for (i = 0; i < nbReceived; ++i) { - case EVENT_ID_DOMAIN_DISTRIBUTION: - recvDomainDistribution(event); - return true; - break; - case EVENT_ID_SEND_DISTRIBUTED_ATTRIBUTE: - recvDistributedAttributes(event); - return true; - break; - default: - ERROR("bool CDomain::dispatchEvent(CEventServer& event)", - << "Unknown Event"); - return false; - } + nbLatInd += recvLatValue[i].numElements(); + } + + if (nbLatInd != globalLocalIndexMap_.size()) + info (0) << "If domain " << this->getDomainOutputName() <<" does not have overlapped regions between processes " + << "something must be wrong with latitude index "<< std::endl; + + nbLatInd = globalLocalIndexMap_.size(); + latvalue.resize(nbLatInd); + if (hasBounds) + { + bounds_latvalue.resize(nvertex,nbLatInd); + bounds_latvalue = 0. ; + } + + nbLatInd = 0; + for (i = 0; i < nbReceived; ++i) + { + CArray& tmpInd = indGlob_[recvClientRanks_[i]]; + CArray& tmp = recvLatValue[i]; + for (ind = 0; ind < tmp.numElements(); ++ind) + { + lInd = globalLocalIndexMap_[size_t(tmpInd(ind))]; + latvalue(lInd) = tmp(ind); + if (hasBounds) + { + CArray& boundslat = recvBoundsLatValue[i]; + for (int nv = 0; nv < nvertex; ++nv) + bounds_latvalue(nv, lInd) = boundslat(nv, ind); + } + ++nbLatInd; + } + } + } + } + CATCH_DUMP_ATTR + + /*! + Receive area event from clients(s) + \param[in] event event contain info about rank and associated area + */ + void CDomain::recvArea(CEventServer& event) + TRY + { + string domainId; + std::map rankBuffers; + + list::iterator it; + for (it = event.subEvents.begin(); it != event.subEvents.end(); ++it) + { + CBufferIn* buffer = it->buffer; + *buffer >> domainId; + rankBuffers[it->rank] = buffer; } + get(domainId)->recvArea(rankBuffers); } CATCH - + /*! + Receive area information from client(s) + \param[in] rankBuffers rank of sending client and the corresponding receive buffer + */ + void CDomain::recvArea(std::map& rankBuffers) + TRY + { + int nbReceived = rankBuffers.size(), i, ind, index, lInd; + if (nbReceived != recvClientRanks_.size()) + ERROR("void CDomain::recvArea(std::map& rankBuffers)", + << "The number of sending clients is not correct." + << "Expected number: " << recvClientRanks_.size() << " but received " << nbReceived); + + vector > recvAreaValue(nbReceived); + for (i = 0; i < recvClientRanks_.size(); ++i) + { + int rank = recvClientRanks_[i]; + CBufferIn& buffer = *(rankBuffers[rank]); + buffer >> hasArea; + if (hasArea) + buffer >> recvAreaValue[i]; + } + + if (hasArea) + { + int nbAreaInd = 0; + for (i = 0; i < nbReceived; ++i) + { + nbAreaInd += recvAreaValue[i].numElements(); + } + + if (nbAreaInd != globalLocalIndexMap_.size()) + info (0) << "If domain " << this->getDomainOutputName() <<" does not have overlapped regions between processes " + << "something must be wrong with area index "<< std::endl; + + nbAreaInd = globalLocalIndexMap_.size(); + areavalue.resize(nbAreaInd); + nbAreaInd = 0; + for (i = 0; i < nbReceived; ++i) + { + CArray& tmpInd = indGlob_[recvClientRanks_[i]]; + CArray& tmp = recvAreaValue[i]; + for (ind = 0; ind < tmp.numElements(); ++ind) + { + lInd = globalLocalIndexMap_[size_t(tmpInd(ind))]; + areavalue(lInd) = tmp(ind); + } + } + + } + } + CATCH_DUMP_ATTR + /*! Compare two domain objects. They are equal if only if they have identical attributes as well as their values. @@ -2333,43 +3034,114 @@ namespace xios { } CATCH_DUMP_ATTR -///////////////////////////////////////////////////////////////////////// -/////////////// TRANSFORMATIONS ////////// -///////////////////////////////////////////////////////////////////////// - - std::map CDomain::transformationMapList_ = std::map(); - bool CDomain::dummyTransformationMapList_ = CDomain::initializeTransformationMap(CDomain::transformationMapList_); - - bool CDomain::initializeTransformationMap(std::map& m) + /*! + Receive data index event from clients(s) + \param[in] event event contain info about rank and associated index + */ + void CDomain::recvDataIndex(CEventServer& event) TRY { - m["zoom_domain"] = TRANS_ZOOM_DOMAIN; - m["interpolate_domain"] = TRANS_INTERPOLATE_DOMAIN; - m["generate_rectilinear_domain"] = TRANS_GENERATE_RECTILINEAR_DOMAIN; - m["compute_connectivity_domain"] = TRANS_COMPUTE_CONNECTIVITY_DOMAIN; - m["expand_domain"] = TRANS_EXPAND_DOMAIN; - m["reorder_domain"] = TRANS_REORDER_DOMAIN; - m["extract_domain"] = TRANS_EXTRACT_DOMAIN; - return true; + string domainId; + std::map rankBuffers; + + list::iterator it; + for (it = event.subEvents.begin(); it != event.subEvents.end(); ++it) + { + CBufferIn* buffer = it->buffer; + *buffer >> domainId; + rankBuffers[it->rank] = buffer; + } + get(domainId)->recvDataIndex(rankBuffers); } CATCH + /*! + Receive data index information from client(s) + A client receives data index from different clients to rebuild its own data index. + Because we use global index + mask info to calculate the sending data to client(s), + this data index must be updated with mask info (maybe it will change in the future) + Because the data index is local, to rebuild data index of received client, we should use global index along with. - CTransformation* CDomain::addTransformation(ETranformationType transType, const StdString& id) + \param[in] rankBuffers rank of sending client and the corresponding receive buffer + */ + void CDomain::recvDataIndex(std::map& rankBuffers) TRY { - transformationMap_.push_back(std::make_pair(transType, CTransformation::createTransformation(transType,id))); - return transformationMap_.back().second; + int nbReceived = rankBuffers.size(), i, ind, index, indexI, indexJ, type_int, lInd; + if (nbReceived != recvClientRanks_.size()) + ERROR("void CDomain::recvDataIndex(std::map& rankBuffers)", + << "The number of sending clients is not correct." + << "Expected number: " << recvClientRanks_.size() << " but received " << nbReceived); + + vector > recvDataIIndex(nbReceived),recvDataJIndex(nbReceived); + for (i = 0; i < recvClientRanks_.size(); ++i) + { + int rank = recvClientRanks_[i]; + CBufferIn& buffer = *(rankBuffers[rank]); + buffer >> recvDataIIndex[i]; + buffer >> recvDataJIndex[i]; + } + + int nbIndex = i_index.numElements(); + CArray dataIIndex(nbIndex), dataJIndex(nbIndex); + dataIIndex = -1; dataJIndex = -1; + + nbIndex = 0; + for (i = 0; i < nbReceived; ++i) + { + CArray& tmpInd = indGlob_[recvClientRanks_[i]]; + CArray& tmpI = recvDataIIndex[i]; + CArray& tmpJ = recvDataJIndex[i]; + if ((tmpI.numElements() != tmpInd.numElements()) || (tmpJ.numElements() != tmpInd.numElements())) + ERROR("void CDomain::recvDataIndex(std::map& rankBuffers)", + << "The number of global received index is not coherent with the number of received data index." + << "Expected number of global index: " << tmpI.numElements() << " but received " << tmpInd.numElements()); + + for (ind = 0; ind < tmpI.numElements(); ++ind) + { + lInd = globalLocalIndexMap_[size_t(tmpInd(ind))]; + dataIIndex(lInd) = (-1 == dataIIndex(lInd)) ? tmpI(ind) : dataIIndex(lInd); // Only fill in dataIndex if there is no data + dataJIndex(lInd) = (-1 == dataJIndex(lInd)) ? tmpJ(ind) : dataJIndex(lInd); + } + } + + int nbCompressedData = 0; + for (ind = 0; ind < dataIIndex.numElements(); ++ind) + { + indexI = dataIIndex(ind); indexJ = dataJIndex(ind); + if ((0 <= indexI) && (0 <= indexJ)) + ++nbCompressedData; + } + + data_i_index.resize(nbCompressedData); + data_j_index.resize(nbCompressedData); + + nbCompressedData = 0; + for (ind = 0; ind < dataIIndex.numElements(); ++ind) + { + indexI = dataIIndex(ind); indexJ = dataJIndex(ind); + if ((0 <= indexI) && (0 <= indexJ)) + { + data_i_index(nbCompressedData) = (1 == data_dim) ? ind : ind % ni; + data_j_index(nbCompressedData) = (1 == data_dim) ? 0 : ind / ni; + ++nbCompressedData; + } + } + + // Reset data_ibegin, data_jbegin + data_ibegin.setValue(0); + data_jbegin.setValue(0); } CATCH_DUMP_ATTR - CTransformation* CDomain::addTransformation(ETranformationType transType, CTransformation* transformation) + CTransformation* CDomain::addTransformation(ETranformationType transType, const StdString& id) TRY { - transformationMap_.push_back(std::make_pair(transType, transformation)); + transformationMap_.push_back(std::make_pair(transType, CTransformation::createTransformation(transType,id))); return transformationMap_.back().second; } CATCH_DUMP_ATTR + /*! Check whether a domain has transformation \return true if domain has transformation @@ -2412,11 +3184,11 @@ namespace xios { } } CATCH_DUMP_ATTR - + /*! * Go through the hierarchy to find the domain from which the transformations must be inherited */ - void CDomain::solveInheritanceTransformation_old() + void CDomain::solveInheritanceTransformation() TRY { if (hasTransformation() || !hasDirectDomainReference()) @@ -2436,72 +3208,6 @@ namespace xios { } CATCH_DUMP_ATTR - - void CDomain::solveInheritanceTransformation() - TRY - { - if (solveInheritanceTransformation_done_) return; - else solveInheritanceTransformation_done_=true ; - - CDomain* domain = this; - CDomain* Lastdomain ; - std::list refDomains; - bool out=false ; - vector excludedAttr; - excludedAttr.push_back("domain_ref"); - - refDomains.push_front(domain) ; - while (domain->hasDirectDomainReference() && !out) - { - CDomain* lastDomain=domain ; - domain = domain->getDirectDomainReference(); - domain->solveRefInheritance() ; - if (!domain->SuperClass::isEqual(lastDomain,excludedAttr)) out=true ; - refDomains.push_front(domain) ; - } - - CTransformationPaths::TPath path ; - auto& pathList = std::get<2>(path) ; - std::get<0>(path) = EElement::DOMAIN ; - std::get<1>(path) = refDomains.front()->getId() ; - for (auto& domain : refDomains) - { - CDomain::TransMapTypes transformations = domain->getAllTransformations(); - for(auto& transformation : transformations) pathList.push_back({transformation.second->getTransformationType(), - transformation.second->getId()}) ; - } - transformationPaths_.addPath(path) ; - - } - CATCH_DUMP_ATTR - - - bool CDomain::activateFieldWorkflow(CGarbageCollector& gc) - TRY - { - if (!domain_ref.isEmpty()) - { - CField* field=getFieldFromId(domain_ref) ; - if (field!=nullptr) - { - bool ret = field->buildWorkflowGraph(gc) ; - if (!ret) return false ; // cannot build workflow graph at this state - } - else - { - CDomain* domain = get(domain_ref) ; - bool ret = domain->activateFieldWorkflow(gc) ; - if (!ret) return false ; // cannot build workflow graph at this state - domain_ref=domain->getId() ; // replace domain_ref by solved reference - } - } - activateFieldWorkflow_done_=true ; - return true ; - } - CATCH_DUMP_ATTR -///////////////////////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////////////////////// - void CDomain::setContextClient(CContextClient* contextClient) TRY { diff --git a/xios_2311_src/src/node/domain.hpp b/xios_2311_src/src/node/domain.hpp index 876def71c53ed4743b9784dfa7bfd220f040a2db..61bfa3c763c339fe4ce0dcd7ce8cc1f38bea4ca7 100644 --- a/xios_2311_src/src/node/domain.hpp +++ b/xios_2311_src/src/node/domain.hpp @@ -15,19 +15,10 @@ #include "attribute_enum.hpp" #include "transformation.hpp" #include "transformation_enum.hpp" -#include "transformation_path.hpp" #include "server_distribution_description.hpp" #include "mesh.hpp" -#include "element.hpp" -#include "local_connector.hpp" -#include "scatterer_connector.hpp" -#include "gatherer_connector.hpp" -#include "distribution_type.hpp" -#include "generic_algorithm_transformation.hpp" - -namespace xios -{ +namespace xios { /// ////////////////////// Déclarations ////////////////////// /// @@ -35,7 +26,6 @@ namespace xios class CDomainAttributes; class CDomain; class CFile; - class CField ; ///-------------------------------------------------------------- @@ -57,26 +47,25 @@ namespace xios public: enum EEventId { - EVENT_ID_DOMAIN_DISTRIBUTION, EVENT_ID_SEND_DISTRIBUTED_ATTRIBUTE + EVENT_ID_INDEX, EVENT_ID_LON, EVENT_ID_LAT, + EVENT_ID_AREA, + EVENT_ID_DATA_INDEX, EVENT_ID_SERVER_ATTRIBUT } ; public: typedef CDomainAttributes RelAttributes; typedef CDomainGroup RelGroup; - + typedef CTransformation::TransformationMapTypes TransMapTypes; + /// Constructeurs /// CDomain(void); explicit CDomain(const StdString & id); CDomain(const CDomain & domain); // Not implemented yet. CDomain(const CDomain * const domain); // Not implemented yet. - static void releaseStaticAllocation(void) ; // release static allocation on heap static CDomain* createDomain(); - static CDomain* get(const string& id, bool noError=false) ; //::TransformationMapTypes TransMapTypes; - private: - static bool initializeTransformationMap(std::map& m); - static std::map transformationMapList_; - static bool dummyTransformationMapList_; - TransMapTypes transformationMap_; - - public: - CTransformation* addTransformation(ETranformationType transType, const StdString& id=""); - CTransformation* addTransformation(ETranformationType transType, CTransformation* transformation) ; - void setTransformations(const TransMapTypes&); - void duplicateTransformation(CDomain*); - TransMapTypes getAllTransformations(); - bool hasTransformation(); - void solveInheritanceTransformation_old(); // to remove later - void solveInheritanceTransformation(); - private: - bool solveInheritanceTransformation_done_= false ; - public: - bool activateFieldWorkflow(CGarbageCollector& gc) ; - private: - bool activateFieldWorkflow_done_=false ; - - private: - shared_ptr transformationAlgorithm_ = nullptr ; - public: - void setTransformationAlgorithm(shared_ptr transformationAlgorithm) { transformationAlgorithm_=transformationAlgorithm ;} - shared_ptr getTransformationAlgorithm(void) { return transformationAlgorithm_ ;} - private: - CTransformationPaths transformationPaths_ ; - public: - CTransformationPaths getTransformationPaths(void) {return transformationPaths_;} - void setTransformationPaths(const CTransformationPaths& transformationPaths) { transformationPaths_=transformationPaths ;} - - //////////////////////////// + void sendCheckedAttributes(); + bool hasTransformation(); + void solveInheritanceTransformation(); + TransMapTypes getAllTransformations(); void redistribute(int nbLocalDomain); + void duplicateTransformation(CDomain*); + CTransformation* addTransformation(ETranformationType transType, const StdString& id=""); public: const std::set & getRelFiles(void) const; bool IsWritten(const StdString & filename) const; bool isWrittenCompressed(const StdString& filename) const; + int getNumberWrittenIndexes(MPI_Comm writtenCom); + int getTotalNumberWrittenIndexes(MPI_Comm writtenCom); + int getOffsetWrittenIndexes(MPI_Comm writtenCom); + CArray& getCompressedIndexToWriteOnServer(MPI_Comm writtenCom); + std::map getAttributesBufferSize(CContextClient* client, bool bufferForWriting = false); bool isEmpty(void) const; bool isDistributed(void) const; + bool isCompressible(void) const; + + bool isTiled(void) const; + bool isTiledOnly(void) const; + int getTileId(int i, int j) const; + int getTileDataISize(int tileId) const; + int getTileDataJSize(int tileId) const; + void computeCompressionTiled(CArray& dataIndexI, CArray& dataIndexJ, + CArray& infoIndexI, CArray& infoIndexJ); - public : - /*! - \brief return if the domain can be written or not in a compressed way. - ie if there are some masked or indexed point on the domain. Valid only on server side. - \return true if domain can be writtedn in a compressed way - */ - bool isCompressible(void) { if (!isCompressibleComputed_) computeIsCompressible() ; return isCompressible_ ;} - private : - bool isCompressible_ ; /** specify if the domain can be written in a compressed way */ - bool isCompressibleComputed_=false ; /** Indicate if compressability has been computed*/ - void computeIsCompressible() ; - - public : + std::vector getNbGlob(); bool isEqual(CDomain* domain); static bool dispatchEvent(CEventServer& event); - - private: - /** define if the domain is completed or not ie all attributes have been received before in case - of grid reading from file or coupling */ - bool isCompleted_=true ; - public: - /*! - \brief Check if a domain is completed - Before make any domain processing, we must be sure that all domain informations have - been sent, for exemple when reading a grid in a file or when grid elements are sent by an - other context (coupling). So all direct reference of the domain (domain_ref) must be also completed - \return true if domain and domain reference are completed - */ - bool isCompleted(void) - { - if (hasDirectDomainReference()) if (!getDirectDomainReference()->isCompleted()) return false; - else return isCompleted_ ; - - MISSING_RETURN( "bool CDomain::isCompleted() " ); - return true; - } - void setCompleted(void) { isCompleted_=true ; } - void unsetCompleted(void) { isCompleted_=false ; } public: /// Mutateur /// void addRelFile(const StdString & filename); void addRelFileCompressed(const StdString& filename); + void computeWrittenIndex(); + void computeWrittenCompressedIndex(MPI_Comm); + void AllgatherRectilinearLonLat(CArray& lon, CArray& lat, CArray& lon_g, CArray& lat_g); @@ -193,6 +132,7 @@ namespace xios CArray& boundsLon, CArray& boundsLat); void fillInLonLat(); + void initLonLatValue(); bool distributionAttributesHaveValue() const; size_t getGlobalWrittenSize() ; @@ -210,6 +150,7 @@ namespace xios CArray bounds_lonvalue, bounds_latvalue; CArray areavalue; + CArray localIndexToWriteOnServer; CArray domainMask; // mask_1d, mask_2d -> domainMask CArray localMask; // domainMask + indexing @@ -224,10 +165,6 @@ namespace xios bool hasBoundsLonInReadFile_ ; // specify if longitude boundaries are defined on read file, so it can be read later when grid distribution will be defined void computeLocalMask(void) ; - - /** The number of server of a context client. Avoid to re-compute indice computed in a previous computeConnectedClient */ - private: std::set listNbServer_ ; - private: void checkDomain(void); void checkLocalIDomain(void); @@ -240,115 +177,76 @@ namespace xios void checkBounds(void); void checkArea(void); void checkLonLat(); - - public: - void sendDomainToFileServer(CContextClient* client) ; - private: - std::set sendDomainToFileServer_done_ ; - public: - void sendDomainToCouplerOut(CContextClient* client, const string& fieldId, int posInGrid) ; - private: - std::set sendDomainToCouplerOut_done_ ; - - public: - void makeAliasForCoupling(const string& fieldId, int posInGrid) ; - string getCouplingAlias(const string& fieldId, int posInGrid) ; - private: - + void checkTiles(); + + void setTransformations(const TransMapTypes&); + void computeNGlobDomain(); + void sendAttributes(); + void sendIndex(); + void sendDistributionAttributes(); + void sendArea(); + void sendLonLat(); + void sendDataIndex(); void convertLonLatValue(); void fillInRectilinearLonLat(); void fillInCurvilinearLonLat(); void fillInUnstructuredLonLat(); - void completeLonLatClient(void); - + static void recvDistributionAttributes(CEventServer& event); + static void recvIndex(CEventServer& event); + static void recvLon(CEventServer& event); + static void recvLat(CEventServer& event); + static void recvArea(CEventServer& event); + static void recvDataIndex(CEventServer& event); + void recvDistributionAttributes(CBufferIn& buffer); + void recvIndex(std::map& rankBuffers); + void recvLon(std::map& rankBuffers); + void recvLat(std::map& rankBuffers); + void recvArea(std::map& rankBuffers); + void recvDataIndex(std::map& rankBuffers); + + void completeLonLatClient(void); + void computeConnectedClients(); + private: /** Clients that have to send a domain. There can be multiple clients in case of secondary server, otherwise only one client. */ std::list clients; std::set clientsSet; - bool isChecked ; + bool isChecked, computedWrittenIndex_; std::set relFiles, relFilesCompressed; + bool isClientChecked; // Verify whether all attributes of domain on the client side are good + bool isClientAfterTransformationChecked; + std::map > indGlob_; + std::map > nbSenders; // Mapping of number of communicating client to a server -/** only on client side : Global index of each client sent to server: map> - indSrv_[nbServers] --> first map is related to the server distribution (ie associated with the contextClient) - indSrv_[nbServers][server_rank] -> array of global index sent to the server of rank "server_rank" - indSrv_[nbServers][server_rank](ind) --> global index on server of the local element "ind" sent (for lon, lat, mask, etc...) -*/ +/** Global index of each client sent to server: map> */ std::map > > indSrv_; - + // std::map > > indWrittenSrv_; // Global written index of each client sent to server + std::vector indexesToWrite; + std::vector recvClientRanks_; + std::map numberWrittenIndexes_, totalNumberWrittenIndexes_, offsetWrittenIndexes_; + std::map > compressedIndexToWriteOnServer; + std::map > connectedDataSize_; std::map > connectedServerRank_; +//! True if and only if the data defined on the domain can be outputted in a compressed way + bool isCompressible_; bool isRedistributed_; + TransMapTypes transformationMap_; bool isUnstructed_; + std::unordered_map globalLocalIndexMap_; - - ////////////////////////////////////////////////////////////////////////////////////// - // this part is related to distribution, element definition, views and connectors // - ////////////////////////////////////////////////////////////////////////////////////// - private: - shared_ptr localElement_ = nullptr ; - void initializeLocalElement(void) ; - - public: - shared_ptr getLocalElement(void) { if (localElement_==nullptr) initializeLocalElement() ; return localElement_ ; } - shared_ptr getLocalView(CElementView::type type) { return getLocalElement()->getView(type) ;} - - private: - void addFullView(void) ; - void addWorkflowView(void) ; - void addModelView(void) ; - - private: - shared_ptr modelToWorkflowConnector_ ; - void computeModelToWorkflowConnector(void) ; - public: - shared_ptr getModelToWorkflowConnector(void) { if (modelToWorkflowConnector_==nullptr) computeModelToWorkflowConnector() ; return modelToWorkflowConnector_ ;} - - public: - void computeRemoteElement(CContextClient* client, EDistributionType) ; - void distributeToServer(CContextClient* client, std::map>& globalIndexOut, std::map>& globalIndexIn, - shared_ptr &scattererConnector, const string& domainId="") ; - - static void recvDomainDistribution(CEventServer& event) ; - void receivedDomainDistribution(CEventServer& event, int phasis) ; - - void sendDistributedAttributes(CContextClient* client, shared_ptr scaterrerConnector, const string& domainId) ; - static void recvDistributedAttributes(CEventServer& event) ; - void recvDistributedAttributes(CEventServer& event, const string& type) ; - void setServerMask(CArray& serverMask, CContextClient* client) ; - - private: - map> remoteElement_ ; - public: - shared_ptr getRemoteElement(CContextClient* client) {return remoteElement_[client] ;} - private: - map> clientToServerConnector_ ; - public: - shared_ptr getClientToServerConnector(CContextClient* client) { return clientToServerConnector_[client] ;} - - private: - shared_ptr gathererConnector_ ; - public: - shared_ptr getGathererConnector(void) { return gathererConnector_ ;} - private: - shared_ptr serverFromClientConnector_ ; - shared_ptr elementFrom_ ; - public: - shared_ptr getServerFromClientConnector(void) { return serverFromClientConnector_ ;} +//! True if tiled data is defined on the domain + bool isTiled_; +//! True if ONLY tiled data is defined on the domain + bool isTiledOnly_; private: - shared_ptr serverToClientConnector_ = nullptr ; - shared_ptr elementTo_ ; - public: - shared_ptr getServerToClientConnector(void) { return serverToClientConnector_ ;} - - private: - map> clientFromServerConnector_ ; - public: - shared_ptr getClientFromServerConnector(CContextClient* client) { return clientFromServerConnector_[client] ;} - + static bool initializeTransformationMap(std::map& m); + static std::map transformationMapList_; + static bool _dummyTransformationMapList; DECLARE_REF_FUNC(Domain,domain) diff --git a/xios_2311_src/src/node/duplicate_scalar_to_axis.cpp b/xios_2311_src/src/node/duplicate_scalar_to_axis.cpp index a949f25255e5861099136f538d40207079dd77ab..f3fa0edf0e1dd4b52999fbbc6ed8b4b37447691e 100644 --- a/xios_2311_src/src/node/duplicate_scalar_to_axis.cpp +++ b/xios_2311_src/src/node/duplicate_scalar_to_axis.cpp @@ -1,5 +1,4 @@ #include "duplicate_scalar_to_axis.hpp" -#include "axis_algorithm_duplicate_scalar.hpp" #include "type.hpp" #include "axis.hpp" #include "scalar.hpp" @@ -28,7 +27,7 @@ namespace xios { bool CDuplicateScalarToAxis::registerTrans() { - return registerTransformation(TRANS_DUPLICATE_SCALAR_TO_AXIS, {create, getTransformation}); + return registerTransformation(TRANS_DUPLICATE_SCALAR_TO_AXIS, CDuplicateScalarToAxis::create); } bool CDuplicateScalarToAxis::_dummyRegistered = CDuplicateScalarToAxis::registerTrans(); @@ -43,19 +42,5 @@ namespace xios { { } - - shared_ptr CDuplicateScalarToAxis::createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) - { - return CAxisAlgorithmDuplicateScalar::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, - elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, - elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition) ; - } + } diff --git a/xios_2311_src/src/node/duplicate_scalar_to_axis.hpp b/xios_2311_src/src/node/duplicate_scalar_to_axis.hpp index b2acab58c7de21e581040beec838ad1ef17ac316..6b4a90924583157ec13000c6509a33b94d755633 100644 --- a/xios_2311_src/src/node/duplicate_scalar_to_axis.hpp +++ b/xios_2311_src/src/node/duplicate_scalar_to_axis.hpp @@ -19,8 +19,6 @@ namespace xios { class CDuplicateScalarToAxis; class CAxis; class CScalar; - class CGenericAlgorithmTransformation ; - class CGrid; ///-------------------------------------------------------------- @@ -42,8 +40,6 @@ namespace xios { public : typedef CObjectTemplate SuperClass; typedef CDuplicateScalarToAxisAttributes SuperClassAttribute; - typedef CDuplicateScalarToAxis MyClass ; - typedef CTransformation SuperTransform ; public : /// Constructeurs /// @@ -59,19 +55,6 @@ namespace xios { static StdString GetName(void); static StdString GetDefName(void); static ENodeType GetType(void); - const string& getId(void) { return this->SuperClass::getId();} - ETranformationType getTransformationType(void) { return TRANS_DUPLICATE_SCALAR_TO_AXIS ;} - static CTransformation* getTransformation(const StdString& id) { return SuperClass::get(id);} - virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} - virtual shared_ptr createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) ; private: static bool registerTrans(); static CTransformation* create(const StdString& id, xml::CXMLNode* node); diff --git a/xios_2311_src/src/node/element_type.hpp b/xios_2311_src/src/node/element_type.hpp deleted file mode 100755 index 3d9b9fa47154e6f306148b38e69a1e1df26d5700..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/node/element_type.hpp +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef __XIOS_ELEMENT_TYPE_HPP__ -#define __XIOS_ELEMENT_TYPE_HPP__ - -namespace xios -{ - enum class EElement { DOMAIN, AXIS, SCALAR} ; -} - -#endif // __XIOS_ELEMENT_TYPE_HPP__ \ No newline at end of file diff --git a/xios_2311_src/src/node/expand_domain.cpp b/xios_2311_src/src/node/expand_domain.cpp index 14b6c901bab3af98e391f4356b768e8cacc9942c..c3fdafe6b6c9224d6a24a3eea1d29b6180f2f86b 100644 --- a/xios_2311_src/src/node/expand_domain.cpp +++ b/xios_2311_src/src/node/expand_domain.cpp @@ -1,5 +1,4 @@ #include "expand_domain.hpp" -#include "domain_algorithm_expand.hpp" #include "type.hpp" namespace xios { @@ -27,7 +26,7 @@ namespace xios { bool CExpandDomain::_dummyRegistered = CExpandDomain::registerTrans(); bool CExpandDomain::registerTrans() { - return registerTransformation(TRANS_EXPAND_DOMAIN, {create, getTransformation}); + return registerTransformation(TRANS_EXPAND_DOMAIN, CExpandDomain::create); } //---------------------------------------------------------------- @@ -47,19 +46,5 @@ namespace xios { if (this->type.isEmpty()) this->type.setValue(CExpandDomain::type_attr::edge); } - - shared_ptr CExpandDomain::createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) - { - return CDomainAlgorithmExpand::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, - elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, - elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition) ; - } + } diff --git a/xios_2311_src/src/node/expand_domain.hpp b/xios_2311_src/src/node/expand_domain.hpp index 5bbf359f00825eaa781802a4c6d44f2e42e535a1..bc8f81660951f318084d8a1e7fc2f6c45d125bc6 100644 --- a/xios_2311_src/src/node/expand_domain.hpp +++ b/xios_2311_src/src/node/expand_domain.hpp @@ -19,8 +19,6 @@ namespace xios { class CExpandDomainAttributes; class CExpandDomain; class CDomain; - class CGenericAlgorithmTransformation ; - class CGrid; ///-------------------------------------------------------------- @@ -42,8 +40,6 @@ namespace xios { public : typedef CObjectTemplate SuperClass; typedef CExpandDomainAttributes SuperClassAttribute; - typedef CExpandDomain MyClass ; - typedef CTransformation SuperTransform ; public : /// Constructeurs /// @@ -59,19 +55,6 @@ namespace xios { static StdString GetName(void); static StdString GetDefName(void); static ENodeType GetType(void); - const string& getId(void) { return this->SuperClass::getId();} - ETranformationType getTransformationType(void) { return TRANS_EXPAND_DOMAIN ;} - static CTransformation* getTransformation(const StdString& id) { return SuperClass::get(id);} - virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} - virtual shared_ptr createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) ; private: static bool registerTrans(); static CTransformation* create(const StdString& id, xml::CXMLNode* node); diff --git a/xios_2311_src/src/node/extract_axis.cpp b/xios_2311_src/src/node/extract_axis.cpp index 3e205aa2e7324517c3ca166713bf45ac6e9071ae..8dce4abb26df4b03694156ed5f49810c8d6dc670 100644 --- a/xios_2311_src/src/node/extract_axis.cpp +++ b/xios_2311_src/src/node/extract_axis.cpp @@ -1,5 +1,4 @@ #include "extract_axis.hpp" -#include "axis_algorithm_extract.hpp" #include "type.hpp" namespace xios { @@ -26,7 +25,7 @@ namespace xios { bool CExtractAxis::registerTrans() { - return registerTransformation(TRANS_EXTRACT_AXIS, {create, getTransformation}); + return registerTransformation(TRANS_EXTRACT_AXIS, CExtractAxis::create); } bool CExtractAxis::_dummyRegistered = CExtractAxis::registerTrans(); @@ -77,18 +76,4 @@ namespace xios { } - shared_ptr CExtractAxis::createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) - { - return CAxisAlgorithmExtract::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, - elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, - elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition); - } } diff --git a/xios_2311_src/src/node/extract_axis.hpp b/xios_2311_src/src/node/extract_axis.hpp index e8c816ee80b6ff280fa57d1ed5b74af27bd534d1..b013bb90316fc7bf29e1af233903e270cb0053ec 100644 --- a/xios_2311_src/src/node/extract_axis.hpp +++ b/xios_2311_src/src/node/extract_axis.hpp @@ -19,8 +19,7 @@ namespace xios { class CExtractAxisAttributes; class CExtractAxis; class CAxis; - class CGenericAlgorithmTransformation ; - class CGrid; + ///-------------------------------------------------------------- // Declare/Define CFileAttribute @@ -41,8 +40,6 @@ namespace xios { public : typedef CObjectTemplate SuperClass; typedef CExtractAxisAttributes SuperClassAttribute; - typedef CExtractAxis MyClass ; - typedef CTransformation SuperTransform ; public : /// Constructeurs /// @@ -58,19 +55,6 @@ namespace xios { static StdString GetName(void); static StdString GetDefName(void); static ENodeType GetType(void); - const string& getId(void) { return this->SuperClass::getId();} - ETranformationType getTransformationType(void) { return TRANS_EXTRACT_AXIS ;} - static CTransformation* getTransformation(const StdString& id) { return SuperClass::get(id);} - virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} - virtual shared_ptr createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) ; private: static bool registerTrans(); static CTransformation* create(const StdString& id, xml::CXMLNode* node); diff --git a/xios_2311_src/src/node/extract_axis_to_scalar.cpp b/xios_2311_src/src/node/extract_axis_to_scalar.cpp index 2d297a8908c06b621a0914a4119faa34fb539957..d99be46a90aca99c3dfdccae7665617bee30f709 100644 --- a/xios_2311_src/src/node/extract_axis_to_scalar.cpp +++ b/xios_2311_src/src/node/extract_axis_to_scalar.cpp @@ -1,6 +1,4 @@ #include "extract_axis_to_scalar.hpp" -#include "scalar_algorithm_extract_axis.hpp" - #include "type.hpp" #include "axis.hpp" #include "scalar.hpp" @@ -29,7 +27,7 @@ namespace xios { bool CExtractAxisToScalar::registerTrans() { - return registerTransformation(TRANS_EXTRACT_AXIS_TO_SCALAR, {create, getTransformation}); + return registerTransformation(TRANS_EXTRACT_AXIS_TO_SCALAR, CExtractAxisToScalar::create); } bool CExtractAxisToScalar::_dummyRegistered = CExtractAxisToScalar::registerTrans(); @@ -58,18 +56,4 @@ namespace xios { << "CScalar destination " << scalarDst->getId() << std::endl); } - shared_ptr CExtractAxisToScalar::createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) - { - return CScalarAlgorithmExtractAxis::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, - elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, - elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition) ; - } } diff --git a/xios_2311_src/src/node/extract_axis_to_scalar.hpp b/xios_2311_src/src/node/extract_axis_to_scalar.hpp index b68cc6e7f0dbcc520045463742bd340763fc29e7..a19ccab8fafc3c4fe9c9a644418bac0be2a6806f 100644 --- a/xios_2311_src/src/node/extract_axis_to_scalar.hpp +++ b/xios_2311_src/src/node/extract_axis_to_scalar.hpp @@ -19,8 +19,7 @@ namespace xios { class CExtractAxisToScalar; class CAxis; class CScalar; - class CGenericAlgorithmTransformation ; - class CGrid; + ///-------------------------------------------------------------- // Declare/Define CFileAttribute @@ -41,8 +40,6 @@ namespace xios { public : typedef CObjectTemplate SuperClass; typedef CExtractAxisToScalarAttributes SuperClassAttribute; - typedef CExtractAxisToScalar MyClass ; - typedef CTransformation SuperTransform ; public : /// Constructeurs /// @@ -58,19 +55,6 @@ namespace xios { static StdString GetName(void); static StdString GetDefName(void); static ENodeType GetType(void); - const string& getId(void) { return this->SuperClass::getId();} - ETranformationType getTransformationType(void) { return TRANS_EXTRACT_AXIS_TO_SCALAR ;} - static CTransformation* getTransformation(const StdString& id) { return SuperClass::get(id);} - virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} - virtual shared_ptr createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) ; private: static bool registerTrans(); static CTransformation* create(const StdString& id, xml::CXMLNode* node); diff --git a/xios_2311_src/src/node/extract_domain.cpp b/xios_2311_src/src/node/extract_domain.cpp index 818e3bcec892d11bb94a2a4ec33d2c18900f6cbc..bca3dcbd46dda0efa4e414f9f8d3184e5a6ebd0d 100644 --- a/xios_2311_src/src/node/extract_domain.cpp +++ b/xios_2311_src/src/node/extract_domain.cpp @@ -1,5 +1,4 @@ #include "extract_domain.hpp" -#include "domain_algorithm_extract.hpp" #include "type.hpp" namespace xios { @@ -27,7 +26,7 @@ namespace xios { bool CExtractDomain::_dummyRegistered = CExtractDomain::registerTrans(); bool CExtractDomain::registerTrans() { - return registerTransformation(TRANS_EXTRACT_DOMAIN, {create, getTransformation}); + return registerTransformation(TRANS_EXTRACT_DOMAIN, CExtractDomain::create); } //---------------------------------------------------------------- @@ -72,18 +71,4 @@ namespace xios { } } - shared_ptr CExtractDomain::createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) - { - return CDomainAlgorithmExtract::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, - elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, - elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition); - } } diff --git a/xios_2311_src/src/node/extract_domain.hpp b/xios_2311_src/src/node/extract_domain.hpp index ae8fcdcb98f0d91d27c606e35f1790ba90247404..176bb062bf0685f25487d35ac718d213b5f1b79a 100644 --- a/xios_2311_src/src/node/extract_domain.hpp +++ b/xios_2311_src/src/node/extract_domain.hpp @@ -19,8 +19,7 @@ namespace xios { class CExtractDomainAttributes; class CExtractDomain; class CDomain; - class CGenericAlgorithmTransformation ; - class CGrid; + ///-------------------------------------------------------------- // Declare/Define CFileAttribute @@ -41,8 +40,6 @@ namespace xios { public : typedef CObjectTemplate SuperClass; typedef CExtractDomainAttributes SuperClassAttribute; - typedef CExtractDomain MyClass ; - typedef CTransformation SuperTransform ; public : /// Constructeurs /// @@ -58,23 +55,10 @@ namespace xios { static StdString GetName(void); static StdString GetDefName(void); static ENodeType GetType(void); - const string& getId(void) { return this->SuperClass::getId();} - ETranformationType getTransformationType(void) { return TRANS_EXTRACT_DOMAIN ;} - static CTransformation* getTransformation(const StdString& id) { return SuperClass::get(id);} - virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} - virtual shared_ptr createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) ; - private: + private: static bool registerTrans(); static CTransformation* create(const StdString& id, xml::CXMLNode* node); - static bool _dummyRegistered; + static bool _dummyRegistered; }; // class CExtractDomain DECLARE_GROUP(CExtractDomain); diff --git a/xios_2311_src/src/node/extract_domain_to_axis.cpp b/xios_2311_src/src/node/extract_domain_to_axis.cpp index 24986806036a445cef218f8568e45e4130aabeff..f02f4029ba8ef2cc558f39d98b3a38d659b7af70 100644 --- a/xios_2311_src/src/node/extract_domain_to_axis.cpp +++ b/xios_2311_src/src/node/extract_domain_to_axis.cpp @@ -1,5 +1,4 @@ #include "extract_domain_to_axis.hpp" -#include "axis_algorithm_extract_domain.hpp" #include "type.hpp" #include "axis.hpp" #include "domain.hpp" @@ -28,7 +27,7 @@ namespace xios { bool CExtractDomainToAxis::registerTrans() { - return registerTransformation(TRANS_EXTRACT_DOMAIN_TO_AXIS, {create, getTransformation}); + return registerTransformation(TRANS_EXTRACT_DOMAIN_TO_AXIS, CExtractDomainToAxis::create); } bool CExtractDomainToAxis::_dummyRegistered = CExtractDomainToAxis::registerTrans(); @@ -47,6 +46,7 @@ namespace xios { << "Domain source " <getId() << std::endl << "Axis destination " << axisDst->getId()); + int axis_n_glo = axisDst->n_glo; int domain_ni_glo = domainSrc->ni_glo; int domain_nj_glo = domainSrc->nj_glo; @@ -65,6 +65,11 @@ namespace xios { switch (direction) { case direction_attr::jDir: + if (axis_n_glo != domain_nj_glo) + ERROR("CExtractDomainToAxis::checkValid(CAxis* axisDst, CDomain* domainSrc)", + << "Extract domain along j, axis destination should have n_glo equal to nj_glo of domain source" + << "Domain source " <getId() << " has nj_glo " << domain_nj_glo << std::endl + << "Axis destination " << axisDst->getId() << " has n_glo " << axis_n_glo); if ((position < 0) || (position >= domain_ni_glo)) ERROR("CExtractDomainToAxis::checkValid(CAxis* axisDst, CDomain* domainSrc)", << "Extract domain along j, position should be inside 0 and ni_glo-1 of domain source" @@ -74,6 +79,11 @@ namespace xios { break; case direction_attr::iDir: + if (axis_n_glo != domain_ni_glo) + ERROR("CExtractDomainToAxis::checkValid(CAxis* axisDst, CDomain* domainSrc)", + << "Extract domain along i, axis destination should have n_glo equal to ni_glo of domain source" + << "Domain source " <getId() << " has ni_glo " << domain_ni_glo << std::endl + << "Axis destination " << axisDst->getId() << " has n_glo " << axis_n_glo); if ((position < 0) || (position >= domain_nj_glo)) ERROR("CExtractDomainToAxis::checkValid(CAxis* axisDst, CDomain* domainSrc)", << "Extract domain along i, position should be inside 0 and nj_glo-1 of domain source" @@ -87,18 +97,4 @@ namespace xios { } } - shared_ptr CExtractDomainToAxis::createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) - { - return CAxisAlgorithmExtractDomain::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, - elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, - elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition); - } } diff --git a/xios_2311_src/src/node/extract_domain_to_axis.hpp b/xios_2311_src/src/node/extract_domain_to_axis.hpp index 80ae0801cafa35108fa15f03df74de0074de23f1..e02dd92d7f53ebf323ea84490b2bec09769f5350 100644 --- a/xios_2311_src/src/node/extract_domain_to_axis.hpp +++ b/xios_2311_src/src/node/extract_domain_to_axis.hpp @@ -19,8 +19,7 @@ namespace xios { class CExtractDomainToAxis; class CAxis; class CDomain; - class CGenericAlgorithmTransformation ; - class CGrid; + ///-------------------------------------------------------------- // Declare/Define CFileAttribute @@ -41,9 +40,7 @@ namespace xios { public : typedef CObjectTemplate SuperClass; typedef CExtractDomainToAxisAttributes SuperClassAttribute; - typedef CExtractDomainToAxis MyClass ; - typedef CTransformation SuperTransform ; - + public : /// Constructeurs /// CExtractDomainToAxis(void); @@ -58,19 +55,6 @@ namespace xios { static StdString GetName(void); static StdString GetDefName(void); static ENodeType GetType(void); - const string& getId(void) { return this->SuperClass::getId();} - ETranformationType getTransformationType(void) { return TRANS_EXTRACT_DOMAIN_TO_AXIS ;} - static CTransformation* getTransformation(const StdString& id) { return SuperClass::get(id);} - virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} - virtual shared_ptr createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) ; private: static bool registerTrans(); static CTransformation* create(const StdString& id, xml::CXMLNode* node); diff --git a/xios_2311_src/src/node/field.cpp b/xios_2311_src/src/node/field.cpp index 7b0e44daa9a37778d2776e5237322f67c72aa729..324a598c0ef904f42df3ebffc9b36498b121f3e1 100755 --- a/xios_2311_src/src/node/field.cpp +++ b/xios_2311_src/src/node/field.cpp @@ -14,79 +14,98 @@ #include "context_server.hpp" #include #include "garbage_collector.hpp" +#include "source_filter.hpp" +#include "store_filter.hpp" +#include "file_writer_filter.hpp" #include "pass_through_filter.hpp" #include "filter_expr_node.hpp" #include "lex_parser.hpp" #include "temporal_filter.hpp" -#include "server_from_client_source_filter.hpp" -#include "file_reader_source_filter.hpp" -#include "tracer.hpp" -#include "graph_package.hpp" - -namespace xios -{ - - /// ////////////////////// Définitions ////////////////////// /// - - CField::CField(void) - : CObjectTemplate(), CFieldAttributes() - , written(false) - , hasOutputFile(false) - , domAxisScalarIds_(vector(3,"")) - , areAllReferenceSolved(false), isReferenceSolved(false), isReferenceSolvedAndTransformed(false) - , isGridChecked(false) - , useCompressedOutput(false) - , hasTimeInstant(false) - , hasTimeCentered(false) - , mustAutoTrigger(false) - { setVirtualVariableGroup(CVariableGroup::create(getId() + "_virtual_variable_group")); } - - CField::CField(const StdString& id) - : CObjectTemplate(id), CFieldAttributes() - , written(false) - , hasOutputFile(false) - , domAxisScalarIds_(vector(3,"")) - , areAllReferenceSolved(false), isReferenceSolved(false), isReferenceSolvedAndTransformed(false) - , isGridChecked(false) - , useCompressedOutput(false) - , hasTimeInstant(false) - , hasTimeCentered(false) - , mustAutoTrigger(false) - { setVirtualVariableGroup(CVariableGroup::create(getId() + "_virtual_variable_group")); } - - CField::~CField(void) - {} +#include "spatial_transform_filter.hpp" +#include "file_server_writer_filter.hpp" +#include "workflow_graph.hpp" + +#include "yacc_var.hpp" +namespace xios{ + + /// ////////////////////// Définitions ////////////////////// /// + + CField::CField(void) + : CObjectTemplate(), CFieldAttributes() + , grid(), file() + , written(false) + , nstep(0), nstepMax(0) + , hasOutputFile(false) + , domAxisScalarIds_(vector(3,"")) + , areAllReferenceSolved(false), isReferenceSolved(false), isReferenceSolvedAndTransformed(false) + , isGridChecked(false) + , useCompressedOutput(false) + , hasTimeInstant(false) + , hasTimeCentered(false) + , wasDataRequestedFromServer(false) + , wasDataAlreadyReceivedFromServer(false) + , mustAutoTrigger(false) + , isEOF(false), nstepMaxRead(false) + { setVirtualVariableGroup(CVariableGroup::create(getId() + "_virtual_variable_group")); + field_graph_start = -2; + field_graph_end = -2; + } + + CField::CField(const StdString& id) + : CObjectTemplate(id), CFieldAttributes() + , grid(), file() + , written(false) + , nstep(0), nstepMax(0) + , hasOutputFile(false) + , domAxisScalarIds_(vector(3,"")) + , areAllReferenceSolved(false), isReferenceSolved(false), isReferenceSolvedAndTransformed(false) + , isGridChecked(false) + , useCompressedOutput(false) + , hasTimeInstant(false) + , hasTimeCentered(false) + , wasDataRequestedFromServer(false) + , wasDataAlreadyReceivedFromServer(false) + , mustAutoTrigger(false) + , isEOF(false), nstepMaxRead(false) + { setVirtualVariableGroup(CVariableGroup::create(getId() + "_virtual_variable_group")); + field_graph_start = -2; + field_graph_end = -2; + } + + + CField::~CField(void) + {} //---------------------------------------------------------------- - void CField::setVirtualVariableGroup(CVariableGroup* newVVariableGroup) - TRY - { - this->vVariableGroup = newVVariableGroup; - } - CATCH + void CField::setVirtualVariableGroup(CVariableGroup* newVVariableGroup) + TRY + { + this->vVariableGroup = newVVariableGroup; + } + CATCH - CVariableGroup* CField::getVirtualVariableGroup(void) const - TRY - { - return this->vVariableGroup; - } - CATCH + CVariableGroup* CField::getVirtualVariableGroup(void) const + TRY + { + return this->vVariableGroup; + } + CATCH - std::vector CField::getAllVariables(void) const - TRY - { - return this->vVariableGroup->getAllChildren(); - } - CATCH + std::vector CField::getAllVariables(void) const + TRY + { + return this->vVariableGroup->getAllChildren(); + } + CATCH - void CField::solveDescInheritance(bool apply, const CAttributeMap* const parent) - TRY - { - SuperClassAttribute::setAttributes(parent, apply); - this->getVirtualVariableGroup()->solveDescInheritance(apply, NULL); - } - CATCH_DUMP_ATTR + void CField::solveDescInheritance(bool apply, const CAttributeMap* const parent) + TRY + { + SuperClassAttribute::setAttributes(parent, apply); + this->getVirtualVariableGroup()->solveDescInheritance(apply, NULL); + } + CATCH_DUMP_ATTR //---------------------------------------------------------------- @@ -99,7 +118,6 @@ namespace xios switch(event.type) { case EVENT_ID_UPDATE_DATA : - // return true; // temporary recvUpdateData(event); return true; break; @@ -123,11 +141,7 @@ namespace xios recvAddVariableGroup(event); return true; break; - - case EVENT_ID_GRID_COMPLETED : - recvGridCompleted(event); - return true; - break; + default : ERROR("bool CField::dispatchEvent(CEventServer& event)", << "Unknown Event"); return false; @@ -135,64 +149,175 @@ namespace xios } } CATCH - - bool CField::isCollectiveEvent(CEventServer& event) + + void CField::sendUpdateData(const CArray& data) TRY { - switch(event.type) + CTimer::get("Field : send data").resume(); + + CContext* context = CContext::getCurrent(); + CContextClient* client = (!context->hasServer) ? context->client : this->file->getContextClient(); + int receiverSize = client->serverSize; + + CEventClient event(getType(), EVENT_ID_UPDATE_DATA); + + map >::iterator it; + list list_msg; + list > list_data; + + if (!grid->doGridHaveDataDistributed(client)) { - case EVENT_ID_UPDATE_DATA : - recvUpdateData(event); - return true; - break; + if (client->isServerLeader()) + { + for (it = grid->storeIndex_toSrv[client].begin(); it != grid->storeIndex_toSrv[client].end(); it++) + { + int rank = it->first; + CArray& index = it->second; - case EVENT_ID_READ_DATA : - recvReadDataRequest(event); - return true; - break; + list_msg.push_back(CMessage()); + list_data.push_back(CArray(index.numElements())); - case EVENT_ID_READ_DATA_READY : - recvReadDataReady(event); - return false; - break; + CArray& data_tmp = list_data.back(); + for (int n = 0; n < data_tmp.numElements(); n++) data_tmp(n) = data(index(n)); - case EVENT_ID_ADD_VARIABLE : - recvAddVariable(event); - return false; - break; + list_msg.back() << getId() << data_tmp; + event.push(rank, 1, list_msg.back()); + } + client->sendEvent(event); + } + else client->sendEvent(event); + } + else + { + for (it = grid->storeIndex_toSrv[client].begin(); it != grid->storeIndex_toSrv[client].end(); it++) + { + int rank = it->first; + CArray& index = it->second; - case EVENT_ID_ADD_VARIABLE_GROUP : - recvAddVariableGroup(event); - return false; - break; - - case EVENT_ID_GRID_COMPLETED : - recvGridCompleted(event); - return true; - break; - default : - ERROR("bool CField::dispatchEvent(CEventServer& event)", << "Unknown Event"); - return false; + list_msg.push_back(CMessage()); + list_data.push_back(CArray(index.numElements())); + + CArray& data_tmp = list_data.back(); + for (int n = 0; n < data_tmp.numElements(); n++) data_tmp(n) = data(index(n)); + + list_msg.back() << getId() << data_tmp; + event.push(rank, grid->nbSenders[receiverSize][rank], list_msg.back()); + } + client->sendEvent(event); } + + CTimer::get("Field : send data").suspend(); } - CATCH + CATCH_DUMP_ATTR void CField::recvUpdateData(CEventServer& event) TRY { + std::map rankBuffers; + + list::iterator it; string fieldId; - for (auto& subEvent : event.subEvents) (*subEvent.buffer) >> fieldId ; - get(fieldId)->receiveUpdateData(event); + CTimer::get("Field : recv data").resume(); + for (it = event.subEvents.begin(); it != event.subEvents.end(); ++it) + { + int rank = it->rank; + CBufferIn* buffer = it->buffer; + *buffer >> fieldId; + rankBuffers[rank] = buffer; + } + get(fieldId)->recvUpdateData(rankBuffers); + CTimer::get("Field : recv data").suspend(); } CATCH - void CField::receiveUpdateData(CEventServer& event) + void CField::recvUpdateData(std::map& rankBuffers) TRY { - if (hasCouplerIn()) clientFromClientSourceFilter_->streamData(event) ; - else serverFromClientSourceFilter_->streamData(event) ; + CContext* context = CContext::getCurrent(); + + size_t sizeData = 0; + if (0 == recvDataSrv.numElements()) + { + CArray& storeClient = grid->storeIndex_client; + + // Gather all data from different clients + recvDataSrv.resize(storeClient.numElements()); + recvFoperationSrv = std::shared_ptr(new func::CInstant(recvDataSrv)); + } + + CArray recv_data_tmp(recvDataSrv.numElements()); + const CDate& currDate = context->getCalendar()->getCurrentDate(); + CDuration offsetAllButMonth (freq_offset.getValue().year, 0 , freq_offset.getValue().day, + freq_offset.getValue().hour, freq_offset.getValue().minute, + freq_offset.getValue().second, freq_offset.getValue().timestep); + const CDate opeDate = (last_operation_srv - offsetAllButMonth + context->getCalendar()->getTimeStep()) + + freq_op + freq_operation_srv - freq_op - context->getCalendar()->getTimeStep() + offsetAllButMonth; + + if (opeDate <= currDate) + { + for (map >::iterator it = grid->outLocalIndexStoreOnClient.begin(); it != grid->outLocalIndexStoreOnClient.end(); ++it) + { + CArray tmp; + CArray& indexTmp = it->second; + *(rankBuffers[it->first]) >> tmp; + for (int idx = 0; idx < indexTmp.numElements(); ++idx) + { + recv_data_tmp(indexTmp(idx)) = tmp(idx); + } + } + } + + this->setData(recv_data_tmp); + // delete incomming flux for server only + recvFoperationSrv.reset() ; + recvDataSrv.reset() ; } - CATCH + CATCH_DUMP_ATTR + + void CField::writeUpdateData(const CArray& data) + TRY + { + CContext* context = CContext::getCurrent(); + + const CDate& currDate = context->getCalendar()->getCurrentDate(); + CDuration offsetAllButMonth (freq_offset.getValue().year, 0 , freq_offset.getValue().day, + freq_offset.getValue().hour, freq_offset.getValue().minute, + freq_offset.getValue().second, freq_offset.getValue().timestep); + const CDate opeDate = (last_operation_srv - offsetAllButMonth + context->getCalendar()->getTimeStep()) + + freq_op + freq_operation_srv - freq_op - context->getCalendar()->getTimeStep() + offsetAllButMonth; + const CDate writeDate = last_Write_srv + freq_write_srv; + + if (opeDate <= currDate) + { + (*recvFoperationSrv)(data); + last_operation_srv = currDate; + } + + if (writeDate < (currDate + freq_operation_srv)) + { + recvFoperationSrv->final(); + last_Write_srv = writeDate; + grid->computeWrittenIndex(); + writeField(); + lastlast_Write_srv = last_Write_srv; + } + } + CATCH_DUMP_ATTR + + void CField::writeField(void) + TRY + { + if (!getRelFile()->isEmptyZone()) + { + if (grid->doGridHaveDataToWrite() || getRelFile()->type == CFile::type_attr::one_file) + { + getRelFile()->checkWriteFile(); + this->incrementNStep(); + getRelFile()->getDataOutput()->writeFieldData(CField::get(this)); + } + } + } + CATCH_DUMP_ATTR /* Send a request for reading data. @@ -204,11 +329,38 @@ namespace xios bool CField::sendReadDataRequest(const CDate& tsDataRequested) TRY { - return clientFromServerSourceFilter_->sendReadDataRequest(tsDataRequested) ; + CContext* context = CContext::getCurrent(); + // CContextClient* client = context->client; + + // This code is for future: If we want to read file with level-2 servers + CContextClient* client = (!context->hasServer) ? context->client : this->file->getContextClient(); + + lastDataRequestedFromServer = tsDataRequested; + + // No need to send the request if we are sure that we are already at EOF + if (!isEOF || context->getCalendar()->getCurrentDate() <= dateEOF) + { + CEventClient event(getType(), EVENT_ID_READ_DATA); + if (client->isServerLeader()) + { + CMessage msg; + msg << getId(); + const std::list& ranks = client->getRanksServerLeader(); + for (std::list::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) + event.push(*itRank, 1, msg); + client->sendEvent(event); + } + else client->sendEvent(event); + } + else + serverSourceFilter->signalEndOfStream(tsDataRequested); + + wasDataRequestedFromServer = true; + + return !isEOF; } CATCH_DUMP_ATTR - - + /*! Send request new data read from file if need be, that is the current data is out-of-date. \return true if and only if some data was requested @@ -216,11 +368,24 @@ namespace xios bool CField::sendReadDataRequestIfNeeded(void) TRY { - return clientFromServerSourceFilter_->sendReadDataRequestIfNeeded() ; + const CDate& currentDate = CContext::getCurrent()->getCalendar()->getCurrentDate(); + + bool dataRequested = false; + + while (currentDate >= lastDataRequestedFromServer) + { + info(20) << "currentDate : " << currentDate << endl ; + info(20) << "lastDataRequestedFromServer : " << lastDataRequestedFromServer << endl ; + info(20) << "file->output_freq.getValue() : " << file->output_freq.getValue() << endl ; + info(20) << "lastDataRequestedFromServer + file->output_freq.getValue() : " << lastDataRequestedFromServer + file->output_freq << endl ; + + dataRequested |= sendReadDataRequest(lastDataRequestedFromServer + file->output_freq); + } + + return dataRequested; } CATCH_DUMP_ATTR - void CField::recvReadDataRequest(CEventServer& event) TRY { @@ -230,7 +395,7 @@ namespace xios get(fieldId)->recvReadDataRequest(); } CATCH - + /*! Receive data request sent from client and process it Every time server receives this request, it will try to read data and sent read data back to client @@ -240,11 +405,148 @@ namespace xios void CField::recvReadDataRequest(void) TRY { - fileReaderSourceFilter_->streamData() ; + CContext* context = CContext::getCurrent(); + CContextClient* client = context->client; + + CEventClient event(getType(), EVENT_ID_READ_DATA_READY); + std::list msgs; + + EReadField hasData = readField(); + + map >::iterator it; + if (!grid->doGridHaveDataDistributed(client)) + { + if (client->isServerLeader()) + { + if (0 != recvDataSrv.numElements()) + { + const std::list& ranks = client->getRanksServerLeader(); + for (std::list::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) + { + msgs.push_back(CMessage()); + CMessage& msg = msgs.back(); + msg << getId(); + switch (hasData) + { + case RF_DATA: + msg << getNStep() - 1 << recvDataSrv; + break; + case RF_NODATA: + msg << int(-2) << recvDataSrv; + break; + case RF_EOF: + default: + msg << int(-1); + break; + } + + event.push(*itRank, 1, msg); + } + } + client->sendEvent(event); + } + else + { + client->sendEvent(event); + } + } + else + { + for (map >::iterator it = grid->outLocalIndexStoreOnClient.begin(); + it != grid->outLocalIndexStoreOnClient.end(); ++it) + { + CArray& indexTmp = it->second; + CArray tmp(indexTmp.numElements()); + for (int idx = 0; idx < indexTmp.numElements(); ++idx) + { + tmp(idx) = recvDataSrv(indexTmp(idx)); + } + + msgs.push_back(CMessage()); + CMessage& msg = msgs.back(); + msg << getId(); + switch (hasData) + { + case RF_DATA: + msg << getNStep() - 1 << tmp; + break; + case RF_NODATA: + msg << int(-2) << tmp; + break; + case RF_EOF: + default: + msg << int(-1); + break; + } + + event.push(it->first, grid->nbReadSenders[client][it->first], msg); + } + client->sendEvent(event); + } + } + CATCH_DUMP_ATTR + + /*! + Read field from a file. + A field is read with the distribution of data on the server side + \return State of field can be read from a file + */ + CField::EReadField CField::readField(void) + TRY + { + CContext* context = CContext::getCurrent(); + grid->computeWrittenIndex(); + getRelFile()->initRead(); + EReadField readState = RF_DATA; + + if (!getRelFile()->isEmptyZone()) + { + if (grid->doGridHaveDataToWrite() || getRelFile()->type == CFile::type_attr::one_file) + { + if (0 == recvDataSrv.numElements()) + { + CArray& storeClient = grid->storeIndex_client; + recvDataSrv.resize(storeClient.numElements()); + } + + getRelFile()->checkReadFile(); + + if (!nstepMax) + { + nstepMax = getRelFile()->getDataInput()->getFieldNbRecords(CField::get(this)); + } + + this->incrementNStep(); + + if (getNStep() > nstepMax && (getRelFile()->cyclic.isEmpty() || !getRelFile()->cyclic) ) + readState = RF_EOF; + + if (RF_EOF != readState) + getRelFile()->getDataInput()->readFieldData(CField::get(this)); + } + } + else + { + this->incrementNStep(); + if (getNStep() > nstepMax && (getRelFile()->cyclic.isEmpty() || !getRelFile()->cyclic) ) + readState = RF_EOF; + else + readState = RF_NODATA; + + if (!nstepMaxRead) // This can be a bug if we try to read field from zero time record + readState = RF_NODATA; + } + + if (!nstepMaxRead) + { + MPI_Allreduce(MPI_IN_PLACE, &nstepMax, 1, MPI_INT, MPI_MAX, context->server->intraComm); + nstepMaxRead = true; + } + + return readState; } - CATCH_DUMP_ATTR + CATCH_DUMP_ATTR - /* Receive read data from server. At the moment, this function is called in the client side. @@ -255,80 +557,105 @@ namespace xios TRY { string fieldId; - for (auto& subEvent : event.subEvents) (*subEvent.buffer) >> fieldId ; - get(fieldId)->receiveReadDataReady(event); + vector ranks; + vector buffers; + + list::iterator it; + for (it = event.subEvents.begin(); it != event.subEvents.end(); ++it) + { + ranks.push_back(it->rank); + CBufferIn* buffer = it->buffer; + *buffer >> fieldId; + buffers.push_back(buffer); + } + get(fieldId)->recvReadDataReady(ranks, buffers); } CATCH - void CField::receiveReadDataReady(CEventServer& event) + /*! + Receive read data from server + \param [in] ranks Ranks of sending processes + \param [in] buffers buffers containing read data + */ + void CField::recvReadDataReady(vector ranks, vector buffers) TRY { - clientFromServerSourceFilter_->streamData(event) ; - } - CATCH_DUMP_ATTR + CContext* context = CContext::getCurrent(); + std::map > data; + const bool wasEOF = isEOF; + for (int i = 0; i < ranks.size(); i++) + { + int rank = ranks[i]; + int record; + *buffers[i] >> record; + isEOF = (record == int(-1)); - void CField::checkForLateDataFromCoupler(void) - TRY - { - CContext* context = CContext::getCurrent(); - const CDate& currentDate = context->getCalendar()->getCurrentDate(); + if (!isEOF) + *buffers[i] >> data[rank]; + else + break; + } - CTimer timer("CField::checkForLateDataFromCoupler"); - timer.resume(); - traceOff() ; - timer.suspend(); - - bool isDataLate; - do + if (wasDataAlreadyReceivedFromServer) + lastDataReceivedFromServer = lastDataReceivedFromServer + file->output_freq; + else { - isDataLate=clientFromClientSourceFilter_->isDataLate() ; - if (isDataLate) - { - timer.resume(); - context->globalEventLoop(); - timer.suspend(); - } - } while (isDataLate && timer.getCumulatedTime() < CXios::recvFieldTimeout); - - timer.resume(); - traceOn() ; - timer.suspend() ; + lastDataReceivedFromServer = context->getCalendar()->getInitDate(); + wasDataAlreadyReceivedFromServer = true; + } - if (isDataLate) ERROR("void CField::checkForLateDataFromCoupler(void)", - << "Late data at timestep = " << currentDate); + if (isEOF) + { + if (!wasEOF) + dateEOF = lastDataReceivedFromServer; + + serverSourceFilter->signalEndOfStream(lastDataReceivedFromServer); + } + else + serverSourceFilter->streamDataFromServer(lastDataReceivedFromServer, data); } CATCH_DUMP_ATTR void CField::checkForLateDataFromServer(void) TRY { - clientFromServerSourceFilter_->checkForLateData() ; - } - CATCH_DUMP_ATTR - - - void CField::triggerLateField(void) - TRY - { - if (hasFileIn()) - { - checkForLateDataFromServer() ; - clientFromServerSourceFilter_->trigger(CContext::getCurrent()->getCalendar()->getCurrentDate()) ; - } - else if (hasCouplerIn()) + CContext* context = CContext::getCurrent(); + const CDate& currentDate = context->getCalendar()->getCurrentDate(); + + // Check if data previously requested has been received as expected + if (wasDataRequestedFromServer && !isEOF) { - checkForLateDataFromCoupler() ; - clientFromClientSourceFilter_->trigger(CContext::getCurrent()->getCalendar()->getCurrentDate()) ; + CTimer timer("CField::checkForLateDataFromServer"); + + bool isDataLate; + do + { + const CDate nextDataDue = wasDataAlreadyReceivedFromServer ? (lastDataReceivedFromServer + file->output_freq) : context->getCalendar()->getInitDate(); + isDataLate = (nextDataDue <= currentDate); + + if (isDataLate) + { + timer.resume(); + + context->checkBuffersAndListen(); + + timer.suspend(); + } + } + while (isDataLate && timer.getCumulatedTime() < CXios::recvFieldTimeout); + + if (isDataLate) + ERROR("void CField::checkForLateDataFromServer(void)", + << "Late data at timestep = " << currentDate); } } CATCH_DUMP_ATTR - void CField::checkIfMustAutoTrigger(void) TRY { - mustAutoTrigger = clientFromServerSourceFilter_ ? clientFromServerSourceFilter_->mustAutoTrigger() : false; + mustAutoTrigger = serverSourceFilter ? serverSourceFilter->mustAutoTrigger() : false; } CATCH_DUMP_ATTR @@ -336,776 +663,875 @@ namespace xios TRY { if (mustAutoTrigger) - clientFromServerSourceFilter_->trigger(CContext::getCurrent()->getCalendar()->getCurrentDate()); + serverSourceFilter->trigger(CContext::getCurrent()->getCalendar()->getCurrentDate()); } CATCH_DUMP_ATTR + //---------------------------------------------------------------- - //---------------------------------------------------------------- - - StdString CField::GetName(void) { return StdString("field"); } - StdString CField::GetDefName(void) { return CField::GetName(); } - ENodeType CField::GetType(void) { return eField; } + void CField::setRelFile(CFile* _file) + TRY + { + this->file = _file; + hasOutputFile = true; + } + CATCH_DUMP_ATTR - //---------------------------------------------------------------- + //---------------------------------------------------------------- - CGrid* CField::getRelGrid(void) const - TRY - { - return this->grid_; - } - CATCH + StdString CField::GetName(void) { return StdString("field"); } + StdString CField::GetDefName(void) { return CField::GetName(); } + ENodeType CField::GetType(void) { return eField; } - //---------------------------------------------------------------- + //---------------------------------------------------------------- - CFile* CField::getRelFile(void) const - TRY - { - if (hasFileIn()) return this->fileIn_; - else if (hasFileOut()) return this->fileOut_ ; - else return nullptr ; - } - CATCH + CGrid* CField::getRelGrid(void) const + TRY + { + return this->grid; + } + CATCH - CGrid* CField::getAssociatedGrid(void) const - TRY - { - return this->grid_; - } - CATCH + //---------------------------------------------------------------- - CDomain* CField::getAssociatedDomain(const string& domainId, bool noError) const - { - if (grid_==nullptr) - { - if (noError) return nullptr ; - else ERROR("CDomain* CField::getAssociatedDomain(const string& domainId)", <<" field with id="<getAssociatedDomain(domainId, noError) ; - } + CFile* CField::getRelFile(void) const + TRY + { + return this->file; + } + CATCH - CAxis* CField::getAssociatedAxis(const string& axisId, bool noError) const - { - if (grid_==nullptr) - { - if (noError) return nullptr ; - else ERROR("CAxis* CField::getAssociatedAxis(const string& axisId)", <<" field with id="<getAssociatedAxis(axisId, noError) ; - } + int CField::getNStep(void) const + TRY + { + return this->nstep; + } + CATCH - CScalar* CField::getAssociatedScalar(const string& scalarId, bool noError) const - { - if (grid_==nullptr) - { - if (noError) return nullptr ; - else ERROR("CScalar* CField::getAssociatedScalar(const string& scalarId)", <<" field with id="<getAssociatedScalar(scalarId, noError) ; - } + func::CFunctor::ETimeType CField::getOperationTimeType() const + TRY + { + return operationTimeType; + } + CATCH + //---------------------------------------------------------------- - func::CFunctor::ETimeType CField::getOperationTimeType() const - TRY - { - return operationTimeType; - } - CATCH + void CField::incrementNStep(void) + TRY + { + this->nstep++; + } + CATCH_DUMP_ATTR + void CField::resetNStep(int nstep /*= 0*/) + TRY + { + this->nstep = nstep; + } + CATCH_DUMP_ATTR - //---------------------------------------------------------------- + void CField::resetNStepMax(void) + TRY + { + this->nstepMax = 0; + nstepMaxRead = false; + } + CATCH_DUMP_ATTR - bool CField::isActive(bool atCurrentTimestep /*= false*/) const - TRY - { - if (modelToClientSourceFilter_) - return atCurrentTimestep ? modelToClientSourceFilter_->isDataExpected(CContext::getCurrent()->getCalendar()->getCurrentDate()) : true; - else if (clientToModelStoreFilter_) return true; - else if (instantDataFilter) - ERROR("bool CField::isActive(bool atCurrentTimestep)", - << "Impossible to check if field [ id = " << getId() << " ] is active as it cannot be used to receive nor send data."); - - return false; - } - CATCH + //---------------------------------------------------------------- - //---------------------------------------------------------------- + bool CField::isActive(bool atCurrentTimestep /*= false*/) const + TRY + { + if (clientSourceFilter) + return atCurrentTimestep ? clientSourceFilter->isDataExpected(CContext::getCurrent()->getCalendar()->getCurrentDate()) : true; + else if (storeFilter) + return true; + else if (instantDataFilter) + ERROR("bool CField::isActive(bool atCurrentTimestep)", + << "Impossible to check if field [ id = " << getId() << " ] is active as it cannot be used to receive nor send data."); - bool CField::wasWritten() const - TRY - { - return written; - } - CATCH + return false; + } + CATCH - void CField::setWritten() - TRY - { - written = true; - } - CATCH_DUMP_ATTR + //---------------------------------------------------------------- - //---------------------------------------------------------------- + bool CField::wasWritten() const + TRY + { + return written; + } + CATCH - bool CField::getUseCompressedOutput() const - TRY - { - return useCompressedOutput; - } - CATCH + void CField::setWritten() + TRY + { + written = true; + } + CATCH_DUMP_ATTR - void CField::setUseCompressedOutput() - TRY - { - useCompressedOutput = true; - } - CATCH_DUMP_ATTR + //---------------------------------------------------------------- - - //---------------------------------------------------------------- - + bool CField::getUseCompressedOutput() const + TRY + { + return useCompressedOutput; + } + CATCH - void CField::checkGridOfEnabledFields() - TRY - { - if (!isGridChecked) - { - isGridChecked = true; - solveCheckMaskIndex(false); - } - } - CATCH_DUMP_ATTR + void CField::setUseCompressedOutput() + TRY + { + useCompressedOutput = true; + } + CATCH_DUMP_ATTR - void CField::sendGridComponentOfEnabledFields() - TRY - { - solveGridDomainAxisRef(true); - // solveCheckMaskIndex(true); - } - CATCH_DUMP_ATTR + //---------------------------------------------------------------- - void CField::sendGridOfEnabledFields() - TRY - { - // solveGridDomainAxisRef(true); - solveCheckMaskIndex(true); - } - CATCH_DUMP_ATTR + std::shared_ptr CField::getInstantDataFilter() + TRY + { + return instantDataFilter; + } + CATCH_DUMP_ATTR - /*! - * Compute the required buffer size to send the fields data. - * \param [in/out] bufferSize Modifying the bufferSize for the client context - * \param [in/out] maxEventSize Modifying the maximum event size for the client context - * \param [in] bufferForWriting True if buffers are used for sending data for writing - */ - void CField::setContextClientDataBufferSize(map>& bufferSize, - map>& maxEventSize, - bool bufferForWriting) - { - auto& contextBufferSize = bufferSize[client] ; - auto& contextMaxEventSize = maxEventSize[client] ; - const std::map mapSize = grid_->getDataBufferSize(client, getId(), bufferForWriting); - for(auto& it : mapSize ) - { - // If contextBufferSize[it.first] does not exist, it will be zero-initialized - // so we can use it safely without checking for its existance - if (CXios::isOptPerformance) contextBufferSize[it.first] += it.second; - else if (contextBufferSize[it.first] < it.second) contextBufferSize[it.first] = it.second; + //---------------------------------------------------------------- - if (contextMaxEventSize[it.first] < it.second) contextMaxEventSize[it.first] = it.second; - } + /*! + Build up graph of grids which plays role of destination and source in grid transformation + This function should be called before \func solveGridReference() + */ + void CField::buildGridTransformationGraph() + TRY + { + CContext* context = CContext::getCurrent(); + if (context->hasClient && !context->hasServer) + { + if (grid && !grid->isTransformed() && hasDirectFieldReference() && grid != getDirectFieldReference()->grid) + { + grid->addTransGridSource(getDirectFieldReference()->grid); + } + } + } + CATCH_DUMP_ATTR - } + /*! + Generate a new grid destination if there are more than one grid source pointing to a same grid destination + */ + void CField::generateNewTransformationGridDest() + TRY + { + CContext* context = CContext::getCurrent(); + if (context->hasClient && !context->hasServer) + { + std::map >& gridSrcMap = grid->getTransGridSource(); + if (1 < gridSrcMap.size()) + { + // Search for grid source + CGrid* gridSrc = grid; + CField* currField = this; + std::vector hieraField; + + while (currField->hasDirectFieldReference() && (gridSrc == grid)) + { + hieraField.push_back(currField); + CField* tmp = currField->getDirectFieldReference(); + currField = tmp; + gridSrc = currField->grid; + } - void CField::setContextClientAttributesBufferSize(map>& bufferSize, - map>& maxEventSize, - bool bufferForWriting) - { - auto& contextBufferSize = bufferSize[client] ; - auto& contextMaxEventSize = maxEventSize[client] ; - const std::map mapSize = grid_->getAttributesBufferSize(client, bufferForWriting); - for(auto& it : mapSize ) - { - // If contextBufferSize[it.first] does not exist, it will be zero-initialized - // so we can use it safely without checking for its existance - if (contextBufferSize[it.first] < it.second) contextBufferSize[it.first] = it.second; - if (contextMaxEventSize[it.first] < it.second) contextMaxEventSize[it.first] = it.second; - } + if (gridSrcMap.end() != gridSrcMap.find(gridSrc)) + { + CGrid* gridTmp; + std::pair newGridDest = gridSrcMap[gridSrc]; + if (newGridDest.first) + { + StdString newIdGridDest = newGridDest.second; + if (!CGrid::has(newIdGridDest)) + { + ERROR("CGrid* CGrid::generateNewTransformationGridDest()", + << " Something wrong happened! Grid whose id " << newIdGridDest + << "should exist "); + } + gridTmp = CGrid::get(newIdGridDest); + } + else + { + StdString newIdGridDest = CGrid::generateId(gridSrc, grid); + gridTmp = CGrid::cloneGrid(newIdGridDest, grid); + + (gridSrcMap[gridSrc]).first = true; + (gridSrcMap[gridSrc]).second = newIdGridDest; + } + + // Update all descendants + for (std::vector::iterator it = hieraField.begin(); it != hieraField.end(); ++it) + { + (*it)->grid = gridTmp; + (*it)->updateRef((*it)->grid); + } + } + } + } + } + CATCH_DUMP_ATTR - } + void CField::updateRef(CGrid* grid) + TRY + { + if (!grid_ref.isEmpty()) grid_ref.setValue(grid->getId()); + else + { + std::vector axisTmp = grid->getAxis(); + std::vector domainTmp = grid->getDomains(); + if ((1getId()); + + if ((!domain_ref.isEmpty()) && (domainTmp.empty())) + ERROR("void CField::updateRef(CGrid* grid)", + << "Incoherent between available domain and domain_ref of field " << this->getId()); + if ((!axis_ref.isEmpty()) && (axisTmp.empty())) + ERROR("void CField::updateRef(CGrid* grid)", + << "Incoherent between available axis and axis_ref of field " << this->getId()); + + if (!domain_ref.isEmpty()) domain_ref.setValue(domainTmp[0]->getId()); + if (!axis_ref.isEmpty()) axis_ref.setValue(axisTmp[0]->getId()); + } + } + CATCH_DUMP_ATTR + + /*! + Solve reference of all enabled fields even the source fields . + In this step, we do transformations. + */ + void CField::solveAllEnabledFieldsAndTransform() + TRY + { + CContext* context = CContext::getCurrent(); + bool hasClient = context->hasClient; + bool hasServer = context->hasServer; + if (!isReferenceSolvedAndTransformed) + { + isReferenceSolvedAndTransformed = true; -// ym obsolete to be removed - std::map CField::getGridAttributesBufferSize(CContextClient* client, bool bufferForWriting /*= "false"*/) - TRY - { - return grid_->getAttributesBufferSize(client, bufferForWriting); - } - CATCH_DUMP_ATTR + if (hasClient && !hasServer) + { + solveRefInheritance(true); + if (hasDirectFieldReference()) getDirectFieldReference()->solveAllEnabledFieldsAndTransform(); + } -// ym obsolete to be removed - std::map CField::getGridDataBufferSize(CContextClient* client, bool bufferForWriting /*= "false"*/) - TRY - { - return grid_->getDataBufferSize(client, getId(), bufferForWriting); - } - CATCH_DUMP_ATTR + if (hasServer) + solveServerOperation(); - bool CField::evaluateBufferSize(map>& evaluateBuffer, bool isOptPerformance) - { - CContextClient* client=nullptr ; + solveGridReference(); - for(int i=0;i<2;i++) - { - map dataSize ; - if (i==0 && clientToServerStoreFilter_) client = clientToServerStoreFilter_-> getTransferedDataSize(dataSize) ; - if (i==1 && serverToClientStoreFilter_) client = serverToClientStoreFilter_-> getTransferedDataSize(dataSize) ; + if (hasClient && !hasServer) + { + solveGenerateGrid(); + buildGridTransformationGraph(); + } - if (client!=nullptr) - { - map bufferSize ; - - if (evaluateBuffer.count(client)!=0) bufferSize = evaluateBuffer[client] ; - if (isOptPerformance) + solveGridDomainAxisRef(false); + + if (hasClient && !hasServer) + { + solveTransformedGrid(); + } + + solveGridDomainAxisRef(false); + } + } + CATCH_DUMP_ATTR + + void CField::checkGridOfEnabledFields() + TRY + { + if (!isGridChecked) + { + isGridChecked = true; + solveCheckMaskIndex(false); + } + } + CATCH_DUMP_ATTR + + void CField::sendGridComponentOfEnabledFields() + TRY + { + solveGridDomainAxisRef(true); + // solveCheckMaskIndex(true); + } + CATCH_DUMP_ATTR + + void CField::sendGridOfEnabledFields() + TRY + { + // solveGridDomainAxisRef(true); + solveCheckMaskIndex(true); + } + CATCH_DUMP_ATTR + + void CField::solveOnlyReferenceEnabledField(bool doSending2Server) + TRY + { + CContext* context = CContext::getCurrent(); + if (!isReferenceSolved) + { + isReferenceSolved = true; + + if (context->hasClient && !context->hasServer) { - for(auto& it : dataSize) - { - if (bufferSize.count(it.first)==0) bufferSize[it.first]=it.second ; - else bufferSize[it.first]+=it.second ; - } + solveRefInheritance(true); + if (hasDirectFieldReference()) getDirectFieldReference()->solveOnlyReferenceEnabledField(false); } - else + + if (context->hasServer) + solveServerOperation(); + + solveGridReference(); + grid->solveDomainAxisRefInheritance(true); // make it again to solve grid reading from file + + if (context->hasClient && !context->hasServer) + { + solveGenerateGrid(); + buildGridTransformationGraph(); + } + } + } + CATCH_DUMP_ATTR + + void CField::solveAllReferenceEnabledField(bool doSending2Server) + TRY + { + CContext* context = CContext::getCurrent(); + solveOnlyReferenceEnabledField(doSending2Server); + + if (!areAllReferenceSolved) + { + areAllReferenceSolved = true; + + if (context->hasClient && !context->hasServer) { - for(auto& it : dataSize) - { - if (bufferSize.count(it.first)==0) bufferSize[it.first]=it.second ; - else bufferSize[it.first]=std::max(bufferSize[it.first],(size_t)it.second) ; - } + solveRefInheritance(true); + if (hasDirectFieldReference()) getDirectFieldReference()->solveAllReferenceEnabledField(false); } - evaluateBuffer[client] = bufferSize ; - client=nullptr ; - } - } - if (client==nullptr) return false ; - else return true; - } + else if (context->hasServer) + solveServerOperation(); + solveGridReference(); + } - size_t CField::getGlobalWrittenSize() - TRY - { - return grid_->getGlobalWrittenSize(); - } - CATCH_DUMP_ATTR + solveGridDomainAxisRef(doSending2Server); - //---------------------------------------------------------------- + if (context->hasClient && !context->hasServer) + { + solveTransformedGrid(); + } - void CField::solveServerOperation(void) - TRY - { - CContext* context = CContext::getCurrent(); + solveCheckMaskIndex(doSending2Server); + } + CATCH_DUMP_ATTR + + std::map CField::getGridAttributesBufferSize(CContextClient* client, bool bufferForWriting /*= "false"*/) + TRY + { + return grid->getAttributesBufferSize(client, bufferForWriting); + } + CATCH_DUMP_ATTR + + std::map CField::getGridDataBufferSize(CContextClient* client, bool bufferForWriting /*= "false"*/) + TRY + { + return grid->getDataBufferSize(client, getId(), bufferForWriting); + } + CATCH_DUMP_ATTR + + size_t CField::getGlobalWrittenSize() + TRY + { + return grid->getGlobalWrittenSize(); + } + CATCH_DUMP_ATTR + + //---------------------------------------------------------------- + + void CField::solveServerOperation(void) + TRY + { + CContext* context = CContext::getCurrent(); - if (freq_op.isEmpty()) freq_op.setValue(TimeStep); + if (!context->hasServer || !hasOutputFile) return; - if (freq_offset.isEmpty()) freq_offset.setValue(NoneDu); + if (freq_op.isEmpty()) + freq_op.setValue(TimeStep); - if (operation.isEmpty()) - ERROR("void CField::solveServerOperation(void)", - << "An operation must be defined for field \"" << getId() << "\"."); + if (freq_offset.isEmpty()) + freq_offset.setValue(NoneDu); - std::shared_ptr functor; - CArray dummyData; + freq_operation_srv = file->output_freq.getValue(); + freq_write_srv = file->output_freq.getValue(); + + lastlast_Write_srv = context->getCalendar()->getInitDate(); + last_Write_srv = context->getCalendar()->getInitDate(); + last_operation_srv = context->getCalendar()->getInitDate(); + + const CDuration toffset = freq_operation_srv - freq_offset.getValue() - context->getCalendar()->getTimeStep(); + last_operation_srv = last_operation_srv - toffset; + + if (operation.isEmpty()) + ERROR("void CField::solveServerOperation(void)", + << "An operation must be defined for field \"" << getId() << "\"."); + + std::shared_ptr functor; + CArray dummyData; #define DECLARE_FUNCTOR(MType, mtype) \ - if (operation.getValue().compare(#mtype) == 0) \ - { \ - functor.reset(new func::C##MType(dummyData)); \ - } + if (operation.getValue().compare(#mtype) == 0) \ + { \ + functor.reset(new func::C##MType(dummyData)); \ + } #include "functor_type.conf" - if (!functor) - ERROR("void CField::solveServerOperation(void)", - << "\"" << operation << "\" is not a valid operation."); + if (!functor) + ERROR("void CField::solveServerOperation(void)", + << "\"" << operation << "\" is not a valid operation."); - operationTimeType = functor->timeType(); - } - CATCH_DUMP_ATTR + operationTimeType = functor->timeType(); + } + CATCH_DUMP_ATTR - //---------------------------------------------------------------- + //---------------------------------------------------------------- - bool CField::buildWorkflowGraph(CGarbageCollector& gc) - { - if (buildWorkflowGraphDone_) return true ; + /*! + * Constructs the graph filter for the field, enabling or not the data output. + * This method should not be called more than once with enableOutput equal to true. + * + * \param gc the garbage collector to use when building the filter graph + * \param enableOutput must be true when the field data is to be + * read by the client or/and written to a file + */ + void CField::buildFilterGraph(CGarbageCollector& gc, bool enableOutput, Time start_graph, Time end_graph) + TRY + { + if (!isReferenceSolvedAndTransformed) solveAllEnabledFieldsAndTransform(); + if (!isGridChecked) checkGridOfEnabledFields(); - - const bool detectMissingValues = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); - const double defaultValue = detectMissingValues ? default_value : (!default_value.isEmpty() ? default_value : 0.0); - bool buildGraph_ = !build_workflow_graph.isEmpty() && build_workflow_graph == true ; + const bool detectMissingValues = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); + + const bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); + if(buildWorkflowGraph && this->operation.getValue()=="once") + { + CDuration tmp_dur = 0; + tmp_dur.timestep = 1; + this->build_workflow_graph_start.setValue(tmp_dur) ; + this->build_workflow_graph_end.setValue(tmp_dur) ; + } + + const double defaultValue = detectMissingValues ? default_value : (!default_value.isEmpty() ? default_value : 0.0); - if (!inputFilter) inputFilter = std::shared_ptr(new CPassThroughFilter(gc)); + CContext* context = CContext::getCurrent(); + + Time filter_start; + if(!build_workflow_graph_start.isEmpty() && buildWorkflowGraph) filter_start = context->calendar->getInitDate()+build_workflow_graph_start; + else if(build_workflow_graph_start.isEmpty() && buildWorkflowGraph) filter_start = 0; + else filter_start = -1; + + Time filter_end; + if(!build_workflow_graph_end.isEmpty() && buildWorkflowGraph) filter_end = context->calendar->getInitDate()+build_workflow_graph_end; + else if(build_workflow_graph_end.isEmpty() && buildWorkflowGraph) filter_end = 9223372036854775807; + else filter_end = -1; + + if(this->field_graph_start==-2) this->field_graph_start = filter_start; + if(this->field_graph_end==-2) this->field_graph_end = filter_end; // init + + + if(start_graph == -1) + { + //nothing + } + else //if(start_graph != -1) + { + if(this->field_graph_start == -1) this->field_graph_start = start_graph; + else this->field_graph_start = min(this->field_graph_start, start_graph); + } + + + if(end_graph == -1) + { + //nothing + } + else + { + if(this->field_graph_end == -1) this->field_graph_end = end_graph; + else this->field_graph_end = max(this->field_graph_end, end_graph); + + } - if (hasDirectFieldReference()) - { - CField* fieldRef = getDirectFieldReference(); - - //------ build_workflow_graph start - if(buildGraph_) - { - (*fieldRef).build_workflow_graph.set(build_workflow_graph); - } - else - { - this->build_workflow_graph.set(fieldRef->build_workflow_graph); - buildGraph_ = !build_workflow_graph.isEmpty() && build_workflow_graph == true ; - } - - // if(buildGraph_) this->build_workflow_graph.set(build_workflow_graph); - //------ build_workflow_graph end + filter_start = this->field_graph_start; + filter_end = this->field_graph_end; - bool ret=fieldRef->buildWorkflowGraph(gc); - if (!ret) return false ; // workflow graph cannot be built at this stage - - this->build_workflow_graph.set(fieldRef->build_workflow_graph); - buildGraph_ = !build_workflow_graph.isEmpty() && build_workflow_graph == true ; - } + - // now construct grid and check if element are enabled - solveGridReference() ; // grid_ is now defined - if (!isGridCompleted()) return false; - if (grid_->activateFieldWorkflow(gc)==false) return false; // workflow graph cannot be built at this stage + bool hasWriterServer = context->hasServer && !context->hasClient; + bool hasIntermediateServer = context->hasServer && context->hasClient; - // Check if we have an expression to parse - std::shared_ptr filterExpr ; - if (hasExpression()) - { - boost::scoped_ptr expr(parseExpr(getExpression() + '\0')); - filterExpr = expr->reduce(gc, *this); - - - if (!filterExpr) return false ; // workflow graph cannot be built at this stage - } - - // prepare transformation. Need to know before if workflow of auxillary field can be built - if (hasDirectFieldReference()) - { - auto gridPath=getGridPath() ; - gridPath.push_back(grid_) ; - - CGrid* gridSrc=getDirectFieldReference()->getGrid() ; - std::shared_ptr lastFilter ; - if (filterExpr) lastFilter=filterExpr ; - else lastFilter = inputFilter ; - CGrid* newGrid ; - - for(auto grid : gridPath) - { - grid->solveElementsRefInheritance() ; - std::pair, std::shared_ptr > filters = grid->buildTransformationGraph(gc, false, gridSrc, detectMissingValues, defaultValue, newGrid, buildGraph_, this) ; - lastFilter->connectOutput(filters.first, 0); - lastFilter = filters.second; - gridSrc = newGrid ; - } + if (hasWriterServer) + { + if (!instantDataFilter) + instantDataFilter = clientSourceFilter = std::shared_ptr(new CSourceFilter(gc, grid, true, false)); - grid_=newGrid ; - grid_ref=grid_->getId() ; // for server - instantDataFilter = lastFilter ; - - // connect the input Filter to the reference - getDirectFieldReference()->getInstantDataFilter()->connectOutput(inputFilter,0); - if(buildGraph_) - { - inputFilter->graphEnabled=true; - inputFilter->graphPackage = new CGraphPackage; - inputFilter->graphPackage->inFields.push_back(this); - inputFilter->label_field_id = getDirectFieldReference()->getId(); - } - } - else - { - std::shared_ptr lastFilter = inputFilter; - if (hasExpression()) - { - if (filterExpr) + + // If the field data is to be read by the client or/and written to a file + if (enableOutput && !storeFilter && !fileWriterFilter) + { + if (file && (file->mode.isEmpty() || file->mode == CFile::mode_attr::write)) { - lastFilter=filterExpr ; + fileServerWriterFilter = std::shared_ptr(new CFileServerWriterFilter(gc, this)); + instantDataFilter->connectOutput(fileServerWriterFilter, 0); } - } - - if (hasFileIn()) // input file, attemp to read the grid from file - { - // must be checked - fileIn_->initRead() ; - fileIn_->checkReadFile(); - grid_->solveElementsRefInheritance() ; - if (fileIn_->isClientSide()) fileIn_->readFieldAttributesMetaData(this); - CGrid* newGrid ; - std::pair, std::shared_ptr > filters = grid_->buildTransformationGraph(gc, true, nullptr, detectMissingValues, defaultValue, newGrid, buildGraph_, this) ; - grid_ = newGrid ; - grid_ref=grid_->getId() ; // for server - //grid_->completeGrid(); // grid generation, to be checked - if (fileIn_->isClientSide()) fileIn_->readFieldAttributesValues(this); - grid_->checkElementsAttributes() ; -// grid_->solveDomainAxisBaseRef(); - // probably in future tag grid incomplete if coming from a reading - instantDataFilter=lastFilter ; - } - else if (hasCouplerIn()) - { - grid_->checkElementsAttributes() ; - instantDataFilter=lastFilter ; - } - else - { - setModelIn() ; // no reference, the field is potentially a source field from model - - grid_->solveElementsRefInheritance() ; - CGrid* newGrid ; - std::pair, std::shared_ptr > filters = grid_->buildTransformationGraph(gc, true, nullptr, detectMissingValues, defaultValue, newGrid, buildGraph_, this) ; - newGrid->duplicateAttributes(grid_) ; // for grid attributes (mask) - grid_ = newGrid ; - grid_ref=grid_->getId() ; // for server - grid_->checkElementsAttributes() ; - instantDataFilter=lastFilter ; - } - } - - if (hasFileOut()) - { - if (fileOut_->isServerSide()) - { - this->solveServerOperation() ; - } - } - - buildWorkflowGraphDone_ = true ; - workflowEnabled_ = true ; - return true ; - } - - /*! - * Connect field to filter to send data to server. A temporal filter is inserted before accordingly to the - * output frequency of the file - * \param gc the garbage collector to use when building the filter graph - */ - void CField::connectToFileServer(CGarbageCollector& gc) - { - // insert temporal filter before sending to files - clientToServerStoreFilter_ = std::shared_ptr(new CClientToServerStoreFilter(gc, this, client)); - // insert temporal filter before sending to files - getTemporalDataFilter(gc, fileOut_->output_freq)->connectOutput(clientToServerStoreFilter_, 0); - const bool buildGraph_ = !build_workflow_graph.isEmpty() && build_workflow_graph == true ; - if(buildGraph_) - { - clientToServerStoreFilter_->graphPackage = new CGraphPackage; - clientToServerStoreFilter_->graphEnabled = true; - clientToServerStoreFilter_->graphPackage->inFields.push_back(this); - } - } - - void CField::connectToCouplerOut(CGarbageCollector& gc) - { - // insert temporal filter before sending to files - clientToServerStoreFilter_ = std::shared_ptr(new CClientToServerStoreFilter(gc, this, client)); - instantDataFilter->connectOutput(clientToServerStoreFilter_, 0); - const bool buildGraph_ = !build_workflow_graph.isEmpty() && build_workflow_graph == true ; - if(buildGraph_) - { - clientToServerStoreFilter_->graphPackage = new CGraphPackage; - clientToServerStoreFilter_->graphEnabled = true; - clientToServerStoreFilter_->graphPackage->inFields.push_back(this); - } - } - - - /*! - * Connect field to a source filter to receive data from model. - */ - void CField::connectToModelInput(CGarbageCollector& gc) - { - const bool detectMissingValues = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); - const double defaultValue = detectMissingValues ? default_value : (!default_value.isEmpty() ? default_value : 0.0); - - if (check_if_active.isEmpty()) check_if_active = false; - modelToClientSourceFilter_ = std::shared_ptr(new CModelToClientSourceFilter(gc, grid_, detectMissingValues, defaultValue)); - modelToClientSourceFilter_ -> connectOutput(inputFilter,0) ; - const bool buildGraph_ = !build_workflow_graph.isEmpty() && build_workflow_graph == true ; - if(buildGraph_ ) - { - modelToClientSourceFilter_->graphPackage = new CGraphPackage; - modelToClientSourceFilter_->graphEnabled = true; - modelToClientSourceFilter_->graphPackage->inFields.push_back(this); - } - } - - /*! - * Connect field to a source filter to receive data from a client (on server side). - */ - void CField::connectToClientInput(CGarbageCollector& gc) - { - serverFromClientSourceFilter_ = std::shared_ptr(new CServerFromClientSourceFilter(gc, grid_)); - serverFromClientSourceFilter_ -> connectOutput(inputFilter,0) ; - const bool buildGraph_ = !build_workflow_graph.isEmpty() && build_workflow_graph == true ; - if(buildGraph_) - { - serverFromClientSourceFilter_->graphPackage = new CGraphPackage; - serverFromClientSourceFilter_->graphEnabled = true; - serverFromClientSourceFilter_->graphPackage->inFields.push_back(this); - } - } - + } + } + else if (hasIntermediateServer) + { + if (!instantDataFilter) + instantDataFilter = clientSourceFilter = std::shared_ptr(new CSourceFilter(gc, grid, false, false)); + + // If the field data is to be read by the client or/and written to a file + if (enableOutput && !storeFilter && !fileWriterFilter) + { + if (file && (file->mode.isEmpty() || file->mode == CFile::mode_attr::write)) + { + fileWriterFilter = std::shared_ptr(new CFileWriterFilter(gc, this)); + instantDataFilter->connectOutput(fileWriterFilter, 0); + } + } + } + else + { + // Start by building a filter which can provide the field's instant data + if (!instantDataFilter) + { + // Check if we have an expression to parse + if (hasExpression()) + { + boost::scoped_ptr expr(parseExpr(getExpression() + '\0')); + std::shared_ptr filter = expr->reduce(gc, *this, filter_start, filter_end); + + // Check if a spatial transformation is needed + if (!field_ref.isEmpty()) + { + CGrid* gridRef = CField::get(field_ref)->grid; + + if (grid && grid != gridRef && grid->hasTransform()) + { + std::pair, std::shared_ptr > filters = CSpatialTransformFilter::buildFilterGraph(gc, gridRef, grid, detectMissingValues, defaultValue); + + filter->connectOutput(filters.first, 0); + filter = filters.second; + } + } + + instantDataFilter = filter; + instantDataFilter->field = this; + filter->tag = buildWorkflowGraph; + + filter->start_graph = filter_start; + filter->end_graph = filter_end; + + for(int i=0; iparent_filters.size(); i++) + { + filter->tag = filter->tag || filter->parent_filters[i]->tag; + } + } + // Check if we have a reference on another field + else if (!field_ref.isEmpty()) + { + instantDataFilter = getFieldReference(gc, filter_start, filter_end); + instantDataFilter->tag = buildWorkflowGraph; + instantDataFilter->start_graph = filter_start; + instantDataFilter->end_graph = filter_end; + } + // Check if the data is to be read from a file + else if (file && !file->mode.isEmpty() && file->mode == CFile::mode_attr::read) + { + checkTimeAttributes(); + instantDataFilter = serverSourceFilter = std::shared_ptr(new CSourceFilter(gc, grid, true, false, freq_offset, true, + detectMissingValues, defaultValue)); + instantDataFilter->tag = buildWorkflowGraph; + instantDataFilter->start_graph = filter_start; + instantDataFilter->end_graph = filter_end; + instantDataFilter->field = this; - /*! - * Connect field to a source filter to receive data from a server (on client side). - */ - void CField::connectToServerInput(CGarbageCollector& gc) - { - checkTimeAttributes(); - clientFromServerSourceFilter_ = std::shared_ptr(new CClientFromServerSourceFilter(gc,this)) ; - clientFromServerSourceFilter_ -> connectOutput(inputFilter,0) ; - const bool buildGraph_ = !build_workflow_graph.isEmpty() && build_workflow_graph == true ; - if(buildGraph_) - { - clientFromServerSourceFilter_->graphPackage = new CGraphPackage; - clientFromServerSourceFilter_->graphEnabled = true; - clientFromServerSourceFilter_->graphPackage->inFields.push_back(this); - } - } + } + else // The data might be passed from the model + { + if (check_if_active.isEmpty()) check_if_active = false; + instantDataFilter = clientSourceFilter = std::shared_ptr(new CSourceFilter(gc, grid, false, true, NoneDu, false, + detectMissingValues, defaultValue)); + instantDataFilter->tag = buildWorkflowGraph; + instantDataFilter->start_graph = filter_start; + instantDataFilter->end_graph = filter_end; + instantDataFilter->field = this; + } + } - /*! - * Connect field to a source filter to receive data from coupler (on client side). - */ - void CField::connectToCouplerIn(CGarbageCollector& gc) - { - CContext* context = CContext::getCurrent(); + // If the field data is to be read by the client or/and written to a file + if (enableOutput && !storeFilter && !fileWriterFilter) + { + if (!read_access.isEmpty() && read_access) + { + storeFilter = std::shared_ptr(new CStoreFilter(gc, CContext::getCurrent(), grid, + detectMissingValues, defaultValue)); + instantDataFilter->connectOutput(storeFilter, 0); + + storeFilter->tag = (instantDataFilter->tag || buildWorkflowGraph); + instantDataFilter->start_graph = filter_start; + instantDataFilter->end_graph = filter_end; + + instantDataFilter->setParentFiltersTag(); + storeFilter->start_graph = filter_start; + storeFilter->end_graph = filter_end; + storeFilter->field = this; + storeFilter->distance = instantDataFilter->distance+1; + } - if (freq_op.isEmpty()) freq_op.setValue(TimeStep); - if (freq_offset.isEmpty()) freq_offset.setValue(freq_op.getValue() - TimeStep); - clientFromClientSourceFilter_ = std::shared_ptr(new CClientFromClientSourceFilter(gc, this)) ; - clientFromClientSourceFilter_ -> connectOutput(inputFilter,0) ; - const bool buildGraph_ = !build_workflow_graph.isEmpty() && build_workflow_graph == true ; - if(buildGraph_) - { - clientFromClientSourceFilter_->graphPackage = new CGraphPackage; - clientFromClientSourceFilter_->graphEnabled = true; - clientFromClientSourceFilter_->graphPackage->inFields.push_back(this); - } - } + if (file && (file->mode.isEmpty() || file->mode == CFile::mode_attr::write)) + { + fileWriterFilter = std::shared_ptr(new CFileWriterFilter(gc, this)); + getTemporalDataFilter(gc, file->output_freq)->connectOutput(fileWriterFilter, 0); + + fileWriterFilter->tag = (getTemporalDataFilter(gc, file->output_freq)->tag || buildWorkflowGraph); + getTemporalDataFilter(gc, file->output_freq)->start_graph = filter_start; + getTemporalDataFilter(gc, file->output_freq)->end_graph = filter_end; + getTemporalDataFilter(gc, file->output_freq)->tag = buildWorkflowGraph; + getTemporalDataFilter(gc, file->output_freq)->setParentFiltersTag(); + fileWriterFilter->start_graph = filter_start; + fileWriterFilter->end_graph = filter_end; + fileWriterFilter->distance = getTemporalDataFilter(gc, file->output_freq)->distance+1; - /*! - * Connect field to a file writer filter to write data in file (on server side). - */ - void CField::connectToFileWriter(CGarbageCollector& gc) - { - fileWriterStoreFilter_ = std::shared_ptr(new CFileWriterStoreFilter(gc, this)); - instantDataFilter->connectOutput(fileWriterStoreFilter_, 0); - const bool buildGraph_ = !build_workflow_graph.isEmpty() && build_workflow_graph == true ; - if(buildGraph_) - { - fileWriterStoreFilter_->graphPackage = new CGraphPackage; - fileWriterStoreFilter_->graphEnabled = true; - fileWriterStoreFilter_->graphPackage->inFields.push_back(this); - } - } - /*! - * Connect field to a file reader filter to read data from file (on server side). - */ - void CField::connectToFileReader(CGarbageCollector& gc) - { - fileReaderSourceFilter_ = std::shared_ptr(new CFileReaderSourceFilter(gc, this)); - fileReaderSourceFilter_->connectOutput(inputFilter, 0); - const bool buildGraph_ = !build_workflow_graph.isEmpty() && build_workflow_graph == true ; - if(buildGraph_) - { - fileReaderSourceFilter_->graphPackage = new CGraphPackage; - fileReaderSourceFilter_->graphEnabled = true; - fileReaderSourceFilter_->graphPackage->inFields.push_back(this); - } - } + } + } + } + } + CATCH_DUMP_ATTR + /*! + * Returns the filter needed to handle the field reference. + * This method should only be called when building the filter graph corresponding to the field. + * + * \param gc the garbage collector to use + * \return the output pin corresponding to the field reference + */ + std::shared_ptr CField::getFieldReference(CGarbageCollector& gc, Time start_graph, Time end_graph) + TRY + { + if (instantDataFilter || field_ref.isEmpty()) + ERROR("COutputPin* CField::getFieldReference(CGarbageCollector& gc)", + "Impossible to get the field reference for a field which has already been parsed or which does not have a field_ref."); + + CField* fieldRef = CField::get(field_ref); + fieldRef->buildFilterGraph(gc, false, start_graph, end_graph); + const bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); + + CContext* context = CContext::getCurrent(); + + Time filter_start; + if(!build_workflow_graph_start.isEmpty() && buildWorkflowGraph) filter_start = context->calendar->getInitDate()+build_workflow_graph_start; + else if(build_workflow_graph_start.isEmpty() && buildWorkflowGraph) filter_start = 0; + else filter_start = -1; + + Time filter_end; + if(!build_workflow_graph_end.isEmpty() && buildWorkflowGraph) filter_end = context->calendar->getInitDate()+build_workflow_graph_end; + else if(build_workflow_graph_end.isEmpty() && buildWorkflowGraph) filter_end = 9223372036854775807; + else filter_end = -1; + + if(this->field_graph_start==-2) this->field_graph_start = filter_start; + if(this->field_graph_end==-2) this->field_graph_end = filter_end; // init + + + if(start_graph == -1) + { + //nothing + } + else //if(start_graph != -1) + { + if(this->field_graph_start == -1) this->field_graph_start = start_graph; + else this->field_graph_start = min(this->field_graph_start, start_graph); + } + + if(end_graph == -1) + { + //nothing + } + else + { + if(this->field_graph_end == -1) this->field_graph_end = end_graph; + else this->field_graph_end = max(this->field_graph_end, end_graph); + } + + filter_start = this->field_graph_start; + filter_end = this->field_graph_end; + + + std::pair, std::shared_ptr > filters; + // Check if a spatial transformation is needed + if (grid && grid != fieldRef->grid && grid->hasTransform()) + { + bool hasMissingValue = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); + double defaultValue = hasMissingValue ? default_value : (!default_value.isEmpty() ? default_value : 0.0); + filters = CSpatialTransformFilter::buildFilterGraph(gc, fieldRef->grid, grid, hasMissingValue, defaultValue); + + fieldRef->getInstantDataFilter()->connectOutput(filters.first, 0); - /*! - * Connect field to a store filter to output data to model on client Side - */ - void CField::connectToModelOutput(CGarbageCollector& gc) - { - clientToModelStoreFilter_ = std::shared_ptr(new CClientToModelStoreFilter(gc, this)); - instantDataFilter->connectOutput(clientToModelStoreFilter_, 0); - const bool buildGraph_ = !build_workflow_graph.isEmpty() && build_workflow_graph == true ; - if(buildGraph_) - { - clientToModelStoreFilter_->graphPackage = new CGraphPackage; - clientToModelStoreFilter_->graphEnabled = true; - clientToModelStoreFilter_->graphPackage->inFields.push_back(this); - } - } + + filters.second->parent_filters.resize(1); + filters.second->parent_filters[0]= fieldRef->getInstantDataFilter(); + + filters.second->tag = (buildWorkflowGraph || filters.second->parent_filters[0]->tag); + + filters.second->start_graph = filter_start; + filters.second->end_graph = filter_end; + filters.second->field = this; + + } + else + { + filters.first = filters.second = std::shared_ptr(new CPassThroughFilter(gc)); + + fieldRef->getInstantDataFilter()->connectOutput(filters.first, 0); + - - void CField::connectToServerToClient(CGarbageCollector& gc) - { - serverToClientStoreFilter_ = std::shared_ptr(new CServerToClientStoreFilter(gc, this, client)); - instantDataFilter->connectOutput(serverToClientStoreFilter_, 0); - const bool buildGraph_ = !build_workflow_graph.isEmpty() && build_workflow_graph == true ; - if(buildGraph_) - { - serverToClientStoreFilter_->graphPackage = new CGraphPackage; - serverToClientStoreFilter_->graphEnabled = true; - serverToClientStoreFilter_->graphPackage->inFields.push_back(this); - } - } + filters.second->parent_filters.resize(1); + filters.second->parent_filters[0]= fieldRef->getInstantDataFilter(); - /*! - * Transform the grid_path attribut into vector of grid. - * \return the vector CGrid* containing the list of grid path for tranformation - */ - vector CField::getGridPath(void) - { - std::vector gridPath; + filters.second->tag = (buildWorkflowGraph || filters.second->parent_filters[0]->tag); - if (hasDirectFieldReference() && grid_ != getDirectFieldReference()->grid_) - { - if (!grid_path.isEmpty()) - { - std::string gridId; - size_t start = 0, end; + filters.second->start_graph = filter_start; + filters.second->end_graph = filter_end; + filters.second->field = this; - do - { - end = grid_path.getValue().find(',', start); - if (end != std::string::npos) - { - gridId = grid_path.getValue().substr(start, end - start); - start = end + 1; - } - else gridId = grid_path.getValue().substr(start); + } - if (!CGrid::has(gridId)) - ERROR("void CField::solveTransformedGrid()", - << "Invalid grid_path, the grid '" << gridId << "' does not exist."); + return filters.second; + } + CATCH_DUMP_ATTR - gridPath.push_back(CGrid::get(gridId)); - } - while (end != std::string::npos); - } - } - return gridPath ; - } + /*! + * Returns the filter needed to handle a self reference in the field's expression. + * If the needed filter does not exist, it is created, otherwise it is reused. + * This method should only be called when building the filter graph corresponding + * to the field's expression. + * + * \param gc the garbage collector to use + * \return the output pin corresponding to a self reference + */ + std::shared_ptr CField::getSelfReference(CGarbageCollector& gc, Time start_graph, Time end_graph) + TRY + { - - - /*! - * Returns the filter needed to handle a self reference in the field's expression. - * If the needed filter does not exist, it is created, otherwise it is reused. - * This method should only be called when building the filter graph corresponding - * to the field's expression. - * - * \param gc the garbage collector to use - * \return the output pin corresponding to a self reference - */ + if (instantDataFilter || !hasExpression()) + ERROR("COutputPin* CField::getSelfReference(CGarbageCollector& gc)", + "Impossible to add a self reference to a field which has already been parsed or which does not have an expression."); + + bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); -/* old version - std::shared_ptr CField::getSelfReference(CGarbageCollector& gc) - TRY - { - if (instantDataFilter || !hasExpression()) - ERROR("COutputPin* CField::getSelfReference(CGarbageCollector& gc)", - "Impossible to add a self reference to a field which has already been parsed or which does not have an expression."); + if (!selfReferenceFilter) + { + const bool detectMissingValues = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); + const double defaultValue = detectMissingValues ? default_value : (!default_value.isEmpty() ? default_value : 0.0); - if (!selfReferenceFilter) - { - const bool detectMissingValues = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); - const double defaultValue = detectMissingValues ? default_value : (!default_value.isEmpty() ? default_value : 0.0); + if (file && !file->mode.isEmpty() && file->mode == CFile::mode_attr::read) + { + if (!serverSourceFilter) + { + checkTimeAttributes(); + serverSourceFilter = std::shared_ptr(new CSourceFilter(gc, grid, true, false, freq_offset, true, + detectMissingValues, defaultValue)); + } - if (file && !file->mode.isEmpty() && file->mode == CFile::mode_attr::read) - { - if (!serverSourceFilter) - { - checkTimeAttributes(); - serverSourceFilter = std::shared_ptr(new CSourceFilter(gc, grid_, true, false, freq_offset, true, - detectMissingValues, defaultValue)); + selfReferenceFilter = serverSourceFilter; + } + else if (!field_ref.isEmpty()) + { + CField* fieldRef = CField::get(field_ref); + fieldRef->buildFilterGraph(gc, false); + selfReferenceFilter = fieldRef->getInstantDataFilter(); + } + else + { + if (!clientSourceFilter) + { + if (check_if_active.isEmpty()) check_if_active = false; + clientSourceFilter = std::shared_ptr(new CSourceFilter(gc, grid, true, true, NoneDu, false, + detectMissingValues, defaultValue)); } - selfReferenceFilter = serverSourceFilter; - } - else if (!field_ref.isEmpty()) - { - CField* fieldRef = CField::get(field_ref); - fieldRef->buildFilterGraph(gc, false); - selfReferenceFilter = fieldRef->getInstantDataFilter(); - } - else - { - if (!clientSourceFilter) - { - if (check_if_active.isEmpty()) check_if_active = false; - clientSourceFilter = std::shared_ptr(new CSourceFilter(gc, grid_, true, true, NoneDu, false, - detectMissingValues, defaultValue)); - } + selfReferenceFilter = clientSourceFilter; + } + } - selfReferenceFilter = clientSourceFilter; - } - } + selfReferenceFilter->tag = buildWorkflowGraph; + selfReferenceFilter->field = this; + return selfReferenceFilter; + } + CATCH_DUMP_ATTR - return selfReferenceFilter; - } - CATCH_DUMP_ATTR -*/ - std::shared_ptr CField::getSelfReference(CGarbageCollector& gc) - TRY - { - return inputFilter ; - } - CATCH_DUMP_ATTR + /*! + * Returns the temporal filter corresponding to the field's temporal operation + * for the specified operation frequency. The filter is created if it does not + * exist, otherwise it is reused. + * + * \param gc the garbage collector to use + * \param outFreq the operation frequency, i.e. the frequency at which the output data will be computed + * \return the output pin corresponding to the requested temporal filter + */ + std::shared_ptr CField::getTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq) + TRY + { + std::map >::iterator it = temporalDataFilters.find(outFreq); + const bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); - /*! - * Returns the temporal filter corresponding to the field's temporal operation - * for the specified operation frequency. The filter is created if it does not - * exist, otherwise it is reused. - * - * \param gc the garbage collector to use - * \param outFreq the operation frequency, i.e. the frequency at which the output data will be computed - * \return the output pin corresponding to the requested temporal filter - */ - std::shared_ptr CField::getTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq) - TRY - { - std::map >::iterator it = temporalDataFilters.find(outFreq); + CContext* context = CContext::getCurrent(); - if (it == temporalDataFilters.end()) - { - if (operation.isEmpty()) - ERROR("void CField::getTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq)", - << "An operation must be defined for field \"" << getId() << "\"."); - checkTimeAttributes(&outFreq); + if (it == temporalDataFilters.end()) + { + if (operation.isEmpty()) + ERROR("void CField::getTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq)", + << "An operation must be defined for field \"" << getId() << "\"."); - const bool detectMissingValues = (!detect_missing_value.isEmpty() && detect_missing_value == true); - std::shared_ptr temporalFilter(new CTemporalFilter(gc, operation, + checkTimeAttributes(&outFreq); + + const bool detectMissingValues = (!detect_missing_value.isEmpty() && detect_missing_value == true); + std::shared_ptr temporalFilter(new CTemporalFilter(gc, operation, CContext::getCurrent()->getCalendar()->getInitDate(), freq_op, freq_offset, outFreq, detectMissingValues)); - instantDataFilter->connectOutput(temporalFilter, 0); - const bool buildGraph_ = !build_workflow_graph.isEmpty() && build_workflow_graph == true ; - if(buildGraph_) - { - info(100)<<"=== Workflow Graph === field "<getId()<<" calls a getTemporalDataFilter ============== "<graphPackage = new CGraphPackage; - temporalFilter->graphEnabled = true; - temporalFilter->graphPackage->inFields.push_back(this); - } + instantDataFilter->connectOutput(temporalFilter, 0); + + temporalFilter->parent_filters.resize(1); + temporalFilter->parent_filters[0] = instantDataFilter; + - it = temporalDataFilters.insert(std::make_pair(outFreq, temporalFilter)).first; - } + temporalFilter->tag = temporalFilter->parent_filters[0]->tag; + temporalFilter->start_graph = temporalFilter->parent_filters[0]->start_graph; + temporalFilter->end_graph = temporalFilter->parent_filters[0]->end_graph; - return it->second; - } - CATCH_DUMP_ATTR + temporalFilter->field = this; + + it = temporalDataFilters.insert(std::make_pair(outFreq, temporalFilter)).first; + } + + return it->second; + } + CATCH_DUMP_ATTR /*! * Returns the temporal filter corresponding to the field's temporal operation @@ -1115,87 +1541,46 @@ namespace xios * \param outFreq the operation frequency, i.e. the frequency at which the output data will be computed * \return the output pin corresponding to the requested temporal filter */ - - std::shared_ptr CField::getSelfTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq) - TRY - { - if (instantDataFilter || !hasExpression()) - ERROR("COutputPin* CField::getSelfTemporalDataFilter(CGarbageCollector& gc)", - "Impossible to add a self reference to a field which has already been parsed or which does not have an expression."); - - if (selfTemporalDataFilter) return selfTemporalDataFilter; - - if (hasDirectFieldReference()) - { - CField* fieldRef=getDirectFieldReference(); - return fieldRef->getTemporalDataFilter(gc, outFreq) ; - } - else - { - if (selfTemporalDataFilter) return selfTemporalDataFilter ; - - if (operation.isEmpty()) - ERROR("void CField::getSelfTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq)", - << "An operation must be defined for field \"" << getId() << "\"."); - - checkTimeAttributes(&outFreq); //bof - - const bool detectMissingValues = (!detect_missing_value.isEmpty() && detect_missing_value == true); - selfTemporalDataFilter = std::shared_ptr(new CTemporalFilter(gc, operation, - CContext::getCurrent()->getCalendar()->getInitDate(), - freq_op, freq_offset, outFreq, detectMissingValues)); - - inputFilter->connectOutput(selfTemporalDataFilter, 0); - const bool buildGraph_ = !build_workflow_graph.isEmpty() && build_workflow_graph == true ; - if(buildGraph_) - { - info(100)<<"=== Workflow Graph === field "<getId()<<" calls a getSelfTemporalDataFilter ============== "<graphPackage = new CGraphPackage; - selfTemporalDataFilter->graphEnabled = true; - selfTemporalDataFilter->graphPackage->inFields.push_back(this); - } - return selfTemporalDataFilter ; - } - } - CATCH_DUMP_ATTR - -/* old version - std::shared_ptr CField::getSelfTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq) - TRY - { - if (instantDataFilter || !hasExpression()) - ERROR("COutputPin* CField::getSelfTemporalDataFilter(CGarbageCollector& gc)", - "Impossible to add a self reference to a field which has already been parsed or which does not have an expression."); - - if (!selfReferenceFilter) getSelfReference(gc) ; - - if (serverSourceFilter || clientSourceFilter) - { - if (operation.isEmpty()) - ERROR("void CField::getSelfTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq)", - << "An operation must be defined for field \"" << getId() << "\"."); - - checkTimeAttributes(&outFreq); - - const bool detectMissingValues = (!detect_missing_value.isEmpty() && detect_missing_value == true); - std::shared_ptr temporalFilter(new CTemporalFilter(gc, operation, - CContext::getCurrent()->getCalendar()->getInitDate(), - freq_op, freq_offset, outFreq, detectMissingValues)); - - selfReferenceFilter->connectOutput(temporalFilter, 0); - return temporalFilter ; - } - else if (!field_ref.isEmpty()) - { - CField* fieldRef = CField::get(field_ref); - fieldRef->buildFilterGraph(gc, false); - return fieldRef->getTemporalDataFilter(gc, outFreq) ; - } + + std::shared_ptr CField::getSelfTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq) + TRY + { + if (instantDataFilter || !hasExpression()) + ERROR("COutputPin* CField::getSelfTemporalDataFilter(CGarbageCollector& gc)", + "Impossible to add a self reference to a field which has already been parsed or which does not have an expression."); + + if (!selfReferenceFilter) getSelfReference(gc) ; + + if (serverSourceFilter || clientSourceFilter) + { + if (operation.isEmpty()) + ERROR("void CField::getSelfTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq)", + << "An operation must be defined for field \"" << getId() << "\"."); + + checkTimeAttributes(&outFreq); + + const bool detectMissingValues = (!detect_missing_value.isEmpty() && detect_missing_value == true); + bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); + std::shared_ptr temporalFilter(new CTemporalFilter(gc, operation, + CContext::getCurrent()->getCalendar()->getInitDate(), + freq_op, freq_offset, outFreq, detectMissingValues)); + + selfReferenceFilter->connectOutput(temporalFilter, 0); + temporalFilter->tag = buildWorkflowGraph; + temporalFilter->field = this; + + return temporalFilter ; + } + else if (!field_ref.isEmpty()) + { + CField* fieldRef = CField::get(field_ref); + fieldRef->buildFilterGraph(gc, false); + return fieldRef->getTemporalDataFilter(gc, outFreq) ; + } } - CATCH_DUMP_ATTR -*/ + CATCH_DUMP_ATTR - //---------------------------------------------------------------- + //---------------------------------------------------------------- /* void CField::fromBinary(StdIStream& is) { @@ -1211,486 +1596,513 @@ namespace xios */ //---------------------------------------------------------------- - void CField::solveGridReference(void) - TRY - { - if (grid_!=nullptr) return ; // already done + void CField::solveGridReference(void) + TRY + { + if (grid_ref.isEmpty() && domain_ref.isEmpty() && axis_ref.isEmpty() && scalar_ref.isEmpty()) + { + ERROR("CField::solveGridReference(void)", + << "A grid must be defined for field '" << getFieldOutputName() << "' ."); + } + else if (!grid_ref.isEmpty() && (!domain_ref.isEmpty() || !axis_ref.isEmpty() || !scalar_ref.isEmpty())) + { + ERROR("CField::solveGridReference(void)", + << "Field '" << getFieldOutputName() << "' has both a grid and a domain/axis/scalar." << std::endl + << "Please define either 'grid_ref' or 'domain_ref'/'axis_ref'/'scalar_ref'."); + } - if (grid_ref.isEmpty() && domain_ref.isEmpty() && axis_ref.isEmpty() && scalar_ref.isEmpty()) - { - ERROR("CField::solveGridReference(void)", - << "A grid must be defined for field '" << getFieldOutputName() << "' ."); - } - else if (!grid_ref.isEmpty() && (!domain_ref.isEmpty() || !axis_ref.isEmpty() || !scalar_ref.isEmpty())) - { - ERROR("CField::solveGridReference(void)", - << "Field '" << getFieldOutputName() << "' has both a grid and a domain/axis/scalar." << std::endl - << "Please define either 'grid_ref' or 'domain_ref'/'axis_ref'/'scalar_ref'."); - } + if (grid_ref.isEmpty()) + { + std::vector vecDom; + std::vector vecAxis; + std::vector vecScalar; + std::vector axisDomainOrderTmp; + + std::vector vecDomRef; + std::vector vecAxisRef; + std::vector vecScalarRef; - if (grid_ref.isEmpty()) - { - std::vector vecDom; - std::vector vecAxis; - std::vector vecScalar; - std::vector axisDomainOrderTmp; - - std::vector vecDomRef; - std::vector vecAxisRef; - std::vector vecScalarRef; - if (!domain_ref.isEmpty()) - { - CField* field=CDomain::getFieldFromId(domain_ref) ; - if (field!=nullptr) field->solveGridReference() ; - if (CDomain::has(domain_ref)) + if (!domain_ref.isEmpty()) { - vecDom.push_back(CDomain::get(domain_ref)); - vecDomRef.push_back(CDomain::createDomain()); - vecDomRef.back()->domain_ref=domain_ref; - axisDomainOrderTmp.push_back(2); + StdString tmp = domain_ref.getValue(); + if (CDomain::has(domain_ref)) + { + vecDom.push_back(CDomain::get(domain_ref)); + vecDomRef.push_back(CDomain::createDomain()); + vecDomRef.back()->domain_ref=domain_ref; + axisDomainOrderTmp.push_back(2); + } + else ERROR("CField::solveGridReference(void)", + << "Invalid reference to domain '" << domain_ref.getValue() << "'."); } - else ERROR("CField::solveGridReference(void)", - << "Invalid reference to domain '" << domain_ref.getValue() << "'."); - } - if (!axis_ref.isEmpty()) - { - CField* field=CAxis::getFieldFromId(axis_ref) ; - if (field!=nullptr) field->solveGridReference() ; - if (CAxis::has(axis_ref)) + if (!axis_ref.isEmpty()) { - vecAxis.push_back(CAxis::get(axis_ref)); - vecAxisRef.push_back(CAxis::createAxis()); - vecAxisRef.back()->axis_ref=axis_ref; - axisDomainOrderTmp.push_back(1); + if (CAxis::has(axis_ref)) + { + vecAxis.push_back(CAxis::get(axis_ref)); + vecAxisRef.push_back(CAxis::createAxis()); + vecAxisRef.back()->axis_ref=axis_ref; + axisDomainOrderTmp.push_back(1); + } + else ERROR("CField::solveGridReference(void)", + << "Invalid reference to axis '" << axis_ref.getValue() << "'."); } - else ERROR("CField::solveGridReference(void)", - << "Invalid reference to axis '" << axis_ref.getValue() << "'."); - } - if (!scalar_ref.isEmpty()) - { - CField* field=CScalar::getFieldFromId(scalar_ref) ; - if (field!=nullptr) field->solveGridReference() ; - if (CScalar::has(scalar_ref)) + if (!scalar_ref.isEmpty()) { - vecScalar.push_back(CScalar::get(scalar_ref)); - vecScalarRef.push_back(CScalar::createScalar()); - vecScalarRef.back()->scalar_ref=scalar_ref; - axisDomainOrderTmp.push_back(0); + if (CScalar::has(scalar_ref)) + { + vecScalar.push_back(CScalar::get(scalar_ref)); + vecScalarRef.push_back(CScalar::createScalar()); + vecScalarRef.back()->scalar_ref=scalar_ref; + axisDomainOrderTmp.push_back(0); + } + else ERROR("CField::solveGridReference(void)", + << "Invalid reference to scalar '" << scalar_ref.getValue() << "'."); } - else ERROR("CField::solveGridReference(void)", - << "Invalid reference to scalar '" << scalar_ref.getValue() << "'."); - } - CArray axisDomainOrder(axisDomainOrderTmp.size()); - for (int idx = 0; idx < axisDomainOrderTmp.size(); ++idx) + CArray axisDomainOrder(axisDomainOrderTmp.size()); + for (int idx = 0; idx < axisDomainOrderTmp.size(); ++idx) + { + axisDomainOrder(idx) = axisDomainOrderTmp[idx]; + } + + // Warning: the gridId shouldn't be set as the grid_ref since it could be inherited + StdString gridId = CGrid::generateId(vecDom, vecAxis, vecScalar,axisDomainOrder); + if (CGrid::has(gridId)) this->grid = CGrid::get(gridId); + else this->grid = CGrid::createGrid(gridId, vecDomRef, vecAxisRef, vecScalarRef,axisDomainOrder); + } + else { - axisDomainOrder(idx) = axisDomainOrderTmp[idx]; + if (CGrid::has(grid_ref)) this->grid = CGrid::get(grid_ref); + else ERROR("CField::solveGridReference(void)", + << "Invalid reference to grid '" << grid_ref.getValue() << "'."); } + } + CATCH_DUMP_ATTR - // Warning: the gridId shouldn't be set as the grid_ref since it could be inherited - StdString gridId = CGrid::generateId(vecDom, vecAxis, vecScalar,axisDomainOrder); - if (CGrid::has(gridId)) this->grid_ = CGrid::get(gridId); - else this->grid_ = CGrid::createGrid(gridId, vecDomRef, vecAxisRef, vecScalarRef,axisDomainOrder); - } - else - { - if (CGrid::has(grid_ref)) this->grid_ = CGrid::get(grid_ref); - else ERROR("CField::solveGridReference(void)", - << "Invalid reference to grid '" << grid_ref.getValue() << "'."); - } - } - CATCH_DUMP_ATTR + void CField::solveGridDomainAxisRef(bool checkAtt) + TRY + { + grid->solveDomainAxisRef(checkAtt); + } + CATCH_DUMP_ATTR - void CField::solveGridDomainAxisRef(bool checkAtt) - TRY - { - grid_->solveDomainAxisRef(checkAtt); - } - CATCH_DUMP_ATTR + void CField::solveCheckMaskIndex(bool doSendingIndex) + TRY + { + grid->checkMaskIndex(doSendingIndex); + } + CATCH_DUMP_ATTR - void CField::solveCheckMaskIndex(bool doSendingIndex) - TRY - { - grid_->checkMaskIndex(doSendingIndex); - } - CATCH_DUMP_ATTR + void CField::solveTransformedGrid() + TRY + { + if (grid && !grid->isTransformed() && hasDirectFieldReference() && grid != getDirectFieldReference()->grid) + { + std::vector grids; + // Source grid + grids.push_back(getDirectFieldReference()->grid); + // Intermediate grids + if (!grid_path.isEmpty()) + { + std::string gridId; + size_t start = 0, end; + + do + { + end = grid_path.getValue().find(',', start); + if (end != std::string::npos) + { + gridId = grid_path.getValue().substr(start, end - start); + start = end + 1; + } + else + gridId = grid_path.getValue().substr(start); + + if (!CGrid::has(gridId)) + ERROR("void CField::solveTransformedGrid()", + << "Invalid grid_path, the grid '" << gridId << "' does not exist."); + + grids.push_back(CGrid::get(gridId)); + } + while (end != std::string::npos); + } + // Destination grid + grids.push_back(grid); + + for (size_t i = 0, count = grids.size() - 1; i < count; ++i) + { + CGrid *gridSrc = grids[i]; + CGrid *gridDest = grids[i + 1]; + if (!gridDest->isTransformed()) + gridDest->transformGrid(gridSrc); + } + } + else if (grid && grid->hasTransform() && !grid->isTransformed()) + { + // Temporarily deactivate the self-transformation of grid + // grid->transformGrid(grid); + } + } + CATCH_DUMP_ATTR - - void CField::solveGridDomainAxisBaseRef() - TRY - { - grid_->solveDomainAxisRef(false); - grid_->solveDomainAxisBaseRef(); - } - CATCH_DUMP_ATTR + void CField::solveGenerateGrid() + TRY + { + if (grid && !grid->isTransformed() && hasDirectFieldReference() && grid != getDirectFieldReference()->grid) + grid->completeGrid(getDirectFieldReference()->grid); + else + grid->completeGrid(); + } + CATCH_DUMP_ATTR + + void CField::solveGridDomainAxisBaseRef() + TRY + { + grid->solveDomainAxisRef(false); + grid->solveDomainAxisBaseRef(); + } + CATCH_DUMP_ATTR - ///------------------------------------------------------------------- + ///------------------------------------------------------------------- - template <> - void CGroupTemplate::solveRefInheritance(void) - TRY - { - if (this->group_ref.isEmpty()) return; - StdString gref = this->group_ref.getValue(); + template <> + void CGroupTemplate::solveRefInheritance(void) + TRY + { + if (this->group_ref.isEmpty()) return; + StdString gref = this->group_ref.getValue(); - if (!CFieldGroup::has(gref)) - ERROR("CGroupTemplate::solveRefInheritance(void)", - << "[ gref = " << gref << "]" - << " invalid group name !"); + if (!CFieldGroup::has(gref)) + ERROR("CGroupTemplate::solveRefInheritance(void)", + << "[ gref = " << gref << "]" + << " invalid group name !"); - CFieldGroup* group = CFieldGroup::get(gref); - CFieldGroup* owner = CFieldGroup::get(boost::polymorphic_downcast(this)); - owner->setAttributes(group); // inherite of attributes of group reference + CFieldGroup* group = CFieldGroup::get(gref); + CFieldGroup* owner = CFieldGroup::get(boost::polymorphic_downcast(this)); + owner->setAttributes(group); // inherite of attributes of group reference - std::vector allChildren = group->getAllChildren(); - std::vector::iterator it = allChildren.begin(), end = allChildren.end(); + std::vector allChildren = group->getAllChildren(); + std::vector::iterator it = allChildren.begin(), end = allChildren.end(); - for (; it != end; it++) - { - CField* child = *it; - if (child->hasId()) owner->createChild()->field_ref.setValue(child->getId()); - } - } - CATCH_DUMP_ATTR + for (; it != end; it++) + { + CField* child = *it; + if (child->hasId()) owner->createChild()->field_ref.setValue(child->getId()); - ///------------------------------------------------------------------- + } + } + CATCH_DUMP_ATTR - void CField::parse(xml::CXMLNode& node) - TRY - { - string newContent ; - SuperClass::parse(node); - if (node.goToChildElement()) - { - do - { - if (node.getElementName() == "variable" || node.getElementName() == "variable_group") this->getVirtualVariableGroup()->parseChild(node); - else if (node.getElementName() == "expr") if (node.getContent(newContent)) content+=newContent ; - } while (node.goToNextElement()); - node.goToParentElement(); - } - if (node.getContent(newContent)) content=newContent ; - } - CATCH_DUMP_ATTR + void CField::scaleFactorAddOffset(double scaleFactor, double addOffset) + TRY + { + recvDataSrv = (recvDataSrv - addOffset) / scaleFactor; + } + CATCH_DUMP_ATTR - /*! - This function retrieves Id of corresponding domain_ref and axis_ref (if any) - of a field. In some cases, only domain exists but axis doesn't - \return pair of Domain and Axis id - */ - const std::vector& CField::getRefDomainAxisIds() - TRY - { - CGrid* cgPtr = getRelGrid(); - if (NULL != cgPtr) - { - std::vector::iterator it; - if (!domain_ref.isEmpty()) + void CField::invertScaleFactorAddOffset(double scaleFactor, double addOffset) + TRY + { + recvDataSrv = recvDataSrv * scaleFactor + addOffset; + } + CATCH_DUMP_ATTR + + void CField::outputField(CArray& fieldOut) + TRY + { + CArray& outIndexClient = grid->localIndexToWriteOnClient; + CArray& outIndexServer = grid->localIndexToWriteOnServer; + for (size_t idx = 0; idx < outIndexServer.numElements(); ++idx) { - std::vector domainList = cgPtr->getDomainList(); - it = std::find(domainList.begin(), domainList.end(), domain_ref.getValue()); - if (domainList.end() != it) domAxisScalarIds_[0] = *it; + fieldOut(outIndexServer(idx)) = recvDataSrv(outIndexClient(idx)); } + } + CATCH_DUMP_ATTR - if (!axis_ref.isEmpty()) + void CField::inputField(CArray& fieldIn) + TRY + { + CArray& outIndexClient = grid->localIndexToWriteOnClient; + CArray& outIndexServer = grid->localIndexToWriteOnServer; + for (size_t idx = 0; idx < outIndexServer.numElements(); ++idx) { - std::vector axisList = cgPtr->getAxisList(); - it = std::find(axisList.begin(), axisList.end(), axis_ref.getValue()); - if (axisList.end() != it) domAxisScalarIds_[1] = *it; + recvDataSrv(outIndexClient(idx)) = fieldIn(outIndexServer(idx)); } + } + CATCH_DUMP_ATTR - if (!scalar_ref.isEmpty()) + void CField::outputCompressedField(CArray& fieldOut) + TRY + { + CArray& outIndexClient = grid->localIndexToWriteOnClient; + CArray& outIndexServer = grid->localIndexToWriteOnServer; + for (size_t idx = 0; idx < outIndexServer.numElements(); ++idx) { - std::vector scalarList = cgPtr->getScalarList(); - it = std::find(scalarList.begin(), scalarList.end(), scalar_ref.getValue()); - if (scalarList.end() != it) domAxisScalarIds_[2] = *it; + fieldOut((idx)) = recvDataSrv(outIndexClient(idx)); } - } - return (domAxisScalarIds_); - } - CATCH_DUMP_ATTR - - CVariable* CField::addVariable(const string& id) - TRY - { - return vVariableGroup->createChild(id); - } - CATCH + } + CATCH_DUMP_ATTR - CVariableGroup* CField::addVariableGroup(const string& id) - TRY - { - return vVariableGroup->createChildGroup(id); - } - CATCH + ///------------------------------------------------------------------- - void CField::setContextClient(CContextClient* contextClient) - TRY - { - CContext* context = CContext::getCurrent(); - client = contextClient; - - // A grid is sent by a client (both for read or write) or by primary server (write only) - if (context->getServiceType()==CServicesManager::GATHERER) - { - if (getRelFile()->mode.isEmpty() || (!getRelFile()->mode.isEmpty() && getRelFile()->mode == CFile::mode_attr::write)) - grid_->setContextClient(contextClient); - } - else if (context->getServiceType()==CServicesManager::CLIENT) - { - if (grid_) - grid_->setContextClient(contextClient); - else - ERROR( "CField::setContextClient(contextClient)", - << "Grid not defined for " << getId() - << " (if field is an input field, set read_access to true)" - ); + void CField::parse(xml::CXMLNode& node) + TRY + { + string newContent ; + SuperClass::parse(node); + if (node.goToChildElement()) + { + do + { + if (node.getElementName() == "variable" || node.getElementName() == "variable_group") this->getVirtualVariableGroup()->parseChild(node); + else if (node.getElementName() == "expr") if (node.getContent(newContent)) content+=newContent ; + } while (node.goToNextElement()); + node.goToParentElement(); + } + if (node.getContent(newContent)) content=newContent ; } - } - CATCH_DUMP_ATTR - - void CField::sendCloseDefinition(void) - { - CContext::getCurrent()->sendCloseDefinition(client) ; - } - - void CField::sendFieldToFileServer(void) - { - CContext::getCurrent()->sendContextToFileServer(client); - getRelFile()->sendFileToFileServer(client); - sentGrid_ = grid_-> duplicateSentGrid() ; - sentGrid_->sendGridToFileServer(client); - name = getFieldOutputName() ; - this->sendAllAttributesToServer(client); - this->sendAddAllVariables(client); - } - - void CField::sendFieldToInputFileServer(void) - { - CContext::getCurrent()->sendContextToFileServer(client); - getRelFile()->sendFileToFileServer(client); - sentGrid_ = grid_-> duplicateSentGrid() ; - sentGrid_->sendGridToFileServer(client); - read_access=true ; // not the best solution, but on server side, the field must be a starting point of the workflow - // must be replace by a better solution when implementing filters for reading and send to client - // on server side - this->sendAllAttributesToServer(client); - this->sendAddAllVariables(client); - } + CATCH_DUMP_ATTR - void CField::sendFieldToCouplerOut(void) - { - if (sendFieldToCouplerOut_done_) return ; - else sendFieldToCouplerOut_done_=true ; - sentGrid_ = grid_-> duplicateSentGrid() ; - sentGrid_->sendGridToCouplerOut(client, this->getId()); - this->sendGridCompleted(); + /*! + This function retrieves Id of corresponding domain_ref and axis_ref (if any) + of a field. In some cases, only domain exists but axis doesn't + \return pair of Domain and Axis id + */ + const std::vector& CField::getRefDomainAxisIds() + TRY + { + CGrid* cgPtr = getRelGrid(); + if (NULL != cgPtr) + { + std::vector::iterator it; + if (!domain_ref.isEmpty()) + { + std::vector domainList = cgPtr->getDomainList(); + it = std::find(domainList.begin(), domainList.end(), domain_ref.getValue()); + if (domainList.end() != it) domAxisScalarIds_[0] = *it; + } + + if (!axis_ref.isEmpty()) + { + std::vector axisList = cgPtr->getAxisList(); + it = std::find(axisList.begin(), axisList.end(), axis_ref.getValue()); + if (axisList.end() != it) domAxisScalarIds_[1] = *it; + } + + if (!scalar_ref.isEmpty()) + { + std::vector scalarList = cgPtr->getScalarList(); + it = std::find(scalarList.begin(), scalarList.end(), scalar_ref.getValue()); + if (scalarList.end() != it) domAxisScalarIds_[2] = *it; + } + } + return (domAxisScalarIds_); + } + CATCH_DUMP_ATTR - } - - void CField::makeGridAliasForCoupling(void) - { - grid_->makeAliasForCoupling(this->getId()); - } + CVariable* CField::addVariable(const string& id) + TRY + { + return vVariableGroup->createChild(id); + } + CATCH - //! Client side: Send a message announcing that the grid definition has been received from a coupling context - void CField::sendGridCompleted(void) + CVariableGroup* CField::addVariableGroup(const string& id) TRY { - CEventClient event(getType(),EVENT_ID_GRID_COMPLETED); + return vVariableGroup->createChildGroup(id); + } + CATCH - if (client->isServerLeader()) - { - CMessage msg; - msg<getId(); - for (auto& rank : client->getRanksServerLeader()) event.push(rank,1,msg); - client->sendEvent(event); - } - else client->sendEvent(event); + void CField::setContextClient(CContextClient* contextClient) + TRY + { + CContext* context = CContext::getCurrent(); + client = contextClient; + if (context->hasClient) + { + // A grid is sent by a client (both for read or write) or by primary server (write only) + if (context->hasServer) + { + if (file->mode.isEmpty() || (!file->mode.isEmpty() && file->mode == CFile::mode_attr::write)) + grid->setContextClient(contextClient); + } + else + grid->setContextClient(contextClient); + } } CATCH_DUMP_ATTR - //! Server side: Receive a message announcing that the grid definition has been received from a coupling context - void CField::recvGridCompleted(CEventServer& event) + CContextClient* CField::getContextClient() TRY { - CBufferIn* buffer=event.subEvents.begin()->buffer; - string id; - *buffer>>id ; - get(id)->recvGridCompleted(*buffer); + return client; } CATCH - //! Server side: Receive a message message announcing that the grid definition has been received from a coupling context - void CField::recvGridCompleted(CBufferIn& buffer) + void CField::sendAddAllVariables(CContextClient* client) TRY { - setGridCompleted() ; + std::vector allVar = getAllVariables(); + std::vector::const_iterator it = allVar.begin(); + std::vector::const_iterator itE = allVar.end(); + + for (; it != itE; ++it) + { + this->sendAddVariable((*it)->getId(), client); + (*it)->sendAllAttributesToServer(client); + (*it)->sendValue(client); + } } CATCH_DUMP_ATTR - bool CField::isGridCompleted(void) - TRY - { - bool isFullCompleted ; - MPI_Allreduce(&isGridCompleted_,&isFullCompleted,1,MPI_C_BOOL, MPI_LAND, CContext::getCurrent()->getIntraComm() ) ; - if ( (isGridCompleted_==false && isFullCompleted==true) ) ERROR("bool CField::isGridCompleted(void)",<< "incoherecy in MPI_AllReduce") ; - return isFullCompleted ; - } - CATCH_DUMP_ATTR - - void CField::sendAddAllVariables(CContextClient* client) - TRY - { - std::vector allVar = getAllVariables(); - std::vector::const_iterator it = allVar.begin(); - std::vector::const_iterator itE = allVar.end(); - - for (; it != itE; ++it) - { - this->sendAddVariable((*it)->getId(), client); - (*it)->sendAllAttributesToServer(client); - (*it)->sendValue(client); - } - } - CATCH_DUMP_ATTR - - /*! - * Send all Attributes to server. This method is overloaded, since only grid_ref attribute - * must be sent to server and not domain_ref/axis_ref/scalar_ref. - */ + /*! + * Send all Attributes to server. This method is overloaded, since only grid_ref attribute + * must be sent to server and not domain_ref/axis_ref/scalar_ref. + */ - void CField::sendAllAttributesToServer(CContextClient* client) - TRY - { - if (grid_ref.isEmpty()) - { - grid_ref=sentGrid_->getId() ; - SuperClass::sendAllAttributesToServer(client) ; - domain_ref.reset() ; - axis_ref.reset() ; - scalar_ref.reset() ; - grid_ref.reset(); - } - else - { - string tmp = grid_ref; - grid_ref = sentGrid_->getId() ; - SuperClass::sendAllAttributesToServer(client) ; - grid_ref = tmp ; - } - } - CATCH_DUMP_ATTR + void CField::sendAllAttributesToServer(CContextClient* client) + TRY + { + if (grid_ref.isEmpty()) + { + grid_ref=grid->getId() ; + SuperClass::sendAllAttributesToServer(client) ; + grid_ref.reset(); + } + else SuperClass::sendAllAttributesToServer(client) ; + } + CATCH_DUMP_ATTR - void CField::sendAddVariable(const string& id, CContextClient* client) - TRY - { - sendAddItem(id, (int)EVENT_ID_ADD_VARIABLE, client); - } - CATCH_DUMP_ATTR + void CField::sendAddVariable(const string& id, CContextClient* client) + TRY + { + sendAddItem(id, (int)EVENT_ID_ADD_VARIABLE, client); + } + CATCH_DUMP_ATTR - void CField::sendAddVariableGroup(const string& id, CContextClient* client) - TRY - { - sendAddItem(id, (int)EVENT_ID_ADD_VARIABLE_GROUP, client); - } - CATCH_DUMP_ATTR + void CField::sendAddVariableGroup(const string& id, CContextClient* client) + TRY + { + sendAddItem(id, (int)EVENT_ID_ADD_VARIABLE_GROUP, client); + } + CATCH_DUMP_ATTR - void CField::recvAddVariable(CEventServer& event) - TRY - { - CBufferIn* buffer = event.subEvents.begin()->buffer; - string id; - *buffer >> id; - get(id)->recvAddVariable(*buffer); - } - CATCH + void CField::recvAddVariable(CEventServer& event) + TRY + { - void CField::recvAddVariable(CBufferIn& buffer) - TRY - { - string id; - buffer >> id; - addVariable(id); - } - CATCH_DUMP_ATTR + CBufferIn* buffer = event.subEvents.begin()->buffer; + string id; + *buffer >> id; + get(id)->recvAddVariable(*buffer); + } + CATCH - void CField::recvAddVariableGroup(CEventServer& event) - TRY - { - CBufferIn* buffer = event.subEvents.begin()->buffer; - string id; - *buffer >> id; - get(id)->recvAddVariableGroup(*buffer); - } - CATCH + void CField::recvAddVariable(CBufferIn& buffer) + TRY + { + string id; + buffer >> id; + addVariable(id); + } + CATCH_DUMP_ATTR - void CField::recvAddVariableGroup(CBufferIn& buffer) - TRY - { - string id; - buffer >> id; - addVariableGroup(id); - } - CATCH_DUMP_ATTR + void CField::recvAddVariableGroup(CEventServer& event) + TRY + { - /*! - * Check on freq_off and freq_op attributes. - */ - void CField::checkTimeAttributes(CDuration* freqOp) - TRY - { - if (hasFileIn() && !(operation.getValue() == "instant" || operation.getValue() == "once") ) - ERROR("void CField::checkTimeAttributes(void)", - << "Unsupported operation for field '" << getFieldOutputName() << "'." << std::endl - << "Currently only \"instant\" is supported for fields read from file.") + CBufferIn* buffer = event.subEvents.begin()->buffer; + string id; + *buffer >> id; + get(id)->recvAddVariableGroup(*buffer); + } + CATCH - if (freq_op.isEmpty()) - { - if (operation.getValue() == "instant") - { - if (hasFileIn() || hasFileOut()) freq_op.setValue(getRelFile()->output_freq.getValue()); - else freq_op=*freqOp ; - } - else freq_op.setValue(TimeStep); - } - if (freq_offset.isEmpty()) freq_offset.setValue(hasFileIn() ? NoneDu : (freq_op.getValue() - TimeStep)); - } - CATCH_DUMP_ATTR + void CField::recvAddVariableGroup(CBufferIn& buffer) + TRY + { + string id; + buffer >> id; + addVariableGroup(id); + } + CATCH_DUMP_ATTR - /*! - * Returns string arithmetic expression associated to the field. - * \return if content is defined return content string, otherwise, if "expr" attribute is defined, return expr string. - */ - const string& CField::getExpression(void) - TRY - { - if (!expr.isEmpty() && content.empty()) - { - content = expr; - expr.reset(); - } + /*! + * Check on freq_off and freq_op attributes. + */ + void CField::checkTimeAttributes(CDuration* freqOp) + TRY + { + bool isFieldRead = file && !file->mode.isEmpty() && file->mode == CFile::mode_attr::read; + bool isFieldWrite = file && ( file->mode.isEmpty() || file->mode == CFile::mode_attr::write); + if (isFieldRead && !(operation.getValue() == "instant" || operation.getValue() == "once") ) + ERROR("void CField::checkTimeAttributes(void)", + << "Unsupported operation for field '" << getFieldOutputName() << "'." << std::endl + << "Currently only \"instant\" is supported for fields read from file.") + + if (freq_op.isEmpty()) + { + if (operation.getValue() == "instant") + { + if (isFieldRead || isFieldWrite) freq_op.setValue(file->output_freq.getValue()); + else freq_op=*freqOp ; + } + else + freq_op.setValue(TimeStep); + } + else + { + //if(file->output_freq.getValue() < freq_op.getValue()) + if((isFieldRead || isFieldWrite) && (file!=nullptr) && (freq_op.getValue() > file->output_freq.getValue() )) + { + ERROR("void CField::checkTimeAttributes(void)", + << "output file has output_freq < freq_op" << std::endl + << "field_id = "<< getId() << std::endl + << "file_id = "<< file->getId() << std::endl + << "output_freq = "<< file->output_freq.getValue() << std::endl + << "freq_op = "<< freq_op.getValue() << std::endl) + } + } + if (freq_offset.isEmpty()) + freq_offset.setValue(isFieldRead ? NoneDu : (freq_op.getValue() - TimeStep)); + } + CATCH_DUMP_ATTR - return content; - } - CATCH_DUMP_ATTR + /*! + * Returns string arithmetic expression associated to the field. + * \return if content is defined return content string, otherwise, if "expr" attribute is defined, return expr string. + */ + const string& CField::getExpression(void) + TRY + { + if (!expr.isEmpty() && content.empty()) + { + content = expr; + expr.reset(); + } - bool CField::hasExpression(void) const - TRY - { - return (!expr.isEmpty() || !content.empty()); - } - CATCH + return content; + } + CATCH_DUMP_ATTR - bool CField::hasGridMask(void) const - TRY - { - return (this->grid_->hasMask()); - } - CATCH + bool CField::hasExpression(void) const + TRY + { + return (!expr.isEmpty() || !content.empty()); + } + CATCH + + bool CField::hasGridMask(void) const + TRY + { + return (this->grid->hasMask()); + } + CATCH - DEFINE_REF_FUNC(Field,field) + DEFINE_REF_FUNC(Field,field) } // namespace xios diff --git a/xios_2311_src/src/node/field.hpp b/xios_2311_src/src/node/field.hpp index e765d2b9f8f084722b12c20da7a7e82c3788bece..6f8568c63bdc98741a76ac347e2bd97603520aef 100755 --- a/xios_2311_src/src/node/field.hpp +++ b/xios_2311_src/src/node/field.hpp @@ -6,6 +6,7 @@ #include "group_factory.hpp" #include "functor.hpp" #include "functor_type.hpp" +#include "filter.hpp" #include "duration.hpp" #include "date.hpp" #include "declare_group.hpp" @@ -16,24 +17,9 @@ #include "transformation_enum.hpp" #include "variable.hpp" #include "context_client.hpp" -#include "pass_through_filter.hpp" -#include "temporal_filter.hpp" -#include "model_to_client_source_filter.hpp" -#include "client_from_client_source_filter.hpp" -#include "client_from_server_source_filter.hpp" -#include "client_to_model_store_filter.hpp" -#include "server_to_client_store_filter.hpp" -#include "server_from_client_source_filter.hpp" -#include "file_writer_store_filter.hpp" -#include "client_to_server_store_filter.hpp" -#include "file_reader_source_filter.hpp" - - - -namespace xios -{ +namespace xios { /// ////////////////////// Déclarations ////////////////////// /// @@ -42,19 +28,17 @@ namespace xios class CField; class CFile; - class CCouplerIn ; - class CCouplerOut ; class CGrid; class CContext; class CGenericFilter; - class CDomain ; - class CAxis ; - class CScalar ; class CGarbageCollector; class COutputPin; class CSourceFilter; - class CServerToClientFilter; + class CStoreFilter; + class CFileWriterFilter; + class CFileServerWriterFilter; + ///-------------------------------------------------------------- // Declare/Define CFieldAttribute @@ -62,8 +46,6 @@ namespace xios # include "field_attribute.conf" END_DECLARE_ATTRIBUTE_MAP(CField) - class CContextClient ; - ///-------------------------------------------------------------- class CField : public CObjectTemplate @@ -76,7 +58,6 @@ namespace xios typedef CObjectTemplate SuperClass; typedef CFieldAttributes SuperClassAttribute; - public : enum EReadField { RF_NODATA, RF_EOF, RF_DATA @@ -90,7 +71,7 @@ namespace xios enum EEventId { EVENT_ID_UPDATE_DATA, EVENT_ID_READ_DATA, EVENT_ID_READ_DATA_READY, - EVENT_ID_ADD_VARIABLE, EVENT_ID_ADD_VARIABLE_GROUP, EVENT_ID_GRID_COMPLETED + EVENT_ID_ADD_VARIABLE, EVENT_ID_ADD_VARIABLE_GROUP }; /// Constructeurs /// @@ -103,24 +84,29 @@ namespace xios CGrid* getRelGrid(void) const; CFile* getRelFile(void) const; - CGrid* getAssociatedGrid(void) const ; - CDomain* getAssociatedDomain(const std::string& domainId, bool noError=false) const; - CAxis* getAssociatedAxis(const std::string& axisId, bool noError=false) const; - CScalar* getAssociatedScalar(const std::string& scalarId, bool noError=false) const; func::CFunctor::ETimeType getOperationTimeType() const; public: + int getNStep(void) const; + template void getData(CArray& _data) const; + std::shared_ptr getInstantDataFilter(); + + /// Mutateur /// + void setRelFile(CFile* _file); + void incrementNStep(void); + void resetNStep(int nstep = 0); + void resetNStepMax(); + std::map getGridAttributesBufferSize(CContextClient* client, bool bufferForWriting = false); // Grid data buffer size for each connection of contextclient std::map getGridDataBufferSize(CContextClient* client, bool bufferForWriting = false); - - // evaluation the size of the buffer for the field - bool evaluateBufferSize(map>& evaluateBuffer, bool isOptPerformance) ; - public: - void makeGridAliasForCoupling(void) ; + + void setContextClient(CContextClient* newContextClient); + CContextClient* getContextClient(); + public: bool isActive(bool atCurrentTimestep = false) const; bool hasOutputFile; @@ -135,34 +121,30 @@ namespace xios void solveGridReference(void); void solveServerOperation(void); void solveCheckMaskIndex(bool doSendingIndex); + void solveAllReferenceEnabledField(bool doSending2Server); + void solveOnlyReferenceEnabledField(bool doSending2Server); + void generateNewTransformationGridDest(); + void updateRef(CGrid* grid); + void buildGridTransformationGraph(); void solveGridDomainAxisRef(bool checkAtt); + void solveTransformedGrid(); + void solveGenerateGrid(); void solveGridDomainAxisBaseRef(); + void solveAllEnabledFieldsAndTransform(); void checkGridOfEnabledFields(); void sendGridOfEnabledFields(); void sendGridComponentOfEnabledFields(); - void sendFieldToFileServer(void) ; - void sendCloseDefinition(void) ; - - public: - void sendFieldToCouplerOut(void) ; - private: - bool sendFieldToCouplerOut_done_=false; - public: - - void sendFieldToInputFileServer(void) ; - /// Vérifications /// void checkTimeAttributes(CDuration* freqOp=NULL); - bool buildWorkflowGraph(CGarbageCollector& gc) ; - bool buildWorkflowGraphDone_ = false ; - + void buildFilterGraph(CGarbageCollector& gc, bool enableOutput, Time start_graph=-1, Time end_graph=-1); size_t getGlobalWrittenSize(void) ; - std::shared_ptr getSelfReference(CGarbageCollector& gc); + std::shared_ptr getFieldReference(CGarbageCollector& gc, Time start_graph=-1, Time end_graph=-1); + std::shared_ptr getSelfReference(CGarbageCollector& gc, Time start_graph=-1, Time end_graph=-1); std::shared_ptr getTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq); std::shared_ptr getSelfTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq); @@ -177,29 +159,33 @@ namespace xios static ENodeType GetType(void); - template void setData(const CArray& _data); + template void setData(const CArray& _data, int ntile = -1); static bool dispatchEvent(CEventServer& event); - static bool isCollectiveEvent(CEventServer& event); void sendAllAttributesToServer(CContextClient* client) ; - + void sendUpdateData(const CArray& data); + void sendUpdateData(const CArray& data, CContextClient* client); static void recvUpdateData(CEventServer& event); - void receiveUpdateData(CEventServer& event); - + void recvUpdateData(std::map& rankBuffers); + void writeField(void); bool sendReadDataRequest(const CDate& tsDataRequested); bool sendReadDataRequestIfNeeded(void); static void recvReadDataRequest(CEventServer& event); void recvReadDataRequest(void); + EReadField readField(void); static void recvReadDataReady(CEventServer& event); - void receiveReadDataReady(CEventServer& event); - void recvReadDataReady(vector ranks, vector buffers); // old interface to remove - void recvDataFromCoupler(vector ranks, vector buffers) ; // old interface to remove + void recvReadDataReady(vector ranks, vector buffers); void checkForLateDataFromServer(void); - void checkForLateDataFromCoupler(void) ; - - void checkIfMustAutoTrigger(void); // ym obsolete - void autoTriggerIfNeeded(void); //ym obsolete - void triggerLateField(void) ; - + void checkIfMustAutoTrigger(void); + void autoTriggerIfNeeded(void); + void outputField(CArray& fieldOut); + void outputField(CArray& fieldOut); + void outputField(CArray& fieldOut); + void inputField(CArray& fieldOut); + void inputField(CArray& fieldOut); + void inputField(CArray& fieldOut); + void outputCompressedField(CArray& fieldOut); + void scaleFactorAddOffset(double scaleFactor, double addOffset); + void invertScaleFactorAddOffset(double scaleFactor, double addOffset); void parse(xml::CXMLNode& node); void setVirtualVariableGroup(CVariableGroup* newVVariableGroup); @@ -216,6 +202,7 @@ namespace xios static void recvAddVariableGroup(CEventServer& event); void recvAddVariableGroup(CBufferIn& buffer); void sendAddAllVariables(CContextClient* client); + void writeUpdateData(const CArray& data); const std::vector& getRefDomainAxisIds(); @@ -223,94 +210,30 @@ namespace xios bool hasExpression(void) const; bool hasGridMask(void) const; - - void connectToFileServer(CGarbageCollector& gc) ; - void connectToCouplerOut(CGarbageCollector& gc) ; - void connectToCouplerIn(CGarbageCollector& gc) ; - void connectToModelInput(CGarbageCollector& gc) ; - void connectToFileWriter(CGarbageCollector& gc) ; - void connectToClientInput(CGarbageCollector& gc) ; - void connectToServerInput(CGarbageCollector& gc) ; - void connectToModelOutput(CGarbageCollector& gc); - void connectToFileReader(CGarbageCollector& gc) ; - void connectToServerToClient(CGarbageCollector& gc) ; - - void setContextClientDataBufferSize(map>& bufferSize, - map>& maxEventSize, - bool bufferForWriting) ; - void setContextClientAttributesBufferSize(map>& bufferSize, - map>& maxEventSize, - bool bufferForWriting) ; - private: - bool isGridCompleted_ = true ; - public: - bool isGridCompleted() ; - void setGridCompleted(void) { isGridCompleted_= true; } - void unsetGridCompleted(void) { isGridCompleted_ = false ;} - - public: - void sendGridCompleted(void) ; - private: - static void recvGridCompleted(CEventServer& event); - void recvGridCompleted(CBufferIn& buffer); - - - private: - std::vector getGridPath(void) ; public: /// Propriétés privées /// CVariableGroup* vVariableGroup; - CGrid* grid_=nullptr; - CGrid* getGrid(void) { return grid_; } - - private: - CGrid* sentGrid_=nullptr ; - public: - CGrid* getSentGrid(void) { return sentGrid_; } + CGrid* grid; + CFile* file; - public: -// CFile* file; - - CFile* fileIn_ = nullptr ; // > foperation_srv; + + // map > data_srv; + CArray recvDataSrv; + + std::shared_ptr recvFoperationSrv; string content; std::vector domAxisScalarIds_; @@ -320,89 +243,41 @@ namespace xios bool hasTimeInstant; bool hasTimeCentered; + Time field_graph_start; + Time field_graph_end; + DECLARE_REF_FUNC(Field,field) - - private: - CContextClient* client; - public: - void setContextClient(CContextClient* newContextClient); - CContextClient* getContextClient(void) {return client;} private: + CContextClient* client; bool areAllReferenceSolved; bool isReferenceSolved; bool isReferenceSolvedAndTransformed; bool isGridChecked; - - private: - //! define if the field is part of the active workflow. It will be tagged to true when CField::buildWorkflowGraph is successfull - bool workflowEnabled_ = false ; - public: - /*! workflowEnabled_ public accessor - * \return Value of workflowEnabled_ */ - bool getWorkflowEnabled(void) { return workflowEnabled_; } - + bool nstepMaxRead; private: - //! The type of operation attached to the field func::CFunctor::ETimeType operationTimeType; - //! The output pin of the input filter of the field - std::shared_ptr inputFilter; - - //! The self temporal data filter - std::shared_ptr selfTemporalDataFilter ; - //! The output pin of the filter providing the instant data for the field std::shared_ptr instantDataFilter; - public: - std::shared_ptr getInstantDataFilter(void) { return instantDataFilter;} - - private: - //! The output pin of the filters providing the result of the field's temporal operation std::map, DurationFakeLessComparator> temporalDataFilters; - //! The output pin of the filter providing the instant data for self references - std::shared_ptr selfReferenceFilter; // probably redondant with inputFilter - + std::shared_ptr selfReferenceFilter; //! The source filter for data provided by the client -// std::shared_ptr clientSourceFilter; // obsolete to remove - - //! The source filter for data provided by the model to enter the client workflow - std::shared_ptr modelToClientSourceFilter_; - - //! The source filter for data provided by the model to enter the client workflow - std::shared_ptr clientToModelStoreFilter_; - - //! The source filter for data provided by the client that send data to server workflow - std::shared_ptr serverFromClientSourceFilter_; - - //! The source filter for data provided by an other to enter the current client workflow (coupling mode) - std::shared_ptr clientFromClientSourceFilter_; - - //! The source filter for data provided by server to enter the current client workflow (reading mode) - std::shared_ptr clientFromServerSourceFilter_; - - //! The source filter for data read from file on server side - std::shared_ptr fileReaderSourceFilter_; - + std::shared_ptr clientSourceFilter; //! The source filter for data provided by the server -// std::shared_ptr serverSourceFilter; // obsolete to remove - - //! The terminal filter which send data to server for writing - std::shared_ptr clientToServerStoreFilter_; - + std::shared_ptr serverSourceFilter; + //! The terminal filter which stores the instant data + std::shared_ptr storeFilter; + //! The terminal filter which writes the data to file + std::shared_ptr fileWriterFilter; //! The terminal filter which writes data to file - std::shared_ptr fileWriterStoreFilter_; - - //! The terminal filter which send data from server to client - std::shared_ptr serverToClientStoreFilter_; - - + std::shared_ptr fileServerWriterFilter; }; // class CField ///-------------------------------------------------------------- diff --git a/xios_2311_src/src/node/field_decl.cpp b/xios_2311_src/src/node/field_decl.cpp index 1854c17350d0781c256028b0047378ae1a6c44cd..bfbc1a7930d9c30734d3d60854e1deafd3406ee1 100644 --- a/xios_2311_src/src/node/field_decl.cpp +++ b/xios_2311_src/src/node/field_decl.cpp @@ -2,13 +2,13 @@ namespace xios { - template void CField::setData<1>(const CArray& _data); - template void CField::setData<2>(const CArray& _data); - template void CField::setData<3>(const CArray& _data); - template void CField::setData<4>(const CArray& _data); - template void CField::setData<5>(const CArray& _data); - template void CField::setData<6>(const CArray& _data); - template void CField::setData<7>(const CArray& _data); + template void CField::setData<1>(const CArray& _data, int ntile); + template void CField::setData<2>(const CArray& _data, int ntile); + template void CField::setData<3>(const CArray& _data, int ntile); + template void CField::setData<4>(const CArray& _data, int ntile); + template void CField::setData<5>(const CArray& _data, int ntile); + template void CField::setData<6>(const CArray& _data, int ntile); + template void CField::setData<7>(const CArray& _data, int ntile); template void CField::getData<1>(CArray& _data) const; template void CField::getData<2>(CArray& _data) const; diff --git a/xios_2311_src/src/node/field_impl.hpp b/xios_2311_src/src/node/field_impl.hpp index a79a7f2339d44ec1e8f98221e78264e76b7a7d15..af7d223e27d628b89a2fa0463981c286fe6eb735 100644 --- a/xios_2311_src/src/node/field_impl.hpp +++ b/xios_2311_src/src/node/field_impl.hpp @@ -8,18 +8,23 @@ #include "grid.hpp" #include "timer.hpp" #include "array_new.hpp" +#include "source_filter.hpp" +#include "store_filter.hpp" namespace xios { template - void CField::setData(const CArray& _data) + void CField::setData(const CArray& _data, int tileid) TRY { - if (modelToClientSourceFilter_) + if (clientSourceFilter) { if (check_if_active.isEmpty() || (!check_if_active.isEmpty() && (!check_if_active) || isActive(true))) - modelToClientSourceFilter_->streamData(CContext::getCurrent()->getCalendar()->getCurrentDate(), _data); + if (tileid > -1) + clientSourceFilter->streamTile(CContext::getCurrent()->getCalendar()->getCurrentDate(), _data, tileid); // tiled domain + else + clientSourceFilter->streamData(CContext::getCurrent()->getCalendar()->getCurrentDate(), _data); } else if (instantDataFilter) ERROR("void CField::setData(const CArray& _data)", @@ -31,9 +36,9 @@ namespace xios { void CField::getData(CArray& _data) const TRY { - if (clientToModelStoreFilter_) + if (storeFilter) { - CDataPacket::StatusCode status = clientToModelStoreFilter_->getData(CContext::getCurrent()->getCalendar()->getCurrentDate(), _data); + CDataPacket::StatusCode status = storeFilter->getData(CContext::getCurrent()->getCalendar()->getCurrentDate(), _data); if (status == CDataPacket::END_OF_STREAM) ERROR("void CField::getData(CArray& _data) const", diff --git a/xios_2311_src/src/node/file.cpp b/xios_2311_src/src/node/file.cpp index fe1a4b4a44fa6582bb6178400233be32bca5c14a..ab15526a634a19234a9adb24de5c2cc52ebcf981 100644 --- a/xios_2311_src/src/node/file.cpp +++ b/xios_2311_src/src/node/file.cpp @@ -144,9 +144,11 @@ namespace xios { bool default_enabled) TRY { - if (!this->enabledFields.empty()) return (this->enabledFields); + if (!this->enabledFields.empty()) + return (this->enabledFields); - const int _outputlevel = (!output_level.isEmpty()) ? output_level.getValue() : default_outputlevel; + const int _outputlevel = + (!output_level.isEmpty()) ? output_level.getValue() : default_outputlevel; std::vector::iterator it; this->enabledFields = this->getAllFields(); @@ -173,6 +175,8 @@ namespace xios { } newEnabledFields.push_back(*it); + // Le champ est finalement actif, on y ajoute la rfrence au champ de base. + (*it)->setRelFile(CFile::get(this)); } enabledFields = newEnabledFields; @@ -221,6 +225,7 @@ namespace xios { { CContext* context = CContext::getCurrent(); const CDate& currentDate = context->calendar->getCurrentDate(); + CContextServer* server = context->server; lastSync = currentDate; lastSplit = currentDate; @@ -239,6 +244,11 @@ namespace xios { } isOpen = false; +// if (!record_offset.isEmpty() && record_offset < 0) +// ERROR("void CFile::initFile(void)", +// "Invalid 'record_offset', this attribute cannot be negative."); + const int recordOffset = record_offset.isEmpty() ? 0 : record_offset; + set setAxis; set setDomains; @@ -246,20 +256,22 @@ namespace xios { for (it = this->enabledFields.begin(); it != end; it++) { CField* field = *it; - std::vector vecAxis = field->getGrid()->getAxis(); + std::vector vecAxis = field->grid->getAxis(); for (size_t i = 0; i < vecAxis.size(); ++i) setAxis.insert(vecAxis[i]->getAxisOutputName()); - std::vector vecDomains = field->getGrid()->getDomains(); + std::vector vecDomains = field->grid->getDomains(); for (size_t i = 0; i < vecDomains.size(); ++i) setDomains.insert(vecDomains[i]->getDomainOutputName()); + + field->resetNStep(recordOffset); } nbAxis = setAxis.size(); nbDomains = setDomains.size(); // create sub communicator for file - //createSubComFile(); // NetCDF runs now write of null data - MPI_Comm_dup(context->intraComm_, &fileComm) ; + createSubComFile(); + // if (time_counter.isEmpty()) time_counter.setValue(time_counter_attr::centered); if (time_counter_name.isEmpty()) time_counter_name = "time_counter"; } CATCH_DUMP_ATTR @@ -268,23 +280,20 @@ namespace xios { void CFile::initRead(void) TRY { - CContext* context = CContext::getCurrent(); if (checkRead) return; - //createSubComFile(); - allZoneEmpty = false; - MPI_Comm_dup(context->intraComm_, &fileComm) ; + createSubComFile(); checkRead = true; } CATCH_DUMP_ATTR /*! Create a sub communicator in which processes participate in reading/opening file - Seems to be deprecated (allZoneEmpty too, which is always false) */ void CFile::createSubComFile() TRY { CContext* context = CContext::getCurrent(); + CContextServer* server = context->server; // create sub communicator for file allZoneEmpty = true; @@ -292,12 +301,12 @@ namespace xios { for (it = this->enabledFields.begin(); it != end; it++) { CField* field = *it; - bool nullGrid = (nullptr == field->getGrid()); - allZoneEmpty &= nullGrid ? false : !field->getGrid()->doGridHaveDataToWrite(); + bool nullGrid = (0 == field->grid); + allZoneEmpty &= nullGrid ? false : !field->grid->doGridHaveDataToWrite(); } int color = allZoneEmpty ? 0 : 1; - MPI_Comm_split(context->intraComm_, color, context->intraCommRank_, &fileComm); + MPI_Comm_split(server->intraComm, color, server->intraCommRank, &fileComm); if (allZoneEmpty) MPI_Comm_free(&fileComm); } CATCH_DUMP_ATTR @@ -311,15 +320,19 @@ namespace xios { TRY { CContext* context = CContext::getCurrent(); - - if (mode.isEmpty() || mode.getValue() == mode_attr::write) + // Done by classical server or secondary server + // This condition should be changed soon + if (CServer::serverLevel == 0 || CServer::serverLevel == 2) { - CTimer::get("Files : create headers").resume(); - if (!isOpen) createHeader(); - CTimer::get("Files : create headers").suspend(); - checkSync(); - } - checkSplit(); + if (mode.isEmpty() || mode.getValue() == mode_attr::write) + { + CTimer::get("Files : create headers").resume(); + if (!isOpen) createHeader(); + CTimer::get("Files : create headers").suspend(); + checkSync(); + } + checkSplit(); // REally need this? + } } CATCH_DUMP_ATTR @@ -335,11 +348,8 @@ namespace xios { CContext* context = CContext::getCurrent(); // Done by classical server or secondary server // TODO: This condition should be changed soon. It only works with maximum number of level as 2 - -//ym if (CServer::serverLevel == 0 || CServer::serverLevel == 1) -// ym client must doing it also -// if (context->getServiceType()==CServicesManager::IO_SERVER || context->getServiceType()==CServicesManager::GATHERER) -// { + if (CServer::serverLevel == 0 || CServer::serverLevel == 1) + { if (!mode.isEmpty() && mode.getValue() == mode_attr::read) { CTimer::get("Files : open headers").resume(); @@ -349,7 +359,7 @@ namespace xios { CTimer::get("Files : open headers").suspend(); } //checkSplit(); // Really need for reading? - // } + } } CATCH_DUMP_ATTR @@ -405,11 +415,11 @@ namespace xios { { lastSplit = lastSplit + split_freq.getValue(); std::vector::iterator it, end = this->enabledFields.end(); -/* for (it = this->enabledFields.begin(); it != end; it++) + for (it = this->enabledFields.begin(); it != end; it++) { (*it)->resetNStep(); (*it)->resetNStepMax(); - }*/ + } if (mode.isEmpty() || mode.getValue() == mode_attr::write) createHeader(); else @@ -421,7 +431,6 @@ namespace xios { } CATCH_DUMP_ATTR - /*! \brief Create header of netcdf file There are some information to fill in header of each netcdf. @@ -430,7 +439,8 @@ namespace xios { TRY { CContext* context = CContext::getCurrent(); - + CContextServer* server = context->server; + if (!allZoneEmpty) { StdString filename = getFileOutputName(); @@ -546,7 +556,7 @@ namespace xios { MPI_Comm_size(fileComm, &commSize); MPI_Comm_rank(fileComm, &commRank); - if (context->intraCommSize_ > 1) + if (commSize > 1) { oss << "_" ; int width=0; int n = commSize-1; @@ -622,6 +632,7 @@ namespace xios { TRY { CContext* context = CContext::getCurrent(); + CContextServer* server = context->server; MPI_Comm readComm = this->fileComm; if (!allZoneEmpty) @@ -668,7 +679,7 @@ namespace xios { MPI_Comm_size(readComm, &commSize); MPI_Comm_rank(readComm, &commRank); - if (context->intraCommSize_ > 1) + if (server->intraCommSize > 1) { oss << "_"; int width = 0, n = commSize - 1; @@ -684,7 +695,7 @@ namespace xios { bool isCollective = par_access.isEmpty() || par_access == par_access_attr::collective; bool readMetaDataPar = true; - if (context->getServiceType()==CServicesManager::CLIENT) readMetaDataPar = (read_metadata_par.isEmpty()) ? false : read_metadata_par; + if (!context->hasServer) readMetaDataPar = (read_metadata_par.isEmpty()) ? false : read_metadata_par; if (isOpen) data_out->closeFile(); bool ugridConvention = !convention.isEmpty() ? (convention == convention_attr::UGRID) : false; @@ -735,10 +746,7 @@ namespace xios { this->data_in->readFieldAttributesMetaData(enabledFields[idx]); // Now complete domain and axis associated with this field - - //ym => this a problem in wich order are done the grid generation. Probably metadata are read in file and after the grid is ditributed by the filter - // => must be checked in detail. But solveGenerated grid is not existing any more with new transformation framework - // enabledFields[idx]->solveGenerateGrid(); + enabledFields[idx]->solveGenerateGrid(); // Read necessary value from file this->data_in->readFieldAttributesValues(enabledFields[idx]); @@ -752,15 +760,6 @@ namespace xios { } CATCH_DUMP_ATTR - void CFile::readFieldAttributesMetaData(CField* field) - { - this->data_in->readFieldAttributesMetaData(field); - } - - void CFile::readFieldAttributesValues(CField* field) - { - this->data_in->readFieldAttributesValues(field); - } /*! \brief Parse xml file and write information into file object \param [in] node xmld node corresponding in xml file @@ -823,6 +822,25 @@ namespace xios { //---------------------------------------------------------------- + /*! + \brief Resolve all reference of active fields. + In order to know exactly which data each active field has, a search for all its + reference to find its parents or/and its base reference object must be done. Moreover + during this search, there are some information that can only be sent to server AFTER + all information of active fields are created on server side, e.g: checking mask or index + \param [in] sendToServer: Send all info to server (true) or only a part of it (false) + */ + void CFile::solveOnlyRefOfEnabledFields(bool sendToServer) + TRY + { + int size = this->enabledFields.size(); + for (int i = 0; i < size; ++i) + { + this->enabledFields[i]->solveOnlyReferenceEnabledField(sendToServer); + } + } + CATCH_DUMP_ATTR + void CFile::checkGridOfEnabledFields() TRY { @@ -848,6 +866,8 @@ namespace xios { /*! \brief Sorting domains with the same name (= describing the same mesh) in the decreasing order of nvertex for UGRID files. This insures that the domain with the highest nvertex is written first and thus all known mesh connectivity is generated at once by this domain. + Secondly, we associate the UGRID mesh to the domain in incresing order, i.e. nvertex=1 first, nvertex=2 and then nvertex>2. + In this case the connectivity of each component of the mesh (node, edge and face) are fully coherent. */ void CFile::sortEnabledFieldsForUgrid() TRY @@ -855,6 +875,7 @@ namespace xios { int size = this->enabledFields.size(); std::vector domainNvertices; std::vector domainNames; + std::map,set,set>> registeredDomains ; for (int i = 0; i < size; ++i) { @@ -897,6 +918,58 @@ namespace xios { domainNames.push_back(domainName); domainNvertices.push_back(nvertex); } + + if (nvertex==1) std::get<0>(registeredDomains[domainName]).insert(domain[0]) ; + else if (nvertex==2) std::get<1>(registeredDomains[domainName]).insert(domain[0]) ; + else std::get<2>(registeredDomains[domainName]).insert(domain[0]) ; + } + + for(auto& it:registeredDomains) + { + list domains ; + string domainName=it.first ; + + for(auto& domain : std::get<0>(it.second) ) domains.push_back(domain) ; + for(auto& domain : std::get<1>(it.second) ) domains.push_back(domain) ; + for(auto& domain : std::get<2>(it.second) ) domains.push_back(domain) ; + + // for each component of a given mesh (i.e. domains with same name but different number of vertices) + // associate the UGRID mesh in increasing order + for(auto& domain : domains ) + { + domain-> computeWrittenIndex(); + CArray& indexToWrite = domain->localIndexToWriteOnServer; + int nbWritten = indexToWrite.numElements(); + CArray writtenLat, writtenLon; + CArray writtenBndsLat, writtenBndsLon; + + writtenLat.resize(nbWritten); + writtenLon.resize(nbWritten); + for (int idx = 0; idx < nbWritten; ++idx) + { + writtenLat(idx) = domain->latvalue(indexToWrite(idx)); + writtenLon(idx) = domain->lonvalue(indexToWrite(idx)); + } + + int nvertex = domain->nvertex, idx; + if (nvertex>1) + { + writtenBndsLat.resize(nvertex, nbWritten); + writtenBndsLon.resize(nvertex, nbWritten); + CArray& boundslat = domain->bounds_latvalue; + CArray& boundslon = domain->bounds_lonvalue; + for (idx = 0; idx < nbWritten; ++idx) + for (int nv = 0; nv < nvertex; ++nv) + { + writtenBndsLat(nv, idx) = boundslat(nv, int(indexToWrite(idx))); + writtenBndsLon(nv, idx) = boundslon(nv, int(indexToWrite(idx))); + } + } + domain->assignMesh(domainName, domain->nvertex); + CContextServer* server=CContext::getCurrent()->server ; + domain->mesh->createMeshEpsilon(server->intraComm, writtenLon, writtenLat, writtenBndsLon, writtenBndsLat); + } + } } CATCH_DUMP_ATTR @@ -912,6 +985,51 @@ namespace xios { } CATCH_DUMP_ATTR + void CFile::generateNewTransformationGridDest() + TRY + { + int size = this->enabledFields.size(); + for (int i = 0; i < size; ++i) + { + this->enabledFields[i]->generateNewTransformationGridDest(); + } + } + CATCH_DUMP_ATTR + + /*! + \brief Resolve all reference of active fields. + In order to know exactly which data each active field has, a search for all its + reference to find its parents or/and its base reference object must be done. Moreover + during this search, there are some information that can only be sent to server AFTER + all information of active fields are created on server side, e.g: checking mask or index + \param [in] sendToServer: Send all info to server (true) or only a part of it (false) + */ + void CFile::solveAllRefOfEnabledFieldsAndTransform(bool sendToServer) + TRY + { + int size = this->enabledFields.size(); + for (int i = 0; i < size; ++i) + { + this->enabledFields[i]->solveAllEnabledFieldsAndTransform(); + } + } + CATCH_DUMP_ATTR + + /*! + * Constructs the filter graph for each active field. + * + * \param gc the garbage collector to use when building the filter graph + */ + void CFile::buildFilterGraphOfEnabledFields(CGarbageCollector& gc) + TRY + { + int size = this->enabledFields.size(); + for (int i = 0; i < size; ++i) + { + this->enabledFields[i]->buildFilterGraph(gc, true); + } + } + CATCH_DUMP_ATTR /*! * Post-process the filter graph for each active field. @@ -1286,26 +1404,6 @@ namespace xios { } CATCH_DUMP_ATTR - - - /*! - * Send file attribute, related variable and chield field tree to a given file server. - * \param[in] client : the context client where to send file - */ - void CFile::sendFileToFileServer(CContextClient* client) - TRY - { - if (sendFileToFileServer_done_.count(client)!=0) return ; - else sendFileToFileServer_done_.insert(client) ; - - StdString fileDefRoot("file_definition"); - CFileGroup* cfgrpPtr = CFileGroup::get(fileDefRoot); - cfgrpPtr->sendCreateChild(this->getId(), client); - this->sendAllAttributesToServer(client); - this->sendAddAllVariables(client); - for(auto field : enabledFields) this->sendAddField(field->getId(), client); - } - CATCH_DUMP_ATTR /*! \brief Dispatch event received from client Whenever a message is received in buffer of server, it will be processed depending on diff --git a/xios_2311_src/src/node/file.hpp b/xios_2311_src/src/node/file.hpp index 8aa8c31d54d9d5ac24ba7f34d45bb3bd8b701975..47079c2f5b0036de081f51ddf270014b2949f5a9 100644 --- a/xios_2311_src/src/node/file.hpp +++ b/xios_2311_src/src/node/file.hpp @@ -103,17 +103,20 @@ namespace xios { void openInReadMode(void); void close(void); void readAttributesOfEnabledFieldsInReadMode(); - void readFieldAttributesMetaData(CField* field) ; - void readFieldAttributesValues(CField* field) ; + // Some processing on file void solveFieldRefInheritance(bool apply); void processEnabledFile(void); + void solveOnlyRefOfEnabledFields(bool sendToServer); + void generateNewTransformationGridDest(); + void buildFilterGraphOfEnabledFields(CGarbageCollector& gc); void postProcessFilterGraph(); void prefetchEnabledReadModeFields(); void doPreTimestepOperationsForEnabledReadModeFields(); void doPostTimestepOperationsForEnabledReadModeFields(); + void solveAllRefOfEnabledFieldsAndTransform(bool sendToServer); void checkGridOfEnabledFields(); void sendGridOfEnabledFields(); void sendGridComponentOfEnabledFields(); @@ -138,12 +141,7 @@ namespace xios { void sendAddVariable(const string& id, CContextClient* client); void sendAddVariableGroup(const string& id, CContextClient* client); void sendAddAllVariables(CContextClient* client); - public: - void sendFileToFileServer(CContextClient* client) ; - private: - std::set sendFileToFileServer_done_ ; - - public: + // Receive info from client static void recvAddField(CEventServer& event); void recvAddField(CBufferIn& buffer); @@ -174,9 +172,6 @@ namespace xios { CDate lastSync; CDate lastSplit; - - const CDate& getLastSplit(void) { return lastSplit ; } - int nbAxis, nbDomains; bool isOpen; MPI_Comm fileComm; @@ -196,16 +191,6 @@ namespace xios { std::shared_ptr data_in; std::vector enabledFields; - private: - bool isClientSide_ ; // the file is on client side or on server side ? - public: - bool isClientSide(void) { return isClientSide_ ;} - bool isServerSide(void) { return !isClientSide_ ;} - void setClientSide(void) { isClientSide_=true ;} - void setServerSide(void) { isClientSide_=false ;} - - private: - public: // virtual void toBinary (StdOStream& os) const; diff --git a/xios_2311_src/src/node/generate_rectilinear_domain.cpp b/xios_2311_src/src/node/generate_rectilinear_domain.cpp index a2aa81bb8164969cadd75478ec16d27a79ac9bcd..a4134c116b10572837f4644343ad64d85855fd4d 100644 --- a/xios_2311_src/src/node/generate_rectilinear_domain.cpp +++ b/xios_2311_src/src/node/generate_rectilinear_domain.cpp @@ -1,5 +1,4 @@ #include "generate_rectilinear_domain.hpp" -#include "domain_algorithm_generate_rectilinear.hpp" #include "type.hpp" namespace xios { @@ -27,7 +26,7 @@ namespace xios { bool CGenerateRectilinearDomain::_dummyRegistered = CGenerateRectilinearDomain::registerTrans(); bool CGenerateRectilinearDomain::registerTrans() { - return registerTransformation(TRANS_GENERATE_RECTILINEAR_DOMAIN, {create, getTransformation}); + return registerTransformation(TRANS_GENERATE_RECTILINEAR_DOMAIN, create); } //---------------------------------------------------------------- @@ -138,18 +137,4 @@ namespace xios { } - shared_ptr CGenerateRectilinearDomain::createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) - { - return CDomainAlgorithmGenerateRectilinear::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, - elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, - elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition); - } } diff --git a/xios_2311_src/src/node/generate_rectilinear_domain.hpp b/xios_2311_src/src/node/generate_rectilinear_domain.hpp index abbc22ae1044a85f915fa7eb9022d5e49eb143cc..1d2097263968945e112c09968a25104531247e3e 100644 --- a/xios_2311_src/src/node/generate_rectilinear_domain.hpp +++ b/xios_2311_src/src/node/generate_rectilinear_domain.hpp @@ -19,8 +19,7 @@ namespace xios { class CGenerateRectilinearDomainAttributes; class CGenerateRectilinearDomain; class CDomain; - class CGenericAlgorithmTransformation ; - class CGrid; + ///-------------------------------------------------------------- // Declare/Define CFileAttribute @@ -41,8 +40,6 @@ namespace xios { public : typedef CObjectTemplate SuperClass; typedef CGenerateRectilinearDomainAttributes SuperClassAttribute; - typedef CGenerateRectilinearDomain MyClass ; - typedef CTransformation SuperTransform ; public : /// Constructeurs /// @@ -58,19 +55,6 @@ namespace xios { static StdString GetName(void); static StdString GetDefName(void); static ENodeType GetType(void); - const string& getId(void) { return this->SuperClass::getId();} - ETranformationType getTransformationType(void) { return TRANS_GENERATE_RECTILINEAR_DOMAIN ;} - static CTransformation* getTransformation(const StdString& id) { return SuperClass::get(id);} - virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} - virtual shared_ptr createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) ; private: static bool registerTrans(); static CTransformation* create(const StdString& id, xml::CXMLNode* node); diff --git a/xios_2311_src/src/node/grid.cpp b/xios_2311_src/src/node/grid.cpp index 5f3d4ea0dd4c1bfb619c01f574ae47e0275a9c5c..4b140831b9f63d19253104b1e2d1ff7502333281 100755 --- a/xios_2311_src/src/node/grid.cpp +++ b/xios_2311_src/src/node/grid.cpp @@ -15,24 +15,11 @@ #include "server_distribution_description.hpp" #include "client_server_mapping_distributed.hpp" #include "distribution_client.hpp" +#include "grid_transformation.hpp" +#include "grid_generate.hpp" #include "server.hpp" -#include "distribution_type.hpp" -#include "grid_client_server_remote_connector.hpp" -#include "grid_elements.hpp" -#include "grid_local_view.hpp" -#include "grid_mask_connector.hpp" -#include "transformation_path.hpp" -#include "grid_transformation_factory_impl.hpp" -#include "transform_filter.hpp" -#include "grid_algorithm.hpp" -#include "grid_algorithm_generic.hpp" -#include "generic_algorithm_transformation.hpp" -#include "algo_types.hpp" - -#include - -namespace xios -{ + +namespace xios { /// ////////////////////// Dfinitions ////////////////////// /// @@ -42,12 +29,18 @@ namespace xios , vDomainGroup_(), domList_(), isDomListSet(false) , vAxisGroup_(), axisList_(), isAxisListSet(false) , vScalarGroup_(), scalarList_(), isScalarListSet(false) - , clientDistribution_(0), isIndexSent(false) + , clientDistribution_(0), isIndexSent(false) , serverDistribution_(0), clientServerMap_(0) + , writtenDataSize_(0), numberWrittenIndexes_(0), totalNumberWrittenIndexes_(0), offsetWrittenIndexes_(0) , connectedDataSize_(), connectedServerRank_(), connectedServerRankRead_(), connectedDataSizeRead_() - , isCompressible_(false) + , isDataDistributed_(true), isCompressible_(false) + , transformations_(0), isTransformed_(false) , axisPositionInGrid_(), hasDomainAxisBaseRef_(false) - , gridSrc_(), order_() + , gridSrc_(), hasTransform_(false), isGenerated_(false), order_(), globalIndexOnServer_() + , computedWrittenIndex_(false) , clients() + , nTiles_(0) + , isTiled_(false), isTiledOnly_(false) + , storeTileIndex() { setVirtualDomainGroup(CDomainGroup::create(getId() + "_virtual_domain_group")); setVirtualAxisGroup(CAxisGroup::create(getId() + "_virtual_axis_group")); @@ -60,12 +53,18 @@ namespace xios , vDomainGroup_(), domList_(), isDomListSet(false) , vAxisGroup_(), axisList_(), isAxisListSet(false) , vScalarGroup_(), scalarList_(), isScalarListSet(false) - , clientDistribution_(0), isIndexSent(false) + , clientDistribution_(0), isIndexSent(false) , serverDistribution_(0), clientServerMap_(0) + , writtenDataSize_(0), numberWrittenIndexes_(0), totalNumberWrittenIndexes_(0), offsetWrittenIndexes_(0) , connectedDataSize_(), connectedServerRank_(), connectedServerRankRead_(), connectedDataSizeRead_() - , isCompressible_(false) + , isDataDistributed_(true), isCompressible_(false) + , transformations_(0), isTransformed_(false) , axisPositionInGrid_(), hasDomainAxisBaseRef_(false) - , gridSrc_(), order_() + , gridSrc_(), hasTransform_(false), isGenerated_(false), order_(), globalIndexOnServer_() + , computedWrittenIndex_(false) , clients() + , nTiles_(0) + , isTiled_(false), isTiledOnly_(false) + , storeTileIndex() { setVirtualDomainGroup(CDomainGroup::create(getId() + "_virtual_domain_group")); setVirtualAxisGroup(CAxisGroup::create(getId() + "_virtual_axis_group")); @@ -75,6 +74,9 @@ namespace xios CGrid::~CGrid(void) { if (0 != clientDistribution_) delete clientDistribution_; + if (0 != serverDistribution_) delete serverDistribution_; + if (0 != clientServerMap_) delete clientServerMap_; + if (0 != transformations_) delete transformations_; } ///--------------------------------------------------------------- @@ -84,1193 +86,2071 @@ namespace xios ENodeType CGrid::GetType(void) { return eGrid; } - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ///////// MEMBER FUNCTION RELATED TO GRID CONSTRUCTION by ELEMNTS AND MANAGEMENT ///// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - - CGrid* CGrid::createGrid(CDomain* domain) + StdSize CGrid::getDimension(void) TRY { - std::vector vecDom(1, domain); - std::vector vecAxis; - return createGrid(vecDom, vecAxis); + return getGlobalDimension().size(); } - CATCH - - CGrid* CGrid::createGrid(CDomain* domain, CAxis* axis) - TRY - { - std::vector vecDom(1, domain); - std::vector vecAxis(1, axis); + CATCH_DUMP_ATTR - return createGrid(vecDom, vecAxis); - } - CATCH + //--------------------------------------------------------------- - CGrid* CGrid::createGrid(const std::vector& domains, const std::vector& axis, - const CArray& axisDomainOrder) + StdSize CGrid::getDataSize(void) const TRY { - std::vector vecScalar; - return createGrid(generateId(domains, axis, vecScalar, axisDomainOrder), domains, axis, vecScalar, axisDomainOrder); + StdSize retvalue = 1; + if (!isScalarGrid()) + { + std::vector dataNindex = clientDistribution_->getDataNIndex(); + for (int i = 0; i < dataNindex.size(); ++i) retvalue *= dataNindex[i]; + } + return retvalue; } CATCH - CGrid* CGrid::createGrid(const std::vector& domains, const std::vector& axis, - const std::vector& scalars, const CArray& axisDomainOrder) + //--------------------------------------------------------------- + /*! + * Returns size of tile data + */ + + StdSize CGrid::getTileDataSize(int tileId) TRY { - return createGrid(generateId(domains, axis, scalars, axisDomainOrder), domains, axis, scalars, axisDomainOrder); + StdSize tileGridSize =1 ; + int numElement = axis_domain_order.numElements(); + + std::vector axisListP = this->getAxis(); + std::vector domainListP = this->getDomains(); + + int axisIndex = 0, domIndex = 0; + for (int idx = 0; idx < numElement; ++idx) + { + int eleDim = axis_domain_order(idx); + if (2 == eleDim) + { + tileGridSize *= domainListP[domIndex]->tile_data_ni(tileId); + tileGridSize *= domainListP[domIndex]->tile_data_nj(tileId); + ++domIndex; + } + else if (1 == eleDim) + { + tileGridSize *= axisListP[axisIndex]->n.getValue(); + ++axisIndex; + } + } // loop over grid elements + return tileGridSize; } CATCH - CGrid* CGrid::createGrid(StdString id, const std::vector& domains, const std::vector& axis, - const std::vector& scalars, const CArray& axisDomainOrder) + //--------------------------------------------------------------- + /*! + * Returns tile size + */ + + StdSize CGrid::getTileSize(int tileId) TRY { - if (axisDomainOrder.numElements() > 0 && axisDomainOrder.numElements() != (domains.size() + axis.size() + scalars.size())) - ERROR("CGrid* CGrid::createGrid(...)", - << "The size of axisDomainOrder (" << axisDomainOrder.numElements() - << ") is not coherent with the number of elements (" << domains.size() + axis.size() <<")."); + StdSize tileGridSize =1 ; + int numElement = axis_domain_order.numElements(); - CGrid* grid = CGridGroup::get("grid_definition")->createChild(id); - grid->setDomainList(domains); - grid->setAxisList(axis); - grid->setScalarList(scalars); + std::vector axisListP = this->getAxis(); + std::vector domainListP = this->getDomains(); - // By default, domains are always the first elements of a grid - if (0 == axisDomainOrder.numElements()) - { - int size = domains.size() + axis.size() + scalars.size(); - int nb = 0; - grid->axis_domain_order.resize(size); - for (int i = 0; i < size; ++i) - { - if (i < domains.size()) - { - grid->axis_domain_order(i) = 2; - grid->order_.push_back(2) ; - } - else if ((scalars.size() < (size-nb)) < size) - { - grid->axis_domain_order(i) = 1; - grid->order_.push_back(1) ; - } - else - { - grid->axis_domain_order(i) = 0; - grid->order_.push_back(0) ; + int axisIndex = 0, domIndex = 0; + for (int idx = 0; idx < numElement; ++idx) + { + int eleDim = axis_domain_order(idx); + if (2 == eleDim) + { + tileGridSize *= domainListP[domIndex]->tile_ni(tileId); + tileGridSize *= domainListP[domIndex]->tile_nj(tileId); + ++domIndex; } - ++nb; - } - } - else - { - grid->axis_domain_order.resize(axisDomainOrder.numElements()); - grid->axis_domain_order = axisDomainOrder; - grid->order_.clear() ; - for(int i=0; iorder_.push_back(axisDomainOrder(i)) ; - - } - - // grid->solveElementsRefInheritance(true); - grid->computeElements() ; - return grid; + else if (1 == eleDim)// So it's an axis + { + tileGridSize *= axisListP[axisIndex]->n.getValue(); + ++axisIndex; + } + } // loop over grid elements + return tileGridSize; } CATCH + //--------------------------------------------------------------- - CGrid* CGrid::get(const string& id, bool noError) + /*! + * Compute the minimum buffer size required to send the attributes to the server(s). + * + * \return A map associating the server rank with its minimum buffer size. + * TODO: Refactor code + */ + std::map CGrid::getAttributesBufferSize(CContextClient* client, bool bufferForWriting) + TRY { - const regex r("::"); - smatch m; - if (regex_search(id, m, r)) + std::map attributesSizes = getMinimumBufferSizeForAttributes(client); + + // The grid indexes require a similar size as the actual data + std::map dataSizes = getDataBufferSize(client, "", bufferForWriting); + std::map::iterator it, itE = dataSizes.end(); + for (it = dataSizes.begin(); it != itE; ++it) { - if (m.size()!=1) ERROR("CGrid* Cgrid::get(string& id)", <<" id = "< bad format id, separator :: append more than one time"); - string fieldId=m.prefix() ; - if (fieldId.empty()) ERROR("CGrid* CGrid::get(string& id)", <<" id = "< bad format id, field name is empty"); - string suffix=m.suffix() ; - if (!suffix.empty()) ERROR("CGrid* CGrid::get(string& id)", <<" id = "< bad format id, suffix is not empty"); - if (!CField::has(fieldId)) - if (noError) return nullptr ; - else ERROR("CGrid* CGrid::get(string& id)", <<" id = "< field Id : < "< doesn't exist"); - CField* field=CField::get(fieldId) ; - return field->getAssociatedGrid() ; + it->second += 2 * sizeof(bool); + if (it->second > attributesSizes[it->first]) + attributesSizes[it->first] = it->second; } - else + + // Account for the axis attributes + std::vector axisList = getAxis(); + for (size_t i = 0; i < axisList.size(); ++i) { - if (noError) if(!CObjectFactory::HasObject(id)) return nullptr ; - return CObjectFactory::GetObject(id).get(); + std::map axisAttBuffSize = axisList[i]->getAttributesBufferSize(client, getGlobalDimension(),axisPositionInGrid_[i]); + for (it = axisAttBuffSize.begin(), itE = axisAttBuffSize.end(); it != itE; ++it) + { + it->second += 2 * sizeof(bool); + if (it->second > attributesSizes[it->first]) + attributesSizes[it->first] = it->second; + } } - } - - bool CGrid::has(const string& id) - { - if (CGrid::get(id,true)==nullptr) return false ; - else return true ; - } - //---------------------------------------------------------------- + // Account for the domain attributes + std::vector domList = getDomains(); + for (size_t i = 0; i < domList.size(); ++i) + { + std::map domAttBuffSize = domList[i]->getAttributesBufferSize(client); + for (it = domAttBuffSize.begin(), itE = domAttBuffSize.end(); it != itE; ++it) + { + it->second += 2 * sizeof(bool); + if (it->second > attributesSizes[it->first]) + attributesSizes[it->first] = it->second; + } + } - //! Change virtual field group to a new one - void CGrid::setVirtualDomainGroup(CDomainGroup* newVDomainGroup) + return attributesSizes; + } + CATCH_DUMP_ATTR + + /*! + * Compute the minimum buffer size required to send the data. + * \param client contextClient used to determine the size of connected receivers + * \param id the id used to tag the data + * \param bufferForWriting flag indicating if a buffer is used to send data for writing + * \return A map associating the sender rank with its minimum buffer size. + */ + std::map CGrid::getDataBufferSize(CContextClient* client, const std::string& id /*= ""*/, bool bufferForWriting /*= "false"*/) TRY - { - this->vDomainGroup_ = newVDomainGroup; + { + // The record index is sometimes sent along with the data but we always + // include it in the size calculation for the sake of simplicity + const size_t extraSize = CEventClient::headerSize + (id.empty() ? getId() : id).size() + + 2 * sizeof(size_t) + + sizeof(size_t); + + std::map dataSizes; + int receiverSize = client->serverSize; + std::map& dataSizeMap = bufferForWriting ? connectedDataSize_[receiverSize]: connectedDataSizeRead_; + std::vector& connectedServerRanks = bufferForWriting ? connectedServerRank_[receiverSize] : connectedServerRankRead_; + + std::map::const_iterator itEnd = dataSizeMap.end(); + for (size_t k = 0; k < connectedServerRanks.size(); ++k) + { + int rank = connectedServerRanks[k]; + std::map::const_iterator it = dataSizeMap.find(rank); + size_t count = (it != itEnd) ? it->second : 0; + + dataSizes.insert(std::make_pair(rank, extraSize + CArray::size(count))); + } + + return dataSizes; } CATCH_DUMP_ATTR - //! Change virtual variable group to new one - void CGrid::setVirtualAxisGroup(CAxisGroup* newVAxisGroup) + size_t CGrid::getGlobalWrittenSize(void) TRY { - this->vAxisGroup_ = newVAxisGroup; + std::vector domainP = this->getDomains(); + std::vector axisP = this->getAxis(); + + size_t globalGridSize=1 ; + for (std::vector::iterator it=domainP.begin(); it!=domainP.end();++it) globalGridSize*=(*it)->getGlobalWrittenSize() ; + for (std::vector::iterator it=axisP.begin(); it!=axisP.end();++it) globalGridSize*=(*it)->getGlobalWrittenSize() ; + return globalGridSize ; } CATCH_DUMP_ATTR - - //! Change virtual variable group to new one - void CGrid::setVirtualScalarGroup(CScalarGroup* newVScalarGroup) + + void CGrid::checkAttributesAfterTransformation() TRY { - this->vScalarGroup_ = newVScalarGroup; + setAxisList(); + std::vector axisListP = this->getAxis(); + if (!axisListP.empty()) + { + int idx = 0; + axisPositionInGrid_.resize(0); + for (int i = 0; i < axis_domain_order.numElements(); ++i) + { + int elementDimension = axis_domain_order(i); + if (1 == elementDimension) + { + axisPositionInGrid_.push_back(idx); + ++idx; + } + else if (2 == elementDimension) idx += 2; + } + + for (int i = 0; i < axisListP.size(); ++i) + { + axisListP[i]->checkAttributesOnClientAfterTransformation(getGlobalDimension(),axisPositionInGrid_[i]); + } + } + + setDomainList(); + std::vector domListP = this->getDomains(); + if (!domListP.empty()) + { + for (int i = 0; i < domListP.size(); ++i) + { + domListP[i]->checkAttributesOnClientAfterTransformation(); + } + } } CATCH_DUMP_ATTR - //---------------------------------------------------------------- + //--------------------------------------------------------------- - CDomainGroup* CGrid::getVirtualDomainGroup() const + /*! + * Test whether the data defined on the grid can be outputted in a compressed way. + * + * \return true if and only if a mask was defined for this grid + */ + bool CGrid::isCompressible(void) const TRY { - return this->vDomainGroup_; + return isCompressible_; } CATCH - CAxisGroup* CGrid::getVirtualAxisGroup() const + //--------------------------------------------------------------- + + void CGrid::addRelFileCompressed(const StdString& filename) TRY { - return this->vAxisGroup_; + this->relFilesCompressed.insert(filename); } - CATCH + CATCH_DUMP_ATTR - CScalarGroup* CGrid::getVirtualScalarGroup() const + bool CGrid::isWrittenCompressed(const StdString& filename) const TRY { - return this->vScalarGroup_; + return (this->relFilesCompressed.find(filename) != this->relFilesCompressed.end()); } CATCH - ///--------------------------------------------------------------- - - CDomain* CGrid::addDomain(const std::string& id) + //--------------------------------------------------------------- + /* + Find all reference of grid's components and inherite attributes if necessary + */ + void CGrid::solveDomainAxisRef(bool areAttributesChecked) TRY { - order_.push_back(2); - axis_domain_order.resize(order_.size()); - for (int idx = 0; idx < order_.size(); ++idx) axis_domain_order(idx)=order_[idx]; - CDomain* domain = vDomainGroup_->createChild(id); - isDomListSet=false ; - computeElements(); - return domain ; + if (this->isDomainAxisChecked) return; + + this->solveScalarRef(areAttributesChecked); + this->solveAxisRef(areAttributesChecked); + this->solveDomainRef(areAttributesChecked); + this->isDomainAxisChecked = areAttributesChecked; } CATCH_DUMP_ATTR - CAxis* CGrid::addAxis(const std::string& id) + /* + Go up hierachy reference and fill in the base reference with attributes of the children + This function should be only used after reading component's attributes from file + */ + void CGrid::solveDomainAxisBaseRef() TRY { - order_.push_back(1); - axis_domain_order.resize(order_.size()); - for (int idx = 0; idx < order_.size(); ++idx) axis_domain_order(idx)=order_[idx]; - CAxis* axis=vAxisGroup_->createChild(id); - isAxisListSet=false ; - computeElements(); - return axis ; + if (this->hasDomainAxisBaseRef_) return; + // Account for the scalar attributes + std::vector scalarList = getScalars(); + for (size_t i = 0; i < scalarList.size(); ++i) + { + scalarList[i]->setAttributesReference(); + } + + // Account for the axis attributes + std::vector axisList = getAxis(); + for (size_t i = 0; i < axisList.size(); ++i) + { + axisList[i]->setAttributesReference(); + } + + // Account for the domain attributes + std::vector domList = getDomains(); + for (size_t i = 0; i < domList.size(); ++i) + { + domList[i]->setAttributesReference(); + } + + this->hasDomainAxisBaseRef_ = true; } CATCH_DUMP_ATTR - CScalar* CGrid::addScalar(const std::string& id) + void CGrid::checkEligibilityForCompressedOutput() TRY { - order_.push_back(0); - axis_domain_order.resize(order_.size()); - for (int idx = 0; idx < order_.size(); ++idx) axis_domain_order(idx)=order_[idx]; - CScalar* scalar = vScalarGroup_->createChild(id); - isScalarListSet=false ; - computeElements(); - return scalar; + // We don't check if the mask is valid here, just if a mask has been defined at this point. + isCompressible_ = !mask_1d.isEmpty() || !mask_2d.isEmpty() || !mask_3d.isEmpty(); } CATCH_DUMP_ATTR + void CGrid::checkMaskIndex(bool doSendingIndex) + TRY + { + CContext* context = CContext::getCurrent(); + int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 0) : 1; + nbSrvPools = 1; + for (int p = 0; p < nbSrvPools; ++p) + { + if (context->hasClient && this->isChecked && doSendingIndex && !isIndexSent) + { + if (isScalarGrid()) + sendIndexScalarGrid(); + else + sendIndex(); + this->isIndexSent = true; + } + // Not sure about this + //if (!(this->hasTransform() && !this->isTransformed())) + // this->isChecked = true; + //return; + } + + if (this->isChecked) return; + this->checkAttributesAfterTransformation(); + // TODO: Transfer grid attributes + //if (!context->hasClient && context->hasServer) this->createMask(); + this->computeIndex(); - /*! - \brief Get the list of domain pointers - \return list of domain pointers - */ - std::vector CGrid::getDomains() - TRY - { - setDomainList(); - std::vector domList; - if (!domList_.empty()) - { - for (int i = 0; i < domList_.size(); ++i) domList.push_back(CDomain::get(domList_[i])); - } - return domList; - } - CATCH_DUMP_ATTR - - /*! - \brief Get the list of axis pointers - \return list of axis pointers - */ - std::vector CGrid::getAxis() - TRY - { - setAxisList(); - std::vector aList; - if (!axisList_.empty()) - for (int i =0; i < axisList_.size(); ++i) aList.push_back(CAxis::get(axisList_[i])); - - return aList; - } - CATCH_DUMP_ATTR + if (!(this->hasTransform() && !this->isTransformed())) + this->isChecked = true; - /*! - \brief Get the list of axis pointers - \return list of axis pointers - */ - std::vector CGrid::getScalars() - TRY - { - setScalarList() ; - std::vector sList; - if (!scalarList_.empty()) - for (int i =0; i < scalarList_.size(); ++i) sList.push_back(CScalar::get(scalarList_[i])); + if (!(this->hasTransform() && (!this->isGenerated()))) + this->isChecked = true; + } + CATCH_DUMP_ATTR + bool CGrid::hasMask() const + TRY + { + return (!mask_1d.isEmpty() || !mask_2d.isEmpty() || !mask_3d.isEmpty() || + !mask_4d.isEmpty() || !mask_5d.isEmpty() || !mask_6d.isEmpty() || !mask_7d.isEmpty()); + } + CATCH - return sList; - } - CATCH_DUMP_ATTR + /* + Create mask of grid from mask of its components + */ + void CGrid::createMask(void) + TRY + { + using namespace std; + std::vector domainP = this->getDomains(); + std::vector axisP = this->getAxis(); + int dim = domainP.size() * 2 + axisP.size(); + + std::vector* > domainMasks(domainP.size()); + for (int i = 0; i < domainMasks.size(); ++i) domainMasks[i] = &(domainP[i]->domainMask); + std::vector* > axisMasks(axisP.size()); + for (int i = 0; i < axisMasks.size(); ++i) axisMasks[i] = &(axisP[i]->mask); + + switch (dim) { + case 1: + checkGridMask(mask_1d, domainMasks, axisMasks, axis_domain_order, true); + break; + case 2: + checkGridMask(mask_2d, domainMasks, axisMasks, axis_domain_order, true); + break; + case 3: + checkGridMask(mask_3d, domainMasks, axisMasks, axis_domain_order, true); + break; + case 4: + checkGridMask(mask_4d, domainMasks, axisMasks, axis_domain_order, true); + break; + case 5: + checkGridMask(mask_5d, domainMasks, axisMasks, axis_domain_order, true); + break; + case 6: + checkGridMask(mask_6d, domainMasks, axisMasks, axis_domain_order, true); + break; + case 7: + checkGridMask(mask_7d, domainMasks, axisMasks, axis_domain_order, true); + break; + default: + break; + } + } + CATCH_DUMP_ATTR - /*! - \brief Get domain pointer with index - \return domain pointer - */ - CDomain* CGrid::getDomain(int domainIndex) - TRY - { - std::vector domainListP = this->getDomains(); - if (domainListP.empty()) - { - ERROR("CGrid::getDomain(int domainIndex)", - << "No domain associated to this grid. " << std::endl - << "Grid id = " << this->getId()); - } + /* + Check validity of grid's mask by using the masks of its components + */ + void CGrid::checkMask(void) + TRY + { + using namespace std; + std::vector domainP = this->getDomains(); + std::vector axisP = this->getAxis(); + int dim = domainP.size() * 2 + axisP.size(); + + std::vector* > domainMasks(domainP.size()); + for (int i = 0; i < domainMasks.size(); ++i) domainMasks[i] = &(domainP[i]->domainMask); + std::vector* > axisMasks(axisP.size()); + for (int i = 0; i < axisMasks.size(); ++i) axisMasks[i] = &(axisP[i]->mask); + + switch (dim) { + case 1: + checkGridMask(mask_1d, domainMasks, axisMasks, axis_domain_order); + break; + case 2: + checkGridMask(mask_2d, domainMasks, axisMasks, axis_domain_order); + break; + case 3: + checkGridMask(mask_3d, domainMasks, axisMasks, axis_domain_order); + break; + case 4: + checkGridMask(mask_4d, domainMasks, axisMasks, axis_domain_order); + break; + case 5: + checkGridMask(mask_5d, domainMasks, axisMasks, axis_domain_order); + break; + case 6: + checkGridMask(mask_6d, domainMasks, axisMasks, axis_domain_order); + break; + case 7: + checkGridMask(mask_7d, domainMasks, axisMasks, axis_domain_order); + break; + default: + break; + } + } + CATCH_DUMP_ATTR - if (domainIndex >= domainListP.size() || (domainIndex < 0)) - ERROR("CGrid::getDomain(int domainIndex)", - << "Domain with the index doesn't exist " << std::endl - << "Grid id = " << this->getId() << std::endl - << "Grid has only " << domainListP.size() << " domain but domain index required is " << domainIndex << std::endl); + /* + Modify value of mask in a certain index + This function can be used to correct the mask of grid after being constructed with createMask + \param [in] indexToModify + \param [in] modifyValue + */ + void CGrid::modifyMask(const CArray& indexToModify, bool modifyValue) + TRY + { + using namespace std; + std::vector domainP = this->getDomains(); + std::vector axisP = this->getAxis(); + int dim = domainP.size() * 2 + axisP.size(); + + switch (dim) { + case 0: + modifyGridMask(mask_0d, indexToModify, modifyValue); + break; + case 1: + modifyGridMask(mask_1d, indexToModify, modifyValue); + break; + case 2: + modifyGridMask(mask_2d, indexToModify, modifyValue); + break; + case 3: + modifyGridMask(mask_3d, indexToModify, modifyValue); + break; + case 4: + modifyGridMask(mask_4d, indexToModify, modifyValue); + break; + case 5: + modifyGridMask(mask_5d, indexToModify, modifyValue); + break; + case 6: + modifyGridMask(mask_6d, indexToModify, modifyValue); + break; + case 7: + modifyGridMask(mask_7d, indexToModify, modifyValue); + break; + default: + break; + } + } + CATCH_DUMP_ATTR - return domainListP[domainIndex]; - } - CATCH_DUMP_ATTR + /* + Change the mask size. This function is used on reconstructing mask in server side + \param [in] newDimensionSize + \param [in] newValue + */ + void CGrid::modifyMaskSize(const std::vector& newDimensionSize, bool newValue) + TRY + { + std::vector domainP = this->getDomains(); + std::vector axisP = this->getAxis(); + int dim = domainP.size() * 2 + axisP.size(); + + switch (dim) { + case 0: + modifyGridMaskSize(mask_0d, newDimensionSize, newValue); + break; + case 1: + modifyGridMaskSize(mask_1d, newDimensionSize, newValue); + break; + case 2: + modifyGridMaskSize(mask_2d, newDimensionSize, newValue); + break; + case 3: + modifyGridMaskSize(mask_3d, newDimensionSize, newValue); + break; + case 4: + modifyGridMaskSize(mask_4d, newDimensionSize, newValue); + break; + case 5: + modifyGridMaskSize(mask_5d, newDimensionSize, newValue); + break; + case 6: + modifyGridMaskSize(mask_6d, newDimensionSize, newValue); + break; + case 7: + modifyGridMaskSize(mask_7d, newDimensionSize, newValue); + break; + default: + break; + } + } + CATCH_DUMP_ATTR - /*! - \brief Get the axis pointer with index - \return axis pointer - */ - CAxis* CGrid::getAxis(int axisIndex) - TRY - { - std::vector axisListP = this->getAxis(); - if (axisListP.empty()) - { - ERROR("CGrid::getDomain(int axisIndex)", - << "No axis associated to this grid. " << std::endl - << "Grid id = " << this->getId()); - } + //--------------------------------------------------------------- - if (axisIndex >= axisListP.size() || (axisIndex < 0)) - ERROR("CGrid::getDomain(int axisIndex)", - << "Domain with the index doesn't exist " << std::endl - << "Grid id = " << this->getId() << std::endl - << "Grid has only " << axisListP.size() << " axis but axis index required is " << axisIndex << std::endl); + void CGrid::solveDomainRef(bool sendAtt) + TRY + { + setDomainList(); + std::vector domListP = this->getDomains(); + if (!domListP.empty()) + { + for (int i = 0; i < domListP.size(); ++i) + { + if (sendAtt) domListP[i]->sendCheckedAttributes(); + else domListP[i]->checkAttributesOnClient(); + if (domListP[i]->isTiled()) this->isTiled_ = true; + if (domListP[i]->isTiledOnly()) this->isTiledOnly_ = true; + } + } + } + CATCH_DUMP_ATTR - return axisListP[axisIndex]; - } - CATCH_DUMP_ATTR + //--------------------------------------------------------------- - /*! - \brief Get the a scalar pointer - \return scalar pointer - */ - CScalar* CGrid::getScalar(int scalarIndex) - TRY - { - std::vector scalarListP = this->getScalars(); - if (scalarListP.empty()) - { - ERROR("CGrid::getScalar(int scalarIndex)", - << "No scalar associated to this grid. " << std::endl - << "Grid id = " << this->getId()); - } + void CGrid::solveAxisRef(bool sendAtt) + TRY + { + setAxisList(); + std::vector axisListP = this->getAxis(); + if (!axisListP.empty()) + { + int idx = 0; + axisPositionInGrid_.resize(0); + for (int i = 0; i < axis_domain_order.numElements(); ++i) + { + int elementDimension = axis_domain_order(i); + if (1 == elementDimension) + { + axisPositionInGrid_.push_back(idx); + ++idx; + } + else if (2 == elementDimension) idx += 2; + } - if (scalarIndex >= scalarListP.size() || (scalarIndex < 0)) - ERROR("CGrid::getScalar(int scalarIndex)", - << "Scalar with the index doesn't exist " << std::endl - << "Grid id = " << this->getId() << std::endl - << "Grid has only " << scalarListP.size() << " scalar but scalar index required is " << scalarIndex << std::endl); + for (int i = 0; i < axisListP.size(); ++i) + { + if (sendAtt) + axisListP[i]->sendCheckedAttributes(getGlobalDimension(),axisPositionInGrid_[i]); + else + axisListP[i]->checkAttributesOnClient(); + } + } + } + CATCH_DUMP_ATTR - return scalarListP[scalarIndex]; - } - CATCH_DUMP_ATTR + //--------------------------------------------------------------- - CDomain* CGrid::getAssociatedDomain(const string& domainId, bool noError) - { - const regex r("\\[[0-9]*\\]"); - smatch m; - string id=domainId ; - int pos=-1 ; - if (regex_search(domainId, m, r)) - { - if (m.size()!=1) ERROR("CGrid::getAssociatedDomain(const string& domainId)", <<" domainId = "< bad format id, separator [] append more than one time"); - id=m.prefix() ; - pos = stoi(m.str(0).substr(1,m.str(0).size()-2)) ; - } - std::vector domainList = this->getDomains(); - if (domainList.empty()) - if (noError) return nullptr ; - else ERROR("CGrid::getAssociatedDomain(const string& domainId)", <<"no domain is composing the grid"); - if (id.empty()) - { - if (pos==-1) + void CGrid::solveScalarRef(bool sendAtt) + TRY + { + setScalarList(); + std::vector scalarListP = this->getScalars(); + if (!scalarListP.empty()) { - if (domainList.size()==1) return domainList[0] ; - else - if (noError) return nullptr ; - else ERROR("CGrid::getAssociatedDomain(const string& domainId)", <<"the grid contain more than 1 domain, use [#n] to specify which one must be retrieved"); + for (int i = 0; i < scalarListP.size(); ++i) + { + /*Nothing to do for now */ +// if (sendAtt) scalarListP[i]->sendCheckedAttributes(); +// else scalarListP[i]->checkAttributesOnClient(); + } } - else + } + CATCH_DUMP_ATTR + + /*! + Compute the index to for write data into a file + */ + void CGrid::computeWrittenIndex() + TRY + { + if (computedWrittenIndex_) return; + computedWrittenIndex_ = true; + + if (isScalarGrid()) { - if (domainList.size()>pos) return domainList[pos] ; - else if (noError) return nullptr ; - else ERROR("CGrid::getAssociatedDomain(const string& domainId)", <<"the position of the requested domain [ pos = "<getGlobalDataIndexOnClient(); + CDistributionClient::GlobalLocalDataMap::const_iterator itb = globalDataIndex.begin(), + ite = globalDataIndex.end(), it; + const CDistributionServer::GlobalLocalMap& globalLocalIndex = serverDistribution_->getGlobalLocalIndex(); + CDistributionServer::GlobalLocalMap::const_iterator itSrvb = globalLocalIndex.begin(), + itSrve = globalLocalIndex.end(), itSrv; + for (it = itb; it != ite; ++it) { - int nbDomain=0 ; - for(int i=0; igetTemplateId()==id) nbDomain++ ; - if (nbDomain>1) - if (noError) return nullptr ; - else ERROR("CGrid::getAssociatedDomain(const string& domainId)", <<"no domain with the id = "<getTemplateId()==id) return domainList[i] ; + indGlo = it->first; + if (globalLocalIndex.end() != globalLocalIndex.find(indGlo)) ++nbWritten; } - else + + localIndexToWriteOnClient.resize(nbWritten); + localIndexToWriteOnServer.resize(nbWritten); + { - int currentPos=0 ; - for(int i=0; igetTemplateId()==id && pos==currentPos) return domainList[i] ; - currentPos++ ; + CContextServer* server = CContext::getCurrent()->server; + MPI_Allreduce(&numberWrittenIndexes_, &totalNumberWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm); + MPI_Scan(&numberWrittenIndexes_, &offsetWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm); + offsetWrittenIndexes_ -= numberWrittenIndexes_; } - if (noError) return nullptr ; - else ERROR("CGrid::getAssociatedDomain(const string& domainId)",<<"Cannot find domain with [ id = "<< id <<" ] at [ pos = "< bad format id, separator [] append more than one time"); - id=m.prefix() ; - pos = stoi(m.str(0).substr(1,m.str(0).size()-2)) ; - } - std::vector axisList = this->getAxis(); - if (axisList.empty()) - if (noError) return nullptr; - else ERROR("CGrid::getAssociatedAxis(const string& AxisId)", <<"no axis is composing the grid"); - if (id.empty()) - { - if (pos==-1) + nbWritten = 0; + for (it = itb; it != ite; ++it) { - if (axisList.size()==1) return axisList[0] ; - else - if (noError) return nullptr; - else ERROR("CGrid::getAssociatedAxis(const string& axisId)", <<"the grid contain more than 1 axis, use [#n] to specify which one must be retrieved"); + indGlo = it->first; + itSrv = globalLocalIndex.find(indGlo); + if (itSrve != itSrv) + { + localIndexToWriteOnServer(nbWritten) = itSrv->second; + localIndexToWriteOnClient(nbWritten) = it->second; + ++nbWritten; + } } - else - { - if (axisList.size()>pos) return axisList[pos] ; - else - if (noError) return nullptr; - else ERROR("CGrid::getAssociatedAxis(const string& axisId)", <<"the position of the requested axis [ pos = "<getTemplateId()==id) nbAxis++ ; - if (nbAxis>1) - if (noError) return nullptr; - else ERROR("CGrid::getAssociatedAxis(const string& axisId)", <<"no axis with the id = "<getTemplateId()==id) return axisList[i] ; + } + CATCH_DUMP_ATTR + + //--------------------------------------------------------------- + + /* + Compute the global index and its local index taking account mask and data index. + These global indexes will be used to compute the connection of this client (sender) to its servers (receivers) + (via function computeConnectedClient) + These global indexes also correspond to data sent to servers (if any) + */ + void CGrid::computeClientIndex() + TRY + { + CContext* context = CContext::getCurrent(); + + CContextClient* client = context->client; + int rank = client->clientRank; + + clientDistribution_ = new CDistributionClient(rank, this); + // Get local data index on client + int nbStoreIndex = clientDistribution_->getLocalDataIndexOnClient().size(); + int nbStoreGridMask = clientDistribution_->getLocalMaskIndexOnClient().size(); + // nbStoreGridMask = nbStoreIndex if grid mask is defined, and 0 otherwise + storeIndex_client.resize(nbStoreIndex); + storeMask_client.resize(nbStoreGridMask); + for (int idx = 0; idx < nbStoreIndex; ++idx) storeIndex_client(idx) = (clientDistribution_->getLocalDataIndexOnClient())[idx]; + for (int idx = 0; idx < nbStoreGridMask; ++idx) storeMask_client(idx) = (clientDistribution_->getLocalMaskIndexOnClient())[idx]; + + if (0 == serverDistribution_) isDataDistributed_= clientDistribution_->isDataDistributed(); + else + { + // Mapping global index received from clients to the storeIndex_client + CDistributionClient::GlobalLocalDataMap& globalDataIndex = clientDistribution_->getGlobalDataIndexOnClient(); + CDistributionClient::GlobalLocalDataMap::const_iterator itGloe = globalDataIndex.end(); + map >::iterator itb = outGlobalIndexFromClient.begin(), + ite = outGlobalIndexFromClient.end(), it; + + for (it = itb; it != ite; ++it) + { + int rank = it->first; + CArray& globalIndex = outGlobalIndexFromClient[rank]; + outLocalIndexStoreOnClient.insert(make_pair(rank, CArray(globalIndex.numElements()))); + CArray& localIndex = outLocalIndexStoreOnClient[rank]; + size_t nbIndex = 0; + + // Keep this code for this moment but it should be removed (or moved to DEBUG) to improve performance + for (size_t idx = 0; idx < globalIndex.numElements(); ++idx) + { + if (itGloe != globalDataIndex.find(globalIndex(idx))) + { + ++nbIndex; + } + } + + if (doGridHaveDataDistributed(client) && (nbIndex != localIndex.numElements())) + ERROR("void CGrid::computeClientIndex()", + << "Number of local index on client is different from number of received global index" + << "Rank of sent client " << rank <<"." + << "Number of local index " << nbIndex << ". " + << "Number of received global index " << localIndex.numElements() << "."); + + nbIndex = 0; + for (size_t idx = 0; idx < globalIndex.numElements(); ++idx) + { + if (itGloe != globalDataIndex.find(globalIndex(idx))) + { + localIndex(idx) = globalDataIndex[globalIndex(idx)]; + } + } + } } - else - { - int currentPos=0 ; - for(int i=0; iclient; + int rank = client->clientRank; + + clientDistributionTiled_ = new CDistributionClient(rank, this, true); + // Get local data index on client + int nbStoreIndex = clientDistributionTiled_->getLocalDataIndexOnClient().size(); + int nbStoreGridMask = clientDistributionTiled_->getLocalMaskIndexOnClient().size(); + // nbStoreGridMask = nbStoreIndex if grid mask is defined, and 0 otherwise + storeIndexTiled_client.resize(nbStoreIndex); + storeMaskTiled_client.resize(nbStoreGridMask); + for (int idx = 0; idx < nbStoreIndex; ++idx) storeIndexTiled_client(idx) = (clientDistributionTiled_->getLocalDataIndexOnClient())[idx]; + for (int idx = 0; idx < nbStoreGridMask; ++idx) storeMaskTiled_client(idx) = (clientDistributionTiled_->getLocalMaskIndexOnClient())[idx]; + + if (0 == serverDistribution_) isDataDistributed_= clientDistributionTiled_->isDataDistributed(); + else + { + // Mapping global index received from clients to the storeIndex_client + CDistributionClient::GlobalLocalDataMap& globalDataIndex = clientDistributionTiled_->getGlobalDataIndexOnClient(); + CDistributionClient::GlobalLocalDataMap::const_iterator itGloe = globalDataIndex.end(); + map >::iterator itb = outGlobalIndexFromClientTiled.begin(), + ite = outGlobalIndexFromClientTiled.end(), it; + + for (it = itb; it != ite; ++it) { - if (axisList[i]->getTemplateId()==id && pos==currentPos) return axisList[i] ; - currentPos++ ; + int rank = it->first; + CArray& globalIndex = outGlobalIndexFromClientTiled[rank]; + outLocalIndexStoreOnClientTiled.insert(make_pair(rank, CArray(globalIndex.numElements()))); + CArray& localIndex = outLocalIndexStoreOnClientTiled[rank]; + size_t nbIndex = 0; + + // Keep this code for this moment but it should be removed (or moved to DEBUG) to improve performance + for (size_t idx = 0; idx < globalIndex.numElements(); ++idx) + { + if (itGloe != globalDataIndex.find(globalIndex(idx))) + { + ++nbIndex; + } + } + + if (doGridHaveDataDistributed(client) && (nbIndex != localIndex.numElements())) + ERROR("void CGrid::computeClientIndex()", + << "Number of local index on client is different from number of received global index" + << "Rank of sent client " << rank <<"." + << "Number of local index " << nbIndex << ". " + << "Number of received global index " << localIndex.numElements() << "."); + + nbIndex = 0; + for (size_t idx = 0; idx < globalIndex.numElements(); ++idx) + { + if (itGloe != globalDataIndex.find(globalIndex(idx))) + { + localIndex(idx) = globalDataIndex[globalIndex(idx)]; + } + } } - if (noError) return nullptr; - else ERROR("CGrid::getAssociatedAxis(const string& axisId)",<<"Cannot find axis with [ id = "<< id <<" ] at [ pos = "<clientPrimServer.size() == 0) ? 1 : context->clientPrimServer.size(); + connectedServerRank_.clear(); + connectedDataSize_.clear(); + globalIndexOnServer_.clear(); + nbSenders.clear(); - CScalar* CGrid::getAssociatedScalar(const string& scalarId, bool noError) - { - const regex r("\\[[0-9]*\\]"); - smatch m; - string id=scalarId ; - int pos=-1 ; - if (regex_search(scalarId, m, r)) + for (int p = 0; p < nbSrvPools; ++p) + { + CContextClient* client = (context->clientPrimServer.size() == 0) ? context->client : context->clientPrimServer[p]; + int receiverSize = client->serverSize; +// connectedServerRank_[client].clear(); + + if (connectedServerRank_.find(receiverSize) == connectedServerRank_.end()) + { + if (!doGridHaveDataDistributed(client)) + { + if (client->isServerLeader()) + { + size_t ssize = clientDistribution_->getLocalDataIndexOnClient().size(); + const std::list& ranks = client->getRanksServerLeader(); + for (std::list::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) + { + connectedServerRank_[receiverSize].push_back(*itRank); + connectedDataSize_[receiverSize][*itRank] = ssize; + } + } + return; + } + + // Compute mapping between client and server + std::vector > > indexServerOnElement; + CServerDistributionDescription serverDistributionDescription(getGlobalDimension(), client->serverSize); + std::vector serverZeroIndex = serverDistributionDescription.computeServerGlobalByElement(indexServerOnElement, + client->clientRank, + client->clientSize, + axis_domain_order, + getDistributedDimension()); + + // Even if servers have no index, they must received something from client + // We only use several client to send "empty" message to these servers + std::list serverZeroIndexLeader; + std::list serverZeroIndexNotLeader; + CContextClient::computeLeader(client->clientRank, client->clientSize, serverZeroIndex.size(), serverZeroIndexLeader, serverZeroIndexNotLeader); + for (std::list::iterator it = serverZeroIndexLeader.begin(); it != serverZeroIndexLeader.end(); ++it) + *it = serverZeroIndex[*it]; + + if (globalIndexOnServer_.find(receiverSize) == globalIndexOnServer_.end()) + computeIndexByElement(indexServerOnElement, client, globalIndexOnServer_[receiverSize]); + + const CDistributionClient::GlobalLocalDataMap& globalLocalIndexSendToServer = clientDistribution_->getGlobalLocalDataSendToServer(); + CDistributionClient::GlobalLocalDataMap::const_iterator iteGlobalLocalIndexMap = globalLocalIndexSendToServer.end(), itGlobalLocalIndexMap; + CClientServerMapping::GlobalIndexMap::const_iterator iteGlobalMap, itbGlobalMap, itGlobalMap; + itbGlobalMap = globalIndexOnServer_[receiverSize].begin(); + iteGlobalMap = globalIndexOnServer_[receiverSize].end(); + + for (itGlobalMap = itbGlobalMap; itGlobalMap != iteGlobalMap; ++itGlobalMap) + { + int serverRank = itGlobalMap->first; + int indexSize = itGlobalMap->second.size(); + const std::vector& indexVec = itGlobalMap->second; + for (int idx = 0; idx < indexSize; ++idx) + { + itGlobalLocalIndexMap = globalLocalIndexSendToServer.find(indexVec[idx]); + if (iteGlobalLocalIndexMap != itGlobalLocalIndexMap) + { + if (connectedDataSize_[receiverSize].end() == connectedDataSize_[receiverSize].find(serverRank)) + connectedDataSize_[receiverSize][serverRank] = 1; + else + ++connectedDataSize_[receiverSize][serverRank]; + } + } + } + + // Connected servers which really have index + for (itGlobalMap = itbGlobalMap; itGlobalMap != iteGlobalMap; ++itGlobalMap) { + connectedServerRank_[receiverSize].push_back(itGlobalMap->first); + } + + // Connected servers which have no index at all + for (std::list::iterator it = serverZeroIndexLeader.begin(); it != serverZeroIndexLeader.end(); ++it) + connectedServerRank_[receiverSize].push_back(*it); + + // Even if a client has no index, it must connect to at least one server and + // send an "empty" data to this server + if (connectedServerRank_[receiverSize].empty()) + connectedServerRank_[receiverSize].push_back(client->clientRank % client->serverSize); + + // Now check if all servers have data to receive. If not, master client will send empty data. + // This ensures that all servers will participate in collective calls upon receiving even if they have no date to receive. + std::vector counts (client->clientSize); + std::vector displs (client->clientSize); + displs[0] = 0; + int localCount = connectedServerRank_[receiverSize].size() ; + MPI_Gather(&localCount, 1, MPI_INT, &counts[0], 1, MPI_INT, 0, client->intraComm) ; + for (int i = 0; i < client->clientSize-1; ++i) + { + displs[i+1] = displs[i] + counts[i]; + } + std::vector allConnectedServers(displs[client->clientSize-1]+counts[client->clientSize-1]); + MPI_Gatherv(&(connectedServerRank_[receiverSize])[0], localCount, MPI_INT, &allConnectedServers[0], &counts[0], &displs[0], MPI_INT, 0, client->intraComm); + + if ((allConnectedServers.size() != receiverSize) && (client->clientRank == 0)) + { + std::vector isSrvConnected (receiverSize, false); + for (int i = 0; i < allConnectedServers.size(); ++i) isSrvConnected[allConnectedServers[i]] = true; + for (int i = 0; i < receiverSize; ++i) + { + if (!isSrvConnected[i]) connectedServerRank_[receiverSize].push_back(i); + } + } + + nbSenders[receiverSize] = clientServerMap_->computeConnectedClients(receiverSize, client->clientSize, client->intraComm, connectedServerRank_[receiverSize]); + } + } + } + CATCH_DUMP_ATTR + + /*! + Compute the global index of grid to send to server as well as the connected server of the current client. + First of all, from the local data on each element of grid, we can calculate their local index which also allows us to know + their global index. We can have a map of global index of grid and local index that each client holds + Then, each client holds a piece of information about the distribution of servers, which permits to compute the connected server(s) + of the current client. + */ + void CGrid::computeIndex(void) + TRY + { + CContext* context = CContext::getCurrent(); + if (isScalarGrid()) + { + computeClientIndexScalarGrid(); + if (context->hasClient) + { + computeConnectedClientsScalarGrid(); + } + } + else + { + if (this->isTiled_) + { + computeClientIndexTiled(); + if (!this->isTiledOnly_) + computeClientIndex(); + } + else + computeClientIndex(); + + if (this->isTiled_) computeTileIndex(); + if (context->hasClient) + { + computeConnectedClients(); + } + } + if (CServer::serverLevel==2) + { + computeWrittenIndex() ; + if (serverDistribution_!=0) serverDistribution_->partialClear() ; + if (clientDistribution_!=0) clientDistribution_->partialClear() ; + outGlobalIndexFromClient.clear() ; + } + } + CATCH_DUMP_ATTR + + /*! + Compute the global of (client) grid to send to server with the global index of each element of grid + Each element of grid has its own global index associated to a groups of server. We only search for the global index of each element whose + server is the same, then calculate the global index of grid. This way can reduce so much the time for executing DHT, which only needs to run + on each element whose size is much smaller than one of whole grid. + \param [in] indexServerOnElement global index of each element and the rank of server associated with these index + \param [in] client contextClient + \param [out] globalIndexOnServer global index of grid and its corresponding rank of server. + */ + void CGrid::computeIndexByElement(const std::vector > >& indexServerOnElement, + const CContextClient* client, + CClientServerMapping::GlobalIndexMap& globalIndexOnServer) + TRY + { + int serverSize = client->serverSize; + + std::vector domList = getDomains(); + std::vector axisList = getAxis(); + + // Some pre-calculations of global index on each element of current grid. + int nbElement = axis_domain_order.numElements(); + std::vector > globalIndexElement(nbElement); + int domainIdx = 0, axisIdx = 0, scalarIdx = 0; + std::vector elementNGlobal(nbElement); + elementNGlobal[0] = 1; + size_t globalSize = 1; + for (int idx = 0; idx < nbElement; ++idx) + { + elementNGlobal[idx] = globalSize; + size_t elementSize; + size_t elementGlobalSize = 1; + if (2 == axis_domain_order(idx)) // This is domain + { + elementSize = domList[domainIdx]->i_index.numElements(); + globalIndexElement[idx].resize(elementSize); + for (int jdx = 0; jdx < elementSize; ++jdx) + { + globalIndexElement[idx](jdx) = (domList[domainIdx]->i_index)(jdx) + domList[domainIdx]->ni_glo * (domList[domainIdx]->j_index)(jdx); + } + elementGlobalSize = domList[domainIdx]->ni_glo.getValue() * domList[domainIdx]->nj_glo.getValue(); + ++domainIdx; + } + else if (1 == axis_domain_order(idx)) // This is axis + { + elementSize = axisList[axisIdx]->index.numElements(); + globalIndexElement[idx].resize(elementSize); + for (int jdx = 0; jdx < elementSize; ++jdx) + { + globalIndexElement[idx](jdx) = (axisList[axisIdx]->index)(jdx); + } + elementGlobalSize = axisList[axisIdx]->n_glo.getValue(); + ++axisIdx; + } + else // Of course, this is scalar + { + globalIndexElement[idx].resize(1); + globalIndexElement[idx](0) = 0; + elementGlobalSize = 1; + } + globalSize *= elementGlobalSize; + } + + std::vector > elementOnServer(nbElement, std::vector(serverSize, false)); + std::vector > > globalElementIndexOnServer(nbElement); + CArray nbIndexOnServer(serverSize); // Number of distributed global index held by each client for each server + // Number of temporary distributed global index held by each client for each server + // We have this variable for the case of non-distributed element (often axis) to check the duplicate server rank + CArray nbIndexOnServerTmp(serverSize); + for (int idx = 0; idx < nbElement; ++idx) + { + nbIndexOnServer = 0; + const std::unordered_map >& indexServerElement = indexServerOnElement[idx]; + const CArray& globalIndexElementOnClient = globalIndexElement[idx]; + CClientClientDHTInt clientClientDHT(indexServerElement, client->intraComm); + clientClientDHT.computeIndexInfoMapping(globalIndexElementOnClient); + const CClientClientDHTInt::Index2VectorInfoTypeMap& globalIndexElementOnServerMap = clientClientDHT.getInfoIndexMap(); + CClientClientDHTInt::Index2VectorInfoTypeMap::const_iterator itb = globalIndexElementOnServerMap.begin(), + ite = globalIndexElementOnServerMap.end(), it; + for (it = itb; it != ite; ++it) + { + const std::vector& tmp = it->second; + nbIndexOnServerTmp = 0; + for (int i = 0; i < tmp.size(); ++i) + { + if (0 == nbIndexOnServerTmp(tmp[i])) ++nbIndexOnServerTmp(tmp[i]); + } + nbIndexOnServer += nbIndexOnServerTmp; + } + + for (int i = 0; i < serverSize; ++i) + { + if (0 != nbIndexOnServer(i)) + { + globalElementIndexOnServer[idx][i].resize(nbIndexOnServer(i)); + elementOnServer[idx][i] = true; + } + } + + nbIndexOnServer = 0; + for (size_t j = 0; j < globalIndexElementOnServerMap.size(); ++j) + { + it = globalIndexElementOnServerMap.find(globalIndexElementOnClient(j)); + if (it != ite) + { + const std::vector& tmp = it->second; + nbIndexOnServerTmp = 0; + for (int i = 0; i < tmp.size(); ++i) + { + if (0 == nbIndexOnServerTmp(tmp[i])) + { + globalElementIndexOnServer[idx][tmp[i]][nbIndexOnServer(tmp[i])] = it->first; + ++nbIndexOnServerTmp(tmp[i]); + } + } + nbIndexOnServer += nbIndexOnServerTmp; + } + } + } + + // Determine server which contain global source index + std::vector intersectedProc(serverSize, true); + for (int idx = 0; idx < nbElement; ++idx) { - if (m.size()!=1) ERROR("CGrid::getAssociatedScalar(const string& scalarId)", <<" scalarId = "< bad format id, separator [] append more than one time"); - id=m.prefix() ; - pos = stoi(m.str(0).substr(1,m.str(0).size()-2)) ; + std::transform(elementOnServer[idx].begin(), elementOnServer[idx].end(), + intersectedProc.begin(), intersectedProc.begin(), + std::logical_and()); } - std::vector scalarList = this->getScalars(); - if (scalarList.empty()) - if (noError) return nullptr; - else ERROR("CGrid::getAssociatedScalar(const string& scalarId)", <<"no scalar is composing the grid"); - if (id.empty()) + + std::vector srcRank; + for (int idx = 0; idx < serverSize; ++idx) { - if (pos==-1) - { - if (scalarList.size()==1) return scalarList[0] ; - else - if (noError) return nullptr; - else ERROR("CGrid::getAssociatedScalar(const string& scalarId)", <<"the grid contain more than 1 scalar, use [#n] to specify which one must be retrieved"); - } - else - { - if (scalarList.size()>pos) return scalarList[pos] ; - else - if (noError) return nullptr; - else ERROR("CGrid::getAssociatedScalar(const string& scalarId)", <<"the position of the requested scalar [ pos = "<* > globalIndexOfElementTmp(nbElement); + std::vector currentIndex(nbElement,0); + for (int idx = 0; idx < nbElement; ++idx) { - int nbScalar=0 ; - for(int i=0; igetTemplateId()==id) nbScalar++ ; - if (nbScalar>1) - if (noError) return nullptr; - else ERROR("CGrid::getAssociatedScalar(const string& scalarId)", <<"no scalar with the id = "<getTemplateId()==id) return scalarList[i] ; + ssize *= (globalElementIndexOnServer[idx][rankSrc]).size(); + globalIndexOfElementTmp[idx] = &(globalElementIndexOnServer[idx][rankSrc]); } - else + globalIndexOnServer[rankSrc].resize(ssize); + + std::vector idxLoop(nbElement,0); + int innnerLoopSize = (globalIndexOfElementTmp[0])->size(); + size_t idx = 0; + while (idx < ssize) { - int currentPos=0 ; - for(int i=0; igetTemplateId()==id && pos==currentPos) return scalarList[i] ; - currentPos++ ; + if (idxLoop[ind] == (globalIndexOfElementTmp[ind])->size()) + { + idxLoop[ind] = 0; + ++idxLoop[ind+1]; + } + + currentIndex[ind] = (*(globalIndexOfElementTmp[ind]))[idxLoop[ind]]; + } + + for (int ind = 0; ind < innnerLoopSize; ++ind) + { + currentIndex[0] = (*globalIndexOfElementTmp[0])[ind]; + size_t globalSrcIndex = 0; + for (int idxElement = 0; idxElement < nbElement; ++idxElement) + { + globalSrcIndex += currentIndex[idxElement] * elementNGlobal[idxElement]; + } + globalIndexOnServer[rankSrc][idx] = globalSrcIndex; + ++idx; + ++idxLoop[0]; } - if (noError) return nullptr; - else ERROR("CGrid::getAssociatedScalar(const string& scalarId)",<<"Cannot find scalar with [ id = "<< id <<" ] at [ pos = "< domains) - TRY - { - if (isDomListSet) return; - std::vector domList = this->getVirtualDomainGroup()->getAllChildren(); - if (!domains.empty() && domList.empty()) - { - for (int i = 0; i < domains.size(); ++i) - this->getVirtualDomainGroup()->addChild(domains[i]); - domList = this->getVirtualDomainGroup()->getAllChildren(); - } + std::vector axisListP = this->getAxis(); + std::vector domainListP = this->getDomains(); - if (!domList.empty()) - { - int sizeDom = domList.size(); - domList_.resize(sizeDom); - for (int i = 0; i < sizeDom; ++i) - { - domList_[i] = domList[i]->getId(); - } - isDomListSet = true; - } - } - CATCH_DUMP_ATTR + // First, allocate storeTileIndex[0..ntiles] + for (int iTile = 0; iTile < nTiles_; ++iTile) + { + int tileGridSize = 1; + int axisIndex = 0, domIndex = 0; + for (int idx = 0; idx < numElement; ++idx) + { + int eleDim = axis_domain_order(idx); + if (2 == eleDim) + { + tileGridSize *= domainListP[domIndex]->getTileDataISize(iTile); + tileGridSize *= domainListP[domIndex]->getTileDataJSize(iTile); + ++domIndex; + } + else if (1 == eleDim)// So it's an axis + { + tileGridSize *= axisListP[axisIndex]->n.getValue(); + ++axisIndex; + } + } // loop over grid elements + storeTileIndex[iTile].resize(tileGridSize); + storeTileIndex[iTile] = -1; + } // loop over tiles + + // Now fill in storeTileIndex + // Currently assuming two possible situations : (1) domain x axis or (2) domain + std::vector tileIndexCount (nTiles_,0); + int axisSize = 1; + if (axisListP.size() != 0) axisSize = axisListP[0]->n.getValue(); + int ni = domainListP[0]->ni.getValue(); + int nj = domainListP[0]->nj.getValue(); + + for (int idxAxis = 0; idxAxis < axisSize; ++idxAxis) + { + for (int jIdxDom = 0; jIdxDom < nj; ++jIdxDom) + { + for (int iIdxDom = 0; iIdxDom < ni; ++iIdxDom) + { + int tile = domainListP[0]->getTileId(iIdxDom, jIdxDom); + int tileOffset = domainListP[0]->tile_data_ibegin(tile); // only sign of offset matters + + // case 1: data size corresponds to tile size + if (tileOffset == 0) + { + storeTileIndex[tile](tileIndexCount[tile]) = idxAxis*nj*ni + jIdxDom * ni + iIdxDom; + ++tileIndexCount[tile]; + } + // case 2: masked data + else if (tileOffset > 0) + { + int iBegin = domainListP[0]->tile_ibegin(tile) + domainListP[0]->tile_data_ibegin(tile); // tile data relative to domain + int jBegin = domainListP[0]->tile_jbegin(tile) + domainListP[0]->tile_data_jbegin(tile); // tile data relative to domain + int iEnd = iBegin + domainListP[0]->tile_data_ni(tile); + int jEnd = jBegin + domainListP[0]->tile_data_nj(tile); + if ((jIdxDom >= jBegin) && (jIdxDom < jEnd) && (iIdxDom >= iBegin) && (iIdxDom < iEnd)) + { + storeTileIndex[tile](tileIndexCount[tile]) = idxAxis*nj*ni + jIdxDom * ni + iIdxDom; + } + ++tileIndexCount[tile]; + } + // case 3: ghost zones + else + { + int tileDataNi = domainListP[0]->tile_data_ni(tile); + int tileDataNj = domainListP[0]->tile_data_nj(tile); + int tileDomSize = tileDataNi * tileDataNj; + int tileNi = domainListP[0]->tile_ni(tile); + int iBegin = domainListP[0]->tile_data_ibegin(tile); + int jBegin = domainListP[0]->tile_data_jbegin(tile); + + // add the ghost zone at the beginning of a domain tile + if (tileIndexCount[tile] % tileDomSize == 0) + tileIndexCount[tile] += (abs(jBegin)*tileDataNi + abs(iBegin)); + + storeTileIndex[tile](tileIndexCount[tile]) = idxAxis*nj*ni + jIdxDom*ni + iIdxDom; + + // add two ghost zones at the right end of a tile + if ( (iIdxDom+1) % tileNi == 0 ) + tileIndexCount[tile] += (2*abs(iBegin)); + + // add ghost zone at the end of a domain tile + if ((tileIndexCount[tile] + abs(jBegin)*tileDataNi-abs(iBegin) + 1) % tileDomSize == 0) + tileIndexCount[tile] += (abs(jBegin)*tileDataNi -abs(iBegin)); + + ++tileIndexCount[tile]; + } + } // loop over domain first dimension + } // loop over domain second dimension + } // loop over axis dimension - /*! - \brief Set axis(s) of a grid from a list - \param[in] axis list of axis - */ - void CGrid::setAxisList(const std::vector axis) - TRY - { - if (isAxisListSet) return; - std::vector aList = this->getVirtualAxisGroup()->getAllChildren(); - if (!axis.empty() && aList.empty()) - { - for (int i = 0; i < axis.size(); ++i) - this->getVirtualAxisGroup()->addChild(axis[i]); - aList = this->getVirtualAxisGroup()->getAllChildren(); - } + } + CATCH_DUMP_ATTR - if (!aList.empty()) - { - int sizeAxis = aList.size(); - axisList_.resize(sizeAxis); - for (int i = 0; i < sizeAxis; ++i) - { - axisList_[i] = aList[i]->getId(); - } - isAxisListSet = true; - } - } - CATCH_DUMP_ATTR +//---------------------------------------------------------------- - /*! - \brief Set scalar(s) of a grid from a list - \param[in] scalars list of scalars - */ - void CGrid::setScalarList(const std::vector scalars) - TRY - { - if (isScalarListSet) return; - std::vector sList = this->getVirtualScalarGroup()->getAllChildren(); - if (!scalars.empty() && sList.empty()) - { - for (int i = 0; i < scalars.size(); ++i) - this->getVirtualScalarGroup()->addChild(scalars[i]); - sList = this->getVirtualScalarGroup()->getAllChildren(); - } + CGrid* CGrid::createGrid(CDomain* domain) + TRY + { + std::vector vecDom(1, domain); + std::vector vecAxis; - if (!sList.empty()) - { - int sizeScalar = sList.size(); - scalarList_.resize(sizeScalar); - for (int i = 0; i < sizeScalar; ++i) - { - scalarList_[i] = sList[i]->getId(); - } - isScalarListSet = true; - } - } - CATCH_DUMP_ATTR + return createGrid(vecDom, vecAxis); + } + CATCH - /*! - \brief Get list of id of domains - \return id list of domains - */ - std::vector CGrid::getDomainList() - TRY + CGrid* CGrid::createGrid(CDomain* domain, CAxis* axis) + TRY { - setDomainList(); - return domList_; - } - CATCH + std::vector vecDom(1, domain); + std::vector vecAxis(1, axis); - /*! - \brief Get list of id of axis - \return id list of axis - */ - std::vector CGrid::getAxisList() - TRY - { - setAxisList(); - return axisList_; - } - CATCH + return createGrid(vecDom, vecAxis); + } + CATCH - /*! - \brief Get list of id of scalar - \return id list of scalar - */ - std::vector CGrid::getScalarList() - TRY - { - setScalarList(); - return scalarList_; - } - CATCH + CGrid* CGrid::createGrid(const std::vector& domains, const std::vector& axis, + const CArray& axisDomainOrder) + TRY + { + std::vector vecScalar; + return createGrid(generateId(domains, axis, vecScalar, axisDomainOrder), domains, axis, vecScalar, axisDomainOrder); + } + CATCH + CGrid* CGrid::createGrid(const std::vector& domains, const std::vector& axis, + const std::vector& scalars, const CArray& axisDomainOrder) + TRY + { + return createGrid(generateId(domains, axis, scalars, axisDomainOrder), domains, axis, scalars, axisDomainOrder); + } + CATCH - void CGrid::computeElements(void) - { - const auto& domains = getDomains() ; - const auto& axis = getAxis() ; - const auto& scalars = getScalars() ; - int idxDomain = 0, idxAxis=0 , idxScalar=0 ; - - elements_.clear() ; - for(auto type : order_) - { - if (type == 0) { elements_.push_back({scalars[idxScalar], TYPE_SCALAR, scalars[idxScalar], nullptr, nullptr } ) ; idxScalar++;} - else if (type == 1) { elements_.push_back({axis[idxAxis], TYPE_AXIS, nullptr, axis[idxAxis], nullptr}) ; idxAxis++;} - else if (type == 2) { elements_.push_back({domains[idxDomain], TYPE_DOMAIN, nullptr, nullptr, domains[idxDomain] }) ; idxDomain++;} - } - elementsComputed_ = true ; - } - - - /*! - Parse a grid, for now, it contains only domain, axis and scalar - */ - void CGrid::parse(xml::CXMLNode& node) - TRY - { - SuperClass::parse(node); + CGrid* CGrid::createGrid(StdString id, const std::vector& domains, const std::vector& axis, + const std::vector& scalars, const CArray& axisDomainOrder) + TRY + { + if (axisDomainOrder.numElements() > 0 && axisDomainOrder.numElements() != (domains.size() + axis.size() + scalars.size())) + ERROR("CGrid* CGrid::createGrid(...)", + << "The size of axisDomainOrder (" << axisDomainOrder.numElements() + << ") is not coherent with the number of elements (" << domains.size() + axis.size() <<")."); - if (node.goToChildElement()) - { - StdString domainName("domain"); - StdString axisName("axis"); - StdString scalarName("scalar"); - do + CGrid* grid = CGridGroup::get("grid_definition")->createChild(id); + grid->setDomainList(domains); + grid->setAxisList(axis); + grid->setScalarList(scalars); + + // By default, domains are always the first elements of a grid + if (0 == axisDomainOrder.numElements()) { - if (node.getElementName() == domainName) { - order_.push_back(2); - this->getVirtualDomainGroup()->parseChild(node); - } - if (node.getElementName() == axisName) { - order_.push_back(1); - this->getVirtualAxisGroup()->parseChild(node); - } - if (node.getElementName() == scalarName) { - order_.push_back(0); - this->getVirtualScalarGroup()->parseChild(node); + int size = domains.size() + axis.size() + scalars.size(); + int nb = 0; + grid->axis_domain_order.resize(size); + for (int i = 0; i < size; ++i) + { + if (i < domains.size()) { + grid->axis_domain_order(i) = 2; + + } + else if ((scalars.size() < (size-nb)) < size) { + grid->axis_domain_order(i) = 1; + } + else + grid->axis_domain_order(i) = 0; + ++nb; } - } while (node.goToNextElement()); - node.goToParentElement(); - } + } + else + { + grid->axis_domain_order.resize(axisDomainOrder.numElements()); + grid->axis_domain_order = axisDomainOrder; + } - if (!order_.empty()) - { - int sizeOrd = order_.size(); - axis_domain_order.resize(sizeOrd); - for (int i = 0; i < sizeOrd; ++i) + grid->solveDomainAxisRefInheritance(true); + + return grid; + } + CATCH + + CGrid* CGrid::cloneGrid(const StdString& idNewGrid, CGrid* gridSrc) + TRY + { + std::vector domainSrcTmp = gridSrc->getDomains(), domainSrc; + std::vector axisSrcTmp = gridSrc->getAxis(), axisSrc; + std::vector scalarSrcTmp = gridSrc->getScalars(), scalarSrc; + + for (int idx = 0; idx < domainSrcTmp.size(); ++idx) + { + CDomain* domain = CDomain::createDomain(); + domain->duplicateAttributes(domainSrcTmp[idx]); + domain->duplicateTransformation(domainSrcTmp[idx]); + domain->solveRefInheritance(true); + domain->solveInheritanceTransformation(); + domainSrc.push_back(domain); + } + + for (int idx = 0; idx < axisSrcTmp.size(); ++idx) + { + CAxis* axis = CAxis::createAxis(); + axis->duplicateAttributes(axisSrcTmp[idx]); + axis->duplicateTransformation(axisSrcTmp[idx]); + axis->solveRefInheritance(true); + axis->solveInheritanceTransformation(); + axisSrc.push_back(axis); + } + + for (int idx = 0; idx < scalarSrcTmp.size(); ++idx) + { + CScalar* scalar = CScalar::createScalar(); + scalar->duplicateAttributes(scalarSrcTmp[idx]); + scalar->duplicateTransformation(scalarSrcTmp[idx]); + scalar->solveRefInheritance(true); + scalar->solveInheritanceTransformation(); + scalarSrc.push_back(scalar); + } + + CGrid* grid = CGrid::createGrid(idNewGrid, domainSrc, axisSrc, scalarSrc, gridSrc->axis_domain_order); + + return grid; + } + CATCH + + StdString CGrid::generateId(const std::vector& domains, const std::vector& axis, + const std::vector& scalars, const CArray& axisDomainOrder) + TRY + { + if (axisDomainOrder.numElements() > 0 && axisDomainOrder.numElements() != (domains.size() + axis.size() + scalars.size())) + ERROR("CGrid* CGrid::generateId(...)", + << "The size of axisDomainOrder (" << axisDomainOrder.numElements() + << ") is not coherent with the number of elements (" << domains.size() + axis.size() <<")."); + + std::ostringstream id; + + if (domains.empty() && axis.empty() && !scalars.empty()) + id << "__scalar_"; + + if (0 != (domains.size() + axis.size() + scalars.size())) { - axis_domain_order(i) = order_[i]; + id << "__grid"; + + if (0 == axisDomainOrder.numElements()) + { + for (size_t i = 0; i < domains.size(); ++i) id << "_" << domains[i]->getId(); + for (size_t i = 0; i < axis.size(); ++i) id << "_" << axis[i]->getId(); + for (size_t i = 0; i < scalars.size(); ++i) id << "_" << scalars[i]->getId(); + } + else + { + size_t iDomain = 0, iAxis = 0, iScalar = 0; + for (size_t i = 0; i < axisDomainOrder.numElements(); ++i) + { + if (2 == axisDomainOrder(i)) + id << "_" << domains[iDomain++]->getId(); + else if (1 == axisDomainOrder(i)) + id << "_" << axis[iAxis++]->getId(); + else + id << "_" << scalars[iScalar++]->getId(); + } + } + + id << "__"; } - } - setDomainList(); - setAxisList(); - setScalarList(); - computeElements() ; + return id.str(); } - CATCH_DUMP_ATTR + CATCH + StdString CGrid::generateId(const CGrid* gridSrc, const CGrid* gridDest) + TRY + { + StdString idSrc = gridSrc->getId(); + StdString idDest = gridDest->getId(); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + std::ostringstream id; + id << idSrc << "__" << idDest; + return id.str(); + } + CATCH + //---------------------------------------------------------------- - StdSize CGrid::getDimension(void) + CDomainGroup* CGrid::getVirtualDomainGroup() const TRY { - return getGlobalDimension().size(); + return this->vDomainGroup_; } - CATCH_DUMP_ATTR - - //--------------------------------------------------------------- + CATCH - StdSize CGrid::getDataSize(void) + CAxisGroup* CGrid::getVirtualAxisGroup() const TRY { - StdSize retvalue = 1; - if (!isScalarGrid()) - { - std::vector dataNindex = getClientDistribution()->getDataNIndex(); - for (int i = 0; i < dataNindex.size(); ++i) retvalue *= dataNindex[i]; - } - return retvalue; + return this->vAxisGroup_; } CATCH - - /*! - * Get the local data grid size, ie the size of the compressed grid (inside the workflow) - * \return The size od the compressed grid - */ - StdSize CGrid::getLocalDataSize(void) { return getClientDistribution()->getLocalDataSize();} - - /*! - * Compute the minimum buffer size required to send the attributes to the server(s). - * - * \return A map associating the server rank with its minimum buffer size. - * TODO: Refactor code - */ - std::map CGrid::getAttributesBufferSize(CContextClient* client, bool bufferForWriting) + CScalarGroup* CGrid::getVirtualScalarGroup() const TRY { - std::map attributesSizes = getMinimumBufferSizeForAttributes(client); - - // The grid indexes require a similar size as the actual data - std::map dataSizes = getDataBufferSize(client, "", bufferForWriting); - std::map::iterator it, itE = dataSizes.end(); - for (it = dataSizes.begin(); it != itE; ++it) - { - it->second += 2 * sizeof(bool); - if (it->second > attributesSizes[it->first]) - attributesSizes[it->first] = it->second; - } - - // Account for the axis attributes - std::vector axisList = getAxis(); - for (size_t i = 0; i < axisList.size(); ++i) - { - std::map axisAttBuffSize = axisList[i]->getAttributesBufferSize(client, getGlobalDimension(),getAxisPositionInGrid()[i]); - for (it = axisAttBuffSize.begin(), itE = axisAttBuffSize.end(); it != itE; ++it) - { - it->second += 2 * sizeof(bool); - if (it->second > attributesSizes[it->first]) - attributesSizes[it->first] = it->second; - } - } - - // Account for the domain attributes - std::vector domList = getDomains(); - for (size_t i = 0; i < domList.size(); ++i) - { - std::map domAttBuffSize = domList[i]->getAttributesBufferSize(client); - for (it = domAttBuffSize.begin(), itE = domAttBuffSize.end(); it != itE; ++it) - { - it->second += 2 * sizeof(bool); - if (it->second > attributesSizes[it->first]) - attributesSizes[it->first] = it->second; - } - } - - return attributesSizes; - } - CATCH_DUMP_ATTR - - /*! - * Compute the minimum buffer size required to send the data. - * \param client contextClient used to determine the size of connected receivers - * \param id the id used to tag the data - * \param bufferForWriting flag indicating if a buffer is used to send data for writing - * \return A map associating the sender rank with its minimum buffer size. - */ - std::map CGrid::getDataBufferSize(CContextClient* client, const std::string& id /*= ""*/, bool bufferForWriting /*= "false"*/) - TRY - { - // The record index is sometimes sent along with the data but we always - // include it in the size calculation for the sake of simplicity - const size_t extraSize = CEventClient::headerSize + (id.empty() ? getId() : id).size() - + 2 * sizeof(size_t) - + sizeof(size_t); - - std::map dataSizes; - int receiverSize = client->serverSize; - std::map& dataSizeMap = bufferForWriting ? connectedDataSize_[receiverSize]: connectedDataSizeRead_; - std::vector& connectedServerRanks = bufferForWriting ? connectedServerRank_[receiverSize] : connectedServerRankRead_; + return this->vScalarGroup_; + } + CATCH - std::map::const_iterator itEnd = dataSizeMap.end(); - for (size_t k = 0; k < connectedServerRanks.size(); ++k) +/* + void CGrid::outputField(int rank, const CArray& stored, double* field) + { + const CArray& out_i = outIndexFromClient[rank]; + StdSize numElements = stored.numElements(); + for (StdSize n = 0; n < numElements; ++n) { - int rank = connectedServerRanks[k]; - std::map::const_iterator it = dataSizeMap.find(rank); - size_t count = (it != itEnd) ? it->second : 0; - - dataSizes.insert(std::make_pair(rank, extraSize + CArray::size(count))); + field[out_i(n)] = stored(n); } - - return dataSizes; } - CATCH_DUMP_ATTR - size_t CGrid::getGlobalWrittenSize(void) - TRY + void CGrid::inputField(int rank, const double* const field, CArray& stored) { - std::vector domainP = this->getDomains(); - std::vector axisP = this->getAxis(); - - size_t globalGridSize=1 ; - for (std::vector::iterator it=domainP.begin(); it!=domainP.end();++it) globalGridSize*=(*it)->getGlobalWrittenSize() ; - for (std::vector::iterator it=axisP.begin(); it!=axisP.end();++it) globalGridSize*=(*it)->getGlobalWrittenSize() ; - return globalGridSize ; + const CArray& out_i = outIndexFromClient[rank]; + StdSize numElements = stored.numElements(); + for (StdSize n = 0; n < numElements; ++n) + { + stored(n) = field[out_i(n)]; + } } - CATCH_DUMP_ATTR - - void CGrid::computeAxisPositionInGrid(void) + void CGrid::outputCompressedField(int rank, const CArray& stored, double* field) { - axisPositionInGrid_.resize(0); - int idx = 0; - for (int i = 0; i < axis_domain_order.numElements(); ++i) + const CArray& out_i = compressedOutIndexFromClient[rank]; + StdSize numElements = stored.numElements(); + for (StdSize n = 0; n < numElements; ++n) { - int elementDimension = axis_domain_order(i); - if (1 == elementDimension) - { - axisPositionInGrid_.push_back(idx); - ++idx; - } - else if (2 == elementDimension) idx += 2; + field[out_i(n)] = stored(n); } } +*/ + //---------------------------------------------------------------- - - /*! - * Test whether the data defined on the grid can be outputted in a compressed way. - * - * \return true if and only if a mask was defined for this grid - */ - bool CGrid::isCompressible(void) const + void CGrid::storeField_arr(const double* const data, CArray& stored) const TRY { - return isCompressible_; + const StdSize size = storeIndex_client.numElements(); + + stored.resize(size); + for(StdSize i = 0; i < size; i++) stored(i) = data[storeIndex_client(i)]; } CATCH - //--------------------------------------------------------------- - - void CGrid::addRelFileCompressed(const StdString& filename) + void CGrid::restoreField_arr(const CArray& stored, double* const data) const TRY { - this->relFilesCompressed.insert(filename); - } - CATCH_DUMP_ATTR + const StdSize size = storeIndex_client.numElements(); - bool CGrid::isWrittenCompressed(const StdString& filename) const - TRY - { - return (this->relFilesCompressed.find(filename) != this->relFilesCompressed.end()); + for(StdSize i = 0; i < size; i++) data[storeIndex_client(i)] = stored(i); } CATCH - //--------------------------------------------------------------- - /* - Find all reference of grid's components and inherite attributes if necessary - */ - void CGrid::solveDomainAxisRef(bool areAttributesChecked) + void CGrid::maskField_arr(const double* const data, CArray& stored, bool isTiled) const TRY { - if (this->isDomainAxisChecked) return; - - this->solveScalarRef(areAttributesChecked); - this->solveAxisRef(areAttributesChecked); - this->solveDomainRef(areAttributesChecked); - this->isDomainAxisChecked = areAttributesChecked; + const CArray& storeIndex_clientP = isTiled ? storeIndexTiled_client : storeIndex_client; + const CArray& storeMask_clientP = isTiled ? storeMaskTiled_client : storeMask_client; + const StdSize size = storeIndex_clientP.numElements(); + stored.resize(size); + const double nanValue = std::numeric_limits::quiet_NaN(); + + if (storeMask_clientP.numElements() != 0) + for(StdSize i = 0; i < size; i++) stored(i) = (storeMask_clientP(i)) ? data[storeIndex_clientP(i)] : nanValue; + else + for(StdSize i = 0; i < size; i++) stored(i) = data[storeIndex_clientP(i)]; } - CATCH_DUMP_ATTR + CATCH - /* - Go up hierachy reference and fill in the base reference with attributes of the children - This function should be only used after reading component's attributes from file - */ - void CGrid::solveDomainAxisBaseRef() + void CGrid::copyTile_arr(const double* const tileData, CArray& stored, int tileId) TRY { - if (this->hasDomainAxisBaseRef_) return; - // Account for the scalar attributes - std::vector scalarList = getScalars(); - for (size_t i = 0; i < scalarList.size(); ++i) - { - scalarList[i]->setAttributesReference(); - } + StdSize tileSize = this->getTileSize(tileId); + const StdSize tileDataSize = this->getTileDataSize(tileId); - // Account for the axis attributes - std::vector axisList = getAxis(); - for (size_t i = 0; i < axisList.size(); ++i) + // case 1: data correspond in size to a tile + if (tileSize == tileDataSize) { - axisList[i]->setAttributesReference(); + for(StdSize i = 0; i < tileDataSize; i++) + stored(storeTileIndex[tileId](i)) = tileData[i]; } - - // Account for the domain attributes - std::vector domList = getDomains(); - for (size_t i = 0; i < domList.size(); ++i) + // case 2: masked data + else if (tileSize > tileDataSize) { - domList[i]->setAttributesReference(); + int tileDataCount = 0; + for(StdSize i = 0; i < tileSize; i++) + if (storeTileIndex[tileId](i) >= 0) + { + stored(storeTileIndex[tileId](i)) = tileData[tileDataCount]; + ++tileDataCount; + } } + // case 3: ghost zones + else + { + for(StdSize i = 0; i < tileDataSize; i++) + if (storeTileIndex[tileId](i) >= 0) + { + stored(storeTileIndex[tileId](i)) = tileData[i]; + } - this->hasDomainAxisBaseRef_ = true; + } } - CATCH_DUMP_ATTR + CATCH - void CGrid::checkEligibilityForCompressedOutput() + void CGrid::uncompressField_arr(const double* const data, CArray& out) const TRY { - // We don't check if the mask is valid here, just if a mask has been defined at this point. - isCompressible_ = !mask_1d.isEmpty() || !mask_2d.isEmpty() || !mask_3d.isEmpty(); + const std::vector& localMaskedDataIndex = clientDistribution_->getLocalMaskedDataIndexOnClient(); + const int size = localMaskedDataIndex.size(); + for(int i = 0; i < size; ++i) out(localMaskedDataIndex[i]) = data[i]; } - CATCH_DUMP_ATTR + CATCH - //ym obsolete -> to be removed later - void CGrid::checkMaskIndex(bool doSendingIndex) - TRY - { - CContext* context = CContext::getCurrent(); - - if (this->isChecked) return; - this->checkElementsAttributes(); - this->isChecked = true; - } - CATCH_DUMP_ATTR + void CGrid::computeClientIndexScalarGrid() + TRY + { + CContext* context = CContext::getCurrent(); + { + CContextClient* client = context->client; + + int rank = client->clientRank; + + clientDistribution_ = new CDistributionClient(rank, this); + + storeIndex_client.resize(1); + storeIndex_client(0) = 0; + + if (0 != serverDistribution_) + { + map >::iterator itb = outGlobalIndexFromClient.begin(), + ite = outGlobalIndexFromClient.end(), it; + for (it = itb; it != ite; ++it) + { + int rank = it->first; + CArray& globalIndex = outGlobalIndexFromClient[rank]; + outLocalIndexStoreOnClient.insert(make_pair(rank, CArray(globalIndex.numElements()))); + CArray& localIndex = outLocalIndexStoreOnClient[rank]; + if (1 != globalIndex.numElements()) + ERROR("void CGrid::computeClientIndexScalarGrid()", + << "Something wrong happened. " + << "Number of received global index on scalar grid should equal to 1" + << "Number of received global index " << globalIndex.numElements() << "."); + + localIndex(0) = globalIndex(0); + } + } + } + } + CATCH_DUMP_ATTR + + void CGrid::computeConnectedClientsScalarGrid() + TRY + { + CContext* context = CContext::getCurrent(); + int nbSrvPools = (context->clientPrimServer.size()==0) ? 1 : context->clientPrimServer.size(); + connectedServerRank_.clear(); + connectedDataSize_.clear(); + nbSenders.clear(); + + for (int p = 0; p < nbSrvPools; ++p) + { + CContextClient* client = (context->clientPrimServer.size()==0) ? context->client : context->clientPrimServer[p]; + int receiverSize = client->serverSize; + +// connectedServerRank_[client].clear(); + + if (connectedServerRank_.find(receiverSize)==connectedServerRank_.end()) + { + if (client->isServerLeader()) + { + const std::list& ranks = client->getRanksServerLeader(); + for (std::list::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) + { + int rank = *itRank; + int nb = 1; + connectedServerRank_[receiverSize].push_back(rank); + connectedDataSize_[receiverSize][rank] = nb; + nbSenders[receiverSize][rank] = nb; + } + } + else + { + const std::list& ranks = client->getRanksServerNotLeader(); + for (std::list::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) + { + int rank = *itRank; + int nb = 1; + connectedServerRank_[receiverSize].push_back(rank); + connectedDataSize_[receiverSize][rank] = nb; + nbSenders[receiverSize][rank] = nb; + } + } + } + isDataDistributed_ = false; + } + } + CATCH_DUMP_ATTR + + void CGrid::sendIndexScalarGrid() + TRY + { + CContext* context = CContext::getCurrent(); + storeIndex_toSrv.clear(); + std::list::iterator it; + + for (it=clients.begin(); it!=clients.end(); ++it) + { + CContextClient* client = *it; + int receiverSize = client->serverSize; + CEventClient event(getType(), EVENT_ID_INDEX); + list listMsg; + list > listOutIndex; - bool CGrid::hasMask() const - TRY - { - return (!mask_1d.isEmpty() || !mask_2d.isEmpty() || !mask_3d.isEmpty() || - !mask_4d.isEmpty() || !mask_5d.isEmpty() || !mask_6d.isEmpty() || !mask_7d.isEmpty()); - } - CATCH + if (client->isServerLeader()) + { + const std::list& ranks = client->getRanksServerLeader(); + for (std::list::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) + { + int rank = *itRank; + int nb = 1; + storeIndex_toSrv[client].insert(std::make_pair(rank, CArray(nb))); + listOutIndex.push_back(CArray(nb)); - - CArray& CGrid::getMask(void) - { - - if (mask_.isEmpty()) - { - if (!mask_0d.isEmpty()) mask_.reference(CArray(mask_0d.dataFirst(),shape(mask_0d.numElements()), neverDeleteData)) ; - if (!mask_1d.isEmpty()) mask_.reference(CArray(mask_1d.dataFirst(),shape(mask_1d.numElements()), neverDeleteData)) ; - if (!mask_2d.isEmpty()) mask_.reference(CArray(mask_2d.dataFirst(),shape(mask_2d.numElements()), neverDeleteData)) ; - if (!mask_3d.isEmpty()) mask_.reference(CArray(mask_3d.dataFirst(),shape(mask_3d.numElements()), neverDeleteData)) ; - if (!mask_4d.isEmpty()) mask_.reference(CArray(mask_4d.dataFirst(),shape(mask_4d.numElements()), neverDeleteData)) ; - if (!mask_5d.isEmpty()) mask_.reference(CArray(mask_5d.dataFirst(),shape(mask_5d.numElements()), neverDeleteData)) ; - if (!mask_6d.isEmpty()) mask_.reference(CArray(mask_6d.dataFirst(),shape(mask_6d.numElements()), neverDeleteData)) ; - if (!mask_7d.isEmpty()) mask_.reference(CArray(mask_7d.dataFirst(),shape(mask_7d.numElements()), neverDeleteData)) ; - } - return mask_ ; - } + CArray& outLocalIndexToServer = storeIndex_toSrv[client][rank]; + CArray& outGlobalIndexOnServer = listOutIndex.back(); - - //--------------------------------------------------------------- + for (int k = 0; k < nb; ++k) + { + outGlobalIndexOnServer(k) = 0; + outLocalIndexToServer(k) = 0; + } - void CGrid::solveDomainRef(bool sendAtt) - TRY - { - setDomainList(); - std::vector domListP = this->getDomains(); - if (!domListP.empty()) - for (int i = 0; i < domListP.size(); ++i) domListP[i]->checkAttributes(); - } - CATCH_DUMP_ATTR + if (context->hasClient && !context->hasServer) + storeIndex_fromSrv.insert(std::make_pair(rank, CArray(outLocalIndexToServer))); - //--------------------------------------------------------------- + listMsg.push_back(CMessage()); + listMsg.back() << getId( )<< isDataDistributed_ << isCompressible_ << listOutIndex.back(); - void CGrid::solveAxisRef(bool sendAtt) - TRY - { - setAxisList(); - std::vector axisListP = this->getAxis(); - if (!axisListP.empty()) - for (int i = 0; i < axisListP.size(); ++i) axisListP[i]->checkAttributes(); - } - CATCH_DUMP_ATTR + event.push(rank, 1, listMsg.back()); + } + client->sendEvent(event); + } + else + { + const std::list& ranks = client->getRanksServerNotLeader(); + for (std::list::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) + { + int rank = *itRank; + int nb = 1; + CArray outLocalIndexToServer(nb); + for (int k = 0; k < nb; ++k) + { + outLocalIndexToServer(k) = 0; + } - //--------------------------------------------------------------- + if (context->hasClient && !context->hasServer) + storeIndex_fromSrv.insert(std::make_pair(rank, CArray(outLocalIndexToServer))); + } + client->sendEvent(event); + } + } + } + CATCH_DUMP_ATTR - void CGrid::solveScalarRef(bool sendAtt) - TRY - { - setScalarList(); - std::vector scalarListP = this->getScalars(); - if (!scalarListP.empty()) - for (int i = 0; i < scalarListP.size(); ++i) scalarListP[i]->checkAttributes() ; - } - CATCH_DUMP_ATTR + void CGrid::sendIndex(void) + TRY + { + CContext* context = CContext::getCurrent(); + storeIndex_toSrv.clear(); + std::list::iterator it; + for (it=clients.begin(); it!=clients.end(); ++it) + { + CContextClient* client = *it; + int receiverSize = client->serverSize; + + CEventClient event(getType(), EVENT_ID_INDEX); + int rank; + list listMsg; + list > listOutIndex; + const CDistributionClient::GlobalLocalDataMap& globalLocalIndexSendToServer = clientDistribution_->getGlobalLocalDataSendToServer(); + CDistributionClient::GlobalLocalDataMap::const_iterator itbIndex = globalLocalIndexSendToServer.begin(), itIndex, + iteIndex = globalLocalIndexSendToServer.end(); + itIndex = itbIndex; + + if (!doGridHaveDataDistributed(client)) + { + if (client->isServerLeader()) + { + int indexSize = globalLocalIndexSendToServer.size(); + CArray outGlobalIndexOnServer(indexSize); + CArray outLocalIndexToServer(indexSize); + for (int idx = 0; itIndex != iteIndex; ++itIndex, ++idx) + { + outGlobalIndexOnServer(idx) = itIndex->first; + outLocalIndexToServer(idx) = itIndex->second; + } - //--------------------------------------------------------------- - CDistributionClient* CGrid::getClientDistribution() - TRY - { - if (!computeClientDistribution_done_) computeClientDistribution() ; - return clientDistribution_; - } - CATCH_DUMP_ATTR - - void CGrid::computeClientDistribution(void) - { - if (computeClientDistribution_done_) return ; - else computeClientDistribution_done_ = true ; + const std::list& ranks = client->getRanksServerLeader(); + for (std::list::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) + { + storeIndex_toSrv[client].insert(std::make_pair(*itRank, CArray(outLocalIndexToServer))); + if (context->hasClient && !context->hasServer) + storeIndex_fromSrv.insert(std::make_pair(*itRank, CArray(outLocalIndexToServer))); + + listOutIndex.push_back(CArray(outGlobalIndexOnServer)); - CContext* context = CContext::getCurrent(); - int rank = context-> getIntraCommRank(); - clientDistribution_ = new CDistributionClient(rank, this); - } + listMsg.push_back(CMessage()); + listMsg.back() << getId() << isDataDistributed_ << isCompressible_ << listOutIndex.back(); + event.push(*itRank, 1, listMsg.back()); + } + client->sendEvent(event); + } + else + { + int indexSize = globalLocalIndexSendToServer.size(); + CArray outLocalIndexToServer(indexSize); + for (int idx = 0; itIndex != iteIndex; ++itIndex, ++idx) + { + outLocalIndexToServer(idx) = itIndex->second; + } + + const std::list& ranks = client->getRanksServerNotLeader(); + for (std::list::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) + { + storeIndex_fromSrv.insert(std::make_pair(*itRank, CArray(outLocalIndexToServer))); + } + client->sendEvent(event); + } + } + else + { + CClientServerMapping::GlobalIndexMap::const_iterator iteGlobalMap, itGlobalMap; + itGlobalMap = globalIndexOnServer_[receiverSize].begin(); + iteGlobalMap = globalIndexOnServer_[receiverSize].end(); - bool CGrid::isDataDistributed(void) - { - return getClientDistribution()->isDataDistributed() ; - } + std::map >localIndexTmp; + std::map > globalIndexTmp; + for (; itGlobalMap != iteGlobalMap; ++itGlobalMap) + { + int serverRank = itGlobalMap->first; + int indexSize = itGlobalMap->second.size(); + const std::vector& indexVec = itGlobalMap->second; + for (int idx = 0; idx < indexSize; ++idx) + { + itIndex = globalLocalIndexSendToServer.find(indexVec[idx]); + if (iteIndex != itIndex) + { + globalIndexTmp[serverRank].push_back(itIndex->first); + localIndexTmp[serverRank].push_back(itIndex->second); + } + } + } - + for (int ns = 0; ns < connectedServerRank_[receiverSize].size(); ++ns) + { + rank = connectedServerRank_[receiverSize][ns]; + int nb = 0; + if (globalIndexTmp.end() != globalIndexTmp.find(rank)) + nb = globalIndexTmp[rank].size(); - CGrid* CGrid::cloneGrid(const StdString& idNewGrid, CGrid* gridSrc) - TRY - { - std::vector domainSrcTmp = gridSrc->getDomains(), domainSrc; - std::vector axisSrcTmp = gridSrc->getAxis(), axisSrc; - std::vector scalarSrcTmp = gridSrc->getScalars(), scalarSrc; + storeIndex_toSrv[client].insert(make_pair(rank, CArray(nb))); + listOutIndex.push_back(CArray(nb)); - for (int idx = 0; idx < domainSrcTmp.size(); ++idx) - { - CDomain* domain = CDomain::createDomain(); - domain->duplicateAttributes(domainSrcTmp[idx]); - domain->duplicateTransformation(domainSrcTmp[idx]); - domain->solveRefInheritance(true); - domain->solveInheritanceTransformation(); - domainSrc.push_back(domain); - } + CArray& outLocalIndexToServer = storeIndex_toSrv[client][rank]; + CArray& outGlobalIndexOnServer = listOutIndex.back(); - for (int idx = 0; idx < axisSrcTmp.size(); ++idx) - { - CAxis* axis = CAxis::createAxis(); - axis->duplicateAttributes(axisSrcTmp[idx]); - axis->duplicateTransformation(axisSrcTmp[idx]); - axis->solveRefInheritance(true); - axis->solveInheritanceTransformation(); - axisSrc.push_back(axis); - } + for (int k = 0; k < nb; ++k) + { + outGlobalIndexOnServer(k) = globalIndexTmp[rank].at(k); + outLocalIndexToServer(k) = localIndexTmp[rank].at(k); + } - for (int idx = 0; idx < scalarSrcTmp.size(); ++idx) - { - CScalar* scalar = CScalar::createScalar(); - scalar->duplicateAttributes(scalarSrcTmp[idx]); - scalar->duplicateTransformation(scalarSrcTmp[idx]); - scalar->solveRefInheritance(true); - scalar->solveInheritanceTransformation(); - scalarSrc.push_back(scalar); - } + storeIndex_fromSrv.insert(make_pair(rank, CArray(outLocalIndexToServer))); + listMsg.push_back(CMessage()); + listMsg.back() << getId() << isDataDistributed_ << isCompressible_ << listOutIndex.back(); - CGrid* grid = CGrid::createGrid(idNewGrid, domainSrc, axisSrc, scalarSrc, gridSrc->axis_domain_order); + event.push(rank, nbSenders[receiverSize][rank], listMsg.back()); + } - return grid; - } - CATCH + client->sendEvent(event); + } + } + } + CATCH_DUMP_ATTR - StdString CGrid::generateId(const std::vector& domains, const std::vector& axis, - const std::vector& scalars, const CArray& axisDomainOrder) - TRY - { - if (axisDomainOrder.numElements() > 0 && axisDomainOrder.numElements() != (domains.size() + axis.size() + scalars.size())) - ERROR("CGrid* CGrid::generateId(...)", - << "The size of axisDomainOrder (" << axisDomainOrder.numElements() - << ") is not coherent with the number of elements (" << domains.size() + axis.size() <<")."); + void CGrid::recvIndex(CEventServer& event) + TRY + { + string gridId; + vector ranks; + vector buffers; - std::ostringstream id; + list::iterator it; + for (it = event.subEvents.begin(); it != event.subEvents.end(); ++it) + { + ranks.push_back(it->rank); + CBufferIn* buffer = it->buffer; + *buffer >> gridId; + buffers.push_back(buffer); + } + get(gridId)->recvIndex(ranks, buffers); + } + CATCH - if (domains.empty() && axis.empty() && !scalars.empty()) - id << "__scalar_"; + void CGrid::recvIndex(vector ranks, vector buffers) + TRY + { + CContext* context = CContext::getCurrent(); + connectedServerRankRead_ = ranks; - if (0 != (domains.size() + axis.size() + scalars.size())) + int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 1) : 1; + nbSrvPools = 1; + nbReadSenders.clear(); + for (int p = 0; p < nbSrvPools; ++p) + { + CContextServer* server = (!context->hasClient) ? context->server : context->serverPrimServer[p]; + CContextClient* client = context->client; //(!context->hasClient) ? context->client : context->clientPrimServer[p]; + + int idx = 0, numElement = axis_domain_order.numElements(); + int ssize = numElement; + std::vector indexMap(numElement); + for (int i = 0; i < numElement; ++i) { - id << "__grid"; - - if (0 == axisDomainOrder.numElements()) + indexMap[i] = idx; + if (2 == axis_domain_order(i)) { - for (size_t i = 0; i < domains.size(); ++i) id << "_" << domains[i]->getId(); - for (size_t i = 0; i < axis.size(); ++i) id << "_" << axis[i]->getId(); - for (size_t i = 0; i < scalars.size(); ++i) id << "_" << scalars[i]->getId(); + ++ssize; + idx += 2; } else + ++idx; + } + + for (int n = 0; n < ranks.size(); n++) + { + int rank = ranks[n]; + CBufferIn& buffer = *buffers[n]; + + buffer >> isDataDistributed_ >> isCompressible_; + size_t dataSize = 0; + + if (0 == serverDistribution_) { - size_t iDomain = 0, iAxis = 0, iScalar = 0; - for (size_t i = 0; i < axisDomainOrder.numElements(); ++i) + int axisId = 0, domainId = 0, scalarId = 0, globalSize = 1; + std::vector domainList = getDomains(); + std::vector axisList = getAxis(); + std::vector nBegin(ssize), nSize(ssize), nGlob(ssize), nBeginGlobal(ssize), nGlobElement(numElement); + std::vector > globalIndex(numElement); + for (int i = 0; i < numElement; ++i) { - if (2 == axisDomainOrder(i)) - id << "_" << domains[iDomain++]->getId(); - else if (1 == axisDomainOrder(i)) - id << "_" << axis[iAxis++]->getId(); - else - id << "_" << scalars[iScalar++]->getId(); + nGlobElement[i] = globalSize; + if (2 == axis_domain_order(i)) //domain + { + nBegin[indexMap[i]] = domainList[domainId]->ibegin; + nSize[indexMap[i]] = domainList[domainId]->ni; + nBeginGlobal[indexMap[i]] = 0; + nGlob[indexMap[i]] = domainList[domainId]->ni_glo; + + nBegin[indexMap[i] + 1] = domainList[domainId]->jbegin; + nSize[indexMap[i] + 1] = domainList[domainId]->nj; + nBeginGlobal[indexMap[i] + 1] = 0; + nGlob[indexMap[i] + 1] = domainList[domainId]->nj_glo; + + { + int count = 0; + globalIndex[i].resize(nSize[indexMap[i]]*nSize[indexMap[i]+1]); + for (int jdx = 0; jdx < nSize[indexMap[i]+1]; ++jdx) + for (int idx = 0; idx < nSize[indexMap[i]]; ++idx) + { + globalIndex[i](count) = (nBegin[indexMap[i]] + idx) + (nBegin[indexMap[i]+1] + jdx) * nGlob[indexMap[i]]; + ++count; + } + } + + ++domainId; + } + else if (1 == axis_domain_order(i)) // axis + { + nBegin[indexMap[i]] = axisList[axisId]->begin; + nSize[indexMap[i]] = axisList[axisId]->n; + nBeginGlobal[indexMap[i]] = 0; + nGlob[indexMap[i]] = axisList[axisId]->n_glo; + globalIndex[i].resize(nSize[indexMap[i]]); + for (int idx = 0; idx < nSize[indexMap[i]]; ++idx) + globalIndex[i](idx) = nBegin[indexMap[i]] + idx; + + ++axisId; + } + else // scalar + { + nBegin[indexMap[i]] = 0; + nSize[indexMap[i]] = 1; + nBeginGlobal[indexMap[i]] = 0; + nGlob[indexMap[i]] = 1; + globalIndex[i].resize(1); + globalIndex[i](0) = 0; + ++scalarId; + } } + dataSize = 1; + + for (int i = 0; i < nSize.size(); ++i) + dataSize *= nSize[i]; + serverDistribution_ = new CDistributionServer(server->intraCommRank, + globalIndex, axis_domain_order, + nBegin, nSize, nBeginGlobal, nGlob); } - id << "__"; + CArray outIndex; + buffer >> outIndex; + outGlobalIndexFromClient.insert(std::make_pair(rank, outIndex)); + connectedDataSizeRead_[rank] = outIndex.numElements(); + + if (doGridHaveDataDistributed(client)) + {} + else + { + // THE PROBLEM HERE IS THAT DATA CAN BE NONDISTRIBUTED ON CLIENT AND DISTRIBUTED ON SERVER + // BELOW IS THE TEMPORARY FIX only for a single type of element (domain, asix, scalar) + dataSize = serverDistribution_->getGridSize(); + } + writtenDataSize_ += dataSize; } - return id.str(); - } - CATCH - StdString CGrid::generateId(const CGrid* gridSrc, const CGrid* gridDest) - TRY - { - StdString idSrc = gridSrc->getId(); - StdString idDest = gridDest->getId(); + // Compute mask of the current grid + { + int axisId = 0, domainId = 0, scalarId = 0, globalSize = 1; + std::vector domainList = getDomains(); + std::vector axisList = getAxis(); + int dimSize = 2 * domainList.size() + axisList.size(); + std::vector nBegin(dimSize), nSize(dimSize), nGlob(dimSize), nBeginGlobal(dimSize); + for (int i = 0; i < numElement; ++i) + { + if (2 == axis_domain_order(i)) //domain + { + nBegin[indexMap[i]] = domainList[domainId]->ibegin; + nSize[indexMap[i]] = domainList[domainId]->ni; + nBeginGlobal[indexMap[i]] = 0; + nGlob[indexMap[i]] = domainList[domainId]->ni_glo; - std::ostringstream id; - id << idSrc << "__" << idDest; + nBegin[indexMap[i] + 1] = domainList[domainId]->jbegin; + nSize[indexMap[i] + 1] = domainList[domainId]->nj; + nBeginGlobal[indexMap[i] + 1] = 0; + nGlob[indexMap[i] + 1] = domainList[domainId]->nj_glo; - return id.str(); - } - CATCH + ++domainId; + } + else if (1 == axis_domain_order(i)) // axis + { + nBegin[indexMap[i]] = axisList[axisId]->begin; + nSize[indexMap[i]] = axisList[axisId]->n; + nBeginGlobal[indexMap[i]] = 0; + nGlob[indexMap[i]] = axisList[axisId]->n_glo; + ++axisId; + } + else // scalar + { + } + } + + if (nSize.empty()) // Scalar grid + { + nBegin.push_back(0); + nSize.push_back(1); + nBeginGlobal.push_back(0); + nGlob.push_back(1); + } + } + if (isScalarGrid()) return; - //---------------------------------------------------------------- + nbReadSenders[client] = CClientServerMappingDistributed::computeConnectedClients(context->client->serverSize, context->client->clientSize, context->client->intraComm, ranks); + } + } + CATCH_DUMP_ATTR - - - /* Compute on the fly the global dimension of a grid with its elements \param[in/out] globalDim global dimension of grid @@ -1363,24 +2243,80 @@ namespace xios bool CGrid::doGridHaveDataToWrite() TRY { - return (0 != getGridLocalElements()->getView(CElementView::FULL)->getSize()); + return (0 != writtenDataSize_); + } + CATCH_DUMP_ATTR + + /*! + Return size of data which is written on each server + Whatever dimension of a grid, data which are written on server must be presented as + an one dimension array. + \return size of data written on server + */ + size_t CGrid::getWrittenDataSize() const + TRY + { + return writtenDataSize_; + } + CATCH + + /*! + Returns the number of indexes written by each server. + \return the number of indexes written by each server + */ + int CGrid::getNumberWrittenIndexes() const + TRY + { + return numberWrittenIndexes_; + } + CATCH + + /*! + Returns the total number of indexes written by the servers. + \return the total number of indexes written by the servers + */ + int CGrid::getTotalNumberWrittenIndexes() const + TRY + { + return totalNumberWrittenIndexes_; + } + CATCH + + /*! + Returns the offset of indexes written by each server. + \return the offset of indexes written by each server + */ + int CGrid::getOffsetWrittenIndexes() const + TRY + { + return offsetWrittenIndexes_; + } + CATCH + + CDistributionServer* CGrid::getDistributionServer() + TRY + { + return serverDistribution_; + } + CATCH_DUMP_ATTR + + CDistributionClient* CGrid::getDistributionClient() + TRY + { + return clientDistribution_; } CATCH_DUMP_ATTR - bool CGrid::doGridHaveDataDistributed(CContextClient* client) TRY { - // This function is now useless because it will return false only if server and client size are equal to 1 - // to be seriously check in future - if (isScalarGrid()) return false; else if (0 != client) { - return (isDataDistributed() || (1 != client->clientSize) || (1 != client->serverSize)); + return (isDataDistributed_ || (1 != client->clientSize) || (1 != client->serverSize)); } else - return isDataDistributed(); + return isDataDistributed_; } CATCH_DUMP_ATTR @@ -1400,6 +2336,11 @@ namespace xios { switch(event.type) { + case EVENT_ID_INDEX : + recvIndex(event); + return true; + break; + case EVENT_ID_ADD_DOMAIN : recvAddDomain(event); return true; @@ -1414,13 +2355,8 @@ namespace xios recvAddScalar(event); return true; break; - - case EVENT_ID_SEND_MASK : - recvMask(event); - return true; - break; default : - ERROR("bool CGrid::dispatchEvent(CEventServer& event)", + ERROR("bool CDomain::dispatchEvent(CEventServer& event)", << "Unknown Event"); return false; } @@ -1428,908 +2364,653 @@ namespace xios } CATCH - + ///--------------------------------------------------------------- - void CGrid::sendGridToFileServer(CContextClient* client) - { - if (sendGridToFileServer_done_.count(client)!=0) return ; - else sendGridToFileServer_done_.insert(client) ; - - StdString gridDefRoot("grid_definition"); - CGridGroup* gridPtr = CGridGroup::get(gridDefRoot); - gridPtr->sendCreateChild(this->getId(),client); - this->sendAllAttributesToServer(client); - distributeGridToServer(client) ; - } + CDomain* CGrid::addDomain(const std::string& id) + TRY + { + order_.push_back(2); + axis_domain_order.resize(order_.size()); + for (int idx = 0; idx < order_.size(); ++idx) axis_domain_order(idx)=order_[idx]; + return vDomainGroup_->createChild(id); + } + CATCH_DUMP_ATTR + + CAxis* CGrid::addAxis(const std::string& id) + TRY + { + order_.push_back(1); + axis_domain_order.resize(order_.size()); + for (int idx = 0; idx < order_.size(); ++idx) axis_domain_order(idx)=order_[idx]; + return vAxisGroup_->createChild(id); + } + CATCH_DUMP_ATTR + + CScalar* CGrid::addScalar(const std::string& id) + TRY + { + order_.push_back(0); + axis_domain_order.resize(order_.size()); + for (int idx = 0; idx < order_.size(); ++idx) axis_domain_order(idx)=order_[idx]; + return vScalarGroup_->createChild(id); + } + CATCH_DUMP_ATTR + + //! Change virtual field group to a new one + void CGrid::setVirtualDomainGroup(CDomainGroup* newVDomainGroup) + TRY + { + this->vDomainGroup_ = newVDomainGroup; + } + CATCH_DUMP_ATTR + + //! Change virtual variable group to new one + void CGrid::setVirtualAxisGroup(CAxisGroup* newVAxisGroup) + TRY + { + this->vAxisGroup_ = newVAxisGroup; + } + CATCH_DUMP_ATTR + //! Change virtual variable group to new one + void CGrid::setVirtualScalarGroup(CScalarGroup* newVScalarGroup) + TRY + { + this->vScalarGroup_ = newVScalarGroup; + } + CATCH_DUMP_ATTR - void CGrid::sendGridToCouplerOut(CContextClient* client, const string& fieldId) + /*! + \brief Send a message to create a domain on server side + \param[in] id String identity of domain that will be created on server + */ + void CGrid::sendAddDomain(const string& id) + TRY { - if (sendGridToCouplerOut_done_.count(client)!=0) return ; - else sendGridToCouplerOut_done_.insert(client) ; - this->sendAllAttributesToServer(client, getCouplingAlias(fieldId)); - distributeGridToServer(client, fieldId) ; - } + sendAddItem(id, (int)EVENT_ID_ADD_DOMAIN); + } + CATCH_DUMP_ATTR + + /*! + \brief Send a message to create an axis on server side + \param[in] id String identity of axis that will be created on server + */ + void CGrid::sendAddAxis(const string& id) + TRY + { + sendAddItem(id, (int)EVENT_ID_ADD_AXIS); + } + CATCH_DUMP_ATTR + + /*! + \brief Send a message to create a scalar on server side + \param[in] id String identity of scalar that will be created on server + */ + void CGrid::sendAddScalar(const string& id) + TRY + { + sendAddItem(id, (int)EVENT_ID_ADD_SCALAR); + } + CATCH_DUMP_ATTR + + /*! + \brief Receive a message annoucing the creation of a domain on server side + \param[in] event Received event + */ + void CGrid::recvAddDomain(CEventServer& event) + TRY + { + + CBufferIn* buffer = event.subEvents.begin()->buffer; + string id; + *buffer >> id; + get(id)->recvAddDomain(*buffer); + } + CATCH + + /*! + \brief Receive a message annoucing the creation of a domain on server side + \param[in] buffer Buffer containing message + */ + void CGrid::recvAddDomain(CBufferIn& buffer) + TRY + { + string id; + buffer >> id; + addDomain(id); + } + CATCH_DUMP_ATTR + + /*! + \brief Receive a message annoucing the creation of an axis on server side + \param[in] event Received event + */ + void CGrid::recvAddAxis(CEventServer& event) + TRY + { + + CBufferIn* buffer = event.subEvents.begin()->buffer; + string id; + *buffer >> id; + get(id)->recvAddAxis(*buffer); + } + CATCH + /*! + \brief Receive a message annoucing the creation of an axis on server side + \param[in] buffer Buffer containing message + */ + void CGrid::recvAddAxis(CBufferIn& buffer) + TRY + { + string id; + buffer >> id; + addAxis(id); + } + CATCH_DUMP_ATTR + + /*! + \brief Receive a message annoucing the creation of an scalar on server side + \param[in] event Received event + */ + void CGrid::recvAddScalar(CEventServer& event) + TRY + { + + CBufferIn* buffer = event.subEvents.begin()->buffer; + string id; + *buffer >> id; + get(id)->recvAddScalar(*buffer); + } + CATCH + + /*! + \brief Receive a message annoucing the creation of an scalar on server side + \param[in] buffer Buffer containing message + */ + void CGrid::recvAddScalar(CBufferIn& buffer) + TRY + { + string id; + buffer >> id; + addScalar(id); + } + CATCH_DUMP_ATTR - void CGrid::distributeGridToServer(CContextClient* client, const string& fieldId) + /*! + \brief Solve domain and axis references + As field, domain and axis can refer to other domains or axis. In order to inherit correctly + all attributes from their parents, they should be processed with this function + \param[in] apply inherit all attributes of parents (true) + */ + void CGrid::solveDomainAxisRefInheritance(bool apply) + TRY { CContext* context = CContext::getCurrent(); - bool isCoupling = !fieldId.empty() ; - // simple Distribution for now - // distribute over the fisrt element except if it is a scalar - auto& elements = getElements() ; - int posDistributed = 0 ; - for(auto& element : elements) - { - if (element.type==TYPE_DOMAIN) break ; - else if (element.type==TYPE_AXIS) break ; - else if (element.type==TYPE_SCALAR) posDistributed++ ; - } - if (posDistributed==elements.size()) posDistributed=0 ; // grid composed only of scalar - - vector> localViews ; - vector> workflowView ; - vector> remoteViews ; - - for(int i=0 ; i::iterator it, itE; + setDomainList(); + it = domList_.begin(); itE = domList_.end(); + for (; it != itE; ++it) { - if (elements[i].type==TYPE_DOMAIN) - { - CDomain* domain = (CDomain*) elements[i].ptr ; - domain->computeRemoteElement(client, posDistributed==i ? EDistributionType::BANDS : EDistributionType::NONE) ; - remoteViews.push_back(domain->getRemoteElement(client)->getView(CElementView::FULL)) ; - localViews.push_back(domain->getLocalView(CElementView::FULL)) ; - workflowView.push_back(domain->getLocalView(CElementView::WORKFLOW)) ; - } - else if (elements[i].type==TYPE_AXIS) - { - CAxis* axis = (CAxis*) elements[i].ptr ; - axis->computeRemoteElement(client, posDistributed==i ? EDistributionType::BANDS : EDistributionType::NONE) ; - remoteViews.push_back(axis->getRemoteElement(client)->getView(CElementView::FULL)) ; - localViews.push_back(axis->getLocalView(CElementView::FULL)) ; - workflowView.push_back(axis->getLocalView(CElementView::WORKFLOW)) ; - } - else if (elements[i].type==TYPE_SCALAR) + CDomain* pDom = CDomain::get(*it); + if (context->hasClient && !context->hasServer) { - CScalar* scalar = (CScalar*) elements[i].ptr ; - scalar->computeRemoteElement(client, posDistributed==i ? EDistributionType::ROOT : EDistributionType::NONE) ; - remoteViews.push_back(scalar->getRemoteElement(client)->getView(CElementView::FULL)) ; - localViews.push_back(scalar->getLocalView(CElementView::FULL)) ; - workflowView.push_back(scalar->getLocalView(CElementView::WORKFLOW)) ; + pDom->solveRefInheritance(apply); + pDom->solveInheritanceTransformation(); + if (!pDom->ntiles.isEmpty() && pDom->ntiles.getValue()>0) nTiles_=pDom->ntiles.getValue(); } } - - // CGridClientServerRemoteConnector : workflowView is added to avoid spurious optimisation with only the fullview - auto gridRemoteConnector = make_shared(localViews, workflowView, remoteViews, context->getIntraComm(), client->getRemoteSize()) ; - gridRemoteConnector->computeConnector(true) ; - - auto gridRemoteConnectorIn = make_shared(localViews, workflowView, remoteViews, context->getIntraComm(), client->getRemoteSize()) ; - gridRemoteConnectorIn->computeConnector(false) ; - - vector> scattererConnectors ; - shared_ptr scattererConnector; - for(int i=0 ; idistributeToServer(client, gridRemoteConnector->getDistributedGlobalIndex(i), gridRemoteConnectorIn->getDistributedGlobalIndex(i), - scattererConnector, domain->getCouplingAlias(fieldId,i)) ; - else - { - sendAddDomain(domain->getId(),client) ; - domain->distributeToServer(client, gridRemoteConnector->getDistributedGlobalIndex(i), gridRemoteConnectorIn->getDistributedGlobalIndex(i), scattererConnector) ; - } - scattererConnectors.push_back(scattererConnector) ; - } - else if (elements[i].type==TYPE_AXIS) - { - CAxis* axis = (CAxis*) elements[i].ptr ; - if (isCoupling) axis->distributeToServer(client, gridRemoteConnector->getDistributedGlobalIndex(i), gridRemoteConnectorIn->getDistributedGlobalIndex(i), - scattererConnector, axis->getCouplingAlias(fieldId,i)) ; - else - { - sendAddAxis(axis->getId(),client) ; - axis->distributeToServer(client, gridRemoteConnector->getDistributedGlobalIndex(i), gridRemoteConnectorIn->getDistributedGlobalIndex(i), scattererConnector) ; - } - scattererConnectors.push_back(scattererConnector) ; - } - else if (elements[i].type==TYPE_SCALAR) + CAxis* pAxis = CAxis::get(*it); + if (context->hasClient && !context->hasServer) { - CScalar* scalar = (CScalar*) elements[i].ptr ; - if (isCoupling) scalar->distributeToServer(client, gridRemoteConnector->getDistributedGlobalIndex(i), gridRemoteConnectorIn->getDistributedGlobalIndex(i), - scattererConnector, scalar->getCouplingAlias(fieldId,i)) ; - else - { - sendAddScalar(scalar->getId(),client) ; - scalar->distributeToServer(client, gridRemoteConnector->getDistributedGlobalIndex(i), gridRemoteConnectorIn->getDistributedGlobalIndex(i), scattererConnector) ; - } - scattererConnectors.push_back(scattererConnector) ; + pAxis->solveRefInheritance(apply); + pAxis->solveInheritanceTransformation(); } } - auto gridScattererConnector = make_shared(scattererConnectors) ; - shared_ptr workflowToFull = getGridLocalElements()->getConnector(CElementView::WORKFLOW, CElementView::FULL) ; - CArray maskIn(workflowToFull->getSrcSize()) ; - CArray maskOut(workflowToFull->getDstSize()) ; - maskIn = true ; - workflowToFull->transfer(maskIn,maskOut,false) ; - - CEventClient event(getType(), EVENT_ID_SEND_MASK); - CMessage message ; - if (isCoupling) message<transfer(maskOut, client, event, message) ; - - vector> clientToServerConnectors ; - vector> clientFromServerConnectors ; - for(auto& element : elements) + setScalarList(); + it = scalarList_.begin(); itE = scalarList_.end(); + for (; it != itE; ++it) { - if (element.type==TYPE_DOMAIN) - { - clientToServerConnectors.push_back(element.domain->getClientToServerConnector(client)) ; - clientFromServerConnectors.push_back(element.domain->getClientFromServerConnector(client)) ; - } - else if (element.type==TYPE_AXIS) - { - clientToServerConnectors.push_back(element.axis->getClientToServerConnector(client)) ; - clientFromServerConnectors.push_back(element.axis->getClientFromServerConnector(client)) ; - - } - else if (element.type==TYPE_SCALAR) + CScalar* pScalar = CScalar::get(*it); + if (context->hasClient && !context->hasServer) { - clientToServerConnectors.push_back(element.scalar->getClientToServerConnector(client)) ; - clientFromServerConnectors.push_back(element.scalar->getClientFromServerConnector(client)) ; + pScalar->solveRefInheritance(apply); + pScalar->solveInheritanceTransformation(); } } - - // compute the grid clientToServerConnector to send flux from client to servers - clientToServerConnector_[client] = make_shared(clientToServerConnectors) ; - clientFromServerConnector_[client] = make_shared(clientFromServerConnectors) ; + } + CATCH_DUMP_ATTR + + int CGrid::getNTiles() + TRY + { + return nTiles_; + } + CATCH_DUMP_ATTR + + bool CGrid::isTiled(void) const + TRY + { + return isTiled_; + } + CATCH + bool CGrid::isTiledOnly(void) const + TRY + { + return isTiledOnly_; } + CATCH + bool CGrid::isTransformed() + TRY + { + return isTransformed_; + } + CATCH_DUMP_ATTR - void CGrid::recvMask(CEventServer& event) + void CGrid::setTransformed() + TRY { - string gridId; - for (auto& subEvent : event.subEvents) (*subEvent.buffer) >> gridId ; - get(gridId)->receiveMask(event); + isTransformed_ = true; } - - void CGrid::receiveMask(CEventServer& event) + CATCH_DUMP_ATTR + + CGridTransformation* CGrid::getTransformations() + TRY + { + return transformations_; + } + CATCH_DUMP_ATTR + + void CGrid::addTransGridSource(CGrid* gridSrc) + TRY { - vector> gathererConnectors ; - vector> fullViews ; + if (gridSrc_.end() == gridSrc_.find(gridSrc)) + gridSrc_.insert(make_pair(gridSrc,make_pair(false,""))); + } + CATCH_DUMP_ATTR + + std::map >& CGrid::getTransGridSource() + TRY + { + return gridSrc_; + } + CATCH_DUMP_ATTR - for(auto& element : getElements()) + /*! + Complete all the necessary (and lacking) attributes of a grid + This function is similar to gridTransformation but works only (till now) on generate_rectilinear_domain transformation + */ + void CGrid::completeGrid(CGrid* transformGridSrc) + TRY + { + if (0 != transformGridSrc) { - if (element.type==TYPE_DOMAIN) - { - gathererConnectors.push_back(element.domain->getGathererConnector()); - fullViews.push_back(element.domain->getLocalElement()->getView(CElementView::FULL)); - - } - else if (element.type==TYPE_AXIS) - { - gathererConnectors.push_back(element.axis->getGathererConnector()); - fullViews.push_back(element.axis->getLocalElement()->getView(CElementView::FULL)); - } - else if (element.type==TYPE_SCALAR) + if (axis_domain_order.numElements() != transformGridSrc->axis_domain_order.numElements()) { - gathererConnectors.push_back(element.scalar->getGathererConnector()); - fullViews.push_back(element.scalar->getLocalElement()->getView(CElementView::FULL)); + ERROR("CGrid::completeGrid(CGrid* transformGridSrc)", + << "Two grids have different number of elements. " << std::endl + << "Number of element of grid destination " << this->getId() << " is " << axis_domain_order.numElements() << std::endl + << "Number of element of grid source " << transformGridSrc->getId() << " is " << transformGridSrc->axis_domain_order.numElements()); } } - auto gridGathererConnector = make_shared(gathererConnectors) ; - auto gridMaskConnector = make_shared(fullViews) ; - CArray maskOut ; - gridGathererConnector->transfer_or(event,maskOut) ; - gridMaskConnector->computeConnector(maskOut) ; + if (isGenerated()) return; + setGenerated(); - CContextClient* client = event.getContextServer()->getAssociatedClient() ; - int i=0 ; - for(auto& element : getElements()) - { - if (element.type==TYPE_DOMAIN) element.domain->setServerMask(gridMaskConnector->getElementMask(i),client); - else if (element.type==TYPE_AXIS) element.axis->setServerMask(gridMaskConnector->getElementMask(i),client); - else if (element.type==TYPE_SCALAR) element.scalar->setServerMask(gridMaskConnector->getElementMask(i),client); - i++ ; - } + CGridGenerate gridGenerate(this, transformGridSrc); + gridGenerate.completeGrid(); + } + CATCH_DUMP_ATTR + + bool CGrid::isGenerated() + TRY + { + return isGenerated_; } + CATCH - string CGrid::getCouplingAlias(const string& fieldId) + void CGrid::setGenerated() + TRY { - return "_grid_of_"+fieldId; + isGenerated_ = true; } + CATCH_DUMP_ATTR - void CGrid::makeAliasForCoupling(const string& fieldId) + void CGrid::transformGrid(CGrid* transformGridSrc) + TRY { - string gridId=getCouplingAlias(fieldId) ; - createAlias(gridId) ; + if (!transformGridSrc) + ERROR("CGrid::transformGrid(CGrid* transformGridSrc)", + << "Impossible to transform grid '" << getId() << "', the source grid is null."); - auto& elements = getElements() ; - for(int i=0 ; iaxis_domain_order.numElements()) + { + ERROR("CGrid::transformGrid(CGrid* transformGridSrc)", + << "Two grids have different number of elements. " << std::endl + << "Number of element of grid destination " << this->getId() << " is " << axis_domain_order.numElements() << std::endl + << "Number of element of grid source " << transformGridSrc->getId() << " is " << transformGridSrc->axis_domain_order.numElements()); + } + else { - if (elements[i].type==TYPE_DOMAIN) elements[i].domain->makeAliasForCoupling(fieldId, i); - else if (elements[i].type==TYPE_AXIS) elements[i].axis->makeAliasForCoupling(fieldId, i); - else if (elements[i].type==TYPE_SCALAR) elements[i].scalar->makeAliasForCoupling(fieldId, i); } - } - - /*! - \brief Send a message to create a domain on server side - \param[in] id String identity of domain that will be created on server - */ - void CGrid::sendAddDomain(const string& id, CContextClient* contextClient) - TRY - { - sendAddItem(id, (int)EVENT_ID_ADD_DOMAIN, contextClient); - } - CATCH_DUMP_ATTR - /*! - \brief Send a message to create an axis on server side - \param[in] id String identity of axis that will be created on server - */ - void CGrid::sendAddAxis(const string& id, CContextClient* contextClient) - TRY - { - sendAddItem(id, (int)EVENT_ID_ADD_AXIS, contextClient); - } - CATCH_DUMP_ATTR + transformations_ = new CGridTransformation(this, transformGridSrc); + transformations_->computeAll(); + if (0 < transformations_->getNbAlgo()) hasTransform_ = true; - /*! - \brief Send a message to create a scalar on server side - \param[in] id String identity of scalar that will be created on server - */ - void CGrid::sendAddScalar(const string& id, CContextClient* contextClient) - TRY - { - sendAddItem(id, (int)EVENT_ID_ADD_SCALAR, contextClient); - } - CATCH_DUMP_ATTR + // Ok, now need to compute index of grid source + transformGridSrc->checkMaskIndex(false); + } + CATCH_DUMP_ATTR - /*! - \brief Receive a message annoucing the creation of a domain on server side - \param[in] event Received event - */ - void CGrid::recvAddDomain(CEventServer& event) - TRY - { + bool CGrid::hasTransform() + TRY + { + if (hasTransform_) return hasTransform_; - CBufferIn* buffer = event.subEvents.begin()->buffer; - string id; - *buffer >> id; - get(id)->recvAddDomain(*buffer); - } - CATCH + std::vector domList = getDomains(); + std::vector axisList = getAxis(); + std::vector scalarList = getScalars(); - /*! - \brief Receive a message annoucing the creation of a domain on server side - \param[in] buffer Buffer containing message - */ - void CGrid::recvAddDomain(CBufferIn& buffer) - TRY - { - string id; - buffer >> id; - addDomain(id); - } - CATCH_DUMP_ATTR + for (int idx = 0; idx < domList.size(); ++idx) hasTransform_ |= domList[idx]->hasTransformation(); + for (int idx = 0; idx < axisList.size(); ++idx) hasTransform_ |= axisList[idx]->hasTransformation(); + for (int idx = 0; idx < scalarList.size(); ++idx) hasTransform_ |= scalarList[idx]->hasTransformation(); - /*! - \brief Receive a message annoucing the creation of an axis on server side - \param[in] event Received event - */ - void CGrid::recvAddAxis(CEventServer& event) - TRY - { + return hasTransform_; + } + CATCH_DUMP_ATTR - CBufferIn* buffer = event.subEvents.begin()->buffer; - string id; - *buffer >> id; - get(id)->recvAddAxis(*buffer); - } - CATCH + /*! + \brief Get the list of domain pointers + \return list of domain pointers + */ + std::vector CGrid::getDomains() + TRY + { + std::vector domList; + if (!domList_.empty()) + { + for (int i = 0; i < domList_.size(); ++i) domList.push_back(CDomain::get(domList_[i])); + } + return domList; + } + CATCH_DUMP_ATTR - /*! - \brief Receive a message annoucing the creation of an axis on server side - \param[in] buffer Buffer containing message - */ - void CGrid::recvAddAxis(CBufferIn& buffer) - TRY - { - string id; - buffer >> id; - addAxis(id); - } - CATCH_DUMP_ATTR + /*! + \brief Get the list of axis pointers + \return list of axis pointers + */ + std::vector CGrid::getAxis() + TRY + { + std::vector aList; + if (!axisList_.empty()) + for (int i =0; i < axisList_.size(); ++i) aList.push_back(CAxis::get(axisList_[i])); - /*! - \brief Receive a message annoucing the creation of an scalar on server side - \param[in] event Received event - */ - void CGrid::recvAddScalar(CEventServer& event) - TRY - { + return aList; + } + CATCH_DUMP_ATTR - CBufferIn* buffer = event.subEvents.begin()->buffer; - string id; - *buffer >> id; - get(id)->recvAddScalar(*buffer); - } - CATCH + /*! + \brief Get the list of axis pointers + \return list of axis pointers + */ + std::vector CGrid::getScalars() + TRY + { + std::vector sList; + if (!scalarList_.empty()) + for (int i =0; i < scalarList_.size(); ++i) sList.push_back(CScalar::get(scalarList_[i])); - /*! - \brief Receive a message annoucing the creation of an scalar on server side - \param[in] buffer Buffer containing message - */ - void CGrid::recvAddScalar(CBufferIn& buffer) - TRY - { - string id; - buffer >> id; - addScalar(id); - } - CATCH_DUMP_ATTR + return sList; + } + CATCH_DUMP_ATTR /*! - \brief Check if all elements of the grid are complete - Before make any grid processing, we must be sure that all grid information elements have - been sent, for exemple when reading a grid in a file or when grid elements are sent by an - other context (coupling) + \brief Get domain pointer with index + \return domain pointer */ - bool CGrid::isCompleted(void) + CDomain* CGrid::getDomain(int domainIndex) + TRY { - setDomainList(); - for (auto domainId : domList_) if (!CDomain::get(domainId)->isCompleted()) return false ; - setAxisList() ; - for (auto axisId : axisList_) if (!CAxis::get(axisId)->isCompleted()) return false ; - setScalarList() ; - for (auto scalarId : scalarList_) if (!CScalar::get(scalarId)->isCompleted()) return false ; - return true ; + std::vector domainListP = this->getDomains(); + if (domainListP.empty()) + { + ERROR("CGrid::getDomain(int domainIndex)", + << "No domain associated to this grid. " << std::endl + << "Grid id = " << this->getId()); + } + + if (domainIndex >= domainListP.size() || (domainIndex < 0)) + ERROR("CGrid::getDomain(int domainIndex)", + << "Domain with the index doesn't exist " << std::endl + << "Grid id = " << this->getId() << std::endl + << "Grid has only " << domainListP.size() << " domain but domain index required is " << domainIndex << std::endl); + + return domainListP[domainIndex]; } + CATCH_DUMP_ATTR /*! - \brief impose that all elements of the grid are complete - Before make any grid processing, we must be sure that all grid information elements have - been sent, for exemple when reading a grid in a file or when grid elements are sent by an - other context (coupling) + \brief Get the axis pointer with index + \return axis pointer */ - void CGrid::setCompleted(void) + CAxis* CGrid::getAxis(int axisIndex) + TRY { - setDomainList(); - for (auto domainId : domList_) CDomain::get(domainId)->setCompleted() ; - setAxisList() ; - for (auto axisId : axisList_) CAxis::get(axisId)->setCompleted() ; - setScalarList() ; - for (auto scalarId : scalarList_) CScalar::get(scalarId)->setCompleted() ; + std::vector axisListP = this->getAxis(); + if (axisListP.empty()) + { + ERROR("CGrid::getDomain(int axisIndex)", + << "No axis associated to this grid. " << std::endl + << "Grid id = " << this->getId()); + } + + if (axisIndex >= axisListP.size() || (axisIndex < 0)) + ERROR("CGrid::getDomain(int axisIndex)", + << "Domain with the index doesn't exist " << std::endl + << "Grid id = " << this->getId() << std::endl + << "Grid has only " << axisListP.size() << " axis but axis index required is " << axisIndex << std::endl); + + return axisListP[axisIndex]; } + CATCH_DUMP_ATTR -/*! - \brief impose that all elements of the grid are incomplete - Before make any grid processing, we must be sure that all grid information elements have - been sent, for exemple when reading a grid in a file or when grid elements are sent by an - other context (coupling) + /*! + \brief Get the a scalar pointer + \return scalar pointer */ - void CGrid::unsetCompleted(void) + CScalar* CGrid::getScalar(int scalarIndex) + TRY { - setDomainList(); - for (auto domainId : domList_) CDomain::get(domainId)->unsetCompleted() ; - setAxisList() ; - for (auto axisId : axisList_) CAxis::get(axisId)->unsetCompleted() ; - setScalarList() ; - for (auto scalarId : scalarList_) CScalar::get(scalarId)->unsetCompleted() ; + std::vector scalarListP = this->getScalars(); + if (scalarListP.empty()) + { + ERROR("CGrid::getScalar(int scalarIndex)", + << "No scalar associated to this grid. " << std::endl + << "Grid id = " << this->getId()); + } + + if (scalarIndex >= scalarListP.size() || (scalarIndex < 0)) + ERROR("CGrid::getScalar(int scalarIndex)", + << "Scalar with the index doesn't exist " << std::endl + << "Grid id = " << this->getId() << std::endl + << "Grid has only " << scalarListP.size() << " scalar but scalar index required is " << scalarIndex << std::endl); + + return scalarListP[scalarIndex]; } + CATCH_DUMP_ATTR /*! - \brief Solve domain and axis references - As field, domain and axis can refer to other domains or axis. In order to inherit correctly - all attributes from their parents, they should be processed with this function - \param[in] apply inherit all attributes of parents (true) + \brief Set domain(s) of a grid from a list + \param[in] domains list of domains */ - void CGrid::solveElementsRefInheritance(bool apply) + void CGrid::setDomainList(const std::vector domains) TRY { - setDomainList(); - for (auto domainId : domList_) + if (isDomListSet) return; + std::vector domList = this->getVirtualDomainGroup()->getAllChildren(); + if (!domains.empty() && domList.empty()) { - CDomain* pDom = CDomain::get(domainId); - pDom->solveRefInheritance(apply); - if (apply) pDom->solveInheritanceTransformation(); + for (int i = 0; i < domains.size(); ++i) + this->getVirtualDomainGroup()->addChild(domains[i]); + domList = this->getVirtualDomainGroup()->getAllChildren(); } - setAxisList(); - for (auto axisId : axisList_) + if (!domList.empty()) + { + int sizeDom = domList.size(); + domList_.resize(sizeDom); + for (int i = 0; i < sizeDom; ++i) + { + domList_[i] = domList[i]->getId(); + } + isDomListSet = true; + } + } + CATCH_DUMP_ATTR + + /*! + \brief Set axis(s) of a grid from a list + \param[in] axis list of axis + */ + void CGrid::setAxisList(const std::vector axis) + TRY + { + if (isAxisListSet) return; + std::vector aList = this->getVirtualAxisGroup()->getAllChildren(); + if (!axis.empty() && aList.empty()) { - CAxis* pAxis = CAxis::get(axisId); - pAxis->solveRefInheritance(apply); - if (apply) pAxis->solveInheritanceTransformation(); + for (int i = 0; i < axis.size(); ++i) + this->getVirtualAxisGroup()->addChild(axis[i]); + aList = this->getVirtualAxisGroup()->getAllChildren(); } - setScalarList(); - for (auto scalarId : scalarList_) + if (!aList.empty()) { - CScalar* pScalar = CScalar::get(scalarId); - pScalar->solveRefInheritance(apply); - if (apply) pScalar->solveInheritanceTransformation(); + int sizeAxis = aList.size(); + axisList_.resize(sizeAxis); + for (int i = 0; i < sizeAxis; ++i) + { + axisList_[i] = aList[i]->getId(); + } + isAxisListSet = true; } } CATCH_DUMP_ATTR - bool CGrid::activateFieldWorkflow(CGarbageCollector& gc) + /*! + \brief Set scalar(s) of a grid from a list + \param[in] scalars list of scalars + */ + void CGrid::setScalarList(const std::vector scalars) TRY { - setDomainList(); - for (auto domainId : domList_) - { - CDomain* pDom = CDomain::get(domainId); - bool ret = pDom->activateFieldWorkflow(gc); - if (!ret) return false ; - } - - setAxisList(); - for (auto axisId : axisList_) + if (isScalarListSet) return; + std::vector sList = this->getVirtualScalarGroup()->getAllChildren(); + if (!scalars.empty() && sList.empty()) { - CAxis* pAxis = CAxis::get(axisId); - bool ret = pAxis->activateFieldWorkflow(gc); - if (!ret) return false ; + for (int i = 0; i < scalars.size(); ++i) + this->getVirtualScalarGroup()->addChild(scalars[i]); + sList = this->getVirtualScalarGroup()->getAllChildren(); } - setScalarList(); - for (auto scalarId : scalarList_) + if (!sList.empty()) { - CScalar* pScalar = CScalar::get(scalarId); - bool ret = pScalar->activateFieldWorkflow(gc); - if (!ret) return false ; + int sizeScalar = sList.size(); + scalarList_.resize(sizeScalar); + for (int i = 0; i < sizeScalar; ++i) + { + scalarList_[i] = sList[i]->getId(); + } + isScalarListSet = true; } - return true ; } CATCH_DUMP_ATTR - /*! - \brief check attributes of all elements of the grid + /*! + \brief Get list of id of domains + \return id list of domains */ - void CGrid::checkElementsAttributes(void) + std::vector CGrid::getDomainList() TRY { setDomainList(); - for (auto domainId : domList_) CDomain::get(domainId)->checkAttributes(); + return domList_; + } + CATCH + /*! + \brief Get list of id of axis + \return id list of axis + */ + std::vector CGrid::getAxisList() + TRY + { setAxisList(); - for (auto axisId : axisList_) CAxis::get(axisId)->checkAttributes(); - - setScalarList(); - for (auto scalarId : scalarList_) CScalar::get(scalarId)->checkAttributes(); + return axisList_; } - CATCH_DUMP_ATTR - - - -//********************************************************** -//************** New transformation method ************** -//********************************************************** + CATCH - std::pair, std::shared_ptr > - CGrid::buildTransformationGraph(CGarbageCollector& gc, bool isSource, CGrid* gridSrc, double detectMissingValues, double defaultValue, CGrid*& newGrid, bool graphEnabled, CField* field) + /*! + \brief Get list of id of scalar + \return id list of scalar + */ + std::vector CGrid::getScalarList() TRY { - static bool transformationGoing = false; - registerAlgorithmTransformation() ; // needed to enable self-registration of the transformations - // big mystery why it doesn't work witout that... - // problem with the linker ?? - - std::shared_ptr inputFilter = std::shared_ptr(new CPassThroughFilter(gc)); - std::shared_ptr outputFilter = inputFilter ; - - - string newId ; - if (gridSrc!=nullptr) newId = gridSrc->getId() + " --> " + this->getId() ; - else newId = " --> " + this->getId() ; - bool isNewGrid ; - if (CGrid::has(newId)) - { - cout<<"Retrive existing grid : "< algo ; - int pos ; - - for(int i=0 ; igetTransformationPaths() ; - else if (dstElement.type==TYPE_AXIS) transformationPath = dstElement.axis->getTransformationPaths() ; - else if (dstElement.type==TYPE_SCALAR) transformationPath = dstElement.scalar->getTransformationPaths() ; - - SElement srcElement ; - if (gridSrc==nullptr) srcElement = this->elements_[i] ; - else srcElement = gridSrc->elements_[i] ; - - if (gridSrc==nullptr) transformationPath.mergePaths() ; - else - { - if (srcElement.type==TYPE_DOMAIN) transformationPath.mergePaths(srcElement.domain->getTransformationPaths()) ; - else if (srcElement.type==TYPE_AXIS) transformationPath.mergePaths(srcElement.axis->getTransformationPaths()) ; - else if (srcElement.type==TYPE_SCALAR) transformationPath.mergePaths(srcElement.scalar->getTransformationPaths()) ; - } - - hasTransform=transformationPath.hasTransform() ; - - if (hasTransform && !hadTransform) - { - pos=i ; - EElement dstElementType=transformationPath.getNextElementType() ; - string dstElementId=transformationPath.getNextElementId() ; - string srcElementId=transformationPath.getNextElementSrcId() ; - auto transType = transformationPath.getNextTransformationType() ; - auto transId = transformationPath.getNextTransformationId() ; - - CGrid* tmpGridSrc=CGrid::create(); // source grid - if (srcElement.type==TYPE_DOMAIN) tmpGridSrc->addDomain(srcElement.domain->getId()) ; - else if (srcElement.type==TYPE_AXIS) tmpGridSrc->addAxis(srcElement.axis->getId()) ; - else if (srcElement.type==TYPE_SCALAR) tmpGridSrc->addScalar(srcElement.scalar->getId()) ; - // WARNING -> suppress checkElement attribute ? What append ? - // tmpGridSrc->checkElementsAttributes() ; - CGrid* tmpGridDst=CGrid::create(); // destination Grid - map posInGrid={{0,0}} ; - - cout<<"--> New transform from "<createAlias(dstElementId) ; - cout<<"Create new domain : "<getId()<<" with alias : "<duplicateAttributes(lastDstDomain) ; - dstDomain->setTemplateId(lastDstDomain) ; - } - else if (srcElementId=="" && srcElement.type==TYPE_DOMAIN) - { - dstDomain->duplicateAttributes(srcElement.domain) ; // make a copy - dstDomain->setTemplateId(srcElement.domain) ; - } - else - { - dstDomain->duplicateAttributes(dstElement.domain) ; // make a copy - dstDomain->setTemplateId(dstElement.domain) ; - } - CTransformation* transformation = CTransformation::createTransformation(transType,"") ; - auto srcTransform = CTransformation::getTransformation(transType, transId) ; - transformation->inheritFrom(srcTransform) ; - CGrid* tmpGridDst=CGrid::create(); // destination Grid - tmpGridDst->addDomain(dstDomain->getId()) ; - - algo = transformation -> createAlgorithm(false, tmpGridDst, tmpGridSrc, 0, - posInGrid,posInGrid,posInGrid, - posInGrid,posInGrid,posInGrid ); - - - dstDomain->setTransformationAlgorithm(algo) ; - dstDomain->setTransformationPaths(transformationPath) ; - } - algo=dstDomain->getTransformationAlgorithm() ; - isGenerate = algo->isGenerateTransformation() ; - transformationPath.removeNextTransform() ; - dstElementId=transformationPath.getNextElementId() ; - srcElementId=transformationPath.getNextElementSrcId() ; - transType = transformationPath.getNextTransformationType() ; - transId = transformationPath.getNextTransformationId() ; - lastDstDomain=dstDomain ; - dstDomain->setTransformationPaths(transformationPath) ; - } while(transformationPath.hasTransform() && isGenerate) ; - - if (isNewGrid) newGrid->addDomain(dstDomain->getId()) ; - algo = dstDomain->getTransformationAlgorithm() ; - } - else if (dstElementType==EElement::AXIS) - { - CAxis* dstAxis ; - CAxis* lastDstAxis ; - bool isGenerate=false ; - - do - { - if (CAxis::has(dstElementId)) - { - dstAxis = CAxis::get(dstElementId) ; - cout<<"Retrive existing axis : "<createAlias(dstElementId) ; - cout<<"Create new axis : "<getId()<<" with alias : "<duplicateAttributes(lastDstAxis) ; - dstAxis->setTemplateId(lastDstAxis) ; - } - else if (srcElementId=="" && srcElement.type==TYPE_AXIS) - { - dstAxis->duplicateAttributes(srcElement.axis) ; // make a copy - dstAxis->setTemplateId(srcElement.axis) ; - } - else - { - dstAxis->duplicateAttributes(dstElement.axis) ; // make a copy$ - dstAxis->setTemplateId(dstElement.axis) ; - } - CTransformation* transformation = CTransformation::createTransformation(transType,"") ; - auto srcTransform = CTransformation::getTransformation(transType, transId) ; - transformation->inheritFrom(srcTransform) ; - tmpGridDst->addAxis(dstAxis->getId()) ; - - algo = transformation -> createAlgorithm(false, tmpGridDst, tmpGridSrc, 0, - posInGrid,posInGrid,posInGrid, - posInGrid,posInGrid,posInGrid ); - - dstAxis->setTransformationAlgorithm(algo) ; - dstAxis->setTransformationPaths(transformationPath) ; - } - - algo=dstAxis->getTransformationAlgorithm() ; - isGenerate = algo->isGenerateTransformation() ; - transformationPath.removeNextTransform() ; - dstElementId=transformationPath.getNextElementId() ; - srcElementId=transformationPath.getNextElementSrcId() ; - transType = transformationPath.getNextTransformationType() ; - transId = transformationPath.getNextTransformationId() ; - lastDstAxis=dstAxis ; - dstAxis->setTransformationPaths(transformationPath) ; - } while(transformationPath.hasTransform() && isGenerate) ; - - if (isNewGrid) newGrid->addAxis(dstAxis->getId()) ; - algo = dstAxis->getTransformationAlgorithm() ; - } - else if (dstElementType==EElement::SCALAR) - { - CScalar* dstScalar ; - CScalar* lastDstScalar ; - bool isGenerate=false ; + setScalarList(); + return scalarList_; + } + CATCH - do - { - if (CScalar::has(dstElementId)) - { - dstScalar = CScalar::get(dstElementId) ; - cout<<"Retrive existing scalar : "<createAlias(dstElementId) ; - cout<<"Create new scalar : "<getId()<<" with alias : "<duplicateAttributes(lastDstScalar) ; - dstScalar->setTemplateId(lastDstScalar) ; - } - else if (srcElementId=="" && srcElement.type==TYPE_SCALAR) - { - dstScalar->duplicateAttributes(srcElement.scalar) ; // make a copy - dstScalar->setTemplateId(srcElement.scalar) ; - } - else - { - dstScalar->duplicateAttributes(dstElement.scalar) ; // make a copy - dstScalar->setTemplateId(dstElement.scalar) ; - } - CTransformation* transformation = CTransformation::createTransformation(transType,"") ; - auto srcTransform = CTransformation::getTransformation(transType, transId) ; - transformation->inheritFrom(srcTransform) ; - tmpGridDst->addScalar(dstScalar->getId()) ; - - algo = transformation -> createAlgorithm(false, tmpGridDst, tmpGridSrc, 0, - posInGrid,posInGrid,posInGrid, - posInGrid,posInGrid,posInGrid ); - - dstScalar->setTransformationAlgorithm(algo) ; - dstScalar->setTransformationPaths(transformationPath) ; - } - algo=dstScalar->getTransformationAlgorithm() ; - isGenerate = algo->isGenerateTransformation() ; - transformationPath.removeNextTransform() ; - dstElementId=transformationPath.getNextElementId() ; - srcElementId=transformationPath.getNextElementSrcId() ; - transType = transformationPath.getNextTransformationType() ; - transId = transformationPath.getNextTransformationId() ; - lastDstScalar=dstScalar ; - dstScalar->setTransformationPaths(transformationPath) ; - } while(transformationPath.hasTransform() && isGenerate) ; - - if (isNewGrid) newGrid->addScalar(dstScalar->getId()) ; - algo = dstScalar->getTransformationAlgorithm() ; - } - // here create a new spatial filter with algo - - hadTransform=true ; - hasTransform=false ; - } - else - { - string srcElementId=transformationPath.getNextElementSrcId() ; + /*! + Send all attributes of grid and all domain, axis, scalar from client to server + */ - if (srcElement.type==TYPE_DOMAIN) - { - CDomain* domain ; - if (srcElementId=="") srcElementId=srcElement.domain->getId() ; - if (!CDomain::has(srcElementId)) - { - domain=srcElement.domain ; - domain->createAlias(srcElementId) ; - } - else domain = CDomain::get(srcElementId) ; - domain->checkAttributes() ; - - if (isNewGrid) newGrid->addDomain(srcElementId) ; - } - else if (srcElement.type==TYPE_AXIS) - { - CAxis* axis ; - if (srcElementId=="") srcElementId=srcElement.axis->getId() ; - if (!CAxis::has(srcElementId)) - { - axis=srcElement.axis ; - axis->createAlias(srcElementId) ; - } - else axis = CAxis::get(srcElementId) ; - axis->checkAttributes() ; - - if (isNewGrid) newGrid->addAxis(srcElementId) ; - } - else if (srcElement.type==TYPE_SCALAR) - { - CScalar* scalar ; - if (srcElementId=="") srcElementId=srcElement.scalar->getId() ; - if (!CScalar::has(srcElementId)) - { - scalar=srcElement.scalar ; - scalar->createAlias(srcElementId) ; - } - else scalar = CScalar::get(srcElementId) ; - scalar->checkAttributes() ; - - if (isNewGrid) newGrid->addScalar(srcElementId) ; - } - } - - if (transformationPath.hasTransform() && hadTransform) hasRemainTransform=true ; - } + void CGrid::sendGrid(void) + TRY + { + this->sendAllAttributesToServer(); + auto domainList=getDomains() ; + auto axisList=getAxis() ; + auto scalarList=getScalars() ; + int domainIdx = 0, axisIdx = 0, scalarIdx = 0; - - if (hadTransform) + for (int idx = 0; idx < axis_domain_order.numElements(); ++idx) { - - if (!isSource) + if (2 == axis_domain_order(idx)) // This is domain { - shared_ptr gridAlgorithm ; - if (isNewGrid) - { - gridAlgorithm = algo->createGridAlgorithm(gridSrc, newGrid, pos) ; - newGrid->setGridAlgorithm(gridAlgorithm); - } - else gridAlgorithm = newGrid->getGridAlgorithm() ; - - shared_ptr transformFilter = shared_ptr(gridAlgorithm->createTransformFilter(gc, detectMissingValues, defaultValue)) ; - outputFilter->connectOutput(transformFilter,0) ; - if(graphEnabled) - { - transformFilter->graphEnabled=true; - transformFilter->graphPackage = new CGraphPackage; - transformFilter->graphPackage->inFields.push_back(field); - transformFilter->graphPackage->show = !transformationGoing; - } - - vector auxFieldId = algo->getAuxFieldId() ; // better to do that at transformation not algo ?? - int i=1; - for (auto& it : auxFieldId) - { - CField* auxField = CField::get(it) ; - auxField->buildWorkflowGraph(gc) ; - auxField->getInstantDataFilter()->connectOutput(transformFilter,i) ; - i++ ; - } - outputFilter = transformFilter ; + sendAddDomain(domainList[domainIdx]->getId()) ; + domainList[domainIdx]->sendAllAttributesToServer(); + domainIdx++ ; } - - if (hasRemainTransform) + else if (1 == axis_domain_order(idx)) // This is axis { - transformationGoing = true; - gridSrc=newGrid ; - CField *field_bis = field; - pair, shared_ptr > filters = this->buildTransformationGraph(gc, isSource, gridSrc, detectMissingValues, defaultValue, newGrid, graphEnabled, field_bis) ; - outputFilter->connectOutput(filters.first,0) ; - outputFilter=filters.second ; + sendAddAxis(axisList[axisIdx]->getId()) ; + axisList[axisIdx]->sendAllAttributesToServer(); + axisIdx++ ; } - transformationGoing = false; - } - - return {inputFilter,outputFilter} ; - } - CATCH_DUMP_ATTR - - -//**************************************************************** -//**************************************************************** - -//---------------------------------------------------------------- - - CGrid* CGrid::duplicateSentGrid(void) - { - CGrid* newGrid ; - string sentGridId="sent__"+getId() ; - if (has(sentGridId)) newGrid = get(sentGridId) ; - else - { - newGrid = CGrid::create(sentGridId) ; - for(auto element : elements_) + else // Of course, this is scalar { - if (element.type==TYPE_DOMAIN) - { - CDomain* domain = CDomain::create(); - domain->duplicateAttributes(element.domain) ; - domain->setTemplateId(element.domain) ; - domain->name = element.domain->getId() ; - newGrid->addDomain(domain->getId()) ; - } - else if (element.type==TYPE_AXIS) - { - CAxis* axis = CAxis::create(); - axis->duplicateAttributes(element.axis) ; - axis->setTemplateId(element.axis) ; - axis->name = element.axis->getId() ; - newGrid->addAxis(axis->getId()) ; - } - else if (element.type==TYPE_SCALAR) - { - CScalar* scalar = CScalar::create(); - scalar->duplicateAttributes(element.scalar) ; - scalar->setTemplateId(element.scalar) ; - scalar->name = element.scalar->getId() ; - newGrid->addScalar(scalar->getId()) ; - } + sendAddScalar(scalarList[scalarIdx]->getId()) ; + scalarList[scalarIdx]->sendAllAttributesToServer(); + scalarIdx++ ; } - newGrid->checkElementsAttributes() ; } - return newGrid ; } - + CATCH_DUMP_ATTR void CGrid::setContextClient(CContextClient* contextClient) TRY @@ -2339,104 +3020,58 @@ namespace xios clients.push_back(contextClient) ; clientsSet.insert(contextClient); } - for (auto domain : getDomains()) domain->setContextClient(contextClient); - for (auto axis : getAxis()) axis->setContextClient(contextClient); - for (auto scalar : getScalars()) scalar->setContextClient(contextClient); - + for (int i=0; igetDomains().size(); i++) + this->getDomains()[i]->setContextClient(contextClient); + for (int i=0; igetAxis().size(); i++) + this->getAxis()[i]->setContextClient(contextClient); } CATCH_DUMP_ATTR - - void CGrid::computeGridLocalElements() - { - std::vector domainList = this->getDomains(); - std::vector axisList = this->getAxis(); - std::vector scalarList = this->getScalars(); - auto domain=domainList.begin() ; - auto axis=axisList.begin() ; - auto scalar=scalarList.begin() ; - vector> elements; - for(auto order : order_) - { - if (order==2) - { - elements.push_back((*domain)->getLocalElement()); - domain++ ; - } - else if (order==1) - { - elements.push_back((*axis)->getLocalElement()); - axis++ ; - } - else if (order==0) - { - elements.push_back((*scalar)->getLocalElement()); - scalar++ ; - } - } - if (hasMask()) - { - vector mask(getMask().getVector()) ; - gridLocalElements_ = make_shared(elements, mask) ; - } - else gridLocalElements_ = make_shared(elements) ; - } - - void CGrid::computeModelToWorkflowConnector(void) - { - modelToWorkflowConnector_ = getGridLocalElements()->getConnector(CElementView::MODEL,CElementView::WORKFLOW,true) ; - } - - void CGrid::computeWorkflowToFullConnector(void) - { - workflowToFullConnector_ = getGridLocalElements()->getConnector(CElementView::WORKFLOW,CElementView::FULL) ; - } - - void CGrid::computeWorkflowToModelConnector(void) - { - workflowToModelConnector_ = getGridLocalElements()->getConnector(CElementView::WORKFLOW,CElementView::MODEL,true) ; - } - - void CGrid::computeFullToWorkflowConnector(void) + /*! + Parse a grid, for now, it contains only domain, axis and scalar + */ + void CGrid::parse(xml::CXMLNode& node) + TRY { - fullToWorkflowConnector_ = getGridLocalElements()->getConnector(CElementView::FULL,CElementView::WORKFLOW) ; - } + SuperClass::parse(node); - void CGrid::computeServerFromClientConnector(void) - { - vector> connectors ; - for(auto& element : getElements()) + if (node.goToChildElement()) { - if (element.type==TYPE_DOMAIN) connectors.push_back(element.domain->getServerFromClientConnector()) ; - else if (element.type==TYPE_AXIS) connectors.push_back(element.axis->getServerFromClientConnector()) ; - else if (element.type==TYPE_SCALAR) connectors.push_back(element.scalar->getServerFromClientConnector()) ; + StdString domainName("domain"); + StdString axisName("axis"); + StdString scalarName("scalar"); + do + { + if (node.getElementName() == domainName) { + order_.push_back(2); + this->getVirtualDomainGroup()->parseChild(node); + } + if (node.getElementName() == axisName) { + order_.push_back(1); + this->getVirtualAxisGroup()->parseChild(node); + } + if (node.getElementName() == scalarName) { + order_.push_back(0); + this->getVirtualScalarGroup()->parseChild(node); + } + } while (node.goToNextElement()); + node.goToParentElement(); } - serverFromClientConnector_ = make_shared(connectors) ; - } - void CGrid::computeServerToClientConnector(void) - { - vector> connectors ; - for(auto& element : getElements()) + if (!order_.empty()) { - if (element.type==TYPE_DOMAIN) connectors.push_back(element.domain->getServerToClientConnector()) ; - else if (element.type==TYPE_AXIS) connectors.push_back(element.axis->getServerToClientConnector()) ; - else if (element.type==TYPE_SCALAR) connectors.push_back(element.scalar->getServerToClientConnector()) ; + int sizeOrd = order_.size(); + axis_domain_order.resize(sizeOrd); + for (int i = 0; i < sizeOrd; ++i) + { + axis_domain_order(i) = order_[i]; + } } - serverToClientConnector_ = make_shared(connectors) ; - } - void CGrid::computeClientFromClientConnector(void) - { - vector> connectors ; - for(auto& element : getElements()) - { - if (element.type==TYPE_DOMAIN) connectors.push_back(element.domain->getServerFromClientConnector()) ; - else if (element.type==TYPE_AXIS) connectors.push_back(element.axis->getServerFromClientConnector()) ; - else if (element.type==TYPE_SCALAR) connectors.push_back(element.scalar->getServerFromClientConnector()) ; - } - clientFromClientConnector_ = make_shared(connectors) ; - } + setDomainList(); + setAxisList(); + setScalarList(); + } + CATCH_DUMP_ATTR - } // namespace xios diff --git a/xios_2311_src/src/node/grid.hpp b/xios_2311_src/src/node/grid.hpp index a7572512ae4234a052194959eb8492482e8adf40..8b1bf4ec10f7f74a61834e63c643d52dca8370bc 100755 --- a/xios_2311_src/src/node/grid.hpp +++ b/xios_2311_src/src/node/grid.hpp @@ -15,14 +15,6 @@ #include "client_server_mapping.hpp" #include "utils.hpp" #include "transformation_enum.hpp" -#include "grid_local_connector.hpp" -#include "grid_elements.hpp" -#include "grid_scatterer_connector.hpp" -#include "grid_gatherer_connector.hpp" -#include "transformation_path.hpp" -#include "filter.hpp" -#include "grid_algorithm.hpp" - namespace xios { @@ -38,7 +30,8 @@ namespace xios { class CDistributionServer; class CServerDistributionDescription; class CClientServerMapping; - + class CGridTransformation; + ///-------------------------------------------------------------- // Declare/Define CGridAttribute @@ -56,19 +49,6 @@ namespace xios { typedef CObjectTemplate SuperClass; typedef CGridAttributes SuperClassAttribute; - private: - - // define a structure to store elements (CDomain, CAxis, CScalar) using a void* and a type to cast the pointer - enum EElementType { TYPE_SCALAR, TYPE_AXIS, TYPE_DOMAIN } ; - struct SElement {void* ptr ; EElementType type ; CScalar* scalar ; CAxis* axis ; CDomain* domain ; } ; - vector elements_ ; - bool elementsComputed_ = false ; - /** retrieve the vector of elements as a structure containing a void* and the type of pointer */ - vector& getElements(void) { if (!elementsComputed_) computeElements() ; return elements_ ; } - void computeElements(void) ; - /** List order of axis and domain in a grid, if there is a domain, it will take value 2, axis 1, scalar 0 */ - std::vector order_; - public: typedef CGridAttributes RelAttributes; @@ -76,9 +56,7 @@ namespace xios { enum EEventId { - EVENT_ID_ADD_DOMAIN, EVENT_ID_ADD_AXIS, EVENT_ID_ADD_SCALAR, - EVENT_ID_SEND_MASK, - + EVENT_ID_INDEX, EVENT_ID_ADD_DOMAIN, EVENT_ID_ADD_AXIS, EVENT_ID_ADD_SCALAR }; /// Constructeurs /// @@ -91,8 +69,8 @@ namespace xios { // void solveReference(void); void checkEligibilityForCompressedOutput(); - + void solveDomainAxisRef(bool areAttributesChecked); void checkMaskIndex(bool doCalculateIndex); @@ -110,15 +88,24 @@ namespace xios { /// Accesseurs /// StdSize getDimension(void); - StdSize getDataSize(void) ; + StdSize getDataSize(void) const; - /** - * Get the local data grid size, ie the size of the compressed grid (inside the workflow) - * \return The size od the compressed grid - */ - StdSize getLocalDataSize(void) ; + StdSize getTileDataSize(int tileId); + + StdSize getTileSize(int tileId); + + /// Entrees-sorties de champs + template + void inputField(const CArray& field, CArray& stored) const; + template + void maskField(const CArray& field, CArray& stored, bool isTiled = false) const; + template + void outputField(const CArray& stored, CArray& field) const; + template + void uncompressField(const CArray& data, CArray& outData) const; + template + void copyTile(const CArray& tileData, CArray& stored, int tileId); - virtual void parse(xml::CXMLNode& node); /// Destructeur /// @@ -141,51 +128,32 @@ namespace xios { const std::vector& scalars, const CArray& axisDomainOrder = CArray()); static CGrid* createGrid(const std::vector& domains, const std::vector& axis, const std::vector& scalars, const CArray& axisDomainOrder); - static CGrid* get(const string& id, bool noError=false) ; //& domains, const std::vector& axis, const std::vector& scalars, const CArray& axisDomainOrder = CArray()); static StdString generateId(const CGrid* gridSrc, const CGrid* gridDest); static CGrid* cloneGrid(const StdString& idNewGrid, CGrid* gridSrc); - CDomain* getAssociatedDomain(const string& domainId, bool noError=false) ; - CAxis* getAssociatedAxis(const string& axisId, bool noError=false) ; - CScalar* getAssociatedScalar(const string& scalarId, bool noError=false) ; public: - void solveDomainAxisRef(bool areAttributesChecked); - void checkElementsAttributes(void) ; + void computeIndexServer(void); + void computeIndex(void); + void computeIndexScalarGrid(); + void computeWrittenIndex(); void solveDomainRef(bool checkAtt); void solveAxisRef(bool checkAtt); void solveScalarRef(bool checkAtt); - void solveElementsRefInheritance(bool apply = true); - bool activateFieldWorkflow(CGarbageCollector& gc) ; - // void solveTransformations(); + void solveDomainAxisRefInheritance(bool apply = true); + void solveTransformations(); void solveDomainAxisBaseRef(); CDomain* addDomain(const std::string& id=StdString()); CAxis* addAxis(const std::string& id=StdString()); CScalar* addScalar(const std::string& id=StdString()); + void sendAddDomain(const std::string& id=""); + void sendAddAxis(const std::string& id=""); + void sendAddScalar(const std::string& id=""); + void sendGrid(void) ; - public: - void sendGridToFileServer(CContextClient* client) ; - private: - std::set sendGridToFileServer_done_ ; - - public: - void sendGridToCouplerOut(CContextClient* client, const string& fieldId) ; - private: - std::set sendGridToCouplerOut_done_ ; - - public: - void makeAliasForCoupling(const string& fieldId) ; - string getCouplingAlias(const string& fieldId) ; - - public: - void sendAddDomain(const std::string& id,CContextClient* contextClient); - void sendAddAxis(const std::string& id,CContextClient* contextClient); - void sendAddScalar(const std::string& id,CContextClient* contextClient); - static void recvAddDomain(CEventServer& event); void recvAddDomain(CBufferIn& buffer); static void recvAddAxis(CEventServer& event); @@ -194,10 +162,15 @@ namespace xios { void recvAddScalar(CBufferIn& buffer); static bool dispatchEvent(CEventServer& event); - - public: + static void recvIndex(CEventServer& event); + void recvIndex(vector ranks, vector buffers); + void sendIndex(void); + void sendIndexScalarGrid(); + void setContextClient(CContextClient* contextClient); + void computeDomConServer(); + std::map getDomConServerSide(); std::map getAttributesBufferSize(CContextClient* client, bool bufferForWriting = false); std::map getDataBufferSize(CContextClient* client, const std::string& id = "", bool bufferForWriting = false); std::vector getDomainList(); @@ -215,45 +188,112 @@ namespace xios { bool doGridHaveDataToWrite(); bool doGridHaveDataDistributed(CContextClient* client = 0); - - /////////////////////////////////////////// - //////// TRANSFORMATIONS ///// - /////////////////////////////////////////// - public: - pair, shared_ptr > buildTransformationGraph(CGarbageCollector& gc, bool isSource, CGrid* gridSrc, double detectMissingValues, - double defaultValue, CGrid*& newGrid, bool graphEnabled=false, CField* field=0) ; - private: - shared_ptr gridAlgorithm_ = nullptr ; - public: - void setGridAlgorithm(shared_ptr gridAlgorithm) {gridAlgorithm_ = gridAlgorithm;} - shared_ptr getGridAlgorithm(void) { return gridAlgorithm_ ;} - - /////////////////////////////////////////// + size_t getWrittenDataSize() const; + int getNumberWrittenIndexes() const; + int getTotalNumberWrittenIndexes() const; + int getOffsetWrittenIndexes() const; + + CDistributionServer* getDistributionServer(); + CDistributionClient* getDistributionClient(); + CGridTransformation* getTransformations(); + + void transformGrid(CGrid* transformGridSrc); + void completeGrid(CGrid* transformGridSrc = 0); + void doAutoDistribution(CGrid* transformGridSrc); + bool isTransformed(); + void setTransformed(); + bool isGenerated(); + void setGenerated(); + void addTransGridSource(CGrid* gridSrc); + std::map >& getTransGridSource(); + bool hasTransform(); + size_t getGlobalWrittenSize(void) ; public: + CArray storeIndex_client; + CArray storeIndexTiled_client; + CArray storeMask_client; + CArray storeMaskTiled_client; - size_t getGlobalWrittenSize(void) ; - - bool isCompleted(void) ; - void setCompleted(void) ; - void unsetCompleted(void) ; +/** Map containing indexes that will be sent in sendIndex(). */ + std::map > > storeIndex_toSrv; +/** Map storing the number of senders. Key = size of receiver's intracomm */ + std::map > nbSenders; + + std::map > nbReadSenders; + + map > storeIndex_fromSrv; // Support, for now, reading with level-1 server + + map > outIndexFromClient; // Deprecated + + map > compressedOutIndexFromClient; + +/** Map storing received indexes. Key = sender rank, value = index array. */ + map > outGlobalIndexFromClient; + +/** Map storing received indexes. Key = sender rank, value = index array for tiled domains */ + map > outGlobalIndexFromClientTiled; + +// Manh Ha's comment: " A client receives global index from other clients (via recvIndex) +// then does mapping these index into local index of STORE_CLIENTINDEX +// In this way, store_clientIndex can be used as an input of a source filter +// Maybe we need a flag to determine whether a client wants to write. TODO " + +/** Map storing received data. Key = sender rank, value = data array. + * The map is created in CGrid::computeClientIndex and filled upon receiving data in CField::recvUpdateData() */ + map > outLocalIndexStoreOnClient; + +/** Map storing received data. Key = sender rank, value = data array. + * The map is created in CGrid::computeClientIndex and filled upon receiving data in CField::recvUpdateData() */ + map > outLocalIndexStoreOnClientTiled; + + +/** Indexes calculated based on server-like distribution. + * They are used for writing/reading data and only calculated for server level that does the writing/reading. + * Along with localIndexToWriteOnClient, these indexes are used to correctly place incoming data. */ + CArray localIndexToWriteOnServer; + +/** Indexes calculated based on client-like distribution. + * They are used for writing/reading data and only calculated for server level that does the writing/reading. + * Along with localIndexToWriteOnServer, these indexes are used to correctly place incoming data. */ + CArray localIndexToWriteOnClient; + + CArray indexFromClients; bool hasMask(void) const; - /** get mask pointer stored in mask_1d, or mask_2d, or..., or mask_7d */ - CArray mask_ ; - CArray& getMask(void) ; + void checkMask(void); + void createMask(void); + void modifyMask(const CArray& indexToModify, bool valueToModify = false); + void modifyMaskSize(const std::vector& newDimensionSize, bool newValue = false); + + void computeGridGlobalDimension(const std::vector& domains, + const std::vector& axis, + const std::vector& scalars, + const CArray& axisDomainOrder); + + int getNTiles(); + bool isTiled(void) const; + bool isTiledOnly(void) const; private: - /** Client-like distribution calculated based on the knowledge of the entire grid */ - CDistributionClient* clientDistribution_; - public: - void computeClientDistribution(void) ; - private: - bool computeClientDistribution_done_ = false ; - public: - CDistributionClient* getClientDistribution(void); - - private: + template + void checkGridMask(CArray& gridMask, + const std::vector* >& domainMasks, + const std::vector* >& axisMasks, + const CArray& axisDomainOrder, + bool createMask = false); + template + void modifyGridMask(CArray& gridMask, const CArray& indexToModify, bool valueToModify); + + template + void modifyGridMaskSize(CArray& gridMask, const std::vector& eachDimSize, bool newValue); + + void storeField_arr(const double* const data, CArray& stored) const; + void restoreField_arr(const CArray& stored, double* const data) const; + void uncompressField_arr(const double* const data, CArray& outData) const; + void maskField_arr(const double* const data, CArray& stored, bool isTiled = false) const; + void copyTile_arr(const double* const tileData, CArray& stored, int tileId); + void setVirtualDomainGroup(CDomainGroup* newVDomainGroup); void setVirtualAxisGroup(CAxisGroup* newVAxisGroup); void setVirtualScalarGroup(CScalarGroup* newVScalarGroup); @@ -266,32 +306,65 @@ namespace xios { CAxisGroup* getVirtualAxisGroup() const; CScalarGroup* getVirtualScalarGroup() const; + void checkAttributesAfterTransformation(); + void setTransformationAlgorithms(); + void computeIndexByElement(const std::vector > >& indexServerOnElement, + const CContextClient* client, + CClientServerMapping::GlobalIndexMap& globalIndexOnServer); int computeGridGlobalDimension(std::vector& globalDim, const std::vector domains, const std::vector axis, const std::vector scalars, const CArray& axisDomainOrder); int getDistributedDimension(); - public: - bool isDataDistributed(void) ; + void computeClientIndex(); + void computeClientIndexTiled(); + void computeConnectedClients(); + void computeClientIndexScalarGrid(); + void computeConnectedClientsScalarGrid(); + + void computeTileIndex(); + private: /** Clients that have to send a grid. There can be multiple clients in case of secondary server, otherwise only one client. */ std::list clients; std::set clientsSet; - private: bool isChecked; bool isDomainAxisChecked; bool isIndexSent; + int nTiles_; +/** True if tiled data is defined on the grid */ + bool isTiled_; +/** True if ONLY tiled data is defined on the grid */ + bool isTiledOnly_; + +/** Vector containing local domain indexes for each tile */ + std::vector > storeTileIndex; + CDomainGroup* vDomainGroup_; CAxisGroup* vAxisGroup_; CScalarGroup* vScalarGroup_; std::vector axisList_, domList_, scalarList_; bool isAxisListSet, isDomListSet, isScalarListSet; +/** Client-like distribution calculated based on the knowledge of the entire grid */ + CDistributionClient* clientDistribution_; + +/** Client-like distribution calculated based on the knowledge of the entire grid in case of a tiled domain */ + CDistributionClient* clientDistributionTiled_; + + +/** Server-like distribution calculated upon receiving indexes */ + CDistributionServer* serverDistribution_; + + CClientServerMapping* clientServerMap_; + size_t writtenDataSize_; + int numberWrittenIndexes_, totalNumberWrittenIndexes_, offsetWrittenIndexes_; + /** Map storing local ranks of connected receivers. Key = size of receiver's intracomm. * It is calculated in computeConnectedClients(). */ std::map > connectedServerRank_; @@ -305,100 +378,246 @@ namespace xios { /** Size of data to be send in case of reading. It is calculated in recvIndex(). */ std::map connectedDataSizeRead_; - + + bool isDataDistributed_; //! True if and only if the data defined on the grid can be outputted in a compressed way bool isCompressible_; std::set relFilesCompressed; - + bool isTransformed_, isGenerated_; + bool computedWrittenIndex_; std::vector axisPositionInGrid_; - void computeAxisPositionInGrid(void) ; - bool computeAxisPositionInGrid_done_ = false ; - std::vector& getAxisPositionInGrid(void) { if (!computeAxisPositionInGrid_done_) computeAxisPositionInGrid() ; return axisPositionInGrid_ ;} - + CGridTransformation* transformations_; bool hasDomainAxisBaseRef_; std::map > gridSrc_; + bool hasTransform_; - ////////////////////////////////////////////////////////////////////////////////////// - // this part is related to distribution, element definition, views and connectors // - ////////////////////////////////////////////////////////////////////////////////////// - public: - CGrid* duplicateSentGrid(void) ; - private: - static void recvMask(CEventServer& event) ; - void receiveMask(CEventServer& event) ; - - private: - shared_ptr gridLocalElements_= nullptr ; - void computeGridLocalElements(void) ; - public: - shared_ptr getGridLocalElements(void) { if (gridLocalElements_==nullptr) computeGridLocalElements() ; return gridLocalElements_ ;} +/** Map storing global indexes of server-like (band-wise) distribution for sending to receivers. + * Key = size of receiver's intracomm. + */ +// std::map globalIndexOnServer_; + std::map globalIndexOnServer_; - private: - shared_ptr modelToWorkflowConnector_ = nullptr ; - public: - void computeModelToWorkflowConnector(void) ; - shared_ptr getModelToWorkflowConnector(void) { if (modelToWorkflowConnector_==nullptr) computeModelToWorkflowConnector() ; return modelToWorkflowConnector_;} - private: - shared_ptr workflowToModelConnector_ = nullptr; - public: - void computeWorkflowToModelConnector(void) ; - shared_ptr getWorkflowToModelConnector(void) { if (workflowToModelConnector_==nullptr) computeWorkflowToModelConnector() ; return workflowToModelConnector_;} +/** List order of axis and domain in a grid, if there is a domain, it will take value 1 (true), axis 0 (false) */ + std::vector order_; - public: //? - void distributeGridToServer(CContextClient* client, const string& fieldId=""); - - - private: - shared_ptr workflowToFullConnector_ = nullptr; - public: - void computeWorkflowToFullConnector(void) ; - shared_ptr getWorkflowToFullConnector(void) { if (workflowToFullConnector_==nullptr) computeWorkflowToFullConnector() ; return workflowToFullConnector_;} - - private: - shared_ptr fullToWorkflowConnector_ = nullptr; - public: - void computeFullToWorkflowConnector(void) ; - shared_ptr getFullToWorkflowConnector(void) { if (fullToWorkflowConnector_==nullptr) computeFullToWorkflowConnector() ; return fullToWorkflowConnector_;} + }; // class CGrid - + ///-------------------------------------------------------------- - private: - shared_ptr clientFromClientConnector_ = nullptr ; - public: - shared_ptr getClientFromClientConnector(void) { if (clientFromClientConnector_==nullptr) computeClientFromClientConnector() ; return clientFromClientConnector_;} - void computeClientFromClientConnector(void) ; + template + void CGrid::inputField(const CArray& field, CArray& stored) const + TRY + { +//#ifdef __XIOS_DEBUG + if (this->getDataSize() != field.numElements()) + ERROR("void CGrid::inputField(const CArray& field, CArray& stored) const", + << "[ Awaiting data of size = " << this->getDataSize() << ", " + << "Received data size = " << field.numElements() << " ] " + << "The data array does not have the right size! " + << "Grid = " << this->getId()) +//#endif + this->storeField_arr(field.dataFirst(), stored); + } + CATCH + + template + void CGrid::copyTile(const CArray& tileData, CArray& storedData, int tileId) + { + this->copyTile_arr(tileData.dataFirst(), storedData, tileId); + } - private: - map> clientToClientConnector_ ; - public: - shared_ptr getClientToClientConnector(CContextClient* client) { return clientToClientConnector_[client] ;} // make some test to see if connector exits for the given client - + template + void CGrid::maskField(const CArray& field, CArray& stored, bool isTiled) const + { +//#ifdef __XIOS_DEBUG + if (this->getDataSize() != field.numElements()) + ERROR("void CGrid::maskField(const CArray& field, CArray& stored) const", + << "[ Awaiting data of size = " << this->getDataSize() << ", " + << "Received data size = " << field.numElements() << " ] " + << "The data array does not have the right size! " + << "Grid = " << this->getId()) +//#endif + this->maskField_arr(field.dataFirst(), stored, isTiled); + } + + template + void CGrid::outputField(const CArray& stored, CArray& field) const + TRY + { +//#ifdef __XIOS_DEBUG + if (this->getDataSize() != field.numElements()) + ERROR("void CGrid::outputField(const CArray& stored, CArray& field) const", + << "[ Size of the data = " << this->getDataSize() << ", " + << "Output data size = " << field.numElements() << " ] " + << "The ouput array does not have the right size! " + << "Grid = " << this->getId()) +//#endif + this->restoreField_arr(stored, field.dataFirst()); + } + CATCH + + /*! + This function removes the effect of mask on received data on the server. + This function only serve for the checking purpose. TODO: Something must be done to seperate mask and data_index from each other in received data + \data data received data with masking effect on the server + \outData data without masking effect + */ + template + void CGrid::uncompressField(const CArray& data, CArray& outData) const + TRY + { + uncompressField_arr(data.dataFirst(), outData); + } + CATCH + + template + void CGrid::checkGridMask(CArray& gridMask, + const std::vector* >& domainMasks, + const std::vector* >& axisMasks, + const CArray& axisDomainOrder, + bool createMask) + TRY + { + int idx = 0; + int numElement = axisDomainOrder.numElements(); + int dim = domainMasks.size() * 2 + axisMasks.size(); + std::vector domainP = this->getDomains(); + std::vector axisP = this->getAxis(); + + std::vector idxLoop(dim,0), indexMap(numElement), eachDimSize(dim); + std::vector currentIndex(dim); + int idxDomain = 0, idxAxis = 0; + for (int i = 0; i < numElement; ++i) + { + indexMap[i] = idx; + if (2 == axisDomainOrder(i)) { + eachDimSize[indexMap[i]] = domainP[idxDomain]->ni; + eachDimSize[indexMap[i]+1] = domainP[idxDomain]->nj; + idx += 2; ++idxDomain; + } + else if (1 == axisDomainOrder(i)) { +// eachDimSize[indexMap[i]] = axisMasks[idxAxis]->numElements(); + eachDimSize[indexMap[i]] = axisP[idxAxis]->n; + ++idx; ++idxAxis; + } + else {}; + } + + if (!gridMask.isEmpty() && !createMask) + { + for (int i = 0; i < dim; ++i) + { + if (gridMask.extent(i) != eachDimSize[i]) + ERROR("CGrid::checkMask(void)", + << "The mask has one dimension whose size is different from the one of the local grid." << std::endl + << "Local size of dimension " << i << " is " << eachDimSize[i] << "." << std::endl + << "Mask size for dimension " << i << " is " << gridMask.extent(i) << "." << std::endl + << "Grid = " << this->getId()) + } + } + else { + CArrayBoolTraits >::resizeArray(gridMask,eachDimSize); + gridMask = true; + } + + int ssize = gridMask.numElements(); + idx = 0; + while (idx < ssize) + { + for (int i = 0; i < dim-1; ++i) + { + if (idxLoop[i] == eachDimSize[i]) + { + idxLoop[i] = 0; + ++idxLoop[i+1]; + } + } + + // Find out outer index + idxDomain = idxAxis = 0; + bool maskValue = true; + for (int i = 0; i < numElement; ++i) + { + if (2 == axisDomainOrder(i)) + { + int idxTmp = idxLoop[indexMap[i]] + idxLoop[indexMap[i]+1] * eachDimSize[indexMap[i]]; + if (idxTmp < (*domainMasks[idxDomain]).numElements()) + maskValue = maskValue && (*domainMasks[idxDomain])(idxTmp); + else + maskValue = false; + ++idxDomain; + } + else if (1 == axisDomainOrder(i)) + { + int idxTmp = idxLoop[indexMap[i]]; + if (idxTmp < (*axisMasks[idxAxis]).numElements()) + maskValue = maskValue && (*axisMasks[idxAxis])(idxTmp); + else + maskValue = false; + + ++idxAxis; + } + } + + int maskIndex = idxLoop[0]; + int mulDim = 1; + for (int k = 1; k < dim; ++k) + { + mulDim *= eachDimSize[k-1]; + maskIndex += idxLoop[k]*mulDim; + } + *(gridMask.dataFirst()+maskIndex) &= maskValue; + + ++idxLoop[0]; + ++idx; + } + } + CATCH_DUMP_ATTR + + template + void CGrid::modifyGridMaskSize(CArray& gridMask, + const std::vector& eachDimSize, + bool newValue) + TRY + { + if (N != eachDimSize.size()) + { + // ERROR("CGrid::modifyGridMaskSize(CArray& gridMask, + // const std::vector& eachDimSize, + // bool newValue)", + // << "Dimension size of the mask is different from input dimension size." << std::endl + // << "Mask dimension is " << N << "." << std::endl + // << "Input dimension is " << eachDimSize.size() << "." << std::endl + // << "Grid = " << this->getId()) + } + CArrayBoolTraits >::resizeArray(gridMask,eachDimSize); + gridMask = newValue; + } + CATCH_DUMP_ATTR + + + /*! + Modify the current mask of grid, the local index to be modified will take value false + \param [in/out] gridMask current mask of grid + \param [in] indexToModify local index to modify + */ + template + void CGrid::modifyGridMask(CArray& gridMask, const CArray& indexToModify, bool valueToModify) + TRY + { + int num = indexToModify.numElements(); + for (int idx = 0; idx < num; ++idx) + { + *(gridMask.dataFirst()+indexToModify(idx)) = valueToModify; + } + } + CATCH_DUMP_ATTR - private: - map> clientFromServerConnector_ ; - public: - shared_ptr getClientFromServerConnector(CContextClient* client) { return clientFromServerConnector_[client];} - void computeClientFromServerConnector(void) ; + ///-------------------------------------------------------------- - private: - shared_ptr serverToClientConnector_=nullptr ; - public: - shared_ptr getServerToClientConnector(void) { if (serverToClientConnector_==nullptr) computeServerToClientConnector() ; return serverToClientConnector_;} - void computeServerToClientConnector(void) ; - private: - map> clientToServerConnector_ ; - public: - shared_ptr getClientToServerConnector(CContextClient* client) { return clientToServerConnector_[client] ;} // make some test to see if connector exits for the given client - - private: - shared_ptr serverFromClientConnector_ = nullptr ; - public: - shared_ptr getServerFromClientConnector(void) { if (serverFromClientConnector_==nullptr) computeServerFromClientConnector() ; return serverFromClientConnector_;} - void computeServerFromClientConnector(void) ; - }; // class CGrid // Declare/Define CGridGroup and CGridDefinition DECLARE_GROUP(CGrid); diff --git a/xios_2311_src/src/node/interpolate_axis.cpp b/xios_2311_src/src/node/interpolate_axis.cpp index 1f0e1db154f2db2ffa7af02f2383b76f58cbfa27..ae7586703bd25df1b215be2ee216980ecc93be6c 100644 --- a/xios_2311_src/src/node/interpolate_axis.cpp +++ b/xios_2311_src/src/node/interpolate_axis.cpp @@ -1,6 +1,4 @@ #include "interpolate_axis.hpp" -#include "axis_algorithm_interpolate_coordinate.hpp" -#include "axis_algorithm_interpolate.hpp" #include "type.hpp" #include "field.hpp" @@ -28,7 +26,7 @@ namespace xios { bool CInterpolateAxis::registerTrans() { - return registerTransformation(TRANS_INTERPOLATE_AXIS, {create, getTransformation}); + return registerTransformation(TRANS_INTERPOLATE_AXIS, CInterpolateAxis::create); } bool CInterpolateAxis::_dummyRegistered = CInterpolateAxis::registerTrans(); @@ -42,6 +40,8 @@ namespace xios { void CInterpolateAxis::checkValid(CAxis* axisSrc) { if (this->order.isEmpty()) this->order.setValue(1); + if (this->coordinate.isEmpty() && !this->coordinate_src.isEmpty()) this->coordinate.setValue(this->coordinate_src.getValue()); + if (this->coordinate_src.isEmpty() && !this->coordinate.isEmpty()) this->coordinate_src.setValue(this->coordinate.getValue()); int order = this->order.getValue(); if (order >= axisSrc->n_glo.getValue()) { @@ -59,74 +59,56 @@ namespace xios { << "Order of interpolation is " << order ); } - if (!this->coordinate.isEmpty() && (!this->coordinate_src.isEmpty() || !this->coordinate_dst.isEmpty())) - { - ERROR("CInterpolateAxis::checkValid(CAxis* axisSrc)", - << " is incompatible with or attributes. attribute is present only for backward" - << "compatibility and is now declared obsolete") ; - } if (!this->coordinate.isEmpty()) { + StdString coordinate = this->coordinate.getValue(); if (!CField::has(coordinate)) ERROR("CInterpolateAxis::checkValid(CAxis* axisSrc)", << "Coordinate field whose id " << coordinate << "does not exist " << "Please define one"); } - - if (!this->coordinate_src.isEmpty()) - { - if (!CField::has(coordinate_src)) - ERROR("CInterpolateAxis::checkValid(CAxis* axisSrc)", - << "Coordinate field whose id " << coordinate_src << "does not exist " - << "Please define one"); - } - + if (!this->coordinate_dst.isEmpty()) { - if (!CField::has(coordinate_dst)) + StdString coordinate = this->coordinate_dst.getValue(); + if (!CField::has(coordinate)) ERROR("CInterpolateAxis::checkValid(CAxis* axisSrc)", - << "Coordinate field whose id " << coordinate_dst << "does not exist " + << "Coordinate field whose id " << coordinate << "does not exist " << "Please define one"); } + } std::vector CInterpolateAxis::checkAuxInputs_() { std::vector auxInputs; - - if (!this->coordinate.isEmpty() && (!this->coordinate_src.isEmpty() || !this->coordinate_dst.isEmpty())) - { - ERROR("std::vector CInterpolateAxis::checkAuxInputs_()", - << " is incompatible with or attributes. attribute is present only for backward" - << "compatibility and is now declared obsolete") ; - } - - if (!this->coordinate.isEmpty()) + if (!this->coordinate.isEmpty() && this->coordinate_src.isEmpty()) { StdString coordinate = this->coordinate.getValue(); + this->coordinate_src.setValue(coordinate); if (!CField::has(coordinate)) - ERROR("std::vector CInterpolateAxis::checkAuxInputs_()", + ERROR("CInterpolateAxis::checkValid(CAxis* axisSrc)", << "Coordinate field whose id " << coordinate << "does not exist " << "Please define one"); auxInputs.push_back(coordinate); } - - if (!this->coordinate_src.isEmpty()) + if (!this->coordinate_src.isEmpty() || !this->coordinate.isEmpty()) { - StdString coordinate = this->coordinate_src.getValue(); + StdString coordinate = !this->coordinate.isEmpty()? this->coordinate.getValue():this->coordinate_src.getValue(); + this->coordinate.setValue(coordinate); if (!CField::has(coordinate)) - ERROR("std::vector CInterpolateAxis::checkAuxInputs_()", + ERROR("CInterpolateAxis::checkValid(CAxis* axisSrc)", << "Coordinate field whose id " << coordinate << "does not exist " << "Please define one"); auxInputs.push_back(coordinate); } - + if (!this->coordinate_dst.isEmpty()) { StdString coordinate = this->coordinate_dst.getValue(); if (!CField::has(coordinate)) - ERROR("std::vector CInterpolateAxis::checkAuxInputs_()", + ERROR("CInterpolateAxis::checkValid(CAxis* axisSrc)", << "Coordinate field whose id " << coordinate << "does not exist " << "Please define one"); auxInputs.push_back(coordinate); @@ -134,24 +116,4 @@ namespace xios { return auxInputs; } - - shared_ptr CInterpolateAxis::createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) - { - if (!coordinate.isEmpty() || !coordinate_src.isEmpty() || !coordinate_dst.isEmpty()) - return CAxisAlgorithmInterpolateCoordinate::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, - elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, - elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition); - - else return CAxisAlgorithmInterpolate::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, - elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, - elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition); - } } diff --git a/xios_2311_src/src/node/interpolate_axis.hpp b/xios_2311_src/src/node/interpolate_axis.hpp index 006422b8af8d8827cf991c07c2add583fc64d8f0..2cecc5b04ac44a687a48368a3f3ca1c4eb69c520 100644 --- a/xios_2311_src/src/node/interpolate_axis.hpp +++ b/xios_2311_src/src/node/interpolate_axis.hpp @@ -19,8 +19,7 @@ namespace xios { class CInterpolateAxisAttributes; class CInterpolateAxis; class CAxis; - class CGenericAlgorithmTransformation ; - class CGrid; + ///-------------------------------------------------------------- // Declare/Define CFileAttribute @@ -41,8 +40,6 @@ namespace xios { public : typedef CObjectTemplate SuperClass; typedef CInterpolateAxisAttributes SuperClassAttribute; - typedef CInterpolateAxis MyClass ; - typedef CTransformation SuperTransform ; public : /// Constructeurs /// @@ -60,19 +57,6 @@ namespace xios { static StdString GetName(void); static StdString GetDefName(void); static ENodeType GetType(void); - const string& getId(void) { return this->SuperClass::getId();} - ETranformationType getTransformationType(void) { return TRANS_INTERPOLATE_AXIS ;} - static CTransformation* getTransformation(const StdString& id) { return SuperClass::get(id);} - virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} - virtual shared_ptr createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) ; private: static bool registerTrans(); static CTransformation* create(const StdString& id, xml::CXMLNode* node); diff --git a/xios_2311_src/src/node/interpolate_domain.cpp b/xios_2311_src/src/node/interpolate_domain.cpp index 076524ee7bba8db16c3098a2175582ff1387611f..58917b53e607ce3d90bc8aca890d295a11900feb 100644 --- a/xios_2311_src/src/node/interpolate_domain.cpp +++ b/xios_2311_src/src/node/interpolate_domain.cpp @@ -1,5 +1,4 @@ #include "interpolate_domain.hpp" -#include "domain_algorithm_interpolate.hpp" #include "type.hpp" namespace xios { @@ -27,7 +26,7 @@ namespace xios { bool CInterpolateDomain::_dummyRegistered = CInterpolateDomain::registerTrans(); bool CInterpolateDomain::registerTrans() { - return registerTransformation(TRANS_INTERPOLATE_DOMAIN, {create, getTransformation}); + return registerTransformation(TRANS_INTERPOLATE_DOMAIN, create); } //---------------------------------------------------------------- @@ -68,18 +67,4 @@ namespace xios { } - shared_ptr CInterpolateDomain::createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) - { - return CDomainAlgorithmInterpolate::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, - elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, - elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition); - } } diff --git a/xios_2311_src/src/node/interpolate_domain.hpp b/xios_2311_src/src/node/interpolate_domain.hpp index e21cb980d9b8704d2caa5ee33a8f1294fd0fb80b..c850fc5aee41877f627af8290cd848215f9a08dc 100644 --- a/xios_2311_src/src/node/interpolate_domain.hpp +++ b/xios_2311_src/src/node/interpolate_domain.hpp @@ -19,8 +19,7 @@ namespace xios { class CInterpolateDomainAttributes; class CInterpolateDomain; class CDomain; - class CGenericAlgorithmTransformation ; - class CGrid; + ///-------------------------------------------------------------- // Declare/Define CFileAttribute @@ -41,8 +40,6 @@ namespace xios { public : typedef CObjectTemplate SuperClass; typedef CInterpolateDomainAttributes SuperClassAttribute; - typedef CInterpolateDomain MyClass ; - typedef CTransformation SuperTransform ; public : /// Constructeurs /// @@ -58,19 +55,6 @@ namespace xios { static StdString GetName(void); static StdString GetDefName(void); static ENodeType GetType(void); - const string& getId(void) { return this->SuperClass::getId();} - ETranformationType getTransformationType(void) { return TRANS_INTERPOLATE_DOMAIN ;} - static CTransformation* getTransformation(const StdString& id) { return SuperClass::get(id);} - virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} - virtual shared_ptr createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) ; private: static bool registerTrans(); static CTransformation* create(const StdString& id, xml::CXMLNode* node); diff --git a/xios_2311_src/src/node/inverse_axis.cpp b/xios_2311_src/src/node/inverse_axis.cpp index f05b7000d4535ac6295656eb682b0efc475707d5..999cd5b4c704c51b16baa6bfb62533f6488fe9ba 100644 --- a/xios_2311_src/src/node/inverse_axis.cpp +++ b/xios_2311_src/src/node/inverse_axis.cpp @@ -1,5 +1,4 @@ #include "inverse_axis.hpp" -#include "axis_algorithm_inverse.hpp" #include "type.hpp" namespace xios { @@ -26,7 +25,7 @@ namespace xios { bool CInverseAxis::registerTrans() { - return registerTransformation(TRANS_INVERSE_AXIS, {create, getTransformation}); + return registerTransformation(TRANS_INVERSE_AXIS, CInverseAxis::create); } bool CInverseAxis::_dummyRegistered = CInverseAxis::registerTrans(); @@ -39,18 +38,4 @@ namespace xios { void CInverseAxis::checkValid(CAxis* axisSrc) {} - shared_ptr CInverseAxis::createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) - { - return CAxisAlgorithmInverse::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, - elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, - elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition) ; - } } diff --git a/xios_2311_src/src/node/inverse_axis.hpp b/xios_2311_src/src/node/inverse_axis.hpp index b8f0e675b301c4dc08d8a3d16cffc5885d2fdf68..18875671d9604cfd509e5eef9c1d09d670f1632a 100644 --- a/xios_2311_src/src/node/inverse_axis.hpp +++ b/xios_2311_src/src/node/inverse_axis.hpp @@ -18,8 +18,6 @@ namespace xios { class CInverseAxisAttributes; class CInverseAxis; class CAxis; - class CGenericAlgorithmTransformation ; - class CGrid; ///-------------------------------------------------------------- // Declare/Define CFileAttribute @@ -40,8 +38,6 @@ namespace xios { public : typedef CObjectTemplate SuperClass; typedef CInverseAxisAttributes SuperClassAttribute; - typedef CInverseAxis MyClass ; - typedef CTransformation SuperTransform ; public : /// Constructeurs /// @@ -57,19 +53,7 @@ namespace xios { static StdString GetName(void); static StdString GetDefName(void); static ENodeType GetType(void); - const string& getId(void) { return this->SuperClass::getId();} - ETranformationType getTransformationType(void) { return TRANS_INVERSE_AXIS ;} - static CTransformation* getTransformation(const StdString& id) { return SuperClass::get(id);} - virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} - virtual shared_ptr createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) ; + private: static bool registerTrans(); static CTransformation* create(const StdString& id, xml::CXMLNode* node); diff --git a/xios_2311_src/src/node/mesh.cpp b/xios_2311_src/src/node/mesh.cpp index ee04626348354284888207f27ef23d52c318625c..18071bad7d369544376d9fbf05fc7da68b2a9ebe 100755 --- a/xios_2311_src/src/node/mesh.cpp +++ b/xios_2311_src/src/node/mesh.cpp @@ -66,9 +66,6 @@ namespace xios { CMesh::meshList.insert( make_pair(meshName, newMesh) ); return &meshList[meshName]; } - - MISSING_RETURN( "CMesh* CMesh::getMesh (StdString meshName, int nvertex)" ); - return nullptr; } ///---------------------------------------------------------------- @@ -429,29 +426,48 @@ namespace xios { if (nvertex == 1) { + if (nodesAreWritten) return ; + nbNodes_ = lonvalue.numElements(); node_lon.resize(nbNodes_); node_lat.resize(nbNodes_); node_lon = lonvalue; node_lat = latvalue; + unsigned long nodeCount = nbNodes_; + unsigned long nodeStart, nbNodes; + MPI_Scan(&nodeCount, &nodeStart, 1, MPI_UNSIGNED_LONG, MPI_SUM, comm); + int nNodes = nodeStart; + MPI_Bcast(&nNodes, 1, MPI_UNSIGNED_LONG, mpiSize-1, comm); + nbNodesGlo = nNodes; + + nodeStart -= nodeCount; + node_start = nodeStart; + node_count = nodeCount; + // Global node indexes vector hashValues(4); CClientClientDHTSizet::Index2VectorInfoTypeMap nodeHash2IdxGlo; for (size_t nn = 0; nn < nbNodes_; ++nn) { +// cout<<"MESH : "<<"node inserted : ("<< lonvalue(nn)<<","<< latvalue(nn)<<") index glo "< " ; hashValues = CMesh::createHashes(lonvalue(nn), latvalue(nn)); for (size_t nh = 0; nh < 4; ++nh) { - nodeHash2IdxGlo[hashValues[nh]].push_back(mpiRank*nbNodes_ + nn); + nodeHash2IdxGlo[hashValues[nh]].push_back(nodeStart + nn); +// cout<second[0]; else nodeIdxGlo2 = it->second[0]; + +// cout<<"("< 2 { + if (facesAreWritten) return ; + nbFaces_ = bounds_lon.shape()[1]; face_lon.resize(nbFaces_); face_lat.resize(nbFaces_); @@ -688,6 +714,8 @@ namespace xios { unsigned long nbFacesAccum; MPI_Scan(&nbFacesOnProc, &nbFacesAccum, 1, MPI_UNSIGNED_LONG, MPI_SUM, comm); nbFacesAccum -= nbFaces_; +// cout<getInfoIndexMap(); CClientClientDHTSizet::Index2VectorInfoTypeMap::iterator it1, it2; CArray edgeHashList(nbFaces_*nvertex); + size_t nEdge = 0; for (int nf = 0; nf < nbFaces_; ++nf) { @@ -770,6 +799,8 @@ namespace xios { { size_t faceIdxGlo = nbFacesAccum + nf; size_t edgeHash = hashPairOrdered(it1->second[0], it2->second[0]); +// cout<<"MESH : "<<"find edge : ("<second[0]<<" & "<second[0]<second[0]; face_edges(nv1,nf) = edgeIdxGlo; @@ -989,8 +1020,7 @@ namespace xios { } } } - if (nEdgeHash==0) edgeHashList.resize(nEdgeHash); - else edgeHashList.resizeAndPreserve(nEdgeHash); + edgeHashList.resizeAndPreserve(nEdgeHash); // (2.3) Generating global edge indexes // The ownership criterion: priority of the process with smaller rank @@ -1295,7 +1325,7 @@ namespace xios { } } -// CDHTAutoIndexing dhtNodeIdxGlo = CDHTAutoIndexing(nodeIdx2Idx, comm); + // CDHTAutoIndexing dhtNodeIdxGlo = CDHTAutoIndexing(nodeIdx2Idx, comm); // CDHTAutoIndexing will not give consistent node numbering for varying number of procs. => // Solution: global node indexing by hand. // Maps modified in this step: @@ -1331,17 +1361,17 @@ namespace xios { } } } - if (nIdx==0) nodeIdxList.resize(nIdx); - else nodeIdxList.resizeAndPreserve(nIdx); + nodeIdxList.resizeAndPreserve(nIdx); CClientClientDHTSizet dhtNodeIdx(nodeIdx2Idx, comm); dhtNodeIdx.computeIndexInfoMapping(nodeIdxList); CClientClientDHTSizet::Index2VectorInfoTypeMap& nodeIdx2IdxGlo = dhtNodeIdx.getInfoIndexMap(); // (3.3) Saving node data: node_lon, node_lat, and face_nodes // Generating edgeHash2Info = > and edgeHashList -// nbNodesGlo = dhtNodeIdxGlo.getNbIndexesGlobal(); -// node_count = dhtNodeIdxGlo.getIndexCount(); -// node_start = dhtNodeIdxGlo.getIndexStart(); + + // nbNodesGlo = dhtNodeIdxGlo.getNbIndexesGlobal(); + // node_count = dhtNodeIdxGlo.getIndexCount(); + // node_start = dhtNodeIdxGlo.getIndexStart(); node_lon.resize(node_count); node_lat.resize(node_count); size_t nodeIdxGlo1 = 0; @@ -1382,8 +1412,7 @@ namespace xios { face_nodes(nv1,nf) = nodeIdxGlo1; } } - if (nEdgeHash==0) edgeHashList.resize(nEdgeHash); - else edgeHashList.resizeAndPreserve(nEdgeHash); + edgeHashList.resizeAndPreserve(nEdgeHash); // (3.4) Generating global edge indexes // Maps generated in this step are: @@ -1471,9 +1500,9 @@ namespace xios { // (3.5) Saving variables: edge_lon, edge_lat, face_edges // Creating map edgeIdxGlo2Face -// nbEdgesGlo = dhtEdgeIdxGlo.getNbIndexesGlobal(); -// edge_count = dhtEdgeIdxGlo.getIndexCount(); -// edge_start = dhtEdgeIdxGlo.getIndexStart(); + // nbEdgesGlo = dhtEdgeIdxGlo.getNbIndexesGlobal(); + // edge_count = dhtEdgeIdxGlo.getIndexCount(); + // edge_start = dhtEdgeIdxGlo.getIndexStart(); edge_lon.resize(edge_count); edge_lat.resize(edge_count); @@ -1607,6 +1636,7 @@ namespace xios { } // createMeshEpsilon + ///---------------------------------------------------------------- /*! * \fn void CMesh::getGloNghbFacesNodeType(const MPI_Comm& comm, const CArray& face_idx, @@ -1760,8 +1790,7 @@ namespace xios { } } } - if (nbNghb==0) nghbFaces.resize(2, nbNghb); - else nghbFaces.resizeAndPreserve(2, nbNghb); + nghbFaces.resizeAndPreserve(2, nbNghb); } // getGloNghbFacesNodeType ///---------------------------------------------------------------- @@ -1813,8 +1842,7 @@ namespace xios { } } } - if (iIdx==0) nodeHashList.resize(iIdx); - else nodeHashList.resizeAndPreserve(iIdx); + nodeHashList.resizeAndPreserve(iIdx); // (1.2) Generating node indexes // The ownership criterion: priority of the process holding the smaller index @@ -1942,8 +1970,7 @@ namespace xios { } // nodeIdxMin1 != nodeIdxMin2 } } - if (nbNghb==0) nghbFaces.resize(2, nbNghb); - else nghbFaces.resizeAndPreserve(2, nbNghb); + nghbFaces.resizeAndPreserve(2, nbNghb); } // getGloNghbFacesEdgeType ///---------------------------------------------------------------- diff --git a/xios_2311_src/src/node/node_enum.hpp b/xios_2311_src/src/node/node_enum.hpp index f00d26ad8b968489b744542bb1d14010fe3b8a76..6d6e69d15fdd02619ac34fe2754ca4a722dae3ac 100644 --- a/xios_2311_src/src/node/node_enum.hpp +++ b/xios_2311_src/src/node/node_enum.hpp @@ -14,8 +14,6 @@ namespace xios eDomain,gDomain, eField,gField, eFile,gFile, - eCouplerIn,gCouplerIn, - eCouplerOut,gCouplerOut, eGrid,gGrid, eVariable,gVariable, eContext,gContext, diff --git a/xios_2311_src/src/node/node_type.hpp b/xios_2311_src/src/node/node_type.hpp index 4902d32c3453ef68f0f2eb60e43073f158e22c7e..ad72c8f81ccd64b4345d45a2e1625abbd025f271 100644 --- a/xios_2311_src/src/node/node_type.hpp +++ b/xios_2311_src/src/node/node_type.hpp @@ -5,8 +5,6 @@ #include "domain.hpp" #include "field.hpp" #include "file.hpp" -#include "coupler_in.hpp" -#include "coupler_out.hpp" #include "grid.hpp" #include "variable.hpp" #include "context.hpp" diff --git a/xios_2311_src/src/node/reduce_axis_to_axis.cpp b/xios_2311_src/src/node/reduce_axis_to_axis.cpp index 2396173ad718b818248576000d4d271cf405f107..6393d81b5e07f84c1236ea65e214b176452ce179 100644 --- a/xios_2311_src/src/node/reduce_axis_to_axis.cpp +++ b/xios_2311_src/src/node/reduce_axis_to_axis.cpp @@ -1,5 +1,4 @@ #include "reduce_axis_to_axis.hpp" -#include "axis_algorithm_reduce_axis.hpp" #include "type.hpp" #include "axis.hpp" @@ -27,7 +26,7 @@ namespace xios { bool CReduceAxisToAxis::registerTrans() { - return registerTransformation(TRANS_REDUCE_AXIS_TO_AXIS, {create, getTransformation}); + return registerTransformation(TRANS_REDUCE_AXIS_TO_AXIS, CReduceAxisToAxis::create); } bool CReduceAxisToAxis::_dummyRegistered = CReduceAxisToAxis::registerTrans(); @@ -56,18 +55,4 @@ namespace xios { } - shared_ptr CReduceAxisToAxis::createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) - { - return CAxisAlgorithmReduceAxis::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, - elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, - elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition); - } } diff --git a/xios_2311_src/src/node/reduce_axis_to_axis.hpp b/xios_2311_src/src/node/reduce_axis_to_axis.hpp index 3059c02c85977893a2859f870bddfe6e4ba79ce2..326d011e03c9eab980380fece82d3e8128e59e2d 100644 --- a/xios_2311_src/src/node/reduce_axis_to_axis.hpp +++ b/xios_2311_src/src/node/reduce_axis_to_axis.hpp @@ -18,8 +18,7 @@ namespace xios { class CReduceAxisToAxisAttributes; class CReduceAxisToAxis; class CAxis; - class CGenericAlgorithmTransformation ; - class CGrid; + ///-------------------------------------------------------------- // Declare/Define CFileAttribute @@ -40,8 +39,6 @@ namespace xios { public : typedef CObjectTemplate SuperClass; typedef CReduceAxisToAxisAttributes SuperClassAttribute; - typedef CReduceAxisToAxis MyClass ; - typedef CTransformation SuperTransform ; public : /// Constructeurs /// @@ -57,20 +54,7 @@ namespace xios { static StdString GetName(void); static StdString GetDefName(void); static ENodeType GetType(void); - const string& getId(void) { return this->SuperClass::getId();} - ETranformationType getTransformationType(void) { return TRANS_REDUCE_AXIS_TO_AXIS ;} - static CTransformation* getTransformation(const StdString& id) { return SuperClass::get(id);} - virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} - virtual shared_ptr createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) ; - private: + private: static bool registerTrans(); static CTransformation* create(const StdString& id, xml::CXMLNode* node); static bool _dummyRegistered; diff --git a/xios_2311_src/src/node/reduce_axis_to_scalar.cpp b/xios_2311_src/src/node/reduce_axis_to_scalar.cpp index 776717e7b564b02f8a20563050d928d62cdb7757..d0cc1b6866435b197f865b6add9c34b0fbba8e7a 100644 --- a/xios_2311_src/src/node/reduce_axis_to_scalar.cpp +++ b/xios_2311_src/src/node/reduce_axis_to_scalar.cpp @@ -1,5 +1,4 @@ #include "reduce_axis_to_scalar.hpp" -#include "scalar_algorithm_reduce_axis.hpp" #include "type.hpp" namespace xios { @@ -26,7 +25,7 @@ namespace xios { bool CReduceAxisToScalar::registerTrans() { - return registerTransformation(TRANS_REDUCE_AXIS_TO_SCALAR, {create, getTransformation}); + return registerTransformation(TRANS_REDUCE_AXIS_TO_SCALAR, CReduceAxisToScalar::create); } bool CReduceAxisToScalar::_dummyRegistered = CReduceAxisToScalar::registerTrans(); @@ -41,18 +40,4 @@ namespace xios { { } - shared_ptr CReduceAxisToScalar::createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) - { - return CScalarAlgorithmReduceAxis::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, - elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, - elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition); - } } diff --git a/xios_2311_src/src/node/reduce_axis_to_scalar.hpp b/xios_2311_src/src/node/reduce_axis_to_scalar.hpp index fee4dcd99e9b4b1da617a840feffec1a26f4c543..de5f89ab83018704310399d69bb51bad3021ce97 100644 --- a/xios_2311_src/src/node/reduce_axis_to_scalar.hpp +++ b/xios_2311_src/src/node/reduce_axis_to_scalar.hpp @@ -18,8 +18,7 @@ namespace xios { class CReduceAxisToScalarAttributes; class CReduceAxisToScalar; class CScalar; - class CGenericAlgorithmTransformation ; - class CGrid; + ///-------------------------------------------------------------- // Declare/Define CFileAttribute @@ -40,8 +39,6 @@ namespace xios { public : typedef CObjectTemplate SuperClass; typedef CReduceAxisToScalarAttributes SuperClassAttribute; - typedef CReduceAxisToScalar MyClass ; - typedef CTransformation SuperTransform ; public : /// Constructeurs /// @@ -57,19 +54,6 @@ namespace xios { static StdString GetName(void); static StdString GetDefName(void); static ENodeType GetType(void); - const string& getId(void) { return this->SuperClass::getId();} - ETranformationType getTransformationType(void) { return TRANS_REDUCE_AXIS_TO_SCALAR ;} - static CTransformation* getTransformation(const StdString& id) { return SuperClass::get(id);} - virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} - virtual shared_ptr createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) ; private: static bool registerTrans(); static CTransformation* create(const StdString& id, xml::CXMLNode* node); diff --git a/xios_2311_src/src/node/reduce_domain_to_axis.cpp b/xios_2311_src/src/node/reduce_domain_to_axis.cpp index 0fdc48fbe0050cc2ed367a7c28b30bd63fce81d3..9038137ca779b6d71a22290c2661aea445eeceb1 100644 --- a/xios_2311_src/src/node/reduce_domain_to_axis.cpp +++ b/xios_2311_src/src/node/reduce_domain_to_axis.cpp @@ -1,5 +1,4 @@ #include "reduce_domain_to_axis.hpp" -#include "axis_algorithm_reduce_domain.hpp" #include "type.hpp" #include "axis.hpp" #include "domain.hpp" @@ -28,7 +27,7 @@ namespace xios { bool CReduceDomainToAxis::registerTrans() { - return registerTransformation(TRANS_REDUCE_DOMAIN_TO_AXIS, {create, getTransformation}); + return registerTransformation(TRANS_REDUCE_DOMAIN_TO_AXIS, CReduceDomainToAxis::create); } bool CReduceDomainToAxis::_dummyRegistered = CReduceDomainToAxis::registerTrans(); @@ -47,6 +46,10 @@ namespace xios { << "Domain source " <getId() << std::endl << "Axis destination " << axisDst->getId()); + int axis_n_glo = axisDst->n_glo; + int domain_ni_glo = domainSrc->ni_glo; + int domain_nj_glo = domainSrc->nj_glo; + if (this->operation.isEmpty()) ERROR("CReduceDomainToAxis::checkValid(CAxis* axisDst, CDomain* domainSrc)", << "An operation must be defined." @@ -60,20 +63,27 @@ namespace xios { << "Axis destination " << axisDst->getId()); if (this->local.isEmpty()) local=false ; - } + switch (direction) + { + case direction_attr::jDir: + if (axis_n_glo != domain_ni_glo) + ERROR("CReduceDomainToAxis::checkValid(CAxis* axisDst, CDomain* domainSrc)", + << "Extract domain along j, axis destination should have n_glo equal to ni_glo of domain source" + << "Domain source " <getId() << " has nj_glo " << domain_ni_glo << std::endl + << "Axis destination " << axisDst->getId() << " has n_glo " << axis_n_glo); + break; - shared_ptr CReduceDomainToAxis::createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) - { - return CAxisAlgorithmReduceDomain::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, - elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, - elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition) ; + case direction_attr::iDir: + if (axis_n_glo != domain_nj_glo) + ERROR("CReduceDomainToAxis::checkValid(CAxis* axisDst, CDomain* domainSrc)", + << "Extract domain along i, axis destination should have n_glo equal to nj_glo of domain source" + << "Domain source " <getId() << " has nj_glo " << domain_nj_glo << std::endl + << "Axis destination " << axisDst->getId() << " has n_glo " << axis_n_glo); + break; + + default: + break; + } } + } diff --git a/xios_2311_src/src/node/reduce_domain_to_axis.hpp b/xios_2311_src/src/node/reduce_domain_to_axis.hpp index 212800c5f29b4402d5a382894559df5af0f6c8d8..90753ba3c5ff1f68d99bcef0a4fa53538d6a96ad 100644 --- a/xios_2311_src/src/node/reduce_domain_to_axis.hpp +++ b/xios_2311_src/src/node/reduce_domain_to_axis.hpp @@ -19,8 +19,7 @@ namespace xios { class CReduceDomainToAxis; class CAxis; class CDomain; - class CGenericAlgorithmTransformation ; - class CGrid; + ///-------------------------------------------------------------- // Declare/Define CFileAttribute @@ -41,8 +40,6 @@ namespace xios { public : typedef CObjectTemplate SuperClass; typedef CReduceDomainToAxisAttributes SuperClassAttribute; - typedef CReduceDomainToAxis MyClass ; - typedef CTransformation SuperTransform ; public : /// Constructeurs /// @@ -58,20 +55,7 @@ namespace xios { static StdString GetName(void); static StdString GetDefName(void); static ENodeType GetType(void); - const string& getId(void) { return this->SuperClass::getId();} - ETranformationType getTransformationType(void) { return TRANS_REDUCE_DOMAIN_TO_AXIS ;} - static CTransformation* getTransformation(const StdString& id) { return SuperClass::get(id);} - virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} - virtual shared_ptr createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) ; - private: + private: static bool registerTrans(); static CTransformation* create(const StdString& id, xml::CXMLNode* node); static bool _dummyRegistered; diff --git a/xios_2311_src/src/node/reduce_domain_to_scalar.cpp b/xios_2311_src/src/node/reduce_domain_to_scalar.cpp index b6b7e86a8d63d49d4e8b4dca2c39930e10d92322..a7f7bce29b1fe2fa574806b9a830ea543a5c541c 100644 --- a/xios_2311_src/src/node/reduce_domain_to_scalar.cpp +++ b/xios_2311_src/src/node/reduce_domain_to_scalar.cpp @@ -1,5 +1,4 @@ #include "reduce_domain_to_scalar.hpp" -#include "scalar_algorithm_reduce_domain.hpp" #include "type.hpp" namespace xios { @@ -26,7 +25,7 @@ namespace xios { bool CReduceDomainToScalar::registerTrans() { - return registerTransformation(TRANS_REDUCE_DOMAIN_TO_SCALAR, {create, getTransformation}); + return registerTransformation(TRANS_REDUCE_DOMAIN_TO_SCALAR, CReduceDomainToScalar::create); } bool CReduceDomainToScalar::_dummyRegistered = CReduceDomainToScalar::registerTrans(); @@ -42,18 +41,4 @@ namespace xios { if (this->local.isEmpty()) local=false ; } - shared_ptr CReduceDomainToScalar::createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) - { - return CScalarAlgorithmReduceDomain::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, - elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, - elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition) ; - } } diff --git a/xios_2311_src/src/node/reduce_domain_to_scalar.hpp b/xios_2311_src/src/node/reduce_domain_to_scalar.hpp index a735ffeece1d81bd29a6fc3a2d5e3c19100e4dab..4d5efbfa99980e6ec1d91658bcc41ca98e6d79f5 100644 --- a/xios_2311_src/src/node/reduce_domain_to_scalar.hpp +++ b/xios_2311_src/src/node/reduce_domain_to_scalar.hpp @@ -19,8 +19,7 @@ namespace xios { class CReduceDomainToScalar; class CDomain; class CScalar; - class CGenericAlgorithmTransformation ; - class CGrid; + ///-------------------------------------------------------------- // Declare/Define CFileAttribute @@ -41,8 +40,6 @@ namespace xios { public : typedef CObjectTemplate SuperClass; typedef CReduceDomainToScalarAttributes SuperClassAttribute; - typedef CReduceDomainToScalar MyClass ; - typedef CTransformation SuperTransform ; public : /// Constructeurs /// @@ -58,19 +55,6 @@ namespace xios { static StdString GetName(void); static StdString GetDefName(void); static ENodeType GetType(void); - const string& getId(void) { return this->SuperClass::getId();} - ETranformationType getTransformationType(void) { return TRANS_REDUCE_DOMAIN_TO_SCALAR ;} - static CTransformation* getTransformation(const StdString& id) { return SuperClass::get(id);} - virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} - virtual shared_ptr createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) ; private: static bool registerTrans(); static CTransformation* create(const StdString& id, xml::CXMLNode* node); diff --git a/xios_2311_src/src/node/reduce_scalar_to_scalar.cpp b/xios_2311_src/src/node/reduce_scalar_to_scalar.cpp index 7e0bc7f83905c761bcda7cf5465cd0289e49446c..da1b0d3aff647693e1f5f106140e49ac8102fe0f 100644 --- a/xios_2311_src/src/node/reduce_scalar_to_scalar.cpp +++ b/xios_2311_src/src/node/reduce_scalar_to_scalar.cpp @@ -1,5 +1,4 @@ #include "reduce_scalar_to_scalar.hpp" -#include "scalar_algorithm_reduce_scalar.hpp" #include "type.hpp" namespace xios { @@ -26,7 +25,7 @@ namespace xios { bool CReduceScalarToScalar::registerTrans() { - return registerTransformation(TRANS_REDUCE_SCALAR_TO_SCALAR, {create, getTransformation}); + return registerTransformation(TRANS_REDUCE_SCALAR_TO_SCALAR, CReduceScalarToScalar::create); } bool CReduceScalarToScalar::_dummyRegistered = CReduceScalarToScalar::registerTrans(); @@ -41,18 +40,4 @@ namespace xios { { } - shared_ptr CReduceScalarToScalar::createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) - { - return CScalarAlgorithmReduceScalar::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, - elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, - elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition); - } } diff --git a/xios_2311_src/src/node/reduce_scalar_to_scalar.hpp b/xios_2311_src/src/node/reduce_scalar_to_scalar.hpp index ad0815396d6512be8c0c89b01d342d06af0811c3..fd5ad89dcf31ffb5cfbf884d33227aaabe648551 100644 --- a/xios_2311_src/src/node/reduce_scalar_to_scalar.hpp +++ b/xios_2311_src/src/node/reduce_scalar_to_scalar.hpp @@ -18,8 +18,7 @@ namespace xios { class CReduceScalarToScalarAttributes; class CReduceScalarToScalar; class CScalar; - class CGenericAlgorithmTransformation ; - class CGrid; + ///-------------------------------------------------------------- // Declare/Define CFileAttribute @@ -40,8 +39,6 @@ namespace xios { public : typedef CObjectTemplate SuperClass; typedef CReduceScalarToScalarAttributes SuperClassAttribute; - typedef CReduceScalarToScalar MyClass ; - typedef CTransformation SuperTransform ; public : /// Constructeurs /// @@ -57,19 +54,6 @@ namespace xios { static StdString GetName(void); static StdString GetDefName(void); static ENodeType GetType(void); - const string& getId(void) { return this->SuperClass::getId();} - ETranformationType getTransformationType(void) { return TRANS_REDUCE_SCALAR_TO_SCALAR ;} - static CTransformation* getTransformation(const StdString& id) { return SuperClass::get(id);} - virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} - virtual shared_ptr createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) ; private: static bool registerTrans(); static CTransformation* create(const StdString& id, xml::CXMLNode* node); diff --git a/xios_2311_src/src/node/reorder_domain.cpp b/xios_2311_src/src/node/reorder_domain.cpp index 4ff9ec7e6eba6935ab067c3cc43b4e5663067eb3..a767692c934dcdecef37ebc37fb1ec3e86b42fd3 100644 --- a/xios_2311_src/src/node/reorder_domain.cpp +++ b/xios_2311_src/src/node/reorder_domain.cpp @@ -1,5 +1,4 @@ #include "reorder_domain.hpp" -#include "domain_algorithm_reorder.hpp" #include "type.hpp" namespace xios { @@ -27,7 +26,7 @@ namespace xios { bool CReorderDomain::_dummyRegistered = CReorderDomain::registerTrans(); bool CReorderDomain::registerTrans() { - return registerTransformation(TRANS_REORDER_DOMAIN, {create, getTransformation}); + return registerTransformation(TRANS_REORDER_DOMAIN, CReorderDomain::create); } //---------------------------------------------------------------- @@ -41,18 +40,4 @@ namespace xios { } - shared_ptr CReorderDomain::createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) - { - return CDomainAlgorithmReorder::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, - elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, - elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition); - } } diff --git a/xios_2311_src/src/node/reorder_domain.hpp b/xios_2311_src/src/node/reorder_domain.hpp index e4cb3a95cae4151b14d85c27653e00782e2af8e6..3813c63f9bca9e84cd364c4689d37cd7c99cd5e2 100644 --- a/xios_2311_src/src/node/reorder_domain.hpp +++ b/xios_2311_src/src/node/reorder_domain.hpp @@ -19,8 +19,7 @@ namespace xios { class CReorderDomainAttributes; class CReorderDomain; class CDomain; - class CGenericAlgorithmTransformation ; - class CGrid; + ///-------------------------------------------------------------- // Declare/Define CReorderDomainAttribute @@ -41,8 +40,6 @@ namespace xios { public : typedef CObjectTemplate SuperClass; typedef CReorderDomainAttributes SuperClassAttribute; - typedef CReorderDomain MyClass ; - typedef CTransformation SuperTransform ; public : /// Constructeurs /// @@ -58,20 +55,7 @@ namespace xios { static StdString GetName(void); static StdString GetDefName(void); static ENodeType GetType(void); - const string& getId(void) { return this->SuperClass::getId();} - ETranformationType getTransformationType(void) { return TRANS_REORDER_DOMAIN ;} - static CTransformation* getTransformation(const StdString& id) { return SuperClass::get(id);} - virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} - virtual shared_ptr createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) ; - private: + private: static bool registerTrans(); static CTransformation* create(const StdString& id, xml::CXMLNode* node); static bool _dummyRegistered; diff --git a/xios_2311_src/src/node/scalar.cpp b/xios_2311_src/src/node/scalar.cpp index 1b903548c51b9489f5b4648f71a2a55fe22a08fb..c5e2cdd1e3add2c21742197ba0b5b0c5b4e921ee 100644 --- a/xios_2311_src/src/node/scalar.cpp +++ b/xios_2311_src/src/node/scalar.cpp @@ -6,126 +6,65 @@ #include "object_factory.hpp" #include "xios_spl.hpp" #include "type.hpp" -#include "context.hpp" -#include -#include +namespace xios { -namespace xios -{ + /// ////////////////////// Définitions ////////////////////// /// - /// ////////////////////// Définitions ////////////////////// /// + CScalar::CScalar(void) + : CObjectTemplate() + , CScalarAttributes() + , relFiles() + { /* Ne rien faire de plus */ } - CScalar::CScalar(void) - : CObjectTemplate() - , CScalarAttributes() - , relFiles() - { /* Ne rien faire de plus */ } + CScalar::CScalar(const StdString & id) + : CObjectTemplate(id) + , CScalarAttributes() + , relFiles() + { /* Ne rien faire de plus */ } - CScalar::CScalar(const StdString & id) - : CObjectTemplate(id) - , CScalarAttributes() - , relFiles() - { /* Ne rien faire de plus */ } + CScalar::~CScalar(void) + { /* Ne rien faire de plus */ } - CScalar::~CScalar(void) - { /* Ne rien faire de plus */ } - - void CScalar::releaseStaticAllocation(void) - { - transformationMapList_.clear() ; - CTransformation::unregisterAllTransformations() ; - CGridTransformationFactory::unregisterAllTransformations() ; - } - - std::map CScalar::transformationMapList_ = std::map(); - bool CScalar::dummyTransformationMapList_ = CScalar::initializeTransformationMap(CScalar::transformationMapList_); - bool CScalar::initializeTransformationMap(std::map& m) - { - m["reduce_axis"] = TRANS_REDUCE_AXIS_TO_SCALAR; - m["extract_axis"] = TRANS_EXTRACT_AXIS_TO_SCALAR; - m["reduce_domain"] = TRANS_REDUCE_DOMAIN_TO_SCALAR; - m["reduce_scalar"] = TRANS_REDUCE_SCALAR_TO_SCALAR; - return true; - } + std::map CScalar::transformationMapList_ = std::map(); + bool CScalar::dummyTransformationMapList_ = CScalar::initializeTransformationMap(CScalar::transformationMapList_); + bool CScalar::initializeTransformationMap(std::map& m) + { + m["reduce_axis"] = TRANS_REDUCE_AXIS_TO_SCALAR; + m["extract_axis"] = TRANS_EXTRACT_AXIS_TO_SCALAR; + m["reduce_domain"] = TRANS_REDUCE_DOMAIN_TO_SCALAR; + m["reduce_scalar"] = TRANS_REDUCE_SCALAR_TO_SCALAR; - StdString CScalar::GetName(void) { return (StdString("scalar")); } - StdString CScalar::GetDefName(void){ return (CScalar::GetName()); } - ENodeType CScalar::GetType(void) { return (eScalar); } + return true ; + } - CScalar* CScalar::createScalar() - { - CScalar* scalar = CScalarGroup::get("scalar_definition")->createChild(); - return scalar; - } + StdString CScalar::GetName(void) { return (StdString("scalar")); } + StdString CScalar::GetDefName(void){ return (CScalar::GetName()); } + ENodeType CScalar::GetType(void) { return (eScalar); } - CScalar* CScalar::get(const string& id, bool noError) - { - const regex r("::"); - smatch m; - if (regex_search(id, m, r)) - { - if (m.size()!=1) ERROR("CScalar* CScalar::get(string& id)", <<" id = "< bad format id, separator :: append more than one time"); - string fieldId=m.prefix() ; - if (fieldId.empty()) ERROR("CScalar* CScalar::get(string& id)", <<" id = "< bad format id, field name is empty"); - string suffix=m.suffix() ; - if (!CField::has(fieldId)) - if (noError) return nullptr ; - else ERROR("CScalar* CScalar::get(const string& id, bool noError)", <<" id = "< field Id : < "< doesn't exist"); - CField* field=CField::get(fieldId) ; - return field->getAssociatedScalar(suffix, noError) ; - } - else - { - if (noError) if(!CObjectFactory::HasObject(id)) return nullptr ; - return CObjectFactory::GetObject(id).get(); - } + CScalar* CScalar::createScalar() + { + CScalar* scalar = CScalarGroup::get("scalar_definition")->createChild(); + return scalar; } - bool CScalar::has(const string& id) + bool CScalar::IsWritten(const StdString & filename) const { - if (CScalar::get(id,true)==nullptr) return false ; - else return true ; + return (this->relFiles.find(filename) != this->relFiles.end()); } - - CField* CScalar::getFieldFromId(const string& id) + + void CScalar::addRelFile(const StdString& filename) { - const regex r("::"); - smatch m; - if (regex_search(id, m, r)) - { - if (m.size()!=1) ERROR("CField* CScalar::getFieldFromId(const string& id)", <<" id = "< bad format id, separator :: append more than one time"); - string fieldId=m.prefix() ; - if (fieldId.empty()) ERROR("CField* CScalar::getFieldFromId(const string& id)", <<" id = "< bad format id, field name is empty"); - string suffix=m.suffix() ; - CField* field=CField::get(fieldId) ; - return field ; - } - else return nullptr; + this->relFiles.insert(filename); } - bool CScalar::IsWritten(const StdString & filename) const - { - return (this->relFiles.find(filename) != this->relFiles.end()); - } + void CScalar::checkAttributes(void) + { + } - void CScalar::addRelFile(const StdString& filename) + void CScalar::checkAttributesOnClient() { - this->relFiles.insert(filename); - } - void CScalar::checkAttributes(void) - { - if (checkAttributes_done_) return ; - checkAttributes_done_ = true ; - - if (n.isEmpty()) n=1 ; - if (mask.isEmpty()) mask=true ; - - initializeLocalElement() ; - addFullView() ; - addWorkflowView() ; - addModelView() ; } /*! @@ -191,7 +130,7 @@ namespace xios /*! * Go through the hierarchy to find the scalar from which the transformations must be inherited */ - void CScalar::solveInheritanceTransformation_old() + void CScalar::solveInheritanceTransformation() { if (hasTransformation() || !hasDirectScalarReference()) return; @@ -208,102 +147,7 @@ namespace xios for (size_t i = 0; i < refScalar.size(); ++i) refScalar[i]->setTransformations(scalar->getAllTransformations()); } - - void CScalar::solveInheritanceTransformation() - TRY - { - if (solveInheritanceTransformation_done_) return; - else solveInheritanceTransformation_done_=true ; - CScalar* scalar = this; - CScalar* Lastscalar ; - std::list refScalars; - bool out=false ; - vector excludedAttr; - excludedAttr.push_back("scalar_ref"); - - refScalars.push_front(scalar) ; - while (scalar->hasDirectScalarReference() && !out) - { - CScalar* lastScalar=scalar ; - scalar = scalar->getDirectScalarReference(); - scalar->solveRefInheritance() ; - if (!scalar->SuperClass::isEqual(lastScalar,excludedAttr)) out=true ; - refScalars.push_front(scalar) ; - } - - CTransformationPaths::TPath path ; - auto& pathList = std::get<2>(path) ; - std::get<0>(path) = EElement::SCALAR ; - std::get<1>(path) = refScalars.front()->getId() ; - for (auto& scalar : refScalars) - { - CScalar::TransMapTypes transformations = scalar->getAllTransformations(); - for(auto& transformation : transformations) pathList.push_back({transformation.second->getTransformationType(), - transformation.second->getId()}) ; - } - transformationPaths_.addPath(path) ; - - } - CATCH_DUMP_ATTR - - bool CScalar::activateFieldWorkflow(CGarbageCollector& gc) - TRY - { - if (!scalar_ref.isEmpty()) - { - CField* field=getFieldFromId(scalar_ref) ; - if (field!=nullptr) - { - bool ret = field->buildWorkflowGraph(gc) ; - if (!ret) return false ; // cannot build workflow graph at this state - } - else - { - CScalar* scalar = get(scalar_ref) ; - bool ret = scalar->activateFieldWorkflow(gc) ; - if (!ret) return false ; // cannot build workflow graph at this state - scalar_ref=scalar->getId() ; // replace domain_ref by solved reference - } - } - activateFieldWorkflow_done_=true ; - return true ; - } - CATCH_DUMP_ATTR - - - /* obsolete, to remove after reimplementing coupling */ - void CScalar::sendScalarToCouplerOut(CContextClient* client, const string& fieldId, int posInGrid) - { - if (sendScalarToCouplerOut_done_.count(client)!=0) return ; - else sendScalarToCouplerOut_done_.insert(client) ; - - string scalarId = getCouplingAlias(fieldId, posInGrid) ; - - this->sendAllAttributesToServer(client, scalarId); - } - - string CScalar::getCouplingAlias(const string& fieldId, int posInGrid) - { - return "_scalar["+std::to_string(posInGrid)+"]_of_"+fieldId ; - } - - void CScalar::makeAliasForCoupling(const string& fieldId, int posInGrid) - { - const string scalarId = getCouplingAlias(fieldId, posInGrid) ; - this->createAlias(scalarId) ; - } - - void CScalar::setContextClient(CContextClient* contextClient) - TRY - { - if (clientsSet.find(contextClient)==clientsSet.end()) - { - clients.push_back(contextClient) ; - clientsSet.insert(contextClient); - } - } - CATCH_DUMP_ATTR /*! Parse children nodes of a scalar in xml file. \param node child node to process @@ -340,290 +184,6 @@ namespace xios } } - ////////////////////////////////////////////////////////////////////////////////////// - // this part is related to distribution, element definition, views and connectors // - ////////////////////////////////////////////////////////////////////////////////////// - - void CScalar::initializeLocalElement(void) - { - // after checkAttribute index of size n - int rank = CContext::getCurrent()->getIntraCommRank() ; - - - CArray index(n) ; - if (n==1) index(0)=0 ; - localElement_ = make_shared(rank, 1, index) ; - } - - void CScalar::addFullView(void) - { - CArray index(n) ; - if (n==1) index(0)=0 ; - localElement_ -> addView(CElementView::FULL, index) ; - } - - void CScalar::addWorkflowView(void) - { - CArray index ; - if (mask && n==1) - { - index.resize(1) ; - index(0)=0 ; - } - else index.resize(0) ; - localElement_ -> addView(CElementView::WORKFLOW, index) ; - } - - void CScalar::addModelView(void) - { - CArray index(1) ; - for(int i=0; i<1 ; i++) index(0)=0 ; - localElement_->addView(CElementView::MODEL, index) ; - } - - void CScalar::computeModelToWorkflowConnector(void) - { - shared_ptr srcView=getLocalView(CElementView::MODEL) ; - shared_ptr dstView=getLocalView(CElementView::WORKFLOW) ; - modelToWorkflowConnector_ = make_shared(srcView, dstView); - modelToWorkflowConnector_->computeConnector() ; - } - - - void CScalar::computeRemoteElement(CContextClient* client, EDistributionType type) - { - CContext* context = CContext::getCurrent(); - map> globalIndex ; - size_t nglo=1 ; - - if (type==EDistributionType::ROOT) // Bands distribution to send to file server - { - for (auto& rankServer : client->getRanksServerLeader()) - { - auto& globalInd = globalIndex[rankServer] ; - if (rankServer==0) - { - globalInd.resize(1) ; - globalInd(0)=0 ; - } - } - } - else if (type==EDistributionType::NONE) // domain is not distributed ie all servers get the same local domain - { - int nbServer = client->serverSize; - CArray indGlo(nglo) ; - for(size_t i=0;igetRanksServerLeader()) globalIndex[rankServer].reference(indGlo.copy()) ; - } - remoteElement_[client] = make_shared(nglo, globalIndex) ; - remoteElement_[client]->addFullView() ; - } - - void CScalar::distributeToServer(CContextClient* client, std::map>& globalIndexOut, std::map>& globalIndexIn, - shared_ptr &scattererConnector, const string& scalarId) - { - string serverScalarId = scalarId.empty() ? this->getId() : scalarId ; - CContext* context = CContext::getCurrent(); - - this->sendAllAttributesToServer(client, serverScalarId) ; - - auto scatteredElement = make_shared(1,globalIndexOut) ; - scatteredElement->addFullView() ; - scattererConnector = make_shared(localElement_->getView(CElementView::FULL), scatteredElement->getView(CElementView::FULL), - context->getIntraComm(), client->getRemoteSize()) ; - scattererConnector->computeConnector() ; - - // phase 0 - // send remote element to construct the full view on server, ie without hole - CEventClient event0(getType(), EVENT_ID_SCALAR_DISTRIBUTION); - CMessage message0 ; - message0<sendToServer(client,event0,message0) ; - - // phase 1 - // send the full view of element to construct the connector which connect distributed data coming from client to the full local view - CEventClient event1(getType(), EVENT_ID_SCALAR_DISTRIBUTION); - CMessage message1 ; - message1<getView(CElementView::FULL)->getGlobalSize() ; - scattererConnector->transfer(localElement_->getView(CElementView::FULL)->getGlobalIndex(),client,event1,message1) ; - - sendDistributedAttributes(client, scattererConnector, scalarId) ; - - // phase 2 send the mask : data index + mask2D - { - CArray maskIn(localElement_->getView(CElementView::WORKFLOW)->getSize()); - CArray maskOut ; - auto workflowToFull = make_shared(localElement_->getView(CElementView::WORKFLOW), localElement_->getView(CElementView::FULL)) ; - workflowToFull->computeConnector() ; - maskIn=true ; - workflowToFull->transfer(maskIn,maskOut,false) ; - - // prepare grid scatterer connector to send data from client to server - map> workflowGlobalIndex ; - map> maskOut2 ; - scattererConnector->transfer(maskOut, maskOut2) ; - scatteredElement->addView(CElementView::WORKFLOW, maskOut2) ; - scatteredElement->getView(CElementView::WORKFLOW)->getGlobalIndexView(workflowGlobalIndex) ; - // create new workflow view for scattered element - auto clientToServerElement = make_shared(scatteredElement->getGlobalSize(), workflowGlobalIndex) ; - clientToServerElement->addFullView() ; - CEventClient event2(getType(), EVENT_ID_SCALAR_DISTRIBUTION); - CMessage message2 ; - message2<sendToServer(client, event2, message2) ; - clientToServerConnector_[client] = make_shared(localElement_->getView(CElementView::WORKFLOW), clientToServerElement->getView(CElementView::FULL), - context->getIntraComm(), client->getRemoteSize()) ; - clientToServerConnector_[client]->computeConnector() ; - } - - //////////// - // phase 3 : compute connector to receive from server - //////////// - { - auto scatteredElement = make_shared(1, globalIndexIn) ; - scatteredElement->addFullView() ; - auto scattererConnector = make_shared(localElement_->getView(CElementView::FULL), scatteredElement->getView(CElementView::FULL), - context->getIntraComm(), client->getRemoteSize()) ; - scattererConnector->computeConnector() ; - - CArray maskIn(localElement_->getView(CElementView::WORKFLOW)->getSize()); - CArray maskOut ; - auto workflowToFull = make_shared(localElement_->getView(CElementView::WORKFLOW), localElement_->getView(CElementView::FULL)) ; - workflowToFull->computeConnector() ; - maskIn=true ; - workflowToFull->transfer(maskIn,maskOut,false) ; - - map> workflowGlobalIndex ; - map> maskOut2 ; - scattererConnector->transfer(maskOut, maskOut2, false) ; - scatteredElement->addView(CElementView::WORKFLOW, maskOut2) ; - scatteredElement->getView(CElementView::WORKFLOW)->getGlobalIndexView(workflowGlobalIndex) ; - auto clientToServerElement = make_shared(scatteredElement->getGlobalSize(), workflowGlobalIndex) ; - clientToServerElement->addFullView() ; - CEventClient event3(getType(), EVENT_ID_SCALAR_DISTRIBUTION); - CMessage message3 ; - message3<sendToServer(client, event3, message3) ; - - clientFromServerConnector_[client] = make_shared(clientToServerElement->getView(CElementView::FULL), localElement_->getView(CElementView::WORKFLOW)); - clientFromServerConnector_[client]->computeConnector() ; - } - } - - void CScalar::recvScalarDistribution(CEventServer& event) - TRY - { - string scalarId; - int phasis ; - for (auto& subEvent : event.subEvents) (*subEvent.buffer) >> scalarId >> phasis ; - get(scalarId)->receivedScalarDistribution(event, phasis); - } - CATCH - - void CScalar::receivedScalarDistribution(CEventServer& event, int phasis) - TRY - { - CContext* context = CContext::getCurrent(); - if (phasis==0) // receive the remote element to construct the full view - { - localElement_ = make_shared(context->getIntraCommRank(),event) ; - localElement_->addFullView() ; - // construct the local dimension and indexes - auto& globalIndex=localElement_->getGlobalIndex() ; - n=globalIndex.numElements() ; - // no distribution for scalar => nk ==1 or maybe 0 ? - } - else if (phasis==1) // receive the sent view from client to construct the full distributed full view on server - { - CContext* context = CContext::getCurrent(); - shared_ptr elementFrom = make_shared(event) ; - elementFrom->addFullView() ; - gathererConnector_ = make_shared(elementFrom->getView(CElementView::FULL), localElement_->getView(CElementView::FULL)) ; - gathererConnector_->computeConnector() ; - } - else if (phasis==2) - { -// delete gathererConnector_ ; - elementFrom_ = make_shared(event) ; - elementFrom_->addFullView() ; -// gathererConnector_ = make_shared(elementFrom_->getView(CElementView::FULL), localElement_->getView(CElementView::FULL)) ; -// gathererConnector_ -> computeConnector() ; - } - else if (phasis==3) - { - elementTo_ = make_shared(event) ; - elementTo_->addFullView() ; - } - } - CATCH - - void CScalar::setServerMask(CArray& serverMask, CContextClient* client) - TRY - { - CContext* context = CContext::getCurrent(); - localElement_->addView(CElementView::WORKFLOW, serverMask) ; - if (serverMask.numElements()==1) mask = serverMask(0) ; - - serverFromClientConnector_ = make_shared(elementFrom_->getView(CElementView::FULL), localElement_->getView(CElementView::WORKFLOW)) ; - serverFromClientConnector_->computeConnector() ; - - serverToClientConnector_ = make_shared(localElement_->getView(CElementView::WORKFLOW), elementTo_->getView(CElementView::FULL), - context->getIntraComm(), client->getRemoteSize()) ; - serverToClientConnector_->computeConnector() ; - } - CATCH_DUMP_ATTR - - void CScalar::sendDistributedAttributes(CContextClient* client, shared_ptr scattererConnector, const string& scalarId) - { - string serverScalarId = scalarId.empty() ? this->getId() : scalarId ; - CContext* context = CContext::getCurrent(); - - // nothing for now - } - - void CScalar::recvDistributedAttributes(CEventServer& event) - TRY - { - string scalarId; - string type ; - for (auto& subEvent : event.subEvents) (*subEvent.buffer) >> scalarId >> type ; - get(scalarId)->recvDistributedAttributes(event, type); - } - CATCH - - void CScalar::recvDistributedAttributes(CEventServer& event, const string& type) - TRY - { - // nothing for now - } - CATCH - - bool CScalar::dispatchEvent(CEventServer& event) - TRY - { - if (SuperClass::dispatchEvent(event)) return true; - else - { - switch(event.type) - { - case EVENT_ID_SCALAR_DISTRIBUTION: - recvScalarDistribution(event); - return true; - break; - case EVENT_ID_SEND_DISTRIBUTED_ATTRIBUTE: - recvDistributedAttributes(event); - return true; - break; - default : - ERROR("bool CScalar::dispatchEvent(CEventServer& event)", - << "Unknown Event"); - return false; - } - } - } - CATCH - - // Definition of some macros DEFINE_REF_FUNC(Scalar,scalar) diff --git a/xios_2311_src/src/node/scalar.hpp b/xios_2311_src/src/node/scalar.hpp index d771d2652c00d6bb98a657e95af4de107ed2c70e..c9be88053be54c47421f7cfd7fb9e15a7aabcc2a 100644 --- a/xios_2311_src/src/node/scalar.hpp +++ b/xios_2311_src/src/node/scalar.hpp @@ -12,241 +12,91 @@ #include "attribute_array.hpp" #include "transformation.hpp" #include "transformation_enum.hpp" -#include "transformation_path.hpp" -#include "element.hpp" -#include "local_connector.hpp" -#include "scatterer_connector.hpp" -#include "gatherer_connector.hpp" -#include "distribution_type.hpp" -#include "generic_algorithm_transformation.hpp" -#include "grid_transformation_factory_impl.hpp" - namespace xios { - /// ////////////////////// Déclarations ////////////////////// /// + /// ////////////////////// Déclarations ////////////////////// /// - class CScalarGroup; - class CScalarAttributes; - class CScalar; - class CField; - ///-------------------------------------------------------------- + class CScalarGroup; + class CScalarAttributes; + class CScalar; + ///-------------------------------------------------------------- - // Declare/Define CVarAttribute - BEGIN_DECLARE_ATTRIBUTE_MAP(CScalar) + // Declare/Define CVarAttribute + BEGIN_DECLARE_ATTRIBUTE_MAP(CScalar) #include "scalar_attribute.conf" - END_DECLARE_ATTRIBUTE_MAP(CScalar) + END_DECLARE_ATTRIBUTE_MAP(CScalar) - ///-------------------------------------------------------------- + ///-------------------------------------------------------------- - class CScalar: public CObjectTemplate - , public CScalarAttributes - { - friend class CScalarGroup; + class CScalar + : public CObjectTemplate + , public CScalarAttributes + { + /// typedef /// + typedef CObjectTemplate SuperClass; + typedef CScalarAttributes SuperClassAttribute; - /// typedef /// - typedef CObjectTemplate SuperClass; - typedef CScalarAttributes SuperClassAttribute; + friend class CScalarGroup; - public: - enum EEventId - { - EVENT_ID_SCALAR_DISTRIBUTION, - EVENT_ID_SEND_DISTRIBUTED_ATTRIBUTE, - } ; - static bool dispatchEvent(CEventServer& event); - - - public : - - typedef CScalarAttributes RelAttributes; - typedef CScalarGroup RelGroup; - - /// Constructeurs /// - CScalar(void); - explicit CScalar(const StdString & id); - CScalar(const CScalar & var); // Not implemented yet. - CScalar(const CScalar * const var); // Not implemented yet. - static void releaseStaticAllocation(void) ; // release static allocation on heap - - /// Destructeur /// - virtual ~CScalar(void); - - public : - /// Accesseurs statiques /// - static StdString GetName(void); - static StdString GetDefName(void); - static ENodeType GetType(void); - - public: - static CScalar* createScalar(); - static CScalar* get(const string& id, bool noError=false) ; // sendScalarToCouplerOut_done_ ; - - public: - void makeAliasForCoupling(const string& fieldId, int posInGrid) ; - string getCouplingAlias(const string& fieldId, int posInGrid) ; - - //////////////////////////////// - //// TRANSFORMATIONS //// - //////////////////////////////// - public: - typedef CTransformation::TransformationMapTypes TransMapTypes; - private: - static bool initializeTransformationMap(std::map& m); - static std::map transformationMapList_; - static bool dummyTransformationMapList_; TransMapTypes transformationMap_; - void setTransformations(const TransMapTypes&); - - public: - bool hasTransformation(); - TransMapTypes getAllTransformations(); - void duplicateTransformation(CScalar*); - CTransformation* addTransformation(ETranformationType transType, const StdString& id=""); - - void solveInheritanceTransformation_old(); - void solveInheritanceTransformation(); - private: - bool solveInheritanceTransformation_done_= false ; - public: - bool activateFieldWorkflow(CGarbageCollector& gc) ; - private: - bool activateFieldWorkflow_done_=false ; - private: - shared_ptr transformationAlgorithm_ = nullptr ; - public: - void setTransformationAlgorithm(shared_ptr transformationAlgorithm) { transformationAlgorithm_=transformationAlgorithm ;} - shared_ptr getTransformationAlgorithm(void) { return transformationAlgorithm_ ;} - private: - CTransformationPaths transformationPaths_ ; - public: - CTransformationPaths getTransformationPaths(void) {return transformationPaths_;} - void setTransformationPaths(const CTransformationPaths& transformationPaths) { transformationPaths_=transformationPaths ;} - //////////////////////////////// - //////////////////////////////// - - bool isEqual(CScalar* scalar); - private: - /** Clients that have to send a scalar. There can be multiple clients in case of secondary server, otherwise only one client. */ - std::list clients; - std::set clientsSet; - public: - void setContextClient(CContextClient* contextClient) ; - - private: - std::set relFiles; - - private: - /** define if the scalar is completed or not ie all attributes have been received before in case - of grid reading from file or coupling */ - bool isCompleted_=true ; - public: - /*! - \brief Check if a scalar is completed - Before make any scalar processing, we must be sure that all scalar informations have - been sent, for exemple when reading a grid in a file or when grid elements are sent by an - other context (coupling). So all direct reference of the scalar (scalar_ref) must be also completed - \return true if scalar and scalar reference are completed - */ - bool isCompleted(void) - { - if (hasDirectScalarReference()) if (!getDirectScalarReference()->isCompleted()) return false; - else return isCompleted_ ; - - MISSING_RETURN( "bool CAxis::isCompleted() " ); - return true; - } - void setCompleted(void) { isCompleted_=true ; } - void unsetCompleted(void) { isCompleted_=false ; } - - - - ////////////////////////////////////////////////////////////////////////////////////// - // this part is related to distribution, element definition, views and connectors // - ////////////////////////////////////////////////////////////////////////////////////// - private: - shared_ptr localElement_ = nullptr ; - void initializeLocalElement(void) ; - - public: - shared_ptr getLocalElement(void) { if (localElement_==nullptr) initializeLocalElement() ; return localElement_ ; } - shared_ptr getLocalView(CElementView::type type) { return getLocalElement()->getView(type) ;} - - private: - void addFullView(void) ; - void addWorkflowView(void) ; - void addModelView(void) ; - - private: - shared_ptr modelToWorkflowConnector_ ; - void computeModelToWorkflowConnector(void) ; - public: - shared_ptr getModelToWorkflowConnector(void) { if (modelToWorkflowConnector_==nullptr) computeModelToWorkflowConnector() ; return modelToWorkflowConnector_ ;} - - public: - void computeRemoteElement(CContextClient* client, EDistributionType) ; - void distributeToServer(CContextClient* client, std::map>& globalIndexOut, std::map>& globalIndexIn, - shared_ptr &scattererConnector, const string& scalarId="") ; - - static void recvScalarDistribution(CEventServer& event) ; - void receivedScalarDistribution(CEventServer& event, int phasis) ; - void setServerMask(CArray& serverMask, CContextClient* client) ; - void sendDistributedAttributes(CContextClient* client, shared_ptr scattererConnector, const string& scalarId) ; - static void recvDistributedAttributes(CEventServer& event) ; - void recvDistributedAttributes(CEventServer& event, const string& type) ; - - private: - map> remoteElement_ ; - public: - shared_ptr getRemoteElement(CContextClient* client) {return remoteElement_[client] ;} - private: - map> clientToServerConnector_ ; - public: - shared_ptr getClientToServerConnector(CContextClient* client) { return clientToServerConnector_[client] ;} - - private: - shared_ptr gathererConnector_ ; - public: - shared_ptr getGathererConnector(void) { return gathererConnector_ ;} - private: - shared_ptr serverFromClientConnector_ ; - shared_ptr elementFrom_ ; - public: - shared_ptr getServerFromClientConnector(void) { return serverFromClientConnector_ ;} - - private: - shared_ptr serverToClientConnector_ = nullptr ; - shared_ptr elementTo_ ; - public: - shared_ptr getServerToClientConnector(void) { return serverToClientConnector_ ;} - - private: - map> clientFromServerConnector_ ; - public: - shared_ptr getClientFromServerConnector(CContextClient* client) { return clientFromServerConnector_[client] ;} - - private: - DECLARE_REF_FUNC(Scalar,scalar) - - }; // class CVar - ///-------------------------------------------------------------- - - // Declare/Define CScalarGroup and CScalarDefinition - DECLARE_GROUP(CScalar); + public : + + typedef CScalarAttributes RelAttributes; + typedef CScalarGroup RelGroup; + typedef CTransformation::TransformationMapTypes TransMapTypes; + + /// Constructeurs /// + CScalar(void); + explicit CScalar(const StdString & id); + CScalar(const CScalar & var); // Not implemented yet. + CScalar(const CScalar * const var); // Not implemented yet. + + /// Destructeur /// + virtual ~CScalar(void); + + public : + /// Accesseurs statiques /// + static StdString GetName(void); + static StdString GetDefName(void); + static ENodeType GetType(void); + + public: + static CScalar* createScalar(); + + public: + void checkAttributes(void); + void addRelFile(const StdString& filename); + bool IsWritten(const StdString& filename) const; + void checkAttributesOnClient(); + virtual void parse(xml::CXMLNode & node); + + public: + bool hasTransformation(); + void solveInheritanceTransformation(); + TransMapTypes getAllTransformations(); + void duplicateTransformation(CScalar*); + CTransformation* addTransformation(ETranformationType transType, const StdString& id=""); + bool isEqual(CScalar* scalar); + + private: + std::set relFiles; + TransMapTypes transformationMap_; + + void setTransformations(const TransMapTypes&); + + private: + static bool initializeTransformationMap(std::map& m); + static std::map transformationMapList_; + static bool dummyTransformationMapList_; + + + DECLARE_REF_FUNC(Scalar,scalar) + + }; // class CVar + ///-------------------------------------------------------------- + + // Declare/Define CScalarGroup and CScalarDefinition + DECLARE_GROUP(CScalar); } // namespace xios #endif // __XIOS_CScalar__ diff --git a/xios_2311_src/src/node/temporal_splitting.cpp b/xios_2311_src/src/node/temporal_splitting.cpp index c1ae95d81b5fcfdfa930a49b22d38e73562c4dce..201ba1318cbf218c3aa572a7760adc3cc702464d 100644 --- a/xios_2311_src/src/node/temporal_splitting.cpp +++ b/xios_2311_src/src/node/temporal_splitting.cpp @@ -1,5 +1,4 @@ #include "temporal_splitting.hpp" -#include "axis_algorithm_temporal_splitting.hpp" #include "type.hpp" #include "axis.hpp" #include "domain.hpp" @@ -29,7 +28,7 @@ namespace xios { bool CTemporalSplitting::registerTrans() { - return registerTransformation(TRANS_TEMPORAL_SPLITTING, {create, getTransformation}); + return registerTransformation(TRANS_TEMPORAL_SPLITTING, CTemporalSplitting::create); } bool CTemporalSplitting::_dummyRegistered = CTemporalSplitting::registerTrans(); @@ -45,18 +44,4 @@ namespace xios { } - shared_ptr CTemporalSplitting::createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) - { - return CAxisAlgorithmTemporalSplitting::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, - elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, - elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition); - } } diff --git a/xios_2311_src/src/node/temporal_splitting.hpp b/xios_2311_src/src/node/temporal_splitting.hpp index e05ca0396a80a7046161cfadaddd70bcc2cfa124..d2b3d1dcba0985f7e4c021d58c8239d7aab1975a 100644 --- a/xios_2311_src/src/node/temporal_splitting.hpp +++ b/xios_2311_src/src/node/temporal_splitting.hpp @@ -19,8 +19,6 @@ namespace xios { class CTemporalSplitting; class CAxis; class CScalar; - class CGenericAlgorithmTransformation ; - class CGrid; ///-------------------------------------------------------------- // Declare/Define CFileAttribute @@ -41,8 +39,6 @@ namespace xios { public : typedef CObjectTemplate SuperClass; typedef CTemporalSplittingAttributes SuperClassAttribute; - typedef CTemporalSplitting MyClass ; - typedef CTransformation SuperTransform ; public : /// Constructeurs /// @@ -58,19 +54,6 @@ namespace xios { static StdString GetName(void); static StdString GetDefName(void); static ENodeType GetType(void); - const string& getId(void) { return this->SuperClass::getId();} - ETranformationType getTransformationType(void) { return TRANS_TEMPORAL_SPLITTING ;} - static CTransformation* getTransformation(const StdString& id) { return SuperClass::get(id);} - virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} - virtual shared_ptr createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) ; private: static bool registerTrans(); static CTransformation* create(const StdString& id, xml::CXMLNode* node); diff --git a/xios_2311_src/src/node/variable.cpp b/xios_2311_src/src/node/variable.cpp index f0c6b7c911a6a85c111c45b0163b2eed551fd8c1..c8bbcccec452336955cee6cecbf981e85d6226fa 100644 --- a/xios_2311_src/src/node/variable.cpp +++ b/xios_2311_src/src/node/variable.cpp @@ -93,8 +93,38 @@ namespace xios { *\brief Sending value of a variable with its id from client to server * */ + void CVariable::sendValue() + { + CContext* context=CContext::getCurrent() ; + + if (context->hasClient) + { + // Use correct context client to send message + // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; + int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 0) : 1; + for (int i = 0; i < nbSrvPools; ++i) + { +// CContextClient* contextClientTmp = (0 != context->clientPrimServer) ? context->clientPrimServer + CContextClient* contextClientTmp = (context->hasServer) ? context->clientPrimServer[i] + : context->client; + + CEventClient event(this->getType(),EVENT_ID_VARIABLE_VALUE) ; + if (contextClientTmp->isServerLeader()) + { + CMessage msg ; + msg<getId() ; + msg<& ranks = contextClientTmp->getRanksServerLeader(); + for (std::list::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) + event.push(*itRank,1,msg); + contextClientTmp->sendEvent(event) ; + } + else contextClientTmp->sendEvent(event) ; + } + } + } - void CVariable::sendValue(CContextClient* client) + void CVariable::sendValue(CContextClient* client, bool clientPrim /*= false*/) { CEventClient event(this->getType(),EVENT_ID_VARIABLE_VALUE) ; if (client->isServerLeader()) diff --git a/xios_2311_src/src/node/variable.hpp b/xios_2311_src/src/node/variable.hpp index af6a6f63866170ccd1b6f924650c65004e97a70c..576915e878434a00776ab8d76af411371da23736 100644 --- a/xios_2311_src/src/node/variable.hpp +++ b/xios_2311_src/src/node/variable.hpp @@ -78,7 +78,8 @@ namespace xios static bool dispatchEvent(CEventServer& event) ; //! Sending a request to set up variable data - void sendValue(CContextClient* client); + void sendValue(); + void sendValue(CContextClient* client, bool clientPrim = false); static void recvValue(CEventServer& event) ; void recvValue(CBufferIn& buffer) ; diff --git a/xios_2311_src/src/node/zoom_axis.cpp b/xios_2311_src/src/node/zoom_axis.cpp index c13428638aa3d2e78ff0f45760d2f77f5ab6aed8..a23120e502b9e86282dfeafed28323378fc66391 100644 --- a/xios_2311_src/src/node/zoom_axis.cpp +++ b/xios_2311_src/src/node/zoom_axis.cpp @@ -1,5 +1,4 @@ #include "zoom_axis.hpp" -#include "axis_algorithm_zoom.hpp" #include "type.hpp" namespace xios { @@ -26,7 +25,7 @@ namespace xios { bool CZoomAxis::registerTrans() { - return registerTransformation(TRANS_ZOOM_AXIS, {create, getTransformation}); + return registerTransformation(TRANS_ZOOM_AXIS, CZoomAxis::create); } bool CZoomAxis::_dummyRegistered = CZoomAxis::registerTrans(); @@ -77,18 +76,4 @@ namespace xios { } - shared_ptr CZoomAxis::createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) - { - return CAxisAlgorithmZoom::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, - elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, - elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition); - } } diff --git a/xios_2311_src/src/node/zoom_axis.hpp b/xios_2311_src/src/node/zoom_axis.hpp index 7b0b66810ea08284f3fa227733e25ad46ef3e12e..269afbd170e2d3cea7a165eb22d3d8046d33290d 100644 --- a/xios_2311_src/src/node/zoom_axis.hpp +++ b/xios_2311_src/src/node/zoom_axis.hpp @@ -19,8 +19,7 @@ namespace xios { class CZoomAxisAttributes; class CZoomAxis; class CAxis; - class CGenericAlgorithmTransformation ; - class CGrid; + ///-------------------------------------------------------------- // Declare/Define CFileAttribute @@ -41,8 +40,6 @@ namespace xios { public : typedef CObjectTemplate SuperClass; typedef CZoomAxisAttributes SuperClassAttribute; - typedef CZoomAxis MyClass ; - typedef CTransformation SuperTransform ; public : /// Constructeurs /// @@ -58,19 +55,6 @@ namespace xios { static StdString GetName(void); static StdString GetDefName(void); static ENodeType GetType(void); - const string& getId(void) { return this->SuperClass::getId();} - ETranformationType getTransformationType(void) { return TRANS_ZOOM_AXIS ;} - static CTransformation* getTransformation(const StdString& id) { return SuperClass::get(id);} - virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} - virtual shared_ptr createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) ; private: static bool registerTrans(); static CTransformation* create(const StdString& id, xml::CXMLNode* node); diff --git a/xios_2311_src/src/node/zoom_domain.cpp b/xios_2311_src/src/node/zoom_domain.cpp index 50db267cd4910e4d7645ec25d84335ac31174da7..fe9c0222095c0fa18a5dc9cb048a6aaa50456fe2 100644 --- a/xios_2311_src/src/node/zoom_domain.cpp +++ b/xios_2311_src/src/node/zoom_domain.cpp @@ -1,5 +1,4 @@ #include "zoom_domain.hpp" -#include "domain_algorithm_zoom.hpp" #include "type.hpp" namespace xios { @@ -27,7 +26,7 @@ namespace xios { bool CZoomDomain::_dummyRegistered = CZoomDomain::registerTrans(); bool CZoomDomain::registerTrans() { - return registerTransformation(TRANS_ZOOM_DOMAIN, {create, getTransformation}); + return registerTransformation(TRANS_ZOOM_DOMAIN, CZoomDomain::create); } //---------------------------------------------------------------- @@ -72,18 +71,4 @@ namespace xios { } } - shared_ptr CZoomDomain::createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) - { - return CDomainAlgorithmZoom::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, - elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, - elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition); - } } diff --git a/xios_2311_src/src/node/zoom_domain.hpp b/xios_2311_src/src/node/zoom_domain.hpp index 3bb1d6e53e00595ec1570508d63c25eb25f377e4..d6d0e4e211a63e98a900d46f49637d48edcb79ef 100644 --- a/xios_2311_src/src/node/zoom_domain.hpp +++ b/xios_2311_src/src/node/zoom_domain.hpp @@ -19,8 +19,7 @@ namespace xios { class CZoomDomainAttributes; class CZoomDomain; class CDomain; - class CGenericAlgorithmTransformation ; - class CGrid; + ///-------------------------------------------------------------- // Declare/Define CFileAttribute @@ -41,8 +40,6 @@ namespace xios { public : typedef CObjectTemplate SuperClass; typedef CZoomDomainAttributes SuperClassAttribute; - typedef CZoomDomain MyClass ; - typedef CTransformation SuperTransform ; public : /// Constructeurs /// @@ -58,23 +55,9 @@ namespace xios { static StdString GetName(void); static StdString GetDefName(void); static ENodeType GetType(void); - const string& getId(void) { return this->SuperClass::getId();} - ETranformationType getTransformationType(void) { return TRANS_ZOOM_DOMAIN ;} - virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} - static CTransformation* getTransformation(const StdString& id) { return SuperClass::get(id);} - virtual shared_ptr createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) ; private: static bool registerTrans(); static CTransformation* create(const StdString& id, xml::CXMLNode* node); - static bool _dummyRegistered; }; // class CZoomDomain diff --git a/xios_2311_src/src/object.cpp b/xios_2311_src/src/object.cpp index 664e1104ca15644ee8bab87d1c68fdf7f2132eb4..d350a4e0efc520fc0c70b566e1e410c9f6bd3f39 100644 --- a/xios_2311_src/src/object.cpp +++ b/xios_2311_src/src/object.cpp @@ -28,6 +28,11 @@ namespace xios return this->id; } + const StdString& CObject::getIdServer() const + { + return this->id; + } + StdString CObject::dumpClassAttributes(void) { return ""; diff --git a/xios_2311_src/src/object.hpp b/xios_2311_src/src/object.hpp index ac359e3f67fc5f2d6cc9f6109c36a7e5113bb1b4..2a551f24ec8cdda697f007c8cf142cd8a37a33be 100644 --- a/xios_2311_src/src/object.hpp +++ b/xios_2311_src/src/object.hpp @@ -16,6 +16,7 @@ namespace xios /// Accesseurs /// const StdString& getId(void) const; + virtual const StdString& getIdServer() const; virtual StdString dumpClassAttributes(void); diff --git a/xios_2311_src/src/object_factory.hpp b/xios_2311_src/src/object_factory.hpp index 90ce4304c89da874f4f25193551ade455ee56f6d..feee4700d0375e2b4f4725735fb196bcb4e49c8a 100644 --- a/xios_2311_src/src/object_factory.hpp +++ b/xios_2311_src/src/object_factory.hpp @@ -20,7 +20,6 @@ namespace xios /// Accesseurs /// static StdString & GetCurrentContextId(void); - static void clearCurrentContextId(void) {CurrContext.clear(); CurrContext.shrink_to_fit(); } template static std::shared_ptr GetObject(const StdString & id); @@ -50,16 +49,11 @@ namespace xios /// Instanciateur /// template static std::shared_ptr CreateObject(const StdString & id = StdString("")); - - template - static std::shared_ptr CreateAlias(const StdString& id, const StdString& alias) ; - - template static const StdString GetUIdBase(void); + + template static const StdString& GetUIdBase(void); template static StdString GenUId(void); template static bool IsGenUId(const StdString& id); - template static void deleteContext(const StdString & context) ; - template static void deleteAllContexts(void) ; - template static void dumpObjects(void) ; + private : /// Propriétés statiques /// diff --git a/xios_2311_src/src/object_factory_decl1.cpp b/xios_2311_src/src/object_factory_decl1.cpp index 0631edecc2760c2a4f135e2a8a1d725a90988df8..7a6dc68052a19f330c433b44292b7e60f1aaac54 100644 --- a/xios_2311_src/src/object_factory_decl1.cpp +++ b/xios_2311_src/src/object_factory_decl1.cpp @@ -4,8 +4,6 @@ namespace xios { macro(CField) macro(CFile) - macro(CCouplerIn) - macro(CCouplerOut) macro(CGrid) macro(CAxis) macro(CDomain) diff --git a/xios_2311_src/src/object_factory_decl3.cpp b/xios_2311_src/src/object_factory_decl3.cpp index 1b79174504d9352ca3c1a1449a8f08a1a33bfacb..7708748dabd0e65b632c72ba0fee4ad2998afd7e 100644 --- a/xios_2311_src/src/object_factory_decl3.cpp +++ b/xios_2311_src/src/object_factory_decl3.cpp @@ -5,8 +5,6 @@ namespace xios { macro(CFieldGroup) macro(CFileGroup) - macro(CCouplerInGroup) - macro(CCouplerOutGroup) macro(CGridGroup) macro(CAxisGroup) macro(CDomainGroup) diff --git a/xios_2311_src/src/object_factory_decl_macro.hpp b/xios_2311_src/src/object_factory_decl_macro.hpp index 50f01c7e40109abaf87095992c52524adb2efe3c..6db3846d8ca25c690b0e9ebbfec53adbe2963f58 100644 --- a/xios_2311_src/src/object_factory_decl_macro.hpp +++ b/xios_2311_src/src/object_factory_decl_macro.hpp @@ -12,14 +12,8 @@ template bool CObjectFactory::HasObject(const StdString& id); \ template bool CObjectFactory::HasObject(const StdString& context,const StdString& id); \ template std::shared_ptr CObjectFactory::CreateObject(const StdString& id ); \ - template std::shared_ptr CObjectFactory::CreateAlias(const StdString& id, const StdString& alias ); \ - template const StdString CObjectFactory::GetUIdBase(void); \ + template const StdString& CObjectFactory::GetUIdBase(void); \ template StdString CObjectFactory::GenUId(void); \ - template bool CObjectFactory::IsGenUId(const StdString& id);\ - template void CObjectFactory::deleteContext(const StdString & context) ;\ - template void CObjectFactory::deleteAllContexts() ;\ - template void CObjectFactory::dumpObjects(void) ; - - + template bool CObjectFactory::IsGenUId(const StdString& id); diff --git a/xios_2311_src/src/object_factory_impl.hpp b/xios_2311_src/src/object_factory_impl.hpp index e2527be4b5b17cb148aa2e85f3f73687a9bad9a3..c5bb71483465b8d44c0f15c4b85ebbd179f0764f 100644 --- a/xios_2311_src/src/object_factory_impl.hpp +++ b/xios_2311_src/src/object_factory_impl.hpp @@ -111,33 +111,6 @@ namespace xios } } - template - std::shared_ptr CObjectFactory::CreateAlias(const StdString& id, const StdString& alias) - { - if (CurrContext.empty()) - ERROR("CObjectFactory::CreateAlias(const StdString& id, const StdString& alias)", - << "[ id = " << id << " alias = "<(alias)) - { - return CObjectFactory::GetObject(alias); - } - else - { - if (! CObjectFactory::HasObject(id)) - { - ERROR("CObjectFactory::CreateAlias(const StdString& id, const StdString& alias)", - << "[ id = " << id << " alias = "< value = CObjectFactory::GetObject(id); - U::AllMapObj[CObjectFactory::CurrContext].insert(std::make_pair(alias, value)); - return value; - } - } - } - template const std::vector > & CObjectFactory::GetObjectVector(const StdString & context) @@ -146,11 +119,9 @@ namespace xios } template - const StdString CObjectFactory::GetUIdBase(void) + const StdString& CObjectFactory::GetUIdBase(void) { - StdString base ; -// base = "__"+CObjectFactory::CurrContext + "::" + U::GetName() + "_undef_id_"; - base = CObjectFactory::CurrContext + "__" + U::GetName() + "_undef_id_"; + static const StdString base = "__" + U::GetName() + "_undef_id_"; return base; } @@ -165,42 +136,10 @@ namespace xios template bool CObjectFactory::IsGenUId(const StdString& id) { - const StdString base = GetUIdBase(); + const StdString& base = GetUIdBase(); return (id.size() > base.size() && id.compare(0, base.size(), base) == 0); } - template - void CObjectFactory::deleteContext(const StdString & context) - { - for (auto& v : U::AllVectObj[context]) v.reset() ; - U::AllVectObj[context].clear() ; - U::AllVectObj.erase(context) ; - for (auto& m : U::AllMapObj[context]) m.second.reset() ; - U::AllMapObj[context].clear() ; - U::AllMapObj.erase(context) ; - - U::GenId.erase(context) ; - } - - template - void CObjectFactory::deleteAllContexts(void) - { - list contextList ; - for(auto& context : U::AllMapObj) contextList.push_back(context.first) ; - for(auto& context : contextList) deleteContext(context) ; - } - - - template - void CObjectFactory::dumpObjects(void) - { - for (auto& context : U::AllMapObj) - for(auto& m : context.second) - { - info(100)<<"Dump All Object"< getMinimumBufferSizeForAttributes(CContextClient* client); - void sendAttributToServer(const string& id, CContextClient* client, const string& objectId=""); - void sendAttributToServer(CAttribute& attr, CContextClient* client, const string& objectId="") ; - void sendAllAttributesToServer(CContextClient* client, const string& objectId=""); - void sendAddItem(const string& id, int itemType, CContextClient* client, const string& objectId=""); + void sendAttributToServer(const string& id); + void sendAttributToServer(const string& id, CContextClient* client); + void sendAttributToServer(CAttribute& attr) ; + void sendAttributToServer(CAttribute& attr, CContextClient* client) ; + void sendAllAttributesToServer(); + void sendAllAttributesToServer(CContextClient* client); + void sendAddItem(const string& id, int itemType); + void sendAddItem(const string& id, int itemType, CContextClient* client); static void recvAttributFromClient(CEventServer& event) ; static bool dispatchEvent(CEventServer& event) ; @@ -71,8 +75,6 @@ namespace xios /// Destructeur /// virtual ~CObjectTemplate(void); - - static void cleanStaticDataStructure(void); static bool has(const string& id) ; static bool has(const string& contextId, const string& id) ; @@ -84,53 +86,30 @@ namespace xios static std::shared_ptr getShared(const T* ptr) ; static T* create(const string& id=string("")) ; - static T* createAlias(const string& id, const string& alias) ; - void createAlias(const string& alias) ; - static const vector getAll() ; static const vector getAll(const string& contextId) ; void generateCInterface(ostream& oss) ; void generateFortran2003Interface(ostream& oss) ; void generateFortranInterface(ostream& oss) ; - - // manage inherited id which is herited by reference - void setInheritedId(T* obj) ; - bool hasInheritedId(void) { return hasInheritedId_ ;} - string getInheritedId(void) { return inheritedId_ ;} - - private: - std::string inheritedId_ ; - bool hasInheritedId_ = false; - - // manage the template id - public: - void setTemplateId(T* obj) ; // & object, bool withAttrList = true, bool withId = true); + CObjectTemplate(const CObjectTemplate & object, + bool withAttrList = true, bool withId = true); CObjectTemplate(const CObjectTemplate * const object); // Not implemented. private : /// Propriétés statiques /// - static xios_map > > AllMapObj; - static xios_map > > AllVectObj; + static xios_map > > AllMapObj; + static xios_map > > AllVectObj; static xios_map< StdString, long int > GenId ; diff --git a/xios_2311_src/src/object_template_decl.cpp b/xios_2311_src/src/object_template_decl.cpp index e5807ff2f39fbf05cbaca1c2e8ebe1098768d457..69707ebafadc13fc7ca00b6b3c7ec3afd10d70f2 100644 --- a/xios_2311_src/src/object_template_decl.cpp +++ b/xios_2311_src/src/object_template_decl.cpp @@ -8,8 +8,6 @@ namespace xios template class CObjectTemplate; template class CObjectTemplate; template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; template class CObjectTemplate; template class CObjectTemplate; template class CObjectTemplate; @@ -39,8 +37,6 @@ namespace xios template class CObjectTemplate; template class CObjectTemplate; template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; template class CObjectTemplate; template class CObjectTemplate; template class CObjectTemplate; diff --git a/xios_2311_src/src/object_template_impl.hpp b/xios_2311_src/src/object_template_impl.hpp index 9e7fd94dfc2c7f4697dbfcb4e38cb4145f8b7ba3..6bf2e595156c9fb46503487c1575b34dadd4db20 100644 --- a/xios_2311_src/src/object_template_impl.hpp +++ b/xios_2311_src/src/object_template_impl.hpp @@ -67,29 +67,6 @@ namespace xios { return (CObjectTemplate::AllVectObj[contextId]); } - - template - void CObjectTemplate::cleanStaticDataStructure(void) - { - xios_map > >* allMap = &(CObjectTemplate::AllMapObj); - for(auto it = allMap->begin(); it != allMap->end(); ++it) - { - for(auto it2 = it->second.begin(); it2 != it->second.end(); ++it2) - { - std::shared_ptr todel = it2->second; - todel.reset(); - } - it->second.clear(); - - std::vector >* allVect = &(CObjectTemplate::AllVectObj[it->first]); - for(auto it = allVect->begin(); it != allVect->end(); ++it) - { - it->reset(); - } - allVect->clear(); - } - allMap->clear(); - } //--------------------------------------------------------------- @@ -179,42 +156,6 @@ namespace xios return (attrMapThis.isEqual(attrMapObj, excludedAttrs)); } - // --------------------------------------------------------------- - template - void CObjectTemplate::setInheritedId(T* obj) - { - if (!hasInheritedId_) - { - if (!(hasId() && !hasAutoGeneratedId())) - if (obj->hasId() && !obj->hasAutoGeneratedId()) - { - hasInheritedId_=true ; - inheritedId_=obj->getId() ; - } - } - } - - template - void CObjectTemplate::setTemplateId(T* obj) - { - if (hasId() && !hasAutoGeneratedId()) - { - templateId_ = getId() ; - hasTemplateId_ = true ; - } - else if (obj->hasId() && !obj->hasAutoGeneratedId()) - { - templateId_ = obj->getId() ; - hasTemplateId_ = true ; - } - else if (obj->hasTemplateId()) - { - templateId_= obj->getTemplateId() ; - hasTemplateId_=true ; - } - } - - //--------------------------------------------------------------- template @@ -263,7 +204,7 @@ namespace xios if (minimumSize) { // Account for extra header info - minimumSize += CEventClient::headerSize + getId().size() + sizeof(size_t); + minimumSize += CEventClient::headerSize + getIdServer().size() + sizeof(size_t); const std::list& ranks = client->getRanksServerLeader(); for (std::list::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) @@ -273,19 +214,39 @@ namespace xios return minimumSizes; } + + template + void CObjectTemplate::sendAllAttributesToServer() + { + CAttributeMap& attrMap = *this; + CAttributeMap::const_iterator it = attrMap.begin(), itE = attrMap.end(); + for (; it != itE; ++it) + { + if (it->second->doSend() && !(it->second)->isEmpty()) sendAttributToServer(*(it->second)); + } + } + template - void CObjectTemplate::sendAllAttributesToServer(CContextClient* client, const string& objectId) + void CObjectTemplate::sendAllAttributesToServer(CContextClient* client) { CAttributeMap& attrMap = *this; CAttributeMap::const_iterator it = attrMap.begin(), itE = attrMap.end(); for (; it != itE; ++it) { - if (it->second->doSend() && !(it->second)->isEmpty()) sendAttributToServer(*(it->second), client, objectId); + if (it->second->doSend() && !(it->second)->isEmpty()) sendAttributToServer(*(it->second), client); } } template - void CObjectTemplate::sendAttributToServer(const string& id, CContextClient* client, const string& objectId ) + void CObjectTemplate::sendAttributToServer(const string& id) + { + CAttributeMap & attrMap = *this; + CAttribute* attr=attrMap[id]; + sendAttributToServer(*attr); + } + + template + void CObjectTemplate::sendAttributToServer(const string& id, CContextClient* client) { CAttributeMap & attrMap = *this; CAttribute* attr=attrMap[id]; @@ -293,32 +254,42 @@ namespace xios } template - void CObjectTemplate::sendAttributToServer(CAttribute& attr, CContextClient* client, const string& objectId) + void CObjectTemplate::sendAttributToServer(CAttribute& attr) { - CEventClient event(getType(),EVENT_ID_SEND_ATTRIBUTE); - if (client->isServerLeader()) + // Use correct context client to send message + CContext* context=CContext::getCurrent(); + if (context->hasClient) { - CMessage msg; - if (objectId.empty()) msg << this->getId(); - else msg << objectId; - msg << attr.getName(); - msg << attr; - const std::list& ranks = client->getRanksServerLeader(); - for (std::list::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) - event.push(*itRank,1,msg); - client->sendEvent(event); + // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; + int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 0) : 1; + for (int i = 0; i < nbSrvPools; ++i) + { + CContextClient* contextClientTmp = (context->hasServer) ? context->clientPrimServer[i] : context->client; + CEventClient event(getType(),EVENT_ID_SEND_ATTRIBUTE); + if (contextClientTmp->isServerLeader()) + { + CMessage msg; + msg<getIdServer(); + msg << attr.getName(); + msg << attr; + const std::list& ranks = contextClientTmp->getRanksServerLeader(); + for (std::list::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) + event.push(*itRank,1,msg); + contextClientTmp->sendEvent(event); + } + else contextClientTmp->sendEvent(event); + } } - else client->sendEvent(event); } -/* specialisation for context, because context Id on client is not the same on server, and no need to transfer context Id */ - template <> - void CObjectTemplate::sendAttributToServer(CAttribute& attr, CContextClient* client, const string& objectId) + template + void CObjectTemplate::sendAttributToServer(CAttribute& attr, CContextClient* client) { CEventClient event(getType(),EVENT_ID_SEND_ATTRIBUTE); if (client->isServerLeader()) { CMessage msg; + msg<getIdServer(); msg << attr.getName(); msg << attr; const std::list& ranks = client->getRanksServerLeader(); @@ -335,17 +306,44 @@ namespace xios \param [in] id Id of added item \param [in] itemType type of added item */ + template + void CObjectTemplate::sendAddItem(const StdString& id, int itemType) + { + CContext* context = CContext::getCurrent(); + typedef typename T::EEventId ItemType; + if (context->hasClient) + { + // Use correct context client to send message + // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; + int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 0) : 1; + for (int i = 0; i < nbSrvPools; ++i) + { + CContextClient* contextClientTmp = (context->hasServer) ? context->clientPrimServer[i] : context->client; + CEventClient event(this->getType(),ItemType(itemType)); + if (contextClientTmp->isServerLeader()) + { + CMessage msg; + msg << this->getId(); + msg << id; + const std::list& ranks = contextClientTmp->getRanksServerLeader(); + for (std::list::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) + event.push(*itRank,1,msg); + contextClientTmp->sendEvent(event); + } + else contextClientTmp->sendEvent(event); + } + } + } template - void CObjectTemplate::sendAddItem(const StdString& id, int itemType, CContextClient* client, const string& objectId) + void CObjectTemplate::sendAddItem(const StdString& id, int itemType, CContextClient* client) { typedef typename T::EEventId ItemType; CEventClient event(this->getType(),ItemType(itemType)); if (client->isServerLeader()) { CMessage msg; - if (objectId.empty()) msg << this->getId(); - else msg << objectId; + msg << this->getId(); msg << id; const std::list& ranks = client->getRanksServerLeader(); for (std::list::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) @@ -374,26 +372,6 @@ namespace xios else info(50) /*attr->getValue()*/ << endl; } -/* specialisation for context, because context Id on client is not the same on server and no need to transfer context Id */ - template <> - void CObjectTemplate::recvAttributFromClient(CEventServer& event) - { - - CBufferIn* buffer=event.subEvents.begin()->buffer; - string attrId; - CAttributeMap & attrMap = *CContext::getCurrent(); - *buffer>>attrId; - CAttribute* attr=attrMap[attrId]; - info(50) << "attribut recu " << attrId << " "; - if (attr->isEmpty()) info(50) << "--> empty" << endl; - else info(50) /*getValue()*/ << endl; - *buffer>>*attr; - info(50) << "attribut recu " << attrId << " "; - if (attr->isEmpty()) info(50) << "--> empty" << endl; - else info(50) /*attr->getValue()*/ << endl; - } - - template bool CObjectTemplate::dispatchEvent(CEventServer& event) { @@ -480,18 +458,6 @@ namespace xios return CObjectFactory::CreateObject(id).get(); } ///-------------------------------------------------------------- - template - T* CObjectTemplate::createAlias(const string & id, const string& alias) - { - return CObjectFactory::CreateAlias(id, alias).get(); - } ///-------------------------------------------------------------- - - template - void CObjectTemplate::createAlias(const string& alias) - { - get()->createAlias(getId(),alias) ; - } // - template T* CObjectTemplate::get(void) { diff --git a/xios_2311_src/src/parse_expr/filter_expr_node.cpp b/xios_2311_src/src/parse_expr/filter_expr_node.cpp index fcc739745d21fab87b1656a473deb76b49d3ce27..5f0138686126673302141a26f45db95d1731a417 100644 --- a/xios_2311_src/src/parse_expr/filter_expr_node.cpp +++ b/xios_2311_src/src/parse_expr/filter_expr_node.cpp @@ -11,7 +11,7 @@ namespace xios { /* Nothing to do */ } - std::shared_ptr CFilterFieldExprNode::reduce(CGarbageCollector& gc, CField& thisField) const + std::shared_ptr CFilterFieldExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const { std::shared_ptr outputPin; @@ -39,10 +39,9 @@ namespace xios << "The field " << id << " has an invalid reference to itself. " << "Use the keyword \"this\" if you want to reference the input data sent to this field."); - bool ret=field->buildWorkflowGraph(gc); - if(!field->build_workflow_graph.isEmpty()) thisField.build_workflow_graph.set(field->build_workflow_graph); - if (ret) outputPin = field->getInstantDataFilter(); // if dependency is complete build the graph other return nullptr - + // field->buildFilterGraph(gc, false); + field->buildFilterGraph(gc, false, start_graph, end_graph); + outputPin = field->getInstantDataFilter(); } else ERROR("boost::shared_ptr CFilterFieldExprNode::reduce(CGarbageCollector& gc, CField& thisField) const", << "The field " << id << " does not exist."); @@ -56,7 +55,7 @@ namespace xios { /* Nothing to do */ } - std::shared_ptr CFilterTemporalFieldExprNode::reduce(CGarbageCollector& gc, CField& thisField) const + std::shared_ptr CFilterTemporalFieldExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const { std::shared_ptr outputPin; @@ -85,8 +84,8 @@ namespace xios << "The field " << fieldId << " has an invalid reference to itself. " << "Use the keyword \"this\" if you want to reference the input data sent to this field."); - bool ret=field->buildWorkflowGraph(gc); - if (ret) outputPin = field->getTemporalDataFilter(gc, thisField.freq_op.isEmpty() ? TimeStep : thisField.freq_op); + field->buildFilterGraph(gc, false); + outputPin = field->getTemporalDataFilter(gc, thisField.freq_op.isEmpty() ? TimeStep : thisField.freq_op); } else ERROR("shared_ptr CFilterTemporalFieldExprNode::reduce(CGarbageCollector& gc, CField& thisField) const", @@ -105,20 +104,21 @@ namespace xios "Impossible to create the new expression node, an invalid child node was provided."); } - std::shared_ptr CFilterUnaryOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const + std::shared_ptr CFilterUnaryOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const { + std::shared_ptr ch = child->reduce(gc, thisField, start_graph, end_graph); + std::shared_ptr filter(new CUnaryArithmeticFilter(gc, opId)); - auto ret=child->reduce(gc, thisField) ; - if (ret) ret->connectOutput(filter, 0); - else filter.reset() ; - - const bool buildGraph_ = !(thisField.build_workflow_graph.isEmpty()) && thisField.build_workflow_graph == true ; - if(buildGraph_) - { - filter->graphPackage = new CGraphPackage; - filter->graphEnabled = true; - filter->graphPackage->inFields.push_back(&thisField); - } + ch->connectOutput(filter, 0); + + (filter->parent_filters).resize(1); + (filter->parent_filters)[0] = ch; + + filter->tag = ch->tag; + filter->start_graph = ch->start_graph; + filter->end_graph = ch->end_graph; + filter->field = &thisField; + return filter; } @@ -133,21 +133,19 @@ namespace xios "Impossible to create the new expression node, an invalid child node was provided."); } - std::shared_ptr CFilterScalarFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const + std::shared_ptr CFilterScalarFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const { + std::shared_ptr ch2 = child2->reduce(gc, thisField, start_graph, end_graph); std::shared_ptr filter(new CScalarFieldArithmeticFilter(gc, opId, child1->reduce())); + ch2->connectOutput(filter, 0); - auto ret=child2->reduce(gc, thisField) ; - if (ret) ret->connectOutput(filter, 0); - else filter.reset() ; - - const bool buildGraph_ = !(thisField.build_workflow_graph.isEmpty()) && thisField.build_workflow_graph == true ; - if(buildGraph_) - { - filter->graphPackage = new CGraphPackage; - filter->graphEnabled = true; - filter->graphPackage->inFields.push_back(&thisField); - } + (filter->parent_filters).resize(1); + (filter->parent_filters)[0] = ch2; + + filter->tag = ch2->tag; + filter->start_graph = ch2->start_graph; + filter->end_graph = ch2->end_graph; + filter->field = &thisField; return filter; } @@ -162,20 +160,21 @@ namespace xios "Impossible to create the new expression node, an invalid child node was provided."); } - std::shared_ptr CFilterFieldScalarOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const + std::shared_ptr CFilterFieldScalarOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const { + std::shared_ptr ch1 = child1->reduce(gc, thisField, start_graph, end_graph); + std::shared_ptr filter(new CFieldScalarArithmeticFilter(gc, opId, child2->reduce())); - auto ret=child1->reduce(gc, thisField) ; - if (ret) ret->connectOutput(filter, 0); - else filter.reset() ; - - const bool buildGraph_ = !(thisField.build_workflow_graph.isEmpty()) && thisField.build_workflow_graph == true ; - if(buildGraph_) - { - filter->graphPackage = new CGraphPackage; - filter->graphEnabled = true; - filter->graphPackage->inFields.push_back(&thisField); - } + ch1->connectOutput(filter, 0); + + (filter->parent_filters).resize(1); + (filter->parent_filters)[0] = ch1; + + filter->tag = ch1->tag; + filter->start_graph = ch1->start_graph; + filter->end_graph = ch1->end_graph; + filter->field = &thisField; + return filter; } @@ -189,25 +188,25 @@ namespace xios "Impossible to create the new expression node, an invalid child node was provided."); } - std::shared_ptr CFilterFieldFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const + std::shared_ptr CFilterFieldFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const { + std::shared_ptr ch1 = child1->reduce(gc, thisField, start_graph, end_graph); + std::shared_ptr ch2 = child2->reduce(gc, thisField, start_graph, end_graph); + std::shared_ptr filter(new CFieldFieldArithmeticFilter(gc, opId)); - auto ret1 = child1->reduce(gc, thisField); - auto ret2 = child2->reduce(gc, thisField); - if (ret1 && ret2) - { - ret1->connectOutput(filter, 0) ; - ret2->connectOutput(filter, 1) ; - } - else filter.reset() ; + ch1->connectOutput(filter, 0); + ch2->connectOutput(filter, 1); + + (filter->parent_filters).resize(2); + (filter->parent_filters)[0] = ch1; + (filter->parent_filters)[1] = ch2; + + filter->tag = (ch1->tag || ch2->tag); + filter->start_graph = ch1->tag? ch1->start_graph : (ch2->tag? ch2->start_graph: -1); + filter->end_graph = ch1->tag? ch1->end_graph : (ch2->tag? ch2->end_graph: -1); + + filter->field = &thisField; - const bool buildGraph_ = !(thisField.build_workflow_graph.isEmpty()) && thisField.build_workflow_graph == true ; - if(buildGraph_) - { - filter->graphPackage = new CGraphPackage; - filter->graphEnabled = true; - filter->graphPackage->inFields.push_back(&thisField); - } return filter; } @@ -226,12 +225,21 @@ namespace xios "Impossible to create the new expression node, an invalid child node was provided."); } - std::shared_ptr CFilterScalarScalarFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const + std::shared_ptr CFilterScalarScalarFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const { + std::shared_ptr ch3 = child3->reduce(gc, thisField, start_graph, end_graph); + std::shared_ptr filter(new CScalarScalarFieldArithmeticFilter(gc, opId, child1->reduce(),child2->reduce())); - auto ret=child3->reduce(gc, thisField) ; - if (ret) ret->connectOutput(filter, 0); - else filter.reset() ; + ch3->connectOutput(filter, 0); + + (filter->parent_filters).resize(1); + (filter->parent_filters)[0] = ch3; + + filter->tag = ch3->tag; + filter->start_graph = ch3->start_graph; + filter->end_graph = ch3->end_graph; + filter->field = &thisField; + return filter; } @@ -247,12 +255,21 @@ namespace xios "Impossible to create the new expression node, an invalid child node was provided."); } - std::shared_ptr CFilterScalarFieldScalarOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const + std::shared_ptr CFilterScalarFieldScalarOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const { + std::shared_ptr ch2 = child2->reduce(gc, thisField, start_graph, end_graph); + std::shared_ptr filter(new CScalarFieldScalarArithmeticFilter(gc, opId, child1->reduce(),child3->reduce())); - auto ret=child2->reduce(gc, thisField); - if (ret) ret->connectOutput(filter, 0); - else filter.reset() ; + ch2->connectOutput(filter, 0); + + (filter->parent_filters).resize(1); + (filter->parent_filters)[0] = ch2; + + filter->tag = ch2->tag; + filter->start_graph = ch2->start_graph; + filter->end_graph = ch2->end_graph; + filter->field = &thisField; + return filter; } @@ -268,17 +285,24 @@ namespace xios "Impossible to create the new expression node, an invalid child node was provided."); } - std::shared_ptr CFilterScalarFieldFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const + std::shared_ptr CFilterScalarFieldFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const { + std::shared_ptr ch2 = child2->reduce(gc, thisField, start_graph, end_graph); + std::shared_ptr ch3 = child3->reduce(gc, thisField, start_graph, end_graph); + std::shared_ptr filter(new CScalarFieldFieldArithmeticFilter(gc, opId, child1->reduce())); - auto ret1=child2->reduce(gc, thisField); - auto ret2=child3->reduce(gc, thisField); - if (ret1 && ret2) - { - ret1->connectOutput(filter, 0); - ret2->connectOutput(filter, 1); - } - else filter.reset() ; + ch2->connectOutput(filter, 0); + ch3->connectOutput(filter, 1); + + (filter->parent_filters).resize(2); + (filter->parent_filters)[0] = ch2; + (filter->parent_filters)[1] = ch3; + + filter->tag = (ch3->tag || ch2->tag); + filter->start_graph = ch3->tag? ch3->start_graph : (ch2->tag? ch2->start_graph: -1); + filter->end_graph = ch3->tag? ch3->end_graph : (ch2->tag? ch2->end_graph: -1); + filter->field = &thisField; + return filter; } @@ -295,12 +319,21 @@ namespace xios "Impossible to create the new expression node, an invalid child node was provided."); } - std::shared_ptr CFilterFieldScalarScalarOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const + std::shared_ptr CFilterFieldScalarScalarOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const { + std::shared_ptr ch1 = child1->reduce(gc, thisField, start_graph, end_graph); + std::shared_ptr filter(new CFieldScalarScalarArithmeticFilter(gc, opId, child2->reduce(),child3->reduce())); - auto ret = child1->reduce(gc, thisField) ; - if (ret) ret->connectOutput(filter, 0); - else filter.reset() ; + ch1->connectOutput(filter, 0); + + (filter->parent_filters).resize(1); + (filter->parent_filters)[0] = ch1; + + filter->tag = ch1->tag; + filter->start_graph = ch1->start_graph; + filter->end_graph = ch1->end_graph; + filter->field = &thisField; + return filter; } @@ -317,17 +350,24 @@ namespace xios "Impossible to create the new expression node, an invalid child node was provided."); } - std::shared_ptr CFilterFieldScalarFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const + std::shared_ptr CFilterFieldScalarFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const { + std::shared_ptr ch1 = child1->reduce(gc, thisField, start_graph, end_graph); + std::shared_ptr ch3 = child3->reduce(gc, thisField, start_graph, end_graph); + std::shared_ptr filter(new CFieldScalarFieldArithmeticFilter(gc, opId, child2->reduce())); - auto ret1 = child1->reduce(gc, thisField); - auto ret2 = child3->reduce(gc, thisField); - if (ret1 && ret2) - { - ret1 -> connectOutput(filter, 0); - ret2 -> connectOutput(filter, 1); - } - else filter.reset() ; + ch1->connectOutput(filter, 0); + ch3->connectOutput(filter, 1); + + (filter->parent_filters).resize(2); + (filter->parent_filters)[0] = ch1; + (filter->parent_filters)[1] = ch3; + + filter->tag = (ch3->tag || ch1->tag); + filter->start_graph = ch3->tag? ch3->start_graph : (ch1->tag? ch1->start_graph: -1); + filter->end_graph = ch3->tag? ch3->end_graph : (ch1->tag? ch1->end_graph: -1); + filter->field = &thisField; + return filter; } @@ -344,17 +384,23 @@ namespace xios "Impossible to create the new expression node, an invalid child node was provided."); } - std::shared_ptr CFilterFieldFieldScalarOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const + std::shared_ptr CFilterFieldFieldScalarOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const { + std::shared_ptr ch1 = child1->reduce(gc, thisField, start_graph, end_graph); + std::shared_ptr ch2 = child2->reduce(gc, thisField, start_graph, end_graph); + std::shared_ptr filter(new CFieldFieldScalarArithmeticFilter(gc, opId, child3->reduce())); - auto ret1 = child1->reduce(gc, thisField); - auto ret2 = child2->reduce(gc, thisField); - if (ret1 && ret2) - { - ret1->connectOutput(filter, 0); - ret2->connectOutput(filter, 1); - } - else filter.reset() ; + ch1->connectOutput(filter, 0); + ch2->connectOutput(filter, 1); + + (filter->parent_filters).resize(2); + (filter->parent_filters)[0] = ch1; + (filter->parent_filters)[1] = ch2; + + filter->tag = (ch2->tag || ch1->tag); + filter->start_graph = ch2->tag? ch2->start_graph : (ch1->tag? ch1->start_graph: -1); + filter->end_graph = ch2->tag? ch2->end_graph : (ch1->tag? ch1->end_graph: -1); + filter->field = &thisField; return filter; } @@ -370,19 +416,29 @@ namespace xios "Impossible to create the new expression node, an invalid child node was provided."); } - std::shared_ptr CFilterFieldFieldFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const + std::shared_ptr CFilterFieldFieldFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const { + std::shared_ptr ch1 = child1->reduce(gc, thisField, start_graph, end_graph); + std::shared_ptr ch2 = child2->reduce(gc, thisField, start_graph, end_graph); + std::shared_ptr ch3 = child3->reduce(gc, thisField, start_graph, end_graph); + std::shared_ptr filter(new CFieldFieldFieldArithmeticFilter(gc, opId)); - auto ret1=child1->reduce(gc, thisField); - auto ret2=child2->reduce(gc, thisField); - auto ret3=child3->reduce(gc, thisField); - if (ret1 && ret2 && ret3) - { - ret1->connectOutput(filter, 0); - ret2->connectOutput(filter, 1); - ret3->connectOutput(filter, 2); - } - else filter.reset() ; + ch1->connectOutput(filter, 0); + ch2->connectOutput(filter, 1); + ch3->connectOutput(filter, 2); + + (filter->parent_filters).resize(3); + (filter->parent_filters)[0] = ch1; + (filter->parent_filters)[1] = ch2; + (filter->parent_filters)[2] = ch3; + + + filter->tag = (ch1->tag || ch1->tag || ch3->tag); + filter->start_graph = ch1->tag? ch1->start_graph : (ch2->tag? ch2->start_graph: (ch3->tag? ch3->start_graph: -1)); + filter->end_graph = ch1->tag? ch1->end_graph : (ch2->tag? ch2->end_graph: (ch3->tag? ch3->end_graph: -1)); + filter->field = &thisField; + + return filter; } diff --git a/xios_2311_src/src/parse_expr/filter_expr_node.hpp b/xios_2311_src/src/parse_expr/filter_expr_node.hpp index 3f7fd2f106d627ca613ec22b81c742982e8316a9..e99aa6f45b1ed44c5eed40e4ed1dd9260968b119 100644 --- a/xios_2311_src/src/parse_expr/filter_expr_node.hpp +++ b/xios_2311_src/src/parse_expr/filter_expr_node.hpp @@ -5,6 +5,8 @@ #include #include "scalar_expr_node.hpp" +#include "duration.hpp" + namespace xios { class COutputPin; @@ -24,7 +26,7 @@ namespace xios * \param thisField the field to which the expression is attached * \return the output pin of the filter producing the result of the expression */ - virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField) const = 0; + virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const = 0; }; /*! @@ -41,7 +43,7 @@ namespace xios */ CFilterFieldExprNode(const std::string& fieldId); - virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField) const; + virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const; private: std::string fieldId; //!< The identifier of the field @@ -62,7 +64,7 @@ namespace xios */ CFilterTemporalFieldExprNode(const std::string& fieldId); - virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField) const; + virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const; private: std::string fieldId; //!< The identifier of the field @@ -85,7 +87,7 @@ namespace xios */ CFilterUnaryOpExprNode(const std::string& opId, IFilterExprNode* child); - virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField) const; + virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const; private: std::string opId; //!< The identifier of the field @@ -110,7 +112,7 @@ namespace xios */ CFilterScalarFieldOpExprNode(IScalarExprNode* child1, const std::string& opId, IFilterExprNode* child2); - virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField) const; + virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const; private: std::string opId; //!< The identifier of the field @@ -136,7 +138,7 @@ namespace xios */ CFilterFieldScalarOpExprNode(IFilterExprNode* child1, const std::string& opId, IScalarExprNode* child2); - virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField) const; + virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const; private: std::string opId; //!< The identifier of the field @@ -161,7 +163,7 @@ namespace xios */ CFilterFieldFieldOpExprNode(IFilterExprNode* child1, const std::string& opId, IFilterExprNode* child2); - virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField) const; + virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const; private: std::string opId; //!< The identifier of the field @@ -189,7 +191,7 @@ namespace xios */ CFilterScalarScalarFieldOpExprNode(IScalarExprNode* child1, const std::string& opId, IScalarExprNode* child2, IFilterExprNode* child3); - virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField) const; + virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const; private: std::string opId; //!< The identifier of the field @@ -218,7 +220,7 @@ namespace xios */ CFilterScalarFieldScalarOpExprNode(IScalarExprNode* child1, const std::string& opId, IFilterExprNode* child2, IScalarExprNode* child3); - virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField) const; + virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const; private: std::string opId; //!< The identifier of the field @@ -247,7 +249,7 @@ namespace xios */ CFilterScalarFieldFieldOpExprNode(IScalarExprNode* child1, const std::string& opId, IFilterExprNode* child2, IFilterExprNode* child3); - virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField) const; + virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const; private: std::string opId; //!< The identifier of the field @@ -277,7 +279,7 @@ namespace xios */ CFilterFieldScalarScalarOpExprNode(IFilterExprNode* child1, const std::string& opId, IScalarExprNode* child2, IScalarExprNode* child3); - virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField) const; + virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const; private: std::string opId; //!< The identifier of the field @@ -306,7 +308,7 @@ namespace xios */ CFilterFieldScalarFieldOpExprNode(IFilterExprNode* child1, const std::string& opId, IScalarExprNode* child2, IFilterExprNode* child3); - virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField) const; + virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const; private: std::string opId; //!< The identifier of the field @@ -334,7 +336,7 @@ namespace xios */ CFilterFieldFieldScalarOpExprNode(IFilterExprNode* child1, const std::string& opId, IFilterExprNode* child2, IScalarExprNode* child3); - virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField) const; + virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const; private: std::string opId; //!< The identifier of the field @@ -363,7 +365,7 @@ namespace xios */ CFilterFieldFieldFieldOpExprNode(IFilterExprNode* child1, const std::string& opId, IFilterExprNode* child2, IFilterExprNode* child3); - virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField) const; + virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const; private: std::string opId; //!< The identifier of the field diff --git a/xios_2311_src/src/parse_expr/operator_expr.hpp b/xios_2311_src/src/parse_expr/operator_expr.hpp index 2391151edd94308c1a63ef4b4590516d2d05aebb..c8d356187471d927a82beb39012f9a44e213a3a3 100644 --- a/xios_2311_src/src/parse_expr/operator_expr.hpp +++ b/xios_2311_src/src/parse_expr/operator_expr.hpp @@ -434,27 +434,9 @@ namespace xios return ret ; } - void release(void) - { - opScalar.clear(); - opScalarScalar.clear(); - opScalarScalarScalar.clear(); - opField.clear(); - opFieldField.clear(); - opFieldScalar.clear(); - opScalarField.clear(); - opScalarScalarField.clear(); - opScalarFieldScalar.clear(); - opScalarFieldField.clear(); - opFieldScalarScalar.clear(); - opFieldScalarField.clear(); - opFieldFieldScalar.clear(); - opFieldFieldField.clear(); - } }; extern COperatorExpr operatorExpr; - } #endif diff --git a/xios_2311_src/src/parse_expr/yacc_parser.cpp b/xios_2311_src/src/parse_expr/yacc_parser.cpp index 299337c38ea89cab2e623cf066110bf47530fbfd..6153b0144a662a0f6253eb9b472416aef8f9afdd 100644 --- a/xios_2311_src/src/parse_expr/yacc_parser.cpp +++ b/xios_2311_src/src/parse_expr/yacc_parser.cpp @@ -69,6 +69,8 @@ #include #include "exception.hpp" +#include "yacc_var.hpp" + using namespace std; using namespace xios; @@ -83,8 +85,14 @@ extern "C" std::string globalInputText; size_t globalReadOffset = 0; + std::string *xios::yacc_globalInputText_ptr = 0; + int readInputForLexer(char* buffer, size_t* numBytesRead, size_t maxBytesToRead) { + yacc_globalInputText_ptr = &globalInputText; + //*yacc_globalInputText_ptr = globalInputText; + + size_t numBytesToRead = maxBytesToRead; size_t bytesRemaining = globalInputText.length()-globalReadOffset; size_t i; diff --git a/xios_2311_src/src/registry.cpp b/xios_2311_src/src/registry.cpp index a84f95517c9b7d02569b27deb1f76c35f6518be7..f47684a7040978fdc4588199017637980c0bda6e 100644 --- a/xios_2311_src/src/registry.cpp +++ b/xios_2311_src/src/registry.cpp @@ -50,12 +50,12 @@ namespace xios } } - void CRegistry::getKey_(const string& key_, CBaseType& value) const + void CRegistry::getKey_(const string& key_, CBaseType& value) { const string key=path+key_ ; size_t size=value.size(); - map >::const_iterator it=registry.find(key) ; + map >::iterator it=registry.find(key) ; if (it!=registry.end()) { @@ -257,16 +257,7 @@ namespace xios void CRegistry::hierarchicalGatherRegistry(void) { - int color; - if (isEmpty()) color=0 ; - else color=1 ; - int rank ; - MPI_Comm_rank(communicator,&rank); - if (rank==0) color=1 ; - MPI_Comm newComm ; - MPI_Comm_split(communicator,color,rank,&newComm) ; - if (color==1) hierarchicalGatherRegistry(newComm) ; - MPI_Comm_free(&newComm) ; + hierarchicalGatherRegistry(communicator) ; } void CRegistry::hierarchicalGatherRegistry(const MPI_Comm& comm) diff --git a/xios_2311_src/src/registry.hpp b/xios_2311_src/src/registry.hpp index 9ce944d5a99ab810a9685460935e2c5cb55df115..a4a8e1c33b632e1a0b273efb87344f29beef31fb 100644 --- a/xios_2311_src/src/registry.hpp +++ b/xios_2311_src/src/registry.hpp @@ -37,11 +37,11 @@ namespace xios /** retrieve a value from a key */ - void getKey(const std::string& key, CBaseType& value) const { this->getKey_(key,value); } + void getKey(const std::string& key, CBaseType& value) { this->getKey_(key,value); } /** retrieve a value from a key */ template typename boost::enable_if_c::value>::type - getKey(const std::string& key, T& value) const { CType_ref valRef(value); this->getKey_(key,valRef); } + getKey(const std::string& key, T& value) { CType_ref valRef(value); this->getKey_(key,valRef); } /** query for an already inserted key */ @@ -102,7 +102,7 @@ namespace xios void setKey_(const std::string& key, const CBaseType& value) ; /** retrieve a value from a key (internal use)*/ - void getKey_(const std::string& key, CBaseType& value) const ; + void getKey_(const std::string& key, CBaseType& value) ; /** use internally for recursivity */ void gatherRegistry(const MPI_Comm& comm) ; diff --git a/xios_2311_src/src/release_static_allocation.cpp b/xios_2311_src/src/release_static_allocation.cpp deleted file mode 100755 index 1529e48d77d40ea6b462fae86fe558bfceecb3a4..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/release_static_allocation.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "release_static_allocation.hpp" -#include "operator_expr.hpp" -#include "netCdf_cf_constant.hpp" -#include "context.hpp" -#include "server_context.hpp" -#include "timer.hpp" -#include "mem_checker.hpp" - -namespace xios -{ - void releaseStaticAllocation(void) - { - CContext::releaseStaticAllocation() ; // free memory from static allocation - CCFConvention::releaseStaticAllocation() ; // free memory from static allocation - CServerContext::releaseStaticAllocation() ; - CTimer::release() ; - CMemChecker::release() ; - operatorExpr.release(); - } -} \ No newline at end of file diff --git a/xios_2311_src/src/release_static_allocation.hpp b/xios_2311_src/src/release_static_allocation.hpp deleted file mode 100755 index 963ee62c428a467f9e57e8ac5ac742c33f48733a..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/release_static_allocation.hpp +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef __RELEASE_STATIC_ALLOCATION_HPP__ -#define __RELEASE_STATIC_ALLOCATION_HPP__ - -namespace xios -{ - - void releaseStaticAllocation(void) ; - -} - -#endif \ No newline at end of file diff --git a/xios_2311_src/src/server.cpp b/xios_2311_src/src/server.cpp index 4a18b6986ac3aae028a6fe77c3bd0f25fdb6a58f..711cda4e0fd9a04e47a48a5165cf7f90828b0ca9 100644 --- a/xios_2311_src/src/server.cpp +++ b/xios_2311_src/src/server.cpp @@ -14,20 +14,10 @@ #include "timer.hpp" #include "event_scheduler.hpp" #include "string_tools.hpp" -#include "ressources_manager.hpp" -#include "services_manager.hpp" -#include "contexts_manager.hpp" -#include "servers_ressource.hpp" -#include -#include "workflow_graph.hpp" -#include "release_static_allocation.hpp" - - namespace xios { MPI_Comm CServer::intraComm ; - MPI_Comm CServer::serversComm_ ; std::list CServer::interCommLeft ; std::list CServer::interCommRight ; std::list CServer::contextInterComms; @@ -43,261 +33,372 @@ namespace xios bool CServer::finished=false ; bool CServer::is_MPI_Initialized ; CEventScheduler* CServer::eventScheduler = 0; - CServersRessource* CServer::serversRessource_=nullptr ; - +//--------------------------------------------------------------- +/*! + * \fn void CServer::initialize(void) + * Creates intraComm for each possible type of servers (classical, primary or secondary). + * Creates interComm and stores them into the following lists: + * classical server -- interCommLeft + * primary server -- interCommLeft and interCommRight + * secondary server -- interCommLeft for each pool. + * IMPORTANT: CXios::usingServer2 should NOT be used beyond this function. Use CServer::serverLevel instead. + */ void CServer::initialize(void) { - - MPI_Comm serverComm ; int initialized ; MPI_Initialized(&initialized) ; if (initialized) is_MPI_Initialized=true ; else is_MPI_Initialized=false ; - MPI_Comm globalComm=CXios::getGlobalComm() ; + int rank ; - ///////////////////////////////////////// - ///////////// PART 1 //////////////////// - ///////////////////////////////////////// - // don't use OASIS + // Not using OASIS if (!CXios::usingOasis) { - if (!is_MPI_Initialized) MPI_Init(NULL, NULL); - - // split the global communicator - // get hash from all model to attribute a unique color (int) and then split to get client communicator - // every mpi process of globalComm (MPI_COMM_WORLD) must participate - - int commRank, commSize ; - MPI_Comm_rank(globalComm,&commRank) ; - MPI_Comm_size(globalComm,&commSize) ; - - std::hash hashString ; - size_t hashServer=hashString(CXios::xiosCodeId) ; - - size_t* hashAll = new size_t[commSize] ; - MPI_Allgather(&hashServer,1,MPI_SIZE_T,hashAll,1,MPI_SIZE_T,globalComm) ; - - int color=0 ; - map listHash ; - for(int i=0 ; i<=commSize ; i++) - if (listHash.count(hashAll[i])==0) - { - listHash[hashAll[i]]=color ; - color=color+1 ; - } - color=listHash[hashServer] ; - delete[] hashAll ; - MPI_Comm_split(globalComm, color, commRank, &serverComm) ; - } - else // using OASIS - { - if (!is_MPI_Initialized) oasis_init(CXios::xiosCodeId); + if (!is_MPI_Initialized) + { + MPI_Init(NULL, NULL); + } + CTimer::get("XIOS").resume() ; - oasis_get_localcomm(serverComm); - } - CTimer::get("XIOS").resume() ; - CTimer::get("XIOS initialize").resume() ; - - ///////////////////////////////////////// - ///////////// PART 2 //////////////////// - ///////////////////////////////////////// - + boost::hash hashString ; + unsigned long hashServer = hashString(CXios::xiosCodeId); - // Create the XIOS communicator for every process which is related - // to XIOS, as well on client side as on server side - MPI_Comm xiosGlobalComm ; - string strIds=CXios::getin("clients_code_id","") ; - vector clientsCodeId=splitRegex(strIds,"\\s*,\\s*") ; - if (strIds.empty()) - { - // no code Ids given, suppose XIOS initialisation is global - int commRank, commGlobalRank, serverLeader, clientLeader,serverRemoteLeader,clientRemoteLeader ; - MPI_Comm splitComm,interComm ; - MPI_Comm_rank(globalComm,&commGlobalRank) ; - MPI_Comm_split(globalComm, 1, commGlobalRank, &splitComm) ; - MPI_Comm_rank(splitComm,&commRank) ; - if (commRank==0) serverLeader=commGlobalRank ; - else serverLeader=0 ; - clientLeader=0 ; - MPI_Allreduce(&clientLeader,&clientRemoteLeader,1,MPI_INT,MPI_SUM,globalComm) ; - MPI_Allreduce(&serverLeader,&serverRemoteLeader,1,MPI_INT,MPI_SUM,globalComm) ; - MPI_Intercomm_create(splitComm, 0, globalComm, clientRemoteLeader,1341,&interComm) ; - MPI_Intercomm_merge(interComm,false,&xiosGlobalComm) ; - CXios::setXiosComm(xiosGlobalComm) ; - } - else - { + unsigned long* hashAll ; + unsigned long* srvLevelAll ; - xiosGlobalCommByFileExchange(serverComm) ; + int size ; + int myColor ; + int i,c ; + MPI_Comm newComm; - } - - ///////////////////////////////////////// - ///////////// PART 4 //////////////////// - // create servers intra communicator // - ///////////////////////////////////////// - - int commRank ; - MPI_Comm_rank(CXios::getXiosComm(), &commRank) ; - MPI_Comm_split(CXios::getXiosComm(),true,commRank,&serversComm_) ; - - CXios::setUsingServer() ; + MPI_Comm_size(CXios::globalComm, &size) ; + MPI_Comm_rank(CXios::globalComm, &rank_); - ///////////////////////////////////////// - ///////////// PART 5 //////////////////// - // redirect files output // - ///////////////////////////////////////// - - CServer::openInfoStream(CXios::serverFile); - CServer::openErrorStream(CXios::serverFile); + hashAll=new unsigned long[size] ; + MPI_Allgather(&hashServer, 1, MPI_LONG, hashAll, 1, MPI_LONG, CXios::globalComm) ; - ///////////////////////////////////////// - ///////////// PART 4 //////////////////// - ///////////////////////////////////////// + map colors ; + map leaders ; + map::iterator it ; - CXios::launchDaemonsManager(true) ; - - ///////////////////////////////////////// - ///////////// PART 5 //////////////////// - ///////////////////////////////////////// + // (1) Establish client leaders, distribute processes between two server levels + std::vector srvRanks; + for(i=0,c=0;i reqNbProc || nbPools < 1) + { + error(0)<<"WARNING: void CServer::initialize(void)"<= firstSndSrvRank) + { + if (rank_ == srvRanks[i]) + { + serverLevel=2; + } + poolLeader += procsPerPool; + if (remainder != 0) + { + ++poolLeader; + --remainder; + } +//*********** (2) Comment out the two lines below to set one process per pool + if (poolLeader < srvRanks.size()) + sndServerGlobalRanks.push_back(srvRanks[poolLeader]); +//*********** (3) Uncomment the line below to set one process per pool +// sndServerGlobalRanks.push_back(srvRanks[i]); + } + else + { + if (rank_ == srvRanks[i]) serverLevel=1; + } + } + if (serverLevel==2) + { + info(50)<<"The number of secondary server pools is "<< sndServerGlobalRanks.size() <= sndServerGlobalRanks[i]) + { + if ( i == sndServerGlobalRanks.size()-1) + { + myColor = colors.size() + sndServerGlobalRanks[i]; + } + else if (rank_< sndServerGlobalRanks[i+1]) + { + myColor = colors.size() + sndServerGlobalRanks[i]; + break; + } + } + } + } + } + } - auto ressourcesManager=CXios::getRessourcesManager() ; - auto servicesManager=CXios::getServicesManager() ; - auto contextsManager=CXios::getContextsManager() ; - auto daemonsManager=CXios::getDaemonsManager() ; - auto serversRessource=CServer::getServersRessource() ; + // (2) Create intraComm + if (serverLevel != 2) myColor=colors[hashServer]; + MPI_Comm_split(CXios::globalComm, myColor, rank_, &intraComm) ; - if (serversRessource->isServerLeader()) - { - int nbRessources = ressourcesManager->getRessourcesSize() ; - if (!CXios::usingServer2) + // (3) Create interComm + if (serverLevel == 0) + { + int clientLeader; + for(it=leaders.begin();it!=leaders.end();it++) + { + if (it->first!=hashServer) + { + clientLeader=it->second ; + int intraCommSize, intraCommRank ; + MPI_Comm_size(intraComm,&intraCommSize) ; + MPI_Comm_rank(intraComm,&intraCommRank) ; + info(50)<<"intercommCreate::server (classical mode) "<createPool(CXios::defaultPoolId, nbRessources) ; - servicesManager->createServices(CXios::defaultPoolId, CXios::defaultServerId, CServicesManager::IO_SERVER,nbRessources,1) ; + int clientLeader, srvSndLeader; + int srvPrmLeader ; + + for (it=leaders.begin();it!=leaders.end();it++) + { + if (it->first != hashServer) + { + clientLeader=it->second ; + int intraCommSize, intraCommRank ; + MPI_Comm_size(intraComm, &intraCommSize) ; + MPI_Comm_rank(intraComm, &intraCommRank) ; + info(50)<<"intercommCreate::server (server level 1) "<createPool(CXios::defaultPoolId, nbRessources) ; - servicesManager->createServices(CXios::defaultPoolId, CXios::defaultGathererId, CServicesManager::GATHERER, nprocsGatherer, 1) ; - servicesManager->createServices(CXios::defaultPoolId, CXios::defaultServerId, CServicesManager::OUT_SERVER, nprocsServer, nbPoolsServer2) ; + int clientLeader; + clientLeader = leaders[hashString(CXios::xiosCodeId)]; + int intraCommSize, intraCommRank ; + MPI_Comm_size(intraComm, &intraCommSize) ; + MPI_Comm_rank(intraComm, &intraCommRank) ; + info(50)<<"intercommCreate::server (server level 2) "<eventLoop() ; } - CTimer::get("XIOS event loop").suspend() ; - - // Delete CContext - //CObjectTemplate::cleanStaticDataStructure(); - } + // using OASIS + else + { + int size; + int myColor; + int* srvGlobalRanks; + if (!is_MPI_Initialized) oasis_init(CXios::xiosCodeId); + CTimer::get("XIOS").resume() ; + MPI_Comm localComm; + oasis_get_localcomm(localComm); + MPI_Comm_rank(localComm,&rank_) ; +// (1) Create server intraComm + if (!CXios::usingServer2) + { + MPI_Comm_dup(localComm, &intraComm); + } + else + { + int globalRank; + MPI_Comm_size(localComm,&size) ; + MPI_Comm_rank(CXios::globalComm,&globalRank) ; + srvGlobalRanks = new int[size] ; + MPI_Allgather(&globalRank, 1, MPI_INT, srvGlobalRanks, 1, MPI_INT, localComm) ; + + int reqNbProc = size*CXios::ratioServer2/100.; + if (reqNbProc < 1 || reqNbProc == size) + { + error(0)<<"WARNING: void CServer::initialize(void)"< reqNbProc || nbPools < 1) + { + error(0)<<"WARNING: void CServer::initialize(void)"<= firstSndSrvRank) + { + if (globalRank == srvGlobalRanks[i]) + { + serverLevel=2; + } + poolLeader += procsPerPool; + if (remainder != 0) + { + ++poolLeader; + --remainder; + } +//*********** (2) Comment out the two lines below to set one process per pool +// if (poolLeader < size) +// sndServerGlobalRanks.push_back(srvGlobalRanks[poolLeader]); +//*********** (3) Uncomment the line below to set one process per pool + sndServerGlobalRanks.push_back(srvGlobalRanks[i]); + } + else + { + if (globalRank == srvGlobalRanks[i]) serverLevel=1; + } + } + if (serverLevel==2) + { + info(50)<<"The number of secondary server pools is "<< sndServerGlobalRanks.size() <= sndServerGlobalRanks[i]) + { + if (i == sndServerGlobalRanks.size()-1) + { + myColor = sndServerGlobalRanks[i]; + } + else if (globalRank< sndServerGlobalRanks[i+1]) + { + myColor = sndServerGlobalRanks[i]; + break; + } + } + } + } + if (serverLevel != 2) myColor=0; + MPI_Comm_split(localComm, myColor, rank_, &intraComm) ; + } + } + string codesId=CXios::getin("oasis_codes_id") ; + vector oasisCodeId=splitRegex(codesId,"\\s*,\\s*") ; + + vector::iterator it ; + MPI_Comm newComm ; + int globalRank ; + MPI_Comm_rank(CXios::globalComm,&globalRank); - void CServer::xiosGlobalCommByFileExchange(MPI_Comm serverComm) - { - - MPI_Comm globalComm=CXios::getGlobalComm() ; - MPI_Comm xiosGlobalComm ; - - string strIds=CXios::getin("clients_code_id","") ; - vector clientsCodeId=splitRegex(strIds,"\\s*,\\s*") ; - - int commRank, globalRank ; - MPI_Comm_rank(serverComm, &commRank) ; - MPI_Comm_rank(globalComm, &globalRank) ; - string serverFileName("__xios_publisher::"+CXios::xiosCodeId+"__to_remove__") ; - - if (commRank==0) // if root process publish name - { - std::ofstream ofs (serverFileName, std::ofstream::out); - ofs< clientsRank(clientsCodeId.size()) ; - for(int i=0;i>clientsRank[i] ; - ifs.close() ; - } + oasis_get_intercomm(newComm,*it) ; + if ( serverLevel == 0 || serverLevel == 1) + { + interCommLeft.push_back(newComm) ; + if (rank_==0) MPI_Send(&globalRank,1,MPI_INT,0,0,newComm) ; + } + } - MPI_Comm intraComm ; - MPI_Comm_dup(serverComm,&intraComm) ; - MPI_Comm interComm ; - for(int i=0 ; i("call_oasis_enddef",true) ; + if (!oasisEnddef) oasis_enddef() ; + } - void CServer::xiosGlobalCommByPublishing(MPI_Comm serverComm) - { - // untested, need to be tested on a true MPI-2 compliant library - - // try to discover other client/server -/* - // publish server name - char portName[MPI_MAX_PORT_NAME]; - int ierr ; - int commRank ; - MPI_Comm_rank(serverComm, &commRank) ; - - if (commRank==0) // if root process publish name - { - MPI_Open_port(MPI_INFO_NULL, portName); - MPI_Publish_name(CXios::xiosCodeId.c_str(), MPI_INFO_NULL, portName); - } - MPI_Comm intraComm=serverComm ; - MPI_Comm interComm ; - for(int i=0 ; i::iterator it = contextInterComms.begin(); it != contextInterComms.end(); it++) - MPI_Comm_free(&(*it)); + /* MPI_Comm_free(&(*it)) */; // WARNING remove freeing communicator !! --> deadlock raised, to be checked for (std::list::iterator it = contextIntraComms.begin(); it != contextIntraComms.end(); it++) MPI_Comm_free(&(*it)); +// for (std::list::iterator it = interComm.begin(); it != interComm.end(); it++) +// MPI_Comm_free(&(*it)); + +// for (std::list::iterator it = interCommLeft.begin(); it != interCommLeft.end(); it++) +// MPI_Comm_free(&(*it)); + for (std::list::iterator it = interCommRight.begin(); it != interCommRight.end(); it++) - MPI_Comm_free(&(*it)); + /* MPI_Comm_free(&(*it)) */ ; // WARNING remove freeing communicator !! --> deadlock raised, to be checked -// MPI_Comm_free(&intraComm); - CXios::finalizeDaemonsManager(); - finalizeServersRessource(); - - CContext::removeAllContexts() ; // free memory for related context - - CXios::getMpiGarbageCollector().release() ; // release unfree MPI ressources + MPI_Comm_free(&intraComm); if (!is_MPI_Initialized) { @@ -330,11 +431,445 @@ namespace xios report(0)<<"Performance report : Time spent in processing events : "<checkEvent() ; + } + CTimer::get("XIOS server").suspend() ; + } + + void CServer::listenFinalize(void) + { + list::iterator it, itr; + int msg ; + int flag ; + + for(it=interCommLeft.begin();it!=interCommLeft.end();it++) + { + MPI_Status status ; + traceOff() ; + MPI_Iprobe(0,0,*it,&flag,&status) ; + traceOn() ; + if (flag==true) + { + MPI_Recv(&msg,1,MPI_INT,0,0,*it,&status) ; + info(20)<<" CServer : Receive client finalize"< deadlock raised, to be checked + interCommLeft.erase(it) ; + break ; + } + } + + if (interCommLeft.empty()) + { + int i,size ; + MPI_Comm_size(intraComm,&size) ; + MPI_Request* requests= new MPI_Request[size-1] ; + MPI_Status* status= new MPI_Status[size-1] ; + + for(int i=1;i::iterator it; + int msg ; + static int nbCompound=0 ; + int size ; + static bool sent=false ; + static MPI_Request* allRequests ; + static MPI_Status* allStatus ; + + + if (sent) + { + MPI_Comm_size(intraComm,&size) ; + MPI_Testall(size,allRequests, &flag, allStatus) ; + if (flag==true) + { + delete [] allRequests ; + delete [] allStatus ; + sent=false ; + } + } + + + for(it=interCommLeft.begin();it!=interCommLeft.end();it++) + { + MPI_Status status ; + traceOff() ; + MPI_Iprobe(0,5,*it,&flag,&status) ; // tags oasis_endded = 5 + traceOn() ; + if (flag==true) + { + MPI_Recv(&msg,1,MPI_INT,0,5,*it,&status) ; // tags oasis_endded = 5 + nbCompound++ ; + if (nbCompound==interCommLeft.size()) + { + for (std::list::iterator it = interCommRight.begin(); it != interCommRight.end(); it++) + { + MPI_Send(&msg,1,MPI_INT,0,5,*it) ; // tags oasis_endded = 5 + } + MPI_Comm_size(intraComm,&size) ; + allRequests= new MPI_Request[size] ; + allStatus= new MPI_Status[size] ; + for(int i=0;i hashString; + size_t hashId = hashString("oasis_enddef"); + if (eventScheduler->queryEvent(0,hashId)) + { + oasis_enddef() ; + eventSent=false ; + } + } + + traceOff() ; + MPI_Iprobe(root,5,intraComm, &flag, &status) ; + traceOn() ; + if (flag==true) + { + MPI_Recv(&msg,1,MPI_INT,root,5,intraComm,&status) ; // tags oasis_endded = 5 + boost::hash hashString; + size_t hashId = hashString("oasis_enddef"); + eventScheduler->registerEvent(0,hashId); + eventSent=true ; + } + } + + + + + + void CServer::listenContext(void) + { + + MPI_Status status ; + int flag ; + static char* buffer ; + static MPI_Request request ; + static bool recept=false ; + int rank ; + int count ; + + if (recept==false) + { + traceOff() ; + MPI_Iprobe(MPI_ANY_SOURCE,1,CXios::globalComm, &flag, &status) ; + traceOn() ; + if (flag==true) + { + rank=status.MPI_SOURCE ; + MPI_Get_count(&status,MPI_CHAR,&count) ; + buffer=new char[count] ; + MPI_Irecv((void*)buffer,count,MPI_CHAR,rank,1,CXios::globalComm,&request) ; + recept=true ; + } + } + else + { + traceOff() ; + MPI_Test(&request,&flag,&status) ; + traceOn() ; + if (flag==true) + { + rank=status.MPI_SOURCE ; + MPI_Get_count(&status,MPI_CHAR,&count) ; + recvContextMessage((void*)buffer,count) ; + delete [] buffer ; + recept=false ; + } + } + } + + void CServer::recvContextMessage(void* buff,int count) + { + static map recvContextId; + map::iterator it ; + CBufferIn buffer(buff,count) ; + string id ; + int clientLeader ; + int nbMessage ; + + buffer>>id>>nbMessage>>clientLeader ; + + it=recvContextId.find(id) ; + if (it==recvContextId.end()) + { + contextMessage msg={0,0} ; + pair::iterator,bool> ret ; + ret=recvContextId.insert(pair(id,msg)) ; + it=ret.first ; + } + it->second.nbRecv+=1 ; + it->second.leaderRank+=clientLeader ; + + if (it->second.nbRecv==nbMessage) + { + int size ; + MPI_Comm_size(intraComm,&size) ; +// MPI_Request* requests= new MPI_Request[size-1] ; +// MPI_Status* status= new MPI_Status[size-1] ; + MPI_Request* requests= new MPI_Request[size] ; + MPI_Status* status= new MPI_Status[size] ; + + CMessage msg ; + msg<second.leaderRank; + int messageSize=msg.size() ; + void * sendBuff = new char[messageSize] ; + CBufferOut sendBuffer(sendBuff,messageSize) ; + sendBuffer< buffers; + static std::vector requests ; + static std::vector counts ; + static std::vector isEventRegistered ; + static std::vector isEventQueued ; + MPI_Request request; + + int rank ; + const int root=0 ; + boost::hash hashString; + size_t hashId = hashString("RegisterContext"); + + // (1) Receive context id from the root, save it into a buffer + traceOff() ; + MPI_Iprobe(root,2,intraComm, &flag, &status) ; + traceOn() ; + if (flag==true) + { + counts.push_back(0); + MPI_Get_count(&status,MPI_CHAR,&(counts.back())) ; + buffers.push_back(new char[counts.back()]) ; + requests.push_back(request); + MPI_Irecv((void*)(buffers.back()),counts.back(),MPI_CHAR,root,2,intraComm,&(requests.back())) ; + isEventRegistered.push_back(false); + isEventQueued.push_back(false); + nbContexts++; + } + + for (int ctxNb = 0; ctxNb < nbContexts; ctxNb++ ) + { + // (2) If context id is received, register an event + MPI_Test(&requests[ctxNb],&flag,&status) ; + if (flag==true && !isEventRegistered[ctxNb]) + { + eventScheduler->registerEvent(ctxNb,hashId); + isEventRegistered[ctxNb] = true; + } + // (3) If event has been scheduled, call register context + if (eventScheduler->queryEvent(ctxNb,hashId) && !isEventQueued[ctxNb]) + { + registerContext(buffers[ctxNb],counts[ctxNb]) ; + isEventQueued[ctxNb] = true; + delete [] buffers[ctxNb] ; + } + } + + } + + void CServer::registerContext(void* buff, int count, int leaderRank) + { + string contextId; + CBufferIn buffer(buff, count); +// buffer >> contextId; + buffer >> contextId>>leaderRank; + CContext* context; + + info(20) << "CServer : Register new Context : " << contextId << endl; + + if (contextList.find(contextId) != contextList.end()) + ERROR("void CServer::registerContext(void* buff, int count, int leaderRank)", + << "Context '" << contextId << "' has already been registred"); + + context=CContext::create(contextId); + contextList[contextId]=context; + + // Primary or classical server: create communication channel with a client + // (1) create interComm (with a client) + // (2) initialize client and server (contextClient and contextServer) + MPI_Comm inter; + if (serverLevel < 2) + { + MPI_Comm contextInterComm; + MPI_Intercomm_create(intraComm, 0, CXios::globalComm, leaderRank, 10+leaderRank, &contextInterComm); + MPI_Intercomm_merge(contextInterComm,1,&inter); + MPI_Barrier(inter); + MPI_Comm_free(&inter); + context->initServer(intraComm,contextInterComm); + contextInterComms.push_back(contextInterComm); + + } + // Secondary server: create communication channel with a primary server + // (1) duplicate interComm with a primary server + // (2) initialize client and server (contextClient and contextServer) + // Remark: in the case of the secondary server there is no need to create an interComm calling MPI_Intercomm_create, + // because interComm of CContext is defined on the same processes as the interComm of CServer. + // So just duplicate it. + else if (serverLevel == 2) + { + MPI_Comm_dup(interCommLeft.front(), &inter); + contextInterComms.push_back(inter); + context->initServer(intraComm, contextInterComms.back()); + } + + // Primary server: + // (1) send create context message to secondary servers + // (2) initialize communication channels with secondary servers (create contextClient and contextServer) + if (serverLevel == 1) + { + int i = 0, size; + MPI_Comm_size(intraComm, &size) ; + for (std::list::iterator it = interCommRight.begin(); it != interCommRight.end(); it++, ++i) + { + StdString str = contextId +"_server_" + boost::lexical_cast(i); + CMessage msg; + int messageSize; + msg<initClient(contextIntraComms.back(), contextInterComms.back()) ; + delete [] buff ; + } + } + } + + void CServer::contextEventLoop(bool enableEventsProcessing /*= true*/) + { + bool isFinalized ; + map::iterator it ; + + for(it=contextList.begin();it!=contextList.end();it++) + { + isFinalized=it->second->isFinalized(); + if (isFinalized) + { + contextList.erase(it) ; + break ; + } + else + it->second->checkBuffersAndListen(enableEventsProcessing); + } + } + + //! Get rank of the current process in the intraComm + int CServer::getRank() + { + int rank; + MPI_Comm_rank(intraComm,&rank); + return rank; + } + + vector& CServer::getSecondaryServerGlobalRanks() + { + return sndServerGlobalRanks; + } + /*! * Open a file specified by a suffix and an extension and use it for the given file buffer. * The file name will be suffix+rank+extension. @@ -345,27 +880,23 @@ namespace xios */ void CServer::openStream(const StdString& fileName, const StdString& ext, std::filebuf* fb) { - StdStringStream fileNameServer; + StdStringStream fileNameClient; int numDigit = 0; - int commSize = 0; - int commRank ; + int size = 0; int id; - - MPI_Comm_size(CXios::getGlobalComm(), &commSize); - MPI_Comm_rank(CXios::getGlobalComm(), &commRank); - - while (commSize) + MPI_Comm_size(CXios::globalComm, &size); + while (size) { - commSize /= 10; + size /= 10; ++numDigit; } - id = commRank; + id = rank_; //getRank(); - fileNameServer << fileName << "_" << std::setfill('0') << std::setw(numDigit) << id << ext; - fb->open(fileNameServer.str().c_str(), std::ios::out); + fileNameClient << fileName << "_" << std::setfill('0') << std::setw(numDigit) << id << ext; + fb->open(fileNameClient.str().c_str(), std::ios::out); if (!fb->is_open()) ERROR("void CServer::openStream(const StdString& fileName, const StdString& ext, std::filebuf* fb)", - << std::endl << "Can not open <" << fileNameServer.str() << "> file to write the server log(s)."); + << std::endl << "Can not open <" << fileNameClient.str() << "> file to write the server log(s)."); } /*! @@ -421,14 +952,4 @@ namespace xios { if (m_errorStream.is_open()) m_errorStream.close(); } - - void CServer::launchServersRessource(MPI_Comm serverComm) - { - serversRessource_ = new CServersRessource(serverComm) ; - } - - void CServer::finalizeServersRessource(void) - { - delete serversRessource_; serversRessource_=nullptr ; - } } diff --git a/xios_2311_src/src/server.hpp b/xios_2311_src/src/server.hpp index 90e18641019f81b8d813e4418f49fb32203142bc..6d1e2e354fc24c51fb9e982068443063b26d3b05 100644 --- a/xios_2311_src/src/server.hpp +++ b/xios_2311_src/src/server.hpp @@ -9,20 +9,23 @@ namespace xios { - class CServersRessource ; - class CServer { public: static void initialize(void); - static void xiosGlobalCommByFileExchange(MPI_Comm serverComm) ; - static void xiosGlobalCommByPublishing(MPI_Comm serverComm) ; - static void finalize(void); static void eventLoop(void); - + static void contextEventLoop(bool enableEventsProcessing=true); + static void listenContext(void); + static void listenFinalize(void); + static void recvContextMessage(void* buff,int count); + static void listenRootContext(void); + static void listenRootFinalize(void); + static void listenRootOasisEnddef(void); + static void listenOasisEnddef(void); + static void registerContext(void* buff,int count, int leaderRank=0); + static MPI_Comm intraComm; - static MPI_Comm serversComm_; static std::list interCommLeft; // interComm between server (primary, classical or secondary) and its client (client or primary server) static std::list interCommRight; // interComm between primary server and secondary server (non-empty only for primary server pool) static std::list contextInterComms; // list of context intercomms @@ -64,18 +67,13 @@ namespace xios //! Close the error log file if it opens static void closeErrorStream(); - static CServersRessource* getServersRessource(void) { return serversRessource_;} - static void launchServersRessource(MPI_Comm commServer) ; - static void finalizeServersRessource(void) ; - static void openStream(const StdString& fileName, const StdString& ext, std::filebuf* fb); - private: static vector sndServerGlobalRanks; //!< Global ranks of pool leaders on the secondary server static int rank_; //!< If (!oasis) global rank, else rank in the intraComm returned by oasis static int nbContexts; //!< Number of contexts registered by server static StdOFStream m_infoStream; static StdOFStream m_errorStream; - static CServersRessource* serversRessource_ ; + static void openStream(const StdString& fileName, const StdString& ext, std::filebuf* fb); }; } diff --git a/xios_2311_src/src/test/generic_testcase.f90 b/xios_2311_src/src/test/generic_testcase.f90 old mode 100755 new mode 100644 index 4ef467d4f49e9c6c086ddc461f77f02de12e7e6e..75815ee7c778c0701a78f38fef9902e1d7400dd9 --- a/xios_2311_src/src/test/generic_testcase.f90 +++ b/xios_2311_src/src/test/generic_testcase.f90 @@ -1,4 +1,4 @@ -PROGRAM generic_testcase +PROGRAM generic_testcase USE xios USE mod_wait IMPLICIT NONE @@ -10,7 +10,6 @@ PROGRAM generic_testcase INTEGER :: nb_proc_atm INTEGER :: nb_proc_oce INTEGER :: nb_proc_surf - INTEGER :: nb_proc_server CHARACTER(LEN=len_str) :: proc_distribution CHARACTER(LEN=len_str) :: start_date CHARACTER(LEN=len_str) :: duration @@ -33,10 +32,7 @@ PROGRAM generic_testcase INTEGER :: nlev CHARACTER(len_str) :: init_field2D="" DOUBLE PRECISION :: pressure_factor - LOGICAL :: domain_mask - CHARACTER(len_str) :: domain_mask_type="" - LOGICAL :: scalar_mask - CHARACTER(len_str) :: scalar_mask_type="" + LOGICAL :: domain_mask LOGICAL :: axis_mask LOGICAL :: mask3d INTEGER :: field_sub_freq @@ -56,8 +52,7 @@ PROGRAM generic_testcase LOGICAL :: i_am_atm, i_am_oce, i_am_surf, i_am_server INTEGER :: rank, size_loc - INTEGER :: nb_procs(4) - LOGICAL :: who_i_am(4) + OPEN(unit=unit, file='param.def',status='old',iostat=ierr) nb_proc_atm=1 @@ -81,7 +76,6 @@ PROGRAM generic_testcase CALL MPI_ABORT() endif - nb_proc_server=size_loc-(nb_proc_atm + nb_proc_oce + nb_proc_surf) i_am_atm=.FALSE. ; i_am_oce=.FALSE. ; i_am_surf=.FALSE. ; i_am_server=.FALSE. IF (proc_distribution=="contiguous") THEN @@ -97,14 +91,7 @@ PROGRAM generic_testcase ELSE i_am_server=.TRUE. ENDIF ; - ELSE IF (proc_distribution=="cyclic") THEN - ! server ranks are dispatched all along the partition - nb_procs(1)=nb_proc_atm ; nb_procs(2)=nb_proc_oce ; nb_procs(3)=nb_proc_surf ; nb_procs(4)=nb_proc_server - CALL compute_cyclic_distribution(rank, nb_procs, who_i_am ) - i_am_atm=who_i_am(1) - i_am_oce=who_i_am(2) - i_am_surf=who_i_am(3) - i_am_server=who_i_am(4) + ENDIF @@ -114,12 +101,11 @@ PROGRAM generic_testcase ELSE IF (i_am_atm) CALL model("atm") - IF (i_am_oce) CALL model("oce") - IF (i_am_surf) CALL model("surf") CALL xios_finalize() ENDIF + print*, "finished Successfully" CALL MPI_FINALIZE(ierr) CONTAINS @@ -143,7 +129,6 @@ CONTAINS LOGICAL, POINTER :: domain_mask(:) INTEGER, POINTER :: domain_index(:) LOGICAL, POINTER :: axis_mask(:) - LOGICAL :: scalar_mask INTEGER, POINTER :: axis_index(:) DOUBLE PRECISION, POINTER :: ensemble_value(:) @@ -163,7 +148,6 @@ CONTAINS DOUBLE PRECISION, POINTER :: fieldXY_init(:,:) DOUBLE PRECISION, POINTER :: field2D(:), other_field2D(:) - DOUBLE PRECISION :: field0D, other_field0D DOUBLE PRECISION, POINTER :: field_X(:), other_field_X(:) DOUBLE PRECISION, POINTER :: field_Y(:), other_field_Y(:) DOUBLE PRECISION, POINTER :: field_Z(:), other_field_Z(:) @@ -176,10 +160,9 @@ CONTAINS DOUBLE PRECISION, POINTER :: field3D(:,:), other_field3D(:,:) DOUBLE PRECISION, POINTER :: field3D_sub(:,:), other_field3D_sub(:,:) DOUBLE PRECISION, POINTER :: field3D_recv(:,:), other_field3D_recv(:,:) - DOUBLE PRECISION, POINTER :: pressure(:,:), other_pressure(:,:) + DOUBLE PRECISION, POINTER :: pressure(:,:), other_pressure(:,:), pressure_shifted(:,:) DOUBLE PRECISION, POINTER :: field2D_W(:,:), other_field2D_W(:,:) - DOUBLE PRECISION, POINTER :: field0D_W(:), other_field0D_W(:) DOUBLE PRECISION, POINTER :: field_XW(:,:), other_field_XW(:,:) DOUBLE PRECISION, POINTER :: field_YW(:,:), other_field_YW(:,:) DOUBLE PRECISION, POINTER :: field_ZW(:,:), other_field_ZW(:,:) @@ -204,17 +187,19 @@ CONTAINS LOGICAL :: ok INTEGER :: ierr - LOGICAL :: ok_field0D, ok_field2D, ok_field3D, ok_pressure, ok_field2D_sub, ok_field3D_sub,ok_field3D_recv, ok_field3D_send + LOGICAL :: ok_field2D, ok_field3D, ok_pressure_shifted, ok_pressure, ok_field2D_sub, ok_field3D_sub,ok_field3D_recv, ok_field3D_send LOGICAL :: ok_field_X, ok_field_Y, ok_field_XY, ok_field_Z, ok_field_XYZ, ok_field_XZ, ok_field_YZ - LOGICAL :: ok_field0D_W, ok_field2D_W, ok_field3D_W, ok_pressure_W, ok_field2D_sub_W, ok_field3D_sub_W,ok_field3D_recv_W, ok_field3D_send_W + LOGICAL :: ok_field2D_W, ok_field3D_W, ok_pressure_W, ok_field2D_sub_W, ok_field3D_sub_W,ok_field3D_recv_W, ok_field3D_send_W LOGICAL :: ok_field_XW, ok_field_YW, ok_field_XYW, ok_field_ZW, ok_field_XYZW, ok_field_XZW, ok_field_YZW - LOGICAL :: ok_other_field0D, ok_other_field2D, ok_other_field3D, ok_other_pressure, ok_other_field2D_sub, ok_other_field3D_sub,ok_other_field3D_recv, ok_other_field3D_send - LOGICAL :: ok_other_field_X, ok_other_field_Y, ok_other_field_XY, ok_other_field_Z, ok_other_field_XYZ, ok_other_field_XZ, ok_other_field_YZ - LOGICAL :: ok_other_field0D_W, ok_other_field2D_W, ok_other_field3D_W, ok_other_pressure_W, ok_other_field2D_sub_W, ok_other_field3D_sub_W,ok_other_field3D_recv_W, ok_other_field3D_send_W - LOGICAL :: ok_other_field_XW, ok_other_field_YW, ok_other_field_XYW, ok_other_field_ZW, ok_other_field_XYZW, ok_other_field_XZW, ok_other_field_YZW - - TYPE(xios_domain) :: domain_handle + LOGICAL :: ok_other_field2D, ok_other_field3D, ok_other_pressure, ok_other_field2D_sub, ok_other_field3D_sub, & + ok_other_field3D_recv, ok_other_field3D_send + LOGICAL :: ok_other_field_X, ok_other_field_Y, ok_other_field_XY, ok_other_field_Z, ok_other_field_XYZ, & + ok_other_field_XZ, ok_other_field_YZ + LOGICAL :: ok_other_field2D_W, ok_other_field3D_W, ok_other_pressure_W, ok_other_field2D_sub_W, ok_other_field3D_sub_W, & + ok_other_field3D_recv_W, ok_other_field3D_send_W + LOGICAL :: ok_other_field_XW, ok_other_field_YW, ok_other_field_XYW, ok_other_field_ZW, ok_other_field_XYZW, & + ok_other_field_XZW, ok_other_field_YZW !! XIOS Initialization (get the local communicator) CALL xios_initialize(trim(model_id),return_comm=comm) @@ -251,7 +236,6 @@ CONTAINS Y_lon, Y_lat, Y_mask, Y_index) CALL init_axis("axis", comm, params, axis_value, axis_mask, axis_index) - CALL init_scalar("scalar", comm, params, scalar_mask) CALL init_ensemble("ensemble", comm, params, ensemble_value) CALL set_mask3d("grid3D",params, ni, nj, lon, lat , axis_value) @@ -305,8 +289,10 @@ CONTAINS z=size(axis_index) w=size(ensemble_value) + ALLOCATE(field2D(0:xy-1)) ALLOCATE(field3D(0:xy-1,0:z-1)) + ALLOCATE(pressure_shifted(0:xy-1,0:z-1)) ALLOCATE(pressure(0:xy-1,0:z-1)) ALLOCATE(field3D_recv(0:xy-1,0:z-1)) ALLOCATE(field_Z(0:z-1)) @@ -328,7 +314,6 @@ CONTAINS ALLOCATE(field_XYZW(0:x-1,0:y-1,0:z-1,0:w-1)) ALLOCATE(field_XZW(0:x-1,0:z-1,0:w-1)) ALLOCATE(field_YZW(0:y-1,0:z-1,0:w-1)) - ALLOCATE(field0D_W(0:w-1)) @@ -373,19 +358,19 @@ CONTAINS pressure=1e20 DO j=0,z-1 - pressure(:,j)=axis_value(j)*100000 ; ! Pa + pressure(:,j)=axis_value(j) * 100000; DO i=0,xy-1 IF (domain_index(i)/=-1) THEN k=domain_index(i) IF (domain_mask(k)) THEN dist=sqrt((lat(k)/90.)**2+(lon(k)/180.)**2) ; pressure(i,j)=pressure(i,j)*(1+params%pressure_factor*exp(-(4*dist)**2)) + pressure_shifted(i,j)=pressure(i,j)+5000 ENDIF ENDIF ENDDO ENDDO - field0D=1 field2D_W(:,0) = field2D(:)*(1+0.1*ensemble_value(0)) @@ -398,10 +383,10 @@ CONTAINS field_XYZW(:,:,:,0) = field_XYZ(:,:,:)*(1+0.1*ensemble_value(0)) field_XZW(:,:,0) = field_XZ(:,:)*(1+0.1*ensemble_value(0)) field_YZW(:,:,0) = field_YZ(:,:)*(1+0.1*ensemble_value(0)) - field0D_W(0) = field0D*(1+0.1*ensemble_value(0)) ok_field2D=xios_is_valid_field("field2D") ; ok_field3D=xios_is_valid_field("field3D") ; + ok_pressure_shifted=xios_is_valid_field("pressure_shifted") ; ok_pressure=xios_is_valid_field("pressure") ; ok_field2D_sub=xios_is_valid_field("field2D_sub") ; ok_field3D_sub=xios_is_valid_field("field3D_sub") ; @@ -412,7 +397,6 @@ CONTAINS ok_field_XYZ=xios_is_valid_field("field_XYZ") ; ok_field_XZ=xios_is_valid_field("field_XZ") ; ok_field_YZ=xios_is_valid_field("field_YZ") ; - ok_field0D=xios_is_valid_field("field0D") ; ok_field2D_W=xios_is_valid_field("field2D_W") ; ok_field3D_W=xios_is_valid_field("field3D_W") ; @@ -426,7 +410,6 @@ CONTAINS ok_field_XYZW=xios_is_valid_field("field_XYZW") ; ok_field_XZW=xios_is_valid_field("field_XZW") ; ok_field_YZW=xios_is_valid_field("field_YZW") ; - ok_field0D_W=xios_is_valid_field("field0D_W") ; @@ -461,7 +444,6 @@ CONTAINS Y_lon, Y_lat, Y_mask, Y_index) CALL init_axis("other_axis", comm, other_params, axis_value, axis_mask, axis_index) - CALL init_scalar("other_scalar", comm, params, scalar_mask) CALL init_ensemble("other_ensemble", comm, other_params, ensemble_value) CALL set_mask3d("other_grid3D",other_params, ni, nj, lon, lat , axis_value) @@ -538,7 +520,6 @@ CONTAINS ALLOCATE(other_field_XYZW(0:x-1,0:y-1,0:z-1,0:w-1)) ALLOCATE(other_field_XZW(0:x-1,0:z-1,0:w-1)) ALLOCATE(other_field_YZW(0:y-1,0:z-1,0:w-1)) - ALLOCATE(other_field0D_W(0:w-1)) @@ -583,7 +564,7 @@ CONTAINS other_pressure=1e20 DO j=0,z-1 - other_pressure(:,j)=axis_value(j)*100000 ; ! Pa + other_pressure(:,j)=axis_value(j) * 100000 ; DO i=0,xy-1 IF (domain_index(i)/=-1) THEN k=domain_index(i) @@ -595,7 +576,6 @@ CONTAINS ENDDO ENDDO - other_field0D = 1 other_field2D_W(:,0) = other_field2D(:)*(1+0.1*ensemble_value(0)) @@ -608,7 +588,6 @@ CONTAINS other_field_XYZW(:,:,:,0) = other_field_XYZ(:,:,:)*(1+0.1*ensemble_value(0)) other_field_XZW(:,:,0) = other_field_XZ(:,:)*(1+0.1*ensemble_value(0)) other_field_YZW(:,:,0) = other_field_YZ(:,:)*(1+0.1*ensemble_value(0)) - other_field0D_W(0) = other_field0D*(1+0.1*ensemble_value(0)) ok_other_field2D=xios_is_valid_field("other_field2D") ; @@ -623,7 +602,6 @@ CONTAINS ok_other_field_XYZ=xios_is_valid_field("other_field_XYZ") ; ok_other_field_XZ=xios_is_valid_field("other_field_XZ") ; ok_other_field_YZ=xios_is_valid_field("other_field_YZ") ; - ok_other_field0D=xios_is_valid_field("other_field0D") ; ok_other_field2D_W=xios_is_valid_field("other_field2D_W") ; ok_other_field3D_W=xios_is_valid_field("other_field3D_W") ; @@ -637,7 +615,6 @@ CONTAINS ok_other_field_XYZW=xios_is_valid_field("other_field_XYZW") ; ok_other_field_XZW=xios_is_valid_field("other_field_XZW") ; ok_other_field_YZW=xios_is_valid_field("other_field_YZW") ; - ok_other_field0D_W=xios_is_valid_field("other_field0D_W") ; !!!!!!!!!!!!!!!!!!!!! end of duplicated section !!!!!!!!!!!!!!!!!!!!!!!!!! @@ -646,15 +623,17 @@ CONTAINS cdate=cdate+dtime CALL xios_close_context_definition() CALL xios_set_current_context(trim(model_id)) -! CALL xios_get_handle("field3D::domain",domain_handle) + DO while ( cdate <= edate ) !!! Mise a jour du pas de temps CALL xios_update_calendar(ts) + IF (ok_field2D) CALL xios_send_field("field2D",field2D) IF (ok_field3D) CALL xios_send_field("field3D",field3D) + IF (ok_pressure_shifted) CALL xios_send_field("pressure_shifted",pressure_shifted) IF (ok_pressure) CALL xios_send_field("pressure",pressure) IF (ok_field_X) CALL xios_send_field("field_X",field_X) IF (ok_field_Y) CALL xios_send_field("field_Y",field_Y) @@ -663,7 +642,6 @@ CONTAINS IF (ok_field_XYZ) CALL xios_send_field("field_XYZ",field_XYZ) IF (ok_field_XZ) CALL xios_send_field("field_XZ",field_XZ) IF (ok_field_YZ) CALL xios_send_field("field_YZ",field_YZ) - IF (ok_field0D) CALL xios_send_field("field0D",field0D) IF ( MOD(params%field_sub_offset+ts-1,params%field_sub_freq)==0) THEN IF (ok_field2D_sub) CALL xios_send_field("field2D_sub",field2D*10) @@ -688,7 +666,6 @@ CONTAINS IF (ok_field_XYZW) CALL xios_send_field("field_XYZW",field_XYZW) IF (ok_field_XZW) CALL xios_send_field("field_XZW",field_XZW) IF (ok_field_YZW) CALL xios_send_field("field_YZW",field_YZW) - IF (ok_field0D_W) CALL xios_send_field("field0D_W",field0D_W) IF ( MOD(params%field_sub_offset+ts-1,params%field_sub_freq)==0) THEN IF (ok_field2D_sub_W) CALL xios_send_field("field2D_sub_W",field2D_W*10) @@ -704,7 +681,6 @@ CONTAINS field2D=field2D+1 field3D=field3D+1 - field0D=field0D+1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! duplicated section for other_ ! @@ -721,7 +697,6 @@ CONTAINS IF (ok_other_field_XY) CALL xios_send_field("other_field_XYZ", other_field_XYZ) IF (ok_other_field_XY) CALL xios_send_field("other_field_XZ", other_field_XZ) IF (ok_other_field_XY) CALL xios_send_field("other_field_YZ", other_field_YZ) - IF (ok_other_field0D) CALL xios_send_field("other_field0D", other_field0D) IF ( MOD(other_params%field_sub_offset+ts-1,other_params%field_sub_freq)==0) THEN IF (ok_other_field2D_sub) CALL xios_send_field("other_field2D_sub",other_field2D*10) @@ -739,14 +714,13 @@ CONTAINS IF (ok_other_field2D_W) CALL xios_send_field("other_field2D_W",other_field2D_W) IF (ok_other_field3D_W) CALL xios_send_field("other_field3D_W",other_field3D_W) IF (ok_other_pressure_W) CALL xios_send_field("other_pressure_W",other_pressure_W) - IF (ok_other_field_XW) CALL xios_send_field("other_field_XW",other_field_XW) - IF (ok_other_field_YW) CALL xios_send_field("other_field_YW",other_field_YW) + IF (ok_other_field_XW) CALL xios_send_field("other_field_XW",other_field_XW) + IF (ok_other_field_YW) CALL xios_send_field("other_field_YW",other_field_YW) IF (ok_other_field_XYW) CALL xios_send_field("other_field_XYW",other_field_XYW) - IF (ok_other_field_ZW) CALL xios_send_field("other_field_ZW",other_field_ZW) + IF (ok_other_field_ZW) CALL xios_send_field("other_field_ZW",other_field_ZW) IF (ok_other_field_XYW) CALL xios_send_field("other_field_XYZW",other_field_XYZW) IF (ok_other_field_XYW) CALL xios_send_field("other_field_XZW",other_field_XZW) IF (ok_other_field_XYW) CALL xios_send_field("other_field_YZW",other_field_YZW) - IF (ok_other_field0D_W) CALL xios_send_field("other_field0D_W",other_field0D_W) IF ( MOD(other_params%field_sub_offset+ts-1,other_params%field_sub_freq)==0) THEN IF (ok_other_field2D_sub_W) CALL xios_send_field("other_field2D_sub_W",other_field2D_W*10) @@ -762,7 +736,6 @@ CONTAINS other_field2D=other_field2D+1 other_field3D=other_field3D+1 - other_field0D=other_field0D+1 !!!!!!!!!!!!!!!!!!!!!! end of duplicated section !!!!!!!!!!!!!!!!! @@ -789,9 +762,6 @@ CONTAINS IF (.NOT. xios_getvar(prefix//"timestep", params%timestep) ) params%timestep="1h" IF (.NOT. xios_getvar(prefix//"domain", params%domain) ) params%domain="lmdz" IF (.NOT. xios_getvar(prefix//"domain_mask", params%domain_mask) ) params%domain_mask=.FALSE. - IF (.NOT. xios_getvar(prefix//"domain_mask_type", params%domain_mask_type) ) params%domain_mask_type="cross" - IF (.NOT. xios_getvar(prefix//"scalar_mask", params%scalar_mask) ) params%scalar_mask=.FALSE. - IF (.NOT. xios_getvar(prefix//"scalar_mask_type", params%scalar_mask_type) ) params%scalar_mask_type="none" IF (.NOT. xios_getvar(prefix//"axis", params%axis) ) params%axis="pressure" IF (.NOT. xios_getvar(prefix//"axis_mask", params%axis_mask) ) params%axis_mask=.FALSE. IF (.NOT. xios_getvar(prefix//"ni", params%ni) ) params%ni=36 @@ -939,12 +909,14 @@ CONTAINS INTEGER :: axis_proc_rank, axis_proc_size INTEGER :: ensemble_proc_size, ensemble_proc_rank - CALL get_decomposition(comm, params, domain_proc_size, domain_proc_rank, axis_proc_size, axis_proc_rank, ensemble_proc_size, ensemble_proc_rank) + CALL get_decomposition(comm, params, domain_proc_size, domain_proc_rank, axis_proc_size, axis_proc_rank, & + ensemble_proc_size, ensemble_proc_rank) ALLOCATE(return_value(0:0)) return_value(0)=ensemble_proc_rank IF (xios_is_valid_axis(TRIM(ensemble_id))) THEN - CALL xios_set_axis_attr(ensemble_id, n_glo=ensemble_proc_size, begin=ensemble_proc_rank, n=1, value=return_value(:), unit='-') + CALL xios_set_axis_attr(ensemble_id, n_glo=ensemble_proc_size, begin=ensemble_proc_rank, n=1, value=return_value(:), & + unit='-') ENDIF END SUBROUTINE init_ensemble @@ -1036,7 +1008,8 @@ CONTAINS CALL MPI_COMM_RANK(comm,mpi_rank,ierr) CALL MPI_COMM_SIZE(comm,mpi_size,ierr) - CALL get_decomposition(comm, params, domain_proc_size, domain_proc_rank, axis_proc_size, axis_proc_rank, ensemble_proc_size, ensemble_proc_rank) + CALL get_decomposition(comm, params, domain_proc_size, domain_proc_rank, axis_proc_size, axis_proc_rank, & + ensemble_proc_size, ensemble_proc_rank) mpi_rank=domain_proc_rank mpi_size=domain_proc_size @@ -1231,7 +1204,8 @@ CONTAINS IF (xios_is_valid_domain(TRIM(domain_id))) THEN CALL xios_set_domain_attr(TRIM(domain_id), type="unstructured", ni_glo=ncell_glo, ni=ncell, ibegin=0, i_index=i_index) CALL xios_set_domain_attr(TRIM(domain_id), data_dim=1, data_ni=data_n_index, data_i_index=data_i_index, mask_1d=return_mask) - CALL xios_set_domain_attr(TRIM(domain_id), lonvalue_1D=lon, latvalue_1D=lat, nvertex=4, bounds_lon_1D=bounds_lon, bounds_lat_1D=bounds_lat) + CALL xios_set_domain_attr(TRIM(domain_id), lonvalue_1D=lon, latvalue_1D=lat, nvertex=4, bounds_lon_1D=bounds_lon, & + bounds_lat_1D=bounds_lat) ENDIF IF (xios_is_valid_axis(TRIM(domain_id)//"_X")) THEN @@ -1249,7 +1223,7 @@ CONTAINS - SUBROUTINE init_domain_dynamico(domain_id, comm, params, return_ni, return_nj, & + SUBROUTINE init_domain_dynamico(domain_id, comm, params, return_ni, return_nj, & return_lon,return_lat,return_mask, return_index, & return_X_lon,return_X_lat, return_X_mask, return_X_index, & return_Y_lon,return_Y_lat, return_Y_mask, return_Y_index) @@ -1291,15 +1265,18 @@ CONTAINS CALL MPI_COMM_RANK(comm,mpi_rank,ierr) CALL MPI_COMM_SIZE(comm,mpi_size,ierr) - CALL get_decomposition(comm, params, domain_proc_size, domain_proc_rank, axis_proc_size, axis_proc_rank, ensemble_proc_size, ensemble_proc_rank) + CALL get_decomposition(comm, params, domain_proc_size, domain_proc_rank, axis_proc_size, axis_proc_rank, & + ensemble_proc_size, ensemble_proc_rank) CALL xios_get_current_context(ctx_hdl) CALL xios_context_initialize("grid_dynamico",comm) CALL xios_close_context_definition() - CALL xios_get_domain_attr("Ai::",ni_glo=ni_glo,nj_glo=nj_glo,ni=ni,nj=nj, ibegin=ibegin, jbegin=jbegin ,nvertex=nvertex) + CALL xios_get_domain_attr("domain_dynamico",ni_glo=ni_glo,nj_glo=nj_glo,ni=ni,nj=nj, ibegin=ibegin, jbegin=jbegin , & + nvertex=nvertex) ALLOCATE(lon(ni),lat(ni),bounds_lon(nvertex,ni),bounds_lat(nvertex,ni)) - CALL xios_get_domain_attr("Ai::", lonvalue_1d=lon, latvalue_1d=lat, bounds_lon_1d=bounds_lon, bounds_lat_1d=bounds_lat) + CALL xios_get_domain_attr("domain_dynamico", lonvalue_1d=lon, latvalue_1d=lat, bounds_lon_1d=bounds_lon, & + bounds_lat_1d=bounds_lat) CALL xios_context_finalize CALL xios_set_current_context(ctx_hdl) @@ -1317,8 +1294,10 @@ CONTAINS CALL MPI_AllgatherV(lon, ni, MPI_REAL8, lon_glo, ni_all, ibegin_all, MPI_REAL8, comm, ierr) CALL MPI_AllgatherV(lat, ni, MPI_REAL8, lat_glo, ni_all, ibegin_all, MPI_REAL8, comm, ierr) - CALL MPI_AllgatherV(bounds_lon, ni*nvertex, MPI_REAL8, bounds_lon_glo, ni_all*nvertex, ibegin_all*nvertex, MPI_REAL8, comm, ierr) - CALL MPI_AllgatherV(bounds_lat, ni*nvertex, MPI_REAL8, bounds_lat_glo, ni_all*nvertex, ibegin_all*nvertex, MPI_REAL8, comm, ierr) + CALL MPI_AllgatherV(bounds_lon, ni*nvertex, MPI_REAL8, bounds_lon_glo, ni_all*nvertex, ibegin_all*nvertex, & + MPI_REAL8, comm, ierr) + CALL MPI_AllgatherV(bounds_lat, ni*nvertex, MPI_REAL8, bounds_lat_glo, ni_all*nvertex, ibegin_all*nvertex, & + MPI_REAL8, comm, ierr) nbp_glo=ni_glo @@ -1384,7 +1363,8 @@ CONTAINS IF (xios_is_valid_domain(TRIM(domain_id))) THEN CALL xios_set_domain_attr(TRIM(domain_id), type="unstructured", ni_glo=ni_glo, ibegin=offset, ni=nbp, nvertex=nvertex) - CALL xios_set_domain_attr(TRIM(domain_id), data_dim=1, lonvalue_1d=lon, latvalue_1d=lat, bounds_lon_1d=bounds_lon, bounds_lat_1d=bounds_lat, mask_1d=return_mask) + CALL xios_set_domain_attr(TRIM(domain_id), data_dim=1, lonvalue_1d=lon, latvalue_1d=lat, bounds_lon_1d=bounds_lon, & + bounds_lat_1d=bounds_lat, mask_1d=return_mask) ENDIF IF (xios_is_valid_axis(TRIM(domain_id)//"_X")) THEN @@ -1440,7 +1420,8 @@ CONTAINS CALL MPI_COMM_RANK(comm,mpi_rank,ierr) CALL MPI_COMM_SIZE(comm,mpi_size,ierr) - CALL get_decomposition(comm, params, domain_proc_size, domain_proc_rank, axis_proc_size, axis_proc_rank, ensemble_proc_size, ensemble_proc_rank) + CALL get_decomposition(comm, params, domain_proc_size, domain_proc_rank, axis_proc_size, axis_proc_rank, & + ensemble_proc_size, ensemble_proc_rank) ni_glo=params%ni nj_glo=params%nj nbp_glo=ni_glo*nj_glo @@ -1523,16 +1504,17 @@ CONTAINS return_nj=nj IF (xios_is_valid_domain(TRIM(domain_id))) THEN - CALL xios_set_domain_attr(TRIM(domain_id), type="rectilinear", ni_glo=ni_glo, ibegin=ibegin, ni=ni, nj_glo=nj_glo, jbegin=jbegin, nj=nj) + CALL xios_set_domain_attr(TRIM(domain_id), type="rectilinear", ni_glo=ni_glo, ibegin=ibegin, ni=ni, nj_glo=nj_glo, & + jbegin=jbegin, nj=nj) CALL xios_set_domain_attr(TRIM(domain_id), data_dim=2, lonvalue_1d=lon, latvalue_1d=lat, mask_1d=return_mask) ENDIF IF (xios_is_valid_axis(TRIM(domain_id)//"_X")) THEN - CALL xios_set_axis_attr(TRIM(domain_id)//"_X", n_glo=ni_glo, begin=ibegin, n=ni, value=return_X_lon, mask=return_X_mask) + CALL xios_set_axis_attr(TRIM(domain_id)//"_X", n_glo=ni_glo, begin=ibegin, n=ni, value=return_X_lon) ENDIF IF (xios_is_valid_axis(TRIM(domain_id)//"_Y")) THEN - CALL xios_set_axis_attr(TRIM(domain_id)//"_Y", n_glo=nj_glo, begin=jbegin, n=nj, value=return_Y_lat, mask=return_Y_mask) + CALL xios_set_axis_attr(TRIM(domain_id)//"_Y", n_glo=nj_glo, begin=jbegin, n=nj, value=return_Y_lat) ENDIF END SUBROUTINE init_domain_lmdz @@ -1577,7 +1559,8 @@ CONTAINS CALL MPI_COMM_RANK(comm,mpi_rank,ierr) CALL MPI_COMM_SIZE(comm,mpi_size,ierr) - CALL get_decomposition(comm, params, domain_proc_size, domain_proc_rank, axis_proc_size, axis_proc_rank, ensemble_proc_size, ensemble_proc_rank) + CALL get_decomposition(comm, params, domain_proc_size, domain_proc_rank, axis_proc_size, axis_proc_rank, & + ensemble_proc_size, ensemble_proc_rank) ni_glo=params%ni nj_glo=params%nj nbp_glo=ni_glo*nj_glo @@ -1642,7 +1625,7 @@ CONTAINS DO i=0,ni-1 i_glo=i j_glo=jbegin+j - ij=j_glo*ni_glo+i_glo + ij=j*ni+i IF ( ij>=ij_begin .AND. ij<=ij_end) THEN IF ((MOD(j_glo,3)==1 .OR. MOD(j_glo,3)==2) .AND. (MOD(i_glo,5)==3 .OR. MOD(i_glo,5)==4)) CYCLE pos=pos+1 @@ -1657,7 +1640,7 @@ CONTAINS DO i=0,ni-1 i_glo=i j_glo=jbegin+j - ij=j_glo*ni_glo+i_glo + ij=j*ni+i IF ( ij>=ij_begin .AND. ij<=ij_end) THEN IF ((MOD(j_glo,3)==1 .OR. MOD(j_glo,3)==2) .AND. (MOD(i_glo,5)==3 .OR. MOD(i_glo,5)==4)) CYCLE return_index(pos)=i+j*ni @@ -1722,17 +1705,20 @@ CONTAINS return_nj=nj IF (xios_is_valid_domain(TRIM(domain_id))) THEN - CALL xios_set_domain_attr(TRIM(domain_id), type="rectilinear", ni_glo=ni_glo, ibegin=ibegin, ni=ni, nj_glo=nj_glo, jbegin=jbegin, nj=nj) + CALL xios_set_domain_attr(TRIM(domain_id), type="rectilinear", ni_glo=ni_glo, ibegin=ibegin, ni=ni, nj_glo=nj_glo, & + jbegin=jbegin, nj=nj) CALL xios_set_domain_attr(TRIM(domain_id), data_dim=1, data_ni=size(return_index), data_i_index=return_index) CALL xios_set_domain_attr(TRIM(domain_id), lonvalue_1d=lon, latvalue_1d=lat, mask_1d=mask) ENDIF IF (xios_is_valid_axis(TRIM(domain_id)//"_X")) THEN - CALL xios_set_axis_attr(TRIM(domain_id)//"_X", n_glo=ni_glo, begin=ibegin, n=ni, value=return_X_lon, data_n=size(return_X_index), data_index=return_X_index) + CALL xios_set_axis_attr(TRIM(domain_id)//"_X", n_glo=ni_glo, begin=ibegin, n=ni, value=return_X_lon, & + data_n=size(return_X_index), data_index=return_X_index) ENDIF IF (xios_is_valid_axis(TRIM(domain_id)//"_Y")) THEN - CALL xios_set_axis_attr(TRIM(domain_id)//"_Y", n_glo=nj_glo, begin=jbegin, n=nj, value=return_Y_lat, data_n=size(return_Y_index), data_index=return_Y_index) + CALL xios_set_axis_attr(TRIM(domain_id)//"_Y", n_glo=nj_glo, begin=jbegin, n=nj, value=return_Y_lat, & + data_n=size(return_Y_index), data_index=return_Y_index) ENDIF END SUBROUTINE init_domain_orchidee @@ -1781,7 +1767,8 @@ CONTAINS CALL MPI_COMM_RANK(comm,mpi_rank,ierr) CALL MPI_COMM_SIZE(comm,mpi_size,ierr) - CALL get_decomposition(comm, params, domain_proc_size, domain_proc_rank, axis_proc_size, axis_proc_rank, ensemble_proc_size, ensemble_proc_rank) + CALL get_decomposition(comm, params, domain_proc_size, domain_proc_rank, axis_proc_size, axis_proc_rank, & + ensemble_proc_size, ensemble_proc_rank) ni_glo=params%ni nj_glo=params%nj @@ -1951,13 +1938,17 @@ CONTAINS IF (xios_is_valid_axis(TRIM(domain_id)//"_X")) THEN - CALL xios_set_axis_attr(TRIM(domain_id)//"_X", n_glo=ni_glo, begin=ibegin, n=ni, data_begin=-offset_i, data_n=ni+2*offset_i, value=return_X_lon, mask=return_X_mask) -! CALL xios_set_axis_attr(TRIM(domain_id)//"_X", n_glo=ni_glo, begin=ibegin, n=ni, data_index=return_X_index, data_n=ni+2*offset_i, value=return_X_lon) + CALL xios_set_axis_attr(TRIM(domain_id)//"_X", n_glo=ni_glo, begin=ibegin, n=ni, data_begin=-offset_i, & + data_n=ni+2*offset_i, value=return_X_lon, mask=return_X_mask) +! CALL xios_set_axis_attr(TRIM(domain_id)//"_X", n_glo=ni_glo, begin=ibegin, n=ni, data_index=return_X_index,& +! data_n=ni+2*offset_i, value=return_X_lon) ENDIF IF (xios_is_valid_axis(TRIM(domain_id)//"_Y")) THEN - CALL xios_set_axis_attr(TRIM(domain_id)//"_Y", n_glo=nj_glo, begin=jbegin, n=nj, data_begin=-offset_j, data_n=nj+2*offset_j, value=return_Y_lat, mask=return_Y_mask) -! CALL xios_set_axis_attr(TRIM(domain_id)//"_Y", n_glo=nj_glo, begin=jbegin, n=nj, data_index=return_Y_index, data_n=nj+2*offset_j, value=return_Y_lat, mask=return_Y_mask) + CALL xios_set_axis_attr(TRIM(domain_id)//"_Y", n_glo=nj_glo, begin=jbegin, n=nj, data_begin=-offset_j, & + data_n=nj+2*offset_j, value=return_Y_lat, mask=return_Y_mask) +! CALL xios_set_axis_attr(TRIM(domain_id)//"_Y", n_glo=nj_glo, begin=jbegin, n=nj, data_index=return_Y_index, & +! data_n=nj+2*offset_j, value=return_Y_lat) ENDIF END SUBROUTINE init_domain_nemo @@ -1976,12 +1967,8 @@ CONTAINS mask(:)=.TRUE. IF (params%domain_mask) THEN - IF (params%domain_mask_type=="cross") THEN - WHERE (lon(:)-2*lat(:)>-10 .AND. lon(:)-2*lat(:) <10) mask(:)=.FALSE. - WHERE (2*lat(:)+lon(:)>-10 .AND. 2*lat(:)+lon(:)<10) mask(:)=.FALSE. - ELSE IF (params%domain_mask_type=="latitude_band") THEN - WHERE (lat(:)>-30 .AND. lat(:)<30) mask(:)=.FALSE. - ENDIF + WHERE (lon(:)-2*lat(:)>-10 .AND. lon(:)-2*lat(:) <10) mask(:)=.FALSE. + WHERE (2*lat(:)+lon(:)>-10 .AND. 2*lat(:)+lon(:)<10) mask(:)=.FALSE. ENDIF END SUBROUTINE set_domain_mask @@ -2044,7 +2031,8 @@ CONTAINS INTEGER :: axis_proc_rank, axis_proc_size INTEGER :: ensemble_proc_size, ensemble_proc_rank - CALL get_decomposition(comm, params, domain_proc_size, domain_proc_rank, axis_proc_size, axis_proc_rank, ensemble_proc_size, ensemble_proc_rank) + CALL get_decomposition(comm, params, domain_proc_size, domain_proc_rank, axis_proc_size, axis_proc_rank, & + ensemble_proc_size, ensemble_proc_rank) nlev_glo=params%nlev @@ -2084,7 +2072,8 @@ CONTAINS return_value=value return_mask=.TRUE. CALL set_axis_mask(params,value,return_mask) - CALL xios_set_axis_attr(axis_id, n_glo=nlev_glo, begin=begin, n=nlev, value=value*100000, mask=return_mask, bounds=bounds_value*100000, unit='Pa', positive='up') + CALL xios_set_axis_attr(axis_id, n_glo=nlev_glo, begin=begin, n=nlev, value=value*100000, mask=return_mask, & + bounds=bounds_value*100000, unit='Pa', positive='up') ALLOCATE(return_index(0:nlev-1)) @@ -2102,55 +2091,17 @@ CONTAINS DOUBLE PRECISION :: value(:) LOGICAL :: mask(:) INTEGER :: i,x - - mask(:)=.TRUE. + x=size(mask) IF (params%axis_mask) THEN DO i=0,x-1 - IF (MOD(i,3)==0) mask(i+1)=.FALSE. - IF (MOD(i,4)==0) mask(i+1)=.FALSE. + IF (MOD(i,3)==0) mask(i)=.FALSE. + IF (MOD(i,4)==0) mask(i)=.FALSE. ENDDO ENDIF END SUBROUTINE set_axis_mask - SUBROUTINE init_scalar(scalar_id, comm, params, return_mask) - IMPLICIT NONE - CHARACTER(LEN=*) :: scalar_id - TYPE(tmodel_params) :: params - INTEGER :: comm - LOGICAL :: return_mask - DOUBLE PRECISION :: value =10. - - CALL set_scalar_mask(comm, params, return_mask) - CALL xios_set_scalar_attr(scalar_id, value=value, mask=return_mask) - - END SUBROUTINE init_scalar - - SUBROUTINE set_scalar_mask(comm, params, mask) - IMPLICIT NONE - TYPE(tmodel_params) :: params - INTEGER :: comm - LOGICAL :: mask - INTEGER :: ierr,rank - - mask=.TRUE. - IF (params%scalar_mask) THEN - IF (params%scalar_mask_type=="none") THEN - mask=.TRUE. - ELSE IF (params%scalar_mask_type=="full") THEN - mask=.FALSE. - ELSE IF (params%scalar_mask_type=="root") THEN - CALL MPI_COMM_RANK(comm,rank,ierr) - mask = (rank==0) - ELSE IF (params%scalar_mask_type=="sparse") THEN - CALL MPI_COMM_RANK(comm,rank,ierr) - mask = (MOD(rank,2)==0) - ENDIF - ENDIF - - END SUBROUTINE set_scalar_mask - SUBROUTINE init_field2D_academic(comm,params, lon, lat, mask, return_field, & X_lon, X_lat, X_mask, return_fieldX, & Y_lon, Y_lat, Y_mask, return_fieldY, return_fieldXY) @@ -2318,7 +2269,8 @@ CONTAINS - SUBROUTINE get_decomposition(comm, params, domain_proc_size, domain_proc_rank, axis_proc_size, axis_proc_rank, ensemble_proc_size, ensemble_proc_rank) + SUBROUTINE get_decomposition(comm, params, domain_proc_size, domain_proc_rank, axis_proc_size, axis_proc_rank, & + ensemble_proc_size, ensemble_proc_rank) IMPLICIT NONE INTEGER,INTENT(IN) :: comm TYPE(tmodel_params) :: params @@ -2436,87 +2388,6 @@ CONTAINS END SUBROUTINE get_decomposition - SUBROUTINE compute_cyclic_distribution(rank, nb_procs, who_i_am) - IMPLICIT NONE - INTEGER,INTENT(IN) :: rank - INTEGER,INTENT(IN) :: nb_procs(:) - LOGICAL,INTENT(OUT) :: who_i_am(:) - INTEGER :: start(SIZE(nb_procs)) - INTEGER :: nb_comp - INTEGER :: nb_client - INTEGER :: nb_server - INTEGER :: current - INTEGER :: current_client - INTEGER :: i,j,k,nq,q,r - - who_i_am=.FALSE. - nb_comp = SIZE(nb_procs) - nb_client = SUM(nb_procs(1:nb_comp-1)) - nb_server = nb_procs(nb_comp) - - start(1)=0 - DO k=2,nb_comp - start(k)=start(k-1)+nb_procs(k-1) - ENDDO - - current=0 - current_client=0 - - IF (nb_client >= nb_server) THEN - q=nb_client/nb_server - r=MOD(nb_client,nb_server) - - DO i=1,nb_server - IF (i<=r) THEN ; nq=q+1 ; ELSE ; nq=q ; ENDIF - DO j=1,nq - IF (current==rank) THEN - DO k=1,nb_comp-1 - IF (current_client >= start(k) .AND. current_client= start(k) .AND. current_client - -namespace xios -{ - const size_t timeLineEventbase = std::numeric_limits::max()-100 ; - const size_t timelineEventNotifyChangeBufferSize = timeLineEventbase + 0 ; - const size_t timelineEventChangeBufferSize = timeLineEventbase + 1 ; -} - - -#endif \ No newline at end of file diff --git a/xios_2311_src/src/timer.cpp b/xios_2311_src/src/timer.cpp index e1659d4636f420aa2dfb3a9228313cb6649bbea6..3bf0813820943c808bce4fba090ecafc53b2eb9e 100644 --- a/xios_2311_src/src/timer.cpp +++ b/xios_2311_src/src/timer.cpp @@ -10,9 +10,8 @@ namespace xios { std::map CTimer::allTimer; - CTimer::CTimer(const std::string& name_, bool trace) : name(name_) + CTimer::CTimer(const std::string& name_) : name(name_) { - isTracing_=trace ; reset(); } @@ -25,7 +24,7 @@ namespace xios { if (!suspended) { - if (isTracing_) traceEnd(name); + traceEnd(name); cumulatedTime += getTime() - lastTime; } suspended = true; @@ -36,7 +35,7 @@ namespace xios if (suspended) { lastTime = getTime(); - if (isTracing_) traceBegin(name); + traceBegin(name); } suspended = false; } @@ -52,11 +51,11 @@ namespace xios return cumulatedTime; } - CTimer& CTimer::get(const std::string name, bool trace) + CTimer& CTimer::get(const std::string name) { std::map::iterator it = allTimer.find(name); if (it == allTimer.end()) - it = allTimer.insert(std::make_pair(name, CTimer(name,trace))).first; + it = allTimer.insert(std::make_pair(name, CTimer(name))).first; return it->second; } diff --git a/xios_2311_src/src/timer.hpp b/xios_2311_src/src/timer.hpp index 5ea4e872ef29ef20909451a6229e7d9778177a60..b4a580b327bb4ca2c1b55c8d968a4f8346edcb8e 100644 --- a/xios_2311_src/src/timer.hpp +++ b/xios_2311_src/src/timer.hpp @@ -12,19 +12,17 @@ namespace xios double cumulatedTime; double lastTime; bool suspended; - bool isTracing_ ; std::string name; - CTimer(const std::string& name, bool trace=true); + CTimer(const std::string& name); void suspend(void); void resume(void); void reset(void); double getCumulatedTime(void); static std::map allTimer; static double getTime(void); - static CTimer& get(std::string name, bool trace=true); + static CTimer& get(std::string name); static std::string getAllCumulatedTime(void) ; - static void release(void) { allTimer.clear() ;} }; } diff --git a/xios_2311_src/src/tracer.cpp b/xios_2311_src/src/tracer.cpp index 963ad09000990918ce8c828693fc1d0d24b21dc0..7551b958bb34cdf9a3d37523e4988e3077e14aa8 100644 --- a/xios_2311_src/src/tracer.cpp +++ b/xios_2311_src/src/tracer.cpp @@ -24,15 +24,9 @@ namespace xios std::map regionId ; int count=0 ; - bool traceIsOn=true ; - int stackOnOffdeep=0 ; void traceOn(void) { - stackOnOffdeep-- ; - if (stackOnOffdeep!=0) return ; - traceIsOn=true; - #if defined(VTRACE) VT_ON() ; #elif defined(SCOREP) @@ -44,9 +38,6 @@ namespace xios void traceOff(void) { - stackOnOffdeep++ ; - if (stackOnOffdeep!=1) return ; - traceIsOn=false; #if defined(VTRACE) VT_OFF() ; #elif defined(SCOREP) @@ -59,8 +50,7 @@ namespace xios void traceBegin(const string& name) { #if defined(VTRACE) - - if (traceIsOn) VT_USER_START(name.c_str()) ; + VT_USER_START(name.c_str()) ; #elif defined(SCOREP) SCOREP_USER_REGION_BY_NAME_BEGIN(name.c_str(),SCOREP_USER_REGION_TYPE_COMMON) @@ -85,7 +75,7 @@ namespace xios void traceEnd(const string& name) { #if defined (VTRACE) - if (traceIsOn) VT_USER_END(name.c_str()) ; + VT_USER_END(name.c_str()) ; #elif defined(SCOREP) SCOREP_USER_REGION_BY_NAME_END(name.c_str()) #elif defined(ITAC) diff --git a/xios_2311_src/src/transformation/Functions/average_reduction.hpp b/xios_2311_src/src/transformation/Functions/average_reduction.hpp index 739346c01db1f67b6ea14b1ceb4fdb74f8d3f252..1b69782501de4523b0220b9c9a42065811581ae7 100644 --- a/xios_2311_src/src/transformation/Functions/average_reduction.hpp +++ b/xios_2311_src/src/transformation/Functions/average_reduction.hpp @@ -32,6 +32,8 @@ public: virtual ~CAverageReductionAlgorithm() {} + virtual StdString getName() {return "Average reduction";} + protected: CArray weights_; bool resetWeight_; diff --git a/xios_2311_src/src/transformation/Functions/extract.hpp b/xios_2311_src/src/transformation/Functions/extract.hpp index b1c530d467f183162940532fd9ebffaf2b034d2b..f1133cbd7b39c200afb743344a623fdf2887de4f 100644 --- a/xios_2311_src/src/transformation/Functions/extract.hpp +++ b/xios_2311_src/src/transformation/Functions/extract.hpp @@ -30,6 +30,8 @@ public: virtual ~CExtractReductionAlgorithm() {} + virtual StdString getName() {return "Extract reduction";} + public: static bool registerTrans(); diff --git a/xios_2311_src/src/transformation/Functions/max_reduction.hpp b/xios_2311_src/src/transformation/Functions/max_reduction.hpp index 8bed597fc41f7a4011ae56cf1984d06666961f06..08b01527d998b80353d0a73852752ccafe19b7a5 100644 --- a/xios_2311_src/src/transformation/Functions/max_reduction.hpp +++ b/xios_2311_src/src/transformation/Functions/max_reduction.hpp @@ -30,6 +30,8 @@ public: virtual ~CMaxReductionAlgorithm() {} + virtual StdString getName() {return "Max reduction";} + public: static bool registerTrans(); diff --git a/xios_2311_src/src/transformation/Functions/min_reduction.hpp b/xios_2311_src/src/transformation/Functions/min_reduction.hpp index 9894aa7bce020de49eae0c43d1122efd85acc917..81dbbf16afe5db472b52b952ce8924e50249d51c 100644 --- a/xios_2311_src/src/transformation/Functions/min_reduction.hpp +++ b/xios_2311_src/src/transformation/Functions/min_reduction.hpp @@ -30,6 +30,8 @@ public: virtual ~CMinReductionAlgorithm() {} + virtual StdString getName() {return "Min reduction";} + public: static bool registerTrans(); diff --git a/xios_2311_src/src/transformation/Functions/reduction.cpp b/xios_2311_src/src/transformation/Functions/reduction.cpp index 3c5f3d61414a36288f6c7cbead4822de6764623d..9ddc483ce911ef6f90925e1d35eac69ba48aabb1 100644 --- a/xios_2311_src/src/transformation/Functions/reduction.cpp +++ b/xios_2311_src/src/transformation/Functions/reduction.cpp @@ -26,6 +26,7 @@ bool CReductionAlgorithm::initReductionOperation(std::map CallBackMap; diff --git a/xios_2311_src/src/transformation/Functions/reduction_types.hpp b/xios_2311_src/src/transformation/Functions/reduction_types.hpp index 3f1a6d903ae5ddb0d279eff95719680d27ca6947..5931f74fac6fd87581904d044a725c43f4261d48 100644 --- a/xios_2311_src/src/transformation/Functions/reduction_types.hpp +++ b/xios_2311_src/src/transformation/Functions/reduction_types.hpp @@ -9,22 +9,16 @@ #ifndef __XIOS_REDUCTION_TYPES_HPP__ #define __XIOS_REDUCTION_TYPES_HPP__ -namespace xios -{ +namespace xios { - typedef enum reduction_algorithm_type + typedef enum reduction_alogirthm_type { - TRANS_REDUCE_NONE = 0, - TRANS_REDUCE_SUM = 1, - TRANS_REDUCE_MIN = 2, - TRANS_REDUCE_MAX = 3, - TRANS_REDUCE_EXTRACT = 4, - TRANS_REDUCE_AVERAGE = 5 + TRANS_REDUCE_SUM = 0, + TRANS_REDUCE_MIN = 1, + TRANS_REDUCE_MAX = 2, + TRANS_REDUCE_EXTRACT = 3, + TRANS_REDUCE_AVERAGE = 4 } EReductionType; - enum class EReduction - { - none, sum, min, max, extract, average - } ; } #endif // __XIOS_REDUCTION_TYPES_HPP__ diff --git a/xios_2311_src/src/transformation/Functions/sum_reduction.hpp b/xios_2311_src/src/transformation/Functions/sum_reduction.hpp index 52969f68820b42192d677c2034b9bda61219fa58..8b35f4f5a24cce99e37b5dbe0aa2f41ac2d40db7 100644 --- a/xios_2311_src/src/transformation/Functions/sum_reduction.hpp +++ b/xios_2311_src/src/transformation/Functions/sum_reduction.hpp @@ -30,6 +30,8 @@ public: virtual ~CSumReductionAlgorithm() {} + virtual StdString getName() {return "Sum reduction";} + public: static bool registerTrans(); diff --git a/xios_2311_src/src/transformation/algo_types.cpp b/xios_2311_src/src/transformation/algo_types.cpp deleted file mode 100755 index 5240784a34a9c4f1f1a3f5ff3a169f78e508401a..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/algo_types.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include "algo_types.hpp" -#include - - namespace xios - { - - void registerAlgorithmTransformation(void) - { - static bool first = true ; - if (!first) return ; - bool ret ; - std::cout<<"register Transformation"<& dataIn, CArray& dataOut) - { - dataOut.reference(dataIn) ; - } - - shared_ptr CAlgorithmTransformationNoDataModification::createGridAlgorithm(CGrid* gridSrc, CGrid* gridDst, int pos) - { - auto algo=make_shared(static_pointer_cast(shared_from_this())) ; - algo->computeAlgorithm() ; - return algo ; - } -} \ No newline at end of file diff --git a/xios_2311_src/src/transformation/algorithm_transformation_no_data_modification.hpp b/xios_2311_src/src/transformation/algorithm_transformation_no_data_modification.hpp deleted file mode 100755 index cb3dcf7ae36c1fcf0256665d3603b03ea8b74b4c..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/algorithm_transformation_no_data_modification.hpp +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef __XIOS_ALGORITHM_TRANSFORMATION_NO_DATA_MODIFICATION_HPP__ -#define __XIOS_ALGORITHM_TRANSFORMATION_NO_DATA_MODIFICATION_HPP__ - -#include "generic_algorithm_transformation.hpp" -#include "array_new.hpp" - -namespace xios -{ - - class CAlgorithmTransformationNoDataModification : public CGenericAlgorithmTransformation - { - public: - - CAlgorithmTransformationNoDataModification(bool isSource) : CGenericAlgorithmTransformation(isSource) {} - virtual ~CAlgorithmTransformationNoDataModification() {}; - virtual void apply(int dimBefore, int dimAfter, const CArray& dataIn, CArray& dataOut); - virtual shared_ptr createGridAlgorithm(CGrid* gridSrc, CGrid* newGrid, int pos) ; - }; - -} -#endif //__XIOS_ALGORITHM_TRANSFORMATION_NO_DATA_MODIFICATION_HPP__ diff --git a/xios_2311_src/src/transformation/algorithm_transformation_reduce.cpp b/xios_2311_src/src/transformation/algorithm_transformation_reduce.cpp deleted file mode 100755 index 9d9568bf3bbf8e04c40e89ba8a754e5475ca37b8..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/algorithm_transformation_reduce.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include "algorithm_transformation_reduce.hpp" -#include "context.hpp" - -namespace xios -{ - - - void CAlgorithmTransformationReduce::computeAlgorithm(shared_ptr srcView, shared_ptr dstView) - { - this->computeRecvElement(srcView, dstView) ; - reduceTransformConnector_ = make_shared(recvElement_->getView(CElementView::FULL), dstView, operator_, transformationMapping_, detectMissingValue_) ; - } - - - void CAlgorithmTransformationReduce::apply(int dimBefore, int dimAfter, const CArray& dataIn, CArray& dataOut) - { - reduceTransformConnector_ -> transfer(dimBefore, dimAfter, dataIn, dataOut) ; - } - - void CAlgorithmTransformationReduce::computeRecvElement(shared_ptr srcView, shared_ptr dstView) - { - auto& srcMap = transformationMapping_ ; - set srcIndex ; - for(auto& it : srcMap) - for(size_t index : it.second) srcIndex.insert(index) ; - - CArray srcArrayIndex(srcIndex.size()) ; - int i=0 ; - for(size_t index : srcIndex) { srcArrayIndex(i) = index ; i++ ;} - recvElement_ = make_shared(CContext::getCurrent()->getIntraCommRank(), srcView->getGlobalSize(), srcArrayIndex) ; - recvElement_->addFullView() ; - } -} \ No newline at end of file diff --git a/xios_2311_src/src/transformation/algorithm_transformation_reduce.hpp b/xios_2311_src/src/transformation/algorithm_transformation_reduce.hpp deleted file mode 100755 index f2138067b9a8b986fb2a087d305edfa6927ea7b8..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/algorithm_transformation_reduce.hpp +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef __XIOS_ALGORITHM_TRANSFORMATION_REDUCE_HPP__ -#define __XIOS_ALGORITHM_TRANSFORMATION_REDUCE_HPP__ - -#include "generic_algorithm_transformation.hpp" -#include "array_new.hpp" -#include "local_view.hpp" -#include "transform_connector.hpp" -#include "reduce_transform_connector.hpp" - -namespace xios -{ - - class CAlgorithmTransformationReduce : public CGenericAlgorithmTransformation - { - public: - - CAlgorithmTransformationReduce(bool isSource) : CGenericAlgorithmTransformation(isSource) {} - virtual ~CAlgorithmTransformationReduce() {}; - virtual void apply(int dimBefore, int dimAfter, const CArray& dataIn, CArray& dataOut); - virtual void computeRecvElement(shared_ptr srcView, shared_ptr dstView) ; - - protected: - virtual void computeAlgorithm(shared_ptr srcView, shared_ptr dstView) ; - - //! Map between global index of destination element and source element - EReduction operator_ ; - TransformationIndexMap transformationMapping_; - shared_ptr reduceTransformConnector_ ; - bool detectMissingValue_=true ; - }; - -} -#endif //__XIOS_ALGORITHM_TRANSFORMATION_REDUCE_HPP__ diff --git a/xios_2311_src/src/transformation/algorithm_transformation_transfer.cpp b/xios_2311_src/src/transformation/algorithm_transformation_transfer.cpp deleted file mode 100755 index b36484f798015d53e5a04203191b9bc2449fa721..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/algorithm_transformation_transfer.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include "algorithm_transformation_transfer.hpp" -#include "array_new.hpp" -#include "local_view.hpp" -#include "transform_connector.hpp" -#include "context.hpp" - -namespace xios -{ - - void CAlgorithmTransformationTransfer::computeAlgorithm(shared_ptr srcView, shared_ptr dstView) - { - this->computeRecvElement(srcView, dstView) ; - transferTransformConnector_ = make_shared( recvElement_->getView(CElementView::FULL), dstView, transformationMapping_) ; - } - - - void CAlgorithmTransformationTransfer::apply(int dimBefore, int dimAfter, const CArray& dataIn, CArray& dataOut) - { - transferTransformConnector_ -> transfer(dimBefore, dimAfter, dataIn, dataOut) ; - } - - void CAlgorithmTransformationTransfer::computeRecvElement(shared_ptr srcView, shared_ptr dstView) - { - set srcIndex ; - for(auto& it : transformationMapping_) srcIndex.insert(it.second) ; - - CArray srcArrayIndex(srcIndex.size()) ; - int i=0 ; - for(size_t index : srcIndex) { srcArrayIndex(i) = index ; i++ ;} - recvElement_ = make_shared(CContext::getCurrent()->getIntraCommRank(), srcView->getGlobalSize(), srcArrayIndex) ; - recvElement_->addFullView() ; - } - -} \ No newline at end of file diff --git a/xios_2311_src/src/transformation/algorithm_transformation_transfer.hpp b/xios_2311_src/src/transformation/algorithm_transformation_transfer.hpp deleted file mode 100755 index 203265e943ae61ecec51469f40a5270d1dbce773..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/algorithm_transformation_transfer.hpp +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef __XIOS_ALGORITHM_TRANSFORMATION_TRANSFER_HPP__ -#define __XIOS_ALGORITHM_TRANSFORMATION_TRANSFER_HPP__ - -#include "generic_algorithm_transformation.hpp" -#include "transfer_transform_connector.hpp" -#include "array_new.hpp" - -namespace xios -{ - - class CAlgorithmTransformationTransfer : public CGenericAlgorithmTransformation - { - public: - - CAlgorithmTransformationTransfer(bool isSource) : CGenericAlgorithmTransformation(isSource) {} - virtual ~CAlgorithmTransformationTransfer() {}; - virtual void apply(int dimBefore, int dimAfter, const CArray& dataIn, CArray& dataOut); - virtual void computeRecvElement(shared_ptr srcView, shared_ptr dstView) ; - virtual StdString getAlgoName() {return "\\nCAlgorithm transformation Transfer";} - - protected: - virtual void computeAlgorithm(shared_ptr srcView, shared_ptr dstView) ; - - //! Map between global index of destination element and source element - unordered_map transformationMapping_; - shared_ptr transferTransformConnector_ ; - }; - -} -#endif //__XIOS_ALGORITHM_TRANSFORMATION_TRANSFER_HPP__ diff --git a/xios_2311_src/src/transformation/algorithm_transformation_weight.cpp b/xios_2311_src/src/transformation/algorithm_transformation_weight.cpp deleted file mode 100755 index 822b1c03174a69982401a067ca866ddd6e43ae40..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/algorithm_transformation_weight.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include "algorithm_transformation_weight.hpp" -#include "context.hpp" - -namespace xios -{ - - - void CAlgorithmTransformationWeight::computeAlgorithm(shared_ptr srcView, shared_ptr dstView) - { - this->computeRecvElement(srcView, dstView) ; - weightTransformConnector_ = make_shared(recvElement_->getView(CElementView::FULL), dstView, transformationMapping_, transformationWeight_) ; - } - - - void CAlgorithmTransformationWeight::apply(int dimBefore, int dimAfter, const CArray& dataIn, CArray& dataOut) - { - weightTransformConnector_ -> transfer(dimBefore, dimAfter, dataIn, dataOut) ; - } - - void CAlgorithmTransformationWeight::computeRecvElement(shared_ptr srcView, shared_ptr dstView) - { - auto& srcMap = transformationMapping_ ; - set srcIndex ; - for(auto& it : srcMap) - for(size_t index : it.second) srcIndex.insert(index) ; - - CArray srcArrayIndex(srcIndex.size()) ; - int i=0 ; - for(size_t index : srcIndex) { srcArrayIndex(i) = index ; i++ ;} - recvElement_ = make_shared(CContext::getCurrent()->getIntraCommRank(), srcView->getGlobalSize(), srcArrayIndex) ; - recvElement_->addFullView() ; - } -} \ No newline at end of file diff --git a/xios_2311_src/src/transformation/algorithm_transformation_weight.hpp b/xios_2311_src/src/transformation/algorithm_transformation_weight.hpp deleted file mode 100755 index 58fb91fa02f7436c6c2270c8c4d037b381bfca08..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/algorithm_transformation_weight.hpp +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef __XIOS_ALGORITHM_TRANSFORMATION_WEIGHT_HPP__ -#define __XIOS_ALGORITHM_TRANSFORMATION_WEIGHT_HPP__ - -#include "generic_algorithm_transformation.hpp" -#include "array_new.hpp" -#include "local_view.hpp" -#include "transform_connector.hpp" -#include "weight_transform_connector.hpp" - -namespace xios -{ - - class CAlgorithmTransformationWeight : public CGenericAlgorithmTransformation - { - public: - - CAlgorithmTransformationWeight(bool isSource) : CGenericAlgorithmTransformation(isSource) {} - virtual ~CAlgorithmTransformationWeight() {}; - virtual void apply(int dimBefore, int dimAfter, const CArray& dataIn, CArray& dataOut); - virtual void computeRecvElement(shared_ptr srcView, shared_ptr dstView); - protected: - virtual void computeAlgorithm(shared_ptr srcView, shared_ptr dstView) ; - - //! Map between global index of destination element and source element - TransformationIndexMap transformationMapping_; - //! Weight corresponding of source to destination - TransformationWeightMap transformationWeight_; - shared_ptr weightTransformConnector_ ; - - }; - -} -#endif //__XIOS_ALGORITHM_TRANSFORMATION_WEIGHT_HPP__ diff --git a/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_duplicate_scalar.cpp b/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_duplicate_scalar.cpp deleted file mode 100755 index 7ae04a3f772909170497a3147239f88e7feef83b..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_duplicate_scalar.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/*! - \file axis_algorithm_duplicate_scalar.cpp - - \brief Algorithm to duplicate scalar into axis - */ -#include "axis_algorithm_duplicate_scalar.hpp" -#include "duplicate_scalar_to_axis.hpp" -#include "axis.hpp" -#include "scalar.hpp" -#include "grid.hpp" -#include "grid_transformation_factory_impl.hpp" - -namespace xios { -shared_ptr CAxisAlgorithmDuplicateScalar::create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) -TRY -{ - std::vector axisListDestP = gridDst->getAxis(); - std::vector scalarListSrcP = gridSrc->getScalars(); - - CDuplicateScalarToAxis* duplicateScalar = dynamic_cast (transformation); - int axisDstIndex = elementPositionInGridDst2AxisPosition[elementPositionInGrid]; - int scalarSrcIndex = elementPositionInGridSrc2ScalarPosition[elementPositionInGrid]; - - return make_shared(isSource, axisListDestP[axisDstIndex], scalarListSrcP[scalarSrcIndex], duplicateScalar); -} -CATCH - -bool CAxisAlgorithmDuplicateScalar::dummyRegistered_ = CAxisAlgorithmDuplicateScalar::registerTrans(); -bool CAxisAlgorithmDuplicateScalar::registerTrans() -TRY -{ - return CGridTransformationFactory::registerTransformation(TRANS_DUPLICATE_SCALAR_TO_AXIS, create); -} -CATCH - - -CAxisAlgorithmDuplicateScalar::CAxisAlgorithmDuplicateScalar(bool isSource, CAxis* axisDestination, CScalar* scalarSource, CDuplicateScalarToAxis* algo) - : CAlgorithmTransformationTransfer(isSource) -{ - axisDestination->checkAttributes() ; - - CArray& axisDstIndex = axisDestination->index; - - int nbAxisIdx = axisDstIndex.numElements(); - for (int idxAxis = 0; idxAxis < nbAxisIdx; ++idxAxis) - { - int globalAxisIdx = axisDstIndex(idxAxis); - this->transformationMapping_[globalAxisIdx] = 0 ; - } - - axisDestination->checkAttributes() ; - this->computeAlgorithm(scalarSource->getLocalView(CElementView::WORKFLOW), axisDestination->getLocalView(CElementView::WORKFLOW)) ; -} - - -CAxisAlgorithmDuplicateScalar::~CAxisAlgorithmDuplicateScalar() -{ -} - -} diff --git a/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_duplicate_scalar.hpp b/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_duplicate_scalar.hpp deleted file mode 100755 index 7dc490d81e877dc7a4bf68321af7ce1db1227b2e..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_duplicate_scalar.hpp +++ /dev/null @@ -1,49 +0,0 @@ -/*! - \file axis_algorithm_reduce_domain.hpp - \author Ha NGUYEN - \since 23 June 2016 - \date 23 June 2016 - - \brief Algorithm for reduce an axis to a axis - */ -#ifndef __XIOS_AXIS_ALGORITHM_DUPLICATE_SCALAR_HPP__ -#define __XIOS_AXIS_ALGORITHM_DUPLICATE_SCALAR_HPP__ - -#include "algorithm_transformation_transfer.hpp" -#include "transformation.hpp" - -namespace xios { - -class CAxis; -class CScalar; -class CDuplicateScalarToAxis; - - -/*! - \class CAxisAlgorithmDuplicateScalar - Duplicate scalar into axis destination -*/ -class CAxisAlgorithmDuplicateScalar : public CAlgorithmTransformationTransfer -{ -public: - CAxisAlgorithmDuplicateScalar(bool isSource, CAxis* axisDestination, CScalar* scalarSource, CDuplicateScalarToAxis* algo); - - virtual ~CAxisAlgorithmDuplicateScalar(); - - static bool registerTrans(); - virtual StdString getAlgoName() {return "\\nduplicate_scalar";} - - static shared_ptr create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition); - static bool dummyRegistered_; -}; - -} -#endif // __XIOS_AXIS_ALGORITHM_DUPLICATE_SCALAR_HPP__ diff --git a/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_extract.cpp b/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_extract.cpp deleted file mode 100755 index 2c5478f71a29f594d9e36cfeb8155354ea1a5e35..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_extract.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/*! - \file axis_algorithm_extract.cpp - \brief Algorithm for extracting an axis. - */ -#include "axis_algorithm_extract.hpp" -#include "axis.hpp" -#include "grid.hpp" -#include "grid_transformation_factory_impl.hpp" -#include "extract_axis.hpp" - -namespace xios { -shared_ptr CAxisAlgorithmExtract::create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) -TRY -{ - std::vector axisListDestP = gridDst->getAxis(); - std::vector axisListSrcP = gridSrc->getAxis(); - - CExtractAxis* extractAxis = dynamic_cast (transformation); - int axisDstIndex = elementPositionInGridDst2AxisPosition[elementPositionInGrid]; - int axisSrcIndex = elementPositionInGridSrc2AxisPosition[elementPositionInGrid]; - - return make_shared(isSource, axisListDestP[axisDstIndex], axisListSrcP[axisSrcIndex], extractAxis); -} -CATCH - -bool CAxisAlgorithmExtract::dummyRegistered_ = CAxisAlgorithmExtract::registerTrans(); -bool CAxisAlgorithmExtract::registerTrans() -TRY -{ - return CGridTransformationFactory::registerTransformation(TRANS_EXTRACT_AXIS, create); -} -CATCH - -CAxisAlgorithmExtract::CAxisAlgorithmExtract(bool isSource, CAxis* axisDestination, CAxis* axisSource, CExtractAxis* extractAxis) -: CAlgorithmTransformationTransfer(isSource), axisDest_(axisDestination), axisSrc_(axisSource) -TRY -{ - axisDestination->axis_type.reset(); - axisDestination->n_glo.reset(); - axisDestination->index.reset(); - axisDestination->n.reset(); - axisDestination->begin.reset(); - - axisDestination->mask.reset(); - axisDestination->data_index.reset(); - axisDestination->data_n.reset(); - axisDestination->data_begin.reset(); - - axisDestination->value.reset(); - axisDestination->label.reset(); - axisDestination->bounds.reset(); - - extractAxis->checkValid(axisSource); - extractBegin_ = extractAxis->begin.getValue(); - extractN_ = extractAxis->n.getValue(); - extractEnd_ = extractBegin_ + extractN_ - 1; - - if (extractN_ > axisSource->n_glo.getValue()) - { - ERROR("CAxisAlgorithmExtract::CAxisAlgorithmExtract(CAxis* axisDestination, CAxis* axisSource, CExtractAxis* extractAxis)", - << "Extract size is greater than global size of source axis" - << "Global size of source axis " <getId() << " is " << axisSource->n_glo.getValue() << std::endl - << "Extract size is " << extractN_ ); - } - - int idxSrc, nDest = 0, beginDestLoc, beginDestGlo = 0 ; - int indGloDest, indGloSrc, iSrc; - for (int i = 0; i < axisSrc_->n.getValue(); i++) - { - idxSrc = axisSrc_->index(i); - if ((idxSrc >= extractBegin_) && (idxSrc <= extractEnd_)) - { - if (nDest == 0) beginDestLoc = i; - ++nDest; - } - } - - axisDest_->n_glo.setValue(extractN_); - axisDest_->index.resize(nDest); - if (nDest==0) - { - axisDest_->n.setValue( 0 ); - axisDest_->begin.setValue( 0 ); - } - - if (axisSrc_->hasValue) axisDest_->value.resize(nDest); - if (axisSrc_->hasLabel) axisDest_->label.resize(nDest); - if (axisSrc_->hasBounds) axisDest_->bounds.resize(2,nDest); - - auto& transMap = this->transformationMapping_; - - // Set attributes required to define domainDestination->localElement_ and associated views, full and workflow) - CArray sourceGlobalIdx = axisSource->getLocalElement()->getGlobalIndex(); - int indexSize = sourceGlobalIdx.numElements(); - - CArray sourceWorkflowIdx = axisSource->getLocalView(CElementView::WORKFLOW)->getIndex(); - int srcWorkflowSize = sourceWorkflowIdx.numElements(); - axisDest_->data_index.resize(nDest); - axisDest_->data_index = -1; - - int idxMin = INT_MAX; - for (int countSrc = 0; countSrc < indexSize ; ++countSrc) - { - if ( sourceGlobalIdx(countSrc) < idxMin ) - idxMin = sourceGlobalIdx(countSrc); - } - - int countDest(0); // increment of the position in destination domain - for (int countSrc = 0; countSrc < indexSize ; ++countSrc) - { - int idxSrc = sourceGlobalIdx(countSrc); - if ( (idxSrc >= extractBegin_) && (idxSrc <= extractEnd_) ) - { - axisDest_->index(countDest) = idxSrc-extractBegin_; - - // ------------------ define transformation only if in the WF ------------------ - int iIdxSrc2 = (countSrc+idxMin)%axisSource->n_glo; - int convert_locally_global_idx = (iIdxSrc2-idxMin) ; - bool concerned_by_WF(false); - for ( int i = 0 ; idata_index( countDest ) = countDest; - } - // ----------------------------------------------------------------------------- - - if (axisSrc_->hasValue) - { - axisDest_->value(countDest) = axisSrc_->value(countSrc); - } - if (axisSrc_->hasLabel) - { - axisDest_->label(countDest) = axisSrc_->label(countSrc); - } - if (axisSrc_->hasBounds) - { - axisDest_->bounds(0,countDest) = axisSrc_->bounds(0,countSrc); - axisDest_->bounds(1,countDest) = axisSrc_->bounds(1,countSrc); - } - - // if point i has been identified as extracted, increment position in destination domain for the next point - countDest++; - } - } - - axisDestination->checkAttributes() ; - - this->computeAlgorithm(axisSource->getLocalView(CElementView::WORKFLOW), axisDestination->getLocalView(CElementView::WORKFLOW)) ; -} -CATCH - - - -} diff --git a/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_extract.hpp b/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_extract.hpp deleted file mode 100755 index 692da182376e8099dc09661ab1f50cbabdea2c89..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_extract.hpp +++ /dev/null @@ -1,63 +0,0 @@ -/*! - \file axis_algorithm_extract.hpp - \brief Algorithm for extracting an axis. - */ -#ifndef __XIOS_AXIS_ALGORITHM_EXTRACT_HPP__ -#define __XIOS_AXIS_ALGORITHM_EXTRACT_HPP__ - -#include "algorithm_transformation_transfer.hpp" -#include "transformation.hpp" - -namespace xios { -class CAxis; -class CExtractAxis; - -/*! - \class CAxisAlgorithmExtract - Implementing extract on axis - A extracted region can be considered as region that isn't masked. - Only this extracted region is extracted to write on Netcdf. -*/ -class CAxisAlgorithmExtract : public CAlgorithmTransformationTransfer -{ -public: - CAxisAlgorithmExtract(bool isSource, CAxis* axisDestination, CAxis* axisSource, CExtractAxis* extractAxis); - - virtual ~CAxisAlgorithmExtract() {} - - static bool registerTrans(); - virtual StdString getAlgoName() {return "\\nextract_axis";} - -private: - -private: - //! Global extract begin on axis - StdSize extractBegin_; - - //! Global extract end on axis - StdSize extractEnd_; - - //! Global extract size on axis - StdSize extractN_; - - std::vector extractIndex_; - -private: - CAxis* axisSrc_; - CAxis* axisDest_; - -public: - static shared_ptr create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition); - static bool dummyRegistered_; -}; - -} -#endif // __XIOS_AXIS_ALGORITHM_EXTRACT_HPP__ diff --git a/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_extract_domain.cpp b/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_extract_domain.cpp deleted file mode 100755 index f1ea38886d4b84976afc4be45aae0d662b391f31..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_extract_domain.cpp +++ /dev/null @@ -1,197 +0,0 @@ -/*! - \file axis_algorithm_reduce_domain.cpp - \author Ha NGUYEN - \since 23 June 2016 - \date 23 June 2016 - - \brief Algorithm for extract a domain to an axis - */ -#include "axis_algorithm_extract_domain.hpp" -#include "extract_domain_to_axis.hpp" -#include "axis.hpp" -#include "domain.hpp" -#include "grid.hpp" -#include "grid_transformation_factory_impl.hpp" -#include "reduction.hpp" - -namespace xios -{ - -shared_ptr CAxisAlgorithmExtractDomain::create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) -TRY -{ - std::vector axisListDestP = gridDst->getAxis(); - std::vector domainListSrcP = gridSrc->getDomains(); - - CExtractDomainToAxis* extractDomain = dynamic_cast (transformation); - int axisDstIndex = elementPositionInGridDst2AxisPosition[elementPositionInGrid]; - int domainSrcIndex = elementPositionInGridSrc2DomainPosition[elementPositionInGrid]; - - return make_shared(isSource, axisListDestP[axisDstIndex], domainListSrcP[domainSrcIndex], extractDomain); -} -CATCH - -bool CAxisAlgorithmExtractDomain::dummyRegistered_ = CAxisAlgorithmExtractDomain::registerTrans(); -bool CAxisAlgorithmExtractDomain::registerTrans() -TRY -{ - return CGridTransformationFactory::registerTransformation(TRANS_EXTRACT_DOMAIN_TO_AXIS, create); -} -CATCH - - -CAxisAlgorithmExtractDomain::CAxisAlgorithmExtractDomain(bool isSource, CAxis* axisDestination, CDomain* domainSource, CExtractDomainToAxis* algo) - : CAlgorithmTransformationTransfer(isSource), pos_(-1), axisDest_(axisDestination), domainSrc_(domainSource) -TRY -{ - axisDestination->axis_type.reset(); - axisDestination->n_glo.reset(); - axisDestination->index.reset(); - axisDestination->n.reset(); - axisDestination->begin.reset(); - - axisDestination->mask.reset(); - axisDestination->data_index.reset(); - axisDestination->data_n.reset(); - axisDestination->data_begin.reset(); - - axisDestination->value.reset(); - axisDestination->label.reset(); - axisDestination->bounds.reset(); - - algo->checkValid(axisDestination, domainSource); - StdString op = "extract"; - - int nglo,nloc; - switch (algo->direction) - { - case CExtractDomainToAxis::direction_attr::jDir: - dir_ = jDir; - nglo = domainSource->nj_glo.getValue(); - nloc = domainSource->nj.getValue(); - break; - case CExtractDomainToAxis::direction_attr::iDir: - dir_ = iDir; - nglo = domainSource->ni_glo.getValue(); - nloc = domainSource->ni.getValue(); - break; - default: - break; - } - - axisDestination->n_glo.setValue( nglo ); - axisDestination->index.resize( nloc ); - axisDestination->data_index.resize( nloc ); - axisDestination->data_index = -1; - - if ( axisDestination->index.isEmpty() ) - { - axisDestination->n.setValue( 0 ); - axisDestination->begin.setValue( 0 ); - } - - pos_ = algo->position; - - auto& transMap = this->transformationMapping_; - - CArray sourceGlobalIdx = domainSource->getLocalElement()->getGlobalIndex(); - int indexSize = sourceGlobalIdx.numElements(); - - CArray sourceWorkflowIdx = domainSource->getLocalView(CElementView::WORKFLOW)->getIndex(); - int srcWorkflowSize = sourceWorkflowIdx.numElements(); - - int iIdxSrcMin = INT_MAX; - int jIdxSrcMin = INT_MAX; - int IdxMin = INT_MAX; - for (int countSrc = 0; countSrc < indexSize ; ++countSrc) - { - if ( sourceGlobalIdx(countSrc)%domainSource->ni_glo < iIdxSrcMin ) - iIdxSrcMin = sourceGlobalIdx(countSrc)%domainSource->ni_glo; - if ( sourceGlobalIdx(countSrc)/domainSource->ni_glo < jIdxSrcMin ) - jIdxSrcMin = sourceGlobalIdx(countSrc)/domainSource->ni_glo; - if ( sourceGlobalIdx(countSrc) < IdxMin ) - IdxMin = sourceGlobalIdx(countSrc); - } - - if (jDir == dir_) - { - int countDest(0); - for (int countSrc = 0; countSrc < indexSize ; ++countSrc) - { - if ( sourceGlobalIdx(countSrc)%domainSource->ni_glo == pos_ ) - { - axisDest_->index(countDest) = sourceGlobalIdx(countSrc)/domainSource->ni_glo; - int iIdxSrc2 = (countSrc+IdxMin)%domainSource->ni_glo; - int jIdxSrc2 = (countSrc+IdxMin)/domainSource->ni_glo; - int convert_locally_global_idx = (jIdxSrc2-jIdxSrcMin)*domainSource->ni + (iIdxSrc2-iIdxSrcMin) ; - bool concerned_by_WF(false); - for ( int i = 0 ; idata_index(countDest) = countDest; - transMap[axisDest_->index(countDest)] = sourceGlobalIdx(countSrc); - } - countDest++; - } - } - } - else if (iDir == dir_) - { - int countDest(0); - for (int countSrc = 0; countSrc < indexSize ; ++countSrc) - { - if ( sourceGlobalIdx(countSrc)/domainSource->ni_glo == pos_ ) - { - axisDest_->index(countDest) = sourceGlobalIdx(countSrc)%domainSource->ni_glo; - int iIdxSrc2 = (countSrc+IdxMin)%domainSource->ni_glo; - int jIdxSrc2 = (countSrc+IdxMin)/domainSource->ni_glo; - int convert_locally_global_idx = (jIdxSrc2-jIdxSrcMin)*domainSource->ni + (iIdxSrc2-iIdxSrcMin) ; - bool concerned_by_WF(false); - for ( int i = 0 ; idata_index(countDest) = countDest; - transMap[axisDest_->index(countDest)] = sourceGlobalIdx(countSrc); - } - countDest++; - } - } - } - else - {} - - axisDestination->checkAttributes() ; - this->computeAlgorithm(domainSource->getLocalView(CElementView::WORKFLOW), axisDestination->getLocalView(CElementView::WORKFLOW)) ; -} -CATCH - - -CAxisAlgorithmExtractDomain::~CAxisAlgorithmExtractDomain() -TRY -{ -} -CATCH - -} diff --git a/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_extract_domain.hpp b/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_extract_domain.hpp deleted file mode 100755 index c28bf2657d9a799132b196edbbc489ab403ac6f7..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_extract_domain.hpp +++ /dev/null @@ -1,64 +0,0 @@ -/*! - \file axis_algorithm_reduce_domain.hpp - \author Ha NGUYEN - \since 23 June 2016 - \date 23 June 2016 - - \brief Algorithm for reduce an axis to a axis - */ -#ifndef __XIOS_AXIS_ALGORITHM_EXTRACT_DOMAIN_HPP__ -#define __XIOS_AXIS_ALGORITHM_EXTRACT_DOMAIN_HPP__ - -#include "algorithm_transformation_transfer.hpp" -#include "transformation.hpp" - -namespace xios { - -class CAxis; -class CDomain; -class CExtractDomainToAxis; -class CReductionAlgorithm; - - -/*! - \class CAxisAlgorithmExtractDomain - Extract a domain to an axis -*/ -class CAxisAlgorithmExtractDomain : public CAlgorithmTransformationTransfer -{ -public: - CAxisAlgorithmExtractDomain(bool isSource, CAxis* axisDestination, CDomain* domainSource, CExtractDomainToAxis* algo); - - virtual ~CAxisAlgorithmExtractDomain(); - - static bool registerTrans(); - virtual StdString getAlgoName() {return "\\nextract_domain)";} -protected: - enum ExtractDirection { - undefined = 0, - iDir = 1, - jDir = 2 - }; - - ExtractDirection dir_; - int pos_; //! Position to extract - -private: - CDomain* domainSrc_; - CAxis* axisDest_ ; - -public: - static shared_ptr create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition); - static bool dummyRegistered_; -}; - -} -#endif // __XIOS_AXIS_ALGORITHM_EXTRACT_DOMAIN_HPP__ diff --git a/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_interpolate.cpp b/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_interpolate.cpp deleted file mode 100755 index 94c0be8b83fec300270f94a21725da2c438f709a..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_interpolate.cpp +++ /dev/null @@ -1,406 +0,0 @@ -/*! - \file axis_algorithm_interpolate.cpp - \author Ha NGUYEN - \since 23 June 2015 - \date 02 Jul 2015 - - \brief Algorithm for interpolation on an axis. - */ -#include "axis_algorithm_interpolate.hpp" -#include "axis.hpp" -#include "interpolate_axis.hpp" -#include -#include "context.hpp" -#include "context_client.hpp" -#include "utils.hpp" -#include "grid.hpp" -#include "grid_transformation_factory_impl.hpp" -#include "distribution_client.hpp" -#include "timer.hpp" - -namespace xios { -shared_ptr CAxisAlgorithmInterpolate::create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) -TRY -{ - std::vector axisListDestP = gridDst->getAxis(); - std::vector axisListSrcP = gridSrc->getAxis(); - - CInterpolateAxis* interpolateAxis = dynamic_cast (transformation); - int axisDstIndex = elementPositionInGridDst2AxisPosition[elementPositionInGrid]; - int axisSrcIndex = elementPositionInGridSrc2AxisPosition[elementPositionInGrid]; - - return make_shared(isSource, axisListDestP[axisDstIndex], axisListSrcP[axisSrcIndex], interpolateAxis); -} -CATCH - -bool CAxisAlgorithmInterpolate::dummyRegistered_ = CAxisAlgorithmInterpolate::registerTrans(); -bool CAxisAlgorithmInterpolate::registerTrans() -TRY -{ - /// descativate for now - // return CGridTransformationFactory::registerTransformation(TRANS_INTERPOLATE_AXIS, create); - return false; -} -CATCH - -CAxisAlgorithmInterpolate::CAxisAlgorithmInterpolate(bool isSource, CAxis* axisDestination, CAxis* axisSource, CInterpolateAxis* interpAxis) -: CAlgorithmTransformationWeight(isSource), coordinate_(), transPosition_(), axisSrc_(axisSource), axisDest_(axisDestination) -TRY -{ - interpAxis->checkValid(axisSource); - axisDestination->checkAttributes() ; - - order_ = interpAxis->order.getValue(); - if (!interpAxis->coordinate.isEmpty()) - { - coordinate_ = interpAxis->coordinate.getValue(); -// this->idAuxInputs_.resize(1); -// this->idAuxInputs_[0] = coordinate_; - } - std::vector* > dataAuxInputs ; - computeRemap(dataAuxInputs) ; - this->computeAlgorithm(axisSource->getLocalView(CElementView::WORKFLOW), axisDestination->getLocalView(CElementView::WORKFLOW)) ; -} -CATCH - -/*! - Compute the index mapping between axis on grid source and one on grid destination -*/ -void CAxisAlgorithmInterpolate::computeRemap(const std::vector* >& dataAuxInputs) -TRY -{ - CTimer::get("CAxisAlgorithmInterpolate::computeIndexSourceMapping_").resume() ; - CContext* context = CContext::getCurrent(); - int nbClient = context->intraCommSize_; - CArray& axisMask = axisSrc_->mask; - int srcSize = axisSrc_->n_glo.getValue(); - std::vector > vecAxisValue; - - // Fill in axis value from coordinate - fillInAxisValue(vecAxisValue, dataAuxInputs); - std::vector valueSrc(srcSize); - std::vector recvBuff(srcSize); - std::vector indexVec(srcSize); - - for (int idx = 0; idx < vecAxisValue.size(); ++idx) - { - CArray& axisValue = vecAxisValue[idx]; - retrieveAllAxisValue(axisValue, axisMask, recvBuff, indexVec); - XIOSAlgorithms::sortWithIndex(recvBuff, indexVec); - for (int i = 0; i < srcSize; ++i) valueSrc[i] = recvBuff[indexVec[i]]; - computeInterpolantPoint(valueSrc, indexVec, idx); - } - CTimer::get("CAxisAlgorithmInterpolate::computeIndexSourceMapping_").suspend() ; -} -CATCH - -/*! - Compute the interpolant points - Assume that we have all value of axis source, with these values, need to calculate weight (coeff) of Lagrange polynomial - \param [in] axisValue all value of axis source - \param [in] tranPos position of axis on a domain -*/ -void CAxisAlgorithmInterpolate::computeInterpolantPoint(const std::vector& axisValue, - const std::vector& indexVec, - int transPos) -TRY -{ - std::vector::const_iterator itb = axisValue.begin(), ite = axisValue.end(); - std::vector::const_iterator itLowerBound, itUpperBound, it, iteRange, itfirst, itsecond; - const double sfmax = NumTraits::sfmax(); - const double precision = NumTraits::dummy_precision(); - - int ibegin = axisDest_->begin.getValue(); - CArray& axisDestValue = axisDest_->value; - int numValue = axisDestValue.numElements(); - std::map > > interpolatingIndexValues; - - for (int idx = 0; idx < numValue; ++idx) - { - bool outOfRange = false; - double destValue = axisDestValue(idx); - if (destValue < *itb) outOfRange = true; - - itLowerBound = std::lower_bound(itb, ite, destValue); - itUpperBound = std::upper_bound(itb, ite, destValue); - if ((ite != itUpperBound) && (sfmax == *itUpperBound)) itUpperBound = ite; - - if ((ite == itLowerBound) || (ite == itUpperBound)) outOfRange = true; - - // We don't do extrapolation FOR NOW, maybe in the future - if (!outOfRange) - { - if ((itLowerBound == itUpperBound) && (itb != itLowerBound)) --itLowerBound; - double distanceToLower = destValue - *itLowerBound; - double distanceToUpper = *itUpperBound - destValue; - int order = (order_ + 1) - 2; - bool down = (distanceToLower < distanceToUpper) ? true : false; - for (int k = 0; k < order; ++k) - { - if ((itb != itLowerBound) && down) - { - --itLowerBound; - distanceToLower = destValue - *itLowerBound; - down = (distanceToLower < distanceToUpper) ? true : false; - continue; - } - if ((ite != itUpperBound) && (sfmax != *itUpperBound)) - { - ++itUpperBound; - distanceToUpper = *itUpperBound - destValue; - down = (distanceToLower < distanceToUpper) ? true : false; - - } - } - - iteRange = (ite == itUpperBound) ? itUpperBound : itUpperBound + 1; - itsecond = it = itLowerBound; ++itsecond; - while (it < iteRange) - { - while ( (itsecond < ite) && ((*itsecond -*it) < precision) ) - { ++itsecond; ++it; } - int index = std::distance(itb, it); - interpolatingIndexValues[idx+ibegin].push_back(make_pair(indexVec[index],*it)); - ++it; ++itsecond; - } - - } - } - computeWeightedValueAndMapping(interpolatingIndexValues, transPos); -} -CATCH - -/*! - Compute weight (coeff) of Lagrange's polynomial - \param [in] interpolatingIndexValues the necessary axis value to calculate the coeffs -*/ -void CAxisAlgorithmInterpolate::computeWeightedValueAndMapping(const std::map > >& interpolatingIndexValues, int transPos) -TRY -{ - TransformationIndexMap& transMap = this->transformationMapping_; - TransformationWeightMap& transWeight = this->transformationWeight_; - std::map > >::const_iterator itb = interpolatingIndexValues.begin(), it, - ite = interpolatingIndexValues.end(); - int ibegin = axisDest_->begin.getValue(); - for (it = itb; it != ite; ++it) - { - int globalIndexDest = it->first; - double localValue = axisDest_->value(globalIndexDest - ibegin); - const std::vector >& interpVal = it->second; - int interpSize = interpVal.size(); - transMap[globalIndexDest].resize(interpSize); - transWeight[globalIndexDest].resize(interpSize); - for (int idx = 0; idx < interpSize; ++idx) - { - int index = interpVal[idx].first; - double weight = 1.0; - - for (int k = 0; k < interpSize; ++k) - { - if (k == idx) continue; - weight *= (localValue - interpVal[k].second); - weight /= (interpVal[idx].second - interpVal[k].second); - } - transMap[globalIndexDest][idx] = index; - transWeight[globalIndexDest][idx] = weight; -/* - if (!transPosition_.empty()) - { - (this->transformationPosition_[transPos])[globalIndexDest] = transPosition_[transPos]; - } -*/ - } - } -/* - if (!transPosition_.empty() && this->transformationPosition_[transPos].empty()) - (this->transformationPosition_[transPos])[0] = transPosition_[transPos]; -*/ -} -CATCH - -/*! - Each client retrieves all values of an axis - \param [in/out] recvBuff buffer for receiving values (already allocated) - \param [in/out] indexVec mapping between values and global index of axis -*/ -void CAxisAlgorithmInterpolate::retrieveAllAxisValue(const CArray& axisValue, const CArray& axisMask, - std::vector& recvBuff, std::vector& indexVec) -TRY -{ - CContext* context = CContext::getCurrent(); - int nbClient = context->intraCommSize_; - - int srcSize = axisSrc_->n_glo.getValue(); - int numValue = axisValue.numElements(); - - if (srcSize == numValue) // Only one client or axis not distributed - { - for (int idx = 0; idx < srcSize; ++idx) - { - if (axisMask(idx)) - { - recvBuff[idx] = axisValue(idx); - indexVec[idx] = idx; - } - else - { - recvBuff[idx] = NumTraits::sfmax(); - indexVec[idx] = -1; - } - } - - } - else // Axis distributed - { - double* sendValueBuff = new double [numValue]; - int* sendIndexBuff = new int [numValue]; - int* recvIndexBuff = new int [srcSize]; - - int ibegin = axisSrc_->begin.getValue(); - for (int idx = 0; idx < numValue; ++idx) - { - if (axisMask(idx)) - { - sendValueBuff[idx] = axisValue(idx); - sendIndexBuff[idx] = idx + ibegin; - } - else - { - sendValueBuff[idx] = NumTraits::sfmax(); - sendIndexBuff[idx] = -1; - } - } - - int* recvCount=new int[nbClient]; - MPI_Allgather(&numValue,1,MPI_INT,recvCount,1,MPI_INT,context->intraComm_); - - int* displ=new int[nbClient]; - displ[0]=0 ; - for(int n=1;nintraComm_); - MPI_Allgatherv(sendValueBuff,numValue,MPI_DOUBLE,&(recvBuff[0]),recvCount,displ,MPI_DOUBLE,context->intraComm_); - - for (int idx = 0; idx < srcSize; ++idx) - { - indexVec[idx] = recvIndexBuff[idx]; - } - - delete [] displ; - delete [] recvCount; - delete [] recvIndexBuff; - delete [] sendIndexBuff; - delete [] sendValueBuff; - } -} -CATCH - -/*! - Fill in axis value dynamically from a field whose grid is composed of a domain and an axis - \param [in/out] vecAxisValue vector axis value filled in from input field -*/ -void CAxisAlgorithmInterpolate::fillInAxisValue(std::vector >& vecAxisValue, - const std::vector* >& dataAuxInputs) -TRY -{ - if (coordinate_.empty()) - { - vecAxisValue.resize(1); - vecAxisValue[0].resize(axisSrc_->value.numElements()); - vecAxisValue[0] = axisSrc_->value; -// this->transformationMapping_.resize(1); -// this->transformationWeight_.resize(1); - } - else - { -/* - CField* field = CField::get(coordinate_); - CGrid* grid = field->getGrid(); - - std::vector domListP = grid->getDomains(); - std::vector axisListP = grid->getAxis(); - if (domListP.empty() || axisListP.empty() || (1 < domListP.size()) || (1 < axisListP.size())) - ERROR("CAxisAlgorithmInterpolate::fillInAxisValue(std::vector >& vecAxisValue)", - << "XIOS only supports dynamic interpolation with coordinate (field) associated with grid composed of a domain and an axis" - << "Coordinate (field) id = " <getId() << std::endl - << "Associated grid id = " << grid->getId()); - - CDomain* dom = domListP[0]; - size_t vecAxisValueSize = dom->i_index.numElements(); - size_t vecAxisValueSizeWithMask = 0; - for (size_t idx = 0; idx < vecAxisValueSize; ++idx) - { - if (dom->domainMask(idx)) ++vecAxisValueSizeWithMask; - } - - int niGlobDom = dom->ni_glo.getValue(); - vecAxisValue.resize(vecAxisValueSizeWithMask); - if (transPosition_.empty()) - { - size_t indexMask = 0; - transPosition_.resize(vecAxisValueSizeWithMask); - for (size_t idx = 0; idx < vecAxisValueSize; ++idx) - { - if (dom->domainMask(idx)) - { - transPosition_[indexMask].resize(1); - transPosition_[indexMask][0] = (dom->i_index)(idx) + niGlobDom * (dom->j_index)(idx); - ++indexMask; - } - - } - } - this->transformationMapping_.resize(vecAxisValueSizeWithMask); - this->transformationWeight_.resize(vecAxisValueSizeWithMask); - this->transformationPosition_.resize(vecAxisValueSizeWithMask); - - const CDistributionClient::GlobalLocalDataMap& globalLocalIndexSendToServer = grid->getClientDistribution()->getGlobalLocalDataSendToServer(); - CDistributionClient::GlobalLocalDataMap::const_iterator itIndex, iteIndex = globalLocalIndexSendToServer.end(); - size_t axisSrcSize = axisSrc_->index.numElements(); - std::vector globalDimension = grid->getGlobalDimension(); - - size_t indexMask = 0; - for (size_t idx = 0; idx < vecAxisValueSize; ++idx) - { - if (dom->domainMask(idx)) - { - size_t axisValueSize = 0; - for (size_t jdx = 0; jdx < axisSrcSize; ++jdx) - { - size_t globalIndex = ((dom->i_index)(idx) + (dom->j_index)(idx)*globalDimension[0]) + (axisSrc_->index)(jdx)*globalDimension[0]*globalDimension[1]; - if (iteIndex != globalLocalIndexSendToServer.find(globalIndex)) - { - ++axisValueSize; - } - } - - vecAxisValue[indexMask].resize(axisValueSize); - axisValueSize = 0; - for (size_t jdx = 0; jdx < axisSrcSize; ++jdx) - { - size_t globalIndex = ((dom->i_index)(idx) + (dom->j_index)(idx)*globalDimension[0]) + (axisSrc_->index)(jdx)*globalDimension[0]*globalDimension[1]; - itIndex = globalLocalIndexSendToServer.find(globalIndex); - if (iteIndex != itIndex) - { - vecAxisValue[indexMask](axisValueSize) = (*dataAuxInputs[0])(itIndex->second); - ++axisValueSize; - } - } - ++indexMask; - } - } - */ - } -} -CATCH - -} diff --git a/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_interpolate.hpp b/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_interpolate.hpp deleted file mode 100755 index dd99202febc60d1f15ff4c8faf1769a6a23f1fbe..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_interpolate.hpp +++ /dev/null @@ -1,68 +0,0 @@ -/*! - \file axis_algorithm_interpolate.hpp - \author Ha NGUYEN - \since 23 June 2015 - \date 23 June 2015 - - \brief Algorithm for interpolation on an axis. - */ -#ifndef __XIOS_AXIS_ALGORITHM_INTERPOLATE_HPP__ -#define __XIOS_AXIS_ALGORITHM_INTERPOLATE_HPP__ - -#include "algorithm_transformation_weight.hpp" -#include "transformation.hpp" - -namespace xios { - -class CAxis; -class CGrid; -class CInterpolateAxis; - -/*! - \class CAxisAlgorithmInterpolate - Implementing interpolation on axis - The values on axis source are assumed monotonic -*/ -class CAxisAlgorithmInterpolate : public CAlgorithmTransformationWeight -{ -public: - CAxisAlgorithmInterpolate(bool isSource, CAxis* axisDestination, CAxis* axisSource, CInterpolateAxis* interpAxis); - - virtual ~CAxisAlgorithmInterpolate() {} - - static bool registerTrans(); - virtual StdString getAlgoName() {return "\\ninterpolate_axis";} - -private: - void computeRemap(const std::vector* >& dataAuxInputs) ; - void retrieveAllAxisValue(const CArray& axisValue, const CArray& axisMask, - std::vector& recvBuff, std::vector& indexVec); - void computeInterpolantPoint(const std::vector& recvBuff, const std::vector&, int transPos = 0); - void computeWeightedValueAndMapping(const std::map > >& interpolatingIndexValues, int transPos = 0); - void fillInAxisValue(std::vector >& vecAxisValue, - const std::vector* >& dataAuxInputs); - -private: - // Interpolation order - int order_; - StdString coordinate_; - std::vector > transPosition_; - CAxis* axisSrc_=nullptr ; - CAxis* axisDest_=nullptr; - -public: - static shared_ptr create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition); - static bool dummyRegistered_; -}; - -} - -#endif // __XIOS_AXIS_ALGORITHM_INTERPOLATE_HPP__ diff --git a/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_interpolate_coordinate.cpp b/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_interpolate_coordinate.cpp deleted file mode 100755 index 7e7ca1c13a3b21f91179aedd866f7c9c70ec6c19..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_interpolate_coordinate.cpp +++ /dev/null @@ -1,349 +0,0 @@ -/*! - \file axis_algorithm_interpolate.cpp - \author Ha NGUYEN - \since 23 June 2015 - \date 02 Jul 2015 - - \brief Algorithm for interpolation on an axis. - */ -#include "axis_algorithm_interpolate_coordinate.hpp" -#include "axis.hpp" -#include "interpolate_axis.hpp" -#include -#include -#include "context.hpp" -#include "context_client.hpp" -#include "utils.hpp" -#include "grid.hpp" -#include "grid_transformation_factory_impl.hpp" -#include "distribution_client.hpp" -#include "transform_filter.hpp" -#include "timer.hpp" - -namespace xios -{ - shared_ptr CAxisAlgorithmInterpolateCoordinate::create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) - TRY - { - std::vector axisListDestP = gridDst->getAxis(); - std::vector axisListSrcP = gridSrc->getAxis(); - - CInterpolateAxis* interpolateAxis = dynamic_cast (transformation); - int axisDstIndex = elementPositionInGridDst2AxisPosition[elementPositionInGrid]; - int axisSrcIndex = elementPositionInGridSrc2AxisPosition[elementPositionInGrid]; - - return make_shared(isSource, axisListDestP[axisDstIndex], axisListSrcP[axisSrcIndex], interpolateAxis); - } - CATCH - - bool CAxisAlgorithmInterpolateCoordinate::dummyRegistered_ = CAxisAlgorithmInterpolateCoordinate::registerTrans(); - bool CAxisAlgorithmInterpolateCoordinate::registerTrans() - TRY - { - return CGridTransformationFactory::registerTransformation(TRANS_INTERPOLATE_AXIS, create); - } - CATCH - - vector CAxisAlgorithmInterpolateCoordinate::getAuxFieldId(void) - { - if (hasCoordinateSrc_ && hasCoordinateDest_) return {coordinateSrc_,coordinateDest_} ; - else if (hasCoordinateSrc_) return {coordinateSrc_} ; - else if (hasCoordinateDest_) return {coordinateDest_} ; - else return vector() ; - } - - bool CAxisAlgorithmInterpolateCoordinate::transformAuxField(int pos) - { - if (pos==0) - { - if (hasCoordinateSrc_) return true ; - else if(hasCoordinateDest_) return false ; - } - if (pos==1) return false ; - - MISSING_RETURN( "bool CAxisAlgorithmInterpolateCoordinate::transformAuxField(int pos)" ); - return false; - } - - CAxisAlgorithmInterpolateCoordinate::CAxisAlgorithmInterpolateCoordinate(bool isSource, CAxis* axisDestination, CAxis* axisSource, CInterpolateAxis* interpAxis) - : CAlgorithmTransformationTransfer(isSource), axisSrc_(axisSource), axisDest_(axisDestination) - TRY - { - interpAxis->checkValid(axisSource); - axisDestination->checkAttributes() ; - - order_ = interpAxis->order.getValue(); - if (!interpAxis->coordinate.isEmpty()) - { - coordinateSrc_ = interpAxis->coordinate.getValue(); - hasCoordinate_=true ; - hasCoordinateSrc_=true ; - } - - if (!interpAxis->coordinate_src.isEmpty()) - { - coordinateSrc_ = interpAxis->coordinate_src.getValue(); - hasCoordinate_=true ; - hasCoordinateSrc_=true ; - } - - if (!interpAxis->coordinate_dst.isEmpty()) - { - coordinateDest_ = interpAxis->coordinate_dst.getValue(); - hasCoordinate_=true ; - hasCoordinateDest_=true ; - } - - ngloSrc_=axisSource->n_glo ; - nDest_ = axisDest_-> getLocalView(CElementView::WORKFLOW)->getSize() ; - - if (!hasCoordinateDest_) - { - CArray coord ; - auto destConnector = make_shared(axisDest_->getLocalView(CElementView::FULL), axisDest_->getLocalView(CElementView::WORKFLOW)) ; - destConnector->computeConnector() ; - destConnector->transfer(axisDest_->value, coord) ; - destCoordinate_ = vector(coord.dataFirst(), coord.dataFirst()+nDest_) ; - } - - CArray globalIndex(ngloSrc_) ; - for(int i=0;i axisSourceGlo = make_shared(CContext::getCurrent()->getIntraCommRank(), ngloSrc_, globalIndex) ; - axisSourceGlo->addFullView() ; - - this->computeAlgorithm(axisSource->getLocalView(CElementView::WORKFLOW), axisSourceGlo->getView(CElementView::FULL)) ; - - if (!hasCoordinateSrc_) - { - CArray coord ; - CArray coordGlo ; - auto srcConnector = make_shared(axisSrc_->getLocalView(CElementView::FULL), axisSrc_->getLocalView(CElementView::WORKFLOW)) ; - srcConnector->computeConnector() ; - srcConnector->transfer(axisSrc_->value, coord) ; // full view value -> workflow value - transferTransformConnector_ -> transfer(coord, coordGlo) ; // workflow view -> full global view - srcCoordinate_ = vector(coordGlo.dataFirst(), coordGlo.dataFirst()+ngloSrc_) ; - } - } - CATCH - - CTransformFilter* CAxisAlgorithmInterpolateCoordinate::createTransformFilter(CGarbageCollector& gc, shared_ptr algo, bool detectMissingValues, double defaultValue) - { - if (hasCoordinateSrc_ && hasCoordinateDest_) return new CTransformFilter(gc, 3, algo, detectMissingValues, defaultValue) ; - else return new CTransformFilter(gc, 2, algo, detectMissingValues, defaultValue) ; - } - - void CAxisAlgorithmInterpolateCoordinate::apply(int dimBefore, int dimAfter, const CArray& dataIn, - const vector>& auxDataIn, CArray& dataOut) - { - CArray dataInTmp; - CArray auxDataInSrc ; - transferTransformConnector_ -> transfer(dimBefore, dimAfter, dataIn, dataInTmp) ; - if (hasCoordinateSrc_) transferTransformConnector_ -> transfer(dimBefore, dimAfter, auxDataIn[0], auxDataInSrc) ; - - - dataOut.resize(dimBefore*dimAfter*nDest_) ; - const double* pressureSrc ; - const double* pressureDest ; - if (hasCoordinateSrc_) pressureSrc = auxDataInSrc.dataFirst() ; - if (hasCoordinateDest_ && hasCoordinateSrc_) pressureDest = auxDataIn[1].dataFirst() ; - else if (hasCoordinateDest_ && !hasCoordinateSrc_ ) pressureDest = auxDataIn[0].dataFirst() ; - - const double* in = dataInTmp.dataFirst() ; - double* out = dataOut.dataFirst() ; - - size_t sliceSrc = dimAfter*ngloSrc_ ; - size_t sliceDest = dimAfter*nDest_ ; - vector srcCoordinate(ngloSrc_) ; - vector destCoordinate(nDest_) ; - std::vector srcIndex(ngloSrc_); - vector srcValue(ngloSrc_) ; - vector destValue(nDest_) ; - std::vector destIndex(nDest_); - - size_t nsrc, nDest ; - - for(size_t j=0, posJsrc=0, posJdest=0 ; j::quiet_NaN() ; - } - } - else - { - nDest=0 ; - for(size_t i=0, posIdest=posKdest ; i::quiet_NaN() ; - } - } - } - } - - void CAxisAlgorithmInterpolateCoordinate::computeInterp(int nsrc, vector& srcCoordinate, vector& srcValue, vector& srcIndex, - int ndst, vector& dstCoordinate, vector& dstValue, vector& dstIndex) - { - double x,y ; - double d ; - - iota(srcIndex.data(), srcIndex.data()+nsrc, 0); // sort array and retrive sorted index - stable_sort(srcIndex.data(), srcIndex.data()+nsrc, [&srcCoordinate](size_t i1, size_t i2) {return srcCoordinate[i1] < srcCoordinate[i2];}); - - iota(dstIndex.data(), dstIndex.data()+ndst, 0); - stable_sort(dstIndex.data(), dstIndex.data()+ndst, [&dstCoordinate](size_t i1, size_t i2) {return dstCoordinate[i1] < dstCoordinate[i2];}); - - if (order_==1 || nsrc<=2) - { - if (nsrc<=1) dstValue.assign(ndst,std::numeric_limits::quiet_NaN()); - else - { - - double x0,x1 ; - double y0,y1 ; - int lastj=0; - - for(int i=0; i < ndst;i++) - { - x=dstCoordinate[dstIndex[i]] ; - if ( x<=srcCoordinate[srcIndex[0]]) lastj=0 ; - else if (x>=srcCoordinate[srcIndex[nsrc-1]]) lastj=nsrc-2 ; - else - { - for(int j=lastj; j= srcCoordinate[srcIndex[j]] && x=srcCoordinate[srcIndex[nsrc-1]]) lastj=nsrc-2 ; - else - { - for(int j=lastj; j= srcCoordinate[srcIndex[j]] && x=nsrc-2) cj=nsrc-2 ; - else - { - if ( (x-srcCoordinate[srcIndex[lastj-1]]) > (srcCoordinate[srcIndex[lastj+2]]-x) ) cj=lastj ; - else cj=lastj+1 ; - } - x0=srcCoordinate[srcIndex[cj-1]] ; - x1=srcCoordinate[srcIndex[cj]] ; - x2=srcCoordinate[srcIndex[cj+1]] ; - y0=srcValue[srcIndex[cj-1]] ; - y1=srcValue[srcIndex[cj]] ; - y2=srcValue[srcIndex[cj+1]] ; - - y=y0*(x-x1)*(x-x2)/((x0-x1)*(x0-x2)) + y1*(x-x0)*(x-x2)/((x1-x0)*(x1-x2)) + y2*(x-x0)*(x-x1)/((x2-x0)*(x2-x1)) ; - dstValue[dstIndex[i]]=y ; - } - } - } - -} diff --git a/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_interpolate_coordinate.hpp b/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_interpolate_coordinate.hpp deleted file mode 100755 index d01d74c68dd97db4addae7d688b98ebc1a522292..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_interpolate_coordinate.hpp +++ /dev/null @@ -1,75 +0,0 @@ -/*! - \file axis_algorithm_interpolate.hpp - \author Ha NGUYEN - \since 23 June 2015 - \date 23 June 2015 - - \brief Algorithm for interpolation on an axis. - */ -#ifndef __XIOS_AXIS_ALGORITHM_INTERPOLATE_COORDINATE_HPP__ -#define __XIOS_AXIS_ALGORITHM_INTERPOLATE_COORDINATE_HPP__ - -#include "algorithm_transformation_transfer.hpp" -#include "transformation.hpp" - -namespace xios { - -class CAxis; -class CGrid; -class CInterpolateAxis; -class CTransformFilter; - -/*! - \class CAxisAlgorithmInterpolateCoordinate - Implementing interpolation on axis - The values on axis source are assumed monotonic -*/ -class CAxisAlgorithmInterpolateCoordinate : public CAlgorithmTransformationTransfer -{ -public: - CAxisAlgorithmInterpolateCoordinate(bool isSource, CAxis* axisDestination, CAxis* axisSource, CInterpolateAxis* interpAxis); - - virtual ~CAxisAlgorithmInterpolateCoordinate() {} - virtual vector getAuxFieldId(void) ; - virtual bool transformAuxField(int pos) ; - virtual void apply(int dimBefore, int dimAfter, const CArray& dataIn, - const vector>& auxDataIn, CArray& dataOut) ; - static bool registerTrans(); - virtual StdString getAlgoName() {return "\\ninterpolate_axis";} - virtual CTransformFilter* createTransformFilter(CGarbageCollector& gc, shared_ptr algo, bool detectMissingValues, double defaultValue) ; - -private: - void computeInterp(int nsrc, vector& srcCoordinate, vector& srcValue, vector& srcIndex, - int ndst, vector& dstCoordinate, vector& dstValue, vector& dstIndex) ; - - // Interpolation order - int order_; - StdString coordinateSrc_; // pressure src - StdString coordinateDest_; // pressure dst - bool hasCoordinate_=false ; - bool hasCoordinateSrc_=false ; - bool hasCoordinateDest_=false ; - - CAxis* axisSrc_=nullptr ; - CAxis* axisDest_=nullptr; - size_t ngloSrc_ ; - size_t nDest_ ; - vector srcCoordinate_ ; // src axis value - vector destCoordinate_ ; // dst axis value - -public: - static shared_ptr create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition); - static bool dummyRegistered_; -}; - -} - -#endif // __XIOS_AXIS_ALGORITHM_INTERPOLATE_HPP__ diff --git a/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_inverse.cpp b/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_inverse.cpp deleted file mode 100755 index a9116a9fc21dd3e303455871d976683a71889eed..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_inverse.cpp +++ /dev/null @@ -1,149 +0,0 @@ -/*! - \file axis_algorithm_inverse.hpp - \author Ha NGUYEN - \since 14 May 2015 - \date 29 June 2015 - - \brief Algorithm for inversing an axis.. - */ -#include "axis_algorithm_inverse.hpp" -#include "context.hpp" -#include "context_client.hpp" -#include "axis.hpp" -#include "grid.hpp" -#include "grid_transformation_factory_impl.hpp" -#include "inverse_axis.hpp" -#include "client_client_dht_template.hpp" - -namespace xios { - -shared_ptr CAxisAlgorithmInverse::create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) -TRY -{ - std::vector axisListDestP = gridDst->getAxis(); - std::vector axisListSrcP = gridSrc->getAxis(); - - CInverseAxis* inverseAxis = dynamic_cast (transformation); - int axisDstIndex = elementPositionInGridDst2AxisPosition[elementPositionInGrid]; - int axisSrcIndex = elementPositionInGridSrc2AxisPosition[elementPositionInGrid]; - - return make_shared(isSource, axisListDestP[axisDstIndex], axisListSrcP[axisSrcIndex], inverseAxis); -} -CATCH - -bool CAxisAlgorithmInverse::dummyRegistered_ = CAxisAlgorithmInverse::registerTrans(); -bool CAxisAlgorithmInverse::registerTrans() -TRY -{ - return CGridTransformationFactory::registerTransformation(TRANS_INVERSE_AXIS, create); -} -CATCH - -CAxisAlgorithmInverse::CAxisAlgorithmInverse(bool isSource, CAxis* axisDestination, CAxis* axisSource, CInverseAxis* inverseAxis) - : CAlgorithmTransformationNoDataModification(isSource), axisDest_(axisDestination), axisSrc_(axisSource) -TRY -{ - - axisDestination->axis_type.reset(); - axisDestination->n_glo.reset(); - axisDestination->index.reset(); - axisDestination->n.reset(); - axisDestination->begin.reset(); - - axisDestination->mask.reset(); - axisDestination->data_index.reset(); - axisDestination->data_n.reset(); - axisDestination->data_begin.reset(); - - axisDestination->value.reset(); - axisDestination->bounds.reset(); - - axisDestination->n_glo.setValue( axisSource->n_glo.getValue() ); - - if (axisDestination->n_glo.getValue() != axisSource->n_glo.getValue()) - { - ERROR("CAxisAlgorithmInverse::CAxisAlgorithmInverse(CAxis* axisDestination, CAxis* axisSource)", - << "Two axis have different global size" - << "Size of axis source " <getId() << " is " << axisSource->n_glo.getValue() << std::endl - << "Size of axis destination " <getId() << " is " << axisDestination->n_glo.getValue()); - } - - int n_glo =axisDestination->n_glo.getValue() ; - - CArray sourceGlobalIdx = axisSource->getLocalElement()->getGlobalIndex(); - int indexSize = sourceGlobalIdx.numElements(); - - axisDestination->index.resize( indexSize ); - axisDestination->data_index.resize( indexSize ); - axisDestination->data_index = -1; - for (size_t i = 0; i < indexSize ; ++i) - { - axisDestination->index(i) = (n_glo-1)-sourceGlobalIdx(i); - } - - int idxMin = INT_MAX; - for (int countSrc = 0; countSrc < indexSize ; ++countSrc) - { - if ( sourceGlobalIdx(countSrc) < idxMin ) - idxMin = sourceGlobalIdx(countSrc); - } - - CArray sourceWorkflowIdx = axisSource->getLocalView(CElementView::WORKFLOW)->getIndex(); - int srcWorkflowSize = sourceWorkflowIdx.numElements(); - for (size_t i = 0; i < indexSize ; ++i) - { - // ------------------ define transformation only if in the WF ------------------ - int iIdxSrc2 = (i+idxMin)%axisSource->n_glo; - int convert_locally_global_idx = (iIdxSrc2-idxMin) ; - bool concerned_by_WF(false); - int i2; - for ( i2 = 0 ; i2data_index(sourceWorkflowIdx(i2)) = sourceWorkflowIdx(i2); - } - // ----------------------------------------------------------------------------- - - } - - if (axisSrc_->hasValue) - { - axisDestination->value.resize(indexSize); - for (size_t i = 0; i < indexSize ; ++i) - { - axisDestination->value(i) = axisSource->value(i); - } - } - - if (axisSrc_->hasBounds) - { - axisDestination->bounds.resize(2,indexSize); - for (int i = 0; i < indexSize ; ++i) - { - axisDestination->bounds(0,i) = axisSource->bounds(0,i); - axisDestination->bounds(1,i) = axisSource->bounds(1,i); - } - } - - axisDestination->checkAttributes() ; - -} -CATCH - -} diff --git a/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_inverse.hpp b/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_inverse.hpp deleted file mode 100755 index 10dc0c531a17d2563136d8f6385ac41c94993035..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_inverse.hpp +++ /dev/null @@ -1,53 +0,0 @@ -/*! - \file axis_algorithm_inverse.hpp - \author Ha NGUYEN - \since 14 May 2015 - \date 09 June 2015 - - \brief Algorithm for inversing an axis.. - */ -#ifndef __XIOS_AXIS_ALGORITHM_INVERSE_HPP__ -#define __XIOS_AXIS_ALGORITHM_INVERSE_HPP__ - -#include "algorithm_transformation_no_data_modification.hpp" -#include "transformation.hpp" - -namespace xios { - -class CAxis; -class CInverseAxis; - -/*! - \class CAxisAlgorithmInverse - Inversing an axis -*/ -class CAxisAlgorithmInverse : public CAlgorithmTransformationNoDataModification -{ -public: - CAxisAlgorithmInverse(bool isSource, CAxis* axisDestination, CAxis* axisSource, CInverseAxis* inverseAxis); - - virtual ~CAxisAlgorithmInverse() {} - - static bool registerTrans(); - virtual StdString getAlgoName() {return "\\ninverse_axis";} - - -private: - CAxis* axisSrc_; - CAxis* axisDest_; - -public: - static shared_ptr create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition); - static bool dummyRegistered_; -}; - -} -#endif // __XIOS_AXIS_ALGORITHM_INVERSE_HPP__ diff --git a/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_reduce_axis.cpp b/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_reduce_axis.cpp deleted file mode 100755 index 61b49f509c08b4703cc9c01e2efe4a44b77dc1eb..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_reduce_axis.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/*! - \file axis_algorithm_reduce_axis.cpp - \author Ha NGUYEN - \since 23 June 2016 - \date 23 June 2016 - - \brief Algorithm for reduce a axis to an axis - */ -#include "axis_algorithm_reduce_axis.hpp" -#include "reduce_axis_to_axis.hpp" -#include "axis.hpp" -#include "grid.hpp" -#include "grid_transformation_factory_impl.hpp" -#include "grid_algorithm_reduce.hpp" - - -namespace xios { -shared_ptr CAxisAlgorithmReduceAxis::create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) -TRY -{ - std::vector axisListDestP = gridDst->getAxis(); - std::vector axisListSrcP = gridSrc->getAxis(); - - CReduceAxisToAxis* reduceAxis = dynamic_cast (transformation); - int axisDstIndex = elementPositionInGridDst2AxisPosition[elementPositionInGrid]; - int axisSrcIndex = elementPositionInGridSrc2AxisPosition[elementPositionInGrid]; - - return make_shared(isSource, axisListDestP[axisDstIndex], axisListSrcP[axisSrcIndex], reduceAxis); -} -CATCH - -bool CAxisAlgorithmReduceAxis::dummyRegistered_ = CAxisAlgorithmReduceAxis::registerTrans(); -bool CAxisAlgorithmReduceAxis::registerTrans() -TRY -{ - return CGridTransformationFactory::registerTransformation(TRANS_REDUCE_AXIS_TO_AXIS, create); -} -CATCH - - -CAxisAlgorithmReduceAxis::CAxisAlgorithmReduceAxis(bool isSource, CAxis* axisDestination, CAxis* axisSource, CReduceAxisToAxis* algo) - : CAlgorithmTransformationReduce(isSource) -TRY -{ - if (!axisDestination->checkGeometricAttributes(false)) - { - axisDestination->resetGeometricAttributes(); - axisDestination->setGeometricAttributes(*axisSource) ; - } - axisDestination->checkAttributes() ; - algo->checkValid(axisDestination, axisSource); - - - switch (algo->operation) - { - case CReduceAxisToAxis::operation_attr::sum: - operator_ = EReduction::sum; - break; - case CReduceAxisToAxis::operation_attr::min: - operator_ = EReduction::min; - break; - case CReduceAxisToAxis::operation_attr::max: - operator_ = EReduction::max; - break; - case CReduceAxisToAxis::operation_attr::average: - operator_ = EReduction::average; - break; - default: - ERROR("CAxisAlgorithmReduceAxis::CAxisAlgorithmReduceAxis(CAxis* axisDestination, CAxis* axisSource, CReduceAxisToAxis* algo)", - << "Operation is wrongly defined. Supported operations: sum, min, max, average." << std::endl - << "Axis source " <getId() << std::endl - << "Axis destination " << axisDestination->getId()); - } - - //TransformationIndexMap& transMap = this->transformationMapping_; - //CArray& axisDstIndex = axisDestination->index; - //int nbAxisIdx = axisDstIndex.numElements(); - - - - auto& transMap = this->transformationMapping_; - - CArray dstGlobalIndex ; - axisDestination->getLocalView(CElementView::WORKFLOW)->getGlobalIndexView(dstGlobalIndex) ; - size_t nbIdx = dstGlobalIndex.numElements(); - - for (size_t idx = 0; idx < nbIdx; ++idx) - { - size_t globalIdx = dstGlobalIndex(idx); - transMap[globalIdx].resize(1); - transMap[globalIdx][0]=globalIdx ; - } - - this->computeAlgorithm(axisSource->getLocalView(CElementView::WORKFLOW), axisDestination->getLocalView(CElementView::WORKFLOW)) ; -} -CATCH - -shared_ptr CAxisAlgorithmReduceAxis::createGridAlgorithm(CGrid* gridSrc, CGrid* gridDst, int pos) -{ - auto algo=make_shared(gridSrc, gridDst, pos, shared_from_this(), operator_) ; - algo->computeAlgorithm(false) ; - return algo ; -} - -CAxisAlgorithmReduceAxis::~CAxisAlgorithmReduceAxis() -TRY -{ - -} -CATCH - - -} diff --git a/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_reduce_axis.hpp b/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_reduce_axis.hpp deleted file mode 100755 index 941a85ce28138f78d1dbfbffcc3d575fdf1c5bf1..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_reduce_axis.hpp +++ /dev/null @@ -1,52 +0,0 @@ -/*! - \file axis_algorithm_reduce_axis.hpp - \author Ha NGUYEN - \since 23 June 2016 - \date 23 June 2016 - - \brief Algorithm for reduce an axis to a axis - */ -#ifndef __XIOS_AXIS_ALGORITHM_REDUCE_AXIS_HPP__ -#define __XIOS_AXIS_ALGORITHM_REDUCE_AXIS_HPP__ - -#include "algorithm_transformation_reduce.hpp" -#include "transformation.hpp" - -namespace xios { - -class CAxis; -class CReduceAxisToAxis; -class CReductionAlgorithm; - -/*! - \class CAxisAlgorithmReduceAxis - Reduce a axis to an axis -*/ -class CAxisAlgorithmReduceAxis : public CAlgorithmTransformationReduce -{ -public: - CAxisAlgorithmReduceAxis(bool isSource, CAxis* axisDestination, CAxis* axisSource, CReduceAxisToAxis* algo); - - - virtual ~CAxisAlgorithmReduceAxis(); - - static bool registerTrans(); - virtual StdString getAlgoName() {return "\\nreduce_axis_to_axis";} - -public: - static shared_ptr create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition); - - virtual shared_ptr createGridAlgorithm(CGrid* gridSrc, CGrid* gridDst, int pos); - static bool dummyRegistered_; -}; - -} -#endif // __XIOS_AXIS_ALGORITHM_REDUCE_AXIS_HPP__ diff --git a/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_reduce_domain.cpp b/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_reduce_domain.cpp deleted file mode 100755 index e7b3f6cc7f447729f2a63265645de3602b45d82e..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_reduce_domain.cpp +++ /dev/null @@ -1,324 +0,0 @@ -/*! - \file axis_algorithm_reduce_domain.cpp - \author Ha NGUYEN - \since 23 June 2016 - \date 23 June 2016 - - \brief Algorithm for reduce a domain to an axis - */ -#include "axis_algorithm_reduce_domain.hpp" -#include "reduce_domain_to_axis.hpp" -#include "axis.hpp" -#include "domain.hpp" -#include "grid.hpp" -#include "grid_transformation_factory_impl.hpp" -#include "reduction.hpp" - -namespace xios { -shared_ptr CAxisAlgorithmReduceDomain::create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) -TRY -{ - std::vector axisListDestP = gridDst->getAxis(); - std::vector domainListSrcP = gridSrc->getDomains(); - - CReduceDomainToAxis* reduceDomain = dynamic_cast (transformation); - int axisDstIndex = elementPositionInGridDst2AxisPosition[elementPositionInGrid]; - int domainSrcIndex = elementPositionInGridSrc2DomainPosition[elementPositionInGrid]; - - return make_shared(isSource, axisListDestP[axisDstIndex], domainListSrcP[domainSrcIndex], reduceDomain); -} -CATCH - -bool CAxisAlgorithmReduceDomain::dummyRegistered_ = CAxisAlgorithmReduceDomain::registerTrans(); -bool CAxisAlgorithmReduceDomain::registerTrans() -TRY -{ - return CGridTransformationFactory::registerTransformation(TRANS_REDUCE_DOMAIN_TO_AXIS, create); -} -CATCH - - -CAxisAlgorithmReduceDomain::CAxisAlgorithmReduceDomain(bool isSource, CAxis* axisDestination, CDomain* domainSource, CReduceDomainToAxis* algo) - : CAlgorithmTransformationReduce(isSource), domainSrc_(domainSource), axisDest_(axisDestination) -TRY -{ - switch (algo->operation) - { - case CReduceDomainToAxis::operation_attr::sum: - operator_ = EReduction::sum; - break; - case CReduceDomainToAxis::operation_attr::min: - operator_ = EReduction::min; - break; - case CReduceDomainToAxis::operation_attr::max: - operator_ = EReduction::max; - break; - case CReduceDomainToAxis::operation_attr::average: - operator_ = EReduction::average; - break; - default: - ERROR("CAxisAlgorithmReduceDomain::CAxisAlgorithmReduceDomain(CAxis* axisDestination, CDomain* domainSource, CReduceDomainToAxis* algo)", - << "Operation is wrongly defined. Supported operations: sum, min, max, average." << std::endl - << "Domain source " <getId() << std::endl - << "Axis destination " << axisDestination->getId()); - - } - - algo->checkValid(axisDestination, domainSource); - dir_ = (CReduceDomainToAxis::direction_attr::iDir == algo->direction) ? iDir : jDir; - - bool local = false; - if (!algo->local.isEmpty()) local=algo->local ; - - size_t nj_glo = domainSource->nj_glo ; - size_t ni_glo = domainSource->ni_glo ; - - bool validAxis = axisDestination->checkGeometricAttributes(false) ; - if (validAxis && !local) - { - - axisDestination->checkAttributes() ; - if (dir_==jDir) - { - if (axisDestination->n_glo != domainSource->nj_glo) - ERROR("CAxisAlgorithmReduceDomain::CAxisAlgorithmReduceDomain(bool isSource, CAxis* axisDestination, CDomain* domainSource, CReduceDomainToAxis* algo)", - << "Extract domain along j, axis destination should have n_glo equal to nj_glo of domain source" - << "Domain source " <getId() << " has nj_glo " << domainSource->nj_glo << std::endl - << "Axis destination " << axisDestination->getId() << " has n_glo " << axisDestination->n_glo) - } - else - { - if (axisDestination->n_glo != domainSource->ni_glo) - ERROR("CAxisAlgorithmReduceDomain::CAxisAlgorithmReduceDomain(bool isSource, CAxis* axisDestination, CDomain* domainSource, CReduceDomainToAxis* algo)", - << "Extract domain along j, axis destination should have n_glo equal to ni_glo of domain source" - << "Domain source " <getId() << " has ni_glo " << domainSource->ni_glo << std::endl - << "Axis destination " << axisDestination->getId() << " has n_glo " << axisDestination->n_glo); - } - } - else - { - // create axis destination from source domain - - axisDestination->resetGeometricAttributes(); - if (dir_== jDir) - { - axisDestination->n_glo = domainSource->nj_glo ; - - CArray srcGlobalIndex ; - set indexFullView; - set indexWorkflowView; - domainSource->getLocalView(CElementView::FULL)->getGlobalIndexView(srcGlobalIndex) ; - for(int i=0; igetLocalView(CElementView::WORKFLOW)->getGlobalIndexView(srcGlobalIndex) ; - for(int i=0; i n = indexFullView.size() ; - axisDestination-> index.resize(axisDestination-> n) ; - axisDestination-> mask.resize(axisDestination-> n) ; - - map globalToLocalIndex ; - auto it=indexFullView.begin(); - for(int i=0; it!=indexFullView.end(); ++i,++it) - { - axisDestination->index(i) = *it ; - if (indexWorkflowView.count(*it)==0) axisDestination->mask(i) = false ; - else axisDestination->mask(i) = true ; - globalToLocalIndex[*it] = i ; - } - if (domainSource->hasLonLat && domainSource->type == CDomain::type_attr::rectilinear) - { - axisDestination->value.resize(axisDestination-> n) ; - axisDestination->axis_type.setValue(CAxis::axis_type_attr::Y) ; - if (domainSource->hasBounds) axisDestination-> bounds.resize(axisDestination-> n, 2) ; - - domainSource->getLocalView(CElementView::FULL)->getGlobalIndexView(srcGlobalIndex) ; - for(int i=0; ivalue(globalToLocalIndex[srcGlobalIndex(i)/ni_glo]) = domainSource->latvalue(i) ; - if (domainSource->hasBounds) - { - axisDestination->bounds(globalToLocalIndex[srcGlobalIndex(i)/ni_glo,0]) = domainSource->bounds_latvalue(i,0) ; - axisDestination->bounds(globalToLocalIndex[srcGlobalIndex(i)/ni_glo,1]) = domainSource->bounds_latvalue(i,1) ; - } - } - } - - } - else // dir_== iDir - { - axisDestination->n_glo = domainSource->ni_glo ; - - CArray srcGlobalIndex ; - set indexFullView; - set indexWorkflowView; - domainSource->getLocalView(CElementView::FULL)->getGlobalIndexView(srcGlobalIndex) ; - for(int i=0; igetLocalView(CElementView::WORKFLOW)->getGlobalIndexView(srcGlobalIndex) ; - for(int i=0; i n = indexFullView.size() ; - axisDestination-> index.resize(axisDestination-> n) ; - axisDestination-> mask.resize(axisDestination-> n) ; - map globalToLocalIndex ; - auto it=indexFullView.begin(); - for(int i=0; it!=indexFullView.end(); ++i,++it) - { - axisDestination->index(i) = *it ; - if (indexWorkflowView.count(*it)==0) axisDestination->mask(i) = false ; - else axisDestination->mask(i) = true ; - globalToLocalIndex[*it] = i ; - } - - if (domainSource->hasLonLat && domainSource->type == CDomain::type_attr::rectilinear) - { - axisDestination-> value.resize(axisDestination-> n) ; - axisDestination-> axis_type.setValue(CAxis::axis_type_attr::X) ; - if (domainSource->hasBounds) axisDestination->bounds.resize(axisDestination-> n, 2) ; - - domainSource->getLocalView(CElementView::FULL)->getGlobalIndexView(srcGlobalIndex) ; - for(int i=0; ivalue(globalToLocalIndex[srcGlobalIndex(i)%ni_glo]) = domainSource->lonvalue(i) ; - if (domainSource->hasBounds) - { - axisDestination->bounds(globalToLocalIndex[srcGlobalIndex(i)%ni_glo,0]) = domainSource->bounds_lonvalue(i,0) ; - axisDestination->bounds(globalToLocalIndex[srcGlobalIndex(i)%ni_glo,1]) = domainSource->bounds_lonvalue(i,1) ; - } - } - } - - } - - axisDestination->checkAttributes() ; - } - - // compute needed index for tranformation - - TransformationIndexMap& transMap = transformationMapping_; - - CArray srcGlobalIndex ; - domainSource->getLocalView(CElementView::WORKFLOW)->getGlobalIndexView(srcGlobalIndex) ; - CArray dstGlobalIndex ; - axisDestination->getLocalView(CElementView::WORKFLOW)->getGlobalIndexView(dstGlobalIndex) ; - - if (local) - { - - set dstGlobalIndexSet ; - for(int i=0; i& axisDstIndex = axisDest_->index; - int ni_glo = domainSrc_->ni_glo, nj_glo = domainSrc_->nj_glo; - if (iDir == dir_) - { - if (local) - { - const CArray& i_index = domainSrc_-> i_index.getValue() ; - const CArray& j_index = domainSrc_-> j_index.getValue() ; - const CArray& localMask = domainSrc_-> localMask ; - int nbDomainIdx = i_index.numElements(); - - for (int idxDomain = 0; idxDomain < nbDomainIdx; ++idxDomain) - { - if (localMask(idxDomain)) - { - transMap[j_index(idxDomain)].push_back(j_index(idxDomain)* ni_glo + i_index(idxDomain)); - } - } - } - else - { - int nbAxisIdx = axisDstIndex.numElements(); - for (int idxAxis = 0; idxAxis < nbAxisIdx; ++idxAxis) - { - int globalAxisIdx = axisDstIndex(idxAxis); - transMap[globalAxisIdx].resize(ni_glo); - for (int idx = 0; idx < ni_glo; ++idx) - { - transMap[globalAxisIdx][idx] = globalAxisIdx * ni_glo + idx; - } - } - } - } - else if (jDir == dir_) - { - int nbAxisIdx = axisDstIndex.numElements(); - if (local) - { - const CArray& i_index = domainSrc_-> i_index.getValue() ; - const CArray& j_index = domainSrc_-> j_index.getValue() ; - const CArray& localMask = domainSrc_-> localMask ; - int nbDomainIdx = i_index.numElements(); - - for (int idxDomain = 0; idxDomain < nbDomainIdx; ++idxDomain) - { - if (localMask(idxDomain)) - { - transMap[i_index(idxDomain)].push_back(j_index(idxDomain)* ni_glo + i_index(idxDomain)); - } - } - } - else - { - for (int idxAxis = 0; idxAxis < nbAxisIdx; ++idxAxis) - { - int globalAxisIdx = axisDstIndex(idxAxis); - transMap[globalAxisIdx].resize(nj_glo); - for (int idx = 0; idx < nj_glo; ++idx) - { - transMap[globalAxisIdx][idx] = globalAxisIdx + ni_glo*idx; - } - } - } - } - else - {} - - axisDestination->checkAttributes() ; -*/ - this->computeAlgorithm(domainSource->getLocalView(CElementView::WORKFLOW), axisDestination->getLocalView(CElementView::WORKFLOW)) ; - -} -CATCH - - -CAxisAlgorithmReduceDomain::~CAxisAlgorithmReduceDomain() -TRY -{ -} -CATCH - - -} diff --git a/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_reduce_domain.hpp b/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_reduce_domain.hpp deleted file mode 100755 index 491f72d6c9fb60395e3da9228d1e77188d07e042..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_reduce_domain.hpp +++ /dev/null @@ -1,63 +0,0 @@ -/*! - \file axis_algorithm_reduce_domain.hpp - \author Ha NGUYEN - \since 23 June 2016 - \date 23 June 2016 - - \brief Algorithm for reduce an axis to a axis - */ -#ifndef __XIOS_AXIS_ALGORITHM_REDUCE_DOMAIN_HPP__ -#define __XIOS_AXIS_ALGORITHM_REDUCE_DOMAIN_HPP__ - -#include "algorithm_transformation_reduce.hpp" -#include "transformation.hpp" - -namespace xios { - -class CAxis; -class CDomain; -class CReduceDomainToAxis; -class CReductionAlgorithm; - -/*! - \class CAxisAlgorithmReduceDomain - Reduce a domain to an axis -*/ -class CAxisAlgorithmReduceDomain : public CAlgorithmTransformationReduce -{ -public: - CAxisAlgorithmReduceDomain(bool isSource, CAxis* axisDestination, CDomain* domainSource, CReduceDomainToAxis* algo); - - virtual ~CAxisAlgorithmReduceDomain(); - - static bool registerTrans(); - virtual StdString getAlgoName() {return "\\nreduce_domain";} - -protected: - enum ReduceDirection { - undefined = 0, - iDir = 1, - jDir = 2 - }; - - ReduceDirection dir_; - bool local ; - - CDomain* domainSrc_ ; - CAxis* axisDest_ ; - -public: - static shared_ptr create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition); - static bool dummyRegistered_; -}; - -} -#endif // __XIOS_AXIS_ALGORITHM_REDUCE_DOMAIN_HPP__ diff --git a/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_temporal_splitting.cpp b/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_temporal_splitting.cpp deleted file mode 100755 index e5d87744ab6174b5c307ac3649193191beb19d67..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_temporal_splitting.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/*! - \file axis_algorithm_temporal_splitting.cpp - - \brief Algorithm to split scalar into axis by temporal accumulation - */ -#include "axis_algorithm_temporal_splitting.hpp" -#include "temporal_splitting.hpp" -#include "axis.hpp" -#include "scalar.hpp" -#include "grid.hpp" -#include "grid_transformation_factory_impl.hpp" -#include "temporal_transform_filter.hpp" - -namespace xios { -shared_ptr CAxisAlgorithmTemporalSplitting::create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) -TRY -{ - std::vector axisListDestP = gridDst->getAxis(); - std::vector scalarListSrcP = gridSrc->getScalars(); - - CTemporalSplitting* temporalSplitting = dynamic_cast (transformation); - int axisDstIndex = elementPositionInGridDst2AxisPosition[elementPositionInGrid]; - int scalarSrcIndex = elementPositionInGridSrc2ScalarPosition[elementPositionInGrid]; - - return make_shared(isSource, axisListDestP[axisDstIndex], scalarListSrcP[scalarSrcIndex], temporalSplitting); -} -CATCH - -bool CAxisAlgorithmTemporalSplitting::dummyRegistered_ = CAxisAlgorithmTemporalSplitting::registerTrans(); -bool CAxisAlgorithmTemporalSplitting::registerTrans() -TRY -{ - return CGridTransformationFactory::registerTransformation(TRANS_TEMPORAL_SPLITTING, create); -} -CATCH - -CAxisAlgorithmTemporalSplitting::CAxisAlgorithmTemporalSplitting(bool isSource, CAxis* axisDestination, CScalar* scalarSource, CTemporalSplitting* algo) - : CAlgorithmTransformationNoDataModification(isSource) -{ - nrecords_ = axisDestination->n_glo ; // also axis must not be distributed, make more test later -} - -CTransformFilter* CAxisAlgorithmTemporalSplitting::createTransformFilter(CGarbageCollector& gc, shared_ptr algo, bool detectMissingValues, double defaultValue) -{ - return new CTemporalTransformFilter(gc, 1, algo, nrecords_, detectMissingValues, defaultValue) ; -} - -CAxisAlgorithmTemporalSplitting::~CAxisAlgorithmTemporalSplitting() -{ -} - - -} diff --git a/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_temporal_splitting.hpp b/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_temporal_splitting.hpp deleted file mode 100755 index d3fa93eac19f946bdde2c8b27d54460a63deb7a5..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_temporal_splitting.hpp +++ /dev/null @@ -1,50 +0,0 @@ -/*! - \file axis_algorithm_reduce_domain.hpp - \author Ha NGUYEN - \since 23 June 2016 - \date 23 June 2016 - - \brief Algorithm for reduce an axis to a axis - */ -#ifndef __XIOS_AXIS_ALGORITHM_TEMPORAL_SPLITTING_HPP__ -#define __XIOS_AXIS_ALGORITHM_TEMPORAL_SPLITTING_HPP__ - -#include "transformation.hpp" -#include "algorithm_transformation_no_data_modification.hpp" -namespace xios -{ - - class CAxis; - class CScalar; - class CTemporalSplitting; - - /*! - \class CAxisAlgorithmExtractDomain - Extract a domain to an axis - */ - class CAxisAlgorithmTemporalSplitting : public CAlgorithmTransformationNoDataModification - { - public: - CAxisAlgorithmTemporalSplitting(bool isSource, CAxis* axisDestination, CScalar* scalarSource, CTemporalSplitting* algo); - virtual ~CAxisAlgorithmTemporalSplitting(); - static bool registerTrans(); - virtual StdString getAlgoName() {return "\\ntemporal_splitting";} - - virtual CTransformFilter* createTransformFilter(CGarbageCollector& gc, shared_ptr algo, bool detectMissingValues, double defaultValue) ; - - static shared_ptr create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition); - private: - int nrecords_; - static bool dummyRegistered_; - }; - -} -#endif // __XIOS_AXIS_ALGORITHM_TEMPORAL_SPLITTING_HPP__ diff --git a/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_zoom.cpp b/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_zoom.cpp deleted file mode 100755 index bee3e020645ac148c7c98316446d3bcb85c0acd8..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_zoom.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/*! - \file axis_algorithm_zoom.cpp - \brief Algorithm for zooming an axis. - */ -#include "axis_algorithm_zoom.hpp" -#include "axis.hpp" -#include "grid.hpp" -#include "grid_transformation_factory_impl.hpp" -#include "zoom_axis.hpp" - -namespace xios { -shared_ptr CAxisAlgorithmZoom::create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) -TRY -{ - std::vector axisListDestP = gridDst->getAxis(); - std::vector axisListSrcP = gridSrc->getAxis(); - - CZoomAxis* zoomAxis = dynamic_cast (transformation); - int axisDstIndex = elementPositionInGridDst2AxisPosition[elementPositionInGrid]; - int axisSrcIndex = elementPositionInGridSrc2AxisPosition[elementPositionInGrid]; - - return make_shared(isSource, axisListDestP[axisDstIndex], axisListSrcP[axisSrcIndex], zoomAxis); -} -CATCH - -bool CAxisAlgorithmZoom::dummyRegistered_ = CAxisAlgorithmZoom::registerTrans(); -bool CAxisAlgorithmZoom::registerTrans() -TRY -{ - return CGridTransformationFactory::registerTransformation(TRANS_ZOOM_AXIS, create); -} -CATCH - -CAxisAlgorithmZoom::CAxisAlgorithmZoom(bool isSource, CAxis* axisDestination, CAxis* axisSource, CZoomAxis* zoomAxis) -: CAlgorithmTransformationTransfer(isSource), axisDest_(axisDestination), axisSrc_(axisSource) -TRY -{ - zoomAxis->checkValid(axisSource); - zoomBegin_ = zoomAxis->begin.getValue(); - zoomN_ = zoomAxis->n.getValue(); - zoomEnd_ = zoomBegin_ + zoomN_ - 1; - - if (zoomN_ > axisSource->n_glo.getValue()) - { - ERROR("CAxisAlgorithmZoom::CAxisAlgorithmZoom(CAxis* axisDestination, CAxis* axisSource, CZoomAxis* zoomAxis)", - << "Zoom size is greater than global size of source axis" - << "Global size of source axis " <getId() << " is " << axisSource->n_glo.getValue() << std::endl - << "Zoom size is " << zoomN_ ); - } - - int idxSrc, nDest = 0, beginDestLoc, beginDestGlo = 0 ; - int indGloDest, indGloSrc, iSrc; - for (int i = 0; i < axisSrc_->n.getValue(); i++) - { - idxSrc = axisSrc_->index(i); - if ((idxSrc >= zoomBegin_) && (idxSrc <= zoomEnd_)) - { - if (nDest == 0) beginDestLoc = i; - ++nDest; - } - } - beginDestGlo = beginDestLoc + axisSrc_->begin - zoomBegin_; - axisDest_->n_glo.setValue(zoomN_); - axisDest_->n.setValue(nDest); - axisDest_->begin.setValue(beginDestGlo); - axisDest_->index.resize(nDest); - - axisDest_->data_n.setValue(nDest); - axisDest_->data_begin.setValue(0); - axisDest_->data_index.resize(nDest); - - axisDest_->mask.resize(nDest); - if (axisSrc_->hasValue) axisDest_->value.resize(nDest); - if (axisSrc_->hasLabel) axisDest_->label.resize(nDest); - if (axisSrc_->hasBounds) axisDest_->bounds.resize(2,nDest); - - auto& transMap = this->transformationMapping_; - - for (int iDest = 0; iDest < nDest; iDest++) - { - iSrc = iDest + beginDestLoc; - axisDest_->index(iDest) = iDest + beginDestGlo; - axisDest_->data_index(iDest) = axisSrc_->data_index(iSrc) - beginDestLoc; - axisDest_->mask(iDest) = axisSrc_->mask(iSrc); - - if (axisSrc_->hasValue) - axisDest_->value(iDest) = axisSrc_->value(iSrc); - if (axisSrc_->hasLabel) - axisDest_->label(iDest) = axisSrc_->label(iSrc); - if (axisSrc_->hasBounds) - { - axisDest_->bounds(0,iDest) = axisSrc_->bounds(0,iSrc); - axisDest_->bounds(1,iDest) = axisSrc_->bounds(1,iSrc); - } - indGloDest = axisDest_->index(iDest); - indGloSrc = axisSrc_->index(iSrc); - transMap[indGloDest]=indGloSrc; - - } - - axisDestination->checkAttributes() ; - - this->computeAlgorithm(axisSource->getLocalView(CElementView::WORKFLOW), axisDestination->getLocalView(CElementView::WORKFLOW)) ; -} -CATCH - - -} diff --git a/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_zoom.hpp b/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_zoom.hpp deleted file mode 100755 index 74f3790699071d049ef2a13c9d7594973ce4170b..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/axis_algorithm/axis_algorithm_zoom.hpp +++ /dev/null @@ -1,63 +0,0 @@ -/*! - \file axis_algorithm_zoom.hpp - \brief Algorithm for zooming an axis. - */ -#ifndef __XIOS_AXIS_ALGORITHM_ZOOM_HPP__ -#define __XIOS_AXIS_ALGORITHM_ZOOM_HPP__ - -#include "algorithm_transformation_transfer.hpp" -#include "transformation.hpp" - -namespace xios { -class CAxis; -class CZoomAxis; - -/*! - \class CAxisAlgorithmZoom - Implementing zoom on axis - A zoomed region can be considered as region that isn't masked. - Only this zoomed region is zoomed to write on Netcdf. -*/ -class CAxisAlgorithmZoom : public CAlgorithmTransformationTransfer -{ -public: - CAxisAlgorithmZoom(bool isSource, CAxis* axisDestination, CAxis* axisSource, CZoomAxis* zoomAxis); - - virtual ~CAxisAlgorithmZoom() {} - - static bool registerTrans(); - -private: - -private: - //! Global zoom begin on axis - StdSize zoomBegin_; - - //! Global zoom end on axis - StdSize zoomEnd_; - - //! Global zoom size on axis - StdSize zoomN_; - - std::vector zoomIndex_; - -private: - - CAxis* axisSrc_; - CAxis* axisDest_; - -public: - static shared_ptr create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition); - static bool dummyRegistered_; -}; - -} -#endif // __XIOS_AXIS_ALGORITHM_ZOOM_HPP__ diff --git a/xios_2311_src/src/transformation/domain_algorithm/domain_algorithm_compute_connectivity.cpp b/xios_2311_src/src/transformation/domain_algorithm/domain_algorithm_compute_connectivity.cpp deleted file mode 100755 index 9dd1295786995831021dae0fbd3a6ed789a905e9..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/domain_algorithm/domain_algorithm_compute_connectivity.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/*! - \file domain_algorithm_compute_connectivity.cpp - \author Ha NGUYEN - \since 15 Jul 2016 - \date 15 Jul 2016 - - \brief Algorithm for compute_connectivity on an domain. - */ -#include "domain_algorithm_compute_connectivity.hpp" -#include "compute_connectivity_domain.hpp" -#include "mesh.hpp" -#include "domain.hpp" -#include "grid.hpp" -#include "grid_transformation_factory_impl.hpp" - -namespace xios { -shared_ptr CDomainAlgorithmComputeConnectivity::create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) -TRY -{ - std::vector domainListDestP = gridDst->getDomains(); - std::vector domainListSrcP = gridSrc->getDomains(); - - CComputeConnectivityDomain* compute_connectivityDomain = dynamic_cast (transformation); - int domainDstIndex = elementPositionInGridDst2DomainPosition[elementPositionInGrid]; - int domainSrcIndex = elementPositionInGridSrc2DomainPosition[elementPositionInGrid]; - - return make_shared(isSource, domainListDestP[domainDstIndex], domainListSrcP[domainSrcIndex], compute_connectivityDomain); -} -CATCH - -bool CDomainAlgorithmComputeConnectivity::dummyRegistered_ = CDomainAlgorithmComputeConnectivity::registerTrans(); - -bool CDomainAlgorithmComputeConnectivity::registerTrans() -TRY -{ - return CGridTransformationFactory::registerTransformation(TRANS_COMPUTE_CONNECTIVITY_DOMAIN, create); -} -CATCH - -CDomainAlgorithmComputeConnectivity::CDomainAlgorithmComputeConnectivity(bool isSource, CDomain* domainDestination, CDomain* domainSource, - CComputeConnectivityDomain* compute_connectivityDomain) -: CAlgorithmTransformationNoDataModification(isSource) -TRY -{ - compute_connectivityDomain->checkValid(domainDestination); - int& nbNeighborMax = compute_connectivityDomain->n_neighbor_max; - CArray& nbNeighbor = compute_connectivityDomain->n_neighbor; - CArray& localNeighbors = compute_connectivityDomain->local_neighbor; - int type = 1; // Edge type - switch (compute_connectivityDomain->type) - { - case CComputeConnectivityDomain::type_attr::node : - type = 0; - break; - case CComputeConnectivityDomain::type_attr::edge : - type = 1; - break; - default: - break; - } - - computeLocalConnectivity(type, domainDestination, nbNeighborMax, nbNeighbor, localNeighbors); -} -CATCH - -/*! - * Compute local connectivity of a domain - * \param[in] type type of connectivity (node or edge) - * \param[in] domain domain on which we calculate local connectivity - * \param[in/out] nbConnectivityMax maximum number of neighbor a cell of domain has - * \param[in/out] nbConnectivity number of neighbor a cell has - * \param[in/out] localConnectivity localConnectivity local index of neighbor of a cell - */ -void CDomainAlgorithmComputeConnectivity::computeLocalConnectivity(int type, - CDomain* domain, - int& nbConnectivityMax, - CArray& nbConnectivity, - CArray& localConnectivity) -TRY -{ - - CMesh mesh; - - CArray& bounds_lon = domain->bounds_lon_1d; - CArray& bounds_lat = domain->bounds_lat_1d; - int ncell = bounds_lon.shape()[1]; - CArray localIndex(ncell); - for (int idx = 0; idx & nbConnectivity, - CArray& localConnectivity); - -public: - static shared_ptr create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition); - static bool dummyRegistered_; -}; - -} - -#endif // __XIOS_DOMAIN_ALGORITHM_COMPUTE_CONNECTIVITY_HPP__ \ No newline at end of file diff --git a/xios_2311_src/src/transformation/domain_algorithm/domain_algorithm_expand.cpp b/xios_2311_src/src/transformation/domain_algorithm/domain_algorithm_expand.cpp deleted file mode 100755 index 3cfcae9205a93f4ea930e29ccec97072e4a41bb9..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/domain_algorithm/domain_algorithm_expand.cpp +++ /dev/null @@ -1,694 +0,0 @@ -/*! - \file domain_algorithm_expand.cpp - \author Ha NGUYEN - \since 08 Aug 2016 - \date 19 Sep 2016 - - \brief Algorithm for expanding an domain. - */ -#include "domain_algorithm_expand.hpp" -#include "expand_domain.hpp" -#include "mesh.hpp" -#include "domain.hpp" -#include "grid.hpp" -#include "grid_transformation_factory_impl.hpp" -#include "context.hpp" -#include "context_client.hpp" - -namespace xios { -shared_ptr CDomainAlgorithmExpand::create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) -TRY -{ - std::vector domainListDestP = gridDst->getDomains(); - std::vector domainListSrcP = gridSrc->getDomains(); - - CExpandDomain* expandDomain = dynamic_cast (transformation); - int domainDstIndex = elementPositionInGridDst2DomainPosition[elementPositionInGrid]; - int domainSrcIndex = elementPositionInGridSrc2DomainPosition[elementPositionInGrid]; - - return make_shared(isSource, domainListDestP[domainDstIndex], domainListSrcP[domainSrcIndex], expandDomain); -} -CATCH - -bool CDomainAlgorithmExpand::dummyRegistered_ = CDomainAlgorithmExpand::registerTrans(); -bool CDomainAlgorithmExpand::registerTrans() -TRY -{ - return CGridTransformationFactory::registerTransformation(TRANS_EXPAND_DOMAIN, create); -} -CATCH - -CDomainAlgorithmExpand::CDomainAlgorithmExpand(bool isSource, CDomain* domainDestination, - CDomain* domainSource, - CExpandDomain* expandDomain) -: CAlgorithmTransformationTransfer(isSource), isXPeriodic_(false), isYPeriodic_(false) -TRY -{ - if (domainDestination == domainSource) - { - ERROR("CDomainAlgorithmExpand::CDomainAlgorithmExpand(CDomain* domainDestination,CDomain* domainSource, CExpandDomain* expandDomain)", - << "Domain source and domain destination are the same. Please make sure domain destination refers to domain source" << std::endl - << "Domain source " <getId() << std::endl - << "Domain destination " <getId() << std::endl); - } - // Make sure domain source have all valid attributes - // domainSource->checkAllAttributes(); - expandDomain->checkValid(domainDestination); - if (!expandDomain->i_periodic.isEmpty()) isXPeriodic_ = expandDomain->i_periodic; - if (!expandDomain->j_periodic.isEmpty()) isYPeriodic_ = expandDomain->j_periodic; - - switch (expandDomain->type) - { - case CExpandDomain::type_attr::node : - expandDomainNodeConnectivity(domainDestination, - domainSource); - break; - case CExpandDomain::type_attr::edge : - expandDomainEdgeConnectivity(domainDestination, - domainSource); - break; - default: - break; - } - - domainDestination->checkAttributes() ; - this->computeAlgorithm(domainSource->getLocalView(CElementView::WORKFLOW), domainDestination->getLocalView(CElementView::WORKFLOW)) ; -} -CATCH - -/*! - * Expand domain with edge-type neighbor - * \param[in/out] domainDestination domain destination and will be modified - * \param[in] domainSource domain source - */ -void CDomainAlgorithmExpand::expandDomainEdgeConnectivity(CDomain* domainDestination, - CDomain* domainSource) -TRY -{ - CContext* context = CContext::getCurrent(); - - int type = 1; // For edge - CMesh mesh; - CArray& bounds_lon_src = domainSource->bounds_lon_1d; - CArray& bounds_lat_src = domainSource->bounds_lat_1d; - CArray neighborsSrc; - switch (domainSource->type) { - case CDomain::type_attr::unstructured: - mesh.getGlobalNghbFaces(type, context->intraComm_, domainSource->i_index, bounds_lon_src, bounds_lat_src, neighborsSrc); - updateUnstructuredDomainAttributes(domainDestination, domainSource, neighborsSrc); - break; - default: - updateRectilinearDomainAttributes(domainDestination, domainSource, neighborsSrc); - break; - } -} -CATCH - -/*! - * Expand domain with node-type neighbor - * \param[in/out] domainDestination domain destination and will be modified - * \param[in] domainSource domain source - */ -void CDomainAlgorithmExpand::expandDomainNodeConnectivity(CDomain* domainDestination, - CDomain* domainSource) -TRY -{ - CContext* context = CContext::getCurrent(); - - int type = 1; // For edge - CMesh mesh; - CArray& bounds_lon_src = domainSource->bounds_lon_1d; - CArray& bounds_lat_src = domainSource->bounds_lat_1d; - CArray neighborsSrc; - switch (domainSource->type) { - case CDomain::type_attr::unstructured: - mesh.getGlobalNghbFaces(type, context->intraComm_, domainSource->i_index, bounds_lon_src, bounds_lat_src, neighborsSrc); - updateUnstructuredDomainAttributes(domainDestination, domainSource, neighborsSrc); - break; - default: - updateRectilinearDomainAttributes(domainDestination, domainSource, neighborsSrc); - break; - } -} -CATCH - -/*! - * Extend rectilinear or curvilinear domain destination and update its attributes - * Suppose that domain destination and domain source have the same values for all attributes (by inheritance) - * \param [in/out] domainDestination domain destination - * \param [in] domainSource domain source - * \param [in] neighborsDomainSrc neighbor of domain source. For now, we don't need it for rectilinear - */ -void CDomainAlgorithmExpand::updateRectilinearDomainAttributes(CDomain* domainDestination, - CDomain* domainSource, - CArray& neighborsDomainSrc) -TRY -{ - int index, globalIndex, idx; - int iindexDst, jindexDst, globIndexDst; - int iindexSrc, jindexSrc, globIndexSrc; - CContext* context = CContext::getCurrent(); - - // First of all, "copy" all attributes of domain source to domain destination - StdString domainDstRef = (!domainDestination->domain_ref.isEmpty()) ? domainDestination->domain_ref.getValue() - : ""; - if (domainDstRef != domainSource->getId()) - { - domainDestination->domain_ref.setValue(domainSource->getId()); - domainDestination->solveRefInheritance(true); - } - - if (domainDstRef.empty()) domainDestination->domain_ref.reset(); - else domainDestination->domain_ref.setValue(domainDstRef); - - - // Here are attributes of source need tranfering - int niGloSrc = domainSource->ni_glo; - int njGloSrc = domainSource->nj_glo; - int niSrc = domainSource->ni, ibegin = domainSource->ibegin; - int njSrc = domainSource->nj, jbegin = domainSource->jbegin; - int dataDimSrc = domainSource->data_dim; - CArray& mask_1d_src = domainSource->domainMask; - CArray& i_index_src = domainSource->i_index; - CArray& j_index_src = domainSource->j_index; - CArray& data_i_index_src = domainSource->data_i_index; - CArray& data_j_index_src = domainSource->data_j_index; - int data_i_begin_src = domainSource->data_ibegin; - int data_j_begin_src = domainSource->data_jbegin; - CArray& lon_src = domainSource->lonvalue; - CArray& lat_src = domainSource->latvalue; - - // We need to generate boundary for longitude and latitude - if (domainSource->bounds_lon_1d.isEmpty() || domainSource->bounds_lat_1d.isEmpty()) - { - CArray lon = lon_src(Range(0,niSrc-1)); - CArray lat = lat_src(Range(0,lat_src.numElements()-niSrc,niSrc)); - CArray& bounds_lon_src = domainSource->bounds_lon_1d; - CArray& bounds_lat_src = domainSource->bounds_lat_1d; - domainSource->fillInRectilinearBoundLonLat(lon_src, lat_src, bounds_lon_src, bounds_lat_src); - } - - - CArray& bounds_lon_src = domainSource->bounds_lon_1d; - CArray& bounds_lat_src = domainSource->bounds_lat_1d; - - int nVertex = bounds_lon_src.shape()[0]; - int oldNbLocal = i_index_src.numElements(); - // Calculate ni, nj by using i_index and j_index - int niSrcByIndex = max(i_index_src) - min(i_index_src) + 1; - int njSrcByIndex = max(j_index_src) - min(j_index_src) + 1; - int dataIindexBoundSrc = (1 == dataDimSrc) ? (niSrcByIndex * njSrcByIndex) : niSrcByIndex; - int dataJindexBoundSrc = (1 == dataDimSrc) ? (niSrcByIndex * njSrcByIndex) : njSrcByIndex; - - // Uncompress data_i_index, data_j_index - CArray data_i_index_src_full(oldNbLocal); - CArray data_j_index_src_full(oldNbLocal); - int nbUnMaskedPointOnLocalDomain = 0; - data_i_index_src_full = -1; // Suppose all values are masked - data_j_index_src_full = -1; // Suppose all values are masked - for (idx = 0; idx < data_i_index_src.numElements(); ++idx) - { - int dataIidx = data_i_index_src(idx) + data_i_begin_src; - int dataJidx = data_j_index_src(idx) + data_j_begin_src; - if ((0 <= dataIidx) && (dataIidx < dataIindexBoundSrc) && - (0 <= dataJidx) && (dataJidx < dataJindexBoundSrc)) - { - data_i_index_src_full(nbUnMaskedPointOnLocalDomain) = dataIidx; - data_j_index_src_full(nbUnMaskedPointOnLocalDomain) = dataJidx; - ++nbUnMaskedPointOnLocalDomain; - } - } - - // Expand domain destination, not only local but also global - int niGloDst = niGloSrc + 2; - int njGloDst = njGloSrc + 2; - int niDst = niSrc + 2; - int njDst = njSrc + 2; - domainDestination->ni_glo.setValue(niGloDst); - domainDestination->nj_glo.setValue(njGloDst); - domainDestination->ni.setValue(niDst); - domainDestination->nj.setValue(njDst); - - CArray& mask_1d_dst = domainDestination->domainMask; - CArray& i_index_dst = domainDestination->i_index; - CArray& j_index_dst = domainDestination->j_index; - CArray& data_i_index_dst = domainDestination->data_i_index; - CArray& data_j_index_dst = domainDestination->data_j_index; - - // Make sure that we use only lonvalue_client, latvalue_client - if (!domainDestination->lonvalue_1d.isEmpty()) domainDestination->lonvalue_1d.reset(); - if (!domainDestination->latvalue_1d.isEmpty()) domainDestination->latvalue_1d.reset(); - if (!domainDestination->lonvalue_2d.isEmpty()) domainDestination->lonvalue_2d.reset(); - if (!domainDestination->latvalue_2d.isEmpty()) domainDestination->latvalue_2d.reset(); - - // Recalculate i_index, j_index of extended domain - // Should be enough for common case, but if we have arbitrary distribution? - int newNbLocalDst = niDst * njDst; - - mask_1d_dst.resize(newNbLocalDst); - i_index_dst.resize(newNbLocalDst); - j_index_dst.resize(newNbLocalDst); - CArray data_i_index_dst_full(newNbLocalDst); - CArray data_j_index_dst_full(newNbLocalDst); - - if (newNbLocalDst==0) - { - domainDestination->lonvalue.resize(newNbLocalDst); - domainDestination->latvalue.resize(newNbLocalDst); - domainDestination->bounds_lon_1d.resize(nVertex, newNbLocalDst); - domainDestination->bounds_lat_1d.resize(nVertex, newNbLocalDst); - } - else - { - domainDestination->lonvalue.resizeAndPreserve(newNbLocalDst); - domainDestination->latvalue.resizeAndPreserve(newNbLocalDst); - domainDestination->bounds_lon_1d.resizeAndPreserve(nVertex, newNbLocalDst); - domainDestination->bounds_lat_1d.resizeAndPreserve(nVertex, newNbLocalDst); - } - CArray& lon_dst = domainDestination->lonvalue; - CArray& lat_dst = domainDestination->latvalue; - CArray& bounds_lon_dst = domainDestination->bounds_lon_1d; - CArray& bounds_lat_dst = domainDestination->bounds_lat_1d; - - // Update i_index, j_index - for (int j = 0; j < njDst; ++j) - for (int i = 0; i < niDst; ++i) - { - idx = j * niDst + i; - i_index_dst(idx) = i + ibegin; - j_index_dst(idx) = j + jbegin; - } - - - // 1. Fill in array relating to global index (i_index, j_index, transmap, etc, ...) - // Global index mapping between destination and source - - transformationMapping_.rehash(std::ceil(newNbLocalDst/transformationMapping_.max_load_factor())); - - // Index mapping for local domain - // Mapping global index of expanded domain into original one - // (Representing global index of expanded domain in form of global index of original one) - CArray globalIndexSrcOnDstDomain(newNbLocalDst); - for (idx = 0; idx < newNbLocalDst; ++idx) - { - iindexDst = i_index_dst(idx); - jindexDst = j_index_dst(idx); - globIndexDst = jindexDst * niGloDst + iindexDst; - globIndexSrc = (((jindexDst-1)+njGloSrc) % njGloSrc) * niGloSrc + (((iindexDst-1)+niGloSrc) % niGloSrc) ; - globalIndexSrcOnDstDomain(idx) = globIndexSrc; - - transformationMapping_[globIndexDst] = globIndexSrc; - } - - // 2. Exchange local info among domains (lon,lat,bounds,mask,etc,...) - CClientClientDHTDouble::Index2VectorInfoTypeMap localData; - localData.rehash(std::ceil(oldNbLocal/localData.max_load_factor())); - - // Information exchanged among domains (attention to their order), number in parentheses presents size of data - // lon(1) + lat(1) + bounds_lon(nVertex) + bounds_lat(nVertex) + mask(1) + data_i_index(1) - int dataPackageSize = 1 + 1 + // lon + lat - nVertex + nVertex + //bounds_lon + bounds_lat - 1 + // mask_1d_dst; - 1 + 1; // data_i_index + data_j_index - // Initialize database - for (int idx = 0; idx < oldNbLocal; ++idx) - { - index = i_index_src(idx) + j_index_src(idx) * niGloSrc; - localData[index].resize(dataPackageSize); - std::vector& data = localData[index]; - - //Pack data - int dataIdx = 0; - data[dataIdx] = lon_src(idx);++dataIdx; - data[dataIdx] = lat_src(idx);++dataIdx; - for (int i = 0; i < nVertex; ++i) - { - data[dataIdx] = bounds_lon_src(i,idx); ++dataIdx; - } - for (int i = 0; i < nVertex; ++i) - { - data[dataIdx] = bounds_lat_src(i,idx); ++dataIdx; - } - data[dataIdx] = mask_1d_src(idx) ? 1.0 : -1.0; ++dataIdx; - data[dataIdx] = data_i_index_src_full(idx);++dataIdx; - data[dataIdx] = data_j_index_src_full(idx); - } - - CClientClientDHTDouble dhtData(localData,context->intraComm_); - dhtData.computeIndexInfoMapping(globalIndexSrcOnDstDomain); - CClientClientDHTDouble::Index2VectorInfoTypeMap& neighborData = dhtData.getInfoIndexMap(); - CClientClientDHTDouble::Index2VectorInfoTypeMap::iterator ite = neighborData.end(), it; - - // Ok get all data for destination - // If domain is not periodic, then we mask all extended part. - int nbUnMaskedPointOnExtendedPart = 0, remainder = 0, dataIIndex, dataJIndex; - size_t nIdx; - double maskValue = 1.0; - for (index = 0; index < newNbLocalDst; ++index) - { - nIdx = globalIndexSrcOnDstDomain(index); - it = neighborData.find(nIdx); - if (ite != it) - { - std::vector& data = it->second; - // Unpack data - int dataIdx = 0; - lon_dst(index) = data[dataIdx]; ++dataIdx; - lat_dst(index) = data[dataIdx]; ++dataIdx; - for (int i = 0; i < nVertex; ++i) - { - bounds_lon_dst(i,index) = data[dataIdx]; ++dataIdx; - } - for (int i = 0; i < nVertex; ++i) - { - bounds_lat_dst(i,index) = data[dataIdx]; ++dataIdx; - } - - // Check whether we have x periodic. If we don't, we should mask all point at 0 and niGloDst-1 - maskValue = data[dataIdx]; - if (!isXPeriodic_) - { - remainder = i_index_dst(index) % (niGloDst-1); - if (0 == remainder) - { - maskValue = -1.0; - } - } - - if (!isYPeriodic_) - { - remainder = j_index_dst(index) % (njGloDst-1); - if (0 == remainder) - { - maskValue = -1.0; - } - } - - mask_1d_dst(index) = (1.0 == maskValue) ? true : false; ++dataIdx; - - dataIIndex = (int) data[dataIdx]; - if (!isXPeriodic_) - { - remainder = i_index_dst(index) % (niGloDst-1); - if (0 == remainder) - { - dataIIndex = -1; - } - } - data_i_index_dst_full(index) = dataIIndex; ++dataIdx; - - dataJIndex = (int) data[dataIdx]; - if (!isYPeriodic_) - { - remainder = j_index_dst(index) % (njGloDst-1); - if (0 == remainder) - { - dataJIndex = -1; - } - } - data_j_index_dst_full(index) = dataJIndex; - - if ((0 <= data_i_index_dst_full(index)) && (0 <= data_j_index_dst_full(index))) - { - ++nbUnMaskedPointOnExtendedPart; - } - } - } - - - // Finally, update data_i_index, data_j_index - int dataDstDim = domainDestination->data_dim; - data_i_index_dst.resize(nbUnMaskedPointOnExtendedPart); - data_j_index_dst.resize(nbUnMaskedPointOnExtendedPart); - int count = 0; - for (idx = 0; idx < newNbLocalDst; ++idx) - { - dataIIndex = data_i_index_dst_full(idx); - dataJIndex = data_j_index_dst_full(idx); - if ((0 <= dataIIndex) && (0 <= dataJIndex)) - { - data_i_index_dst(count) = (1 == dataDstDim) ? idx : i_index_dst(idx) - i_index_dst(0); - data_j_index_dst(count) = (1 == dataDstDim) ? 0 : j_index_dst(idx) - j_index_dst(0); - ++count; - } - } - - // Update data_ni, data_nj - - domainDestination->data_ni.setValue((1==dataDstDim) ? niDst * njDst : niDst); - domainDestination->data_nj.setValue((1==dataDstDim) ? niDst * njDst : njDst); - domainDestination->data_ibegin.setValue(0); - domainDestination->data_jbegin.setValue(0); - - // Update longitude and latitude - if (niSrc == domainSource->lonvalue_1d.numElements() && njSrc == domainSource->latvalue_1d.numElements()) // Ok, we have rectilinear here - { - domainDestination->lonvalue_1d.resize(niDst); - domainDestination->lonvalue_1d = lon_dst(Range(0,niDst-1)); - domainDestination->latvalue_1d.resize(njDst); - domainDestination->latvalue_1d = lat_dst(Range(0,lat_dst.numElements()-niDst,niDst)); - } - else // It should be curvilinear - { - domainDestination->lonvalue_1d.resize(lon_dst.numElements()); - domainDestination->lonvalue_1d = lon_dst; - domainDestination->latvalue_1d.resize(lat_dst.numElements()); - domainDestination->latvalue_1d = (lat_dst); - } - domainDestination->mask_1d.resize(domainDestination->domainMask.numElements()) ; - domainDestination->mask_1d=domainDestination->domainMask ; - domainDestination->computeLocalMask() ; -} -CATCH - -/*! - * Extend domain destination and update its attributes - * Suppose that domain destination and domain source have the same values for all attributes (by inheritance) - * \param [in/out] domainDestination domain destination - * \param [in] domainSource domain source - * \param [in] neighborsDomainSrc domain extended part - */ -void CDomainAlgorithmExpand::updateUnstructuredDomainAttributes(CDomain* domainDestination, - CDomain* domainSource, - CArray& neighborsDomainSrc) -TRY -{ - - CContext* context = CContext::getCurrent(); - - // First of all, "copy" all attributes of domain source to domain destination - StdString domainDstRef = (!domainDestination->domain_ref.isEmpty()) ? domainDestination->domain_ref.getValue() - : ""; - if (domainDstRef != domainSource->getId()) - { - domainDestination->domain_ref.setValue(domainSource->getId()); - domainDestination->solveRefInheritance(true); - } - - if (domainDstRef.empty()) domainDestination->domain_ref.reset(); - else domainDestination->domain_ref.setValue(domainDstRef); - - // Now extend domain destination - int niGlob = domainSource->ni_glo; - CArray& mask_1d_src = domainSource->domainMask; - CArray& i_index_src = domainSource->i_index; - CArray& lon_src = domainSource->lonvalue_1d; - CArray& lat_src = domainSource->latvalue_1d; - CArray& bounds_lon_src = domainSource->bounds_lon_1d; - CArray& bounds_lat_src = domainSource->bounds_lat_1d; - CArray& data_i_index_src = domainSource->data_i_index; - - int oldNbLocal = i_index_src.numElements(), index, globalIndex; - // Uncompress data_i_index - CArray data_i_index_src_full(oldNbLocal); - int nbUnMaskedPointOnLocalDomain = 0; - data_i_index_src_full = -1; // Suppose all values are masked - for (int idx = 0; idx < data_i_index_src.numElements(); ++idx) - { - int dataIdx = data_i_index_src(idx); - if ((0 <= dataIdx) && (dataIdx < oldNbLocal)) - { - data_i_index_src_full(nbUnMaskedPointOnLocalDomain) = dataIdx; - ++nbUnMaskedPointOnLocalDomain; - } - } - - CArray& mask_1d_dst = domainDestination->domainMask; - CArray& i_index_dst = domainDestination->i_index; - CArray& j_index_dst = domainDestination->j_index; - CArray& lon_dst = domainDestination->lonvalue_1d; - CArray& lat_dst = domainDestination->latvalue_1d; - CArray& bounds_lon_dst = domainDestination->bounds_lon_1d; - CArray& bounds_lat_dst = domainDestination->bounds_lat_1d; - CArray& data_i_index_dst = domainDestination->data_i_index; - CArray& data_j_index_dst = domainDestination->data_j_index; - - // Resize all array-like attributes of domain destination - int nbNeighbor = neighborsDomainSrc.shape()[1]; - int newNbLocalDst = nbNeighbor + oldNbLocal; - int nVertex = bounds_lon_dst.shape()[0]; - - if (newNbLocalDst==0) - { - mask_1d_dst.resize(newNbLocalDst); - i_index_dst.resize(newNbLocalDst); - j_index_dst.resize(newNbLocalDst); - lon_dst.resize(newNbLocalDst); - lat_dst.resize(newNbLocalDst); - bounds_lon_dst.resize(nVertex, newNbLocalDst); - bounds_lat_dst.resize(nVertex, newNbLocalDst); - } - else - { - mask_1d_dst.resizeAndPreserve(newNbLocalDst); - i_index_dst.resizeAndPreserve(newNbLocalDst); - j_index_dst.resizeAndPreserve(newNbLocalDst); - lon_dst.resizeAndPreserve(newNbLocalDst); - lat_dst.resizeAndPreserve(newNbLocalDst); - bounds_lon_dst.resizeAndPreserve(nVertex, newNbLocalDst); - bounds_lat_dst.resizeAndPreserve(nVertex, newNbLocalDst); - } - CArray data_i_index_dst_full(newNbLocalDst); - data_i_index_dst_full(Range(0,oldNbLocal-1)) = data_i_index_src_full; - data_i_index_dst_full(Range(oldNbLocal,newNbLocalDst-1)) = -1; - - // 1. Fill in array relating to global index (i_index, j_index, transmap, etc, ...) - // Global index mapping between destination and source - - transformationMapping_.rehash(std::ceil(newNbLocalDst/transformationMapping_.max_load_factor())); - // First, index mapping for local domain - for (int idx = 0; idx < oldNbLocal; ++idx) - { - index = i_index_dst(idx); - transformationMapping_[index] = index ; - } - // Then, index mapping for extended part - for (int idx = 0; idx < nbNeighbor; ++idx) - { - index = idx + oldNbLocal; - globalIndex = neighborsDomainSrc(0,idx); - i_index_dst(index) = globalIndex; - j_index_dst(index) = 0; - transformationMapping_[globalIndex]=globalIndex; - } - - // 2. Exchange local info among domains (lon,lat,bounds,mask,etc,...) - CClientClientDHTDouble::Index2VectorInfoTypeMap localData; - localData.rehash(std::ceil(oldNbLocal/localData.max_load_factor())); - // Information exchanged among domains (attention to their order), number in parentheses presents size of data - // lon(1) + lat(1) + bounds_lon(nVertex) + bounds_lat(nVertex) + mask(1) + data_i_index(1) - int dataPackageSize = 1 + 1 + // lon + lat - nVertex + nVertex + //bounds_lon + bounds_lat - 1 + // mask_1d_dst; - 1; // data_i_index - // Initialize database - for (int idx = 0; idx < oldNbLocal; ++idx) - { - index = i_index_src(idx); - localData[index].resize(dataPackageSize); - std::vector& data = localData[index]; - - //Pack data - int dataIdx = 0; - data[dataIdx] = lon_src(idx);++dataIdx; - data[dataIdx] = lat_src(idx);++dataIdx; - for (int i = 0; i < nVertex; ++i) - { - data[dataIdx] = bounds_lon_src(i,idx); ++dataIdx; - } - for (int i = 0; i < nVertex; ++i) - { - data[dataIdx] = bounds_lat_src(i,idx); ++dataIdx; - } - data[dataIdx] = mask_1d_src(idx) ? 1.0 : -1.0; ++dataIdx; - data[dataIdx] = data_i_index_src_full(idx); - } - - CClientClientDHTDouble dhtData(localData, context->intraComm_); - CArray neighborInd(nbNeighbor); - for (int idx = 0; idx < nbNeighbor; ++idx) - neighborInd(idx) = neighborsDomainSrc(0,idx); - - // Compute local data on other domains - dhtData.computeIndexInfoMapping(neighborInd); - CClientClientDHTDouble::Index2VectorInfoTypeMap& neighborData = dhtData.getInfoIndexMap(); - CClientClientDHTDouble::Index2VectorInfoTypeMap::iterator ite = neighborData.end(), it; - // Ok get neighbor data - size_t nIdx; - int nbUnMaskedPointOnExtendedPart = 0; - for (int idx = 0; idx < nbNeighbor; ++idx) - { - nIdx = neighborInd(idx); - it = neighborData.find(nIdx); - if (ite != it) - { - index = idx + oldNbLocal; - std::vector& data = it->second; - // Unpack data - int dataIdx = 0; - lon_dst(index) = data[dataIdx]; ++dataIdx; - lat_dst(index) = data[dataIdx]; ++dataIdx; - for (int i = 0; i < nVertex; ++i) - { - bounds_lon_dst(i,index) = data[dataIdx]; ++dataIdx; - } - for (int i = 0; i < nVertex; ++i) - { - bounds_lat_dst(i,index) = data[dataIdx]; ++dataIdx; - } - mask_1d_dst(index) = (1.0 == data[dataIdx]) ? true : false; ++dataIdx; - data_i_index_dst_full(index) = (int)(data[dataIdx]); - if (0 <= data_i_index_dst_full(index)) - { - data_i_index_dst_full(index) = index; - ++nbUnMaskedPointOnExtendedPart; - } - } - } - - - // Finally, update data_i_index - int nbUnMaskedPointOnNewDstDomain = (nbUnMaskedPointOnExtendedPart + nbUnMaskedPointOnLocalDomain); - int count = 0, dataIdx; - for (int idx = 0; idx < newNbLocalDst; ++idx) - { - dataIdx = data_i_index_dst_full(idx); - if ((0 <= dataIdx)) - { - ++count; - } - } - - data_i_index_dst.resize(count); - data_j_index_dst.resize(count); - data_j_index_dst = 0; - - count = 0; - for (int idx = 0; idx < newNbLocalDst; ++idx) - { - dataIdx = data_i_index_dst_full(idx); - if ((0 <= dataIdx)) - { - data_i_index_dst(count) = dataIdx; - ++count; - } - } - - // Update ni - domainDestination->ni.setValue(newNbLocalDst); - domainDestination->mask_1d.resize(domainDestination->domainMask.numElements()) ; - domainDestination->mask_1d=domainDestination->domainMask ; - domainDestination->computeLocalMask() ; -} -CATCH - - -} diff --git a/xios_2311_src/src/transformation/domain_algorithm/domain_algorithm_expand.hpp b/xios_2311_src/src/transformation/domain_algorithm/domain_algorithm_expand.hpp deleted file mode 100755 index 3bacf778421a935afbcea22bb854e7b967cc6053..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/domain_algorithm/domain_algorithm_expand.hpp +++ /dev/null @@ -1,61 +0,0 @@ -/*! - \file domain_algorithm_expand.hpp - \author Ha NGUYEN - \since 08 Aug 2016 - \date 08 Aug 2016 - - \brief Algorithm for expanding an domain. - */ -#ifndef __XIOS_DOMAIN_ALGORITHM_EXPAND_HPP__ -#define __XIOS_DOMAIN_ALGORITHM_EXPAND_HPP__ - -#include "algorithm_transformation_transfer.hpp" -#include "transformation.hpp" - -namespace xios { -class CDomain; -class CExpandDomain; - -/*! - \class CDomainAlgorithmExpand -*/ -class CDomainAlgorithmExpand : public CAlgorithmTransformationTransfer -{ -public: - CDomainAlgorithmExpand(bool isSource, CDomain* domainDestination, CDomain* domainSource, CExpandDomain* expandDomain); - - virtual ~CDomainAlgorithmExpand() {} - - static bool registerTrans(); - virtual StdString getAlgoName() {return "\\nexpand_domain";} - -protected: - bool isXPeriodic_; // Flag to determine the periodicity of expansion (only for rectilinear) - bool isYPeriodic_; // Flag to determine the periodicity of expansion (only for rectilinear) - -protected: - void expandDomainEdgeConnectivity(CDomain* domainDestination, CDomain* domainSource); - void expandDomainNodeConnectivity(CDomain* domainDestination, CDomain* domainSource); - void updateRectilinearDomainAttributes(CDomain* domainDestination, - CDomain* domainSource, - CArray& neighborsDomainSrc); - - void updateUnstructuredDomainAttributes(CDomain* domainDestination, - CDomain* domainSource, - CArray& neighborsDomainSrc); - -public: - static shared_ptr create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition); - static bool dummyRegistered_; -}; - -} -#endif // __XIOS_DOMAIN_ALGORITHM_EXPAND_HPP__ diff --git a/xios_2311_src/src/transformation/domain_algorithm/domain_algorithm_extract.cpp b/xios_2311_src/src/transformation/domain_algorithm/domain_algorithm_extract.cpp deleted file mode 100755 index e430de6bc90b64759fa54c61fb5211432dae92c2..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/domain_algorithm/domain_algorithm_extract.cpp +++ /dev/null @@ -1,301 +0,0 @@ -#include "domain_algorithm_extract.hpp" -#include "extract_domain.hpp" -#include "domain.hpp" -#include "grid.hpp" -#include "grid_transformation_factory_impl.hpp" -#include "attribute_template.hpp" - -namespace xios { -shared_ptr CDomainAlgorithmExtract::create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) -TRY -{ - std::vector domainListDestP = gridDst->getDomains(); - std::vector domainListSrcP = gridSrc->getDomains(); - - CExtractDomain* extractDomain = dynamic_cast (transformation); - int domainDstIndex = elementPositionInGridDst2DomainPosition[elementPositionInGrid]; - int domainSrcIndex = elementPositionInGridSrc2DomainPosition[elementPositionInGrid]; - - return make_shared(isSource, domainListDestP[domainDstIndex], domainListSrcP[domainSrcIndex], extractDomain); -} -CATCH - -bool CDomainAlgorithmExtract::dummyRegistered_ = CDomainAlgorithmExtract::registerTrans(); -bool CDomainAlgorithmExtract::registerTrans() -TRY -{ - return CGridTransformationFactory::registerTransformation(TRANS_EXTRACT_DOMAIN, create); -} -CATCH - -CDomainAlgorithmExtract::CDomainAlgorithmExtract(bool isSource, CDomain* domainDestination, CDomain* domainSource, CExtractDomain* extractDomain) -: CAlgorithmTransformationTransfer(isSource), domainSrc_(domainSource), domainDest_(domainDestination) -TRY -{ - // Reset geometrical attributes to avoid incompatible (user/domainSource) attributs - // attributs will be defined using domainSource and/or transformation attributs - domainDestination->type.reset(); - domainDestination->ni_glo.reset(); - domainDestination->nj_glo.reset(); - - domainDestination->i_index.reset(); // defined using domainSource->getLocalElement() - domainDestination->j_index.reset(); // " - domainDestination->ibegin.reset(); // will be computed in domainDestination->checkDomain() (from checkAttributes()) - domainDestination->ni.reset(); // " - domainDestination->jbegin.reset(); // " - domainDestination->nj.reset(); // " - - domainDestination->mask_1d.reset(); // defined scanning domainSource->getFullView() & domainSource->getWorkflowView() differencies - domainDestination->mask_2d.reset(); // in all case domainDestination->mask_1d used as reference - - // domainDestination->data_* attributes will be computed in : - domainDestination->data_dim.reset(); // domainDestination->checkDomainData() (from checkAttributes()) - domainDestination->data_ni.reset(); - domainDestination->data_nj.reset(); - domainDestination->data_ibegin.reset(); - domainDestination->data_jbegin.reset(); - domainDestination->data_i_index.reset(); // domainDestination->checkCompression() (from checkAttributes()) - domainDestination->data_j_index.reset(); - - // Next attributes will be set using domainSource->attributes - domainDestination->lonvalue_1d.reset(); - domainDestination->latvalue_1d.reset(); - domainDestination->lonvalue_2d.reset(); - domainDestination->latvalue_2d.reset(); - domainDestination->nvertex.reset(); - domainDestination->bounds_lon_1d.reset(); - domainDestination->bounds_lat_1d.reset(); - domainDestination->bounds_lon_2d.reset(); - domainDestination->bounds_lat_2d.reset(); - domainDestination->area.reset(); - domainDestination->radius.reset(); - - - extractDomain->checkValid(domainSource); - extractIBegin_ = extractDomain->ibegin.getValue(); - extractJBegin_ = extractDomain->jbegin.getValue(); - - extractNi_ = extractDomain->ni.getValue(); - extractNj_ = extractDomain->nj.getValue(); - - extractIEnd_ = extractIBegin_ + extractNi_ - 1; - extractJEnd_ = extractJBegin_ + extractNj_ - 1; - - if (extractNi_ > domainSource->ni_glo.getValue()) - { - ERROR("CDomainAlgorithmExtract::CDomainAlgorithmExtract(CDomain* domainDestination, CDomain* domainSource, CExtractDomain* extractDomain)", - << "Extract size is greater than size of domain source" - << "Size ni_glo of domain source " <getId() << " is " << domainSource->ni_glo.getValue() << std::endl - << "Extract size is " << extractNi_ ); - } - - if (extractNj_ > domainSource->nj_glo.getValue()) - { - ERROR("CDomainAlgorithmExtract::CDomainAlgorithmExtract(CDomain* domainDestination, CDomain* domainSource, CExtractDomain* extractDomain)", - << "Extract size is greater than size of domain source" - << "Size nj_glo of domain source " <getId() << " is " << domainSource->nj_glo.getValue() << std::endl - << "Extract size is " << extractNj_ ); - } - - // Calculate the size of local domain - int ind, indLocSrc, indLocDest, iIdxSrc, jIdxSrc, destIBegin = -1, destJBegin = -1, niDest = 0, njDest = 0 ; - int indGloDest, indGloSrc, niGloSrc = domainSrc_->ni_glo, iSrc, jSrc; - for (int j = 0; j < domainSrc_->nj.getValue(); j++) - { - for (int i = 0; i < domainSrc_->ni.getValue(); i++) - { - ind = j*domainSrc_->ni + i; - iIdxSrc = domainSrc_->i_index(ind); - if ((iIdxSrc >= extractIBegin_) && (iIdxSrc <= extractIEnd_)) - { - jIdxSrc = domainSrc_->j_index(ind); - if ((jIdxSrc >= extractJBegin_) && (jIdxSrc <= extractJEnd_)) - { - if ((niDest == 0) && (njDest == 0)) - { - destIBegin = i; - destJBegin = j; - } - if (i == destIBegin) ++njDest; - } - if (j == destJBegin) ++niDest; - - } - } - } - - - // Set attributes for this transformation - domainDest_->type = domainSrc_ -> type ; - domainDest_->ni_glo.setValue(extractNi_); - domainDest_->nj_glo.setValue(extractNj_); - domainDest_->i_index.resize(niDest*njDest); - domainDest_->j_index.resize(niDest*njDest); - - // Resize lon/lat, bounds, area arrays to local domain dimensions - if (!domainSrc_->lonvalue_1d.isEmpty()) - { - if (domainDest_->type == CDomain::type_attr::rectilinear) - { - domainDest_->lonvalue_1d.resize(niDest); - domainDest_->latvalue_1d.resize(njDest); - } - else if (domainDest_->type == CDomain::type_attr::unstructured) - { - domainDest_->lonvalue_1d.resize(niDest); - domainDest_->latvalue_1d.resize(niDest); - } - } - else if (!domainSrc_->lonvalue_2d.isEmpty()) - { - domainDest_->lonvalue_2d.resize(niDest,njDest); - domainDest_->latvalue_2d.resize(niDest,njDest); - } - if (domainSrc_->hasBounds) - { - if (!domainSrc_->bounds_lon_2d.isEmpty()) - { - domainDest_->bounds_lon_2d.resize(domainDest_->nvertex, niDest, njDest); - domainDest_->bounds_lon_2d.resize(domainDest_->nvertex, niDest, njDest); - } - else if (!domainSrc_->bounds_lon_1d.isEmpty()) - { - domainDest_->bounds_lon_1d.resize(domainDest_->nvertex, niDest); - domainDest_->bounds_lon_1d.resize(domainDest_->nvertex, niDest); - } - } - if (domainSrc_->hasArea) domainDest_->area.resize(niDest,njDest); - - // Set attributes required to define domainDestination->localElement_ and associated views, full and workflow) - CArray sourceGlobalIdx = domainSource->getLocalElement()->getGlobalIndex(); - int indexSize = sourceGlobalIdx.numElements(); - domainDest_->data_i_index.resize(niDest*njDest); - domainDestination->data_i_index = -1; - domainDest_->data_j_index.resize(niDest*njDest); - domainDestination->data_j_index = 0; - - CArray sourceWorkflowIdx = domainSource->getLocalView(CElementView::WORKFLOW)->getIndex(); - int srcWorkflowSize = sourceWorkflowIdx.numElements(); - - int iIdxSrcMin = INT_MAX; - int jIdxSrcMin = INT_MAX; - int IdxMin = INT_MAX; - for (int countSrc = 0; countSrc < indexSize ; ++countSrc) - { - if ( sourceGlobalIdx(countSrc)%domainSource->ni_glo < iIdxSrcMin ) - iIdxSrcMin = sourceGlobalIdx(countSrc)%domainSource->ni_glo; - if ( sourceGlobalIdx(countSrc)/domainSource->ni_glo < jIdxSrcMin ) - jIdxSrcMin = sourceGlobalIdx(countSrc)/domainSource->ni_glo; - if ( sourceGlobalIdx(countSrc) < IdxMin ) - IdxMin = sourceGlobalIdx(countSrc); - } - - int countDest(0); // increment of the position in destination domain - for (int countSrc = 0; countSrc < indexSize ; ++countSrc) - { - int iIdxSrc = sourceGlobalIdx(countSrc)%domainSource->ni_glo; - int jIdxSrc = sourceGlobalIdx(countSrc)/domainSource->ni_glo; - // check that point countSrc concerned by extract - if ( (iIdxSrc >= extractIBegin_) && (iIdxSrc <= extractIEnd_) - && (jIdxSrc >= extractJBegin_) && (jIdxSrc <= extractJEnd_) ) - { - // if concerned, convert source the global indexation in the extracted frame - domainDest_->i_index(countDest) = iIdxSrc-extractIBegin_; - domainDest_->j_index(countDest) = jIdxSrc-extractJBegin_; - - // ------------------ define transformation only if in the WF ------------------ - // countSrc+IdxMin is the global position (not index) considering the distributed memory - // - can be compared to the workflow view - int iIdxSrc2 = (countSrc+IdxMin)%domainSource->ni_glo; - int jIdxSrc2 = (countSrc+IdxMin)/domainSource->ni_glo; - int convert_locally_global_idx = (jIdxSrc2-jIdxSrcMin)*domainSource->ni + (iIdxSrc2-iIdxSrcMin) ; - bool concerned_by_WF(false); - for ( int i = 0 ; idata_i_index( countDest ) = countDest; - } - // ----------------------------------------------------------------------------- - - int iIdxDestLocal = countDest%niDest; - int jIdxDestLocal = countDest/niDest; - int iIdxSrcLocal = countSrc%domainSource->ni; - int jIdxSrcLocal = countSrc/domainSource->ni; - - // area - if (!domainSrc_->area.isEmpty()) - { - domainDest_->area(iIdxDestLocal,jIdxDestLocal) = domainSrc_->area(iIdxSrcLocal,jIdxSrcLocal); - } - - // bounds - if (!domainDest_->bounds_lon_1d.isEmpty()) - { - for (int n = 0; n < domainSrc_->nvertex; ++n) - { - domainDest_->bounds_lon_1d(n, countDest) = domainSrc_->bounds_lon_1d(n,countSrc); - domainDest_->bounds_lat_1d(n, countDest) = domainSrc_->bounds_lat_1d(n,countSrc); - } - } - else if (!domainDest_->bounds_lon_2d.isEmpty()) - { - for (int n = 0; n < domainSrc_->nvertex; ++n) - { - domainDest_->bounds_lon_2d(n, iIdxDestLocal, jIdxDestLocal) = domainSrc_->bounds_lon_2d(n, iIdxSrcLocal, jIdxSrcLocal); - domainDest_->bounds_lat_2d(n, iIdxDestLocal, jIdxDestLocal) = domainSrc_->bounds_lat_2d(n, iIdxSrcLocal, jIdxSrcLocal); - } - } - - // lon/lat - if (!domainDest_->lonvalue_1d.isEmpty()) - { - if (domainDest_->type == CDomain::type_attr::rectilinear) - { - // i : scan nbr of points in src - domainDest_->lonvalue_1d(iIdxDestLocal) = domainSrc_->lonvalue_1d(iIdxSrcLocal); - domainDest_->latvalue_1d(jIdxDestLocal) = domainSrc_->latvalue_1d(jIdxSrcLocal); - } - else if (domainDest_->type == CDomain::type_attr::unstructured) - { - domainDest_->lonvalue_1d(countDest) = domainSrc_->lonvalue_1d(countSrc); - domainDest_->latvalue_1d(countDest) = domainSrc_->latvalue_1d(countSrc); - } - } - else if (!domainDest_->lonvalue_2d.isEmpty()) - { - if (domainDest_->type == CDomain::type_attr::curvilinear) - { - domainDest_->lonvalue_2d(iIdxDestLocal, jIdxDestLocal) = domainSrc_->lonvalue_2d(iIdxSrcLocal,jIdxSrcLocal); - domainDest_->latvalue_2d(iIdxDestLocal, jIdxDestLocal) = domainSrc_->latvalue_2d(iIdxSrcLocal,jIdxSrcLocal); - } - } - - // if point i has been identified as extracted, increment position in destination domain for the next point - countDest++; - } - - } - - domainDestination->checkAttributes() ; - this->computeAlgorithm(domainSource->getLocalView(CElementView::WORKFLOW), domainDestination->getLocalView(CElementView::WORKFLOW)) ; -} -CATCH - - -} diff --git a/xios_2311_src/src/transformation/domain_algorithm/domain_algorithm_extract.hpp b/xios_2311_src/src/transformation/domain_algorithm/domain_algorithm_extract.hpp deleted file mode 100755 index 423954b2cef97465a8f8c694f6077898df3b6d5a..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/domain_algorithm/domain_algorithm_extract.hpp +++ /dev/null @@ -1,58 +0,0 @@ - -#ifndef __XIOS_DOMAIN_ALGORITHM_EXTRACT_HPP__ -#define __XIOS_DOMAIN_ALGORITHM_EXTRACT_HPP__ - -#include "transformation.hpp" -#include "algorithm_transformation_transfer.hpp" - -namespace xios { - -class CDomain; -class CExtractDomain; - -/*! - \class CDomainAlgorithmExtract - Implementing extract (alternative zoom) on domain -*/ -class CDomainAlgorithmExtract : public CAlgorithmTransformationTransfer -{ -public: - CDomainAlgorithmExtract(bool isSource, CDomain* domainDestination, CDomain* domainSource, CExtractDomain* extractDomain); - - virtual ~CDomainAlgorithmExtract() {} - virtual StdString getAlgoName() {return "\\nextract_domain";} - - static bool registerTrans(); - -private: - //! Global extract begin on domain - int extractIBegin_; - int extractJBegin_; - - //! Global extract end on domain - int extractIEnd_; - int extractJEnd_; - - //! Global extract size on domain - int extractNi_; - int extractNj_; - - CDomain* domainSrc_ ; - CDomain* domainDest_ ; - - -public: - static shared_ptr create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition); - static bool dummyRegistered_; -}; - -} -#endif // __XIOS_DOMAIN_ALGORITHM_EXTRACT_HPP__ diff --git a/xios_2311_src/src/transformation/domain_algorithm/domain_algorithm_generate_rectilinear.cpp b/xios_2311_src/src/transformation/domain_algorithm/domain_algorithm_generate_rectilinear.cpp deleted file mode 100755 index 067eac4ea780f7cfda4c811e25649c3abef053df..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/domain_algorithm/domain_algorithm_generate_rectilinear.cpp +++ /dev/null @@ -1,176 +0,0 @@ -/*! - \file domain_algorithm_generate_rectilinear.cpp - \author Ha NGUYEN - \since 31 Aug 2015 - \date 31 Aug 2015 - - \brief Algorithm for automatic generation of rectilinear domain. - */ -#include "domain_algorithm_generate_rectilinear.hpp" -#include "grid.hpp" -#include "domain.hpp" -#include "context.hpp" -#include "context_client.hpp" -#include "generate_rectilinear_domain.hpp" -#include "grid_transformation_factory_impl.hpp" - -namespace xios { - - -shared_ptr CDomainAlgorithmGenerateRectilinear::create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) -TRY -{ - std::vector domainListDestP = gridDst->getDomains(); - std::vector domainListSrcP = gridSrc->getDomains(); - - CGenerateRectilinearDomain* transform = dynamic_cast (transformation); - int domainDstIndex = elementPositionInGridDst2DomainPosition[elementPositionInGrid]; - int domainSrcIndex = elementPositionInGridSrc2DomainPosition[elementPositionInGrid]; - - return make_shared(isSource, domainListDestP[domainDstIndex], domainListSrcP[domainSrcIndex], gridDst, gridSrc, transform); -} -CATCH - -bool CDomainAlgorithmGenerateRectilinear::dummyRegistered_ = CDomainAlgorithmGenerateRectilinear::registerTrans(); - -bool CDomainAlgorithmGenerateRectilinear::registerTrans() -TRY -{ - return CGridTransformationFactory::registerTransformation(TRANS_GENERATE_RECTILINEAR_DOMAIN, create); -} -CATCH - - - -CDomainAlgorithmGenerateRectilinear::CDomainAlgorithmGenerateRectilinear(bool isSource, CDomain* domainDestination, CDomain* domainSource, - CGrid* gridDest, CGrid* gridSource, - CGenerateRectilinearDomain* genRectDomain) -: CAlgorithmTransformationNoDataModification(isSource), nbDomainDistributedPart_(0), domainDest_(domainDestination) -TRY -{ - genRectDomain->checkValid(domainDestination); - if (0 != gridSource) computeDistributionGridSource(gridSource); - else - { - computeDistributionGridDestination(gridDest); - } - fillInAttributesDomainDestination(); - domainDestination->checkAttributes() ; -} -CATCH - -/*! - Compute the index mapping between domain on grid source and one on grid destination -*/ -void CDomainAlgorithmGenerateRectilinear::computeIndexSourceMapping_(const std::vector* >& dataAuxInputs) -{ - /* Nothing to do */ -} - -/*! - Calculate the number of distributed parts on domain source -*/ -void CDomainAlgorithmGenerateRectilinear::computeDistributionGridSource(CGrid* gridSrc) -TRY -{ - CContext* context = CContext::getCurrent(); - int clientSize = context->intraCommSize_ ; - int clientRank = context->intraCommRank_ ; - - std::vector domListSrcP = gridSrc->getDomains(); - std::vector axisListSrcP = gridSrc->getAxis(); - - for (int i = 0; i < domListSrcP.size(); ++i) // support we have only domain, more than one, for now, dont know how to process - { - // First, find (roundly) distribution of associated axis (if any) - if (axisListSrcP.empty()) nbDomainDistributedPart_ = clientSize; - else - { - gridSrc->solveAxisRef(false); - int nbAxis = axisListSrcP.size(); - std::vector nbLocalAxis(nbAxis, 0); - for (int j = 0; j < nbAxis; ++j) - { - std::vector globalAxisIndex(axisListSrcP[j]->n); - for (int idx = 0; idx < axisListSrcP[j]->n; ++idx) - globalAxisIndex[idx] = axisListSrcP[j]->begin + idx; - HashXIOS hashFunc; - StdSize hashValue = hashFunc.hashVec(globalAxisIndex); - std::vector recvBuff(clientSize); - MPI_Gather(&hashValue, 1, MPI_UNSIGNED_LONG, - &recvBuff[0], 1, MPI_UNSIGNED_LONG, - 0, - context->intraComm_); - if (0 == clientRank) - { - std::set setTmp; - for (int k = 0; k < recvBuff.size(); ++k) - { - if (setTmp.end() == setTmp.find(recvBuff[k])) - { - ++nbLocalAxis[j]; - setTmp.insert(recvBuff[k]); - } - } - } - - MPI_Bcast(&nbLocalAxis[0], nbAxis, MPI_INT, - 0, context->intraComm_); - } - - int nbAxisDistributedPart = 1; - for (int j = 0; j < nbAxis; ++j) nbAxisDistributedPart *= nbLocalAxis[j]; - nbDomainDistributedPart_ = clientSize/nbAxisDistributedPart; - } - } -} -CATCH - -/*! - Compute the distribution of the domain destination by using available information provided by user such as n_distributed_partition of axis -*/ -void CDomainAlgorithmGenerateRectilinear::computeDistributionGridDestination(CGrid* gridDest) -TRY -{ - // For now, just suppose that the grid contains only one domain - std::vector axisListDestP = gridDest->getAxis(); - int nbPartition = 1, idx = 0; - for (int i = 0; i < gridDest->axis_domain_order.numElements(); ++i) - { - if (false == (gridDest->axis_domain_order)(i)) - { - nbPartition *= (axisListDestP[idx]->n_distributed_partition.isEmpty()) ? 1: (axisListDestP[idx]->n_distributed_partition.getValue()); - ++idx; - } - } - - CContext* context = CContext::getCurrent(); - int modPart = (context->intraCommSize_) % nbPartition; - if (0 != modPart) - ERROR("CDomainAlgorithmGenerateRectilinear::computeDistributionGridDestination(CGrid* gridDest)", - << "The grid " <getId() << " is not well-distributed. There is an incompatibility between distribution of axis and domain."); - nbDomainDistributedPart_ = context->intraCommSize_/nbPartition; - -} -CATCH - -/*! - Fill in all necessary attributes of domain destination and their values -*/ -void CDomainAlgorithmGenerateRectilinear::fillInAttributesDomainDestination() -TRY -{ - if (!domainDest_->distributionAttributesHaveValue()) - domainDest_->redistribute(nbDomainDistributedPart_); - domainDest_->fillInLonLat(); -} -CATCH -} diff --git a/xios_2311_src/src/transformation/domain_algorithm/domain_algorithm_generate_rectilinear.hpp b/xios_2311_src/src/transformation/domain_algorithm/domain_algorithm_generate_rectilinear.hpp deleted file mode 100755 index 398387258cde6b657184133d0f80036fc032e3a9..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/domain_algorithm/domain_algorithm_generate_rectilinear.hpp +++ /dev/null @@ -1,64 +0,0 @@ -/*! - \file domain_algorithm_generate_rectilinear.hpp - \author Ha NGUYEN - \since 31 Aug 2015 - \date 01 Sep 2015 - - \brief Algorithm for automatic generation of rectilinear domain. - */ -#ifndef __XIOS_DOMAIN_ALGORITHM_GENERATE_RECTILINEAR_HPP__ -#define __XIOS_DOMAIN_ALGORITHM_GENERATE_RECTILINEAR_HPP__ - -#include "algorithm_transformation_no_data_modification.hpp" -#include "transformation.hpp" - -namespace xios { - -class CGrid; -class CDomain; -class CGenerateRectilinearDomain; - -/*! - \class CDomainAlgorithmGenerateRectilinear - Generate a rectilinear or CURVILINEAR domain and fill in necessary its attributes automatically - A new rectilinear (or CURVILINEAR) domain will also be distributed automatically among the processes. - The number of processes is deduced from the distribution of the grid source. -*/ -class CDomainAlgorithmGenerateRectilinear : public CAlgorithmTransformationNoDataModification -{ -public: - CDomainAlgorithmGenerateRectilinear(bool isSource, CDomain* domainDestination, CDomain* domainSource, - CGrid* gridDest, CGrid* gridSource, - CGenerateRectilinearDomain* zoomDomain); - - virtual ~CDomainAlgorithmGenerateRectilinear() {} - static bool registerTrans(); - virtual bool isGenerateTransformation(void) { return true ;} - virtual StdString getAlgoName() {return "\\ngenerate_rectilinear_domain";} -protected: - void computeIndexSourceMapping_(const std::vector* >& dataAuxInputs); - -private: - void computeDistributionGridSource(CGrid* gridSrc); - void computeDistributionGridDestination(CGrid* gridDest); - void fillInAttributesDomainDestination(); - -public: - static shared_ptr create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition); -private: - int nbDomainDistributedPart_; //! Number of local domain. - CDomain* domainDest_ ; - - static bool dummyRegistered_; -}; - -} -#endif // __XIOS_DOMAIN_ALGORITHM_GENERATE_RECTILINEAR_HPP__ diff --git a/xios_2311_src/src/transformation/domain_algorithm/domain_algorithm_interpolate.cpp b/xios_2311_src/src/transformation/domain_algorithm/domain_algorithm_interpolate.cpp deleted file mode 100755 index c258a8a7dcfa37e5c5a00c5a3ac528b6d32ee7ad..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/domain_algorithm/domain_algorithm_interpolate.cpp +++ /dev/null @@ -1,1012 +0,0 @@ -/*! - \file domain_algorithm_interpolate_from_file.cpp - \author Ha NGUYEN - \since 09 Jul 2015 - \date 15 Sep 2015 - - \brief Algorithm for interpolation on a domain. - */ -#include "domain_algorithm_interpolate.hpp" -#include -#include "context.hpp" -#include "context_client.hpp" -#include "distribution_client.hpp" -#include "client_server_mapping_distributed.hpp" -#include "netcdf.hpp" -#include "mapper.hpp" -#include "mpi_tag.hpp" -#include "domain.hpp" -#include "grid_transformation_factory_impl.hpp" -#include "interpolate_domain.hpp" -#include "grid.hpp" - -namespace xios { -shared_ptr CDomainAlgorithmInterpolate::create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) -TRY -{ - std::vector domainListDestP = gridDst->getDomains(); - std::vector domainListSrcP = gridSrc->getDomains(); - - CInterpolateDomain* interpolateDomain = dynamic_cast (transformation); - int domainDstIndex = elementPositionInGridDst2DomainPosition[elementPositionInGrid]; - int domainSrcIndex = elementPositionInGridSrc2DomainPosition[elementPositionInGrid]; - - return make_shared(isSource, domainListDestP[domainDstIndex], domainListSrcP[domainSrcIndex], interpolateDomain); -} -CATCH - -bool CDomainAlgorithmInterpolate::dummyRegistered_ = CDomainAlgorithmInterpolate::registerTrans(); -bool CDomainAlgorithmInterpolate::registerTrans() -TRY -{ - return CGridTransformationFactory::registerTransformation(TRANS_INTERPOLATE_DOMAIN, create); -} -CATCH - -CDomainAlgorithmInterpolate::CDomainAlgorithmInterpolate(bool isSource, CDomain* domainDestination, CDomain* domainSource, CInterpolateDomain* interpDomain) -: CAlgorithmTransformationWeight(isSource), interpDomain_(interpDomain), writeToFile_(false), readFromFile_(false), domainSrc_(domainSource), domainDest_(domainDestination) -TRY -{ - CContext* context = CContext::getCurrent(); - interpDomain_->checkValid(domainSource); - - detectMissingValue = interpDomain_->detect_missing_value ; - renormalize = interpDomain_->renormalize ; - quantity = interpDomain_->quantity ; - - if (interpDomain_->read_write_convention == CInterpolateDomain::read_write_convention_attr::fortran) fortranConvention=true ; - else fortranConvention=false ; - - fileToReadWrite_ = "xios_interpolation_weights_"; - - if (interpDomain_->weight_filename.isEmpty()) - { - fileToReadWrite_ += context->getId() + "_" + - domainSource->getDomainOutputName() + "_" + - domainDestination->getDomainOutputName() + ".nc"; - } - else - fileToReadWrite_ = interpDomain_->weight_filename; - - ifstream f(fileToReadWrite_.c_str()); - switch (interpDomain_->mode) - { - case CInterpolateDomain::mode_attr::read: - readFromFile_ = true; - break; - case CInterpolateDomain::mode_attr::compute: - readFromFile_ = false; - break; - case CInterpolateDomain::mode_attr::read_or_compute: - if (!f.good()) - readFromFile_ = false; - else - readFromFile_ = true; - break; - default: - break; - } - - writeToFile_ = interpDomain_->write_weight; - domainDestination->checkAttributes() ; - - if (readFromFile_) readRemapInfo(); - else computeRemap(); - - this->computeAlgorithm(domainSource->getLocalView(CElementView::WORKFLOW), domainDestination->getLocalView(CElementView::WORKFLOW)) ; - -} -CATCH - -/*! - Compute remap with integrated remap calculation module -*/ -void CDomainAlgorithmInterpolate::computeRemap() -TRY -{ - using namespace sphereRemap; - - CContext* context = CContext::getCurrent(); - int clientRank = context->intraCommRank_; - int i, j, k, idx; - std::vector srcPole(3,0), dstPole(3,0); - int orderInterp = interpDomain_->order.getValue(); - - - const double poleValue = 90.0; - const int constNVertex = 4; // Value by default number of vertex for rectangular domain - int nVertexSrc, nVertexDest; - nVertexSrc = nVertexDest = constNVertex; - - // First of all, try to retrieve the boundary values of domain source and domain destination - int localDomainSrcSize = domainSrc_->i_index.numElements(); - int niSrc = domainSrc_->ni.getValue(), njSrc = domainSrc_->nj.getValue(); - bool hasBoundSrc = domainSrc_->hasBounds; - if (hasBoundSrc) nVertexSrc = domainSrc_->nvertex.getValue(); - CArray boundsLonSrc(nVertexSrc,localDomainSrcSize); - CArray boundsLatSrc(nVertexSrc,localDomainSrcSize); - - if (domainSrc_->hasPole) srcPole[2] = 1; - if (hasBoundSrc) // Suppose that domain source is curvilinear or unstructured - { - if (!domainSrc_->bounds_lon_2d.isEmpty()) - { - for (j = 0; j < njSrc; ++j) - for (i = 0; i < niSrc; ++i) - { - k=j*niSrc+i; - for(int n=0;nbounds_lon_2d(n,i,j); - boundsLatSrc(n,k) = domainSrc_->bounds_lat_2d(n,i,j); - } - } - } - else - { - boundsLonSrc = domainSrc_->bounds_lon_1d; - boundsLatSrc = domainSrc_->bounds_lat_1d; - } - } - else // if domain source is rectilinear, not do anything now - { - CArray lon_g ; - CArray lat_g ; - - if (!domainSrc_->lonvalue_1d.isEmpty() && !domainSrc_->latvalue_1d.isEmpty()) - { - domainSrc_->AllgatherRectilinearLonLat(domainSrc_->lonvalue_1d,domainSrc_->latvalue_1d, lon_g,lat_g) ; - } - else if (! domainSrc_->latvalue_rectilinear_read_from_file.isEmpty() && ! domainSrc_->lonvalue_rectilinear_read_from_file.isEmpty() ) - { - lat_g=domainSrc_->latvalue_rectilinear_read_from_file ; - lon_g=domainSrc_->lonvalue_rectilinear_read_from_file ; - } - else if (!domainSrc_->lon_start.isEmpty() && !domainSrc_->lon_end.isEmpty() && - !domainSrc_->lat_start.isEmpty() && !domainSrc_->lat_end.isEmpty()) - { - double step=(domainSrc_->lon_end-domainSrc_->lon_start)/domainSrc_->ni_glo ; - for (int i=0; ini_glo; ++i) lon_g(i)=domainSrc_->lon_start+i*step ; - step=(domainSrc_->lat_end-domainSrc_->lat_start)/domainSrc_->nj_glo ; - for (int i=0; ini_glo; ++i) lat_g(i)=domainSrc_->lat_start+i*step ; - } - else if (!domainSrc_->lonvalue.isEmpty() && !domainSrc_->latvalue.isEmpty()) // data can come possibly from coupler so only lonvalue and latvalue are defined ? - { - CArray lon(niSrc), lat(njSrc) ; - for(int i=0; i< niSrc;++i) lon(i) = domainSrc_->lonvalue(i) ; - for(int j=0, n=0; jlatvalue(n) ; - domainSrc_->AllgatherRectilinearLonLat(lon, lat, lon_g, lat_g) ; - } - else ERROR("void CDomainAlgorithmInterpolate::computeRemap()",<<"Cannot compute bounds for rectilinear domain") ; - - nVertexSrc = constNVertex; - domainSrc_->fillInRectilinearBoundLonLat(lon_g,lat_g, boundsLonSrc, boundsLatSrc); - } - - std::map > > interpMapValueNorthPole; - std::map > > interpMapValueSouthPole; - - int localDomainDestSize = domainDest_->i_index.numElements(); - int niDest = domainDest_->ni.getValue(), njDest = domainDest_->nj.getValue(); - bool hasBoundDest = domainDest_->hasBounds; - if (hasBoundDest) nVertexDest = domainDest_->nvertex.getValue(); - CArray boundsLonDest(nVertexDest,localDomainDestSize); - CArray boundsLatDest(nVertexDest,localDomainDestSize); - - if (domainDest_->hasPole) dstPole[2] = 1; - if (hasBoundDest) - { - if (!domainDest_->bounds_lon_2d.isEmpty()) - { - for (j = 0; j < njDest; ++j) - for (i = 0; i < niDest; ++i) - { - k=j*niDest+i; - for(int n=0;nbounds_lon_2d(n,i,j); - boundsLatDest(n,k) = domainDest_->bounds_lat_2d(n,i,j); - } - } - } - else - { - boundsLonDest = domainDest_->bounds_lon_1d; - boundsLatDest = domainDest_->bounds_lat_1d; - } - } - else - { - bool isNorthPole = false; - bool isSouthPole = false; - - CArray lon_g ; - CArray lat_g ; - - if (!domainDest_->lonvalue_1d.isEmpty() && !domainDest_->latvalue_1d.isEmpty()) - { - domainDest_->AllgatherRectilinearLonLat(domainDest_->lonvalue_1d,domainDest_->latvalue_1d, lon_g,lat_g) ; - } - else if (! domainDest_->latvalue_rectilinear_read_from_file.isEmpty() && ! domainDest_->lonvalue_rectilinear_read_from_file.isEmpty() ) - { - lat_g=domainDest_->latvalue_rectilinear_read_from_file ; - lon_g=domainDest_->lonvalue_rectilinear_read_from_file ; - } - else if (!domainDest_->lon_start.isEmpty() && !domainDest_->lon_end.isEmpty() && - !domainDest_->lat_start.isEmpty() && !domainDest_->lat_end.isEmpty()) - { - double step=(domainDest_->lon_end-domainDest_->lon_start)/domainDest_->ni_glo ; - for(int i=0; ini_glo; ++i) lon_g(i)=domainDest_->lon_start+i*step ; - step=(domainDest_->lat_end-domainDest_->lat_start)/domainDest_->nj_glo ; - for(int i=0; ini_glo; ++i) lat_g(i)=domainDest_->lat_start+i*step ; - } - else ERROR("void CDomainAlgorithmInterpolate::computeRemap()",<<"Cannot compute bounds for rectilinear domain") ; - - if (std::abs(poleValue - std::abs(lat_g(0))) < NumTraits::epsilon()) isNorthPole = true; - if (std::abs(poleValue - std::abs(lat_g(domainDest_->nj_glo-1))) < NumTraits::epsilon()) isSouthPole = true; - - - - - if (isNorthPole && (0 == domainDest_->jbegin.getValue())) - { - int ibegin = domainDest_->ibegin.getValue(); - for (i = 0; i < niDest; ++i) - { - interpMapValueNorthPole[i+ibegin]; - } - } - - if (isSouthPole && (domainDest_->nj_glo.getValue() == (domainDest_->jbegin.getValue() + njDest))) - { - int ibegin = domainDest_->ibegin.getValue(); - int njGlo = domainDest_->nj_glo.getValue(); - int niGlo = domainDest_->ni_glo.getValue(); - for (i = 0; i < niDest; ++i) - { - k = (njGlo - 1)*niGlo + i + ibegin; - interpMapValueSouthPole[k]; - } - } - - // Ok, fill in boundary values for rectangular domain - nVertexDest = constNVertex; - domainDest_->fillInRectilinearBoundLonLat(lon_g,lat_g, boundsLonDest, boundsLatDest); - } - - - - // Ok, now use mapper to calculate - int nSrcLocal = domainSrc_->i_index.numElements(); - int nDstLocal = domainDest_->i_index.numElements(); - long int * globalSrc = new long int [nSrcLocal]; - long int * globalDst = new long int [nDstLocal]; - - long int globalIndex; - int i_ind, j_ind; - for (int idx = 0; idx < nSrcLocal; ++idx) - { - i_ind=domainSrc_->i_index(idx) ; - j_ind=domainSrc_->j_index(idx) ; - - globalIndex = i_ind + j_ind * domainSrc_->ni_glo; - globalSrc[idx] = globalIndex; - } - - for (int idx = 0; idx < nDstLocal; ++idx) - { - i_ind=domainDest_->i_index(idx) ; - j_ind=domainDest_->j_index(idx) ; - - globalIndex = i_ind + j_ind * domainDest_->ni_glo; - globalDst[idx] = globalIndex; - } - - - // Calculate weight index - Mapper mapper(context->intraComm_); - mapper.setVerbosity(PROGRESS) ; - - - // supress masked data for the source - int nSrcLocalUnmasked = 0 ; - for (int idx=0 ; idx < nSrcLocal; idx++) if (domainSrc_->localMask(idx)) ++nSrcLocalUnmasked ; - - - CArray boundsLonSrcUnmasked(nVertexSrc,nSrcLocalUnmasked); - CArray boundsLatSrcUnmasked(nVertexSrc,nSrcLocalUnmasked); - CArray areaSrcUnmasked(nSrcLocalUnmasked); - - long int * globalSrcUnmasked = new long int [nSrcLocalUnmasked]; - - nSrcLocalUnmasked=0 ; - bool hasSrcArea=domainSrc_->hasArea && !domainSrc_->radius.isEmpty() && !interpDomain_->use_area.isEmpty() && interpDomain_->use_area==true ; - double srcAreaFactor ; - if (hasSrcArea) srcAreaFactor=1./(domainSrc_->radius*domainSrc_->radius) ; - - for (int idx=0 ; idx < nSrcLocal; idx++) - { - if (domainSrc_->localMask(idx)) - { - for(int n=0;nareavalue(idx)*srcAreaFactor ; - globalSrcUnmasked[nSrcLocalUnmasked]=globalSrc[idx] ; - ++nSrcLocalUnmasked ; - } - } - - - int nDstLocalUnmasked = 0 ; - for (int idx=0 ; idx < nDstLocal; idx++) if (domainDest_->localMask(idx)) ++nDstLocalUnmasked ; - - CArray boundsLonDestUnmasked(nVertexDest,nDstLocalUnmasked); - CArray boundsLatDestUnmasked(nVertexDest,nDstLocalUnmasked); - CArray areaDstUnmasked(nDstLocalUnmasked); - - long int * globalDstUnmasked = new long int [nDstLocalUnmasked]; - - nDstLocalUnmasked=0 ; - bool hasDstArea=domainDest_->hasArea && !domainDest_->radius.isEmpty() && !interpDomain_->use_area.isEmpty() && interpDomain_->use_area==true ; - double dstAreaFactor ; - if (hasDstArea) dstAreaFactor=1./(domainDest_->radius*domainDest_->radius) ; - for (int idx=0 ; idx < nDstLocal; idx++) - { - if (domainDest_->localMask(idx)) - { - for(int n=0;nareavalue(idx)*dstAreaFactor ; - globalDstUnmasked[nDstLocalUnmasked]=globalDst[idx] ; - ++nDstLocalUnmasked ; - } - } - - double* ptAreaSrcUnmasked = NULL ; - if (hasSrcArea) ptAreaSrcUnmasked=areaSrcUnmasked.dataFirst() ; - - double* ptAreaDstUnmasked = NULL ; - if (hasDstArea) ptAreaDstUnmasked=areaDstUnmasked.dataFirst() ; - - mapper.setSourceMesh(boundsLonSrcUnmasked.dataFirst(), boundsLatSrcUnmasked.dataFirst(), ptAreaSrcUnmasked, nVertexSrc, nSrcLocalUnmasked, &srcPole[0], globalSrcUnmasked); - mapper.setTargetMesh(boundsLonDestUnmasked.dataFirst(), boundsLatDestUnmasked.dataFirst(), ptAreaDstUnmasked, nVertexDest, nDstLocalUnmasked, &dstPole[0], globalDstUnmasked); - - std::vector timings = mapper.computeWeights(orderInterp,renormalize,quantity); - - std::map > > interpMapValue; - std::map > >::const_iterator iteNorthPole = interpMapValueNorthPole.end(), - iteSouthPole = interpMapValueSouthPole.end(); - for (int idx = 0; idx < mapper.nWeights; ++idx) - { - interpMapValue[mapper.targetWeightId[idx]].push_back(make_pair(mapper.sourceWeightId[idx],mapper.remapMatrix[idx])); - if (iteNorthPole != interpMapValueNorthPole.find(mapper.targetWeightId[idx])) - { - interpMapValueNorthPole[mapper.targetWeightId[idx]].push_back(make_pair(mapper.sourceWeightId[idx],mapper.remapMatrix[idx])); - } - - if (iteSouthPole != interpMapValueSouthPole.find(mapper.targetWeightId[idx])) - { - interpMapValueSouthPole[mapper.targetWeightId[idx]].push_back(make_pair(mapper.sourceWeightId[idx],mapper.remapMatrix[idx])); - } - } - int niGloDst = domainDest_->ni_glo.getValue(); - processPole(interpMapValueNorthPole, niGloDst); - processPole(interpMapValueSouthPole, niGloDst); - - if (!interpMapValueNorthPole.empty()) - { - std::map > >::iterator itNorthPole = interpMapValueNorthPole.begin(); - for (; itNorthPole != iteNorthPole; ++itNorthPole) - { - if (!(itNorthPole->second.empty())) - itNorthPole->second.swap(interpMapValue[itNorthPole->first]); - } - } - - if (!interpMapValueSouthPole.empty()) - { - std::map > >::iterator itSouthPole = interpMapValueSouthPole.begin(); - for (; itSouthPole != iteSouthPole; ++itSouthPole) - { - if (!(itSouthPole->second.empty())) - itSouthPole->second.swap(interpMapValue[itSouthPole->first]); - } - } - - if (writeToFile_ && !readFromFile_) writeRemapInfo(interpMapValue); -// exchangeRemapInfo(interpMapValue); - convertRemapInfo(interpMapValue) ; - - delete [] globalSrc; - delete [] globalSrcUnmasked; - delete [] globalDst; - delete [] globalDstUnmasked; - -} -CATCH - -void CDomainAlgorithmInterpolate::processPole(std::map > >& interMapValuePole, - int nbGlobalPointOnPole) -TRY -{ - CContext* context = CContext::getCurrent(); - - MPI_Comm poleComme(MPI_COMM_NULL); - MPI_Comm_split(context->intraComm_, interMapValuePole.empty() ? MPI_UNDEFINED : 1, 0, &poleComme); - if (MPI_COMM_NULL != poleComme) - { - int nbClientPole; - MPI_Comm_size(poleComme, &nbClientPole); - - std::map > >::iterator itePole = interMapValuePole.end(), itPole, - itbPole = interMapValuePole.begin(); - - int nbWeight = 0; - for (itPole = itbPole; itPole != itePole; ++itPole) - nbWeight += itPole->second.size(); - - std::vector recvCount(nbClientPole,0); - std::vector displ(nbClientPole,0); - MPI_Allgather(&nbWeight,1,MPI_INT,&recvCount[0],1,MPI_INT,poleComme) ; - - displ[0]=0; - for(int n=1;n sendSourceIndexBuff(nbWeight); - std::vector sendSourceWeightBuff(nbWeight); - int k = 0; - for (itPole = itbPole; itPole != itePole; ++itPole) - { - for (int idx = 0; idx < itPole->second.size(); ++idx) - { - sendSourceIndexBuff[k] = (itPole->second)[idx].first; - sendSourceWeightBuff[k] = (itPole->second)[idx].second; - ++k; - } - } - - std::vector recvSourceIndexBuff(recvSize); - std::vector recvSourceWeightBuff(recvSize); - - // Gather all index and weight for pole - MPI_Allgatherv(&sendSourceIndexBuff[0],nbWeight,MPI_INT,&recvSourceIndexBuff[0],&recvCount[0],&displ[0],MPI_INT,poleComme); - MPI_Allgatherv(&sendSourceWeightBuff[0],nbWeight,MPI_DOUBLE,&recvSourceWeightBuff[0],&recvCount[0],&displ[0],MPI_DOUBLE,poleComme); - - std::map recvTemp; - for (int idx = 0; idx < recvSize; ++idx) - { - if (recvTemp.end() != recvTemp.find(recvSourceIndexBuff[idx])) - recvTemp[recvSourceIndexBuff[idx]] += recvSourceWeightBuff[idx]/nbGlobalPointOnPole; - else - recvTemp[recvSourceIndexBuff[idx]] = recvSourceWeightBuff[idx]/nbGlobalPointOnPole; - } - - std::map::const_iterator itRecvTemp, itbRecvTemp = recvTemp.begin(), iteRecvTemp = recvTemp.end(); - - for (itPole = itbPole; itPole != itePole; ++itPole) - { - itPole->second.clear(); - for (itRecvTemp = itbRecvTemp; itRecvTemp != iteRecvTemp; ++itRecvTemp) - itPole->second.push_back(make_pair(itRecvTemp->first, itRecvTemp->second)); - } - } - -} -CATCH - - -void CDomainAlgorithmInterpolate::writeRemapInfo(std::map > >& interpMapValue) -TRY -{ - writeInterpolationInfo(fileToReadWrite_, interpMapValue); -} -CATCH - -void CDomainAlgorithmInterpolate::readRemapInfo() -TRY -{ - std::map > > interpMapValue; - readInterpolationInfo(fileToReadWrite_, interpMapValue); - - exchangeRemapInfo(interpMapValue); -} -CATCH - -void CDomainAlgorithmInterpolate::convertRemapInfo(std::map > >& interpMapValue) -TRY -{ - CContext* context = CContext::getCurrent(); - int clientRank = context->intraCommRank_; - - TransformationIndexMap& transMap = this->transformationMapping_; - TransformationWeightMap& transWeight = this->transformationWeight_; - - std::map > >::const_iterator itb = interpMapValue.begin(), it, - ite = interpMapValue.end(); - - for (it = itb; it != ite; ++it) - { - const std::vector >& tmp = it->second; - for (int i = 0; i < tmp.size(); ++i) - { - transMap[it->first].push_back(tmp[i].first); - transWeight[it->first].push_back(tmp[i].second); - } - } -} -CATCH - -/*! - Read remap information from file then distribute it among clients -*/ -void CDomainAlgorithmInterpolate::exchangeRemapInfo(std::map > >& interpMapValue) -TRY -{ - CContext* context = CContext::getCurrent(); - int clientRank = context->intraCommRank_; - int nbClient = context-> intraCommSize_; - - TransformationIndexMap& transMap = this->transformationMapping_; - TransformationWeightMap& transWeight = this->transformationWeight_; - - std::unordered_map globalIndexOfDomainDest; - int ni = domainDest_->ni.getValue(); - int nj = domainDest_->nj.getValue(); - int ni_glo = domainDest_->ni_glo.getValue(); - size_t globalIndex; - int nIndexSize = domainDest_->i_index.numElements(), i_ind, j_ind; - for (int idx = 0; idx < nIndexSize; ++idx) - { - i_ind=domainDest_->i_index(idx) ; - j_ind=domainDest_->j_index(idx) ; - - globalIndex = i_ind + j_ind * ni_glo; - globalIndexOfDomainDest[globalIndex] = clientRank; - } - - CClientServerMappingDistributed domainIndexClientClientMapping(globalIndexOfDomainDest, - context->intraComm_, - true); - CArray globalIndexInterp(interpMapValue.size()); - std::map > >::const_iterator itb = interpMapValue.begin(), it, - ite = interpMapValue.end(); - size_t globalIndexCount = 0; - for (it = itb; it != ite; ++it) - { - globalIndexInterp(globalIndexCount) = it->first; - ++globalIndexCount; - } - - domainIndexClientClientMapping.computeServerIndexMapping(globalIndexInterp, nbClient); - const CClientServerMapping::GlobalIndexMap& globalIndexInterpSendToClient = domainIndexClientClientMapping.getGlobalIndexOnServer(); - - //Inform each client number of index they will receive - int* sendBuff = new int[nbClient]; - int* recvBuff = new int[nbClient]; - for (int i = 0; i < nbClient; ++i) - { - sendBuff[i] = 0; - recvBuff[i] = 0; - } - int sendBuffSize = 0; - CClientServerMapping::GlobalIndexMap::const_iterator itbMap = globalIndexInterpSendToClient.begin(), itMap, - iteMap = globalIndexInterpSendToClient.end(); - for (itMap = itbMap; itMap != iteMap; ++itMap) - { - const std::vector& tmp = itMap->second; - int sizeIndex = 0, mapSize = (itMap->second).size(); - for (int idx = 0; idx < mapSize; ++idx) - { -// sizeIndex += interpMapValue.at((itMap->second)[idx]).size(); - sizeIndex += (interpMapValue[(int)(itMap->second)[idx]]).size(); - } - sendBuff[itMap->first] = sizeIndex; - sendBuffSize += sizeIndex; - } - - - MPI_Allreduce(sendBuff, recvBuff, nbClient, MPI_INT, MPI_SUM, context->intraComm_); - - int* sendIndexDestBuff = new int [sendBuffSize]; - int* sendIndexSrcBuff = new int [sendBuffSize]; - double* sendWeightBuff = new double [sendBuffSize]; - - std::vector sendRequest; - - int sendOffSet = 0, l = 0; - for (itMap = itbMap; itMap != iteMap; ++itMap) - { - const std::vector& indexToSend = itMap->second; - int mapSize = indexToSend.size(); - int k = 0; - for (int idx = 0; idx < mapSize; ++idx) - { - std::vector >& interpMap = interpMapValue[(int)indexToSend[idx]]; //interpMapValue.at(indexToSend[idx]); - for (int i = 0; i < interpMap.size(); ++i) - { - sendIndexDestBuff[l] = indexToSend[idx]; - sendIndexSrcBuff[l] = interpMap[i].first; - sendWeightBuff[l] = interpMap[i].second; - ++k; - ++l; - } - } - - sendRequest.push_back(MPI_Request()); - MPI_Isend(sendIndexDestBuff + sendOffSet, - k, - MPI_INT, - itMap->first, - MPI_DOMAIN_INTERPOLATION_DEST_INDEX, - context->intraComm_, - &sendRequest.back()); - sendRequest.push_back(MPI_Request()); - MPI_Isend(sendIndexSrcBuff + sendOffSet, - k, - MPI_INT, - itMap->first, - MPI_DOMAIN_INTERPOLATION_SRC_INDEX, - context->intraComm_, - &sendRequest.back()); - sendRequest.push_back(MPI_Request()); - MPI_Isend(sendWeightBuff + sendOffSet, - k, - MPI_DOUBLE, - itMap->first, - MPI_DOMAIN_INTERPOLATION_WEIGHT, - context->intraComm_, - &sendRequest.back()); - sendOffSet += k; - } - - int recvBuffSize = recvBuff[clientRank]; - int* recvIndexDestBuff = new int [recvBuffSize]; - int* recvIndexSrcBuff = new int [recvBuffSize]; - double* recvWeightBuff = new double [recvBuffSize]; - int receivedSize = 0; - int clientSrcRank; - while (receivedSize < recvBuffSize) - { - MPI_Status recvStatus; - MPI_Recv((recvIndexDestBuff + receivedSize), - recvBuffSize, - MPI_INT, - MPI_ANY_SOURCE, - MPI_DOMAIN_INTERPOLATION_DEST_INDEX, - context->intraComm_, - &recvStatus); - - int countBuff = 0; - MPI_Get_count(&recvStatus, MPI_INT, &countBuff); - clientSrcRank = recvStatus.MPI_SOURCE; - - MPI_Recv((recvIndexSrcBuff + receivedSize), - recvBuffSize, - MPI_INT, - clientSrcRank, - MPI_DOMAIN_INTERPOLATION_SRC_INDEX, - context->intraComm_, - &recvStatus); - - MPI_Recv((recvWeightBuff + receivedSize), - recvBuffSize, - MPI_DOUBLE, - clientSrcRank, - MPI_DOMAIN_INTERPOLATION_WEIGHT, - context->intraComm_, - &recvStatus); - - for (int idx = 0; idx < countBuff; ++idx) - { - transMap[*(recvIndexDestBuff + receivedSize + idx)].push_back(*(recvIndexSrcBuff + receivedSize + idx)); - transWeight[*(recvIndexDestBuff + receivedSize + idx)].push_back(*(recvWeightBuff + receivedSize + idx)); - } - receivedSize += countBuff; - } - - std::vector requestStatus(sendRequest.size()); - MPI_Waitall(sendRequest.size(), &sendRequest[0], MPI_STATUS_IGNORE); - - delete [] sendIndexDestBuff; - delete [] sendIndexSrcBuff; - delete [] sendWeightBuff; - delete [] recvIndexDestBuff; - delete [] recvIndexSrcBuff; - delete [] recvWeightBuff; - delete [] sendBuff; - delete [] recvBuff; -} -CATCH - -/*! Redefined some functions of CONetCDF4 to make use of them */ -CDomainAlgorithmInterpolate::WriteNetCdf::WriteNetCdf(const StdString& filename, const MPI_Comm comm) - : CNc4DataOutput(NULL, filename, false, false, true, comm, false, true) {} -int CDomainAlgorithmInterpolate::WriteNetCdf::addDimensionWrite(const StdString& name, - const StdSize size) -TRY -{ - return CONetCDF4::addDimension(name, size); -} -CATCH - -int CDomainAlgorithmInterpolate::WriteNetCdf::addVariableWrite(const StdString& name, nc_type type, - const std::vector& dim) -TRY -{ - return CONetCDF4::addVariable(name, type, dim); -} -CATCH - -void CDomainAlgorithmInterpolate::WriteNetCdf::endDefinition() -TRY -{ - CONetCDF4::definition_end(); -} -CATCH - -void CDomainAlgorithmInterpolate::WriteNetCdf::writeDataIndex(const CArray& data, const StdString& name, - bool collective, StdSize record, - const std::vector* start, - const std::vector* count) -TRY -{ - CONetCDF4::writeData(data, name, collective, record, start, count); -} -CATCH - -void CDomainAlgorithmInterpolate::WriteNetCdf::writeDataIndex(const CArray& data, const StdString& name, - bool collective, StdSize record, - const std::vector* start, - const std::vector* count) -TRY -{ - CONetCDF4::writeData(data, name, collective, record, start, count); -} -CATCH - -/* - Write interpolation weights into a file - \param [in] filename name of output file - \param interpMapValue mapping of global index of domain destination and domain source as well as the corresponding weight -*/ -void CDomainAlgorithmInterpolate::writeInterpolationInfo(std::string& filename, - std::map > >& interpMapValue) -TRY -{ - CContext* context = CContext::getCurrent(); - - size_t n_src = domainSrc_->ni_glo * domainSrc_->nj_glo; - size_t n_dst = domainDest_->ni_glo * domainDest_->nj_glo; - - long localNbWeight = 0; - long globalNbWeight; - long startIndex; - typedef std::map > > IndexRemap; - IndexRemap::iterator itb = interpMapValue.begin(), it, - ite = interpMapValue.end(); - for (it = itb; it!=ite; ++it) - { - localNbWeight += (it->second).size(); - } - - CArray src_idx(localNbWeight); - CArray dst_idx(localNbWeight); - CArray weights(localNbWeight); - - int index = 0; - int indexOffset=0 ; - if (fortranConvention) indexOffset=1 ; - for (it = itb; it !=ite; ++it) - { - std::vector >& tmp = it->second; - for (int idx = 0; idx < tmp.size(); ++idx) - { - dst_idx(index) = it->first + indexOffset; - src_idx(index) = tmp[idx].first + indexOffset; - weights(index) = tmp[idx].second; - ++index; - } - } - - MPI_Allreduce(&localNbWeight, &globalNbWeight, 1, MPI_LONG, MPI_SUM, context->intraComm_); - MPI_Scan(&localNbWeight, &startIndex, 1, MPI_LONG, MPI_SUM, context->intraComm_); - - if (0 == globalNbWeight) - { - info << "There is no interpolation weights calculated between " - << "domain source: " << domainSrc_->getDomainOutputName() - << " and domain destination: " << domainDest_->getDomainOutputName() - << std::endl; - return; - } - - std::vector start(1, startIndex - localNbWeight); - std::vector count(1, localNbWeight); - - WriteNetCdf netCdfWriter(filename, context->intraComm_); - - // Define some dimensions - netCdfWriter.addDimensionWrite("n_src", n_src); - netCdfWriter.addDimensionWrite("n_dst", n_dst); - netCdfWriter.addDimensionWrite("n_weight", globalNbWeight); - - std::vector dims(1,"n_weight"); - - // Add some variables - netCdfWriter.addVariableWrite("src_idx", NC_INT, dims); - netCdfWriter.addVariableWrite("dst_idx", NC_INT, dims); - netCdfWriter.addVariableWrite("weight", NC_DOUBLE, dims); - - // End of definition - netCdfWriter.endDefinition(); - - // // Write variables - if (0 != localNbWeight) - { - netCdfWriter.writeDataIndex(src_idx, "src_idx", false, 0, &start, &count); - netCdfWriter.writeDataIndex(dst_idx, "dst_idx", false, 0, &start, &count); - netCdfWriter.writeDataIndex(weights, "weight", false, 0, &start, &count); - } - - netCdfWriter.closeFile(); -} -CATCH - -/*! - Read interpolation information from a file - \param [in] filename interpolation file - \param [in/out] interpMapValue Mapping between (global) index of domain on grid destination and - corresponding global index of domain and associated weight value on grid source -*/ -void CDomainAlgorithmInterpolate::readInterpolationInfo(std::string& filename, - std::map > >& interpMapValue) -TRY -{ - int ncid ; - int weightDimId ; - size_t nbWeightGlo ; - - - CContext* context = CContext::getCurrent(); - int clientRank = context->intraCommRank_; - int clientSize = context->intraCommSize_; - - - { - ifstream f(filename.c_str()); - if (!f.good()) ERROR("void CDomainAlgorithmInterpolate::readInterpolationInfo", - << "Attempt to read file weight :" << filename << " which doesn't seem to exist." << std::endl - << "Please check this file "); - } - - nc_open(filename.c_str(),NC_NOWRITE, &ncid) ; - nc_inq_dimid(ncid,"n_weight",&weightDimId) ; - nc_inq_dimlen(ncid,weightDimId,&nbWeightGlo) ; - - size_t nbWeight ; - size_t start ; - size_t div = nbWeightGlo/clientSize ; - size_t mod = nbWeightGlo%clientSize ; - if (clientRank < mod) - { - nbWeight=div+1 ; - start=clientRank*(div+1) ; - } - else - { - nbWeight=div ; - start= mod * (div+1) + (clientRank-mod) * div ; - } - - double* weight=new double[nbWeight] ; - int weightId ; - nc_inq_varid (ncid, "weight", &weightId) ; - nc_get_vara_double(ncid, weightId, &start, &nbWeight, weight) ; - - long* srcIndex=new long[nbWeight] ; - int srcIndexId ; - nc_inq_varid (ncid, "src_idx", &srcIndexId) ; - nc_get_vara_long(ncid, srcIndexId, &start, &nbWeight, srcIndex) ; - - long* dstIndex=new long[nbWeight] ; - int dstIndexId ; - nc_inq_varid (ncid, "dst_idx", &dstIndexId) ; - nc_get_vara_long(ncid, dstIndexId, &start, &nbWeight, dstIndex) ; - - int indexOffset=0 ; - if (fortranConvention) indexOffset=1 ; - for(size_t ind=0; ind >& localIndex, - const double* dataInput, - CArray& dataOut, - std::vector& flagInitial, - bool ignoreMissingValue, bool firstPass ) -TRY -{ - int nbLocalIndex = localIndex.size(); - double defaultValue = std::numeric_limits::quiet_NaN(); - - if (detectMissingValue) - { - if (firstPass && renormalize) - { - renormalizationFactor.resize(dataOut.numElements()) ; - renormalizationFactor=1 ; - } - - if (firstPass) - { - allMissing.resize(dataOut.numElements()) ; - allMissing=true ; - } - - for (int idx = 0; idx < nbLocalIndex; ++idx) - { - if (NumTraits::isNan(*(dataInput + idx))) - { - allMissing(localIndex[idx].first) = allMissing(localIndex[idx].first) && true; - if (renormalize) renormalizationFactor(localIndex[idx].first)-=localIndex[idx].second ; - } - else - { - dataOut(localIndex[idx].first) += *(dataInput + idx) * localIndex[idx].second; - allMissing(localIndex[idx].first) = allMissing(localIndex[idx].first) && false; // Reset flag to indicate not all data source are nan - } - } - - } - else - { - for (int idx = 0; idx < nbLocalIndex; ++idx) - { - dataOut(localIndex[idx].first) += *(dataInput + idx) * localIndex[idx].second; - } - } -} -CATCH - -void CDomainAlgorithmInterpolate::updateData(CArray& dataOut) -TRY -{ - if (detectMissingValue) - { - double defaultValue = std::numeric_limits::quiet_NaN(); - size_t nbIndex=dataOut.numElements() ; - - if (allMissing.numElements()>0) - { - for (int idx = 0; idx < nbIndex; ++idx) - { - if (allMissing(idx)) dataOut(idx) = defaultValue; // If all data source are nan then data destination must be nan - } - } - - if (renormalize) - { - if (renormalizationFactor.numElements()>0) dataOut/=renormalizationFactor ; // In some case, process doesn't received any data for interpolation (mask) - // so renormalizationFactor is not initialized - } - } -} -CATCH - -} diff --git a/xios_2311_src/src/transformation/domain_algorithm/domain_algorithm_interpolate.hpp b/xios_2311_src/src/transformation/domain_algorithm/domain_algorithm_interpolate.hpp deleted file mode 100755 index e9e572c372aa1f7034598619fa22c28609b8a15d..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/domain_algorithm/domain_algorithm_interpolate.hpp +++ /dev/null @@ -1,109 +0,0 @@ -/*! - \file domain_algorithm_interpolate_from_file.hpp - \author Ha NGUYEN - \since 09 July 2015 - \date 09 Sep 2015 - - \brief Algorithm for interpolation on a domain. - */ -#ifndef __XIOS_DOMAIN_ALGORITHM_INTERPOLATE_HPP__ -#define __XIOS_DOMAIN_ALGORITHM_INTERPOLATE_HPP__ - -#include "algorithm_transformation_weight.hpp" -#include "transformation.hpp" -#include "nc4_data_output.hpp" - -namespace xios { - -class CDomain; -class CInterpolateDomain; - - -/*! - \class CDomainAlgorithmInterpolate - Reading interpolation from file then apply on a domain -*/ -class CDomainAlgorithmInterpolate : public CAlgorithmTransformationWeight -{ -public: - CDomainAlgorithmInterpolate(bool isSource, CDomain* domainDestination, CDomain* domainSource, CInterpolateDomain* interpDomain); - - virtual ~CDomainAlgorithmInterpolate() {} - - virtual void apply(const std::vector >& localIndex, - const double* dataInput, - CArray& dataOut, - std::vector& flagInitial, - bool ignoreMissingValue, bool firstPass); - virtual void updateData(CArray& dataOut); - - static bool registerTrans(); - virtual StdString getAlgoName() {return "\\ninterpolate_domain";} - -private: - void readInterpolationInfo(std::string& filename, std::map > >& interpMapValue); - void writeInterpolationInfo(std::string& filename, std::map > >& interpMapValue); - void processPole(std::map > >& interMapValuePole, - int nbGlobalPointOnPole); - void computeRemap(); - void readRemapInfo(); - void writeRemapInfo(std::map > >&); - void exchangeRemapInfo(std::map > >& interpMapValue); - void convertRemapInfo(std::map > >& interpMapValue); - -private: - CArray renormalizationFactor ; - CArray allMissing ; - bool detectMissingValue ; - bool renormalize ; - bool quantity ; - - CInterpolateDomain* interpDomain_; - bool writeToFile_; - bool readFromFile_; - StdString fileToReadWrite_; - bool fortranConvention ; - - // class WriteNetCdf; - class WriteNetCdf : public CNc4DataOutput - { - public: - WriteNetCdf(const StdString& filename, const MPI_Comm comm); - int addDimensionWrite(const StdString& name, const StdSize size = UNLIMITED_DIM); - int addVariableWrite(const StdString& name, nc_type type, - const std::vector& dim); - void endDefinition(); - void writeDataIndex(const CArray& data, const StdString& name, - bool collective, StdSize record, - const std::vector* start = NULL, - const std::vector* count = NULL); - void writeDataIndex(const CArray& data, const StdString& name, - bool collective, StdSize record, - const std::vector* start = NULL, - const std::vector* count = NULL); - }; - - -public: - - static shared_ptr create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition); -private: - CDomain* domainSrc_ ; - CDomain* domainDest_ ; - -public: - static bool dummyRegistered_; - - -}; - -} -#endif // __XIOS_DOMAIN_ALGORITHM_INTERPOLATE_HPP__ diff --git a/xios_2311_src/src/transformation/domain_algorithm/domain_algorithm_reorder.cpp b/xios_2311_src/src/transformation/domain_algorithm/domain_algorithm_reorder.cpp deleted file mode 100755 index 0c4f452fe37b6b01ee2778bb7968c9c1e056b43b..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/domain_algorithm/domain_algorithm_reorder.cpp +++ /dev/null @@ -1,238 +0,0 @@ -/*! - \file domain_algorithm_reorder.cpp - \brief Algorithm for reorder a domain. - */ -#include "domain_algorithm_reorder.hpp" -#include "reorder_domain.hpp" -#include "domain.hpp" -#include "grid.hpp" -#include "grid_transformation_factory_impl.hpp" - -namespace xios { -shared_ptr CDomainAlgorithmReorder::create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) -TRY -{ - std::vector domainListDestP = gridDst->getDomains(); - std::vector domainListSrcP = gridSrc->getDomains(); - - CReorderDomain* reorderDomain = dynamic_cast (transformation); - int domainDstIndex = elementPositionInGridDst2DomainPosition[elementPositionInGrid]; - int domainSrcIndex = elementPositionInGridSrc2DomainPosition[elementPositionInGrid]; - - return make_shared(isSource, domainListDestP[domainDstIndex], domainListSrcP[domainSrcIndex], reorderDomain); -} -CATCH - -bool CDomainAlgorithmReorder::dummyRegistered_ = CDomainAlgorithmReorder::registerTrans(); -bool CDomainAlgorithmReorder::registerTrans() -TRY -{ - return CGridTransformationFactory::registerTransformation(TRANS_REORDER_DOMAIN, create); -} -CATCH - -CDomainAlgorithmReorder::CDomainAlgorithmReorder(bool isSource, CDomain* domainDestination, CDomain* domainSource, CReorderDomain* reorderDomain) -: CAlgorithmTransformationNoDataModification(isSource) -TRY -{ - // Reset geometrical attributes to avoid incompatible (user/domainSource) attributs - // attributs will be defined using domainSource and/or transformation attributs - domainDestination->type.reset(); - domainDestination->ni_glo.reset(); - domainDestination->nj_glo.reset(); - - domainDestination->i_index.reset(); // defined using domainSource->getLocalElement() - domainDestination->j_index.reset(); // " - domainDestination->ibegin.reset(); // will be computed in domainDestination->checkDomain() (from checkAttributes()) - domainDestination->ni.reset(); // " - domainDestination->jbegin.reset(); // " - domainDestination->nj.reset(); // " - - domainDestination->mask_1d.reset(); // defined scanning domainSource->getFullView() & domainSource->getWorkflowView() differencies - domainDestination->mask_2d.reset(); // in all case domainDestination->mask_1d used as reference - - // domainDestination->data_* attributes will be computed in : - domainDestination->data_dim.reset(); // domainDestination->checkDomainData() (from checkAttributes()) - domainDestination->data_ni.reset(); - domainDestination->data_nj.reset(); - domainDestination->data_ibegin.reset(); - domainDestination->data_jbegin.reset(); - domainDestination->data_i_index.reset(); // domainDestination->checkCompression() (from checkAttributes()) - domainDestination->data_j_index.reset(); - - // Next attributes will be set using domainSource->attributes - domainDestination->lonvalue_1d.reset(); - domainDestination->latvalue_1d.reset(); - domainDestination->lonvalue_2d.reset(); - domainDestination->latvalue_2d.reset(); - domainDestination->nvertex.reset(); - domainDestination->bounds_lon_1d.reset(); - domainDestination->bounds_lat_1d.reset(); - domainDestination->bounds_lon_2d.reset(); - domainDestination->bounds_lat_2d.reset(); - domainDestination->area.reset(); - domainDestination->radius.reset(); - - - // Set attributes for this transformation - domainDestination->type.setValue( domainSource->type ); - - // Keep a 2D point of view for this transformation which is intrinsically 2D - domainDestination->ni_glo = domainSource->ni_glo; - domainDestination->nj_glo = domainSource->nj_glo; - // Set attributes required to define domainDestination->localElement_ and associated views, full and workflow) - CArray sourceGlobalIdx = domainSource->getLocalElement()->getGlobalIndex(); - int indexSize = sourceGlobalIdx.numElements(); - domainDestination->i_index.resize( indexSize ); - domainDestination->j_index.resize( indexSize ); - for (size_t i = 0; i < indexSize ; ++i) - { - domainDestination->i_index(i) = sourceGlobalIdx(i)%domainSource->ni_glo; - domainDestination->j_index(i) = sourceGlobalIdx(i)/domainSource->ni_glo; - } - // else - // - domainDestination->ni_glo = domainSource->ni_glo * domainSource->nj_glo; - // - domainDestination->nj_glo = 1; - // - domainDestination->i_index = sourceGlobalIdx; - // - domainDestination->j_index = 0; - - // set data_i_index to enable localMask computing (in computeLocalMask()), used to compute Workflow View - CArray sourceWorkflowIdx = domainSource->getLocalView(CElementView::WORKFLOW)->getIndex(); - domainDestination->data_i_index.resize( indexSize ); - domainDestination->data_i_index = -1; - domainDestination->data_j_index.resize( indexSize ); - domainDestination->data_j_index = 0; - int srcWorkflowSize = sourceWorkflowIdx.numElements(); - for (size_t i = 0; i < srcWorkflowSize ; ++i) - { - domainDestination->data_i_index(sourceWorkflowIdx(i)) = sourceWorkflowIdx(i); - } - - - // Set lon/lat values - if (!domainSource->lonvalue_1d.isEmpty() ) - { - domainDestination->latvalue_1d.resize( domainSource->latvalue_1d.numElements() ); - domainDestination->lonvalue_1d.resize( domainSource->lonvalue_1d.numElements() ); - domainDestination->latvalue_1d = domainSource->latvalue_1d; - domainDestination->lonvalue_1d = domainSource->lonvalue_1d; - } - else if (!domainSource->lonvalue_2d.isEmpty() ) - { - domainDestination->latvalue_2d.resize( domainSource->latvalue_2d.numElements() ); - domainDestination->lonvalue_2d.resize( domainSource->lonvalue_2d.numElements() ); - domainDestination->latvalue_2d = domainSource->latvalue_2d; - domainDestination->lonvalue_2d = domainSource->lonvalue_2d; - } - // Set bounds_lon/lat values - if (!domainSource->nvertex.isEmpty() ) - domainDestination->nvertex = domainSource->nvertex; - if (!domainSource->bounds_lon_1d.isEmpty() ) - { - domainDestination->bounds_lon_1d.resize( domainSource->bounds_lon_1d.numElements() ); - domainDestination->bounds_lat_1d.resize( domainSource->bounds_lat_1d.numElements() ); - domainDestination->bounds_lon_1d = domainSource->bounds_lon_1d; - domainDestination->bounds_lat_1d = domainSource->bounds_lat_1d; - } - else if (!domainSource->bounds_lon_2d.isEmpty() ) - { - domainDestination->bounds_lon_2d.resize( domainSource->bounds_lon_2d.numElements() ); - domainDestination->bounds_lat_2d.resize( domainSource->bounds_lat_2d.numElements() ); - domainDestination->bounds_lon_2d = domainSource->bounds_lon_2d; - domainDestination->bounds_lat_2d = domainSource->bounds_lat_2d; - } - // set area - if (!domainSource->area.isEmpty() ) - { - domainDestination->area.resize( domainSource->area.numElements() ); - domainDestination->area = domainSource->area; - } - if (!domainSource->radius.isEmpty() ) - domainDestination->radius = domainSource->radius; - - - reorderDomain->checkValid(domainSource); - // domainDestination->checkAttributes() will be operated at the end of the transformation definition to define correctly domainDestination views - - if (domainSource->type != CDomain::type_attr::rectilinear) - { - ERROR("CDomainAlgorithmReorder::CDomainAlgorithmReorder(CDomain* domainDestination, CDomain* domainSource, CReorderDomain* reorderDomain)", - << "Domain destination is not rectilinear. This filter work only for rectilinear domain and destination domain with < id = " - <getId() <<" > is of type "<type<getId() << std::endl - << "Domain destination " <getId() << std::endl); - } - - if (!reorderDomain->invert_lat.isEmpty() && reorderDomain->invert_lat.getValue() ) - { - CArray& j_index=domainDestination->j_index ; - int nglo = j_index.numElements() ; - int nj_glo =domainDestination->nj_glo ; - for (size_t i = 0; i < nglo ; ++i) - { - j_index(i)=(nj_glo-1)-j_index(i) ; - } - } - - if (!reorderDomain->shift_lon_fraction.isEmpty()) - { - int ni_glo =domainDestination->ni_glo ; - int offset = ni_glo*reorderDomain->shift_lon_fraction ; - CArray& i_index=domainDestination->i_index ; - int nglo = i_index.numElements() ; - for (size_t i = 0; i < nglo ; ++i) - { - i_index(i)= (i_index(i)+offset+ni_glo)%ni_glo ; - } - } - - if (!reorderDomain->min_lon.isEmpty() && !reorderDomain->max_lon.isEmpty()) - { - double min_lon=reorderDomain->min_lon ; - double max_lon=reorderDomain->max_lon ; - double delta=max_lon-min_lon ; - - if (!domainDestination->lonvalue_1d.isEmpty() ) - { - CArray& lon=domainDestination->lonvalue_1d ; - for (int i=0;i max_lon) lon(i)=lon(i)-delta ; - while (lon(i) < min_lon) lon(i)=lon(i)+delta ; - } - } - - if (!domainDestination->bounds_lon_1d.isEmpty() ) - { - CArray& bounds_lon=domainDestination->bounds_lon_1d ; - for (int i=0;i max_lon) bounds_lon(0,i)=bounds_lon(0,i)-delta ; - while (bounds_lon(1,i) > max_lon) bounds_lon(1,i)=bounds_lon(1,i)-delta ; - - while (bounds_lon(0,i) < min_lon) bounds_lon(0,i)=bounds_lon(0,i)+delta ; - while (bounds_lon(1,i) < min_lon) bounds_lon(1,i)=bounds_lon(1,i)+delta ; - } - } - } - - domainDestination->checkAttributes() ; -} -CATCH - - -} diff --git a/xios_2311_src/src/transformation/domain_algorithm/domain_algorithm_reorder.hpp b/xios_2311_src/src/transformation/domain_algorithm/domain_algorithm_reorder.hpp deleted file mode 100755 index dcc3a4d5fbe9360847255b28fa776bb855a300c9..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/domain_algorithm/domain_algorithm_reorder.hpp +++ /dev/null @@ -1,45 +0,0 @@ -/*! - \brief Algorithm for reordering domain. - */ -#ifndef __XIOS_DOMAIN_ALGORITHM_REORDER_HPP__ -#define __XIOS_DOMAIN_ALGORITHM_REORDER_HPP__ - -#include "algorithm_transformation_no_data_modification.hpp" -#include "transformation.hpp" - -namespace xios -{ - - class CDomain; - class CReorderDomain; - - /*! - \class CDomainAlgorithmReorder - Reordering data on domain - */ - class CDomainAlgorithmReorder : public CAlgorithmTransformationNoDataModification - { - public: - CDomainAlgorithmReorder(bool isSource, CDomain* domainDestination, CDomain* domainSource, CReorderDomain* reorderDomain); - - virtual ~CDomainAlgorithmReorder() {} - - static bool registerTrans(); - virtual StdString getAlgoName() {return "\\nreorder_domain";} - - - public: - static shared_ptr create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition); - static bool dummyRegistered_; -}; - -} -#endif // __XIOS_DOMAIN_ALGORITHM_REORDER_HPP__ diff --git a/xios_2311_src/src/transformation/domain_algorithm/domain_algorithm_zoom.cpp b/xios_2311_src/src/transformation/domain_algorithm/domain_algorithm_zoom.cpp deleted file mode 100755 index 17ead450316ac9003a406241734e2ea40ef76881..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/domain_algorithm/domain_algorithm_zoom.cpp +++ /dev/null @@ -1,280 +0,0 @@ -#include "domain_algorithm_zoom.hpp" -#include "zoom_domain.hpp" -#include "domain.hpp" -#include "grid.hpp" -#include "grid_transformation_factory_impl.hpp" -#include "attribute_template.hpp" - -namespace xios { -shared_ptr CDomainAlgorithmZoom::create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) -TRY -{ - std::vector domainListDestP = gridDst->getDomains(); - std::vector domainListSrcP = gridSrc->getDomains(); - - CZoomDomain* zoomDomain = dynamic_cast (transformation); - int domainDstIndex = elementPositionInGridDst2DomainPosition[elementPositionInGrid]; - int domainSrcIndex = elementPositionInGridSrc2DomainPosition[elementPositionInGrid]; - - return make_shared(isSource, domainListDestP[domainDstIndex], domainListSrcP[domainSrcIndex], zoomDomain); -} -CATCH - -bool CDomainAlgorithmZoom::dummyRegistered_ = CDomainAlgorithmZoom::registerTrans(); -bool CDomainAlgorithmZoom::registerTrans() -TRY -{ - return CGridTransformationFactory::registerTransformation(TRANS_ZOOM_DOMAIN, create); -} -CATCH - -CDomainAlgorithmZoom::CDomainAlgorithmZoom(bool isSource, CDomain* domainDestination, CDomain* domainSource, CZoomDomain* zoomDomain) -: CAlgorithmTransformationTransfer(isSource), domainSrc_(domainSource), domainDest_(domainDestination) -TRY -{ - zoomDomain->checkValid(domainSource); - zoomIBegin_ = zoomDomain->ibegin.getValue(); - zoomJBegin_ = zoomDomain->jbegin.getValue(); - - zoomNi_ = zoomDomain->ni.getValue(); - zoomNj_ = zoomDomain->nj.getValue(); - - zoomIEnd_ = zoomIBegin_ + zoomNi_ - 1; - zoomJEnd_ = zoomJBegin_ + zoomNj_ - 1; - - if (zoomNi_ > domainSource->ni_glo.getValue()) - { - ERROR("CDomainAlgorithmZoom::CDomainAlgorithmZoom(CDomain* domainDestination, CDomain* domainSource, CZoomDomain* zoomDomain)", - << "Zoom size is greater than size of domain source" - << "Size ni_glo of domain source " <getId() << " is " << domainSource->ni_glo.getValue() << std::endl - << "Zoom size is " << zoomNi_ ); - } - - if (zoomNj_ > domainSource->nj_glo.getValue()) - { - ERROR("CDomainAlgorithmZoom::CDomainAlgorithmZoom(CDomain* domainDestination, CDomain* domainSource, CZoomDomain* zoomDomain)", - << "Zoom size is greater than size of domain source" - << "Size nj_glo of domain source " <getId() << " is " << domainSource->nj_glo.getValue() << std::endl - << "Zoom size is " << zoomNj_ ); - } - - // Calculate the size of local domain - int ind, indLocSrc, indLocDest, iIdxSrc, jIdxSrc, destIBegin = -1, destJBegin = -1, niDest = 0, njDest = 0, ibeginDest, jbeginDest ; - int indGloDest, indGloSrc, niGloSrc = domainSrc_->ni_glo, iSrc, jSrc, nvertex = 0; - for (int j = 0; j < domainSrc_->nj.getValue(); j++) - { - for (int i = 0; i < domainSrc_->ni.getValue(); i++) - { - ind = j*domainSrc_->ni + i; - iIdxSrc = domainSrc_->i_index(ind); - if ((iIdxSrc >= zoomIBegin_) && (iIdxSrc <= zoomIEnd_)) - { - jIdxSrc = domainSrc_->j_index(ind); - if ((jIdxSrc >= zoomJBegin_) && (jIdxSrc <= zoomJEnd_)) - { - if ((niDest == 0) && (njDest == 0)) - { - destIBegin = i; - destJBegin = j; - } - if (i == destIBegin) ++njDest; - } - if (j == destJBegin) ++niDest; - - } - } - } - ibeginDest = destIBegin + domainSrc_->ibegin - zoomIBegin_; - jbeginDest = destJBegin + domainSrc_->jbegin - zoomJBegin_; - domainDest_->ni_glo.setValue(zoomNi_); - domainDest_->nj_glo.setValue(zoomNj_); - domainDest_->ni.setValue(niDest); - domainDest_->nj.setValue(njDest); - if ( (niDest==0) || (njDest==0)) - { - domainDest_->ibegin.setValue(0); - domainDest_->jbegin.setValue(0); - } - else - { - domainDest_->ibegin.setValue(ibeginDest); - domainDest_->jbegin.setValue(jbeginDest); - } - domainDest_->i_index.resize(niDest*njDest); - domainDest_->j_index.resize(niDest*njDest); - - domainDest_->data_ni.setValue(niDest); - domainDest_->data_nj.setValue(njDest); - domainDest_->data_ibegin.setValue(0); - domainDest_->data_jbegin.setValue(0); - domainDest_->data_i_index.resize(niDest*njDest); - domainDest_->data_j_index.resize(niDest*njDest); - - domainDest_->domainMask.resize(niDest*njDest); - - if (!domainSrc_->lonvalue_1d.isEmpty()) - { - if (domainDest_->type == CDomain::type_attr::rectilinear) - { - domainDest_->lonvalue_1d.resize(niDest); - domainDest_->latvalue_1d.resize(njDest); - } - else if (domainDest_->type == CDomain::type_attr::unstructured) - { - domainDest_->lonvalue_1d.resize(niDest); - domainDest_->latvalue_1d.resize(niDest); - } - else if (domainDest_->type == CDomain::type_attr::curvilinear) - { - domainDest_->lonvalue_1d.resize(niDest*njDest); - domainDest_->latvalue_1d.resize(niDest*njDest); - } - } - else if (!domainSrc_->lonvalue_2d.isEmpty()) - { - domainDest_->lonvalue_2d.resize(niDest,njDest); - domainDest_->latvalue_2d.resize(niDest,njDest); - } - - if (domainSrc_->hasBounds) - { - nvertex = domainSrc_->nvertex; - domainDest_->nvertex.setValue(nvertex); - if (!domainSrc_->bounds_lon_1d.isEmpty()) - { - if (domainDest_->type == CDomain::type_attr::rectilinear) - { - domainDest_->bounds_lon_1d.resize(nvertex, niDest); - domainDest_->bounds_lat_1d.resize(nvertex, njDest); - } - else if (domainDest_->type == CDomain::type_attr::unstructured) - { - domainDest_->bounds_lon_1d.resize(nvertex, niDest); - domainDest_->bounds_lat_1d.resize(nvertex, niDest); - } - else if (domainDest_->type == CDomain::type_attr::curvilinear) - { - domainDest_->bounds_lon_1d.resize(nvertex, niDest*njDest); - domainDest_->bounds_lat_1d.resize(nvertex, niDest*njDest); - } - } - else if (!domainSrc_->bounds_lon_2d.isEmpty()) - { - domainDest_->bounds_lon_2d.resize(nvertex, niDest, njDest); - domainDest_->bounds_lat_2d.resize(nvertex, niDest, njDest); - } - } - if (domainSrc_->hasArea) domainDest_->area.resize(niDest,njDest); - - - for (int iDest = 0; iDest < niDest; iDest++) - { - iSrc = iDest + destIBegin; - for (int jDest = 0; jDest < njDest; jDest++) - { - jSrc = jDest + destJBegin; - ind = jSrc * domainSrc_->ni + iSrc; - iIdxSrc = domainSrc_->i_index(ind); - jIdxSrc = domainSrc_->j_index(ind); - indLocDest = jDest*niDest + iDest; - indGloDest = (jDest + jbeginDest)*zoomNi_ + (iDest + ibeginDest); - indLocSrc = (jDest+destJBegin)*domainSrc_->ni + (iDest+destIBegin); - indGloSrc = (jIdxSrc )* niGloSrc + iIdxSrc; - domainDest_->i_index(indLocDest) = iDest + ibeginDest; // i_index contains global positions - domainDest_->j_index(indLocDest) = jDest + jbeginDest; // i_index contains global positions - domainDest_->data_i_index(indLocDest) = (domainSrc_->data_dim == 1) ? indLocDest : iDest; // data_i_index contains local positions - domainDest_->data_j_index(indLocDest) = (domainSrc_->data_dim == 1) ? 0 :jDest; // data_i_index contains local positions - domainDest_->domainMask(indLocDest) = domainSrc_->domainMask(indLocSrc); - - if (domainSrc_->hasArea) - domainDest_->area(iDest,jDest) = domainSrc_->area(iSrc,jSrc); - - if (domainSrc_->hasLonLat) - { - if (!domainSrc_->latvalue_1d.isEmpty()) - { - if (domainDest_->type == CDomain::type_attr::rectilinear) - { - domainDest_->latvalue_1d(jDest) = domainSrc_->latvalue_1d(jSrc); - } - else - { - domainDest_->lonvalue_1d(indLocDest) = domainSrc_->lonvalue_1d(ind); - domainDest_->latvalue_1d(indLocDest) = domainSrc_->latvalue_1d(ind); - } - } - else if (!domainSrc_->latvalue_2d.isEmpty()) - { - domainDest_->lonvalue_2d(iDest,jDest) = domainSrc_->lonvalue_2d(iSrc,jSrc); - domainDest_->latvalue_2d(iDest,jDest) = domainSrc_->latvalue_2d(iSrc,jSrc); - } - } - - if (domainSrc_->hasBounds) - { - if (!domainSrc_->bounds_lon_1d.isEmpty()) - { - if (domainDest_->type == CDomain::type_attr::rectilinear) - { - for (int n = 0; n < nvertex; ++n) - domainDest_->bounds_lat_1d(n,jDest) = domainSrc_->bounds_lat_1d(n,jSrc); - } - else - { - for (int n = 0; n < nvertex; ++n) - { - domainDest_->bounds_lon_1d(n,indLocDest) = domainSrc_->bounds_lon_1d(n,ind); - domainDest_->bounds_lat_1d(n,indLocDest) = domainSrc_->bounds_lat_1d(n,ind); - } - } - } - else if (!domainSrc_->bounds_lon_2d.isEmpty()) - { - for (int n = 0; n < nvertex; ++n) - { - domainDest_->bounds_lon_2d(n,iDest,jDest) = domainSrc_->bounds_lon_2d(n,iSrc,jSrc); - domainDest_->bounds_lat_2d(n,iDest,jDest) = domainSrc_->bounds_lat_2d(n,iSrc,jSrc); - } - } - - } - - transformationMapping_[indGloDest]=indGloSrc; - - } - - if (domainSrc_->hasLonLat && !domainSrc_->latvalue_1d.isEmpty()) - { - if (domainDest_->type == CDomain::type_attr::rectilinear) - { - domainDest_->lonvalue_1d(iDest) = domainSrc_->lonvalue_1d(iSrc); - } - } - - if (domainSrc_->hasBounds && !domainSrc_->bounds_lon_1d.isEmpty()) - { - if (domainDest_->type == CDomain::type_attr::rectilinear) - { - for (int n = 0; n < nvertex; ++n) - domainDest_->bounds_lon_1d(n,iDest) = domainSrc_->bounds_lon_1d(n,iSrc); - } - } - } - domainDest_->computeLocalMask(); - - domainDestination->checkAttributes() ; - - this->computeAlgorithm(domainSource->getLocalView(CElementView::WORKFLOW), domainDestination->getLocalView(CElementView::WORKFLOW)) ; - -} -CATCH - -} diff --git a/xios_2311_src/src/transformation/domain_algorithm/domain_algorithm_zoom.hpp b/xios_2311_src/src/transformation/domain_algorithm/domain_algorithm_zoom.hpp deleted file mode 100755 index 9f3daf2f9f93ed1dea9c347ebe857ec49adfa4be..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/domain_algorithm/domain_algorithm_zoom.hpp +++ /dev/null @@ -1,61 +0,0 @@ - -#ifndef __XIOS_DOMAIN_ALGORITHM_ZOOM_HPP__ -#define __XIOS_DOMAIN_ALGORITHM_ZOOM_HPP__ - -#include "algorithm_transformation_transfer.hpp" -#include "transformation.hpp" - -namespace xios { - -class CDomain; -class CZoomDomain; - -/*! - \class CDomainAlgorithmZoom - Implementing zoom (alternative zoom) on domain -*/ -class CDomainAlgorithmZoom : public CAlgorithmTransformationTransfer -{ -public: - CDomainAlgorithmZoom(bool isSource, CDomain* domainDestination, CDomain* domainSource, CZoomDomain* zoomDomain); - - virtual ~CDomainAlgorithmZoom() {} - - static bool registerTrans(); -protected: - void updateDomainAttributes(); - -private: - void updateZoom(); - -private: - //! Global zoom begin on domain - int zoomIBegin_; - int zoomJBegin_; - - //! Global zoom end on domain - int zoomIEnd_; - int zoomJEnd_; - - //! Global zoom size on domain - int zoomNi_; - int zoomNj_; - CDomain* domainSrc_ ; - CDomain* domainDest_ ; - - -public: - static shared_ptr create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition); - static bool dummyRegistered_; -}; - -} -#endif // __XIOS_DOMAIN_ALGORITHM_ZOOM_HPP__ diff --git a/xios_2311_src/src/transformation/generic_algorithm_transformation.cpp b/xios_2311_src/src/transformation/generic_algorithm_transformation.cpp index 6e3ce42cef627df6fc7ef31bf58fa85221c0081b..acb478e7ae55128d6c93c2f0d5ecdfe62342a279 100644 --- a/xios_2311_src/src/transformation/generic_algorithm_transformation.cpp +++ b/xios_2311_src/src/transformation/generic_algorithm_transformation.cpp @@ -13,42 +13,1132 @@ #include "utils.hpp" #include "timer.hpp" #include "mpi.hpp" -#include "transform_connector.hpp" -#include "weight_transform_connector.hpp" -#include "grid_algorithm_generic.hpp" -#include "transform_filter.hpp" -namespace xios +namespace xios { + +CGenericAlgorithmTransformation::CGenericAlgorithmTransformation() + : transformationMapping_(), transformationWeight_(), transformationPosition_(), + idAuxInputs_(), type_(ELEMENT_NO_MODIFICATION_WITH_DATA), indexElementSrc_(), + computedProcSrcNonTransformedElement_(false), eliminateRedondantSrc_(true), isDistributedComputed_(false) +{ +} + +void CGenericAlgorithmTransformation::updateData(CArray& dataOut) +{ + +} + +void CGenericAlgorithmTransformation::apply(const std::vector >& localIndex, + const double* dataInput, + CArray& dataOut, + std::vector& flagInitial, + bool ignoreMissingValue, bool firstPass ) +TRY +{ + int nbLocalIndex = localIndex.size(); + double defaultValue = std::numeric_limits::quiet_NaN(); + + if (ignoreMissingValue) + { + if (firstPass) dataOut=defaultValue ; + + for (int idx = 0; idx < nbLocalIndex; ++idx) + { + if (! NumTraits::isNan(*(dataInput + idx))) + { + if (flagInitial[localIndex[idx].first]) dataOut(localIndex[idx].first) = *(dataInput + idx) * localIndex[idx].second; + else dataOut(localIndex[idx].first) += *(dataInput + idx) * localIndex[idx].second; + flagInitial[localIndex[idx].first] = false; // Reset flag to indicate not all data source are nan + } + } + + } + else + { + for (int idx = 0; idx < nbLocalIndex; ++idx) + { + dataOut(localIndex[idx].first) += *(dataInput + idx) * localIndex[idx].second; + } + } +} +CATCH + +void CGenericAlgorithmTransformation::computePositionElements(CGrid* dst, CGrid* src) +TRY +{ + int idxScalar = 0, idxAxis = 0, idxDomain = 0; + CArray axisDomainOrderDst = dst->axis_domain_order; + for (int i = 0; i < axisDomainOrderDst.numElements(); ++i) + { + int dimElement = axisDomainOrderDst(i); + if (2 == dimElement) + { + elementPositionInGridDst2DomainPosition_[i] = idxDomain; + ++idxDomain; + } + else if (1 == dimElement) + { + elementPositionInGridDst2AxisPosition_[i] = idxAxis; + ++idxAxis; + } + else + { + elementPositionInGridDst2ScalarPosition_[i] = idxScalar; + ++idxScalar; + } + } + + idxScalar = idxAxis = idxDomain = 0; + CArray axisDomainOrderSrc = src->axis_domain_order; + for (int i = 0; i < axisDomainOrderSrc.numElements(); ++i) + { + int dimElement = axisDomainOrderSrc(i); + if (2 == dimElement) + { + elementPositionInGridSrc2DomainPosition_[i] = idxDomain; + ++idxDomain; + } + else if (1 == dimElement) + { + elementPositionInGridSrc2AxisPosition_[i] = idxAxis; + ++idxAxis; + } + else + { + elementPositionInGridSrc2ScalarPosition_[i] = idxScalar; + ++idxScalar; + } + } +} +CATCH + +bool CGenericAlgorithmTransformation::isDistributedTransformation(int elementPositionInGrid, CGrid* gridSrc, CGrid* gridDst) +TRY +{ + + if (!isDistributedComputed_) + { + isDistributedComputed_=true ; + if (!eliminateRedondantSrc_) isDistributed_=true ; + else + { + CContext* context = CContext::getCurrent(); + CContextClient* client = context->client; + + computePositionElements(gridSrc, gridDst); + std::vector scalarListSrcP = gridSrc->getScalars(); + std::vector axisListSrcP = gridSrc->getAxis(); + std::vector domainListSrcP = gridSrc->getDomains(); + int distributed, distributed_glo ; + + CArray axisDomainSrcOrder = gridSrc->axis_domain_order; + if (2 == axisDomainSrcOrder(elementPositionInGrid)) // It's domain + { + distributed=domainListSrcP[elementPositionInGridSrc2DomainPosition_[elementPositionInGrid]]->isDistributed() ; + MPI_Allreduce(&distributed,&distributed_glo, 1, MPI_INT, MPI_LOR, client->intraComm) ; + + } + else if (1 == axisDomainSrcOrder(elementPositionInGrid))//it's an axis + { + distributed=axisListSrcP[elementPositionInGridSrc2AxisPosition_[elementPositionInGrid]]->isDistributed() ; + MPI_Allreduce(&distributed,&distributed_glo, 1, MPI_INT, MPI_LOR, client->intraComm) ; + } + else //it's a scalar + { + distributed_glo=false ; + } + isDistributed_=distributed_glo ; + } + } + return isDistributed_ ; +} +CATCH + +/*! + This function computes the global indexes of grid source, which the grid destination is in demand. + \param[in] elementPositionInGrid position of an element in a grid .E.g: if grid is composed of domain and axis (in order), + then position of axis in grid is 1 and domain is positioned at 0. + \param[in] gridSrc Grid source + \param[in] gridDst Grid destination + \param[in\out] globaIndexWeightFromSrcToDst mapping of each global index source and weight to index destination +*/ +void CGenericAlgorithmTransformation::computeGlobalSourceIndex(int elementPositionInGrid, + CGrid* gridSrc, + CGrid* gridDst, + SourceDestinationIndexMap& globaIndexWeightFromSrcToDst) +TRY + { + CContext* context = CContext::getCurrent(); + CContextClient* client = context->client; + int nbClient = client->clientSize; + + typedef std::unordered_map > > SrcToDstMap; + int idx; + + // compute position of elements on grids + computePositionElements(gridDst, gridSrc); + std::vector scalarListDestP = gridDst->getScalars(); + std::vector axisListDestP = gridDst->getAxis(); + std::vector domainListDestP = gridDst->getDomains(); + CArray axisDomainDstOrder = gridDst->axis_domain_order; + std::vector scalarListSrcP = gridSrc->getScalars(); + std::vector axisListSrcP = gridSrc->getAxis(); + std::vector domainListSrcP = gridSrc->getDomains(); + CArray axisDomainSrcOrder = gridSrc->axis_domain_order; + + bool isTransPosEmpty = transformationPosition_.empty(); + CArray transPos; + if (!isTransPosEmpty) transPos.resize(transformationMapping_.size()); + std::set allIndexSrc; // All index of source, which can be scattered among processes, need for doing transformation + + for (size_t idxTrans = 0; idxTrans < transformationMapping_.size(); ++idxTrans) + { + TransformationIndexMap::const_iterator itbTransMap = transformationMapping_[idxTrans].begin(), itTransMap, + iteTransMap = transformationMapping_[idxTrans].end(); + TransformationWeightMap::const_iterator itbTransWeight = transformationWeight_[idxTrans].begin(), itTransWeight; + + // Build mapping between global source element index and global destination element index. + itTransWeight = itbTransWeight; + for (itTransMap = itbTransMap; itTransMap != iteTransMap; ++itTransMap, ++itTransWeight) + { + const std::vector& srcIndex = itTransMap->second; + for (idx = 0; idx < srcIndex.size(); ++idx) + allIndexSrc.insert(srcIndex[idx]); + } + + if (!isTransPosEmpty) + { + TransformationPositionMap::const_iterator itPosMap = transformationPosition_[idxTrans].begin(); + transPos(idxTrans) = itPosMap->second[0]; + } + } + + size_t indexSrcSize = 0; + CArray indexSrc(allIndexSrc.size()); + for (std::set::iterator it = allIndexSrc.begin(); it != allIndexSrc.end(); ++it, ++indexSrcSize) + indexSrc(indexSrcSize) = *it; + + // Flag to indicate whether we will recompute distribution of source global index on processes + bool computeGlobalIndexOnProc = false; + if (indexElementSrc_.size() != allIndexSrc.size()) + computeGlobalIndexOnProc = true; + else + { + for (std::set::iterator it = allIndexSrc.begin(); it != allIndexSrc.end(); ++it) + if (0 == indexElementSrc_.count(*it)) + { + computeGlobalIndexOnProc = true; + break; + } + } + + if (computeGlobalIndexOnProc) + indexElementSrc_.swap(allIndexSrc); + + int sendValue = (computeGlobalIndexOnProc) ? 1 : 0; + int recvValue = 0; + MPI_Allreduce(&sendValue, &recvValue, 1, MPI_INT, MPI_SUM, client->intraComm); + computeGlobalIndexOnProc = (0 < recvValue); + +// CClientClientDHTInt::Index2VectorInfoTypeMap globalIndexOfTransformedElementOnProc; + + if (computeGlobalIndexOnProc || !computedProcSrcNonTransformedElement_) + { + { + CClientClientDHTInt::Index2VectorInfoTypeMap tmp ; + globalIndexOfTransformedElementOnProc_.swap(tmp) ; + } + // Find out global index source of transformed element on corresponding process. + if (globalElementIndexOnProc_.empty()) + globalElementIndexOnProc_.resize(axisDomainDstOrder.numElements()); + + for (idx = 0; idx < axisDomainDstOrder.numElements(); ++idx) + { + + if (idx == elementPositionInGrid) + computeExchangeGlobalIndex(indexSrc, axisDomainSrcOrder(idx), globalIndexOfTransformedElementOnProc_); //globalElementIndexOnProc[idx]); + if (!computedProcSrcNonTransformedElement_) + { + if (2 == axisDomainDstOrder(idx)) // It's domain + { + if (idx != elementPositionInGrid) + computeExchangeDomainIndex(domainListDestP[elementPositionInGridDst2DomainPosition_[idx]], + domainListSrcP[elementPositionInGridSrc2DomainPosition_[idx]], + transPos, + globalElementIndexOnProc_[idx]); + + } + else if (1 == axisDomainDstOrder(idx))//it's an axis + { + if (idx != elementPositionInGrid) + computeExchangeAxisIndex(axisListDestP[elementPositionInGridDst2AxisPosition_[idx]], + axisListSrcP[elementPositionInGridSrc2AxisPosition_[idx]], + transPos, + globalElementIndexOnProc_[idx]); + } + else //it's a scalar + { + if (idx != elementPositionInGrid) + computeExchangeScalarIndex(scalarListDestP[elementPositionInGridDst2ScalarPosition_[idx]], + scalarListSrcP[elementPositionInGridSrc2ScalarPosition_[idx]], + transPos, + globalElementIndexOnProc_[idx]); + + } + } + } + + if (!isTransPosEmpty && !computedProcSrcNonTransformedElement_) + { + for (idx = 0; idx < globalElementIndexOnProc_.size(); ++idx) + { + if (idx != elementPositionInGrid) + { + std::unordered_map >::iterator itb = globalElementIndexOnProc_[idx].begin(), it, + ite = globalElementIndexOnProc_[idx].end(); + for (it = itb; it != ite; ++it) it->second.resize(1); + } + } + } + +/* + if (!computedProcSrcNonTransformedElement_) + { + for (idx = 0; idx < globalElementIndexOnProc_.size(); ++idx) + { + if (idx != elementPositionInGrid) + { + std::unordered_map >::iterator itb = globalElementIndexOnProc_[idx].begin(), it, + ite = globalElementIndexOnProc_[idx].end(); + for (it = itb; it != ite; ++it) procOfNonTransformedElements_.insert(it->first); + if (procOfNonTransformedElements_.size() == nbClient) + break; + } + } + } + + // Processes contain the source index of transformed element + std::set procOfTransformedElement; + CClientClientDHTInt::Index2VectorInfoTypeMap::iterator itIdxb = globalIndexOfTransformedElementOnProc.begin(), + itIdxe = globalIndexOfTransformedElementOnProc.end(), itIdx; + for (itIdx = itIdxb; itIdx != itIdxe; ++itIdx) + { + std::vector& tmp = itIdx->second; + for (int i = 0; i < tmp.size(); ++i) + procOfTransformedElement.insert(tmp[i]); + if (tmp.size() == nbClient) + break; + } + + std::set& commonProc = (procOfTransformedElement.size() < procOfNonTransformedElements_.size()) ? procOfTransformedElement + : (!procOfNonTransformedElements_.empty() ? procOfNonTransformedElements_ : procOfTransformedElement); + + std::vector procContainSrcElementIdx(commonProc.size()); + int count = 0; + for (std::set::iterator it = commonProc.begin(); it != commonProc.end(); ++it) + procContainSrcElementIdx[count++] = *it; + + procContainSrcElementIdx_.swap(procContainSrcElementIdx); +*/ + + if (procElementList_.empty()) procElementList_.resize(axisDomainDstOrder.numElements()) ; + for (idx = 0; idx < axisDomainDstOrder.numElements(); ++idx) + { + std::set& procList=procElementList_[idx] ; + std::set commonTmp ; + if (idx == elementPositionInGrid) + { + set tmpSet ; + procList.swap(tmpSet) ; + CClientClientDHTInt::Index2VectorInfoTypeMap::iterator itIdxb = globalIndexOfTransformedElementOnProc_.begin(), + itIdxe = globalIndexOfTransformedElementOnProc_.end(), itIdx; + for (itIdx = itIdxb; itIdx != itIdxe; ++itIdx) + { + std::vector& tmp = itIdx->second; + for (int i = 0; i < tmp.size(); ++i) procList.insert(tmp[i]); + if (tmp.size() == nbClient) + break; + } + } + else + { + if (!computedProcSrcNonTransformedElement_) + { + set tmpSet ; + procList.swap(tmpSet) ; + std::unordered_map >::iterator itb = globalElementIndexOnProc_[idx].begin(), it, + ite = globalElementIndexOnProc_[idx].end(); + for (it = itb; it != ite; ++it) + { + procList.insert(it->first); + if (procList.size() == nbClient) break; + } + } + } + + if (idx==0) commonProc_= procList ; + else + { + for (std::set::iterator it = commonProc_.begin(); it != commonProc_.end(); ++it) + if (procList.count(*it)==1) commonTmp.insert(*it) ; + commonProc_.swap(commonTmp) ; + } + } + std::vector procContainSrcElementIdx(commonProc_.size()); + int count = 0; + for (std::set::iterator it = commonProc_.begin(); it != commonProc_.end(); ++it) procContainSrcElementIdx[count++] = *it; + procContainSrcElementIdx_.swap(procContainSrcElementIdx); + + // For the first time, surely we calculate proc containing non transformed elements + if (!computedProcSrcNonTransformedElement_) computedProcSrcNonTransformedElement_ = true; + } + + for (size_t idxTrans = 0; idxTrans < transformationMapping_.size(); ++idxTrans) + { + TransformationIndexMap::const_iterator itbTransMap = transformationMapping_[idxTrans].begin(), itTransMap, + iteTransMap = transformationMapping_[idxTrans].end(); + TransformationWeightMap::const_iterator itbTransWeight = transformationWeight_[idxTrans].begin(), itTransWeight; + SrcToDstMap src2DstMap; + src2DstMap.rehash(std::ceil(transformationMapping_[idxTrans].size()/src2DstMap.max_load_factor())); + + // Build mapping between global source element index and global destination element index. + std::unordered_map >().swap(globalElementIndexOnProc_[elementPositionInGrid]); + std::set tmpCounter; + itTransWeight = itbTransWeight; + for (itTransMap = itbTransMap; itTransMap != iteTransMap; ++itTransMap, ++itTransWeight) + { + const std::vector& srcIndex = itTransMap->second; + const std::vector& weight = itTransWeight->second; + for (idx = 0; idx < srcIndex.size(); ++idx) + { + src2DstMap[srcIndex[idx]].push_back(make_pair(itTransMap->first, weight[idx])); + if (0 == tmpCounter.count(srcIndex[idx])) + { + tmpCounter.insert(srcIndex[idx]); + + vector& rankSrc = globalIndexOfTransformedElementOnProc_[srcIndex[idx]] ; + for (int n=0;n >::iterator itb = globalElementIndexOnProc_[idx].begin(), it, + ite = globalElementIndexOnProc_[idx].end(); + for (it = itb; it != ite; ++it) it->second[0] = transPos(idxTrans); + } + } + } + + // Ok, now compute global index of grid source and ones of grid destination + computeGlobalGridIndexMapping(elementPositionInGrid, + procContainSrcElementIdx_, //srcRank, + src2DstMap, + gridSrc, + gridDst, + globalElementIndexOnProc_, + globaIndexWeightFromSrcToDst); + } + } +CATCH + +/*! + Compute mapping of global index of grid source and grid destination + \param [in] elementPositionInGrid position of element in grid. E.x: grid composed of domain and axis, domain has position 0 and axis 1. + \param [in] srcRank rank of client from which we demand global index of element source + \param [in] src2DstMap mapping of global index of element source and global index of element destination + \param [in] gridSrc Grid source + \param [in] gridDst Grid destination + \param [in] globalElementIndexOnProc Global index of element source on different client rank + \param [out] globaIndexWeightFromSrcToDst Mapping of global index of grid source and grid destination +*/ +void CGenericAlgorithmTransformation::computeGlobalGridIndexMapping(int elementPositionInGrid, + const std::vector& srcRank, + std::unordered_map > >& src2DstMap, + CGrid* gridSrc, + CGrid* gridDst, + std::vector > >& globalElementIndexOnProc, + SourceDestinationIndexMap& globaIndexWeightFromSrcToDst) +TRY +{ + SourceDestinationIndexMap globaIndexWeightFromSrcToDst_tmp ; + + CContext* context = CContext::getCurrent(); + CContextClient* client=context->client; + int clientRank = client->clientRank; + + std::vector domainListSrcP = gridSrc->getDomains(); + std::vector axisListSrcP = gridSrc->getAxis(); + std::vector scalarListSrcP = gridSrc->getScalars(); + CArray axisDomainSrcOrder = gridSrc->axis_domain_order; + + size_t nbElement = axisDomainSrcOrder.numElements(); + std::vector nGlobSrc(nbElement); + size_t globalSrcSize = 1; + int domainIndex = 0, axisIndex = 0, scalarIndex = 0; + for (int idx = 0; idx < nbElement; ++idx) + { + nGlobSrc[idx] = globalSrcSize; + int elementDimension = axisDomainSrcOrder(idx); + + // If this is a domain + if (2 == elementDimension) + { + globalSrcSize *= domainListSrcP[domainIndex]->nj_glo.getValue() * domainListSrcP[domainIndex]->ni_glo.getValue(); + ++domainIndex; + } + else if (1 == elementDimension) // So it's an axis + { + globalSrcSize *= axisListSrcP[axisIndex]->n_glo.getValue(); + ++axisIndex; + } + else + { + globalSrcSize *= 1; + ++scalarIndex; + } + } + + std::vector domainListDestP = gridDst->getDomains(); + std::vector axisListDestP = gridDst->getAxis(); + std::vector scalarListDestP = gridDst->getScalars(); + CArray axisDomainDstOrder = gridDst->axis_domain_order; + + std::vector nGlobDst(nbElement); + size_t globalDstSize = 1; + domainIndex = axisIndex = scalarIndex = 0; + set globalSrcStoreIndex ; + + for (int idx = 0; idx < nbElement; ++idx) + { + nGlobDst[idx] = globalDstSize; + int elementDimension = axisDomainDstOrder(idx); + + // If this is a domain + if (2 == elementDimension) + { + globalDstSize *= domainListDestP[domainIndex]->nj_glo.getValue() * domainListDestP[domainIndex]->ni_glo.getValue(); + ++domainIndex; + } + else if (1 == elementDimension) // So it's an axis + { + globalDstSize *= axisListDestP[axisIndex]->n_glo.getValue(); + ++axisIndex; + } + else + { + globalDstSize *= 1; + ++scalarIndex; + } + } + + std::map< std::pair, int > rankMap ; + std::map< std::pair, int >:: iterator rankMapIt ; + + for (int i = 0; i < srcRank.size(); ++i) + { + size_t ssize = 1; + int rankSrc = srcRank[i]; + for (int idx = 0; idx < nbElement; ++idx) + { + ssize *= (globalElementIndexOnProc[idx][rankSrc]).size(); + } + + std::vector idxLoop(nbElement,0); + std::vector currentIndexSrc(nbElement, 0); + std::vector currentIndexDst(nbElement, 0); + int innnerLoopSize = (globalElementIndexOnProc[0])[rankSrc].size(); + size_t idx = 0; + while (idx < ssize) + { + for (int ind = 0; ind < nbElement; ++ind) + { + if (idxLoop[ind] == (globalElementIndexOnProc[ind])[rankSrc].size()) + { + idxLoop[ind] = 0; + ++idxLoop[ind+1]; + } + + currentIndexDst[ind] = currentIndexSrc[ind] = (globalElementIndexOnProc[ind])[rankSrc][idxLoop[ind]]; + } + + for (int ind = 0; ind < innnerLoopSize; ++ind) + { + currentIndexDst[0] = currentIndexSrc[0] = (globalElementIndexOnProc[0])[rankSrc][ind]; + int globalElementDstIndexSize = 0; + if (1 == src2DstMap.count(currentIndexSrc[elementPositionInGrid])) + { + globalElementDstIndexSize = src2DstMap[currentIndexSrc[elementPositionInGrid]].size(); + } + + std::vector globalDstVecIndex(globalElementDstIndexSize,0); + size_t globalSrcIndex = 0; + for (int idxElement = 0; idxElement < nbElement; ++idxElement) + { + if (idxElement == elementPositionInGrid) + { + for (int k = 0; k < globalElementDstIndexSize; ++k) + { + globalDstVecIndex[k] += src2DstMap[currentIndexSrc[elementPositionInGrid]][k].first * nGlobDst[idxElement]; + } + } + else + { + for (int k = 0; k < globalElementDstIndexSize; ++k) + { + globalDstVecIndex[k] += currentIndexDst[idxElement] * nGlobDst[idxElement]; + } + } + globalSrcIndex += currentIndexSrc[idxElement] * nGlobSrc[idxElement]; + } + + for (int k = 0; k < globalElementDstIndexSize; ++k) + { + + globaIndexWeightFromSrcToDst_tmp[rankSrc][globalSrcIndex].push_back(make_pair(globalDstVecIndex[k],src2DstMap[currentIndexSrc[elementPositionInGrid]][k].second )); + rankMapIt=rankMap.find(make_pair(globalSrcIndex,globalDstVecIndex[k])) ; + if (rankMapIt==rankMap.end()) rankMap[make_pair(globalSrcIndex,globalDstVecIndex[k])] = rankSrc ; + else if (rankSrc==clientRank) rankMapIt->second = rankSrc ; + } + ++idxLoop[0]; + } + idx += innnerLoopSize; + } + } + + // eliminate redondant global src point owned by differrent processes. + // Avoid as possible to tranfer data from an other process if the src point is also owned by current process + int rankSrc ; + size_t globalSrcIndex ; + size_t globalDstIndex ; + double weight ; + + SourceDestinationIndexMap::iterator rankIt,rankIte ; + std::unordered_map > >::iterator globalSrcIndexIt, globalSrcIndexIte ; + std::vector >::iterator vectIt,vectIte ; + + rankIt=globaIndexWeightFromSrcToDst_tmp.begin() ; rankIte=globaIndexWeightFromSrcToDst_tmp.end() ; + for(;rankIt!=rankIte;++rankIt) + { + rankSrc = rankIt->first ; + globalSrcIndexIt = rankIt->second.begin() ; globalSrcIndexIte = rankIt->second.end() ; + for(;globalSrcIndexIt!=globalSrcIndexIte;++globalSrcIndexIt) + { + globalSrcIndex = globalSrcIndexIt->first ; + vectIt = globalSrcIndexIt->second.begin() ; vectIte = globalSrcIndexIt->second.end() ; + for(vectIt; vectIt!=vectIte; vectIt++) + { + globalDstIndex = vectIt->first ; + weight = vectIt->second ; + if (eliminateRedondantSrc_) + { + if (rankMap[make_pair(globalSrcIndex,globalDstIndex)] == rankSrc) + globaIndexWeightFromSrcToDst[rankSrc][globalSrcIndex].push_back(make_pair(globalDstIndex,weight)) ; + } + else globaIndexWeightFromSrcToDst[rankSrc][globalSrcIndex].push_back(make_pair(globalDstIndex,weight)) ; + } + } + } +} +CATCH + +/*! + Find out proc and global index of axis source which axis destination is on demande + \param[in] scalar Scalar destination + \param[in] scalar Scalar source + \param[in] destGlobalIndexPositionInGrid Relative position of axis corresponds to other element of grid. + \param[out] globalScalarIndexOnProc Global index of axis source on different procs +*/ +void CGenericAlgorithmTransformation::computeExchangeScalarIndex(CScalar* scalarDst, + CScalar* scalarSrc, + CArray& destGlobalIndexPositionInGrid, + std::unordered_map >& globalScalarIndexOnProc) +TRY { + CContext* context = CContext::getCurrent(); + CContextClient* client=context->client; + int clientRank = client->clientRank; + int clientSize = client->clientSize; -CGenericAlgorithmTransformation::CGenericAlgorithmTransformation(bool isSource) - : isSource_(isSource) + globalScalarIndexOnProc.rehash(std::ceil(clientSize/globalScalarIndexOnProc.max_load_factor())); + for (int idx = 0; idx < clientSize; ++idx) + { + globalScalarIndexOnProc[idx].push_back(0); + } +} +CATCH + +/*! + Find out proc and global index of axis source which axis destination is on demande + \param[in] axisDst Axis destination + \param[in] axisSrc Axis source + \param[in] destGlobalIndexPositionInGrid Relative position of axis corresponds to other element of grid. + \param[out] globalAxisIndexOnProc Global index of axis source on different procs +*/ +void CGenericAlgorithmTransformation::computeExchangeAxisIndex(CAxis* axisDst, + CAxis* axisSrc, + CArray& destGlobalIndexPositionInGrid, + std::unordered_map >& globalAxisIndexOnProc) +TRY { + CContext* context = CContext::getCurrent(); + CContextClient* client=context->client; + int clientRank = client->clientRank; + int clientSize = client->clientSize; + + size_t globalIndex; + int nIndexSize = axisSrc->index.numElements(); + CClientClientDHTInt::Index2VectorInfoTypeMap globalIndex2ProcRank; + globalIndex2ProcRank.rehash(std::ceil(nIndexSize/globalIndex2ProcRank.max_load_factor())); + for (int idx = 0; idx < nIndexSize; ++idx) + { + if (axisSrc->mask(idx)) + { + globalIndex = axisSrc->index(idx); + globalIndex2ProcRank[globalIndex].push_back(clientRank); + } + } + + CClientClientDHTInt dhtIndexProcRank(globalIndex2ProcRank, client->intraComm); + CArray globalAxisIndex(axisDst->index.numElements()); + for (int idx = 0; idx < globalAxisIndex.numElements(); ++idx) + { + globalAxisIndex(idx) = axisDst->index(idx); + } + dhtIndexProcRank.computeIndexInfoMapping(globalAxisIndex); + + std::vector countIndex(clientSize,0); + const CClientClientDHTInt::Index2VectorInfoTypeMap& computedGlobalIndexOnProc = dhtIndexProcRank.getInfoIndexMap(); + CClientClientDHTInt::Index2VectorInfoTypeMap::const_iterator itb = computedGlobalIndexOnProc.begin(), it, + ite = computedGlobalIndexOnProc.end(); + for (it = itb; it != ite; ++it) + { + const std::vector& procList = it->second; + for (int idx = 0; idx < procList.size(); ++idx) ++countIndex[procList[idx]]; + } + + globalAxisIndexOnProc.rehash(std::ceil(clientSize/globalAxisIndexOnProc.max_load_factor())); + for (int idx = 0; idx < clientSize; ++idx) + { + if (0 != countIndex[idx]) + { + globalAxisIndexOnProc[idx].resize(countIndex[idx]); + countIndex[idx] = 0; + } + } + + for (it = itb; it != ite; ++it) + { + const std::vector& procList = it->second; + for (int idx = 0; idx < procList.size(); ++idx) + { + globalAxisIndexOnProc[procList[idx]][countIndex[procList[idx]]] = it->first; + ++countIndex[procList[idx]]; + } + } } +CATCH + +/*! + Find out proc and global index of domain source which domain destination is on demande + \param[in] domainDst Domain destination + \param[in] domainSrc Domain source + \param[in] destGlobalIndexPositionInGrid Relative position of domain corresponds to other element of grid. + \param[out] globalDomainIndexOnProc Global index of domain source on different procs +*/ +void CGenericAlgorithmTransformation::computeExchangeDomainIndex(CDomain* domainDst, + CDomain* domainSrc, + CArray& destGlobalIndexPositionInGrid, + std::unordered_map >& globalDomainIndexOnProc) +TRY +{ + CContext* context = CContext::getCurrent(); + CContextClient* client=context->client; + int clientRank = client->clientRank; + int clientSize = client->clientSize; + + int niGlobSrc = domainSrc->ni_glo.getValue(); + size_t globalIndex; + int i_ind, j_ind; + int nIndexSize = (destGlobalIndexPositionInGrid.isEmpty()) ? domainSrc->i_index.numElements() + : destGlobalIndexPositionInGrid.numElements(); + CClientClientDHTInt::Index2VectorInfoTypeMap globalIndex2ProcRank; + globalIndex2ProcRank.rehash(std::ceil(nIndexSize/globalIndex2ProcRank.max_load_factor())); + + if (destGlobalIndexPositionInGrid.isEmpty()) + { + for (int idx = 0; idx < nIndexSize; ++idx) + { + i_ind=domainSrc->i_index(idx) ; + j_ind=domainSrc->j_index(idx) ; + if (domainSrc->localMask(idx)) + { + globalIndex = i_ind + j_ind * niGlobSrc; + globalIndex2ProcRank[globalIndex].resize(1); + globalIndex2ProcRank[globalIndex][0] = clientRank; + } + } + } + else + { + for (int idx = 0; idx < nIndexSize; ++idx) + { +// if (domainSrc->localMask(idx)) -> not necessairy, mask seem to be included in destGlobalIndexPositionInGrid(idx) (ym) + globalIndex2ProcRank[destGlobalIndexPositionInGrid(idx)].push_back(clientRank); + } + } + CArray globalDomainIndex; + if (destGlobalIndexPositionInGrid.isEmpty()) + { + int niGlobDst = domainDst->ni_glo.getValue(); + globalDomainIndex.resize(domainDst->i_index.numElements()); + nIndexSize = domainDst->i_index.numElements(); -/////////////////////////////////////////////////////////////// -////////// new algorithm for new method ///////// -/////////////////////////////////////////////////////////////// + for (int idx = 0; idx < nIndexSize; ++idx) + { + i_ind=domainDst->i_index(idx) ; + j_ind=domainDst->j_index(idx) ; -shared_ptr CGenericAlgorithmTransformation::createGridAlgorithm(CGrid* gridSrc, CGrid* gridDst, int pos) + globalDomainIndex(idx) = i_ind + j_ind * niGlobDst; + } + } + else + { + globalDomainIndex.reference(destGlobalIndexPositionInGrid); + } + + CClientClientDHTInt dhtIndexProcRank(globalIndex2ProcRank, client->intraComm); + dhtIndexProcRank.computeIndexInfoMapping(globalDomainIndex); + + std::vector countIndex(clientSize,0); + const CClientClientDHTInt::Index2VectorInfoTypeMap& computedGlobalIndexOnProc = dhtIndexProcRank.getInfoIndexMap(); + CClientClientDHTInt::Index2VectorInfoTypeMap::const_iterator itb = computedGlobalIndexOnProc.begin(), it, + ite = computedGlobalIndexOnProc.end(); + for (it = itb; it != ite; ++it) + { + const std::vector& procList = it->second; + for (int idx = 0; idx < procList.size(); ++idx) ++countIndex[procList[idx]]; + } + + globalDomainIndexOnProc.rehash(std::ceil(clientSize/globalDomainIndexOnProc.max_load_factor())); + for (int idx = 0; idx < clientSize; ++idx) + { + if (0 != countIndex[idx]) + { + globalDomainIndexOnProc[idx].resize(countIndex[idx]); + countIndex[idx] = 0; + } + } + + for (it = itb; it != ite; ++it) + { + const std::vector& procList = it->second; + for (int idx = 0; idx < procList.size(); ++idx) + { + globalDomainIndexOnProc[procList[idx]][countIndex[procList[idx]]] = it->first; + ++countIndex[procList[idx]]; + } + } +} +CATCH + +void CGenericAlgorithmTransformation::computeTransformationMappingNonDistributed(int elementPositionInGrid, CGrid* gridSrc, CGrid* gridDst, + vector& localSrc, vector& localDst, vector& weight, + int& nlocalIndexDest) +TRY { - auto algo = make_shared(gridSrc, gridDst, pos, shared_from_this()) ; - algo->computeAlgorithm() ; - return algo ; + + CContext* context = CContext::getCurrent(); + CContextClient* client = context->client; + int nbClient = client->clientSize; + + computePositionElements(gridDst, gridSrc); + std::vector scalarListDstP = gridDst->getScalars(); + std::vector axisListDstP = gridDst->getAxis(); + std::vector domainListDstP = gridDst->getDomains(); + CArray axisDomainDstOrder = gridDst->axis_domain_order; + std::vector scalarListSrcP = gridSrc->getScalars(); + std::vector axisListSrcP = gridSrc->getAxis(); + std::vector domainListSrcP = gridSrc->getDomains(); + CArray axisDomainSrcOrder = gridSrc->axis_domain_order; + + int nElement=axisDomainSrcOrder.numElements() ; + int indSrc=1 ; + int indDst=1 ; + vector nIndexSrc(nElement) ; + vector nIndexDst(nElement) ; + vector< CArray* > maskSrc(nElement) ; + vector< CArray* > maskDst(nElement) ; + + int nlocalIndexSrc=1 ; +// int nlocalIndexDest=1 ; + nlocalIndexDest=1 ; + CArray maskScalar(1) ; + maskScalar = true ; + + + for(int i=0 ; ii_index.numElements() ; + maskSrc[i]=&domain->localMask ; + } + else if (1 == dimElement) //axis + { + CAxis* axis=axisListSrcP[elementPositionInGridSrc2AxisPosition_[i]] ; + nIndexSrc[i] = axis->index.numElements() ; + maskSrc[i]=&axis->mask ; + } + else //scalar + { + nIndexSrc[i]=1 ; + maskSrc[i]=&maskScalar ; + } + nlocalIndexSrc=nlocalIndexSrc*nIndexSrc[i] ; + } + + + + int offset=1 ; + for(int i=0 ; ii_index.numElements() ; + CArray& localMask=domain->localMask ; + int nbInd=0 ; + for(int j=0;jlocalMask ; + } + else if (1 == dimElement) //axis + { + CAxis* axis = axisListDstP[elementPositionInGridDst2AxisPosition_[i]] ; + int nIndex=axis->index.numElements() ; + CArray& localMask=axis->mask ; + int nbInd=0 ; + for(int j=0;jmask ; + } + else //scalar + { + nIndexDst[i]=1 ; + maskDst[i]=&maskScalar ; + } + if (i dstLocalInd ; + int dimElement = axisDomainDstOrder(elementPositionInGrid); + if (2 == dimElement) //domain + { + CDomain* domain = domainListDstP[elementPositionInGridDst2DomainPosition_[elementPositionInGrid]] ; + int ni_glo=domain->ni_glo ; + int nj_glo=domain->nj_glo ; + int nindex_glo=ni_glo*nj_glo ; + dstLocalInd.resize(nindex_glo,-1) ; + int nIndex=domain->i_index.numElements() ; + CArray& localMask=domain->localMask ; + int unmaskedInd=0 ; + int globIndex ; + for(int i=0;ij_index(i)*ni_glo+domain->i_index(i) ; + dstLocalInd[globIndex]=unmaskedInd ; + unmaskedInd++ ; + } + } + } + else if (1 == dimElement) //axis + { + CAxis* axis = axisListDstP[elementPositionInGridDst2AxisPosition_[elementPositionInGrid]] ; + int nindex_glo=axis->n_glo ; + dstLocalInd.resize(nindex_glo,-1) ; + int nIndex=axis->index.numElements() ; + CArray& localMask=axis->mask ; // axis mask must include later data_index + int unmaskedInd=0 ; + for(int i=0;iindex(i)]=unmaskedInd ; + unmaskedInd++ ; + } + } + } + else //scalar + { + dstLocalInd.resize(1) ; + dstLocalInd[0]=0 ; + } + + vector > > > dstIndWeight(transformationMapping_.size()) ; + + for(int t=0;tfirst] ; + if (dst!=-1) + { + const vector& srcs=itTransMap->second; + const vector& weights=itTransWeight->second; + for(int i=0;i(dst*offset+t,weights[i])) ; + } + } + } + int srcInd=0 ; + int currentInd ; + int t=0 ; + int srcIndCompressed=0 ; + + nonDistributedrecursiveFunct(nElement-1,true,elementPositionInGrid,maskSrc,maskDst, srcInd, srcIndCompressed, nIndexSrc, t, dstIndWeight, + currentInd,localSrc,localDst,weight); + } +CATCH + + +void CGenericAlgorithmTransformation::nonDistributedrecursiveFunct(int currentPos, bool masked, int elementPositionInGrid, + vector< CArray* >& maskSrc, vector< CArray* >& maskDst, + int& srcInd, int& srcIndCompressed, vector& nIndexSrc, + int& t, vector > > >& dstIndWeight, int currentInd, + vector& localSrc, vector& localDst, vector& weight) +TRY +{ + int masked_ ; + if (currentPos!=elementPositionInGrid) + { + if (currentPos!=0) + { + CArray& mask = *maskSrc[currentPos] ; + + for(int i=0;i& mask = *maskSrc[currentPos] ; + for(int i=0;i0) + { + for(vector >::iterator it = dstIndWeight[t][currentInd].begin(); it!=dstIndWeight[t][currentInd].end(); ++it) + { + localSrc.push_back(srcIndCompressed) ; + localDst.push_back(it->first) ; + weight.push_back(it->second) ; + (it->first)++ ; + } + } + if (t < dstIndWeight.size()-1) t++ ; + srcIndCompressed ++ ; + } + srcInd++ ; + } + } + } + else + { + + if (currentPos!=0) + { + CArray& mask = *maskSrc[currentPos] ; + for(int i=0;i0) + { + for(vector >::iterator it = dstIndWeight[t][i].begin(); it!=dstIndWeight[t][i].end(); ++it) + { + localSrc.push_back(srcIndCompressed) ; + localDst.push_back(it->first) ; + weight.push_back(it->second) ; + (it->first)++ ; + } + } + if (t < dstIndWeight.size()-1) t++ ; + srcIndCompressed ++ ; + } + srcInd++ ; + } + } + } +} +CATCH + +/*! + Compute index mapping between element source and element destination with an auxiliary inputs which determine +position of each mapped index in global index of grid destination. + \param [in] dataAuxInputs auxiliary inputs +*/ +void CGenericAlgorithmTransformation::computeIndexSourceMapping(const std::vector* >& dataAuxInputs) +TRY +{ + computeIndexSourceMapping_(dataAuxInputs); +} +CATCH -CTransformFilter* CGenericAlgorithmTransformation::createTransformFilter(CGarbageCollector& gc, shared_ptr algo, bool detectMissingValues, double defaultValue) +std::vector CGenericAlgorithmTransformation::getIdAuxInputs() +TRY { - return new CTransformFilter(gc, 1, algo, detectMissingValues, defaultValue) ; + return idAuxInputs_; } +CATCH -vector CGenericAlgorithmTransformation::getAuxFieldId(void) +CGenericAlgorithmTransformation::AlgoTransType CGenericAlgorithmTransformation::type() +TRY { - return vector() ; + return type_; } +CATCH } diff --git a/xios_2311_src/src/transformation/generic_algorithm_transformation.hpp b/xios_2311_src/src/transformation/generic_algorithm_transformation.hpp index 296d04dd62c17f1630b4c355d3cc995d13f95d2e..d5af78a5ea9057ff0fa459f662091335c9add971 100644 --- a/xios_2311_src/src/transformation/generic_algorithm_transformation.hpp +++ b/xios_2311_src/src/transformation/generic_algorithm_transformation.hpp @@ -13,46 +13,163 @@ #include #include "array_new.hpp" #include "client_client_dht_template.hpp" -#include "local_view.hpp" -#include "transform_connector.hpp" -#include "weight_transform_connector.hpp" -namespace xios -{ +namespace xios { class CGrid; class CDomain; class CAxis; class CScalar; - class CGridAlgorithm ; - class CTransformFilter ; - class CGarbageCollector ; /*! \class CGenericAlgorithmTransformation This class defines the interface for all other inherited algorithms class */ -class CGenericAlgorithmTransformation : public std::enable_shared_from_this +class CGenericAlgorithmTransformation { - public : - CGenericAlgorithmTransformation(bool isSource) ; - virtual shared_ptr createGridAlgorithm(CGrid* gridSrc, CGrid* newGrid, int pos) ; - virtual CTransformFilter* createTransformFilter(CGarbageCollector& gc, shared_ptr algo, bool detectMissingValues, double defaultValue) ; - virtual void apply(int dimBefore, int dimAfter, const CArray& dataIn, CArray& dataOut) { abort() ;} //=0 - virtual void apply(int dimBefore, int dimAfter, const CArray& dataIn, const vector>& auxData, CArray& dataOut) { abort() ;} //=0 - virtual bool isGenerateTransformation(void) { return false ;} - virtual StdString getAlgoName() { return "\\nGeneric algorithm transformation";} - virtual bool transformAuxField(int pos) { return true ;} - virtual vector getAuxFieldId(void) ; - protected : - typedef std::unordered_map > TransformationIndexMap; - typedef std::unordered_map > TransformationWeightMap; - - shared_ptr recvElement_ ; - bool isSource_ ; - - public: - shared_ptr getRecvElement(void) { return recvElement_ ;} +public: + enum AlgoTransType { + ELEMENT_GENERATION = 0, + ELEMENT_MODIFICATION_WITHOUT_DATA = 1, + ELEMENT_MODIFICATION_WITH_DATA = 2, + ELEMENT_NO_MODIFICATION_WITH_DATA = 3, + ELEMENT_NO_MODIFICATION_WITHOUT_DATA = 4 + } ; + +public: + // Mapping between global index map of DESTINATION and its local index with pair of global index of SOURCE and weights + typedef std::unordered_map > > > SourceDestinationIndexMap; + +protected: + typedef std::unordered_map GlobalLocalMap; +protected: + typedef std::unordered_map > TransformationIndexMap; + typedef std::unordered_map > TransformationWeightMap; + typedef std::unordered_map > TransformationPositionMap; + +public: + CGenericAlgorithmTransformation(); + + virtual ~CGenericAlgorithmTransformation() {} + + bool isDistributedTransformation(int elementPositionInGrid, CGrid* gridSrc, CGrid* gridDst) ; + + void computeGlobalSourceIndex(int elementPositionInGrid, + CGrid* gridSrc, + CGrid* gridDst, + SourceDestinationIndexMap& globaIndexWeightFromSrcToDst); + + /*! + Apply a operation on local data. + \param [in] localIndex vector contains local index of local data output and the corresponding weight + \param [in] dataInput Pointer to the first element of data input array (in form of buffer) + \param [in/out] dataOut Array contains local data + \param [in/out] flagInitial vector of boolean to mark the local index already initialized. True means there is a need for initalization + \param [in] ignoreMissingValue don't count missing value in operation if this flag is true + \param [in] firstPass indicate if it is the first time the apply funtion is called for a same transformation, in order to make a clean initialization + */ + virtual void apply(const std::vector >& localIndex, + const double* dataInput, + CArray& dataOut, + std::vector& flagInitial, + bool ignoreMissingValue, bool firstPass); + + virtual StdString getName() {return "Generic Transformation";} + + /*! + * Update whole dataOut (on necessary). + * (Example: Impose a weight, whose value is only known after being applied an operation, on dataOut) + * \param [in/out] dataOut dataOut + */ + virtual void updateData(CArray& dataOut); + + std::vector getIdAuxInputs(); + AlgoTransType type(); + /*! + Compute global index mapping from one element of destination grid to the corresponding element of source grid + */ + void computeIndexSourceMapping(const std::vector* >& dataAuxInputs = std::vector* >()); + void computeTransformationMappingNonDistributed(int elementPositionInGrid, CGrid* gridSrc, CGrid* gridDst, + vector& localSrc, vector& localDst, vector& weight, int& nbLocalIndexOnGridDest); + void nonDistributedrecursiveFunct(int currentPos, bool masked, int elementPositionInGrid, vector< CArray* >& maskSrc, vector< CArray* >& maskDst, + int& srcInd, int& srcIndCompressed, vector& nIndexSrc, + int& t, vector > > >& dstIndWeight, int currentInd, + vector& localSrc, vector& localDst, vector& weight) ; + +protected: + virtual void computeIndexSourceMapping_(const std::vector* >&) = 0; + + /*! + Compute proc which contains global index of an element + \param[in] globalElementIndex demanding global index of an element of source grid + \param[in] elementType type of source element, 2: domain, 1: axis and 0: scalar + \param[out] globalElementIndexOnProc Proc contains the demanding global index + */ + virtual void computeExchangeGlobalIndex(const CArray& globalElementIndex, + int elementType, + CClientClientDHTInt::Index2VectorInfoTypeMap& globalElementIndexOnProc) = 0; + +protected: + void computeGlobalGridIndexMapping(int elementPositionInGrid, + const std::vector& srcRank, + std::unordered_map > >& src2DstMap, + CGrid* gridDst, + CGrid* gridSrc, + std::vector > >& globalElementIndexOnProc, + SourceDestinationIndexMap& globaIndexWeightFromSrcToDst); + + void computeExchangeDomainIndex(CDomain* domainDst, + CDomain* domainSrc, + CArray& destGlobalIndexPositionInGrid, + std::unordered_map >& globalDomainIndexOnProc); + + void computeExchangeAxisIndex(CAxis* axisDst, + CAxis* axisSrc, + CArray& destGlobalIndexPositionInGrid, + std::unordered_map >& globalAxisIndexOnProc); + + void computeExchangeScalarIndex(CScalar* scalarDst, + CScalar* scalarSrc, + CArray& destGlobalIndexPositionInGrid, + std::unordered_map >& globalScalarIndexOnProc); + + void computePositionElements(CGrid* dst, CGrid* src); + +protected: + //! indicate if the transformation is performed on a distributed element + bool isDistributed_ ; + //! indicate if the method isDistributedTransformation has been called before + bool isDistributedComputed_ ; + //! Map between global index of destination element and source element + std::vector transformationMapping_; + //! Weight corresponding of source to destination + std::vector transformationWeight_; + //! Map of global index of destination element and corresponding global index of other elements in the same grid + //! By default, one index of an element corresponds to all index of remaining element in the grid. So it's empty + std::vector transformationPosition_; + + //! Id of auxillary inputs which helps doing transformation dynamically + std::vector idAuxInputs_; + AlgoTransType type_; + + std::set indexElementSrc_; + + std::vector > > globalElementIndexOnProc_; + + std::vector procContainSrcElementIdx_; // List of processes containing source index of transformed elements +// std::set procOfNonTransformedElements_; // Processes contain the source index of non-transformed elements + std::set commonProc_; + std::vector< set > procElementList_ ; // List of processes containing source index of elements + + CClientClientDHTInt::Index2VectorInfoTypeMap globalIndexOfTransformedElementOnProc_; + + bool computedProcSrcNonTransformedElement_; // Flag to indicate whether we computed proc containing non transformed elements + + std::map elementPositionInGridSrc2AxisPosition_, elementPositionInGridSrc2DomainPosition_, elementPositionInGridSrc2ScalarPosition_; + std::map elementPositionInGridDst2AxisPosition_, elementPositionInGridDst2DomainPosition_, elementPositionInGridDst2ScalarPosition_; + + bool eliminateRedondantSrc_ ; // flag to indicate if the transformation must select only one global source point for all proc. + // In this case it will choose preferentially the current process }; } diff --git a/xios_2311_src/src/transformation/grid_algorithm.cpp b/xios_2311_src/src/transformation/grid_algorithm.cpp deleted file mode 100755 index 25b43ea18ad0d952401c2c4421db35050c17d903..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/grid_algorithm.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "grid_algorithm.hpp" -#include "generic_algorithm_transformation.hpp" - -namespace xios -{ - - CTransformFilter* CGridAlgorithm::createTransformFilter(CGarbageCollector& gc, bool detectMissingValues, double defaultValue) - { - return algorithm_->createTransformFilter(gc, shared_from_this(), detectMissingValues, defaultValue) ; - } - - bool CGridAlgorithm::isGenerateTranformation(void) - { - return algorithm_->isGenerateTransformation() ; - } - - - StdString CGridAlgorithm::getAlgoName() - { - return algorithm_->getAlgoName(); - } -} diff --git a/xios_2311_src/src/transformation/grid_algorithm.hpp b/xios_2311_src/src/transformation/grid_algorithm.hpp deleted file mode 100755 index 287a8b1ef78c92e1dfc0058f5050dce54135b0db..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/grid_algorithm.hpp +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef __XIOS_GRID_ALGORITHM_HPP__ -#define __XIOS_GRID_ALGORITHM_HPP__ - -#include "grid_transform_connector.hpp" -#include -#include "array_new.hpp" -#include "local_view.hpp" - -namespace xios -{ - class CGrid; - class CGenericAlgorithmTransformation ; - - /*! - \class CGenericAlgorithmTransformation - This class defines the interface for all other inherited algorithms class - */ -class CTransformFilter ; -class CGarbageCollector ; - -class CGridAlgorithm : public std::enable_shared_from_this -{ - public: - CGridAlgorithm(shared_ptr algorithm) : algorithm_(algorithm) {} ; - virtual ~CGridAlgorithm() {} ; - virtual void apply(const CArray& dataIn, CArray& dataOut) { abort(); } //=0 - virtual void apply(const CArray& dataIn, const vector>& auxData, CArray& dataOut) { abort(); } //=0 - virtual CTransformFilter* createTransformFilter(CGarbageCollector& gc, bool detectMissingValues, double defaultValue) ; - virtual bool isGenerateTranformation(void) ; - virtual StdString getAlgoName() ; - - protected: - shared_ptr algorithm_=nullptr ; -}; - -} -#endif // __XIOS_GRID_ALGORITHM_TRANSFORMATION_HPP__ diff --git a/xios_2311_src/src/transformation/grid_algorithm_generic.cpp b/xios_2311_src/src/transformation/grid_algorithm_generic.cpp deleted file mode 100755 index 89f59f35b7a44d1552cbdbe212c390241c49185e..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/grid_algorithm_generic.cpp +++ /dev/null @@ -1,76 +0,0 @@ -#include "grid_algorithm_generic.hpp" -#include "grid_elements.hpp" -#include "grid_local_view.hpp" -#include "grid.hpp" -#include "algo_types.hpp" -#include "context.hpp" -#include "transform_filter.hpp" - -namespace xios -{ - - CGridAlgorithmGeneric::CGridAlgorithmGeneric(CGrid* gridSrc, CGrid* gridDst, int pos, shared_ptr algo) - : CGridAlgorithm(algo), gridSrc_(gridSrc), gridDst_(gridDst), pos_(pos) - { - } - - void CGridAlgorithmGeneric::computeAlgorithm(bool eliminateRedondant) - { - shared_ptr gridSrcElements = gridSrc_->getGridLocalElements() ; - shared_ptr gridDstElements = gridDst_->getGridLocalElements() ; - - shared_ptr srcView = gridSrcElements->getView(CElementView::WORKFLOW) ; - shared_ptr dstView = gridDstElements->getView(CElementView::WORKFLOW) ; - MPI_Comm comm = CContext::getCurrent()->getIntraComm() ; - int commSize = CContext::getCurrent()->getIntraCommSize() ; - int commRank = CContext::getCurrent()->getIntraCommRank() ; - - auto& elements = gridSrcElements->getElements() ; - int nElements = elements.size() ; - vector> remoteElements(nElements) ; - vector> remoteViews(nElements) ; - for(int i=0;igetRecvElement() ; - else - { - CArray globalIndexView ; - srcView->getView(i)->getGlobalIndexView(globalIndexView) ; - remoteElements[i] = make_shared(commRank, srcView->getView(i)->getGlobalSize(),globalIndexView) ; - remoteElements[i]->addFullView() ; - if (i>pos_) dimBefore_ *= srcView->getView(i)->getSize() ; - else dimAfter_ *= srcView->getView(i)->getSize() ; - - } - remoteViews[i] = remoteElements[i] -> getView(CElementView::FULL); - } - - gridTransformConnector_ = make_shared(srcView->getViews(), remoteViews, comm ) ; - gridTransformConnector_->computeConnector(eliminateRedondant) ; - - } - - void CGridAlgorithmGeneric::apply(const CArray& dataIn, CArray& dataOut) - { - CArray dataOutTmp ; - gridTransformConnector_->transfer(dataIn, dataOutTmp) ; - algorithm_->apply(dimBefore_, dimAfter_, dataOutTmp, dataOut) ; - } - - void CGridAlgorithmGeneric::apply(const CArray& dataIn, const vector>& auxData, CArray& dataOut) - { - CArray dataOutTmp ; - vector> auxDataOutTmp(auxData.size()) ; - - gridTransformConnector_->transfer(dataIn, dataOutTmp) ; - for (int i=0; itransformAuxField(i)) gridTransformConnector_->transfer(auxData[i], auxDataOutTmp[i]) ; - else auxDataOutTmp[i].reference(auxData[i]) ; - } - - algorithm_->apply(dimBefore_, dimAfter_, dataOutTmp, auxDataOutTmp, dataOut) ; - } - - -} \ No newline at end of file diff --git a/xios_2311_src/src/transformation/grid_algorithm_generic.hpp b/xios_2311_src/src/transformation/grid_algorithm_generic.hpp deleted file mode 100755 index 70b7c29b560d3d5f07d720cd2d783d87e2fa2be9..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/grid_algorithm_generic.hpp +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef __XIOS_GRID_ALGORITHM_GENERIC_HPP__ -#define __XIOS_GRID_ALGORITHM_GENERIC_HPP__ - -#include "grid_transform_connector.hpp" -#include -#include "array_new.hpp" -#include "local_view.hpp" -#include "grid_algorithm.hpp" - -namespace xios -{ - class CGrid; - class CGenericAlgorithmTransformation ; - - /*! - \class CGenericAlgorithmTransformation - This class defines the interface for all other inherited algorithms class - */ -class CTransformFilter ; -class CGarbageCollector ; - -class CGridAlgorithmGeneric : public CGridAlgorithm -{ - public: - CGridAlgorithmGeneric(CGrid* gridSrc, CGrid* gridDst, int pos, shared_ptr algo) ; - virtual ~CGridAlgorithmGeneric() {} ; - - void computeAlgorithm(bool eliminateRedundant=true) ; - virtual void apply(const CArray& dataIn, CArray& dataOut) ; - virtual void apply(const CArray& dataIn, const vector>& auxData, CArray& dataOut) ; - - protected: - - shared_ptr gridTransformConnector_=nullptr ; - CGrid* gridSrc_ = nullptr ; - CGrid* gridDst_ = nullptr ; - int pos_ ; - int dimBefore_=1 ; - int dimAfter_=1 ; - -}; - -} -#endif // __XIOS_GRID_ALGORITHM_GENERIC_HPP__ diff --git a/xios_2311_src/src/transformation/grid_algorithm_no_data_modification.cpp b/xios_2311_src/src/transformation/grid_algorithm_no_data_modification.cpp deleted file mode 100755 index 0cd1a819e53ffa236afdc9d7ae658713e8e88876..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/grid_algorithm_no_data_modification.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "grid_algorithm_no_data_modification.hpp" - -namespace xios -{ - void CGridAlgorithmNoDataModification::apply(const CArray& dataIn, CArray& dataOut) - { - dataOut.reference(dataIn) ; - } - -} \ No newline at end of file diff --git a/xios_2311_src/src/transformation/grid_algorithm_no_data_modification.hpp b/xios_2311_src/src/transformation/grid_algorithm_no_data_modification.hpp deleted file mode 100755 index 10ac4f28ce4b762cfd35853330ef3e4f9eb92733..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/grid_algorithm_no_data_modification.hpp +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef __XIOS_GRID_ALGORITHM_NO_DATA_MODIFICATION_HPP__ -#define __XIOS_GRID_ALGORITHM_NO_DATA_MODIFICATION_HPP__ - -#include "grid_algorithm.hpp" -namespace xios -{ - class CGrid; - class CGenericAlgorithmTransformation ; - - /*! - \class CGenericAlgorithmTransformation - This class defines the interface for all other inherited algorithms class - */ -class CTransformFilter ; -class CGarbageCollector ; -class CGenericAlgorithmTransformation ; - -class CGridAlgorithmNoDataModification : public CGridAlgorithm -{ - public: - CGridAlgorithmNoDataModification(shared_ptr algo) : CGridAlgorithm(algo) {} - ~CGridAlgorithmNoDataModification(void) {}; - void computeAlgorithm(void) {} ; - virtual void apply(const CArray& dataIn, CArray& dataOut) ; -}; - -} -#endif // __XIOS_GRID_ALGORITHM_NO_DATA_MODIFICATION_HPP__ diff --git a/xios_2311_src/src/transformation/grid_algorithm_reduce.cpp b/xios_2311_src/src/transformation/grid_algorithm_reduce.cpp deleted file mode 100755 index 29950597c2d258d8348f04fbd9bb744838ad3293..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/grid_algorithm_reduce.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "grid_algorithm_reduce.hpp" -#include "algo_types.hpp" - -namespace xios -{ - - void CGridAlgorithmReduce::apply(const CArray& dataIn, CArray& dataOut) - { - CArray dataOutTmp ; - gridTransformConnector_->transfer(dataIn, dataOutTmp, operator_) ; - algorithm_->apply(dimBefore_, dimAfter_, dataOutTmp, dataOut) ; - } -} \ No newline at end of file diff --git a/xios_2311_src/src/transformation/grid_algorithm_reduce.hpp b/xios_2311_src/src/transformation/grid_algorithm_reduce.hpp deleted file mode 100755 index 9db6e712107051e4d8743e797eb0eb673eeb5d46..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/grid_algorithm_reduce.hpp +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef __XIOS_GRID_ALGORITHM_REDUCE_HPP__ -#define __XIOS_GRID_ALGORITHM_REDUCE_HPP__ - -#include "grid_transform_connector.hpp" -#include -#include "array_new.hpp" -#include "local_view.hpp" -#include "grid_algorithm_generic.hpp" -#include "reduction_types.hpp" - -namespace xios -{ - class CGrid; - class CGenericAlgorithmTransformation ; - - /*! - \class CGenericAlgorithmTransformation - This class defines the interface for all other inherited algorithms class - */ - class CTransformFilter ; - class CGarbageCollector ; - - class CGridAlgorithmReduce : public CGridAlgorithmGeneric - { - public: - CGridAlgorithmReduce(CGrid* gridSrc, CGrid* gridDst, int pos, shared_ptr algo, EReduction op) - : CGridAlgorithmGeneric(gridSrc, gridDst, pos, algo), operator_(op) {} - virtual ~CGridAlgorithmReduce() {} - - virtual void apply(const CArray& dataIn, CArray& dataOut) ; - - protected: - - EReduction operator_ ; // reduction operator to apply - - }; - -} - -#endif // __XIOS_GRID_ALGORITHM_REDUCE_HPP__ \ No newline at end of file diff --git a/xios_2311_src/src/transformation/grid_transformation_factory_impl.hpp b/xios_2311_src/src/transformation/grid_transformation_factory_impl.hpp index afc808e6d95d5c895ac3d496ea77f3e8f1ba08b9..ef0826bc4db0f46fa9fc100732c3b34705bb62c1 100644 --- a/xios_2311_src/src/transformation/grid_transformation_factory_impl.hpp +++ b/xios_2311_src/src/transformation/grid_transformation_factory_impl.hpp @@ -32,7 +32,7 @@ public: CGridTransformationFactory() {} virtual ~CGridTransformationFactory() {} - static shared_ptr createTransformation(ETranformationType transType, bool isSource, + static CGenericAlgorithmTransformation* createTransformation(ETranformationType transType, CGrid* gridDst, CGrid* gridSrc, CTransformation* transformation, int elementPositionInGrid, @@ -44,7 +44,7 @@ public: std::map& elementPositionInGridDst2DomainPosition); public: - typedef shared_ptr (*CreateTransformationCallBack)(bool isSource, CGrid* gridDst, CGrid* gridSrc, + typedef CGenericAlgorithmTransformation* (*CreateTransformationCallBack)(CGrid* gridDst, CGrid* gridSrc, CTransformation* transformation, int elementPositionInGrid, std::map& elementPositionInGridSrc2ScalarPosition, @@ -59,7 +59,6 @@ public: static bool registerTransformation(ETranformationType transType, CreateTransformationCallBack createFn); static bool unregisterTransformation(ETranformationType transType); static bool initializeTransformation_; - static void unregisterAllTransformations(void) ; }; template @@ -68,7 +67,7 @@ template bool CGridTransformationFactory::initializeTransformation_ = false; template -shared_ptr CGridTransformationFactory::createTransformation(ETranformationType transType, bool isSource, +CGenericAlgorithmTransformation* CGridTransformationFactory::createTransformation(ETranformationType transType, CGrid* gridDst, CGrid* gridSrc, CTransformation* transformation, int elementPositionInGrid, @@ -86,7 +85,7 @@ shared_ptr CGridTransformationFactory::creat << "Transformation type " << transType << "doesn't exist. Please define."); } - return (it->second)(isSource, gridDst, gridSrc, transformation, elementPositionInGrid, + return (it->second)(gridDst, gridSrc, transformation, elementPositionInGrid, elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, @@ -98,7 +97,7 @@ shared_ptr CGridTransformationFactory::creat template bool CGridTransformationFactory::registerTransformation(ETranformationType transType, CreateTransformationCallBack createFn) { - if (nullptr == transformationCreationCallBacks_) + if (0 == transformationCreationCallBacks_) transformationCreationCallBacks_ = new CallBackMap(); return (*transformationCreationCallBacks_).insert(make_pair(transType, createFn)).second; @@ -110,16 +109,6 @@ bool CGridTransformationFactory::unregisterTransformation(ETranformationType return (1 == (*transformationCreationCallBacks_).erase(transType)); } -template -void CGridTransformationFactory::unregisterAllTransformations(void) -{ - if (nullptr != transformationCreationCallBacks_) - { - transformationCreationCallBacks_->clear() ; - delete transformationCreationCallBacks_; - } -} } - #endif // __XIOS_GRID_TRANSFORMATION_FACTORY_HPP__ diff --git a/xios_2311_src/src/transformation/scalar_algorithm/scalar_algorithm_extract_axis.cpp b/xios_2311_src/src/transformation/scalar_algorithm/scalar_algorithm_extract_axis.cpp deleted file mode 100755 index 3c5b36047a5b0490e5f3d655abe6ba1bf53168a9..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/scalar_algorithm/scalar_algorithm_extract_axis.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/*! - \file scalar_algorithm_extract_scalar.cpp - \author Ha NGUYEN - \since 23 June 2016 - \date 23 June 2016 - - \brief Algorithm for extract an axis to a scalar - */ -#include "scalar_algorithm_extract_axis.hpp" -#include "axis.hpp" -#include "scalar.hpp" -#include "extract_axis_to_scalar.hpp" -#include "grid.hpp" -#include "grid_transformation_factory_impl.hpp" - -#include "reduction.hpp" - -namespace xios { -shared_ptr CScalarAlgorithmExtractAxis::create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) -TRY -{ - std::vector scalarListDestP = gridDst->getScalars(); - std::vector axisListSrcP = gridSrc->getAxis(); - - CExtractAxisToScalar* extractAxis = dynamic_cast (transformation); - int scalarDstIndex = elementPositionInGridDst2ScalarPosition[elementPositionInGrid]; - int axisSrcIndex = elementPositionInGridSrc2AxisPosition[elementPositionInGrid]; - - return make_shared(isSource, scalarListDestP[scalarDstIndex], axisListSrcP[axisSrcIndex], extractAxis); -} -CATCH - -bool CScalarAlgorithmExtractAxis::dummyRegistered_ = CScalarAlgorithmExtractAxis::registerTrans(); -bool CScalarAlgorithmExtractAxis::registerTrans() -TRY -{ - return CGridTransformationFactory::registerTransformation(TRANS_EXTRACT_AXIS_TO_SCALAR, create); -} -CATCH - -CScalarAlgorithmExtractAxis::CScalarAlgorithmExtractAxis(bool isSource, CScalar* scalarDestination, CAxis* axisSource, CExtractAxisToScalar* algo) - : CAlgorithmTransformationTransfer(isSource) -TRY -{ - scalarDestination->mask.reset(); - scalarDestination->value.reset(); - scalarDestination->n.reset(); - - algo->checkValid(scalarDestination, axisSource); - pos_ = algo->position; - - scalarDestination->mask.setValue( false ); // scalar do not contain data_index, WF view set looking at mask - scalarDestination->n.setValue( 0 ); - - // ---------------------------- - bool scalarOnThisAxisPiece(false); - CArray sourceGlobalIdx = axisSource->getLocalElement()->getGlobalIndex(); - int indexSize = sourceGlobalIdx.numElements(); - int idxSrc(-1); - for (int countSrc = 0; countSrc < indexSize ; ++countSrc) - { - if ( sourceGlobalIdx(countSrc) == pos_ ) - { - scalarOnThisAxisPiece = true; - idxSrc = countSrc; - } - } - - int idxMin = INT_MAX; - for (int countSrc = 0; countSrc < indexSize ; ++countSrc) - { - if ( sourceGlobalIdx(countSrc) < idxMin ) - idxMin = sourceGlobalIdx(countSrc); - } - - CArray sourceWorkflowIdx = axisSource->getLocalView(CElementView::WORKFLOW)->getIndex(); - int srcWorkflowSize = sourceWorkflowIdx.numElements(); - - - if (scalarOnThisAxisPiece) - { - int iIdxSrc2 = (idxSrc+idxMin)%axisSource->n_glo; - int convert_locally_global_idx = (iIdxSrc2-idxMin) ; - bool concerned_by_WF(false); - for ( int i = 0 ; itransformationMapping_[0]=pos_ ; - scalarDestination->mask.setValue( true ); - scalarDestination->n.setValue( 1 ); - } - - if (axisSource->hasValue) - { - scalarDestination->value = axisSource->value(idxSrc); - } - } - // ---------------------------- - - scalarDestination->checkAttributes() ; - this->computeAlgorithm(axisSource->getLocalView(CElementView::WORKFLOW), scalarDestination->getLocalView(CElementView::WORKFLOW)) ; -} -CATCH - - - -} diff --git a/xios_2311_src/src/transformation/scalar_algorithm/scalar_algorithm_extract_axis.hpp b/xios_2311_src/src/transformation/scalar_algorithm/scalar_algorithm_extract_axis.hpp deleted file mode 100755 index 48a84b47ee543b80903f228c2416ce03680c62a8..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/scalar_algorithm/scalar_algorithm_extract_axis.hpp +++ /dev/null @@ -1,54 +0,0 @@ -/*! - \file scalar_algorithm_extract_scalar.hpp - \author Ha NGUYEN - \since 23 June 2016 - \date 23 June 2016 - - \brief Algorithm for extract an axis to a scalar - */ -#ifndef __XIOS_SCALAR_ALGORITHM_EXTRACT_AXIS_HPP__ -#define __XIOS_SCALAR_ALGORITHM_EXTRACT_AXIS_HPP__ - -#include "algorithm_transformation_transfer.hpp" -#include "transformation.hpp" - -namespace xios { - -class CScalar; -class CAxis; -class CExtractAxisToScalar; -class CReductionAlgorithm; - -/*! - \class CScalarAlgorithmExtractAxis - Extract a scalar from an axis -*/ -class CScalarAlgorithmExtractAxis : public CAlgorithmTransformationTransfer -{ -public: - CScalarAlgorithmExtractAxis(bool isSource, CScalar* scalarDestination, CAxis* axisSource, CExtractAxisToScalar* algo); - - - virtual ~CScalarAlgorithmExtractAxis() {} ; - - static bool registerTrans(); - virtual StdString getAlgoName() {return "\\nextract_axis";} - -protected: - int pos_; - -public: - static shared_ptr create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition); - static bool dummyRegistered_; -}; - -} -#endif // __XIOS_SCALAR_ALGORITHM_EXTRACT_AXIS_HPP__ diff --git a/xios_2311_src/src/transformation/scalar_algorithm/scalar_algorithm_reduce_axis.cpp b/xios_2311_src/src/transformation/scalar_algorithm/scalar_algorithm_reduce_axis.cpp deleted file mode 100755 index 877f165b74c87714224b2e98a88c5e2131d97b70..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/scalar_algorithm/scalar_algorithm_reduce_axis.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/*! - \file scalar_algorithm_reduce_scalar.cpp - \author Ha NGUYEN - \since 23 June 2016 - \date 23 June 2016 - - \brief Algorithm for reduce an axis to a scalar - */ -#include "scalar_algorithm_reduce_axis.hpp" -#include "axis.hpp" -#include "scalar.hpp" -#include "reduce_axis_to_scalar.hpp" -#include "grid.hpp" -#include "grid_transformation_factory_impl.hpp" -#include "reduction.hpp" - -#include "reduction.hpp" - -namespace xios { -shared_ptr CScalarAlgorithmReduceAxis::create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) -TRY -{ - std::vector scalarListDestP = gridDst->getScalars(); - std::vector axisListSrcP = gridSrc->getAxis(); - - CReduceAxisToScalar* reduceAxis = dynamic_cast (transformation); - int scalarDstIndex = elementPositionInGridDst2ScalarPosition[elementPositionInGrid]; - int axisSrcIndex = elementPositionInGridSrc2AxisPosition[elementPositionInGrid]; - - return make_shared(isSource, scalarListDestP[scalarDstIndex], axisListSrcP[axisSrcIndex], reduceAxis); -} -CATCH - -bool CScalarAlgorithmReduceAxis::dummyRegistered_ = CScalarAlgorithmReduceAxis::registerTrans(); -bool CScalarAlgorithmReduceAxis::registerTrans() -TRY -{ - return CGridTransformationFactory::registerTransformation(TRANS_REDUCE_AXIS_TO_SCALAR, create); -} -CATCH - -CScalarAlgorithmReduceAxis::CScalarAlgorithmReduceAxis(bool isSource, CScalar* scalarDestination, CAxis* axisSource, CReduceAxisToScalar* algo) - : CAlgorithmTransformationReduce(isSource) -TRY -{ - if (algo->operation.isEmpty()) - ERROR("CScalarAlgorithmReduceAxis::CScalarAlgorithmReduceAxis(CAxis* axisDestination, CAxis* axisSource, CReduceAxisToScalar* algo)", - << "Operation must be defined." - << "Axis source " <getId() << std::endl - << "Scalar destination " << scalarDestination->getId()); - StdString op; - switch (algo->operation) - { - case CReduceAxisToScalar::operation_attr::sum: - operator_ = EReduction::sum; - break; - case CReduceAxisToScalar::operation_attr::min: - operator_ = EReduction::min; - break; - case CReduceAxisToScalar::operation_attr::max: - operator_ = EReduction::max; - break; - case CReduceAxisToScalar::operation_attr::average: - operator_ = EReduction::average; - break; - default: - ERROR("CScalarAlgorithmReduceAxis::CScalarAlgorithmReduceAxis(CScalar* scalarDestination, CAxis* axisSource, CReduceAxisToScalar* algo)", - << "Operation is wrongly defined. Supported operations: sum, min, max, average." << std::endl - << "Domain source " <getId() << std::endl - << "Scalar destination " << scalarDestination->getId()); - - } - - bool local=false ; - if (!algo->local.isEmpty()) local=algo->local ; - - auto& transMap = this->transformationMapping_; - - if (local) - { - scalarDestination->n=1 ; // no mask - scalarDestination->mask.reset() ; - - CArray srcGlobalIndex ; - axisSource->getLocalView(CElementView::WORKFLOW)->getGlobalIndexView(srcGlobalIndex) ; - size_t nbIdx = srcGlobalIndex.numElements(); - if (nbIdx==0) scalarDestination->n=0 ; - scalarDestination->checkAttributes() ; - - for (size_t idx = 0; idx < nbIdx; ++idx) - { - size_t globalIdx = srcGlobalIndex(idx); - transformationMapping_[0].push_back(globalIdx); - } - - } - else - { - scalarDestination->checkAttributes() ; - - int globalIndexSize = axisSource->getLocalView(CElementView::WORKFLOW)->getGlobalSize(); - CArray dstGlobalIndex ; - scalarDestination->getLocalView(CElementView::WORKFLOW)->getGlobalIndexView(dstGlobalIndex) ; - if (dstGlobalIndex.numElements()!=0) - for (int idx = 0; idx < globalIndexSize; ++idx) transformationMapping_[0].push_back(idx); - } - - this->computeAlgorithm(axisSource->getLocalView(CElementView::WORKFLOW), scalarDestination->getLocalView(CElementView::WORKFLOW)) ; - -} -CATCH - - -CScalarAlgorithmReduceAxis::~CScalarAlgorithmReduceAxis() -TRY -{ -} -CATCH - -} diff --git a/xios_2311_src/src/transformation/scalar_algorithm/scalar_algorithm_reduce_axis.hpp b/xios_2311_src/src/transformation/scalar_algorithm/scalar_algorithm_reduce_axis.hpp deleted file mode 100755 index 389279e019fb3d2f170d69e418b9c5a10511f4be..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/scalar_algorithm/scalar_algorithm_reduce_axis.hpp +++ /dev/null @@ -1,52 +0,0 @@ -/*! - \file scalar_algorithm_reduce_scalar.hpp - \author Ha NGUYEN - \since 23 June 2016 - \date 23 June 2016 - - \brief Algorithm for reduce an axis to a scalar - */ -#ifndef __XIOS_SCALAR_ALGORITHM_REDUCE_AXIS_HPP__ -#define __XIOS_SCALAR_ALGORITHM_REDUCE_AXIS_HPP__ - -#include "algorithm_transformation_reduce.hpp" -#include "transformation.hpp" - -namespace xios { - -class CScalar; -class CAxis; -class CReduceAxisToScalar; -class CReductionAlgorithm; - -/*! - \class CScalarAlgorithmReduceAxis - Reducing an axis to a scalar -*/ -class CScalarAlgorithmReduceAxis : public CAlgorithmTransformationReduce -{ -public: - CScalarAlgorithmReduceAxis(bool isSource, CScalar* scalarDestination, CAxis* axisSource, CReduceAxisToScalar* algo); - - - virtual ~CScalarAlgorithmReduceAxis(); - - static bool registerTrans(); - - virtual StdString getAlgoName() {return "\\nreduce_axis";} - -public: - static shared_ptr create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition); - static bool dummyRegistered_; -}; - -} -#endif // __XIOS_SCALAR_ALGORITHM_REDUCE_AXIS_HPP__ diff --git a/xios_2311_src/src/transformation/scalar_algorithm/scalar_algorithm_reduce_domain.cpp b/xios_2311_src/src/transformation/scalar_algorithm/scalar_algorithm_reduce_domain.cpp deleted file mode 100755 index 098b736e3c348a31e1136a693b9ffb7464f01d85..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/scalar_algorithm/scalar_algorithm_reduce_domain.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/*! - \file scalar_algorithm_reduce_domain.cpp - \author Ha NGUYEN - \since 23 June 2016 - \date 23 June 2016 - - \brief Algorithm for reduce a domain to a scalar - */ -#include "scalar_algorithm_reduce_domain.hpp" -#include "domain.hpp" -#include "scalar.hpp" -#include "reduce_domain_to_scalar.hpp" -#include "grid.hpp" -#include "grid_transformation_factory_impl.hpp" - -namespace xios { -shared_ptr CScalarAlgorithmReduceDomain::create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) -TRY -{ - std::vector scalarListDestP = gridDst->getScalars(); - std::vector domainListSrcP = gridSrc->getDomains(); - - CReduceDomainToScalar* reduceDomain = dynamic_cast (transformation); - int scalarDstIndex = elementPositionInGridDst2ScalarPosition[elementPositionInGrid]; - int domainSrcIndex = elementPositionInGridSrc2DomainPosition[elementPositionInGrid]; - - return make_shared(isSource, scalarListDestP[scalarDstIndex], domainListSrcP[domainSrcIndex], reduceDomain); -} -CATCH - -bool CScalarAlgorithmReduceDomain::dummyRegistered_ = CScalarAlgorithmReduceDomain::registerTrans(); -bool CScalarAlgorithmReduceDomain::registerTrans() -TRY -{ - return CGridTransformationFactory::registerTransformation(TRANS_REDUCE_DOMAIN_TO_SCALAR, create); -} -CATCH - -CScalarAlgorithmReduceDomain::CScalarAlgorithmReduceDomain(bool isSource, CScalar* scalarDestination, CDomain* domainSource, CReduceDomainToScalar* algo) - : CAlgorithmTransformationReduce(isSource), domainSrc_(domainSource) -TRY -{ - algo->checkValid(scalarDestination, domainSource); - - StdString op; - switch (algo->operation) - { - case CReduceDomainToScalar::operation_attr::sum: - operator_ = EReduction::sum; - break; - case CReduceDomainToScalar::operation_attr::min: - operator_ = EReduction::min; - break; - case CReduceDomainToScalar::operation_attr::max: - operator_ = EReduction::max; - break; - case CReduceDomainToScalar::operation_attr::average: - operator_ = EReduction::average; - break; - default: - ERROR("CScalarAlgorithmReduceDomain::CScalarAlgorithmReduceDomain(CDomain* domainDestination, CDomain* domainSource, CReduceDomainToScalar* algo)", - << "Operation must be defined." - << "Domain source " <getId() << std::endl - << "Scalar destination " << scalarDestination->getId()); - - } - - bool local=false ; - if (!algo->local.isEmpty()) local=algo->local ; - - auto& transMap = this->transformationMapping_; - - if (local) - { - scalarDestination->n=1 ; // no mask - scalarDestination->mask.reset() ; - - CArray srcGlobalIndex ; - domainSource->getLocalView(CElementView::WORKFLOW)->getGlobalIndexView(srcGlobalIndex) ; - size_t nbIdx = srcGlobalIndex.numElements(); - if (nbIdx==0) scalarDestination->n=0 ; - scalarDestination->checkAttributes() ; - - for (size_t idx = 0; idx < nbIdx; ++idx) - { - size_t globalIdx = srcGlobalIndex(idx); - transformationMapping_[0].push_back(globalIdx); - } - - } - else - { - scalarDestination->checkAttributes() ; - - int globalIndexSize = domainSource->getLocalView(CElementView::WORKFLOW)->getGlobalSize(); - CArray dstGlobalIndex ; - scalarDestination->getLocalView(CElementView::WORKFLOW)->getGlobalIndexView(dstGlobalIndex) ; - if (dstGlobalIndex.numElements()!=0) - for (int idx = 0; idx < globalIndexSize; ++idx) transformationMapping_[0].push_back(idx); - } - - this->computeAlgorithm(domainSource->getLocalView(CElementView::WORKFLOW), scalarDestination->getLocalView(CElementView::WORKFLOW)) ; - -} -CATCH - - - -CScalarAlgorithmReduceDomain::~CScalarAlgorithmReduceDomain() -TRY -{ -} -CATCH - - -} diff --git a/xios_2311_src/src/transformation/scalar_algorithm/scalar_algorithm_reduce_domain.hpp b/xios_2311_src/src/transformation/scalar_algorithm/scalar_algorithm_reduce_domain.hpp deleted file mode 100755 index d7606e5cc3bc328c85f58e34e020110e7d18c47d..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/scalar_algorithm/scalar_algorithm_reduce_domain.hpp +++ /dev/null @@ -1,55 +0,0 @@ -/*! - \file scalar_algorithm_reduce_scalar.hpp - \author Ha NGUYEN - \since 13 Oct 2016 - \date 13 Oct 2016 - - \brief Algorithm for reduce an DOMAIN to a scalar - */ -#ifndef __XIOS_SCALAR_ALGORITHM_REDUCE_DOMAIN_HPP__ -#define __XIOS_SCALAR_ALGORITHM_REDUCE_DOMAIN_HPP__ - -#include "algorithm_transformation_reduce.hpp" -#include "transformation.hpp" - -namespace xios { - -class CScalar; -class CDomain; -class CReduceDomainToScalar; -class CReductionAlgorithm; - -/*! - \class CScalarAlgorithmReduceDomain - Reducing an DOMAIN to a scalar -*/ -class CScalarAlgorithmReduceDomain : public CAlgorithmTransformationReduce -{ -public: - CScalarAlgorithmReduceDomain(bool isSource, CScalar* scalarDestination, CDomain* domainSource, CReduceDomainToScalar* algo); - - virtual ~CScalarAlgorithmReduceDomain(); - - static bool registerTrans(); - - virtual StdString getAlgoName() {return "\\nreduce_domain";} - -protected: - CDomain* domainSrc_ ; - - -public: - static shared_ptr create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2DOMAINPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2DOMAINPosition, - std::map& elementPositionInGridDst2DomainPosition); - static bool dummyRegistered_; -}; - -} -#endif // __XIOS_SCALAR_ALGORITHM_REDUCE_DOMAIN_HPP__ diff --git a/xios_2311_src/src/transformation/scalar_algorithm/scalar_algorithm_reduce_scalar.cpp b/xios_2311_src/src/transformation/scalar_algorithm/scalar_algorithm_reduce_scalar.cpp deleted file mode 100755 index 31bf2d1da79393f73fe462d521d226f48bd6cc47..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/scalar_algorithm/scalar_algorithm_reduce_scalar.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/*! - \file scalar_algorithm_reduce_scalar.cpp - - \brief Algorithm for reduce an scalar to a scalar - */ -#include "scalar_algorithm_reduce_scalar.hpp" -#include "scalar.hpp" -#include "reduce_scalar_to_scalar.hpp" -#include "grid.hpp" -#include "grid_transformation_factory_impl.hpp" -#include "reduction.hpp" -#include "grid_algorithm_reduce.hpp" - - - -namespace xios { -shared_ptr CScalarAlgorithmReduceScalar::create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) -TRY -{ - std::vector scalarListDestP = gridDst->getScalars(); - std::vector scalarListSrcP = gridSrc->getScalars(); - - CReduceScalarToScalar* reduceScalar = dynamic_cast (transformation); - int scalarDstIndex = elementPositionInGridDst2ScalarPosition[elementPositionInGrid]; - int scalarSrcIndex = elementPositionInGridSrc2AxisPosition[elementPositionInGrid]; - - return make_shared(isSource, scalarListDestP[scalarDstIndex], scalarListSrcP[scalarSrcIndex], reduceScalar); -} -CATCH - -bool CScalarAlgorithmReduceScalar::dummyRegistered_ = CScalarAlgorithmReduceScalar::registerTrans(); -bool CScalarAlgorithmReduceScalar::registerTrans() -TRY -{ - return CGridTransformationFactory::registerTransformation(TRANS_REDUCE_SCALAR_TO_SCALAR, create); -} -CATCH - -CScalarAlgorithmReduceScalar::CScalarAlgorithmReduceScalar(bool isSource, CScalar* scalarDestination, CScalar* scalarSource, CReduceScalarToScalar* algo) - : CAlgorithmTransformationReduce(isSource) -TRY -{ - scalarDestination->checkAttributes() ; - if (algo->operation.isEmpty()) - ERROR("CScalarAlgorithmReduceScalar::CScalarAlgorithmReduceScalar(CScalar* scalarDestination, CScalar* scalarSource, CReduceScalarToScalar* algo)", - << "Operation must be defined." - << "Scalar source " <getId() << std::endl - << "Scalar destination " << scalarDestination->getId()); - StdString op; - switch (algo->operation) - { - case CReduceScalarToScalar::operation_attr::sum: - operator_ = EReduction::sum; - break; - case CReduceScalarToScalar::operation_attr::min: - operator_ = EReduction::min; - break; - case CReduceScalarToScalar::operation_attr::max: - operator_ = EReduction::max; - break; - case CReduceScalarToScalar::operation_attr::average: - operator_ = EReduction::average; - break; - default: - ERROR("CScalarAlgorithmReduceScalar::CScalarAlgorithmReduceScalar(CScalar* scalarDestination, CScalar* scalarSource, CReduceScalarToScalar* algo)", - << "Operation is wrongly defined. Supported operations: sum, min, max, average." << std::endl - << "Scalar source " <getId() << std::endl - << "Scalar destination " << scalarDestination->getId()); - - } - - auto& transMap = this->transformationMapping_; - - CArray dstGlobalIndex ; - scalarDestination->getLocalView(CElementView::WORKFLOW)->getGlobalIndexView(dstGlobalIndex) ; - size_t nbIdx = dstGlobalIndex.numElements(); - - for (size_t idx = 0; idx < nbIdx; ++idx) - { - size_t globalIdx = dstGlobalIndex(idx); - transMap[globalIdx].resize(1); - transMap[globalIdx][0]=globalIdx ; - } - - this->computeAlgorithm(scalarSource->getLocalView(CElementView::WORKFLOW), scalarDestination->getLocalView(CElementView::WORKFLOW)) ; -} -CATCH - -shared_ptr CScalarAlgorithmReduceScalar::createGridAlgorithm(CGrid* gridSrc, CGrid* gridDst, int pos) -{ - auto algo=make_shared(gridSrc, gridDst, pos, shared_from_this(), operator_) ; - algo->computeAlgorithm(false) ; - return algo ; -} - -CScalarAlgorithmReduceScalar::~CScalarAlgorithmReduceScalar() -TRY -{ -} -CATCH - - -} diff --git a/xios_2311_src/src/transformation/scalar_algorithm/scalar_algorithm_reduce_scalar.hpp b/xios_2311_src/src/transformation/scalar_algorithm/scalar_algorithm_reduce_scalar.hpp deleted file mode 100755 index 765385ae1abca5eca9d914165bb3ee1212cd428d..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/scalar_algorithm/scalar_algorithm_reduce_scalar.hpp +++ /dev/null @@ -1,49 +0,0 @@ -/*! - \file scalar_algorithm_reduce_scalar.hpp - \brief Algorithm for reduce an scalar to a scalar - */ -#ifndef __XIOS_SCALAR_ALGORITHM_REDUCE_SCALAR_HPP__ -#define __XIOS_SCALAR_ALGORITHM_REDUCE_SCALAR_HPP__ - -#include "algorithm_transformation_reduce.hpp" -#include "transformation.hpp" - -namespace xios { - -class CScalar; -class CReduceScalarToScalar; -class CReductionAlgorithm; - -/*! - \class CScalarAlgorithmReduceScalar - Reducing an scalar to a scalar -*/ -class CScalarAlgorithmReduceScalar : public CAlgorithmTransformationReduce -{ -public: - CScalarAlgorithmReduceScalar(bool isSource, CScalar* scalarDestination, CScalar* scalarSource, CReduceScalarToScalar* algo); - - virtual ~CScalarAlgorithmReduceScalar(); - - static bool registerTrans(); - - virtual StdString getAlgoName() {return "\\nreduce_scalar";} -protected: - - -public: - static shared_ptr create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition); - virtual shared_ptr createGridAlgorithm(CGrid* gridSrc, CGrid* gridDst, int pos); - static bool dummyRegistered_; -}; - -} -#endif // __XIOS_SCALAR_ALGORITHM_REDUCE_SCALAR_HPP__ diff --git a/xios_2311_src/src/transformation/transformation.hpp b/xios_2311_src/src/transformation/transformation.hpp deleted file mode 100755 index 66929f0cce53338decebdfb798d36e501bdbd6b2..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/transformation.hpp +++ /dev/null @@ -1,129 +0,0 @@ -#ifndef __XIOS_CTransformation__ -#define __XIOS_CTransformation__ - -#include "xios_spl.hpp" -#include "xml_node.hpp" -#include "transformation_enum.hpp" -#include "exception.hpp" - -namespace xios { - - ///-------------------------------------------------------------- - /*! - \class CTransformation - This class describes inverse_axis in xml file. - */ - class CGenericAlgorithmTransformation; - class CGrid; - - template - class CTransformation - { - public: - typedef typename std::list* > > TransformationMapTypes; - typedef TransformationMapTypes TransMapTypes; - - public : - /// Constructeurs /// - CTransformation(void) {} - virtual void checkValid(T* dest) {} - - std::vector checkAuxInputs() { return checkAuxInputs_(); } - static CTransformation* createTransformation(ETranformationType transType, const StdString& id, xml::CXMLNode* node=0); - static CTransformation* getTransformation(ETranformationType transType, const StdString& id); - - virtual const string& getId(void) = 0 ; - virtual ETranformationType getTransformationType(void)=0; - virtual void inheritFrom(CTransformation* src) = 0 ; - - virtual const string& getId_(void) { ERROR("string Transformation::getId())",<< "unimplemented virtual function for child"); } ; - virtual const string& getName(void) { ERROR("string Transformation::getId())",<< "unimplemented virtual function for child"); } ; - virtual const string& getDefName(void) { ERROR("string Transformation::getId())",<< "unimplemented virtual function for child"); } ; - virtual shared_ptr createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) =0 ; - - /// Destructeur /// - public: - virtual ~CTransformation(void) {} - static void unregisterAllTransformations(); - protected: - typedef CTransformation* (*createTransformationCallBack)(const StdString&, xml::CXMLNode*); - typedef CTransformation* (*getIdTransformationCallBack)(const StdString&); - typedef std::map> callBackMap; - static callBackMap* callBacks_; - - static bool registerTransformation(ETranformationType transType, tuple callBackFunctions); - static bool unregisterTransformation(ETranformationType transType); - - - - protected: - virtual std::vector checkAuxInputs_() { return std::vector(); } - - }; // class CTransformation - - template - typename CTransformation::callBackMap* CTransformation::callBacks_ = 0; //CTransformation::CallBackMap(); - - template - CTransformation* CTransformation::createTransformation(ETranformationType transType, const StdString& id, xml::CXMLNode* node) - { - int transTypeInt = transType; - typename callBackMap::const_iterator it = (*callBacks_).find(transType); - if ((*callBacks_).end() == it) - { - ERROR("CTransformation::createTransformation(ETranformationType transType)", - << "Transformation type " << transType - << "doesn't exist. Please define."); - } - return (get<0>(it->second))(id,node); - } - - template - CTransformation* CTransformation::getTransformation(ETranformationType transType, const StdString& id) - { - int transTypeInt = transType; - typename callBackMap::const_iterator it = (*callBacks_).find(transType); - if ((*callBacks_).end() == it) - { - ERROR("CTransformation::getTransformation(ETranformationType transType, const StdString& id)", - << "Transformation type " << transType - << "doesn't exist. Please define."); - } - return (get<1>(it->second))(id); - } - - template - bool CTransformation::registerTransformation(ETranformationType transType, tuple functions) - { - if (0 == callBacks_) callBacks_ = new callBackMap(); - return (* callBacks_).insert(make_pair(transType, functions)).second; - } - - template - bool CTransformation::unregisterTransformation(ETranformationType transType) - { - int transTypeInt = transType; - return (1 == (*callBacks_).erase(transType)); - } - - template - void CTransformation::unregisterAllTransformations(void) - { - if (0 != callBacks_) - { - callBacks_->clear(); - delete callBacks_ ; - } - } - -} // namespace xios - -#endif // __XIOS_CTransformation__ diff --git a/xios_2311_src/src/transformation/transformation_enum.hpp b/xios_2311_src/src/transformation/transformation_enum.hpp deleted file mode 100644 index 152020c9b6a72e3064046591fc61615852a3405f..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/transformation_enum.hpp +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef __XIOS_TRANSFORMATION_ENUM__ -#define __XIOS_TRANSFORMATION_ENUM__ - -namespace xios -{ - /// ////////////////////// Définitions ////////////////////// /// - typedef enum transformation_type - { - TRANS_ZOOM_AXIS = 0, - TRANS_INVERSE_AXIS = 1, - TRANS_INTERPOLATE_AXIS = 2, - TRANS_ZOOM_DOMAIN = 3, - TRANS_INTERPOLATE_DOMAIN = 4, - TRANS_GENERATE_RECTILINEAR_DOMAIN = 5, - TRANS_REDUCE_AXIS_TO_SCALAR = 6, - TRANS_REDUCE_DOMAIN_TO_AXIS = 7, - TRANS_EXTRACT_DOMAIN_TO_AXIS = 8, - TRANS_COMPUTE_CONNECTIVITY_DOMAIN = 9, - TRANS_EXPAND_DOMAIN = 10, - TRANS_EXTRACT_AXIS_TO_SCALAR = 11, - TRANS_REDUCE_DOMAIN_TO_SCALAR = 12, - TRANS_TEMPORAL_SPLITTING = 13, - TRANS_REDUCE_AXIS_TO_AXIS = 14, - TRANS_DUPLICATE_SCALAR_TO_AXIS = 15, - TRANS_REDUCE_SCALAR_TO_SCALAR = 16, - TRANS_REORDER_DOMAIN = 17, - TRANS_EXTRACT_DOMAIN = 18, - TRANS_EXTRACT_AXIS = 19 - } ETranformationType; - -} // namespace xios - -#endif // __XIOS_TRANSFORMATION_ENUM__ diff --git a/xios_2311_src/src/transformation/transformation_path.cpp b/xios_2311_src/src/transformation/transformation_path.cpp deleted file mode 100755 index 2673cd10eca4d787e5b1814378ad7e6f61415a2f..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/transformation_path.cpp +++ /dev/null @@ -1,163 +0,0 @@ -#include "transformation_path.hpp" - -namespace xios -{ - void CTransformationPaths::mergePaths(const CTransformationPaths& transformationPaths) - { - donePath_ = transformationPaths.donePath_ ; - if (donePath_.empty()) donePath_.push_back(transformationPaths.path_) ; // entry point - - if (get<1>(remainPath_)!="") return ; - - if (!donePath_.empty()) - { - TPath& remotePath = donePath_.back() ; - - // same element type and element id - if (std::get<0>(remotePath)==std::get<0>(path_) && std::get<1>(remotePath)==std::get<1>(path_)) - { - auto it = get<2>(path_).begin() ; - auto remoteIt = get<2>(remotePath).begin() ; - for( ; remoteIt !=get<2>(remotePath).end() ; remoteIt++ ) - { - if (it==get<2>(path_).end() || *it != *remoteIt) break ; - else it++ ; - } - - if (remoteIt==get<2>(remotePath).end()) - { - get<0>(remainPath_) = std::get<0>(path_) ; - get<1>(remainPath_) = std::get<1>(path_) ; - get<2>(remainPath_).insert( get<2>(remainPath_).begin(), it , std::get<2>(path_).end() ) ; - } - else remainPath_ = path_ ; - - } - else remainPath_=path_ ; - } - else - { - remainPath_=path_ ; - } - get<1>(path_).clear() ; - get<2>(path_).clear() ; - } - - void CTransformationPaths::mergePaths(void) - { - CTransformationPaths transformationPath ; - /* TPath newPath = path_ ; - get<2>(newPath).clear() ; - transformationPath.donePath_.push_back(newPath) ; */ - mergePaths(transformationPath) ; - } - - CTransformationPaths CTransformationPaths::getDonePath(void) - { - CTransformationPaths returnDonePath ; - returnDonePath.donePath_ = donePath_ ; - return returnDonePath ; - } - - EElement CTransformationPaths::getNextElementType(void) - { - if (get<1>(remainPath_)=="") return get<0>(donePath_.back()); - else return get<0>(remainPath_) ; - } - - string CTransformationPaths::getNextElementId(void) - { - CTransformationPaths transformationPath = *this ; - transformationPath.removeNextTransform() ; - return transformationPath.getPathsId(transformationPath.donePath_) ; - /* - string sep="/" ; - string doneId=getPathsId(donePath_) ; - if (doneId=="") sep="" ; - TPath next = remainPath_ ; - get<2>(next).erase(++(get<2>(next).begin()),get<2>(next).end()) ; - string remainId=getPathId(next) ; - if (remainId=="") sep="" ; - return doneId+sep+remainId ; - */ - } - - string CTransformationPaths::getNextElementSrcId(void) - { - return getPathsId(donePath_) ; - } - - ETranformationType CTransformationPaths::getNextTransformationType(void) - { - return get<2>(remainPath_).front().first ; - } - - string CTransformationPaths::getNextTransformationId(void) - { - return get<2>(remainPath_).front().second ; - } - - void CTransformationPaths::removeNextTransform(void) - { - if (get<1>(remainPath_)!="") - { - TPath newPath; - get<0>(newPath)=get<0>(remainPath_) ; - get<1>(newPath)=get<1>(remainPath_) ; - if (!get<2>(remainPath_).empty()) get<2>(newPath).push_back(get<2>(remainPath_).front()) ; - if (donePath_.empty()) donePath_.push_back(newPath); - else - { - if (get<0>(donePath_.back())==get<0>(newPath) && get<1>(donePath_.back())==get<1>(newPath)) - get<2>(donePath_.back()).push_back(get<2>(newPath).front()) ; - else donePath_.push_back(newPath); - } - if (!get<2>(newPath).empty()) get<2>(remainPath_).pop_front() ; - if (get<2>(remainPath_).empty()) get<1>(remainPath_)="" ; - } - else - { - if (!get<2>(remainPath_).empty()) - { - get<2>(donePath_.back()).push_back(get<2>(remainPath_).front()) ; - get<2>(remainPath_).pop_front() ; - } - } - } - - - string CTransformationPaths::getPathId(const TPath& path) - { - string id,id1 ; - if (get<1>(path)!="") - { - if (get<0>(path)==EElement::DOMAIN) id="CDomain" ; - if (get<0>(path)==EElement::AXIS) id="CAxis" ; - if (get<0>(path)==EElement::SCALAR) id="CScalar" ; - id=id+":"+get<1>(path) ; - id1="/" ; - } - - for(auto transform : get<2>(path)) - { - - id=id+id1 ; - id=id+to_string(transform.first) ; // not very nice but enough for now. Should be replace by string tranformation name - id=id+":"+transform.second ; - id1="/" ; - } - return id ; - } - - string CTransformationPaths::getPathsId(const list& paths) - { - string id ; - string sep("") ; - for(auto path:paths) - { - id=id+sep+getPathId(path) ; - sep="//" ; - } - return id ; - } -} \ No newline at end of file diff --git a/xios_2311_src/src/transformation/transformation_path.hpp b/xios_2311_src/src/transformation/transformation_path.hpp deleted file mode 100755 index b729a6b3030973aeaf271419dd079c09c38302de..0000000000000000000000000000000000000000 --- a/xios_2311_src/src/transformation/transformation_path.hpp +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef __XIOS_TRANSFORMATION_PATH_HPP__ -#define __XIOS_TRANSFORMATION_PATH_HPP__ - -#include "transformation_enum.hpp" -#include "element_type.hpp" -#include "xios_spl.hpp" - -namespace xios -{ - class CTransformationPaths - { - public: - typedef std::tuple>> TPath ; - - private: - TPath path_ ; - std::list donePath_ ; - TPath remainPath_ ; - string getPathId(const TPath& path) ; - string getPathsId(const list& paths) ; - - public: - void addPath(TPath& path) {path_=path;} - void mergePaths(const CTransformationPaths& transformationPath) ; - void mergePaths(void) ; - bool hasTransform(void) { return !std::get<2>(remainPath_).empty();} - bool hasPath(void) { return !std::get<1>(path_).empty() ;} - CTransformationPaths getDonePath(void) ; - - EElement getNextElementType(void); - std::string getNextElementId(void) ; - std::string getNextElementSrcId(void) ; - ETranformationType getNextTransformationType(void) ; - std::string getNextTransformationId(void) ; - void removeNextTransform(void) ; - }; - -} - -#endif // __XIOS_TRANSFORMATION_PATH_HPP__ \ No newline at end of file diff --git a/xios_2311_src/src/type/message.cpp b/xios_2311_src/src/type/message.cpp index 9ddd4eab9701e94799bd61a54acbab22097f7226..475d7e7096b5fbcdd840f1eb1cd7abdcaa14fa24 100644 --- a/xios_2311_src/src/type/message.cpp +++ b/xios_2311_src/src/type/message.cpp @@ -8,12 +8,6 @@ namespace xios { CMessage::CMessage(void) {} - - CMessage::CMessage(const CMessage& msg) - { - for(auto type : msg.typeList) push(*type) ; - } - CMessage& CMessage::push(const CBaseType& type) { diff --git a/xios_2311_src/src/type/message.hpp b/xios_2311_src/src/type/message.hpp index 220b0337b02e5347a4cd3203fc35f4abe4b0d11c..b7e65988f5b6017e0025812fd874ea3e9c1c3a58 100644 --- a/xios_2311_src/src/type/message.hpp +++ b/xios_2311_src/src/type/message.hpp @@ -16,8 +16,6 @@ namespace xios public: CMessage(void) ; - CMessage(const CMessage& Msg) ; - list typeList ; virtual bool fromBuffer(CBufferIn& buffer) const; virtual bool toBuffer(CBufferOut& buffer) const; diff --git a/xios_2311_src/src/type/type_decl.cpp b/xios_2311_src/src/type/type_decl.cpp index d10886df562ef40cbf39f9d1a642a3e7029bebd1..c3c9c2146a4d0d1e32d80449ff9623d3068f11b4 100644 --- a/xios_2311_src/src/type/type_decl.cpp +++ b/xios_2311_src/src/type/type_decl.cpp @@ -32,16 +32,10 @@ namespace xios template bool operator==(const CType_ref& lhs, const CType_ref& rhs); macro(string) - macro(char) - macro(short) macro(int) - macro(unsigned int) - macro(long) - macro(unsigned long) - macro(long long) - macro(unsigned long long) macro(double) macro(bool) + macro(StdSize) macro(CDate) macro(CDuration) } diff --git a/xios_2311_src/src/type/type_util.hpp b/xios_2311_src/src/type/type_util.hpp index 9ee9adc1db64040544aed66b14ac85a37bab7532..648ceed334f4f003ae88e4b955c12dbafef00b74 100644 --- a/xios_2311_src/src/type/type_util.hpp +++ b/xios_2311_src/src/type/type_util.hpp @@ -14,10 +14,6 @@ namespace xios class CAxisGroup; class CFile; class CFileGroup; - class CCouplerIn; - class CCouplerInGroup; - class CCouplerOut; - class CCouplerOutGroup; class CContext; class CContextGroup; class CCalendarWrapper; @@ -75,9 +71,7 @@ namespace xios macro(int) macro(unsigned int) macro(long) - macro(long long) macro(unsigned long) - macro(unsigned long long) macro(float) macro(double) macro(long double) @@ -98,10 +92,6 @@ namespace xios macro(CAxisGroup) macro(CFile) macro(CFileGroup) - macro(CCouplerIn) - macro(CCouplerInGroup) - macro(CCouplerOut) - macro(CCouplerOutGroup) macro(CContext) macro(CContextGroup) macro(CCalendarWrapper) diff --git a/xios_2311_src/src/utils.hpp b/xios_2311_src/src/utils.hpp index 4a0520a91503658e0eb0ba181445119663091915..8463cfb8528e4638deb9758227835823a6f49b6f 100644 --- a/xios_2311_src/src/utils.hpp +++ b/xios_2311_src/src/utils.hpp @@ -180,17 +180,10 @@ namespace xios int sizeVec = vec.size(); for(int i = 0; i < sizeVec; ++i) { - hash ^= jenkins_hash(vec[i]) + 0x9e3779b9 + (hash << 6) + (hash >> 2); + hash ^= i + 0x9e3779b9 + (hash << 6) + (hash >> 2); } return hash; } - - static inline size_t hash_combine(size_t seed, const T& value) - { - seed ^= jenkins_hash(value) + 0x9e3779b9 + (seed << 6) + (seed >> 2); - return seed; - } - }; template > @@ -206,11 +199,7 @@ namespace xios { return HashAlgorithm::boost_hash(vec); } - - std::size_t hashCombine(size_t seed, const T& val) - { - return HashAlgorithm::hash_combine(seed, val); - } + private: size_t hash_value(const T& val, Int2Type<0>) { diff --git a/xios_2311_src/src/workflow_graph.cpp b/xios_2311_src/src/workflow_graph.cpp index 87c0cec5923fd5fc8a62f0509f9965567b54f042..90a624c9a63f2dac5e289bd543669c03029fae83 100644 --- a/xios_2311_src/src/workflow_graph.cpp +++ b/xios_2311_src/src/workflow_graph.cpp @@ -1,363 +1,177 @@ #include "workflow_graph.hpp" -#include "cxios.hpp" namespace xios { - std::vector *CWorkflowGraph::vectorOfNodes_ = 0; - std::vector *CWorkflowGraph::vectorOfEdges_ = 0; - std::vector *CWorkflowGraph::vectorOfContexts_ = 0; + std::unordered_map *CWorkflowGraph::mapFilters_ptr_with_info = 0; - std::vector *CWorkflowGraph::vectorOfNodes_srv_ = 0; - std::vector *CWorkflowGraph::vectorOfEdges_srv_ = 0; - std::vector *CWorkflowGraph::vectorOfContexts_srv_ = 0; + std::unordered_map *CWorkflowGraph::mapFieldToFilters_ptr_with_info = 0; - bool CWorkflowGraph::clientGraphBuilt = false; - bool CWorkflowGraph::serverGraphBuilt = false; - bool CWorkflowGraph::build_begin = false; + std::unordered_map *CWorkflowGraph::mapHashFilterID_ptr = 0; + + std::unordered_map *CWorkflowGraph::mapContext_ptr = 0; - std::unordered_map *CWorkflowGraph::mapHashFilterID_ = 0; - std::unordered_map *CWorkflowGraph::mapHashFilterID_srv_ = 0; + vector CWorkflowGraph::filters; + vector CWorkflowGraph::fields; + vector > CWorkflowGraph::fieldsToFilters; + + bool CWorkflowGraph::build_begin = false; CWorkflowGraph::CWorkflowGraph() { } - -//****************************************************** - - void CWorkflowGraph::outputWorkflowGraph_client_stdout() - { - std::cout<<"\n\nbuild workflow graph ..."<size(); i++) - { - std::cout<<"Node["<size(); i++) - { - std::cout<<"Edge["<size(); i++) - { - info(100)<<"Node["<size(); i++) - { - info(100)<<"Edge["<size()); + fieldsToFilters.clear(); + fields.clear(); + for (auto it=mapFilters_ptr_with_info->begin(); it != mapFilters_ptr_with_info->end(); it++) + { + filters[it->first]=it->second.filter_name; + } + + // Create a list of fields and their filter connectivity (graph edges and edge-to-node connectivity) + for (auto it=mapFieldToFilters_ptr_with_info->begin(); it != mapFieldToFilters_ptr_with_info->end(); it++) + { + fieldsToFilters.push_back(make_pair(it->second.from,it->second.to)); + fields.push_back(it->second.field_id + " "+it->second.date.toString()); + } } - else info(100)<<"Server side : no graph information"<; - std::string currentContextId = CContext::getCurrent()->getId(); - - graph_edge_object edge_obj; - edge_obj.from = from; - edge_obj.to = to; - edge_obj.date = packet->date; - edge_obj.timestamp = packet->timestamp; - edge_obj.field = packet->graphPackage->currentField; - edge_obj.show = true; - - if(vectorOfNodes_->at(from).filter_class == 2) // from pass through filter + size_t filterIdx = 0; + filters.resize(mapFilters_ptr_with_info->size()); + fieldsToFilters.clear(); + fields.clear(); + for (auto it=mapFilters_ptr_with_info->begin(); it != mapFilters_ptr_with_info->end(); it++) { - edge_obj.label_info = vectorOfNodes_->at(from).label_field_id; - } - - if(vectorOfNodes_->at(to).filter_class == 3) // to temporal filter - { - vectorOfNodes_->at(to).expected_entry_nb++; + // std::cout<<"it->first = "<first<first]=it->second.filter_name; } - for(int i=0; isize(); i++) + // Create a list of fields and their filter connectivity (graph edges and edge-to-node connectivity) + for (auto it=mapFieldToFilters_ptr_with_info->begin(); it != mapFieldToFilters_ptr_with_info->end(); it++) { - if(vectorOfContexts_->at(i) == currentContextId) - { - edge_obj.context = i; - edge_obj.context_id = currentContextId; - break; - } - } - edge_obj.attributes = packet->graphPackage->currentField->recordXiosAttributes(); - - vectorOfEdges_->push_back(edge_obj); - //info(100)<<"****************** Add Edge from "<at(from).filter_filled = true; - } - else - { - if(!vectorOfEdges_srv_) vectorOfEdges_srv_ = new std::vector; - std::string currentContextId = CContext::getCurrent()->getId(); - - graph_edge_object edge_obj; - edge_obj.from = from; - edge_obj.to = to; - edge_obj.date = packet->date; - edge_obj.timestamp = packet->timestamp; - edge_obj.field = packet->graphPackage->currentField; - edge_obj.show = true; - for(int i=0; isize(); i++) - { - if(vectorOfContexts_srv_->at(i) == currentContextId) - { - edge_obj.context = i; - edge_obj.context_id = currentContextId; - break; - } + fieldsToFilters.push_back(make_pair(it->second.from,it->second.to)); + fields.push_back(it->second.field_id + " "+it->second.date.toString()); } - edge_obj.attributes = packet->graphPackage->currentField->recordXiosAttributes(); - - vectorOfEdges_srv_->push_back(edge_obj); - //info(100)<<"****************** Server side : Add Edge from "<at(from).filter_filled = true; - } } CATCH - - void CWorkflowGraph::addNode(StdString filterName, int filterClass, bool filterFilled, int entryNb, CDataPacketPtr packet) + + + void CWorkflowGraph::showStaticWorkflow() TRY { - if(CXios::isClient) - { - //if(vectorOfEdges_&&vectorOfNodes_) outputWorkflowGraph_client_stdout(); - // std::cout<<"Trying to add a node naming "<; - if(!vectorOfContexts_) vectorOfContexts_ = new std::vector; - if(!mapHashFilterID_) mapHashFilterID_ = new std::unordered_map ; - - std::string currentContextId = CContext::getCurrent()->getId(); - if ( std::find(vectorOfContexts_->begin(), vectorOfContexts_->end(), currentContextId) == vectorOfContexts_->end() ) - vectorOfContexts_->push_back(currentContextId); - - - graph_node_object node_obj; - node_obj.filter_name = filterName; - node_obj.filter_class = filterClass; - node_obj.filter_filled = filterFilled; - node_obj.expected_entry_nb = entryNb; - node_obj.date = packet->date; - node_obj.timestamp = packet->timestamp; - - for(int i=0; isize(); i++) - { - if(vectorOfContexts_->at(i) == currentContextId) - { - node_obj.context = i; - node_obj.context_id = currentContextId; - break; - } - } - - node_obj.attributes = packet->graphPackage->currentField->recordXiosAttributes(); + if(mapFilters_ptr_with_info!=0 && !mapFilters_ptr_with_info->empty()) + for (auto it=mapFilters_ptr_with_info->begin(); it != mapFilters_ptr_with_info->end(); it++) + { + std::cout<<"mapFilters_ptr_with_info["<first<<"].filter_name="<second.filter_name<first<<"].filter_class="<second.filter_class<first<<"].filter_fillled="<second.filter_filled<first<<"].expected_entry_nb="<second.expected_entry_nb<first<<"].date="<second.date<first<<"].timestamp="<second.timestamp<first<<"].transform_type="<second.transform_type<empty()) + for (auto it=mapFieldToFilters_ptr_with_info->begin(); it != mapFieldToFilters_ptr_with_info->end(); it++) + { + std::cout<<"mapFieldToFilters_ptr_with_info["<first<<"].from = "<second.from<first<<"].to = "<second.to<first<<"].field_id = "<second.field_id<first<<"].field_name = "<second.field_name<first<<"].date = "<second.date<push_back(node_obj); - } - else - { - if(!vectorOfNodes_srv_) vectorOfNodes_srv_ = new std::vector; - if(!vectorOfContexts_srv_) vectorOfContexts_srv_ = new std::vector; - if(!mapHashFilterID_srv_) mapHashFilterID_srv_ = new std::unordered_map ; - - std::string currentContextId = CContext::getCurrent()->getId(); - if ( std::find(vectorOfContexts_srv_->begin(), vectorOfContexts_srv_->end(), currentContextId) == vectorOfContexts_srv_->end() ) - vectorOfContexts_srv_->push_back(currentContextId); - - graph_node_object node_obj; - node_obj.filter_name = filterName; - node_obj.filter_class = filterClass; - node_obj.filter_filled = filterFilled; - node_obj.expected_entry_nb = entryNb; - node_obj.date = packet->date; - node_obj.timestamp = packet->timestamp; - for(int i=0; isize(); i++) - { - if(vectorOfContexts_srv_->at(i) == currentContextId) - { - node_obj.context = i; - node_obj.context_id = currentContextId; - break; - } - } - node_obj.attributes = packet->graphPackage->currentField->recordXiosAttributes(); - - vectorOfNodes_srv_->push_back(node_obj); } + else std::cout<<"mapFieldToFilters_ptr_with_info empty"<size(); - } - else - { - return !vectorOfNodes_srv_? 0 : vectorOfNodes_srv_->size(); - } + if(!mapContext_ptr) mapContext_ptr = new std::unordered_map; + std::string current_context_id = CContext::getCurrent()->getId(); + std::unordered_map::const_iterator found = mapContext_ptr->find(current_context_id); + if (found == mapContext_ptr->end()) + { + std::pair mypair (current_context_id, mapContext_ptr->size()); + mapContext_ptr->insert(mypair); + } + + (*mapFilters_ptr_with_info)[nodeID].filter_name = filterName; + (*mapFilters_ptr_with_info)[nodeID].filter_class = filterClass; + (*mapFilters_ptr_with_info)[nodeID].filter_filled = filterFilled; + (*mapFilters_ptr_with_info)[nodeID].expected_entry_nb = entry_nb; + (*mapFilters_ptr_with_info)[nodeID].date = packet->date; + (*mapFilters_ptr_with_info)[nodeID].timestamp = packet->timestamp; + (*mapFilters_ptr_with_info)[nodeID].node_context_id = CContext::getCurrent()->getId(); } CATCH - void CWorkflowGraph::outputWorkflowGraph_client() + void CWorkflowGraph::addEdge(int edgeID, int toID, CDataPacketPtr packet) + TRY { - int graph_rank; - MPI_Comm_rank(MPI_COMM_WORLD, &graph_rank); - std::ofstream *outfiles; - - outfiles = new std::ofstream[vectorOfContexts_->size()]; - - for(int ctx=0; ctxsize(); ctx++) - { - StdString graphFileName="graph_data_"+vectorOfContexts_->at(ctx)+"_client_"+to_string(graph_rank)+".json"; - outfiles[ctx].open(graphFileName); - - outfiles[ctx] << "{\"nodes\":["<size(); i++) - { - int ctx = vectorOfNodes_->at(i).context; - if(i!=0) outfiles[ctx] << ","; - outfiles[ctx] << "{\"id\":"<at(i).filter_name<<"\","<at(i).filter_class<<","<at(i).filter_filled)<<","<at(i).context_id<<"\","<at(i).expected_entry_nb<<"\","<at(i).attributes<<"\","<size(); ctx++) - { - outfiles[ctx] << std::endl<<"],"<size(); i++) - { - int ctx = vectorOfEdges_->at(i).context; - if(i!=0) outfiles[ctx] << ","; - outfiles[ctx] << "{\"id\":"<at(i).from<<","<at(i).to<<","<at(i).label_info != "none") - { - if(vectorOfEdges_->at(i).show) outfiles[ctx] << "\"label\":"<<"\""<at(i).label_info<<"\\n"<at(i).date<<"\","<at(i).date<<"\","<at(i).show) outfiles[ctx] << "\"label\":"<<"\""<at(i).field->getId()<<"\\n"<at(i).date<<"\","<at(i).date<<"\","<at(i).context_id<<"\","<at(i).attributes<<"\","<at(i).date<<"\"}"<size(); ctx++) - { - outfiles[ctx] << std::endl<<"]}"<getId(); + (*mapFieldToFilters_ptr_with_info)[edgeID].from = packet->src_filterID; + (*mapFieldToFilters_ptr_with_info)[edgeID].to = toID; + (*mapFieldToFilters_ptr_with_info)[edgeID].field_id = packet->field->getId(); + (*mapFieldToFilters_ptr_with_info)[edgeID].field_name = packet->field->name; + (*mapFieldToFilters_ptr_with_info)[edgeID].grid_id = packet->field->grid->getId(); + (*mapFieldToFilters_ptr_with_info)[edgeID].date = packet->date; + (*mapFieldToFilters_ptr_with_info)[edgeID].timestamp = packet->timestamp; + (*mapFieldToFilters_ptr_with_info)[edgeID].field = packet->field; + (*mapFieldToFilters_ptr_with_info)[edgeID].attributes = packet->field->record4graphXiosAttributes(); + (*mapFieldToFilters_ptr_with_info)[edgeID].edge_context_id = CContext::getCurrent()->getId(); } - - - void CWorkflowGraph::outputWorkflowGraph_server() - { - int graph_rank; - MPI_Comm_rank(MPI_COMM_WORLD, &graph_rank); - std::ofstream *outfiles; + CATCH - outfiles = new std::ofstream[vectorOfContexts_srv_->size()]; - for(int ctx=0; ctxsize(); ctx++) - { - StdString graphFileName="graph_data_"+vectorOfContexts_srv_->at(ctx)+"_client_"+to_string(graph_rank)+".json"; - outfiles[ctx].open(graphFileName); - - outfiles[ctx] << "{\"nodes\":["<size(); i++) - { - int ctx = vectorOfNodes_srv_->at(i).context; - if(i!=0) outfiles[ctx] << ","; - outfiles[ctx] << "{\"id\":"<at(i).filter_name<<"\","<at(i).filter_class<<","<at(i).filter_filled)<<","<at(i).context_id<<"\","<at(i).expected_entry_nb<<"\","<at(i).attributes<<"\","<size(); ctx++) - { - outfiles[ctx] << std::endl<<"],"<size(); i++) - { - int ctx = vectorOfEdges_srv_->at(i).context; - if(i!=0) outfiles[ctx] << ","; - outfiles[ctx] << "{\"id\":"<at(i).from<<","<at(i).to<<","<at(i).show) outfiles[ctx] << "\"label\":"<<"\""<at(i).field->getId()<<"\\n"<at(i).date<<"\","<at(i).date<<"\","<at(i).context_id<<"\","<at(i).attributes<<"\","<at(i).date<<"\"}"<size(); ctx++) - { - outfiles[ctx] << std::endl<<"]}"<; + if(mapFieldToFilters_ptr_with_info==0) mapFieldToFilters_ptr_with_info = new std::unordered_map ; + if(mapHashFilterID_ptr==0) mapHashFilterID_ptr = new std::unordered_map ; } -} + CATCH +} diff --git a/xios_2311_src/src/workflow_graph.hpp b/xios_2311_src/src/workflow_graph.hpp index eeef37dc06d687c086898bad2b4646bc7e1520be..a0112289d753832ea7099754fd2d4db0c1ad84af 100644 --- a/xios_2311_src/src/workflow_graph.hpp +++ b/xios_2311_src/src/workflow_graph.hpp @@ -13,10 +13,10 @@ namespace xios { class CField; - struct graph_node_object + struct graph_info_box_node { - StdString filter_name; + StdString filter_name; int filter_class; bool filter_filled; int expected_entry_nb; @@ -29,21 +29,13 @@ namespace xios int filter_tag; int clusterID; int distance; - StdString context_id; - int context; - StdString label_field_id; - bool show; - - - graph_node_object():show(true){} - + StdString node_context_id; }; - struct graph_edge_object + struct graph_info_box_edge { int from; int to; - StdString field_id; StdString field_name; StdString grid_id; @@ -51,16 +43,14 @@ namespace xios Time timestamp; CField *field; StdString attributes; - StdString context_id; - int context; - bool show; - StdString label_info; - - graph_edge_object():show(true), label_info("none"){} + StdString edge_context_id; }; class CWorkflowGraph { + + friend class CGraphviz; + public: CWorkflowGraph(); @@ -68,44 +58,45 @@ namespace xios /*! Map between fields identified by its id and their filters identified by an integer. * It is filled up during reconstruction of a workflow (in function CField::buildFilterGraph()). */ + // static std::unordered_map > *mapFieldToFilters_ptr; + // #pragma omp threadprivate(mapFieldToFilters_ptr) + - static std::vector *vectorOfNodes_; - static std::vector *vectorOfEdges_; - static std::vector *vectorOfContexts_; - static std::vector *vectorOfNodes_srv_; - static std::vector *vectorOfEdges_srv_; - static std::vector *vectorOfContexts_srv_; + static std::unordered_map *mapFilters_ptr_with_info; + + static std::unordered_map *mapFieldToFilters_ptr_with_info; + + static std::unordered_map *mapHashFilterID_ptr; + + static std::unordered_map *mapContext_ptr; - static std::unordered_map *mapHashFilterID_; - static std::unordered_map *mapHashFilterID_srv_; - // these variables are not yet used - static bool clientGraphBuilt; - static bool serverGraphBuilt; static bool build_begin; + static void addNode(int nodeID, StdString filterName, int filter_class, bool filter_filled, int entry_nb, CDataPacketPtr packet); + static void addEdge(int edgeID, int toID, CDataPacketPtr packet); + static void allocNodeEdge(); - static void drawWorkFlowGraph_client(); - static void drawWorkFlowGraph_server(); + private: + //! List of fields marked for visualizing of their workflow + static vector fields; + + //! List of connected filters for fields for visualizing of their workflow + static vector filters; + + //! Fields to filters connectivity + static vector > fieldsToFilters; + + static void buildStaticWorkflow(); + static void buildStaticWorkflow_with_info(); + static void showStaticWorkflow(); - static void addNode(StdString filterName, int filter_class, bool filter_filled, int entry_nb, CDataPacketPtr packet); - static void addEdge(int from, int to, CDataPacketPtr packet); - - // write to file the graph info - static void outputWorkflowGraph_client(); - static void outputWorkflowGraph_server(); - // output on screen the graph info - static void outputWorkflowGraph_client_stdout(); - static void outputWorkflowGraph_server_stdout(); - static int getNodeSize(); }; - } #endif - diff --git a/xios_2311_src/src/xios_spl.hpp b/xios_2311_src/src/xios_spl.hpp index d4c5b8d9247969058173b59c9b777f7040e88a66..8aa0aea12fbb44816cb922b9a2cbae510878fdda 100644 --- a/xios_2311_src/src/xios_spl.hpp +++ b/xios_2311_src/src/xios_spl.hpp @@ -7,16 +7,11 @@ #include #include #include + // standard C #include #include - #include -// bug in cmath header => macro collision marco with DOMAIN -#ifdef DOMAIN -#undef DOMAIN -#endif - #include // Conteneurs. @@ -28,8 +23,6 @@ #include #include #include -#include - // Flux. #include #include @@ -38,7 +31,6 @@ /// boost headers /// #include #include - /// Map /// #define xios_map std::map @@ -56,11 +48,9 @@ typedef std::istream StdIStream; typedef std::string StdString; typedef std::size_t StdSize; -typedef unsigned short int ushort; -typedef unsigned int uint; -typedef unsigned long int ulong; -typedef long long int longlong; -typedef unsigned long long int ulonglong; +typedef unsigned short int ushort; +typedef unsigned int uint; +typedef unsigned long int ulong; const size_t stringArrayLen=255 ; @@ -68,6 +58,7 @@ const size_t stringArrayLen=255 ; #include "configure.hpp" #include "log.hpp" using namespace std; -//using namespace boost ; +using namespace boost ; + #endif //__XIOS_SPL__ diff --git a/xios_2311_src/src/xml_parser_decl.cpp b/xios_2311_src/src/xml_parser_decl.cpp index 918dfc314dacbbbfb062ea740a471d084b958b40..c4e6698eb09f65fdb3d86192c9a40f79f16a29a7 100644 --- a/xios_2311_src/src/xml_parser_decl.cpp +++ b/xios_2311_src/src/xml_parser_decl.cpp @@ -17,8 +17,6 @@ namespace xios macro( Grid ) macro( Field ) macro( File ) - macro( CouplerIn ) - macro( CouplerOut ) macro( Variable ) macro( InverseAxis ) macro( ZoomAxis ) diff --git a/xios_2311_src/tools/archive/boost.tar b/xios_2311_src/tools/archive/boost.tar index aba695e6a3faf7d0d0e5613385d820d725e264ae..374a5eaa0fbd6da2fc00a7b054e6aa4b44f79642 100644 Binary files a/xios_2311_src/tools/archive/boost.tar and b/xios_2311_src/tools/archive/boost.tar differ diff --git a/xios_2311_src/trunk/.svn/entries b/xios_2311_src/trunk/.svn/entries deleted file mode 100644 index 48082f72f087ce7e6fa75b9c41d7387daecd447b..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/entries +++ /dev/null @@ -1 +0,0 @@ -12 diff --git a/xios_2311_src/trunk/.svn/format b/xios_2311_src/trunk/.svn/format deleted file mode 100644 index 48082f72f087ce7e6fa75b9c41d7387daecd447b..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/format +++ /dev/null @@ -1 +0,0 @@ -12 diff --git a/xios_2311_src/trunk/.svn/pristine/00/001664a702346a7735783c40c3c5d7dc9f061f48.svn-base b/xios_2311_src/trunk/.svn/pristine/00/001664a702346a7735783c40c3c5d7dc9f061f48.svn-base deleted file mode 100644 index b5bad8c348473fd009c58e1aa80f48d6fc72230d..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/00/001664a702346a7735783c40c3c5d7dc9f061f48.svn-base +++ /dev/null @@ -1,71 +0,0 @@ -import netCDF4 as nc -import sys -import math -import numpy as np - -def from_reduced(N,M): - "N elements from south to north and N elements around equator " - hmax = 2*math.pi/N - hmin = hmax/2 - nlon = N - cells_lon = [] - cells_lat = [] - for i in range(M/2): - lat1 = 180.0/M*i - lat2 = 180.0/M*(i+1) - y = math.sin(lat1*math.pi/180) - r = math.cos(lat1*math.pi/180) - h = 2.0*r/nlon - reduce_nlon = (h < hmin) and (i > 0) and (nlon > 4) - if reduce_nlon: - nlon = nlon/2 - for j in range(nlon): - lon1 = 360.0*j/nlon - lon2 = 360.0*(j+1)/nlon - bounds_lon = [lon1, lon1, lon2, lon2] - bounds_lat = [lat1, lat2, lat2, lat1] - if reduce_nlon: - bounds_lon.append((lon1+lon2)/2) - bounds_lat.append(lat1) - else: # close by netCDF convention - bounds_lon.append(bounds_lon[0]) - bounds_lat.append(bounds_lat[0]) - # northern hemisphere - cells_lon.append(bounds_lon) - cells_lat.append(bounds_lat) - # southern hemisphere - cells_lon.append(bounds_lon) - cells_lat.append(list(-np.array(bounds_lat))) # convert to array to negate elementwise - return np.array(cells_lon), np.array(cells_lat) - -for N in [64, 128, 256, 512]: - filename = "reduced" + str(N) + ".nc" - - print "Generating: N =", N - lon, lat = from_reduced(N*2,N) - - print lon.shape[0], "cells -> writing as ", filename - - f = nc.Dataset(filename,'w') - f.createDimension('n_vert', 5) - f.createDimension('n_cell', lon.shape[0]) - - var = f.createVariable('lat', 'd', ('n_cell')) - var.setncattr("long_name", "latitude") - var.setncattr("units", "degrees_north") - var.setncattr("bounds", "bounds_lat") - var[:] = np.zeros(lon.shape[0]) - var = f.createVariable('lon', 'd', ('n_cell')) - var.setncattr("long_name", "longitude") - var.setncattr("units", "degrees_east") - var.setncattr("bounds", "bounds_lon") - var[:] = np.zeros(lon.shape[0]) - - var = f.createVariable('bounds_lon', 'd', ('n_cell','n_vert')) - var[:] = lon - var = f.createVariable('bounds_lat', 'd', ('n_cell','n_vert')) - var[:] = lat - var = f.createVariable('val', 'd', ('n_cell')) - var.setncattr("coordinates", "lon lat") - var[:] = np.arange(lon.shape[0]) - f.close() diff --git a/xios_2311_src/trunk/.svn/pristine/00/00bb56d4f2685a36d67ee488f80e0432497ce34c.svn-base b/xios_2311_src/trunk/.svn/pristine/00/00bb56d4f2685a36d67ee488f80e0432497ce34c.svn-base deleted file mode 100644 index 24986806036a445cef218f8568e45e4130aabeff..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/00/00bb56d4f2685a36d67ee488f80e0432497ce34c.svn-base +++ /dev/null @@ -1,104 +0,0 @@ -#include "extract_domain_to_axis.hpp" -#include "axis_algorithm_extract_domain.hpp" -#include "type.hpp" -#include "axis.hpp" -#include "domain.hpp" - -namespace xios { - - /// ////////////////////// Définitions ////////////////////// /// - - CExtractDomainToAxis::CExtractDomainToAxis(void) - : CObjectTemplate(), CExtractDomainToAxisAttributes(), CTransformation() - { /* Ne rien faire de plus */ } - - CExtractDomainToAxis::CExtractDomainToAxis(const StdString & id) - : CObjectTemplate(id), CExtractDomainToAxisAttributes(), CTransformation() - { /* Ne rien faire de plus */ } - - CExtractDomainToAxis::~CExtractDomainToAxis(void) - {} - - CTransformation* CExtractDomainToAxis::create(const StdString& id, xml::CXMLNode* node) - { - CExtractDomainToAxis* extractDomain = CExtractDomainToAxisGroup::get("extract_domain_to_axis_definition")->createChild(id); - if (node) extractDomain->parse(*node); - return static_cast*>(extractDomain); - } - - bool CExtractDomainToAxis::registerTrans() - { - return registerTransformation(TRANS_EXTRACT_DOMAIN_TO_AXIS, {create, getTransformation}); - } - - bool CExtractDomainToAxis::_dummyRegistered = CExtractDomainToAxis::registerTrans(); - - //---------------------------------------------------------------- - - StdString CExtractDomainToAxis::GetName(void) { return StdString("extract_domain_to_axis"); } - StdString CExtractDomainToAxis::GetDefName(void) { return StdString("extract_domain_to_axis"); } - ENodeType CExtractDomainToAxis::GetType(void) { return eExtractDomainToAxis; } - - void CExtractDomainToAxis::checkValid(CAxis* axisDst, CDomain* domainSrc) - { - if (CDomain::type_attr::unstructured == domainSrc->type) - ERROR("CExtractDomainToAxis::checkValid(CAxis* axisDst, CDomain* domainSrc)", - << "Domain reduction is only supported for rectilinear or curvillinear grid." - << "Domain source " <getId() << std::endl - << "Axis destination " << axisDst->getId()); - - int domain_ni_glo = domainSrc->ni_glo; - int domain_nj_glo = domainSrc->nj_glo; - - if (this->direction.isEmpty()) - ERROR("CExtractDomainToAxis::checkValid(CAxis* axisDst, CDomain* domainSrc)", - << "A direction to apply the operation must be defined. It should be: 'iDir' or 'jDir'" - << "Domain source " <getId() << std::endl - << "Axis destination " << axisDst->getId()); - - if (this->position.isEmpty()) - ERROR("CExtractDomainToAxis::checkValid(CAxis* axisDst, CDomain* domainSrc)", - << "Position to extract axis must be defined. " << std::endl - << "Domain source " <getId() << std::endl - << "Axis destination " << axisDst->getId()); - - switch (direction) - { - case direction_attr::jDir: - if ((position < 0) || (position >= domain_ni_glo)) - ERROR("CExtractDomainToAxis::checkValid(CAxis* axisDst, CDomain* domainSrc)", - << "Extract domain along j, position should be inside 0 and ni_glo-1 of domain source" - << "Domain source " <getId() << " has ni_glo " << domain_ni_glo << std::endl - << "Axis destination " << axisDst->getId() << std::endl - << "Position " << position); - break; - - case direction_attr::iDir: - if ((position < 0) || (position >= domain_nj_glo)) - ERROR("CExtractDomainToAxis::checkValid(CAxis* axisDst, CDomain* domainSrc)", - << "Extract domain along i, position should be inside 0 and nj_glo-1 of domain source" - << "Domain source " <getId() << " has nj_glo " << domain_nj_glo << std::endl - << "Axis destination " << axisDst->getId() << std::endl - << "Position " << position); - break; - - default: - break; - } - } - - shared_ptr CExtractDomainToAxis::createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) - { - return CAxisAlgorithmExtractDomain::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, - elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, - elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition); - } -} diff --git a/xios_2311_src/trunk/.svn/pristine/00/00c00a6ee28d2511414161f64f086497532d706d.svn-base b/xios_2311_src/trunk/.svn/pristine/00/00c00a6ee28d2511414161f64f086497532d706d.svn-base deleted file mode 100644 index a6add8fff5f80218526162eceaf192aa8e55a16a..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/00/00c00a6ee28d2511414161f64f086497532d706d.svn-base +++ /dev/null @@ -1,2560 +0,0 @@ -#include "domain.hpp" -#include "attribute_template.hpp" -#include "object_template.hpp" -#include "group_template.hpp" - -#include "xios_spl.hpp" -#include "event_client.hpp" -#include "event_server.hpp" -#include "buffer_in.hpp" -#include "message.hpp" -#include "type.hpp" -#include "context.hpp" -#include "context_client.hpp" -#include "context_server.hpp" -#include "array_new.hpp" -#include "distribution_client.hpp" -#include "server_distribution_description.hpp" -#include "client_server_mapping_distributed.hpp" -#include "local_connector.hpp" -#include "grid_local_connector.hpp" -#include "remote_connector.hpp" -#include "gatherer_connector.hpp" -#include "scatterer_connector.hpp" -#include "grid_scatterer_connector.hpp" -#include "grid_gatherer_connector.hpp" -#include "transformation_path.hpp" -#include "grid_transformation_factory_impl.hpp" - -#include -#include - - -namespace xios { - - /// ////////////////////// Définitions ////////////////////// /// - - CDomain::CDomain(void) - : CObjectTemplate(), CDomainAttributes() - , isChecked(false), relFiles(), indSrv_(), connectedServerRank_() - , hasBounds(false), hasArea(false), isCompressible_(false), isUnstructed_(false) - , hasLonLat(false) - , isRedistributed_(false), hasPole(false) - , lonvalue(), latvalue(), bounds_lonvalue(), bounds_latvalue() - , clients(), hasLatInReadFile_(false), hasBoundsLatInReadFile_(false) - , hasLonInReadFile_(false), hasBoundsLonInReadFile_(false) - { - } - - CDomain::CDomain(const StdString & id) - : CObjectTemplate(id), CDomainAttributes() - , isChecked(false), relFiles(), indSrv_(), connectedServerRank_() - , hasBounds(false), hasArea(false), isCompressible_(false), isUnstructed_(false) - , hasLonLat(false) - , isRedistributed_(false), hasPole(false) - , lonvalue(), latvalue(), bounds_lonvalue(), bounds_latvalue() - , clients(), hasLatInReadFile_(false), hasBoundsLatInReadFile_(false) - , hasLonInReadFile_(false), hasBoundsLonInReadFile_(false) - { - } - - CDomain::~CDomain(void) - { - } - - void CDomain::releaseStaticAllocation(void) - { - transformationMapList_.clear() ; - CTransformation::unregisterAllTransformations() ; - CGridTransformationFactory::unregisterAllTransformations() ; - } - ///--------------------------------------------------------------- - - void CDomain::assignMesh(const StdString meshName, const int nvertex) - TRY - { - mesh = CMesh::getMesh(meshName, nvertex); - } - CATCH_DUMP_ATTR - - CDomain* CDomain::createDomain() - TRY - { - CDomain* domain = CDomainGroup::get("domain_definition")->createChild(); - return domain; - } - CATCH - - CDomain* CDomain::get(const string& id, bool noError) - { - const regex r("::"); - smatch m; - if (regex_search(id, m, r)) - { - if (m.size()!=1) ERROR("CDomain* CDomain::get(string& id)", <<" id = "< bad format id, separator :: append more than one time"); - string fieldId=m.prefix() ; - if (fieldId.empty()) ERROR("CDomain* CDomain::get(string& id)", <<" id = "< bad format id, field name is empty"); - string suffix=m.suffix() ; - if (!CField::has(fieldId)) - if (noError) return nullptr ; - else ERROR("CDomain* CDomain::get(string& id)", <<" id = "< field Id : < "< doesn't exist"); - CField* field=CField::get(fieldId) ; - return field->getAssociatedDomain(suffix, noError) ; - } - else - { - if (noError) if(!CObjectFactory::HasObject(id)) return nullptr ; - return CObjectFactory::GetObject(id).get(); - } - } - - bool CDomain::has(const string& id) - { - if (CDomain::get(id,true)==nullptr) return false ; - else return true ; - } - - CField* CDomain::getFieldFromId(const string& id) - { - const regex r("::"); - smatch m; - if (regex_search(id, m, r)) - { - if (m.size()!=1) ERROR("CField* CDomain::getFieldFromId(const string& id)", <<" id = "< bad format id, separator :: append more than one time"); - string fieldId=m.prefix() ; - if (fieldId.empty()) ERROR("CField* CDomain::getFieldFromId(const string& id)", <<" id = "< bad format id, field name is empty"); - string suffix=m.suffix() ; - CField* field=CField::get(fieldId) ; - return field ; - } - else return nullptr; - } - - const std::set & CDomain::getRelFiles(void) const - TRY - { - return (this->relFiles); - } - CATCH - - //---------------------------------------------------------------- - - /*! - * Compute the minimum buffer size required to send the attributes to the server(s). - * - * \return A map associating the server rank with its minimum buffer size. - */ - std::map CDomain::getAttributesBufferSize(CContextClient* client, bool bufferForWriting /*= false*/) - TRY - { - - std::map attributesSizes = getMinimumBufferSizeForAttributes(client); - - if (client->isServerLeader()) - { - // size estimation for sendDistributionAttribut - size_t size = 11 * sizeof(size_t); - - const std::list& ranks = client->getRanksServerLeader(); - for (std::list::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) - { - if (size > attributesSizes[*itRank]) - attributesSizes[*itRank] = size; - } - } - - std::unordered_map >::const_iterator itIndexEnd = indSrv_[client->serverSize].end(); - // std::map >::const_iterator itWrittenIndexEnd = indWrittenSrv_.end(); - for (size_t k = 0; k < connectedServerRank_[client->serverSize].size(); ++k) - { - int rank = connectedServerRank_[client->serverSize][k]; - std::unordered_map >::const_iterator it = indSrv_[client->serverSize].find(rank); - size_t idxCount = (it != itIndexEnd) ? it->second.size() : 0; - - // size estimation for sendIndex (and sendArea which is always smaller or equal) - size_t sizeIndexEvent = 2 * sizeof(size_t) + 2 * CArray::size(idxCount); - - // size estimation for sendLonLat - size_t sizeLonLatEvent = CArray::size(idxCount); - if (hasBounds) - sizeLonLatEvent += CArray::size(nvertex * idxCount); - - size_t size = CEventClient::headerSize + getId().size() + sizeof(size_t) + std::max(sizeIndexEvent, sizeLonLatEvent); - if (size > attributesSizes[rank]) - attributesSizes[rank] = size; - } - - return attributesSizes; - } - CATCH_DUMP_ATTR - - //---------------------------------------------------------------- - - bool CDomain::isEmpty(void) const - TRY - { - return ((this->i_index.isEmpty()) || (0 == this->i_index.numElements())); - } - CATCH - - //---------------------------------------------------------------- - - bool CDomain::IsWritten(const StdString & filename) const - TRY - { - return (this->relFiles.find(filename) != this->relFiles.end()); - } - CATCH - - bool CDomain::isWrittenCompressed(const StdString& filename) const - TRY - { - return (this->relFilesCompressed.find(filename) != this->relFilesCompressed.end()); - } - CATCH - - //---------------------------------------------------------------- - - bool CDomain::isDistributed(void) const - TRY - { - bool distributed = !((!ni.isEmpty() && (ni == ni_glo) && !nj.isEmpty() && (nj == nj_glo)) || - (!i_index.isEmpty() && i_index.numElements() == ni_glo*nj_glo)); - bool distributed_glo ; - distributed |= (1 == CContext::getCurrent()->intraCommSize_); - - return distributed; - } - CATCH - - //---------------------------------------------------------------- - - /*! - * Compute if the domain can be ouput in a compressed way. - * In this case the workflow view on server side must be the same - * than the full view for all context rank. The result is stored on - * internal isCompressible_ attribute. - */ - void CDomain::computeIsCompressible(void) - TRY - { - // mesh is compressible contains some masked or indexed value, ie if full view is different of workflow view. - // But now assume that the size of the 2 view must be equal for everybody. True on server side - int isSameView = getLocalView(CElementView::FULL)->getSize() == getLocalView(CElementView::WORKFLOW)->getSize(); - MPI_Allreduce(MPI_IN_PLACE, &isSameView, 1, MPI_INT, MPI_LAND, CContext::getCurrent()->getIntraComm()) ; - if (isSameView) isCompressible_ = false ; - else isCompressible_ = true ; - isCompressibleComputed_=true ; - } - CATCH - - void CDomain::addRelFile(const StdString & filename) - TRY - { - this->relFiles.insert(filename); - } - CATCH_DUMP_ATTR - - void CDomain::addRelFileCompressed(const StdString& filename) - TRY - { - this->relFilesCompressed.insert(filename); - } - CATCH_DUMP_ATTR - - StdString CDomain::GetName(void) { return (StdString("domain")); } - StdString CDomain::GetDefName(void){ return (CDomain::GetName()); } - ENodeType CDomain::GetType(void) { return (eDomain); } - - //---------------------------------------------------------------- - - /*! - Verify if all distribution information of a domain are available - This checking verifies the definition of distribution attributes (ni, nj, ibegin, jbegin) - */ - bool CDomain::distributionAttributesHaveValue() const - TRY - { - bool hasValues = true; - - if (ni.isEmpty() && ibegin.isEmpty() && i_index.isEmpty()) - { - hasValues = false; - return hasValues; - } - - return hasValues; - } - CATCH - - /*! - Redistribute RECTILINEAR or CURVILINEAR domain with a number of local domains. - All attributes ni,nj,ibegin,jbegin (if defined) will be rewritten - The optional attributes lonvalue, latvalue will be added. Because this function only serves (for now) - for interpolation from unstructured domain to rectilinear one, range of latvalue is 0-360 and lonvalue is -90 - +90 - \param [in] nbLocalDomain number of local domain on the domain destination - */ - void CDomain::redistribute(int nbLocalDomain) - TRY - { - if (this->isRedistributed_) return; - - this->isRedistributed_ = true; - CContext* context = CContext::getCurrent(); - // For now the assumption is that secondary server pools consist of the same number of procs. - // CHANGE the line below if the assumption changes. - - int rankClient = context->intraCommRank_; - int rankOnDomain = rankClient%nbLocalDomain; - - if (ni_glo.isEmpty() || ni_glo <= 0 ) - { - ERROR("CDomain::redistribute(int nbLocalDomain)", - << "[ Id = " << this->getId() << " ] " - << "The global domain is badly defined," - << " check the \'ni_glo\' value !") - } - - if (nj_glo.isEmpty() || nj_glo <= 0 ) - { - ERROR("CDomain::redistribute(int nbLocalDomain)", - << "[ Id = " << this->getId() << " ] " - << "The global domain is badly defined," - << " check the \'nj_glo\' value !") - } - - if ((type_attr::rectilinear == type) || (type_attr::curvilinear == type)) - { - int globalDomainSize = ni_glo * nj_glo; - if (globalDomainSize <= nbLocalDomain) - { - for (int idx = 0; idx < nbLocalDomain; ++idx) - { - if (rankOnDomain < globalDomainSize) - { - int iIdx = rankOnDomain % ni_glo; - int jIdx = rankOnDomain / ni_glo; - ibegin.setValue(iIdx); jbegin.setValue(jIdx); - ni.setValue(1); nj.setValue(1); - } - else - { - ibegin.setValue(0); jbegin.setValue(0); - ni.setValue(0); nj.setValue(0); - } - } - } - else - { - float njGlo = nj_glo.getValue(); - float niGlo = ni_glo.getValue(); - int nbProcOnX, nbProcOnY, range; - - // Compute (approximately) number of segment on x and y axis - float yOverXRatio = njGlo/niGlo; - - nbProcOnX = std::ceil(std::sqrt(nbLocalDomain/yOverXRatio)); - nbProcOnY = std::ceil(((float)nbLocalDomain)/nbProcOnX); - - // Simple distribution: Sweep from top to bottom, left to right - // Calculate local begin on x - std::vector ibeginVec(nbProcOnX,0), jbeginVec(nbProcOnY,0); - std::vector niVec(nbProcOnX), njVec(nbProcOnY); - for (int i = 1; i < nbProcOnX; ++i) - { - range = ni_glo / nbProcOnX; - if (i < (ni_glo%nbProcOnX)) ++range; - niVec[i-1] = range; - ibeginVec[i] = ibeginVec[i-1] + niVec[i-1]; - } - niVec[nbProcOnX-1] = ni_glo - ibeginVec[nbProcOnX-1]; - - // Calculate local begin on y - for (int j = 1; j < nbProcOnY; ++j) - { - range = nj_glo / nbProcOnY; - if (j < (nj_glo%nbProcOnY)) ++range; - njVec[j-1] = range; - jbeginVec[j] = jbeginVec[j-1] + njVec[j-1]; - } - njVec[nbProcOnY-1] = nj_glo - jbeginVec[nbProcOnY-1]; - - // Now assign value to ni, ibegin, nj, jbegin - int iIdx = rankOnDomain % nbProcOnX; - int jIdx = rankOnDomain / nbProcOnX; - - if (rankOnDomain != (nbLocalDomain-1)) - { - ibegin.setValue(ibeginVec[iIdx]); - jbegin.setValue(jbeginVec[jIdx]); - nj.setValue(njVec[jIdx]); - ni.setValue(niVec[iIdx]); - } - else // just merge all the remaining rectangle into the last one - { - ibegin.setValue(ibeginVec[iIdx]); - jbegin.setValue(jbeginVec[jIdx]); - nj.setValue(njVec[jIdx]); - ni.setValue(ni_glo - ibeginVec[iIdx]); - } - } - } - else // unstructured domain - { - if (this->i_index.isEmpty()) - { - int globalDomainSize = ni_glo * nj_glo; - if (globalDomainSize <= nbLocalDomain) - { - for (int idx = 0; idx < nbLocalDomain; ++idx) - { - if (rankOnDomain < globalDomainSize) - { - int iIdx = rankOnDomain % ni_glo; - int jIdx = rankOnDomain / ni_glo; - ibegin.setValue(iIdx); jbegin.setValue(jIdx); - ni.setValue(1); nj.setValue(1); - } - else - { - ibegin.setValue(0); jbegin.setValue(0); - ni.setValue(0); nj.setValue(0); - } - } - } - else - { - float njGlo = nj_glo.getValue(); - float niGlo = ni_glo.getValue(); - std::vector ibeginVec(nbLocalDomain,0); - std::vector niVec(nbLocalDomain); - for (int i = 1; i < nbLocalDomain; ++i) - { - int range = ni_glo / nbLocalDomain; - if (i < (ni_glo%nbLocalDomain)) ++range; - niVec[i-1] = range; - ibeginVec[i] = ibeginVec[i-1] + niVec[i-1]; - } - niVec[nbLocalDomain-1] = ni_glo - ibeginVec[nbLocalDomain-1]; - - int iIdx = rankOnDomain % nbLocalDomain; - ibegin.setValue(ibeginVec[iIdx]); - jbegin.setValue(0); - ni.setValue(niVec[iIdx]); - nj.setValue(1); - } - - i_index.resize(ni); - for(int idx = 0; idx < ni; ++idx) i_index(idx)=ibegin+idx; - } - else - { - ibegin.setValue(this->i_index(0)); - jbegin.setValue(0); - ni.setValue(this->i_index.numElements()); - nj.setValue(1); - } - } - - checkDomain(); - } - CATCH_DUMP_ATTR - - /*! - Fill in longitude and latitude whose values are read from file - */ - void CDomain::fillInLonLat() - TRY - { - switch (type) - { - case type_attr::rectilinear: - fillInRectilinearLonLat(); - break; - case type_attr::curvilinear: - fillInCurvilinearLonLat(); - break; - case type_attr::unstructured: - fillInUnstructuredLonLat(); - break; - - default: - break; - } - completeLonLatClient() ; - } - CATCH_DUMP_ATTR - - /*! - Fill in the values for lonvalue_1d and latvalue_1d of rectilinear domain - Range of longitude value from 0 - 360 - Range of latitude value from -90 - +90 - */ - void CDomain::fillInRectilinearLonLat() - TRY - { - if (!lonvalue_rectilinear_read_from_file.isEmpty() && lonvalue_2d.isEmpty() && lonvalue_1d.isEmpty()) - { - lonvalue_1d.resize(ni); - for (int idx = 0; idx < ni; ++idx) - lonvalue_1d(idx) = lonvalue_rectilinear_read_from_file(idx+ibegin); - lon_start.setValue(lonvalue_rectilinear_read_from_file(0)); - lon_end.setValue(lonvalue_rectilinear_read_from_file(ni_glo-1)); - } - else if (!hasLonInReadFile_) - { - if (!lonvalue_2d.isEmpty()) lonvalue_2d.free(); - lonvalue_1d.resize(ni); - double lonRange = lon_end - lon_start; - double lonStep = (1 == ni_glo.getValue()) ? lonRange : lonRange/double(ni_glo.getValue()-1); - - // Assign lon value - for (int i = 0; i < ni; ++i) - { - if (0 == (ibegin + i)) - { - lonvalue_1d(i) = lon_start; - } - else if (ni_glo == (ibegin + i + 1)) - { - lonvalue_1d(i) = lon_end; - } - else - { - lonvalue_1d(i) = (ibegin + i) * lonStep + lon_start; - } - } - } - - - if (!latvalue_rectilinear_read_from_file.isEmpty() && latvalue_2d.isEmpty() && latvalue_1d.isEmpty()) - { - latvalue_1d.resize(nj); - for (int idx = 0; idx < nj; ++idx) - latvalue_1d(idx) = latvalue_rectilinear_read_from_file(idx+jbegin); - lat_start.setValue(latvalue_rectilinear_read_from_file(0)); - lat_end.setValue(latvalue_rectilinear_read_from_file(nj_glo-1)); - } - else if (!hasLatInReadFile_) - { - if (!latvalue_2d.isEmpty()) latvalue_1d.free(); - latvalue_1d.resize(nj); - - double latRange = lat_end - lat_start; - double latStep = (1 == nj_glo.getValue()) ? latRange : latRange/double(nj_glo.getValue()-1); - - for (int j = 0; j < nj; ++j) - { - if (0 == (jbegin + j)) - { - latvalue_1d(j) = lat_start; - } - else if (nj_glo == (jbegin + j + 1)) - { - latvalue_1d(j) = lat_end; - } - else - { - latvalue_1d(j) = (jbegin + j) * latStep + lat_start; - } - } - } - } - CATCH_DUMP_ATTR - - /* - Fill in 2D longitude and latitude of curvilinear domain read from a file. - If there are already longitude and latitude defined by model. We just ignore read value. - */ - void CDomain::fillInCurvilinearLonLat() - TRY - { - if (!lonvalue_curvilinear_read_from_file.isEmpty() && lonvalue_2d.isEmpty() && lonvalue_1d.isEmpty()) - { - lonvalue_2d.resize(ni,nj); - for (int jdx = 0; jdx < nj; ++jdx) - for (int idx = 0; idx < ni; ++idx) - lonvalue_2d(idx,jdx) = lonvalue_curvilinear_read_from_file(idx, jdx); - - lonvalue_curvilinear_read_from_file.free(); - } - - if (!latvalue_curvilinear_read_from_file.isEmpty() && latvalue_2d.isEmpty() && latvalue_1d.isEmpty()) - { - latvalue_2d.resize(ni,nj); - for (int jdx = 0; jdx < nj; ++jdx) - for (int idx = 0; idx < ni; ++idx) - latvalue_2d(idx,jdx) = latvalue_curvilinear_read_from_file(idx, jdx); - - latvalue_curvilinear_read_from_file.free(); - } - - if (!bounds_lonvalue_curvilinear_read_from_file.isEmpty() && bounds_lon_2d.isEmpty() && bounds_lon_1d.isEmpty()) - { - bounds_lon_2d.resize(nvertex,ni,nj); - for (int jdx = 0; jdx < nj; ++jdx) - for (int idx = 0; idx < ni; ++idx) - for (int ndx = 0; ndx < nvertex; ++ndx) - bounds_lon_2d(ndx,idx,jdx) = bounds_lonvalue_curvilinear_read_from_file(ndx,idx, jdx); - - bounds_lonvalue_curvilinear_read_from_file.free(); - } - - if (!bounds_latvalue_curvilinear_read_from_file.isEmpty() && bounds_lat_2d.isEmpty() && bounds_lat_1d.isEmpty()) - { - bounds_lat_2d.resize(nvertex,ni,nj); - for (int jdx = 0; jdx < nj; ++jdx) - for (int idx = 0; idx < ni; ++idx) - for (int ndx = 0; ndx < nvertex; ++ndx) - bounds_lat_2d(ndx,idx,jdx) = bounds_latvalue_curvilinear_read_from_file(ndx,idx, jdx); - - bounds_latvalue_curvilinear_read_from_file.free(); - } - } - CATCH_DUMP_ATTR - - /* - Fill in longitude and latitude of unstructured domain read from a file - If there are already longitude and latitude defined by model. We just igonore reading value. - */ - void CDomain::fillInUnstructuredLonLat() - TRY - { - if (i_index.isEmpty()) - { - i_index.resize(ni); - for(int idx = 0; idx < ni; ++idx) i_index(idx)=ibegin+idx; - } - - if (!lonvalue_unstructured_read_from_file.isEmpty() && lonvalue_1d.isEmpty()) - { - lonvalue_1d.resize(ni); - for (int idx = 0; idx < ni; ++idx) - lonvalue_1d(idx) = lonvalue_unstructured_read_from_file(idx); - - // We dont need these values anymore, so just delete them - lonvalue_unstructured_read_from_file.free(); - } - - if (!latvalue_unstructured_read_from_file.isEmpty() && latvalue_1d.isEmpty()) - { - latvalue_1d.resize(ni); - for (int idx = 0; idx < ni; ++idx) - latvalue_1d(idx) = latvalue_unstructured_read_from_file(idx); - - // We dont need these values anymore, so just delete them - latvalue_unstructured_read_from_file.free(); - } - - if (!bounds_lonvalue_unstructured_read_from_file.isEmpty() && bounds_lon_1d.isEmpty()) - { - int nbVertex = nvertex; - bounds_lon_1d.resize(nbVertex,ni); - for (int idx = 0; idx < ni; ++idx) - for (int jdx = 0; jdx < nbVertex; ++jdx) - bounds_lon_1d(jdx,idx) = bounds_lonvalue_unstructured_read_from_file(jdx, idx); - - // We dont need these values anymore, so just delete them - bounds_lonvalue_unstructured_read_from_file.free(); - } - - if (!bounds_latvalue_unstructured_read_from_file.isEmpty() && bounds_lat_1d.isEmpty()) - { - int nbVertex = nvertex; - bounds_lat_1d.resize(nbVertex,ni); - for (int idx = 0; idx < ni; ++idx) - for (int jdx = 0; jdx < nbVertex; ++jdx) - bounds_lat_1d(jdx,idx) = bounds_latvalue_unstructured_read_from_file(jdx, idx); - - // We dont need these values anymore, so just delete them - bounds_latvalue_unstructured_read_from_file.free(); - } - } - CATCH_DUMP_ATTR - - /* - Get global longitude and latitude of rectilinear domain. - */ - void CDomain::AllgatherRectilinearLonLat(CArray& lon, CArray& lat, CArray& lon_g, CArray& lat_g) - TRY - { - CContext* context = CContext::getCurrent(); - // For now the assumption is that secondary server pools consist of the same number of procs. - // CHANGE the line below if the assumption changes. - int clientSize = context->intraCommSize_ ; - lon_g.resize(ni_glo) ; - lat_g.resize(nj_glo) ; - - - int* ibegin_g = new int[clientSize] ; - int* jbegin_g = new int[clientSize] ; - int* ni_g = new int[clientSize] ; - int* nj_g = new int[clientSize] ; - int v ; - v=ibegin ; - MPI_Allgather(&v,1,MPI_INT,ibegin_g,1,MPI_INT,context->intraComm_) ; - v=jbegin ; - MPI_Allgather(&v,1,MPI_INT,jbegin_g,1,MPI_INT,context->intraComm_) ; - v=ni ; - MPI_Allgather(&v,1,MPI_INT,ni_g,1,MPI_INT,context->intraComm_) ; - v=nj ; - MPI_Allgather(&v,1,MPI_INT,nj_g,1,MPI_INT,context->intraComm_) ; - - MPI_Allgatherv(lon.dataFirst(),ni,MPI_DOUBLE,lon_g.dataFirst(),ni_g, ibegin_g,MPI_DOUBLE,context->intraComm_) ; - MPI_Allgatherv(lat.dataFirst(),nj,MPI_DOUBLE,lat_g.dataFirst(),nj_g, jbegin_g,MPI_DOUBLE,context->intraComm_) ; - - delete[] ibegin_g ; - delete[] jbegin_g ; - delete[] ni_g ; - delete[] nj_g ; - } - CATCH_DUMP_ATTR - - void CDomain::fillInRectilinearBoundLonLat(CArray& lon, CArray& lat, - CArray& boundsLon, CArray& boundsLat) - TRY - { - int i,j,k; - - const int nvertexValue = 4; - boundsLon.resize(nvertexValue,ni*nj); - - if (ni_glo>1) - { - double lonStepStart = lon(1)-lon(0); - bounds_lon_start=lon(0) - lonStepStart/2; - double lonStepEnd = lon(ni_glo-1)-lon(ni_glo-2); - bounds_lon_end=lon(ni_glo-1) + lonStepEnd/2; - double errorBoundsLon = std::abs(360-std::abs(bounds_lon_end-bounds_lon_start)); - - // if errorBoundsLon is reasonably small (0.1 x cell size) consider it as closed in longitude - if (errorBoundsLon < std::abs(lonStepStart)*1e-1 || errorBoundsLon < std::abs(lonStepEnd)*1e-1 ) - { - bounds_lon_start= (lon(0) + lon(ni_glo-1)-360)/2 ; - bounds_lon_end= (lon(0) +360 + lon(ni_glo-1))/2 ; - } - } - else - { - if (bounds_lon_start.isEmpty()) bounds_lon_start=-180. ; - if (bounds_lon_end.isEmpty()) bounds_lon_end=180.-1e-8 ; - } - - for(j=0;j::epsilon()) isNorthPole = true; - if (std::abs(90 - std::abs(lat(nj_glo-1))) < NumTraits::epsilon()) isSouthPole = true; - - // lat boundaries beyond pole the assimilate it to pole - // lat boundarie is relativelly close to pole (0.1 x cell size) assimilate it to pole - if (nj_glo>1) - { - double latStepStart = lat(1)-lat(0); - if (isNorthPole) bounds_lat_start=lat(0); - else - { - bounds_lat_start=lat(0)-latStepStart/2; - if (bounds_lat_start >= 90 ) bounds_lat_start=90 ; - else if (bounds_lat_start <= -90 ) bounds_lat_start=-90 ; - else if (bounds_lat_start <= 90 && bounds_lat_start >= lat(0)) - { - if ( std::abs(90-bounds_lat_start) <= 0.1*std::abs(latStepStart)) bounds_lat_start=90 ; - } - else if (bounds_lat_start >= -90 && bounds_lat_start <= lat(0)) - { - if ( std::abs(-90 - bounds_lat_start) <= 0.1*std::abs(latStepStart)) bounds_lat_start=-90 ; - } - } - - double latStepEnd = lat(nj_glo-1)-lat(nj_glo-2); - if (isSouthPole) bounds_lat_end=lat(nj_glo-1); - else - { - bounds_lat_end=lat(nj_glo-1)+latStepEnd/2; - - if (bounds_lat_end >= 90 ) bounds_lat_end=90 ; - else if (bounds_lat_end <= -90 ) bounds_lat_end=-90 ; - else if (bounds_lat_end <= 90 && bounds_lat_end >= lat(nj_glo-1)) - { - if ( std::abs(90-bounds_lat_end) <= 0.1*std::abs(latStepEnd)) bounds_lat_end=90 ; - } - else if (bounds_lat_end >= -90 && bounds_lat_end <= lat(nj_glo-1)) - { - if ( std::abs(-90 - bounds_lat_end) <= 0.1*std::abs(latStepEnd)) bounds_lat_end=-90 ; - } - } - } - else - { - if (bounds_lat_start.isEmpty()) bounds_lat_start=-90. ; - if (bounds_lat_end.isEmpty()) bounds_lat_end=90 ; - } - - for(j=0;j to be checked why is it transposed - } - - if (ni_glo.isEmpty()) - { - ERROR("CDomain::checkDomain(void)", - << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " - << "The global domain is badly defined, " - << "the mandatory 'ni_glo' attribute is missing.") - } - else if (ni_glo <= 0) - { - ERROR("CDomain::checkDomain(void)", - << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " - << "The global domain is badly defined, " - << "'ni_glo' attribute should be strictly positive so 'ni_glo = " << ni_glo.getValue() << "' is invalid.") - } - - if (nj_glo.isEmpty()) - { - ERROR("CDomain::checkDomain(void)", - << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " - << "The global domain is badly defined, " - << "the mandatory 'nj_glo' attribute is missing.") - } - else if (nj_glo <= 0) - { - ERROR("CDomain::checkDomain(void)", - << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " - << "The global domain is badly defined, " - << "'nj_glo' attribute should be strictly positive so 'nj_glo = " << nj_glo.getValue() << "' is invalid.") - } - - checkLocalIDomain(); - checkLocalJDomain(); - - if (i_index.isEmpty()) - { - i_index.resize(ni*nj); - for (int j = 0; j < nj; ++j) - for (int i = 0; i < ni; ++i) i_index(i+j*ni) = i+ibegin; - } - - if (j_index.isEmpty()) - { - j_index.resize(ni*nj); - for (int j = 0; j < nj; ++j) - for (int i = 0; i < ni; ++i) j_index(i+j*ni) = j+jbegin; - } - } - CATCH_DUMP_ATTR - - size_t CDomain::getGlobalWrittenSize(void) - { - return ni_glo*nj_glo ; - } - //---------------------------------------------------------------- - - // Check validity of local domain on using the combination of 3 parameters: ibegin, ni and i_index - void CDomain::checkLocalIDomain(void) - TRY - { - // If ibegin and ni are provided then we use them to check the validity of local domain - if (i_index.isEmpty() && !ibegin.isEmpty() && !ni.isEmpty()) - { - if ((ni.getValue() < 0 || ibegin.getValue() < 0) || ((ibegin.getValue() + ni.getValue()) > ni_glo.getValue())) - { - ERROR("CDomain::checkLocalIDomain(void)", - << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " - << "The local domain is wrongly defined," - << " check the attributes 'ni_glo' (" << ni_glo.getValue() << "), 'ni' (" << ni.getValue() << ") and 'ibegin' (" << ibegin.getValue() << ")"); - } - } - - // i_index has higher priority than ibegin and ni - if (!i_index.isEmpty()) - { - int minIIndex = (0 < i_index.numElements()) ? i_index(0) : 0; - if (ni.isEmpty()) - { - // No information about ni - int minIndex = ni_glo - 1; - int maxIndex = 0; - for (int idx = 0; idx < i_index.numElements(); ++idx) - { - if (i_index(idx) < minIndex) minIndex = i_index(idx); - if (i_index(idx) > maxIndex) maxIndex = i_index(idx); - } - if (i_index.numElements()) { - ni = maxIndex - minIndex + 1; - minIIndex = minIndex; - } - else { - ni = 0; - } - } - - // It's not so correct but if ibegin is not the first value of i_index - // then data on local domain has user-defined distribution. In this case, ibegin, ni have no meaning. - if (ibegin.isEmpty()) ibegin = minIIndex; - } - else if (ibegin.isEmpty() && ni.isEmpty()) - { - ibegin = 0; - ni = ni_glo; - } - else if ((!ibegin.isEmpty() && ni.isEmpty()) || (ibegin.isEmpty() && !ni.isEmpty())) - { - ERROR("CDomain::checkLocalIDomain(void)", - << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " - << "The local domain is wrongly defined," << endl - << "i_index is empty and either 'ni' or 'ibegin' is not defined. " - << "If 'ni' and 'ibegin' are used to define a domain, both of them must not be empty."); - } - - - if ((ni.getValue() < 0 || ibegin.getValue() < 0)) - { - ERROR("CDomain::checkLocalIDomain(void)", - << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " - << "The local domain is wrongly defined," - << " check the attributes 'ni_glo' (" << ni_glo.getValue() << "), 'ni' (" << ni.getValue() << ") and 'ibegin' (" << ibegin.getValue() << ")"); - } - } - CATCH_DUMP_ATTR - - // Check validity of local domain on using the combination of 3 parameters: jbegin, nj and j_index - void CDomain::checkLocalJDomain(void) - TRY - { - // If jbegin and nj are provided then we use them to check the validity of local domain - if (j_index.isEmpty() && !jbegin.isEmpty() && !nj.isEmpty()) - { - if ((nj.getValue() < 0 || jbegin.getValue() < 0) || (jbegin.getValue() + nj.getValue()) > nj_glo.getValue()) - { - ERROR("CDomain::checkLocalJDomain(void)", - << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " - << "The local domain is wrongly defined," - << " check the attributes 'nj_glo' (" << nj_glo.getValue() << "), 'nj' (" << nj.getValue() << ") and 'jbegin' (" << jbegin.getValue() << ")"); - } - } - - if (!j_index.isEmpty()) - { - int minJIndex = (0 < j_index.numElements()) ? j_index(0) : 0; - if (nj.isEmpty()) - { - // No information about nj - int minIndex = nj_glo - 1; - int maxIndex = 0; - for (int idx = 0; idx < j_index.numElements(); ++idx) - { - if (j_index(idx) < minIndex) minIndex = j_index(idx); - if (j_index(idx) > maxIndex) maxIndex = j_index(idx); - } - if (j_index.numElements()) { - nj = maxIndex - minIndex + 1; - minJIndex = minIndex; - } - else - nj = 0; - } - // It's the same as checkLocalIDomain. It's not so correct but if jbegin is not the first value of j_index - // then data on local domain has user-defined distribution. In this case, jbegin has no meaning. - if (jbegin.isEmpty()) jbegin = minJIndex; - } - else if (jbegin.isEmpty() && nj.isEmpty()) - { - jbegin = 0; - nj = nj_glo; - } - - - if ((nj.getValue() < 0 || jbegin.getValue() < 0)) - { - ERROR("CDomain::checkLocalJDomain(void)", - << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " - << "The local domain is wrongly defined," - << " check the attributes 'nj_glo' (" << nj_glo.getValue() << "), 'nj' (" << nj.getValue() << ") and 'jbegin' (" << jbegin.getValue() << ")"); - } - } - CATCH_DUMP_ATTR - - //---------------------------------------------------------------- - - void CDomain::checkMask(void) - TRY - { - if (!mask_1d.isEmpty() && !mask_2d.isEmpty()) - ERROR("CDomain::checkMask(void)", - << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " - << "Both mask_1d and mask_2d are defined but only one can be used at the same time." << std::endl - << "Please define only one mask: 'mask_1d' or 'mask_2d'."); - - if (!mask_1d.isEmpty() && mask_2d.isEmpty()) - { - if (mask_1d.numElements() != i_index.numElements()) - ERROR("CDomain::checkMask(void)", - << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " - << "'mask_1d' does not have the same size as the local domain." << std::endl - << "Local size is " << i_index.numElements() << "." << std::endl - << "Mask size is " << mask_1d.numElements() << "."); - } - - if (mask_1d.isEmpty() && !mask_2d.isEmpty()) - { - if (mask_2d.extent(0) != ni || mask_2d.extent(1) != nj) - ERROR("CDomain::checkMask(void)", - << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " - << "The mask does not have the same size as the local domain." << std::endl - << "Local size is " << ni.getValue() << " x " << nj.getValue() << "." << std::endl - << "Mask size is " << mask_2d.extent(0) << " x " << mask_2d.extent(1) << "."); - } - - if (!mask_2d.isEmpty()) - { - domainMask.resize(mask_2d.extent(0) * mask_2d.extent(1)); - for (int j = 0; j < nj; ++j) - for (int i = 0; i < ni; ++i) domainMask(i+j*ni) = mask_2d(i,j); -// mask_2d.reset(); - } - else if (mask_1d.isEmpty()) - { - domainMask.resize(i_index.numElements()); - for (int i = 0; i < i_index.numElements(); ++i) domainMask(i) = true; - } - else - { - domainMask.resize(mask_1d.numElements()); - domainMask=mask_1d ; - } - } - CATCH_DUMP_ATTR - - //---------------------------------------------------------------- - - void CDomain::checkDomainData(void) - TRY - { - if (data_dim.isEmpty()) - { - data_dim.setValue(1); - } - else if (!(data_dim.getValue() == 1 || data_dim.getValue() == 2)) - { - ERROR("CDomain::checkDomainData(void)", - << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " - << "The data dimension is invalid, 'data_dim' must be 1 or 2 not << " << data_dim.getValue() << "."); - } - - if (data_ibegin.isEmpty()) - data_ibegin.setValue(0); - if (data_jbegin.isEmpty()) - data_jbegin.setValue(0); - - if (data_ni.isEmpty()) - { - data_ni.setValue((data_dim == 1) ? (ni.getValue() * nj.getValue()) : ni.getValue()); - } - else if (data_ni.getValue() < 0) - { - ERROR("CDomain::checkDomainData(void)", - << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " - << "The data size cannot be negative ('data_ni' = " << data_ni.getValue() << ")."); - } - - if (data_nj.isEmpty()) - { - data_nj.setValue((data_dim.getValue() == 1) ? (ni.getValue() * nj.getValue()) : nj.getValue()); - } - else if (data_nj.getValue() < 0) - { - ERROR("CDomain::checkDomainData(void)", - << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " - << "The data size cannot be negative ('data_nj' = " << data_nj.getValue() << ")."); - } - } - CATCH_DUMP_ATTR - - //---------------------------------------------------------------- - - void CDomain::checkCompression(void) - TRY - { - int i,j,ind; - if (!data_i_index.isEmpty()) - { - if (!data_j_index.isEmpty() && - data_j_index.numElements() != data_i_index.numElements()) - { - ERROR("CDomain::checkCompression(void)", - << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " - << "'data_i_index' and 'data_j_index' arrays must have the same size." << std::endl - << "'data_i_index' size = " << data_i_index.numElements() << std::endl - << "'data_j_index' size = " << data_j_index.numElements()); - } - - if (2 == data_dim) - { - if (data_j_index.isEmpty()) - { - ERROR("CDomain::checkCompression(void)", - << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " - << "'data_j_index' must be defined when 'data_i_index' is set and 'data_dim' is 2."); - } - for (int k=0; k=0 && i=0 && j=0 && i < domainMask.size()) - { - if (!domainMask(i)) data_i_index(k) = -1; - } - else - data_i_index(k) = -1; - - if ( (i<0)||(!domainMask(i)) ) data_i_index(k) = -1; - } - } - } - else - { - if (data_dim == 2 && !data_j_index.isEmpty()) - ERROR("CDomain::checkCompression(void)", - << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " - << "'data_i_index' must be defined when 'data_j_index' is set and 'data_dim' is 2."); - - if (1 == data_dim) - { - data_i_index.resize(data_ni); - data_j_index.resize(data_ni); - data_j_index = 0; - - for (int k = 0; k < data_ni; ++k) - { - i=k+data_ibegin ; - if (i>=0 && i < domainMask.size()) - { - if ( (i<0)||(!domainMask(i)) ) - data_i_index(k) = -1; - else - data_i_index(k) = k; - } - else - data_i_index(k) = -1; - } - } - else // (data_dim == 2) - { - const int dsize = data_ni * data_nj; - data_i_index.resize(dsize); - data_j_index.resize(dsize); - - for(int count = 0, kj = 0; kj < data_nj; ++kj) - { - for(int ki = 0; ki < data_ni; ++ki, ++count) - { - i = ki + data_ibegin; - j = kj + data_jbegin; - ind=j*ni+i ; - if (i>=0 && i=0 && j=0 && i=0 && j=0 && i 0 && !hasBoundValues) - { - if (!bounds_lon_1d.isEmpty() && !bounds_lon_2d.isEmpty()) - ERROR("CDomain::checkBounds(void)", - << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " - << "Only one longitude boundary attribute can be used but both 'bounds_lon_1d' and 'bounds_lon_2d' are defined." << std::endl - << "Define only one longitude boundary attribute: 'bounds_lon_1d' or 'bounds_lon_2d'."); - - if (!bounds_lat_1d.isEmpty() && !bounds_lat_2d.isEmpty()) - ERROR("CDomain::checkBounds(void)", - << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " - << "Only one latitude boundary attribute can be used but both 'bounds_lat_1d' and 'bounds_lat_2d' are defined." << std::endl - << "Define only one latitude boundary attribute: 'bounds_lat_1d' or 'bounds_lat_2d'."); - - if ((!bounds_lon_1d.isEmpty() && bounds_lat_1d.isEmpty()) || (bounds_lon_1d.isEmpty() && !bounds_lat_1d.isEmpty())) - { - ERROR("CDomain::checkBounds(void)", - << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " - << "Only 'bounds_lon_1d' or 'bounds_lat_1d' is defined." << std::endl - << "Please define either both attributes or none."); - } - - if ((!bounds_lon_2d.isEmpty() && bounds_lat_2d.isEmpty()) || (bounds_lon_2d.isEmpty() && !bounds_lat_2d.isEmpty())) - { - ERROR("CDomain::checkBounds(void)", - << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " - << "Only 'bounds_lon_2d' or 'bounds_lat_2d' is defined." << std::endl - << "Please define either both attributes or none."); - } - - if (!bounds_lon_1d.isEmpty() && nvertex.getValue() != bounds_lon_1d.extent(0)) - ERROR("CDomain::checkBounds(void)", - << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " - << "'bounds_lon_1d' dimension is not compatible with 'nvertex'." << std::endl - << "'bounds_lon_1d' dimension is " << bounds_lon_1d.extent(0) - << " but nvertex is " << nvertex.getValue() << "."); - - if (!bounds_lon_2d.isEmpty() && nvertex.getValue() != bounds_lon_2d.extent(0)) - ERROR("CDomain::checkBounds(void)", - << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " - << "'bounds_lon_2d' dimension is not compatible with 'nvertex'." << std::endl - << "'bounds_lon_2d' dimension is " << bounds_lon_2d.extent(0) - << " but nvertex is " << nvertex.getValue() << "."); - - if (!bounds_lon_1d.isEmpty() && lonvalue_1d.isEmpty()) - ERROR("CDomain::checkBounds(void)", - << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " - << "Since 'bounds_lon_1d' is defined, 'lonvalue_1d' must be defined too." << std::endl); - - if (!bounds_lon_2d.isEmpty() && lonvalue_2d.isEmpty()) - ERROR("CDomain::checkBounds(void)", - << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " - << "Since 'bounds_lon_2d' is defined, 'lonvalue_2d' must be defined too." << std::endl); - - if (!bounds_lat_1d.isEmpty() && nvertex.getValue() != bounds_lat_1d.extent(0)) - ERROR("CDomain::checkBounds(void)", - << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " - << "'bounds_lat_1d' dimension is not compatible with 'nvertex'." << std::endl - << "'bounds_lat_1d' dimension is " << bounds_lat_1d.extent(0) - << " but nvertex is " << nvertex.getValue() << "."); - - if (!bounds_lat_2d.isEmpty() && nvertex.getValue() != bounds_lat_2d.extent(0)) - ERROR("CDomain::checkBounds(void)", - << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " - << "'bounds_lat_2d' dimension is not compatible with 'nvertex'." << std::endl - << "'bounds_lat_2d' dimension is " << bounds_lat_2d.extent(0) - << " but nvertex is " << nvertex.getValue() << "."); - - if (!bounds_lat_1d.isEmpty() && latvalue_1d.isEmpty()) - ERROR("CDomain::checkBounds(void)", - << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " - << "Since 'bounds_lat_1d' is defined, 'latvalue_1d' must be defined too." << std::endl); - - if (!bounds_lat_2d.isEmpty() && latvalue_2d.isEmpty()) - ERROR("CDomain::checkBounds(void)", - << "Since 'bounds_lat_2d' is defined, 'latvalue_2d' must be defined too." << std::endl); - - // In case of reading UGRID bounds values are not required - hasBounds = (!bounds_lat_1d.isEmpty() || !bounds_lat_2d.isEmpty() ); - } - else if (hasBoundValues) - { - hasBounds = true; - } - else - { - hasBounds = false; - } - } - CATCH_DUMP_ATTR - - void CDomain::checkArea(void) - TRY - { - bool hasAreaValue = (!areavalue.isEmpty() && 0 != areavalue.numElements()); - hasArea = !area.isEmpty(); - if (hasArea && !hasAreaValue) - { - if (area.extent(0) != ni || area.extent(1) != nj) - { - ERROR("CDomain::checkArea(void)", - << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " - << "The area does not have the same size as the local domain." << std::endl - << "Local size is " << ni.getValue() << " x " << nj.getValue() << "." << std::endl - << "Area size is " << area.extent(0) << " x " << area.extent(1) << "."); - } -// if (areavalue.isEmpty()) -// { -// areavalue.resize(ni*nj); -// for (int j = 0; j < nj; ++j) -// { -// for (int i = 0; i < ni; ++i) -// { -// int k = j * ni + i; -// areavalue(k) = area(i,j); -// } -// } -// } - } - } - CATCH_DUMP_ATTR - - void CDomain::checkLonLat() - TRY - { - if (!hasLonLat) hasLonLat = (!latvalue_1d.isEmpty() && !lonvalue_1d.isEmpty()) || - (!latvalue_2d.isEmpty() && !lonvalue_2d.isEmpty()); - bool hasLonLatValue = (0 != lonvalue.numElements()) || (0 != latvalue.numElements()); - if (hasLonLat && !hasLonLatValue) - { - if (!lonvalue_1d.isEmpty() && !lonvalue_2d.isEmpty()) - ERROR("CDomain::checkLonLat()", - << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " - << "Only one longitude attribute can be used but both 'lonvalue_1d' and 'lonvalue_2d' are defined." << std::endl - << "Define only one longitude attribute: 'lonvalue_1d' or 'lonvalue_2d'."); - - if (!lonvalue_1d.isEmpty() && lonvalue_2d.isEmpty()) - { - if ((type_attr::rectilinear != type) && (lonvalue_1d.numElements() != i_index.numElements())) - ERROR("CDomain::checkLonLat()", - << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " - << "'lonvalue_1d' does not have the same size as the local domain." << std::endl - << "Local size is " << i_index.numElements() << "." << std::endl - << "'lonvalue_1d' size is " << lonvalue_1d.numElements() << "."); - } - - if (lonvalue_1d.isEmpty() && !lonvalue_2d.isEmpty()) - { - if (lonvalue_2d.extent(0) != ni || lonvalue_2d.extent(1) != nj) - ERROR("CDomain::checkLonLat()", - << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " - << "'lonvalue_2d' does not have the same size as the local domain." << std::endl - << "Local size is " << ni.getValue() << " x " << nj.getValue() << "." << std::endl - << "'lonvalue_2d' size is " << lonvalue_2d.extent(0) << " x " << lonvalue_2d.extent(1) << "."); - } - - if (!latvalue_1d.isEmpty() && !latvalue_2d.isEmpty()) - ERROR("CDomain::checkLonLat()", - << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " - << "Only one latitude attribute can be used but both 'latvalue_1d' and 'latvalue_2d' are defined." << std::endl - << "Define only one latitude attribute: 'latvalue_1d' or 'latvalue_2d'."); - - if (!latvalue_1d.isEmpty() && latvalue_2d.isEmpty()) - { - if ((type_attr::rectilinear != type) && (latvalue_1d.numElements() != i_index.numElements())) - ERROR("CDomain::checkLonLat()", - << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " - << "'latvalue_1d' does not have the same size as the local domain." << std::endl - << "Local size is " << i_index.numElements() << "." << std::endl - << "'latvalue_1d' size is " << latvalue_1d.numElements() << "."); - } - - if (latvalue_1d.isEmpty() && !latvalue_2d.isEmpty()) - { - if (latvalue_2d.extent(0) != ni || latvalue_2d.extent(1) != nj) - ERROR("CDomain::checkLonLat()", - << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " - << "'latvalue_2d' does not have the same size as the local domain." << std::endl - << "Local size is " << ni.getValue() << " x " << nj.getValue() << "." << std::endl - << "'latvalue_2d' size is " << latvalue_2d.extent(0) << " x " << latvalue_2d.extent(1) << "."); - } - } - } - CATCH_DUMP_ATTR - - void CDomain::checkAttributes(void) - TRY - { - if (this->checkAttributes_done_) return; - this->checkDomain(); - this->checkLonLat(); - this->checkBounds(); - this->checkArea(); - this->checkMask(); - this->checkDomainData(); - this->checkCompression(); - this->computeLocalMask() ; - this->completeLonLatClient(); - this->initializeLocalElement() ; - this->addFullView() ; // probably do not automatically add View, but only if requested - this->addWorkflowView() ; // probably do not automatically add View, but only if requested - this->addModelView() ; // probably do not automatically add View, but only if requested - // testing ? - /* - shared_ptr local = localElement_->getView(CElementView::WORKFLOW) ; - shared_ptr model = localElement_->getView(CElementView::MODEL) ; - - CLocalConnector test1(model, local) ; - test1.computeConnector() ; - CLocalConnector test2(local, model) ; - test2.computeConnector() ; - CGridLocalConnector gridTest1(vector{&test1}) ; - CGridLocalConnector gridTest2(vector{&test2}) ; - - - CArray out1 ; - CArray out2 ; - test1.transfer(data_i_index,out1,-111) ; - test2.transfer(out1,out2,-111) ; - - out1 = 0 ; - out2 = 0 ; - gridTest1.transfer(data_i_index,out1,-111) ; - gridTest2.transfer(out1, out2,-111) ; - */ - this->checkAttributes_done_ = true; - } - CATCH_DUMP_ATTR - - - void CDomain::initializeLocalElement(void) - { - // after checkDomain i_index and j_index of size (ni*nj) - int nij = ni*nj ; - CArray ij_index(ni*nj) ; - for(int ij=0; ijgetIntraCommRank() ; - localElement_ = make_shared(rank, ni_glo*nj_glo, ij_index) ; - } - - void CDomain::addFullView(void) - { - CArray index(ni*nj) ; - int nij=ni*nj ; - for(int ij=0; ij addView(CElementView::FULL, index) ; - } - - void CDomain::addWorkflowView(void) - { - // information for workflow view is stored in localMask - int nij=ni*nj ; - int nMask=0 ; - for(int ij=0; ij index(nMask) ; - - nMask=0 ; - for(int ij=0; ij addView(CElementView::WORKFLOW, index) ; - } - - void CDomain::addModelView(void) - { - // information for model view is stored in data_i_index/data_j_index - // very weird, do not mix data_i_index and data_i_begin => in future only keep data_i_index - int dataSize = data_i_index.numElements() ; - CArray index(dataSize) ; - int i,j ; - for(int k=0;k=0 && i=0 && j=0 && iaddView(CElementView::MODEL, index) ; - } - - void CDomain::computeModelToWorkflowConnector(void) - { - shared_ptr srcView=getLocalView(CElementView::MODEL) ; - shared_ptr dstView=getLocalView(CElementView::WORKFLOW) ; - modelToWorkflowConnector_ = make_shared(srcView, dstView); - modelToWorkflowConnector_->computeConnector() ; - } - - - string CDomain::getCouplingAlias(const string& fieldId, int posInGrid) - { - return "_domain["+std::to_string(posInGrid)+"]_of_"+fieldId ; - } - - /* to be removed later when coupling will be reimplemented, just to not forget */ - void CDomain::sendDomainToCouplerOut(CContextClient* client, const string& fieldId, int posInGrid) - { - if (sendDomainToFileServer_done_.count(client)!=0) return ; - else sendDomainToFileServer_done_.insert(client) ; - - const string domainId = getCouplingAlias(fieldId, posInGrid) ; - - if (!domain_ref.isEmpty()) - { - auto domain_ref_tmp=domain_ref.getValue() ; - domain_ref.reset() ; // remove the reference, find an other way to do that more cleanly - this->sendAllAttributesToServer(client, domainId) ; - domain_ref = domain_ref_tmp ; - } - else this->sendAllAttributesToServer(client, domainId) ; - } - - - - - void CDomain::makeAliasForCoupling(const string& fieldId, int posInGrid) - { - const string domainId = getCouplingAlias(fieldId, posInGrid); - this->createAlias(domainId) ; - } - - - void CDomain::computeRemoteElement(CContextClient* client, EDistributionType distType) - TRY - { - CContext* context = CContext::getCurrent(); - map> globalIndex ; -/* old method - if (type==EDistributionType::BANDS) // Bands distribution to send to file server - { - int nbServer = client->serverSize; - std::vector nGlobDomain(2); - nGlobDomain[0] = this->ni_glo; - nGlobDomain[1] = this->nj_glo; - - // to be changed in future, need to rewrite more simply domain distribution - CServerDistributionDescription serverDescription(nGlobDomain, nbServer); - int distributedPosition ; - if (isUnstructed_) distributedPosition = 0 ; - else distributedPosition = 1 ; - - std::vector > serverIndexBegin = serverDescription.getServerIndexBegin(); - std::vector > serverDimensionSizes = serverDescription.getServerDimensionSizes(); - vector>> indexServerOnElement ; - CArray axisDomainOrder(1) ; axisDomainOrder(0)=2 ; - auto zeroIndex=serverDescription.computeServerGlobalByElement(indexServerOnElement, context->getIntraCommRank(), context->getIntraCommSize(), - axisDomainOrder,distributedPosition) ; - // distribution is very bad => to redo - // convert indexServerOnElement => map> - need to be changed later - map> vectGlobalIndex ; - for(auto& indexRanks : indexServerOnElement[0]) - { - size_t index=indexRanks.first ; - auto& ranks=indexRanks.second ; - for(int rank : ranks) vectGlobalIndex[rank].push_back(index) ; - } - for(auto& vect : vectGlobalIndex ) globalIndex.emplace(vect.first, CArray(vect.second.data(), shape(vect.second.size()),duplicateData)) ; - // some servers receves no index (zeroIndex array) => root process take them into account. - if (context->getIntraCommRank()==0) - for(auto& rank : zeroIndex) globalIndex[rank] = CArray() ; - } -*/ - if (distType==EDistributionType::BANDS && isUnstructed_) distType=EDistributionType::COLUMNS ; - - if (distType==EDistributionType::BANDS) // Bands distribution to send to file server - { - int nbServer = client->serverSize; - int nbClient = client->clientSize ; - int rankClient = client->clientRank ; - int size = nbServer / nbClient ; - int start ; - if (nbServer%nbClient > rankClient) - { - start = (size+1) * rankClient ; - size++ ; - } - else start = size*rankClient + nbServer%nbClient ; - - for(int i=0; i rank) - { - indStart = (indSize+1) * rank ; - indSize++ ; - } - else indStart = indSize*rank + nj_glo%nbServer ; - - indStart=indStart*ni_glo ; - indSize=indSize*ni_glo ; - auto& globalInd = globalIndex[rank] ; - globalInd.resize(indSize) ; - for(size_t n = 0 ; nserverSize; - int nbClient = client->clientSize ; - int rankClient = client->clientRank ; - int size = nbServer / nbClient ; - int start ; - if (nbServer%nbClient > rankClient) - { - start = (size+1) * rankClient ; - size++ ; - } - else start = size*rankClient + nbServer%nbClient ; - - for(int i=0; i rank) - { - indStart = (indSize+1) * rank ; - indSize++ ; - } - else indStart = indSize*rank + ni_glo%nbServer ; - - auto& globalInd = globalIndex[rank] ; - globalInd.resize(indSize*nj_glo) ; - size_t n=0 ; - for(int j=0; jserverSize; - int nglo=ni_glo*nj_glo ; - CArray indGlo ; - for(size_t i=0;igetRanksServerLeader()) globalIndex[rankServer] = indGlo ; - } - remoteElement_[client] = make_shared(ni_glo*nj_glo, globalIndex) ; - remoteElement_[client]->addFullView() ; - } - CATCH - - - - void CDomain::distributeToServer(CContextClient* client, map>& globalIndexOut, std::map>& globalIndexIn, - shared_ptr &scattererConnector, const string& domainId) - TRY - { - string serverDomainId = domainId.empty() ? this->getId() : domainId ; - CContext* context = CContext::getCurrent(); - - this->sendAllAttributesToServer(client, serverDomainId) ; - - auto scatteredElement = make_shared(ni_glo*nj_glo, globalIndexOut) ; - scatteredElement->addFullView() ; - scattererConnector = make_shared(localElement_->getView(CElementView::FULL), scatteredElement->getView(CElementView::FULL), - context->getIntraComm(), client->getRemoteSize()) ; - scattererConnector->computeConnector() ; - - // phase 0 - // send remote element to construct the full view on server, ie without hole - CEventClient event0(getType(), EVENT_ID_DOMAIN_DISTRIBUTION); - CMessage message0 ; - message0<sendToServer(client,event0,message0) ; - - // phase 1 - // send the full view of element to construct the connector which connect distributed data coming from client to the full local view - CEventClient event1(getType(), EVENT_ID_DOMAIN_DISTRIBUTION); - CMessage message1 ; - message1<getView(CElementView::FULL)->getGlobalSize() ; - scattererConnector->transfer(localElement_->getView(CElementView::FULL)->getGlobalIndex(),client,event1,message1) ; - - sendDistributedAttributes(client, scattererConnector, domainId) ; - - - // phase 2 send the mask : data index + mask2D - { - CArray maskIn(localElement_->getView(CElementView::WORKFLOW)->getSize()); - CArray maskOut ; - auto workflowToFull = make_shared(localElement_->getView(CElementView::WORKFLOW), localElement_->getView(CElementView::FULL)) ; - workflowToFull->computeConnector() ; - maskIn=true ; - workflowToFull->transfer(maskIn,maskOut,false) ; - - - // prepare grid scatterer connector to send data from client to server - map> workflowGlobalIndex ; - map> maskOut2 ; - scattererConnector->transfer(maskOut, maskOut2, false) ; - scatteredElement->addView(CElementView::WORKFLOW, maskOut2) ; - scatteredElement->getView(CElementView::WORKFLOW)->getGlobalIndexView(workflowGlobalIndex) ; - // create new workflow view for scattered element - auto clientToServerElement = make_shared(scatteredElement->getGlobalSize(), workflowGlobalIndex) ; - clientToServerElement->addFullView() ; - CEventClient event2(getType(), EVENT_ID_DOMAIN_DISTRIBUTION); - CMessage message2 ; - message2<sendToServer(client, event2, message2) ; - clientToServerConnector_[client] = make_shared(localElement_->getView(CElementView::WORKFLOW), clientToServerElement->getView(CElementView::FULL), - context->getIntraComm(), client->getRemoteSize()) ; - clientToServerConnector_[client]->computeConnector() ; - } - //////////// - // phase 3 : compute connector to receive from server - //////////// - { - auto scatteredElement = make_shared(ni_glo*nj_glo, globalIndexIn) ; - scatteredElement->addFullView() ; - auto scattererConnector = make_shared(localElement_->getView(CElementView::FULL), scatteredElement->getView(CElementView::FULL), - context->getIntraComm(), client->getRemoteSize()) ; - scattererConnector->computeConnector() ; - - CArray maskIn(localElement_->getView(CElementView::WORKFLOW)->getSize()); - CArray maskOut ; - auto workflowToFull = make_shared(localElement_->getView(CElementView::WORKFLOW), localElement_->getView(CElementView::FULL)) ; - workflowToFull->computeConnector() ; - maskIn=true ; - workflowToFull->transfer(maskIn,maskOut,false) ; - - map> workflowGlobalIndex ; - map> maskOut2 ; - scattererConnector->transfer(maskOut, maskOut2, false) ; - scatteredElement->addView(CElementView::WORKFLOW, maskOut2) ; - scatteredElement->getView(CElementView::WORKFLOW)->getGlobalIndexView(workflowGlobalIndex) ; - auto clientToServerElement = make_shared(scatteredElement->getGlobalSize(), workflowGlobalIndex) ; - clientToServerElement->addFullView() ; - CEventClient event3(getType(), EVENT_ID_DOMAIN_DISTRIBUTION); - CMessage message3 ; - message3<sendToServer(client, event3, message3) ; - - clientFromServerConnector_[client] = make_shared(clientToServerElement->getView(CElementView::FULL), localElement_->getView(CElementView::WORKFLOW)); - clientFromServerConnector_[client]->computeConnector() ; - } - } - CATCH - - void CDomain::recvDomainDistribution(CEventServer& event) - TRY - { - string domainId; - int phasis ; - for (auto& subEvent : event.subEvents) (*subEvent.buffer) >> domainId >> phasis ; - get(domainId)->receivedDomainDistribution(event, phasis); - } - CATCH - - void CDomain::receivedDomainDistribution(CEventServer& event, int phasis) - TRY - { - CContext* context = CContext::getCurrent(); - if (phasis==0) // receive the remote element to construct the full view - { - localElement_ = make_shared(context->getIntraCommRank(),event) ; - localElement_->addFullView() ; - // construct the local dimension and indexes - auto& globalIndex=localElement_->getGlobalIndex() ; - int nij=globalIndex.numElements() ; - int minI=ni_glo,maxI=-1,minJ=nj_glo,maxJ=-1 ; - int i,j ; - int niGlo=ni_glo, njGlo=njGlo ; - for(int ij=0;ijmaxI) maxI=i ; - if (jmaxJ) maxJ=j ; - } - if (maxI>=minI) { ibegin=minI ; ni=maxI-minI+1 ; } - else {ibegin=0; ni=0 ;} - if (maxJ>=minJ) { jbegin=minJ ; nj=maxJ-minJ+1 ; } - else {jbegin=0; nj=0 ;} - - } - else if (phasis==1) // receive the sent view from client to construct the full distributed full view on server - { - CContext* context = CContext::getCurrent(); - shared_ptr elementFrom = make_shared(event) ; - elementFrom->addFullView() ; - gathererConnector_ = make_shared(elementFrom->getView(CElementView::FULL), localElement_->getView(CElementView::FULL)) ; - gathererConnector_->computeConnector() ; - } - else if (phasis==2) - { - elementFrom_ = make_shared(event) ; - elementFrom_->addFullView() ; - } - else if (phasis==3) - { - elementTo_ = make_shared(event) ; - elementTo_->addFullView() ; - } - } - CATCH - - void CDomain::setServerMask(CArray& serverMask, CContextClient* client) - TRY - { - // nota : the client is needed to get the remote size for the scatterer connector. Maybe it is not the good place for this - // Later, server to client connector can be computed on demand, with "client" as argument - CContext* context = CContext::getCurrent(); - localElement_->addView(CElementView::WORKFLOW, serverMask) ; - mask_1d.reference(serverMask.copy()) ; - - serverFromClientConnector_ = make_shared(elementFrom_->getView(CElementView::FULL), localElement_->getView(CElementView::WORKFLOW)) ; - serverFromClientConnector_->computeConnector() ; - - serverToClientConnector_ = make_shared(localElement_->getView(CElementView::WORKFLOW), elementTo_->getView(CElementView::FULL), - context->getIntraComm(), client->getRemoteSize()) ; - serverToClientConnector_->computeConnector() ; - } - CATCH_DUMP_ATTR - - - void CDomain::sendDistributedAttributes(CContextClient* client, shared_ptr scattererConnector, const string& domainId) - { - string serverDomainId = domainId.empty() ? this->getId() : domainId ; - CContext* context = CContext::getCurrent(); - - if (hasLonLat) - { - { // send longitude - CEventClient event(getType(), EVENT_ID_SEND_DISTRIBUTED_ATTRIBUTE); - CMessage message ; - message<transfer(lonvalue, client, event,message) ; - } - - { // send latitude - CEventClient event(getType(), EVENT_ID_SEND_DISTRIBUTED_ATTRIBUTE); - CMessage message ; - message<transfer(latvalue, client, event, message) ; - } - } - - if (hasBounds) - { - { // send longitude boudaries - CEventClient event(getType(), EVENT_ID_SEND_DISTRIBUTED_ATTRIBUTE); - CMessage message ; - message<transfer(nvertex, bounds_lonvalue, client, event, message ) ; - } - - { // send latitude boudaries - CEventClient event(getType(), EVENT_ID_SEND_DISTRIBUTED_ATTRIBUTE); - CMessage message ; - message<transfer(nvertex, bounds_latvalue, client, event, message ) ; - } - } - - if (hasArea) - { // send area - CEventClient event(getType(), EVENT_ID_SEND_DISTRIBUTED_ATTRIBUTE); - CMessage message ; - message<transfer(areavalue, client, event,message) ; - } - } - - void CDomain::recvDistributedAttributes(CEventServer& event) - TRY - { - string domainId; - string type ; - for (auto& subEvent : event.subEvents) (*subEvent.buffer) >> domainId >> type ; - get(domainId)->recvDistributedAttributes(event, type); - } - CATCH - - void CDomain::recvDistributedAttributes(CEventServer& event, const string& type) - TRY - { - if (type=="lon") - { - CArray value ; - gathererConnector_->transfer(event, value, 0.); - lonvalue_2d.resize(ni,nj) ; - if (lonvalue_2d.numElements()>0) lonvalue_2d=CArray(value.dataFirst(),shape(ni,nj),neverDeleteData) ; - } - else if (type=="lat") - { - CArray value ; - gathererConnector_->transfer(event, value, 0.); - latvalue_2d.resize(ni,nj) ; - if (latvalue_2d.numElements()>0) latvalue_2d=CArray(value.dataFirst(),shape(ni,nj),neverDeleteData) ; - } - else if (type=="boundslon") - { - CArray value ; - gathererConnector_->transfer(event, nvertex, value, 0.); - bounds_lon_2d.resize(nvertex,ni,nj) ; - if (bounds_lon_2d.numElements()>0) bounds_lon_2d=CArray(value.dataFirst(),shape(nvertex,ni,nj),neverDeleteData) ; - } - else if (type=="boundslat") - { - CArray value ; - gathererConnector_->transfer(event, nvertex, value, 0.); - bounds_lat_2d.resize(nvertex,ni,nj) ; - if (bounds_lat_2d.numElements()>0) bounds_lat_2d=CArray(value.dataFirst(),shape(nvertex,ni,nj),neverDeleteData) ; - } - else if (type=="area") - { - CArray value ; - gathererConnector_->transfer(event, value, 0.); - area.resize(ni,nj) ; - if (area.numElements()>0) area=CArray(value.dataFirst(),shape(ni,nj),neverDeleteData) ; - } - } - CATCH - - bool CDomain::dispatchEvent(CEventServer& event) - TRY - { - if (SuperClass::dispatchEvent(event)) return true; - else - { - switch(event.type) - { - case EVENT_ID_DOMAIN_DISTRIBUTION: - recvDomainDistribution(event); - return true; - break; - case EVENT_ID_SEND_DISTRIBUTED_ATTRIBUTE: - recvDistributedAttributes(event); - return true; - break; - default: - ERROR("bool CDomain::dispatchEvent(CEventServer& event)", - << "Unknown Event"); - return false; - } - } - } - CATCH - - - /*! - Compare two domain objects. - They are equal if only if they have identical attributes as well as their values. - Moreover, they must have the same transformations. - \param [in] domain Compared domain - \return result of the comparison - */ - bool CDomain::isEqual(CDomain* obj) - TRY - { - vector excludedAttr; - excludedAttr.push_back("domain_ref"); - bool objEqual = SuperClass::isEqual(obj, excludedAttr); - if (!objEqual) return objEqual; - - TransMapTypes thisTrans = this->getAllTransformations(); - TransMapTypes objTrans = obj->getAllTransformations(); - - TransMapTypes::const_iterator it, itb, ite; - std::vector thisTransType, objTransType; - for (it = thisTrans.begin(); it != thisTrans.end(); ++it) - thisTransType.push_back(it->first); - for (it = objTrans.begin(); it != objTrans.end(); ++it) - objTransType.push_back(it->first); - - if (thisTransType.size() != objTransType.size()) return false; - for (int idx = 0; idx < thisTransType.size(); ++idx) - objEqual &= (thisTransType[idx] == objTransType[idx]); - - return objEqual; - } - CATCH_DUMP_ATTR - -///////////////////////////////////////////////////////////////////////// -/////////////// TRANSFORMATIONS ////////// -///////////////////////////////////////////////////////////////////////// - - std::map CDomain::transformationMapList_ = std::map(); - bool CDomain::dummyTransformationMapList_ = CDomain::initializeTransformationMap(CDomain::transformationMapList_); - - bool CDomain::initializeTransformationMap(std::map& m) - TRY - { - m["zoom_domain"] = TRANS_ZOOM_DOMAIN; - m["interpolate_domain"] = TRANS_INTERPOLATE_DOMAIN; - m["generate_rectilinear_domain"] = TRANS_GENERATE_RECTILINEAR_DOMAIN; - m["compute_connectivity_domain"] = TRANS_COMPUTE_CONNECTIVITY_DOMAIN; - m["expand_domain"] = TRANS_EXPAND_DOMAIN; - m["reorder_domain"] = TRANS_REORDER_DOMAIN; - m["extract_domain"] = TRANS_EXTRACT_DOMAIN; - return true; - } - CATCH - - - CTransformation* CDomain::addTransformation(ETranformationType transType, const StdString& id) - TRY - { - transformationMap_.push_back(std::make_pair(transType, CTransformation::createTransformation(transType,id))); - return transformationMap_.back().second; - } - CATCH_DUMP_ATTR - - CTransformation* CDomain::addTransformation(ETranformationType transType, CTransformation* transformation) - TRY - { - transformationMap_.push_back(std::make_pair(transType, transformation)); - return transformationMap_.back().second; - } - CATCH_DUMP_ATTR - /*! - Check whether a domain has transformation - \return true if domain has transformation - */ - bool CDomain::hasTransformation() - TRY - { - return (!transformationMap_.empty()); - } - CATCH_DUMP_ATTR - - /*! - Set transformation for current domain. It's the method to move transformation in hierarchy - \param [in] domTrans transformation on domain - */ - void CDomain::setTransformations(const TransMapTypes& domTrans) - TRY - { - transformationMap_ = domTrans; - } - CATCH_DUMP_ATTR - - /*! - Get all transformation current domain has - \return all transformation - */ - CDomain::TransMapTypes CDomain::getAllTransformations(void) - TRY - { - return transformationMap_; - } - CATCH_DUMP_ATTR - - void CDomain::duplicateTransformation(CDomain* src) - TRY - { - if (src->hasTransformation()) - { - this->setTransformations(src->getAllTransformations()); - } - } - CATCH_DUMP_ATTR - - /*! - * Go through the hierarchy to find the domain from which the transformations must be inherited - */ - void CDomain::solveInheritanceTransformation_old() - TRY - { - if (hasTransformation() || !hasDirectDomainReference()) - return; - - CDomain* domain = this; - std::vector refDomains; - while (!domain->hasTransformation() && domain->hasDirectDomainReference()) - { - refDomains.push_back(domain); - domain = domain->getDirectDomainReference(); - } - - if (domain->hasTransformation()) - for (size_t i = 0; i < refDomains.size(); ++i) - refDomains[i]->setTransformations(domain->getAllTransformations()); - } - CATCH_DUMP_ATTR - - - void CDomain::solveInheritanceTransformation() - TRY - { - if (solveInheritanceTransformation_done_) return; - else solveInheritanceTransformation_done_=true ; - - CDomain* domain = this; - CDomain* Lastdomain ; - std::list refDomains; - bool out=false ; - vector excludedAttr; - excludedAttr.push_back("domain_ref"); - - refDomains.push_front(domain) ; - while (domain->hasDirectDomainReference() && !out) - { - CDomain* lastDomain=domain ; - domain = domain->getDirectDomainReference(); - domain->solveRefInheritance() ; - if (!domain->SuperClass::isEqual(lastDomain,excludedAttr)) out=true ; - refDomains.push_front(domain) ; - } - - CTransformationPaths::TPath path ; - auto& pathList = std::get<2>(path) ; - std::get<0>(path) = EElement::DOMAIN ; - std::get<1>(path) = refDomains.front()->getId() ; - for (auto& domain : refDomains) - { - CDomain::TransMapTypes transformations = domain->getAllTransformations(); - for(auto& transformation : transformations) pathList.push_back({transformation.second->getTransformationType(), - transformation.second->getId()}) ; - } - transformationPaths_.addPath(path) ; - - } - CATCH_DUMP_ATTR - - - bool CDomain::activateFieldWorkflow(CGarbageCollector& gc) - TRY - { - if (!domain_ref.isEmpty()) - { - CField* field=getFieldFromId(domain_ref) ; - if (field!=nullptr) - { - bool ret = field->buildWorkflowGraph(gc) ; - if (!ret) return false ; // cannot build workflow graph at this state - } - else - { - CDomain* domain = get(domain_ref) ; - bool ret = domain->activateFieldWorkflow(gc) ; - if (!ret) return false ; // cannot build workflow graph at this state - domain_ref=domain->getId() ; // replace domain_ref by solved reference - } - } - activateFieldWorkflow_done_=true ; - return true ; - } - CATCH_DUMP_ATTR -///////////////////////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////////////////////// - - void CDomain::setContextClient(CContextClient* contextClient) - TRY - { - if (clientsSet.find(contextClient)==clientsSet.end()) - { - clients.push_back(contextClient) ; - clientsSet.insert(contextClient); - } - } - CATCH_DUMP_ATTR - - /*! - Parse children nodes of a domain in xml file. - Whenver there is a new transformation, its type and name should be added into this function - \param node child node to process - */ - void CDomain::parse(xml::CXMLNode & node) - TRY - { - SuperClass::parse(node); - - if (node.goToChildElement()) - { - StdString nodeElementName; - do - { - StdString nodeId(""); - if (node.getAttributes().end() != node.getAttributes().find("id")) - { nodeId = node.getAttributes()["id"]; } - - nodeElementName = node.getElementName(); - std::map::const_iterator ite = transformationMapList_.end(), it; - it = transformationMapList_.find(nodeElementName); - if (ite != it) - { - transformationMap_.push_back(std::make_pair(it->second, CTransformation::createTransformation(it->second, - nodeId, - &node))); - } - else - { - ERROR("void CDomain::parse(xml::CXMLNode & node)", - << "The transformation " << nodeElementName << " has not been supported yet."); - } - } while (node.goToNextElement()) ; - node.goToParentElement(); - } - } - CATCH_DUMP_ATTR - //---------------------------------------------------------------- - - DEFINE_REF_FUNC(Domain,domain) - - ///--------------------------------------------------------------- - -} // namespace xios diff --git a/xios_2311_src/trunk/.svn/pristine/00/00e647ef3e30c69b485c32b184bda5192a21d103.svn-base b/xios_2311_src/trunk/.svn/pristine/00/00e647ef3e30c69b485c32b184bda5192a21d103.svn-base deleted file mode 100644 index a0800ba496758044fb7da1b7a1a921f6b4895290..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/00/00e647ef3e30c69b485c32b184bda5192a21d103.svn-base +++ /dev/null @@ -1,73 +0,0 @@ -/* ************************************************************************** * - * Copyright © IPSL/LSCE, xios, Avril 2010 - Octobre 2011 * - * ************************************************************************** */ - -#include - -#include "xios.hpp" - -#include "attribute_template.hpp" -#include "object_template.hpp" -#include "group_template.hpp" - -#include "icutil.hpp" -#include "timer.hpp" -#include "grid.hpp" - -extern "C" -{ -// /////////////////////////////// Définitions ////////////////////////////// // - - // ----------------------- Redéfinition de types ---------------------------- - - typedef xios::CGrid * XGridPtr; - typedef xios::CGridGroup * XGridGroupPtr; - - // ------------------------ Création des handle ----------------------------- - - void cxios_grid_handle_create (XGridPtr * _ret, const char * _id, int _id_len) - TRY - { - std::string id; - if (!cstr2string(_id, _id_len, id)) return; - CTimer::get("XIOS").resume() ; - *_ret = CGrid::get(id); - CTimer::get("XIOS").suspend() ; - } - CATCH_DUMP_STACK - - void cxios_gridgroup_handle_create (XGridGroupPtr * _ret, const char * _id, int _id_len) - TRY - { - std::string id; - if (!cstr2string(_id, _id_len, id)) return; - CTimer::get("XIOS").resume() ; - *_ret = CGridGroup::get(id); - CTimer::get("XIOS").suspend() ; - } - CATCH_DUMP_STACK - - // -------------------- Vérification des identifiants ----------------------- - - void cxios_grid_valid_id (bool * _ret, const char * _id, int _id_len) - TRY - { - std::string id; - if (!cstr2string(_id, _id_len, id)) return; - CTimer::get("XIOS").resume() ; - *_ret = CGrid::has(id); - CTimer::get("XIOS").suspend() ; - } - CATCH_DUMP_STACK - - void cxios_gridgroup_valid_id (bool * _ret, const char * _id, int _id_len) - TRY - { - std::string id; - if (!cstr2string(_id, _id_len, id)) return; - CTimer::get("XIOS").resume() ; - *_ret = CGridGroup::has(id); - CTimer::get("XIOS").suspend() ; - } - CATCH_DUMP_STACK -} // extern "C" diff --git a/xios_2311_src/trunk/.svn/pristine/01/01b7937e330b418c0bb3bc589b10b4a6020bcf2f.svn-base b/xios_2311_src/trunk/.svn/pristine/01/01b7937e330b418c0bb3bc589b10b4a6020bcf2f.svn-base deleted file mode 100644 index dcaf2443af90b78d72a135b19e4cd0670392ad77..0000000000000000000000000000000000000000 Binary files a/xios_2311_src/trunk/.svn/pristine/01/01b7937e330b418c0bb3bc589b10b4a6020bcf2f.svn-base and /dev/null differ diff --git a/xios_2311_src/trunk/.svn/pristine/01/01c82c8b3267602e50d7132407425f8e004c988c.svn-base b/xios_2311_src/trunk/.svn/pristine/01/01c82c8b3267602e50d7132407425f8e004c988c.svn-base deleted file mode 100644 index 05eca2361ddca607765d8dbe2e47c8393db8f69c..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/01/01c82c8b3267602e50d7132407425f8e004c988c.svn-base +++ /dev/null @@ -1,138 +0,0 @@ -#ifndef __XIOS_ONETCDF4__ -#define __XIOS_ONETCDF4__ - -/// XIOS headers /// -#include "xios_spl.hpp" -#include "exception.hpp" -#include "data_output.hpp" -#include "array_new.hpp" -#include "mpi.hpp" -#include "netcdf.hpp" - -#ifndef UNLIMITED_DIM - #define UNLIMITED_DIM (size_t)(-1) -#endif //UNLIMITED_DIM - -namespace xios -{ - /// ////////////////////// Déclarations ////////////////////// /// - class CONetCDF4 - : public virtual CDataOutput - { - public : - - /// Définition de type /// - typedef std::vector CONetCDF4Path; - - /// Constructeurs /// - CONetCDF4(const StdString& filename, bool append, bool useClassicFormat = false, - bool useCFConvention = true, - const MPI_Comm* comm = NULL, bool multifile = true, - const StdString& timeCounterName = "time_counter"); - - CONetCDF4(const CONetCDF4& onetcdf4); // Not implemented. - CONetCDF4(const CONetCDF4* const onetcdf4); // Not implemented. - - - /// Initialisation /// - void initialize(const StdString& filename, bool append, bool useClassicFormat, bool useCFConvention, - const MPI_Comm* comm, bool multifile, const StdString& timeCounterName); - void close(void); - void sync(void); - void definition_start(void); - void definition_end(void); - - /// Mutateurs /// - void setCurrentPath(const CONetCDF4Path& path); - - int addGroup(const StdString& name); - int addDimension(const StdString& name, const StdSize size = UNLIMITED_DIM); - int addVariable(const StdString& name, nc_type type, - const std::vector& dim, int compressionLevel=0); - - //---------------------------------------------------------------- - public : - - template - void setDefaultValue(const StdString& varname, const T* value = NULL); - - void setCompressionLevel(const StdString& varname, int compressionLevel); - - template void addAttribute (const StdString& name, const T& value, const StdString* varname = NULL); - - /// Ecriture des données /// - template - void writeData(const CArray& data, const StdString& name, - bool collective, StdSize record, - const std::vector* start = NULL, - const std::vector* count = NULL); - - void writeData(const CArray& data, const StdString& name); - void writeTimeAxisData(const CArray& data, const StdString& name, - bool collective, StdSize record, bool Isroot); - void writeTimeAxisDataBounds(const CArray& data, const StdString& name, - bool collective, StdSize record, bool Isroot); - /// Accesseur /// - const CONetCDF4Path& getCurrentPath(void) const; - - /// Destructeur /// - virtual ~CONetCDF4(void); - - //---------------------------------------------------------------- - - protected : - - /// Ecriture /// - virtual void writeField_ (CField* field) = 0; - virtual void writeDomain_(CDomain* domain) = 0; - virtual void writeAxis_ (CAxis* axis) = 0; - - /// Accesseurs /// - int getCurrentGroup(void); - int getGroup(const CONetCDF4Path& path); - int getVariable(const StdString& varname); - int getDimension(const StdString& dimname); - std::vector getDimensions (const StdString& varname); - std::vector getDimensionsIdList (const StdString* varname); - int getUnlimitedDimension(void); - StdString getUnlimitedDimensionName(void); - const StdString& getTimeCounterName(void) const { return timeCounterName; }; - - void getTimeAxisBounds(CArray& timeAxisBounds, const StdString& name, bool collective ); - void getTimeAxisBounds(CArray& timeAxisBounds, const StdString& name, bool collective, size_t record); - - bool varExist(const StdString& varname); - bool dimExist(const StdString& dimname); - - bool useClassicFormat; //!< If true, NetCDF4 will use the classic NetCDF3 format - bool useCFConvention; //!< If true data is written in the CF convention otherwise in UGRID - - //---------------------------------------------------------------- - - private : - template - void writeData_(int grpid, int varid, - const std::vector& sstart, - const std::vector& scount, T* data); - - void getWriteDataInfos(const StdString& name, StdSize record, StdSize& array_size, - std::vector& sstart, - std::vector& scount, - const std::vector* start, - const std::vector* count); - - /// Propriétés privées /// - CONetCDF4Path path; - int ncidp; - bool wmpi; - map timeAxis; - StdString timeCounterName; - }; // class CONetCDF4 - - ///--------------------------------------------------------------- - - - -} // namespace xios - -#endif //__XIOS_ONETCDF4__ diff --git a/xios_2311_src/trunk/.svn/pristine/01/01e3437bc73c2f4dd411424f56d5f91d5431e765.svn-base b/xios_2311_src/trunk/.svn/pristine/01/01e3437bc73c2f4dd411424f56d5f91d5431e765.svn-base deleted file mode 100644 index ab46661de1e78bb89db5e8cfdeaa45e54cea45d5..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/01/01e3437bc73c2f4dd411424f56d5f91d5431e765.svn-base +++ /dev/null @@ -1,176 +0,0 @@ -#ifndef __XIOS_DECLARE_ATTRIBUTE__ -#define __XIOS_DECLARE_ATTRIBUTE__ - -/// ///////////////////////////// Macros ///////////////////////////// /// -#define DECLARE_ATTRIBUTE(type, name, ...) \ - class name##_attr : public CAttributeTemplate \ - { \ - public : \ - name##_attr(void) \ - : CAttributeTemplate \ - (#name, *CAttributeMap::Current) \ - { /* Ne rien faire de plus */ } \ - type operator=(const type & value) \ - { return (CAttributeTemplate::operator=(value)); } \ - virtual bool doSend() const { return helper(__VA_ARGS__); } \ - bool helper(bool returnTrue=true) const { return returnTrue; } \ - virtual ~name##_attr(void) \ - { /* Ne rien faire de plus */ } \ - } name; - -#define DECLARE_ATTRIBUTE_PRIVATE(type, name, ...) \ - class name##_attr : public CAttributeTemplate \ - { \ - public : \ - name##_attr(void) \ - : CAttributeTemplate \ - (#name, *CAttributeMap::Current) \ - { /* Ne rien faire de plus */ } \ - type operator=(const type & value) \ - { return (CAttributeTemplate::operator=(value)); } \ - virtual bool isPublic() const \ - { return false; } \ - virtual bool doSend() const { return helper(__VA_ARGS__); } \ - bool helper(bool returnTrue=true) const { return returnTrue; } \ - virtual ~name##_attr(void) \ - { /* Ne rien faire de plus */ } \ - } name; - -#define DECLARE_ARRAY(T_num, T_rank, name, ...) \ - class name##_attr : public CAttributeArray \ - { \ - public : \ - using CAttributeArray::operator = ; \ - bool alwaysFalse=false;\ - name##_attr(void) : CAttributeArray (#name, *CAttributeMap::Current) {} \ - virtual bool doSend() const { return helper(__VA_ARGS__); } \ - bool helper(bool returnTrue=true) const { return returnTrue; } \ - virtual ~name##_attr(void) {} \ - } name; - -#define DECLARE_ARRAY_PRIVATE(T_num, T_rank, name, ...) \ - class name##_attr : public CAttributeArray \ - { \ - public : \ - using CAttributeArray::operator = ; \ - name##_attr(void) : CAttributeArray (#name, *CAttributeMap::Current) {} \ - virtual bool isPublic() const \ - { return false; } \ - virtual bool doSend() const { return helper(__VA_ARGS__); } \ - bool helper(bool returnTrue=true) const { return returnTrue; } \ - virtual ~name##_attr(void) {} \ - } name; - -#define DECLARE_CLASS_ENUM(name, ...) \ - class name##_attr : public CAttributeEnum \ - { \ - public : \ - name##_attr(void) : CAttributeEnum(#name, *CAttributeMap::Current) { } \ - virtual bool doSend() const { return helper(__VA_ARGS__); } \ - bool helper(bool returnTrue=true) const { return returnTrue; } \ - virtual ~name##_attr(void) {} \ - } name; - -#define DECLARE_ENUM2(name,arg1,arg2) \ - class Enum_##name \ - { \ - public: \ - enum t_enum { arg1=0, arg2} ; \ - const char** getStr(void) const { static const char * enumStr[] = { #arg1, #arg2 } ; return enumStr ; } \ - int getSize(void) const { return 2 ; } \ - } ; \ - DECLARE_CLASS_ENUM(name) - -#define DECLARE_ENUM3(name,arg1,arg2,arg3) \ - class Enum_##name \ - { \ - public: \ - enum t_enum { arg1=0, arg2, arg3} ; \ - const char** getStr(void) const { static const char * enumStr[] = { #arg1, #arg2, #arg3 } ; return enumStr ; } \ - int getSize(void) const { return 3 ; } \ - } ; \ - DECLARE_CLASS_ENUM(name) - -#define DECLARE_ENUM4(name,arg1,arg2,arg3,arg4) \ - class Enum_##name \ - { \ - public: \ - enum t_enum { arg1=0, arg2, arg3,arg4} ; \ - const char** getStr(void) const { static const char * enumStr[] = { #arg1, #arg2, #arg3,#arg4 } ; return enumStr ; } \ - int getSize(void) const { return 4 ; } \ - } ; \ - DECLARE_CLASS_ENUM(name) - -#define DECLARE_ENUM5(name,arg1,arg2,arg3,arg4,arg5) \ - class Enum_##name \ - { \ - public: \ - enum t_enum { arg1=0, arg2, arg3,arg4,arg5} ; \ - const char** getStr(void) const { static const char * enumStr[] = { #arg1, #arg2, #arg3,#arg4,#arg5 } ; return enumStr ; } \ - int getSize(void) const { return 5 ; } \ - } ; \ - DECLARE_CLASS_ENUM(name) - -#define DECLARE_ENUM6(name,arg1,arg2,arg3,arg4,arg5,arg6) \ - class Enum_##name \ - { \ - public: \ - enum t_enum { arg1=0, arg2, arg3,arg4,arg5,arg6} ; \ - const char** getStr(void) const { static const char * enumStr[] = { #arg1, #arg2, #arg3,#arg4,#arg5,#arg6 } ; return enumStr ; } \ - int getSize(void) const { return 6 ; } \ - } ; \ - DECLARE_CLASS_ENUM(name) - -#define DECLARE_ENUM7(name,arg1,arg2,arg3,arg4,arg5,arg6,arg7) \ - class Enum_##name \ - { \ - public: \ - enum t_enum { arg1=0, arg2, arg3,arg4,arg5,arg6,arg7} ; \ - const char** getStr(void) const { static const char * enumStr[] = { #arg1, #arg2, #arg3,#arg4,#arg5,#arg6,#arg7 } ; return enumStr ; } \ - int getSize(void) const { return 7 ; } \ - } ; \ - DECLARE_CLASS_ENUM(name) - -#define DECLARE_ENUM8(name,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) \ - class Enum_##name \ - { \ - public: \ - enum t_enum { arg1=0, arg2, arg3,arg4,arg5,arg6,arg7,arg8} ; \ - const char** getStr(void) const { static const char * enumStr[] = { #arg1, #arg2, #arg3,#arg4,#arg5,#arg6,#arg7,#arg8 } ; return enumStr ; } \ - int getSize(void) const { return 8 ; } \ - } ; \ - DECLARE_CLASS_ENUM(name) - - #define DECLARE_ENUM9(name,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9) \ - class Enum_##name \ - { \ - public: \ - enum t_enum { arg1=0, arg2, arg3,arg4,arg5,arg6,arg7,arg8,arg9} ; \ - const char** getStr(void) const { static const char * enumStr[] = { #arg1, #arg2, #arg3,#arg4,#arg5,#arg6,#arg7,#arg8,#arg9 } ; return enumStr ; } \ - int getSize(void) const { return 9 ; } \ - } ; \ - DECLARE_CLASS_ENUM(name) - - #define DECLARE_TYPE(name) \ - class Enum_##name \ - { \ - public: \ - enum t_enum { t_bool=0, t_int16, t_int, t_int32, t_int64, t_float, t_double, t_string }; \ - const char** getStr(void) const { static const char * enumStr[] = { "bool", "int16", "int", "int32", "int64", "float", "double", "string" }; return enumStr; } \ - int getSize(void) const { return 8; } \ - }; \ - DECLARE_CLASS_ENUM(name) - -#define BEGIN_DECLARE_ATTRIBUTE_MAP(type) \ - class type##Attributes : public virtual CAttributeMap \ - { \ - public : - -#define END_DECLARE_ATTRIBUTE_MAP(type) \ - type##Attributes (void) : CAttributeMap() \ - { /* Ne rien faire de plus */ } \ - virtual ~type##Attributes (void) \ - { /* Ne rien faire de plus */ } \ - }; - -#endif // __XIOS_DECLARE_ATTRIBUTE__ diff --git a/xios_2311_src/trunk/.svn/pristine/02/020285d707a316fbb435e21ce1792cf26a092b78.svn-base b/xios_2311_src/trunk/.svn/pristine/02/020285d707a316fbb435e21ce1792cf26a092b78.svn-base deleted file mode 100644 index 3fd1bf7ada5693ee2ef2ff470853e8f9b7a496fd..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/02/020285d707a316fbb435e21ce1792cf26a092b78.svn-base +++ /dev/null @@ -1,167 +0,0 @@ -#ifndef __XIOS_INETCDF4__ -#define __XIOS_INETCDF4__ - -/// XIOS headers /// -#include "xios_spl.hpp" -#include "exception.hpp" -#include "array_new.hpp" - -#include "mpi.hpp" -#include "netcdf.hpp" - -#ifndef UNLIMITED_DIM -#define UNLIMITED_DIM (size_t)(-1) -#endif // UNLIMITED_DIM - -namespace xios -{ - typedef std::vector CVarPath; - - class CINetCDF4 - { - public: - /// Constructors /// - CINetCDF4(const StdString& filename, const MPI_Comm* comm = NULL, bool multifile = true, - bool readMetaDataPar = false, const StdString& timeCounterName = "time_counter"); - - CINetCDF4(const CINetCDF4& inetcdf4); // Not implemented. - CINetCDF4(const CINetCDF4* const inetcdf4); // Not implemented. - - //------------------------------------------------------------- - - /// Destructor /// - virtual ~CINetCDF4(void); - - //------------------------------------------------------------- - - void close(void); - - //------------------------------------------------------------- - - /// Getters /// - StdSize getNbOfTimestep(const CVarPath* const path = NULL); - - StdString getUnlimitedDimensionName(const CVarPath* const path = NULL); - - const StdString& getTimeCounterName(void) const { return timeCounterName; }; - - StdString getCoordinatesId(const StdString& name, const CVarPath* const path = NULL); - - StdString getBoundsId(const StdString& name, const CVarPath* const path = NULL); - - StdString getLonCoordName(const StdString& varname, const CVarPath* const path = NULL); - StdString getLatCoordName(const StdString& varname, const CVarPath* const path = NULL); - StdString getVertCoordName(const StdString& varname, const CVarPath* const path = NULL); - - std::set getCoordVariables(const CVarPath* const path = NULL); - std::set getBoundVariables(const CVarPath* const path = NULL); - - std::list getGroups (const CVarPath* const path = NULL); - std::list getVariables(const CVarPath* const path = NULL); - - std::list getDataVariables(bool _is3D = true, - bool _isRecti = true, - bool _isCurvi = true, - bool _isUnstr = true, - bool _isCellData = true, - bool _isTemporal = true, - const CVarPath* const path = NULL); - - std::list getAttributes(const StdString* const var = NULL, - const CVarPath* const path = NULL); - - std::list getDimensionsList(const StdString* const var = NULL, - const CVarPath* const path = NULL); - - std::list getCoordinatesIdList(const StdString& name, - const CVarPath* const path = NULL); - - std::map getDimensions(const StdString* const var = NULL, - const CVarPath* const path = NULL); - - StdSize getNbVertex(const StdString& name, const CVarPath* const path = NULL); - - //------------------------------------------------------------- - - template - T getMissingValue(const StdString& name, const CVarPath* const path = NULL); - - template - std::vector getAttributeValue(const StdString& name, - const StdString* const var = NULL, - const CVarPath* const path = NULL); - - StdString getAttributeValue(const StdString& name, - const StdString* const var, - const CVarPath* const path); - - template - void getData(CArray& data, - const StdString& var, - const CVarPath* const path = NULL, - StdSize record = UNLIMITED_DIM); - - template - void getData(CArray& data, const StdString& var, - bool collective, StdSize record, - const std::vector* start = NULL, - const std::vector* count = NULL); - - //------------------------------------------------------------- - - /// Tests /// - bool hasMissingValue(const StdString& name, const CVarPath* const path = NULL); - - bool hasAttribute(const StdString& name, const StdString* const var = NULL, const CVarPath* const path = NULL); - - bool hasVariable(const StdString& name, const CVarPath* const path = NULL); - - bool hasCoordinates(const StdString& name, const CVarPath* const path = NULL); - - bool hasTemporalDim(const CVarPath* const path = NULL); - - bool hasBounds(const StdString& name, const CVarPath* const path = NULL); - - //------------------------------------------------------------- - - bool isBound(const StdString& name, const CVarPath* const path = NULL); - bool isCoordinate(const StdString& name, const CVarPath* const path = NULL); - bool isRectilinear(const StdString& name, const CVarPath* const path = NULL); - bool isCurvilinear(const StdString& name, const CVarPath* const path = NULL); - bool isUnknown(const StdString& name, const CVarPath* const path = NULL); - bool isUnstructured(const StdString& name, const CVarPath* const path = NULL); - - bool isTemporal(const StdString& name, const CVarPath* const path = NULL); - bool is3Dim(const StdString& name, const CVarPath* const path = NULL); - bool isCellGrid(const StdString& name, const CVarPath* const path = NULL); - - bool isLonOrLat(const StdString& varname, const CVarPath* const path = NULL); - - protected: - /// Getters /// - int getGroup (const CVarPath* const path = NULL); - int getVariable(const StdString& varname, const CVarPath* const path = NULL); - int getDimension(const StdString& dimname, const CVarPath* const path = NULL); - int getUnlimitedDimension(const CVarPath* const path = NULL); - int getAttributeId(const StdString& name, - const StdString* const var = NULL, - const CVarPath* const path = NULL); - - std::pair getAttribute(const StdString& attname, - const StdString* const var = NULL, - const CVarPath* const path = NULL); - - //------------------------------------------------------------- - - void getDataInfo(const StdString& var, const CVarPath* const path, StdSize record, - std::vector& sstart, std::vector& scount, StdSize& array_size, - const std::vector* start = NULL, const std::vector* count = NULL); - - private: - int ncidp; //< Id of the NetCDF file - bool mpi; //< Whether parallel file access is used - StdString timeCounterName; - }; // class CINetCDF4 -} // namespace xios - -#endif //__XIOS_INETCDF4__ diff --git a/xios_2311_src/trunk/.svn/pristine/02/023613fb62d54b462672e461520f00a745ec7bf1.svn-base b/xios_2311_src/trunk/.svn/pristine/02/023613fb62d54b462672e461520f00a745ec7bf1.svn-base deleted file mode 100644 index ccb6c3371e305c9b99ecf0e65a63dac4fe95bb9e..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/02/023613fb62d54b462672e461520f00a745ec7bf1.svn-base +++ /dev/null @@ -1,198 +0,0 @@ -/* Copyright 2009, UCAR/Unidata and OPeNDAP, Inc. - See the COPYRIGHT file for more information. */ - -#ifndef OCINTERNAL_H -#define OCINTERNAL_H - -#include "config.h" - -#ifdef _AIX -#include -#endif - -#include -#include -#include -#ifndef WIN32 -#include -#endif -#include -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_SYS_TYPES_H -#include -#endif - -#define CURL_DISABLE_TYPECHECK 1 -#include - -#include "oclist.h" -#include "ocbytes.h" -#include "ocuri.h" - -#define OCCACHEPOS - -#include "oc.h" -#include "ocdatatypes.h" -#include "occonstraints.h" -#include "ocnode.h" -#include "ocutil.h" -#include "oclog.h" -#include "xxdr.h" -#include "ocdata.h" - -#ifndef nulldup -#define nulldup(s) (s==NULL?NULL:strdup(s)) -#endif - -#define nullstring(s) (s==NULL?"(null)":s) -#define PATHSEPARATOR "." - -/* Default initial memory packet size */ -#define DFALTPACKETSIZE 0x20000 /*approximately 100k bytes*/ - -/* Default maximum memory packet size */ -#define DFALTMAXPACKETSIZE 0x3000000 /*approximately 50M bytes*/ - -/* Extend the OCdxd type */ -#define OCVER 3 - -/* Define a magic number to mark externally visible oc objects */ -#define OCMAGIC ((unsigned int)0x0c0c0c0c) /*clever, huh?*/ - -/*! Specifies the OCstate. */ -typedef struct OCstate -{ - unsigned int magic; /* Mark each structure type */ - CURL* curl; /* curl handle*/ - OClist* trees; /* list ; all root objects */ - OCURI* uri; /* base URI*/ - OCbytes* packet; /* shared by all trees during construction */ - /* OCContent information */ - struct OCcontent* contentlist; - struct OCerrdata {/* Hold info for an error return from server */ - char* code; - char* message; - long httpcode; - char curlerrorbuf[CURL_ERROR_SIZE]; /* to get curl error message */ - } error; - /* Store .rc file info */ - struct OCcurlflags { - int compress; - int verbose; - int timeout; - int followlocation; - int maxredirs; - char* useragent; - char* cookiejar; - char* cookiefile; - } curlflags; - struct OCSSL { - int validate; - char* certificate; - char* key; - char* keypasswd; - char* cainfo; /* certificate authority */ - char* capath; - int verifypeer; - } ssl; - struct OCproxy { - char *host; - int port; - } proxy; - struct OCcredentials { - char *username; - char *password; - } creds; - long ddslastmodified; - long datalastmodified; -} OCstate; - - -/*! Specifies all the info about a particular DAP tree - i.e. DAS, DDS, or DATADDS as obtained from a fetch response - This is associated with the root object. -*/ -typedef struct OCtree -{ - OCdxd dxdclass; - char* constraint; - char* text; - struct OCnode* root; /* cross link */ - struct OCstate* state; /* cross link */ - OClist* nodes; /* all nodes in tree*/ - /* when dxdclass == OCDATADDS */ - struct { - char* memory; /* allocated memory if OC_INMEMORY is set */ - char* filename; - FILE* file; - unsigned long datasize; /* xdr size on disk or in memory */ - unsigned long bod; /* offset of the beginning of packet data */ - unsigned long ddslen; /* length of ddslen (assert(ddslen <= bod)) */ - XXDR* xdrs; /* access either memory or file */ - } data; -} OCtree; - -/* (Almost) All shared procedure definitions are kept here - except for: ocdebug.h ocutil.h - The true external interface is defined in oc.h -*/ - -/* Location: ocnode.c */ -extern OCnode* ocmakenode(char* name, OCtype ptype, OCnode* root); -extern void occollectpathtonode(OCnode* node, OClist* path); -extern void occomputefullnames(OCnode* root); -extern void occomputesemantics(OClist*); -extern void ocaddattribute(OCattribute* attr, OCnode* parent); -extern OCattribute* ocmakeattribute(char* name, OCtype ptype, OClist* values); -extern size_t ocsetsize(OCnode* node); -extern OCerror occorrelate(OCnode*,OCnode*); -extern OCerror occomputeskipdata(OCstate*, OCnode*); -extern void ocmarkcacheable(OCstate* state, OCnode* ddsroot); - -/* Location: dapparselex.c*/ -extern int dapdebug; -extern OCerror DAPparse(OCstate*, struct OCtree*, char*); -extern char* dimnameanon(char* basename, unsigned int index); - -/* Location: ceparselex.c*/ -extern int cedebug; -extern OClist* CEparse(OCstate*,char* input); - -/* Location: ocinternal.c*/ -extern OCerror ocopen(OCstate** statep, const char* url); -extern void occlose(OCstate* state); - -extern OCerror ocfetchf(OCstate*, const char*, OCdxd, OCflags, OCnode**); - -/* Location: ocinternal.c */ -extern int oc_network_order; -extern int oc_invert_xdr_double; -extern int ocinternalinitialize(void); - -/* Location: ocnode.c */ -extern void ocfreetree(OCtree* tree); -extern void ocfreeroot(OCnode* root); -extern void ocfreenodes(OClist*); - -extern void ocddsclear(struct OCstate*); -extern void ocdasclear(struct OCstate*); -extern void ocdataddsclear(struct OCstate*); -extern void* oclinearize(OCtype etype, unsigned int, char**); - -/* Merge DAS with DDS or DATADDS*/ -extern int ocddsdasmerge(struct OCstate*, OCnode* das, OCnode* dds); - -extern OCerror ocupdatelastmodifieddata(OCstate* state); - -extern int ocinternalinitialize(void); - - -extern OCerror ocsetrcfile(char* rcfile); - -/* Global stateflags */ -extern int oc_curl_file_supported; -extern int oc_curl_https_supported; - -#endif /*COMMON_H*/ diff --git a/xios_2311_src/trunk/.svn/pristine/02/025664f1dbb8fa1d2e76d860b901065c7a64b5f5.svn-base b/xios_2311_src/trunk/.svn/pristine/02/025664f1dbb8fa1d2e76d860b901065c7a64b5f5.svn-base deleted file mode 100644 index 30ea32f939bbb52a88b80147818043b049700d26..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/02/025664f1dbb8fa1d2e76d860b901065c7a64b5f5.svn-base +++ /dev/null @@ -1,333 +0,0 @@ -/********************************************************************* - * Copyright 1993, UCAR/Unidata - * See netcdf/COPYRIGHT file for copying and redistribution conditions. - * $Header: /upc/share/CVS/netcdf-3/libnccommon/nccommon.h,v 1.40 2010/05/30 19:45:52 dmh Exp $ - *********************************************************************/ -#ifndef NCCOMMON_H -#define NCCOMMON_H 1 - -/* Mnemonics */ -#ifndef BOOL -#define BOOL int -#endif -#ifndef TRUE -#define TRUE 1 -#define FALSE 0 -#endif - -#ifndef nullfree -#define nullfree(m) {if((m)!=NULL) {free(m);} else {}} -#endif - - -#define FILLCONSTRAINT TRUE - - -/* Use an extended version of the netCDF-4 type system */ -#define NC_URL 50 -#define NC_SET 51 -/* Merge relevant translations of OC types */ -#define NC_Dataset 52 -#define NC_Sequence 53 -#define NC_Structure 54 -#define NC_Grid 55 -#define NC_Dimension 56 -#define NC_Primitive 57 - -#undef OCCOMPILEBYDEFAULT - -#define DEFAULTSTRINGLENGTH 64 -/* The sequence limit default is zero because - most servers do not implement projections - on sequences. -*/ -#define DEFAULTSEQLIMIT 0 - -/**************************************************/ -/* sigh, do the forwards */ -struct NCDAPCOMMON; -struct NCprojection; -struct NCselection; -struct Getvara; -struct NCcachenode; -struct NCcache; -struct NCslice; -struct NCsegment; -struct OClist; -/**************************************************/ -/* -Collect single bit flags that -affect the operation of the system. -*/ - -typedef unsigned int NCFLAGS; -# define SETFLAG(controls,flag) ((controls.flags) |= (flag)) -# define CLRFLAG(controls,flag) ((controls.flags) &= ~(flag)) -# define FLAGSET(controls,flag) (((controls.flags) & (flag)) != 0) - -/* Defined flags */ -#define NCF_NC3 (0x0001) /* DAP->netcdf-3 */ -#define NCF_NC4 (0x0002) /* DAP->netcdf-4 */ -#define NCF_NCDAP (0x0004) /* Do libnc-dap mimic */ -#define NCF_CACHE (0x0008) /* Cache enabled/disabled */ -#define NCF_PREFETCH (0x0010) /* Cache prefetch enabled/disabled */ -#define NCF_UPGRADE (0x0020) /* Do proper type upgrades */ -#define NCF_UNCONSTRAINABLE (0x0040) /* Not a constrainable URL */ -#define NCF_SHOWFETCH (0x0080) /* show fetch calls */ -#define NCF_ONDISK (0x0100) /* cause oc to store data on disk */ -#define NCF_WHOLEVAR (0x0200) /* retrieve only whole variables (as opposed to partial variable) - into cache */ - -/* Define all the default on flags */ -#define DFALT_ON_FLAGS (NCF_PREFETCH) - -typedef struct NCCONTROLS { - NCFLAGS flags; -} NCCONTROLS; - -struct NCTMODEL { - int translation; - char* model; - unsigned int flags; -}; - -/* Detail information about each cache item */ -typedef struct NCcachenode { - int wholevariable; /* does this node only have wholevariables? */ - int prefetch; /* is this the prefetch cache entry? */ - size_t xdrsize; - DCEconstraint* constraint; /* as used to create this node */ - NClist* vars; /* vars potentially covered by this cache node */ - struct CDFnode* datadds; - OCobject ocroot; - OCdata content; -} NCcachenode; - -/* All cache info */ -typedef struct NCcache { - size_t cachelimit; /* max total size for all cached entries */ - size_t cachesize; /* current size */ - size_t cachecount; /* max # nodes in cache */ - NCcachenode* prefetch; - NClist* nodes; /* cache nodes other than prefetch */ -} NCcache; - -/**************************************************/ -/* The DAP packet info from OC */ -typedef struct NCOC { - OCconnection conn; - char* rawurltext; /* as given to nc3d_open */ - char* urltext; /* as modified by nc3d_open */ - NC_URI* url; /* parse of rawuritext */ - OCobject ocdasroot; - DCEconstraint* dapconstraint; /* from url */ - int inmemory; /* store fetched data in memory? */ -} NCOC; - -typedef struct NCCDF { - struct CDFnode* ddsroot; /* constrained dds */ - struct CDFnode* fullddsroot; /* unconstrained dds */ - /* Collected sets of useful nodes (in ddsroot tree space) */ - NClist* varnodes; /* nodes which can represent netcdf variables */ - NClist* seqnodes; /* sequence nodes; */ - NClist* gridnodes; /* grid nodes */ - NClist* dimnodes; /* (base) dimension nodes */ - unsigned int defaultstringlength; - unsigned int defaultsequencelimit; /* global sequence limit;0=>no limit */ - struct NCcache* cache; - size_t fetchlimit; - size_t smallsizelimit; /* what constitutes a small object? */ - size_t totalestimatedsize; - const char* separator; /* constant; do not free */ - /* global string dimension */ - struct CDFnode* globalstringdim; - char* recorddimname; /* From DODS_EXTRA */ - struct CDFnode* recorddim; - /* libncdap4 only */ - NClist* usertypes; /* nodes which will represent netcdf types */ -} NCCDF; - -/* Define a structure holding common info for NCDAP{3,4} */ - -typedef struct NCDAPCOMMON { - NC* controller; /* Parent instance of NCDAPCOMMON */ - NCCDF cdf; - NCOC oc; - NCCONTROLS controls; /* Control flags and parameters */ -} NCDAPCOMMON; - -/**************************************************/ -/* Create our own node tree to mimic ocnode trees*/ - -/* Each root CDFnode contains info about the whole tree */ -typedef struct CDFtree { - OCobject ocroot; - OCdxd occlass; - NClist* nodes; /* all nodes in tree*/ - struct CDFnode* root; /* cross link */ - struct NCDAPCOMMON* owner; - /* Classification flags */ - int regridded; /* Was this tree passed thru regrid3? */ -} CDFtree; - -/* Track the kinds of dimensions */ -typedef int CDFdimflags; -#define CDFDIMNORMAL 0x0 -#define CDFDIMSEQ 0x1 -#define CDFDIMSTRING 0x2 -#define CDFDIMCLONE 0x4 -#define CDFDIMRECORD 0x20 - -#define DIMFLAG(d,flag) ((d)->dim.dimflags & (flag)) -#define DIMFLAGSET(d,flag) ((d)->dim.dimflags |= (flag)) -#define DIMFLAGCLR(d,flag) ((d)->dim.dimflags &= ~(flag)) - -typedef struct CDFdim { - CDFdimflags dimflags; - struct CDFnode* basedim; /* for duplicate dimensions*/ - struct CDFnode* array; /* parent array node */ - size_t declsize; /* from constrained DDS*/ - size_t declsize0; /* from unconstrained DDS*/ - int index1; /* dimension name index +1; 0=>no index */ -} CDFdim; - -typedef struct CDFarray { - NClist* dimsetall; /* inherited+originals+pseudo */ - NClist* dimsetplus; /* originals+pseudo */ - NClist* dimset0; /* original dims from the dds */ - struct CDFnode* stringdim; - /* Track sequence related information */ - struct CDFnode* seqdim; /* if this node is a sequence */ - /* note: unlike string dim; seqdim is also stored in dimensions vector */ - struct CDFnode* sequence; /* containing usable sequence, if any */ - struct CDFnode* basevar; /* for duplicate grid variables*/ -} CDFarray; - -typedef struct NCattribute { - char* name; - nc_type etype; /* dap type of the attribute */ - NClist* values; /* strings come from the oc values */ - int invisible; /* Do not materialize to the user */ -} NCattribute; - -/* Extend as additional DODS attribute values are defined */ -typedef struct NCDODS { - size_t maxstrlen; - char* dimname; -} NCDODS; - -typedef struct NCalignment { - unsigned long size; /* size of single instance of this type*/ - unsigned long alignment; /* alignment of this field */ - unsigned long offset; /* offset of this field in parent */ -} NCalignment; - -typedef struct NCtypesize { - BOOL aligned; /* have instance and field been defined? */ - NCalignment instance; /* Alignment, etc for instance data */ - NCalignment field; /* Alignment, etc WRT to parent */ -} NCtypesize; - -/* Closely mimics struct OCnode*/ -typedef struct CDFnode { - nc_type nctype; /* e.g. var, dimension */ - nc_type etype; /* e.g. NC_INT, NC_FLOAT if applicable,*/ - char* ocname; /* oc base name */ - char* ncbasename; /* generally cdflegalname(ocname) */ - char* ncfullname; /* complete path name from root to this node*/ - OCobject ocnode; /* oc mirror node*/ - struct CDFnode* group; /* null => in root group */ - struct CDFnode* container; /* e.g. struct or sequence, but not group */ - struct CDFnode* root; - CDFtree* tree; /* root level metadata;only defined if root*/ - CDFdim dim; /* nctype == dimension */ - CDFarray array; /* nctype == grid,var,etc. with dimensions */ - NClist* subnodes; /* if nctype == grid, sequence, etc. */ - NClist* attributes; /*NClist*/ - NCDODS dodsspecial; /* special attributes like maxStrlen */ - nc_type externaltype; /* the type as represented to nc_inq*/ - int ncid; /* relevant NC id for this object*/ - unsigned long maxstringlength; - unsigned long sequencelimit; /* 0=>unlimited */ - BOOL usesequence; /* If this sequence is usable */ - BOOL elided; /* 1 => node does not partipate in naming*/ - struct CDFnode* basenode; /* derived tree map to template tree */ - BOOL visible; /* 1 => node is present in derived tree; independent of elided flag */ - BOOL zerodim; /* 1 => node has a zero dimension */ - /* These two flags track the effects on grids of constraints */ - BOOL virtual; /* node added by regrid */ -#ifdef PROJECTED - BOOL projected; /* node referenced by projection */ -#endif - struct CDFnode* attachment; /* DDS<->DATADDS cross link*/ - struct CDFnode* template; /* temporary field for regridding */ - /* Fields for use by libncdap4 */ - NCtypesize typesize; - int typeid; /* when treating field as type */ - int basetypeid; /* when typeid is vlen */ - char* typename; - char* vlenname; /* for sequence types */ - int singleton; /* for singleton sequences */ - unsigned long estimatedsize; /* > 0 Only for var nodes */ -} CDFnode; - -/**************************************************/ -/* Shared procedures */ - -/* From ncdap3.c*/ -extern NCerror freeNCDAPCOMMON(struct NCDAPCOMMON*); -extern NCerror fetchtemplatemetadata3(NCDAPCOMMON*); - -/* From error.c*/ -extern NCerror ocerrtoncerr(OCerror); - -/* From: common34.c */ -extern NCerror fixgrid34(struct NCDAPCOMMON* drno, CDFnode* grid); -extern NCerror computecdfinfo34(struct NCDAPCOMMON*, NClist*); -extern char* cdfname34(char* basename); -extern NCerror augmentddstree34(struct NCDAPCOMMON*, NClist*); -extern NCerror computecdfdimnames34(struct NCDAPCOMMON*); -extern NCerror buildcdftree34(struct NCDAPCOMMON*, OCobject, OCdxd, CDFnode**); -extern CDFnode* makecdfnode34(struct NCDAPCOMMON*, char* nm, OCtype, - /*optional*/ OCobject ocnode, CDFnode* container); -extern void freecdfroot34(CDFnode*); - -extern NCerror findnodedds34(struct NCDAPCOMMON* drno, CDFnode* ddssrc); -extern NCerror makegetvar34(struct NCDAPCOMMON*, struct CDFnode*, void*, nc_type, struct Getvara**); -extern NCerror applyclientparams34(struct NCDAPCOMMON* drno); -extern NCerror attach34(CDFnode* xroot, CDFnode* ddstarget); -extern NCerror attachall34(CDFnode* xroot, CDFnode* ddsroot); -extern NCerror attachsubset34(CDFnode*, CDFnode*); -extern void unattach34(CDFnode*); -extern int nodematch34(CDFnode* node1, CDFnode* node2); -extern int simplenodematch34(CDFnode* node1, CDFnode* node2); -extern CDFnode* findxnode34(CDFnode* target, CDFnode* xroot); -extern int constrainable34(NC_URI*); -extern char* makeconstraintstring34(DCEconstraint*); -extern size_t estimatedataddssize34(CDFnode* datadds); -extern void canonicalprojection34(NClist*, NClist*); -extern NClist* getalldims34(NCDAPCOMMON* nccomm, int visibleonly); - -/* From cdf3.c */ -extern NCerror dimimprint3(NCDAPCOMMON*); -extern NCerror definedimsets3(struct NCDAPCOMMON*); - -/* From cache.c */ -extern int iscached(NCDAPCOMMON*, CDFnode* target, NCcachenode** cachenodep); -extern NCerror prefetchdata3(NCDAPCOMMON*); -extern NCerror buildcachenode34(NCDAPCOMMON*, - DCEconstraint* constraint, - NClist* varlist, - NCcachenode** cachep, - int isprefetch); -extern NCcachenode* createnccachenode(void); -extern void freenccachenode(NCDAPCOMMON*, NCcachenode* node); -extern NCcache* createnccache(void); -extern void freenccache(NCDAPCOMMON*, NCcache* cache); - -/* Add an extra function whose sole purpose is to allow - configure(.ac) to test for the presence of thiscode. -*/ -extern int nc__opendap(void); - -#endif /*NCCOMMON_H*/ diff --git a/xios_2311_src/trunk/.svn/pristine/02/02bfcb8d5f5f2ef6e578ede836f7b433c5f10bf3.svn-base b/xios_2311_src/trunk/.svn/pristine/02/02bfcb8d5f5f2ef6e578ede836f7b433c5f10bf3.svn-base deleted file mode 100644 index 6444dda11c0d945e886e93368167b7ee5947d262..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/02/02bfcb8d5f5f2ef6e578ede836f7b433c5f10bf3.svn-base +++ /dev/null @@ -1,30 +0,0 @@ -#include "xios_fortran_prefix.hpp" - -MODULE IEXTRACT_DOMAIN_TO_AXIS - USE, INTRINSIC :: ISO_C_BINDING - USE EXTRACT_DOMAIN_TO_AXIS_INTERFACE - - TYPE txios(extract_domain_to_axis) - INTEGER(kind = C_INTPTR_T) :: daddr - END TYPE txios(extract_domain_to_axis) - - CONTAINS ! Fonctions disponibles pour les utilisateurs. - - SUBROUTINE xios(get_extract_domain_to_axis_handle)(idt,ret) - IMPLICIT NONE - CHARACTER(len = *), INTENT(IN) :: idt - TYPE(txios(extract_domain_to_axis)) , INTENT(OUT):: ret - CALL cxios_extract_domain_to_axis_handle_create(ret%daddr, idt, len(idt)) - END SUBROUTINE xios(get_extract_domain_to_axis_handle) - - LOGICAL FUNCTION xios(is_valid_extract_domain_to_axis)(idt) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: idt - LOGICAL (kind = 1) :: val - - CALL cxios_extract_domain_to_axis_valid_id(val, idt, len(idt)) - xios(is_valid_extract_domain_to_axis) = val - - END FUNCTION xios(is_valid_extract_domain_to_axis) - -END MODULE IEXTRACT_DOMAIN_TO_AXIS diff --git a/xios_2311_src/trunk/.svn/pristine/03/0300a8579eed33640034cd71bea063c5173bc065.svn-base b/xios_2311_src/trunk/.svn/pristine/03/0300a8579eed33640034cd71bea063c5173bc065.svn-base deleted file mode 100644 index 84deecc7afe05b892f85b63a5037d8594966c187..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/03/0300a8579eed33640034cd71bea063c5173bc065.svn-base +++ /dev/null @@ -1,121 +0,0 @@ -#!/bin/bash - -export build_dir=xios_test_suite/RUN_TEST_SUITE/build_${arch}_${mode} -export svnR=$(svn info --show-item revision ../../) -if [[ -v enable_mem_track ]]; then - echo "enable_mem_track is set to '$enable_mem_track'" -fi - -echo "Start Building XIOS ... " - -if [[ ${xios_machine_name} == "jeanzay" ]]; then - - rm -f compile.sh - echo "#!/bin/bash" >> compile.sh - echo "#SBATCH --ntasks=1 ">> compile.sh - echo "#SBATCH --cpus-per-task=16 ">> compile.sh - echo "#SBATCH --hint=nomultithread ">> compile.sh - echo "#SBATCH -t 00:30:00 " >> compile.sh - echo "#SBATCH -o compile.out ">> compile.sh - echo "#SBATCH -e compile.err ">> compile.sh - echo "#SBATCH --account="$user_account >> compile.sh - echo "#SBATCH --job-name=XIOS_rev"$svnR >> compile.sh - echo "#SBATCH --exclusive " >> compile.sh - echo "cd \${SLURM_SUBMIT_DIR}">> compile.sh - echo "ulimit -c 0">> compile.sh - echo "cd ../.. ">> compile.sh - echo "./make_xios --arch_path `pwd`/../ARCH --arch ${arch} --${mode} --use_tv --build_dir ${build_dir} --job 16" >> compile.sh - cmd=$(sbatch compile.sh) - jobid="${cmd//[!0-9]/}" - i=0 - output=$(squeue -u uim55ri | grep ${jobid}) - while [ ! -z "$output" ] - do - echo "compiling job " $jobid "pending/running for about" ${i} seconds - sleep 30 - ((i+=30)) - output=$(squeue -u uim55ri | grep ${jobid}) - done - -fi - -if [[ ${xios_machine_name} == "irene" ]]; then - - rm -f compile.sh - echo "#!/bin/bash" >> compile.sh - echo "#MSUB -o compile.out" >> compile.sh - echo "#MSUB -e compile.err" >> compile.sh - echo "#MSUB -eo" >> compile.sh - echo "#MSUB -c 16" >> compile.sh - echo "#MSUB -n 1" >> compile.sh - echo "#MSUB -X" >> compile.sh - echo "#MSUB -x" >> compile.sh - echo "#MSUB -T 1800" >> compile.sh - echo "#MSUB -q skylake" >> compile.sh - echo "#MSUB -A "$user_account >> compile.sh - echo "#MSUB -Q test" >> compile.sh - echo "#MSUB -r XIOS_rev"$svnR >> compile.sh - echo "#MSUB -m work,scratch" >> compile.sh - echo "cd ../.. ">> compile.sh - echo "./make_xios --arch_path `pwd`/../ARCH --arch ${arch} --${mode} --use_tv ${enable_mem_track} --build_dir ${build_dir} --job 16" >> compile.sh - cmd=$(ccc_msub compile.sh) - jobid="${cmd//[!0-9]/}" - i=0 - output=$(squeue -u $USER | grep ${jobid}) - while [ ! -z "$output" ] - do - echo "compiling job " $jobid "pending/running for about" ${i} seconds - sleep 30 - ((i+=30)) - output=$(squeue -u $USER | grep ${jobid}) - done - -fi - -exec=build_${arch}_${mode}/bin/generic_testcase.exe -if [[ -f "$exec" ]]; then - build_ok=true -else - build_ok=false -fi - - -if [ "$build_ok" = true ] -then - echo "XIOS Build Finished. Start Unit Tests" - bash ./my_run.sh - - if [ "$COPY_TO_SERVER" = true ] - then - echo "with files copy" - rundir=${xios_test_suite_repository}/RUN - mkdir -p $rundir ; CHMOD $rundir - mkdir -p ${rundir}/test_${xios_machine_name} ; CHMOD ${rundir}/test_${xios_machine_name} - - cp report_${svnR}_${arch}_${mode}.txt ${rundir}/test_${xios_machine_name}/test_${svnR}_${xios_machine_name}_${arch}_${mode}.txt - - CHMOD ${rundir}/test_${xios_machine_name}/test_${svnR}_${xios_machine_name}_${arch}_${mode}.txt - - mkdir -p ${rundir}/def_files ; CHMOD ${rundir}/def_files - mkdir -p ${rundir}/def_files/${svnR} ; CHMOD ${rundir}/def_files/${svnR} - - for i in $(ls -d test_*/) - do - mkdir -p ${rundir}/def_files/${svnR}/${i%%} ; CHMOD ${rundir}/def_files/${svnR}/${i%%} - cp ${i%%}/user_param_*.json ${rundir}/def_files/${svnR}/${i%%} - for j in $(ls -d ${i%%/}/CONFIG_*) - do - mkdir -p ${rundir}/def_files/${svnR}/${j%%} ; CHMOD ${rundir}/def_files/${svnR}/${j%%} - cp ${j%%}/all_param.def ${rundir}/def_files/${svnR}/${j%%} - done - done - else - echo "without files copy" - fi - -else - echo "XIOS Build Failed. Skip Unit Tests" -fi - - - diff --git a/xios_2311_src/trunk/.svn/pristine/03/0331aaa77c8b8bc34c5ac25eaa652d51e613fa84.svn-base b/xios_2311_src/trunk/.svn/pristine/03/0331aaa77c8b8bc34c5ac25eaa652d51e613fa84.svn-base deleted file mode 100644 index 9db6e712107051e4d8743e797eb0eb673eeb5d46..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/03/0331aaa77c8b8bc34c5ac25eaa652d51e613fa84.svn-base +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef __XIOS_GRID_ALGORITHM_REDUCE_HPP__ -#define __XIOS_GRID_ALGORITHM_REDUCE_HPP__ - -#include "grid_transform_connector.hpp" -#include -#include "array_new.hpp" -#include "local_view.hpp" -#include "grid_algorithm_generic.hpp" -#include "reduction_types.hpp" - -namespace xios -{ - class CGrid; - class CGenericAlgorithmTransformation ; - - /*! - \class CGenericAlgorithmTransformation - This class defines the interface for all other inherited algorithms class - */ - class CTransformFilter ; - class CGarbageCollector ; - - class CGridAlgorithmReduce : public CGridAlgorithmGeneric - { - public: - CGridAlgorithmReduce(CGrid* gridSrc, CGrid* gridDst, int pos, shared_ptr algo, EReduction op) - : CGridAlgorithmGeneric(gridSrc, gridDst, pos, algo), operator_(op) {} - virtual ~CGridAlgorithmReduce() {} - - virtual void apply(const CArray& dataIn, CArray& dataOut) ; - - protected: - - EReduction operator_ ; // reduction operator to apply - - }; - -} - -#endif // __XIOS_GRID_ALGORITHM_REDUCE_HPP__ \ No newline at end of file diff --git a/xios_2311_src/trunk/.svn/pristine/03/034adcdefb88d4a8c04f8e9b33f381681bd217a6.svn-base b/xios_2311_src/trunk/.svn/pristine/03/034adcdefb88d4a8c04f8e9b33f381681bd217a6.svn-base deleted file mode 100644 index 3427b3761aceedb91d901ccbb1cd33d9dee99a59..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/03/034adcdefb88d4a8c04f8e9b33f381681bd217a6.svn-base +++ /dev/null @@ -1,15 +0,0 @@ -#include "object_factory.hpp" - -namespace xios -{ - /// ////////////////////// Définitions ////////////////////// /// - - StdString CObjectFactory::CurrContext(""); - - void CObjectFactory::SetCurrentContextId(const StdString & context) - { CObjectFactory::CurrContext = context; } - - StdString & CObjectFactory::GetCurrentContextId(void) - { return (CObjectFactory::CurrContext); } - -} // namespace xios diff --git a/xios_2311_src/trunk/.svn/pristine/03/0390aad587a061ed4b0e0d231ecb090254f8b17a.svn-base b/xios_2311_src/trunk/.svn/pristine/03/0390aad587a061ed4b0e0d231ecb090254f8b17a.svn-base deleted file mode 100644 index 614341e8c1ef04360af446d0fc093ec7b8b2f69d..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/03/0390aad587a061ed4b0e0d231ecb090254f8b17a.svn-base +++ /dev/null @@ -1,22 +0,0 @@ -MODULE AXIS_INTERFACE - USE, INTRINSIC :: ISO_C_BINDING - - INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99 - - SUBROUTINE cxios_axis_handle_create(ret, idt, idt_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_axis_handle_create - - SUBROUTINE cxios_axis_valid_id(ret, idt, idt_size) BIND(C) - USE ISO_C_BINDING - LOGICAL (kind = C_BOOL) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_axis_valid_id - - END INTERFACE - -END MODULE AXIS_INTERFACE diff --git a/xios_2311_src/trunk/.svn/pristine/03/03a2c14076c89810ea11ba184078a577728cd3d3.svn-base b/xios_2311_src/trunk/.svn/pristine/03/03a2c14076c89810ea11ba184078a577728cd3d3.svn-base deleted file mode 100644 index 0799479acee470dfa74ae38c8f0bd6fca005a344..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/03/03a2c14076c89810ea11ba184078a577728cd3d3.svn-base +++ /dev/null @@ -1,57 +0,0 @@ -/*! - \file policy.hpp - \author Ha NGUYEN - \since 06 Oct 2015 - \date 06 Oct 2015 - - \brief Some useful policies for templated classes - */ - -#ifndef __XIOS_POLICY_HPP__ -#define __XIOS_POLICY_HPP__ - -#include -#include "mpi.hpp" - -namespace xios -{ -//class DivideCommByTwo -//{ -//protected: -// void computeMPICommLevel(const MPI_Comm& mpiCommRoot, int levels); -// -//protected: -// std::vector commLevel_; -//private: -// // Divide MPI communicator on each level recursively -// void divideMPICommLevel(const MPI_Comm& mpiCommLevel, int level); -//}; - -class DivideAdaptiveComm -{ -protected: - DivideAdaptiveComm(const MPI_Comm& mpiComm); - - void computeMPICommLevel(); - const std::vector& getGroupBegin() { return groupBegin_; } - const std::vector& getNbInGroup() { return nbInGroup_; } - const std::vector >& getGroupParentsBegin() { return groupParentsBegin_; } - const std::vector >& getNbInGroupParents() { return nbInGroupParents_; } - int getNbLevel() { return level_; } - -protected: - const MPI_Comm& internalComm_; - std::vector > groupParentsBegin_; - std::vector > nbInGroupParents_; - - int level_; - std::vector groupBegin_; //! Rank beginning of a group - std::vector nbInGroup_; //! Number of process in each group - bool computed_; -// std::vector > child_; /*!< List of child rank for each level */ -// std::vector nbChild_; /*!< Number of child for each level */ -}; - -} - -#endif // __XIOS_POLICY_HPP__ diff --git a/xios_2311_src/trunk/.svn/pristine/04/04f0c59495f59756f325a366de7e3f704287927c.svn-base b/xios_2311_src/trunk/.svn/pristine/04/04f0c59495f59756f325a366de7e3f704287927c.svn-base deleted file mode 100644 index b442fe700fe79210b367843d81b05c04d4e9fdbc..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/04/04f0c59495f59756f325a366de7e3f704287927c.svn-base +++ /dev/null @@ -1,34 +0,0 @@ -! * ************************************************************************** * -! * Interface auto generated - do not modify * -! * ************************************************************************** * -#include "../fortran/xios_fortran_prefix.hpp" - -MODULE reduce_axis_to_axis_interface_attr - USE, INTRINSIC :: ISO_C_BINDING - - INTERFACE - ! Do not call directly / interface FORTRAN 2003 <-> C99 - - SUBROUTINE cxios_set_reduce_axis_to_axis_operation(reduce_axis_to_axis_hdl, operation, operation_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: reduce_axis_to_axis_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: operation - INTEGER (kind = C_INT) , VALUE :: operation_size - END SUBROUTINE cxios_set_reduce_axis_to_axis_operation - - SUBROUTINE cxios_get_reduce_axis_to_axis_operation(reduce_axis_to_axis_hdl, operation, operation_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: reduce_axis_to_axis_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: operation - INTEGER (kind = C_INT) , VALUE :: operation_size - END SUBROUTINE cxios_get_reduce_axis_to_axis_operation - - FUNCTION cxios_is_defined_reduce_axis_to_axis_operation(reduce_axis_to_axis_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_reduce_axis_to_axis_operation - INTEGER (kind = C_INTPTR_T), VALUE :: reduce_axis_to_axis_hdl - END FUNCTION cxios_is_defined_reduce_axis_to_axis_operation - - END INTERFACE - -END MODULE reduce_axis_to_axis_interface_attr diff --git a/xios_2311_src/trunk/.svn/pristine/04/04f13843f1159578dfbbe9c828440250066e4256.svn-base b/xios_2311_src/trunk/.svn/pristine/04/04f13843f1159578dfbbe9c828440250066e4256.svn-base deleted file mode 100644 index b9c191f51c07ef902067d977d5eaa7a8efb54a96..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/04/04f13843f1159578dfbbe9c828440250066e4256.svn-base +++ /dev/null @@ -1,244 +0,0 @@ -! * ************************************************************************** * -! * Interface auto generated - do not modify * -! * ************************************************************************** * -#include "../fortran/xios_fortran_prefix.hpp" - -MODULE grid_interface_attr - USE, INTRINSIC :: ISO_C_BINDING - - INTERFACE - ! Do not call directly / interface FORTRAN 2003 <-> C99 - - SUBROUTINE cxios_set_grid_comment(grid_hdl, comment, comment_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: grid_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: comment - INTEGER (kind = C_INT) , VALUE :: comment_size - END SUBROUTINE cxios_set_grid_comment - - SUBROUTINE cxios_get_grid_comment(grid_hdl, comment, comment_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: grid_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: comment - INTEGER (kind = C_INT) , VALUE :: comment_size - END SUBROUTINE cxios_get_grid_comment - - FUNCTION cxios_is_defined_grid_comment(grid_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_grid_comment - INTEGER (kind = C_INTPTR_T), VALUE :: grid_hdl - END FUNCTION cxios_is_defined_grid_comment - - - SUBROUTINE cxios_set_grid_description(grid_hdl, description, description_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: grid_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: description - INTEGER (kind = C_INT) , VALUE :: description_size - END SUBROUTINE cxios_set_grid_description - - SUBROUTINE cxios_get_grid_description(grid_hdl, description, description_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: grid_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: description - INTEGER (kind = C_INT) , VALUE :: description_size - END SUBROUTINE cxios_get_grid_description - - FUNCTION cxios_is_defined_grid_description(grid_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_grid_description - INTEGER (kind = C_INTPTR_T), VALUE :: grid_hdl - END FUNCTION cxios_is_defined_grid_description - - - SUBROUTINE cxios_set_grid_mask_0d(grid_hdl, mask_0d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: grid_hdl - LOGICAL (KIND=C_BOOL) , DIMENSION(*) :: mask_0d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_set_grid_mask_0d - - SUBROUTINE cxios_get_grid_mask_0d(grid_hdl, mask_0d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: grid_hdl - LOGICAL (KIND=C_BOOL) , DIMENSION(*) :: mask_0d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_get_grid_mask_0d - - FUNCTION cxios_is_defined_grid_mask_0d(grid_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_grid_mask_0d - INTEGER (kind = C_INTPTR_T), VALUE :: grid_hdl - END FUNCTION cxios_is_defined_grid_mask_0d - - - SUBROUTINE cxios_set_grid_mask_1d(grid_hdl, mask_1d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: grid_hdl - LOGICAL (KIND=C_BOOL) , DIMENSION(*) :: mask_1d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_set_grid_mask_1d - - SUBROUTINE cxios_get_grid_mask_1d(grid_hdl, mask_1d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: grid_hdl - LOGICAL (KIND=C_BOOL) , DIMENSION(*) :: mask_1d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_get_grid_mask_1d - - FUNCTION cxios_is_defined_grid_mask_1d(grid_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_grid_mask_1d - INTEGER (kind = C_INTPTR_T), VALUE :: grid_hdl - END FUNCTION cxios_is_defined_grid_mask_1d - - - SUBROUTINE cxios_set_grid_mask_2d(grid_hdl, mask_2d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: grid_hdl - LOGICAL (KIND=C_BOOL) , DIMENSION(*) :: mask_2d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_set_grid_mask_2d - - SUBROUTINE cxios_get_grid_mask_2d(grid_hdl, mask_2d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: grid_hdl - LOGICAL (KIND=C_BOOL) , DIMENSION(*) :: mask_2d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_get_grid_mask_2d - - FUNCTION cxios_is_defined_grid_mask_2d(grid_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_grid_mask_2d - INTEGER (kind = C_INTPTR_T), VALUE :: grid_hdl - END FUNCTION cxios_is_defined_grid_mask_2d - - - SUBROUTINE cxios_set_grid_mask_3d(grid_hdl, mask_3d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: grid_hdl - LOGICAL (KIND=C_BOOL) , DIMENSION(*) :: mask_3d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_set_grid_mask_3d - - SUBROUTINE cxios_get_grid_mask_3d(grid_hdl, mask_3d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: grid_hdl - LOGICAL (KIND=C_BOOL) , DIMENSION(*) :: mask_3d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_get_grid_mask_3d - - FUNCTION cxios_is_defined_grid_mask_3d(grid_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_grid_mask_3d - INTEGER (kind = C_INTPTR_T), VALUE :: grid_hdl - END FUNCTION cxios_is_defined_grid_mask_3d - - - SUBROUTINE cxios_set_grid_mask_4d(grid_hdl, mask_4d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: grid_hdl - LOGICAL (KIND=C_BOOL) , DIMENSION(*) :: mask_4d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_set_grid_mask_4d - - SUBROUTINE cxios_get_grid_mask_4d(grid_hdl, mask_4d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: grid_hdl - LOGICAL (KIND=C_BOOL) , DIMENSION(*) :: mask_4d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_get_grid_mask_4d - - FUNCTION cxios_is_defined_grid_mask_4d(grid_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_grid_mask_4d - INTEGER (kind = C_INTPTR_T), VALUE :: grid_hdl - END FUNCTION cxios_is_defined_grid_mask_4d - - - SUBROUTINE cxios_set_grid_mask_5d(grid_hdl, mask_5d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: grid_hdl - LOGICAL (KIND=C_BOOL) , DIMENSION(*) :: mask_5d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_set_grid_mask_5d - - SUBROUTINE cxios_get_grid_mask_5d(grid_hdl, mask_5d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: grid_hdl - LOGICAL (KIND=C_BOOL) , DIMENSION(*) :: mask_5d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_get_grid_mask_5d - - FUNCTION cxios_is_defined_grid_mask_5d(grid_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_grid_mask_5d - INTEGER (kind = C_INTPTR_T), VALUE :: grid_hdl - END FUNCTION cxios_is_defined_grid_mask_5d - - - SUBROUTINE cxios_set_grid_mask_6d(grid_hdl, mask_6d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: grid_hdl - LOGICAL (KIND=C_BOOL) , DIMENSION(*) :: mask_6d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_set_grid_mask_6d - - SUBROUTINE cxios_get_grid_mask_6d(grid_hdl, mask_6d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: grid_hdl - LOGICAL (KIND=C_BOOL) , DIMENSION(*) :: mask_6d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_get_grid_mask_6d - - FUNCTION cxios_is_defined_grid_mask_6d(grid_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_grid_mask_6d - INTEGER (kind = C_INTPTR_T), VALUE :: grid_hdl - END FUNCTION cxios_is_defined_grid_mask_6d - - - SUBROUTINE cxios_set_grid_mask_7d(grid_hdl, mask_7d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: grid_hdl - LOGICAL (KIND=C_BOOL) , DIMENSION(*) :: mask_7d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_set_grid_mask_7d - - SUBROUTINE cxios_get_grid_mask_7d(grid_hdl, mask_7d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: grid_hdl - LOGICAL (KIND=C_BOOL) , DIMENSION(*) :: mask_7d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_get_grid_mask_7d - - FUNCTION cxios_is_defined_grid_mask_7d(grid_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_grid_mask_7d - INTEGER (kind = C_INTPTR_T), VALUE :: grid_hdl - END FUNCTION cxios_is_defined_grid_mask_7d - - - SUBROUTINE cxios_set_grid_name(grid_hdl, name, name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: grid_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: name - INTEGER (kind = C_INT) , VALUE :: name_size - END SUBROUTINE cxios_set_grid_name - - SUBROUTINE cxios_get_grid_name(grid_hdl, name, name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: grid_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: name - INTEGER (kind = C_INT) , VALUE :: name_size - END SUBROUTINE cxios_get_grid_name - - FUNCTION cxios_is_defined_grid_name(grid_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_grid_name - INTEGER (kind = C_INTPTR_T), VALUE :: grid_hdl - END FUNCTION cxios_is_defined_grid_name - - END INTERFACE - -END MODULE grid_interface_attr diff --git a/xios_2311_src/trunk/.svn/pristine/05/054b907a861f3b86ca0d28adbfc93004eadec3f9.svn-base b/xios_2311_src/trunk/.svn/pristine/05/054b907a861f3b86ca0d28adbfc93004eadec3f9.svn-base deleted file mode 100644 index d57a5aa4abb5caf22f800987d2402205b9a16414..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/05/054b907a861f3b86ca0d28adbfc93004eadec3f9.svn-base +++ /dev/null @@ -1,741 +0,0 @@ -/* - -This file is part of netcdf-4, a netCDF-like interface for HDF5, or a -HDF5 backend for netCDF, depending on your point of view. - -This file handles the nc4 user-defined type functions (i.e. compound -and opaque types). - -Copyright 2005, University Corporation for Atmospheric Research. See -the COPYRIGHT file for copying and redistribution conditions. - -$Id: nc4type.c,v 1.73 2010/05/25 17:54:24 dmh Exp $ -*/ - -#include "nc4internal.h" - -#define NUM_ATOMIC_TYPES 13 -char atomic_name[NUM_ATOMIC_TYPES][NC_MAX_NAME + 1] = {"none", "byte", "char", - "short", "int", "float", - "double", "ubyte", - "ushort", "uint", - "int64", "uint64", "string"}; - -EXTERNL int -NC4_inq_type_equal(int ncid1, nc_type typeid1, int ncid2, - nc_type typeid2, int *equalp) -{ - NC_GRP_INFO_T *grp1, *grp2; - NC_TYPE_INFO_T *type1, *type2; - int retval; - - LOG((2, "nc_inq_type_equal: ncid1 0x%x typeid1 %d ncid2 0x%x typeid2 %d", - ncid1, typeid1, ncid2, typeid2)); - - /* Check input. */ - if(equalp == NULL) return NC_NOERR; - - if (typeid1 <= NC_NAT || typeid2 <= NC_NAT) - return NC_EINVAL; - - /* If one is atomic, and the other user-defined, the types are not - * equal. */ - if ((typeid1 <= NC_STRING && typeid2 > NC_STRING) || - (typeid2 <= NC_STRING && typeid1 > NC_STRING)) - { - if (equalp) *equalp = 0; - return NC_NOERR; - } - - /* If both are atomic types, the answer is easy. */ - if (typeid1 <= NUM_ATOMIC_TYPES) - { - if (equalp) - { - if (typeid1 == typeid2) - *equalp = 1; - else - *equalp = 0; - } - return NC_NOERR; - } - - /* Not atomic types - so find type1 and type2 information. */ - if ((retval = nc4_find_nc4_grp(ncid1, &grp1))) - return retval; - if (!(type1 = nc4_rec_find_nc_type(grp1->file->nc4_info->root_grp, - typeid1))) - return NC_EBADTYPE; - if ((retval = nc4_find_nc4_grp(ncid2, &grp2))) - return retval; - if (!(type2 = nc4_rec_find_nc_type(grp2->file->nc4_info->root_grp, - typeid2))) - return NC_EBADTYPE; - - /* Are the two types equal? */ - if (equalp) - *equalp = (int)H5Tequal(type1->native_typeid, type2->native_typeid); - - return NC_NOERR; -} - -/* Get the id of a type from the name. */ -EXTERNL int -NC4_inq_typeid(int ncid, const char *name, nc_type *typeidp) -{ - NC_GRP_INFO_T *grp, *grp2; - NC_HDF5_FILE_INFO_T *h5; - NC_TYPE_INFO_T *type = NULL; - char *norm_name; - int i, retval; - - for (i = 0; i < NUM_ATOMIC_TYPES; i++) - if (!strcmp(name, atomic_name[i])) - { - if (typeidp) - *typeidp = i; - return NC_NOERR; - } - - /* Find info for this file and group, and set pointer to each. */ - if ((retval = nc4_find_grp_h5(ncid, &grp, &h5))) - return retval; - - /* Must be a netCDF-4 file. */ - if (!h5) - return NC_ENOTNC4; - - /* If the first char is a /, this is a fully-qualified - * name. Otherwise, this had better be a local name (i.e. no / in - * the middle). */ - if (name[0] != '/' && strstr(name, "/")) - return NC_EINVAL; - - /* Normalize name. */ - if (!(norm_name = malloc(strlen(name) + 1))) - return NC_ENOMEM; - if ((retval = nc4_normalize_name(name, norm_name))) - return retval; - - /* Is the type in this group? If not, search parents. */ - for (grp2 = grp; grp2; grp2 = grp2->parent) - for (type = grp2->type; type; type = type->next) - if (!strcmp(norm_name, type->name)) - { - if (typeidp) - *typeidp = type->nc_typeid; - break; - } - - /* Still didn't find type? Search file recursively, starting at the - * root group. */ - if (!type) - if ((type = nc4_rec_find_named_type(grp->file->nc4_info->root_grp, norm_name))) - if (typeidp) - *typeidp = type->nc_typeid; - - free(norm_name); - - /* OK, I give up already! */ - if (!type) - return NC_EBADTYPE; - - return NC_NOERR; -} - -/* Find all user-defined types for a location. This finds all - * user-defined types in a group. */ -int -NC4_inq_typeids(int ncid, int *ntypes, int *typeids) -{ - NC_GRP_INFO_T *grp; - NC_HDF5_FILE_INFO_T *h5; - NC_TYPE_INFO_T *type; - int num = 0; - int retval; - - LOG((2, "nc_inq_typeids: ncid 0x%x", ncid)); - - /* Find info for this file and group, and set pointer to each. */ - if ((retval = nc4_find_grp_h5(ncid, &grp, &h5))) - return retval; - - /* If this is a netCDF-4 file, count types. */ - if (h5 && grp->type) - for (type = grp->type; type; type = type->next) - { - if (typeids) - typeids[num] = type->nc_typeid; - num++; - } - - /* Give the count to the user. */ - if (ntypes) - *ntypes = num; - - return NC_NOERR; -} - - -/* This internal function adds a new user defined type to the metadata - * of a group of an open file. */ -static int -add_user_type(int ncid, size_t size, const char *name, nc_type base_typeid, - nc_type type_class, nc_type *typeidp) -{ - NC_HDF5_FILE_INFO_T *h5; - NC_GRP_INFO_T *grp; - NC_TYPE_INFO_T *type; - char norm_name[NC_MAX_NAME + 1]; - int retval; - - /* Check and normalize the name. */ - if ((retval = nc4_check_name(name, norm_name))) - return retval; - - LOG((2, "add_user_type: ncid 0x%x size %d name %s base_typeid %d ", - ncid, size, norm_name, base_typeid)); - - /* Find group metadata. */ - if ((retval = nc4_find_grp_h5(ncid, &grp, &h5))) - return retval; - - /* Only netcdf-4 files! */ - if (!h5) - return NC_ENOTNC4; - - /* Turn on define mode if it is not on. */ - if (!(h5->cmode & NC_INDEF)) - if ((retval = nc_redef(ncid))) - return retval; - - /* No size is provided for vlens or enums, get it from the base type. */ - if (type_class == NC_VLEN || type_class == NC_ENUM) - { - if ((retval = nc4_get_typelen_mem(grp->file->nc4_info, base_typeid, 0, - &size))) - return retval; - } - else if (size <= 0) - return NC_EINVAL; - - /* Check that this name is not in use as a var, grp, or type. */ - if ((retval = nc4_check_dup_name(grp, norm_name))) - return retval; - - /* Add to our list of types. */ - if ((retval = nc4_type_list_add(&(grp->type), &type))) - return retval; - - /* Remember info about this type. */ - type->nc_typeid = grp->file->nc4_info->next_typeid++; - type->size = size; - if (!(type->name = malloc((strlen(norm_name) + 1) * sizeof(char)))) - return NC_ENOMEM; - strcpy(type->name, norm_name); - type->class = type_class; - type->base_nc_type = base_typeid; - - /* Return the typeid to the user. */ - if (typeidp) - *typeidp = type->nc_typeid; - - return NC_NOERR; -} - - -/* The sizes of types may vary from platform to platform, but within - * netCDF files, type sizes are fixed. */ -#define NC_CHAR_LEN sizeof(char) -#define NC_STRING_LEN sizeof(char *) -#define NC_BYTE_LEN 1 -#define NC_SHORT_LEN 2 -#define NC_INT_LEN 4 -#define NC_FLOAT_LEN 4 -#define NC_DOUBLE_LEN 8 -#define NC_INT64_LEN 8 - -/* Get the name and size of a type. For strings, 1 is returned. For - * VLEN the base type len is returned. */ -int -NC4_inq_type(int ncid, nc_type typeid, char *name, size_t *size) -{ - NC_GRP_INFO_T *grp; - NC_TYPE_INFO_T *type; - int atomic_size[NUM_ATOMIC_TYPES] = {0, NC_BYTE_LEN, NC_CHAR_LEN, NC_SHORT_LEN, - NC_INT_LEN, NC_FLOAT_LEN, NC_DOUBLE_LEN, - NC_BYTE_LEN, NC_SHORT_LEN, NC_INT_LEN, NC_INT64_LEN, - NC_INT64_LEN, NC_STRING_LEN}; - - int retval; - - LOG((2, "nc_inq_type: ncid 0x%x typeid %d", ncid, typeid)); - - /* If this is an atomic type, the answer is easy. */ - if (typeid <= NUM_ATOMIC_TYPES) - { - if (name) - strcpy(name, atomic_name[typeid]); - if (size) - *size = atomic_size[typeid]; - return NC_NOERR; - } - - /* Not an atomic type - so find group. */ - if ((retval = nc4_find_nc4_grp(ncid, &grp))) - return retval; - - /* Find this type. */ - if (!(type = nc4_rec_find_nc_type(grp->file->nc4_info->root_grp, typeid))) - return NC_EBADTYPE; - - if (name) - strcpy(name, type->name); - - if (size) - { - if (type->class != NC_VLEN) - *size = type->size; - else - *size = sizeof(nc_vlen_t); - } - - return NC_NOERR; -} - -/* Create a compound type. */ -int -NC4_def_compound(int ncid, size_t size, const char *name, nc_type *typeidp) -{ - return add_user_type(ncid, size, name, 0, NC_COMPOUND, typeidp); -} - -/* Insert a named field into a compound type. */ -int -NC4_insert_compound(int ncid, nc_type typeid, const char *name, size_t offset, - nc_type field_typeid) -{ - return nc_insert_array_compound(ncid, typeid, name, offset, - field_typeid, 0, NULL); -} - -/* Insert a named array into a compound type. */ -EXTERNL int -NC4_insert_array_compound(int ncid, int typeid, const char *name, - size_t offset, nc_type field_typeid, - int ndims, const int *dim_sizesp) -{ - NC_GRP_INFO_T *grp; - NC_TYPE_INFO_T *type; - char norm_name[NC_MAX_NAME + 1]; - int retval; - - LOG((2, "nc_insert_array_compound: ncid 0x%x, typeid %d name %s " - "offset %d field_typeid %d ndims %d", ncid, typeid, - name, offset, field_typeid, ndims)); - - /* Check and normalize the name. */ - if ((retval = nc4_check_name(name, norm_name))) - return retval; - - /* Find file metadata. */ - if ((retval = nc4_find_nc4_grp(ncid, &grp))) - return retval; - - /* Find type metadata. */ - if ((retval = nc4_find_type(grp->file->nc4_info, typeid, &type))) - return retval; - - /* Did the user give us a good compound type typeid? */ - if (!type || type->class != NC_COMPOUND) - return NC_EBADTYPE; - - /* If this type has already been written to the file, you can't - * change it. */ - if (type->committed) - return NC_ETYPDEFINED; - - /* Insert new field into this type's list of fields. */ - if ((retval = nc4_field_list_add(&type->field, type->num_fields, - norm_name, offset, 0, 0, field_typeid, - ndims, dim_sizesp))) - return retval; - - type->num_fields++; - - return NC_NOERR; -} - -/* Find info about any user defined type. */ -int -NC4_inq_user_type(int ncid, nc_type typeid, char *name, size_t *size, - nc_type *base_nc_typep, size_t *nfieldsp, int *classp) -{ - NC_GRP_INFO_T *grp; - NC_TYPE_INFO_T *type; - NC_FIELD_INFO_T *field; - int retval; - - LOG((2, "nc_inq_user_type: ncid 0x%x typeid %d", ncid, typeid)); - - /* Find group metadata. */ - if ((retval = nc4_find_nc4_grp(ncid, &grp))) - return retval; - - /* Find this type. */ - if (!(type = nc4_rec_find_nc_type(grp->file->nc4_info->root_grp, typeid))) - return NC_EBADTYPE; - - /* Count the number of fields. */ - if (nfieldsp) - { - *nfieldsp = 0; - if (type->class == NC_COMPOUND) - for (field = type->field; field; field = field->next) - (*nfieldsp)++; - else if (type->class == NC_ENUM) - *nfieldsp = type->num_enum_members; - } - - /* Fill in size and name info, if desired. */ - if (size) - { - if (type->class != NC_VLEN) - *size = type->size; - else - *size = sizeof(nc_vlen_t); - } - if (name) - strcpy(name, type->name); - - /* VLENS and ENUMs have a base type - that is, they type they are - * arrays of or enums of. */ - if (base_nc_typep) - *base_nc_typep = type->base_nc_type; - - /* If the user wants it, tell whether this is a compound, opaque, - * vlen, enum, or string class of type. */ - if (classp) - *classp = type->class; - - return NC_NOERR; -} - -/* Given the ncid, typeid and fieldid, get info about the field. */ -int -NC4_inq_compound_field(int ncid, nc_type typeid, int fieldid, char *name, - size_t *offsetp, nc_type *field_typeidp, int *ndimsp, - int *dim_sizesp) -{ - NC_GRP_INFO_T *grp; - NC_TYPE_INFO_T *type; - NC_FIELD_INFO_T *field; - int d, retval; - - /* Find file metadata. */ - if ((retval = nc4_find_nc4_grp(ncid, &grp))) - return retval; - - /* Find this type. */ - if (!(type = nc4_rec_find_nc_type(grp->file->nc4_info->root_grp, typeid))) - return NC_EBADTYPE; - - /* Find the field. */ - for (field = type->field; field; field = field->next) - if (field->fieldid == fieldid) - { - if (name) - strcpy(name, field->name); - if (offsetp) - *offsetp = field->offset; - if (field_typeidp) - *field_typeidp = field->nctype; - if (ndimsp) - *ndimsp = field->ndims; - if (dim_sizesp) - for (d = 0; d < field->ndims; d++) - dim_sizesp[d] = field->dim_size[d]; - return NC_NOERR; - } - - return NC_EBADFIELD; -} - -/* Find a netcdf-4 file. THis will return an error if it finds a - * netcdf-3 file, or a netcdf-4 file with strict nc3 rules. */ -static int -find_nc4_file(int ncid, NC_FILE_INFO_T **nc) -{ - - /* Find file metadata. */ - if (!((*nc) = nc4_find_nc_file(ncid))) - return NC_EBADID; - - /* Check for netcdf-3 files or netcdf-3 rules. */ - if (!(*nc)->nc4_info) - return NC_ENOTNC4; - if ((*nc)->nc4_info->cmode & NC_CLASSIC_MODEL) - return NC_ESTRICTNC3; - - return NC_NOERR; -} - -/* Given the typeid and the name, get the fieldid. */ -int -NC4_inq_compound_fieldindex(int ncid, nc_type typeid, const char *name, int *fieldidp) -{ - NC_FILE_INFO_T *nc; - NC_TYPE_INFO_T *type; - NC_FIELD_INFO_T *field; - char norm_name[NC_MAX_NAME + 1]; - int retval; - - LOG((2, "nc_inq_compound_fieldindex: ncid 0x%x typeid %d name %s", - ncid, typeid, name)); - - /* Find file metadata. */ - if ((retval = find_nc4_file(ncid, &nc))) - return retval; - - /* Find the type. */ - if ((retval = nc4_find_type(nc->nc4_info, typeid, &type))) - return retval; - - /* Did the user give us a good compound type typeid? */ - if (!type || type->class != NC_COMPOUND) - return NC_EBADTYPE; - - /* Normalize name. */ - if ((retval = nc4_normalize_name(name, norm_name))) - return retval; - - /* Find the field with this name. */ - for (field = type->field; field; field = field->next) - if (!strcmp(field->name, norm_name)) - break; - - if (!field) - return NC_EBADFIELD; - - if (fieldidp) - *fieldidp = field->fieldid; - return NC_NOERR; -} - - -/* Opaque type. */ - -/* Create an opaque type. Provide a size and a name. */ -int -NC4_def_opaque(int ncid, size_t datum_size, const char *name, - nc_type *typeidp) -{ - return add_user_type(ncid, datum_size, name, 0, NC_OPAQUE, typeidp); -} - - -/* Define a variable length type. */ -int -NC4_def_vlen(int ncid, const char *name, nc_type base_typeid, - nc_type *typeidp) -{ - return add_user_type(ncid, 0, name, base_typeid, NC_VLEN, typeidp); -} - -/* Create an enum type. Provide a base type and a name. At the moment - * only ints are accepted as base types. */ -int -NC4_def_enum(int ncid, nc_type base_typeid, const char *name, - nc_type *typeidp) -{ - return add_user_type(ncid, 0, name, base_typeid, NC_ENUM, typeidp); -} - - -/* Get enum name from enum value. Name size will be <= NC_MAX_NAME. */ -int -NC4_inq_enum_ident(int ncid, nc_type xtype, long long value, char *identifier) -{ - NC_GRP_INFO_T *grp; - NC_TYPE_INFO_T *type; - NC_ENUM_MEMBER_INFO_T *enum_member; - long long ll_val; - int i; - int retval; - - LOG((3, "nc_inq_enum_ident: xtype %d value %d\n", xtype, value)); - - /* Find group metadata. */ - if ((retval = nc4_find_nc4_grp(ncid, &grp))) - return retval; - - /* Find this type. */ - if (!(type = nc4_rec_find_nc_type(grp->file->nc4_info->root_grp, xtype))) - return NC_EBADTYPE; - - /* Complain if they are confused about the type. */ - if (type->class != NC_ENUM) - return NC_EBADTYPE; - - /* Move to the desired enum member in the list. */ - enum_member = type->enum_member; - for (i = 0; i < type->num_enum_members; i++) - { - switch (type->base_nc_type) - { - case NC_BYTE: - ll_val = *(char *)enum_member->value; - break; - case NC_UBYTE: - ll_val = *(unsigned char *)enum_member->value; - break; - case NC_SHORT: - ll_val = *(short *)enum_member->value; - break; - case NC_USHORT: - ll_val = *(unsigned short *)enum_member->value; - break; - case NC_INT: - ll_val = *(int *)enum_member->value; - break; - case NC_UINT: - ll_val = *(unsigned int *)enum_member->value; - break; - case NC_INT64: - case NC_UINT64: - ll_val = *(long long *)enum_member->value; - break; - default: - return NC_EINVAL; - } - LOG((4, "ll_val=%d", ll_val)); - if (ll_val == value) - { - if (identifier) - strcpy(identifier, enum_member->name); - break; - } - else - enum_member = enum_member->next; - } - - /* If we didn't find it, life sucks for us. :-( */ - if (i == type->num_enum_members) - return NC_EINVAL; - - return NC_NOERR; -} - -/* Get information about an enum member: an identifier and - * value. Identifier size will be <= NC_MAX_NAME. */ -int -NC4_inq_enum_member(int ncid, nc_type typeid, int idx, char *identifier, - void *value) -{ - NC_GRP_INFO_T *grp; - NC_TYPE_INFO_T *type; - NC_ENUM_MEMBER_INFO_T *enum_member; - int i; - int retval; - - LOG((2, "nc_inq_enum_member: ncid 0x%x typeid %d", ncid, typeid)); - - /* Find group metadata. */ - if ((retval = nc4_find_nc4_grp(ncid, &grp))) - return retval; - - /* Find this type. */ - if (!(type = nc4_rec_find_nc_type(grp->file->nc4_info->root_grp, typeid))) - return NC_EBADTYPE; - - /* Complain if they are confused about the type. */ - if (type->class != NC_ENUM) - return NC_EBADTYPE; - - /* Check index. */ - if (idx >= type->num_enum_members) - return NC_EINVAL; - - /* Move to the desired enum member in the list. */ - enum_member = type->enum_member; - for (i = 0; i < idx; i++) - enum_member = enum_member->next; - - /* Give the people what they want. */ - if (identifier) - strcpy(identifier, enum_member->name); - if (value) - memcpy(value, enum_member->value, type->size); - - return NC_NOERR; -} - -/* Insert a identifierd value into an enum type. The value must fit within - * the size of the enum type, the identifier size must be <= NC_MAX_NAME. */ -int -NC4_insert_enum(int ncid, nc_type typeid, const char *identifier, - const void *value) -{ - NC_GRP_INFO_T *grp; - NC_TYPE_INFO_T *type; - char norm_name[NC_MAX_NAME + 1]; - int retval; - - LOG((2, "nc_insert_enum: ncid 0x%x, typeid %d identifier %s value %d", ncid, - typeid, identifier, value)); - - /* Check and normalize the name. */ - if ((retval = nc4_check_name(identifier, norm_name))) - return retval; - - /* Find file metadata. */ - if ((retval = nc4_find_nc4_grp(ncid, &grp))) - return retval; - - /* Find type metadata. */ - if ((retval = nc4_find_type(grp->file->nc4_info, typeid, &type))) - return retval; - - /* Did the user give us a good enum typeid? */ - if (!type || type->class != NC_ENUM) - return NC_EBADTYPE; - - /* If this type has already been written to the file, you can't - * change it. */ - if (type->committed) - return NC_ETYPDEFINED; - - /* Insert new field into this type's list of fields. */ - if ((retval = nc4_enum_member_add(&type->enum_member, type->size, - norm_name, value))) - return retval; - - type->num_enum_members++; - - return NC_NOERR; -} - -/* Insert one element into an already allocated vlen array element. */ -int -NC4_put_vlen_element(int ncid, int typeid, void *vlen_element, - size_t len, const void *data) -{ - nc_vlen_t *tmp = vlen_element; - tmp->len = len; - tmp->p = (void *)data; - return NC_NOERR; -} - -/* Insert one element into an already allocated vlen array element. */ -int -NC4_get_vlen_element(int ncid, int typeid, const void *vlen_element, - size_t *len, void *data) -{ - const nc_vlen_t *tmp = vlen_element; - int type_size = 4; - - *len = tmp->len; - memcpy(data, tmp->p, tmp->len * type_size); - return NC_NOERR; -} - diff --git a/xios_2311_src/trunk/.svn/pristine/05/054eef59aa1d47b05b43d73237e33f24ff3085e1.svn-base b/xios_2311_src/trunk/.svn/pristine/05/054eef59aa1d47b05b43d73237e33f24ff3085e1.svn-base deleted file mode 100644 index a7572512ae4234a052194959eb8492482e8adf40..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/05/054eef59aa1d47b05b43d73237e33f24ff3085e1.svn-base +++ /dev/null @@ -1,410 +0,0 @@ -#ifndef __XIOS_CGrid__ -#define __XIOS_CGrid__ - -/// XIOS headers /// -#include "xios_spl.hpp" -#include "group_factory.hpp" - -#include "declare_group.hpp" -#include "domain.hpp" -#include "axis.hpp" -#include "scalar.hpp" -#include "array_new.hpp" -#include "attribute_array.hpp" -#include "distribution_server.hpp" -#include "client_server_mapping.hpp" -#include "utils.hpp" -#include "transformation_enum.hpp" -#include "grid_local_connector.hpp" -#include "grid_elements.hpp" -#include "grid_scatterer_connector.hpp" -#include "grid_gatherer_connector.hpp" -#include "transformation_path.hpp" -#include "filter.hpp" -#include "grid_algorithm.hpp" - - -namespace xios { - - /// ////////////////////// Declarations ////////////////////// /// - - class CGridGroup; - class CGridAttributes; - class CDomainGroup; - class CAxisGroup; - class CScalarGroup; - class CGrid; - class CDistributionClient; - class CDistributionServer; - class CServerDistributionDescription; - class CClientServerMapping; - - ///-------------------------------------------------------------- - - // Declare/Define CGridAttribute - BEGIN_DECLARE_ATTRIBUTE_MAP(CGrid) -# include "grid_attribute.conf" - END_DECLARE_ATTRIBUTE_MAP(CGrid) - - ///-------------------------------------------------------------- - - class CGrid - : public CObjectTemplate - , public CGridAttributes - { - /// typedef /// - typedef CObjectTemplate SuperClass; - typedef CGridAttributes SuperClassAttribute; - - private: - - // define a structure to store elements (CDomain, CAxis, CScalar) using a void* and a type to cast the pointer - enum EElementType { TYPE_SCALAR, TYPE_AXIS, TYPE_DOMAIN } ; - struct SElement {void* ptr ; EElementType type ; CScalar* scalar ; CAxis* axis ; CDomain* domain ; } ; - vector elements_ ; - bool elementsComputed_ = false ; - /** retrieve the vector of elements as a structure containing a void* and the type of pointer */ - vector& getElements(void) { if (!elementsComputed_) computeElements() ; return elements_ ; } - void computeElements(void) ; - /** List order of axis and domain in a grid, if there is a domain, it will take value 2, axis 1, scalar 0 */ - std::vector order_; - - public: - - typedef CGridAttributes RelAttributes; - typedef CGridGroup RelGroup; - - enum EEventId - { - EVENT_ID_ADD_DOMAIN, EVENT_ID_ADD_AXIS, EVENT_ID_ADD_SCALAR, - EVENT_ID_SEND_MASK, - - }; - - /// Constructeurs /// - CGrid(void); - explicit CGrid(const StdString& id); - CGrid(const CGrid& grid); // Not implemented yet. - CGrid(const CGrid* const grid); // Not implemented yet. - - /// Traitements /// -// void solveReference(void); - - void checkEligibilityForCompressedOutput(); - - - - void checkMaskIndex(bool doCalculateIndex); - - // virtual void toBinary (StdOStream& os) const; -// virtual void fromBinary(StdIStream& is); - - void addRelFileCompressed(const StdString& filename); - - /// Tests /// - bool isCompressible(void) const; - bool isWrittenCompressed(const StdString& filename) const; - - public: - - /// Accesseurs /// - StdSize getDimension(void); - - StdSize getDataSize(void) ; - - /** - * Get the local data grid size, ie the size of the compressed grid (inside the workflow) - * \return The size od the compressed grid - */ - StdSize getLocalDataSize(void) ; - - - virtual void parse(xml::CXMLNode& node); - - /// Destructeur /// - virtual ~CGrid(void); - - public: - - /// Accesseurs statiques /// - static StdString GetName(void); - static StdString GetDefName(void); - - static ENodeType GetType(void); - - /// Instanciateurs Statiques /// - static CGrid* createGrid(CDomain* domain); - static CGrid* createGrid(CDomain* domain, CAxis* axis); - static CGrid* createGrid(const std::vector& domains, const std::vector& axis, - const CArray& axisDomainOrder = CArray()); - static CGrid* createGrid(StdString id, const std::vector& domains, const std::vector& axis, - const std::vector& scalars, const CArray& axisDomainOrder = CArray()); - static CGrid* createGrid(const std::vector& domains, const std::vector& axis, - const std::vector& scalars, const CArray& axisDomainOrder); - static CGrid* get(const string& id, bool noError=false) ; //& domains, const std::vector& axis, - const std::vector& scalars, const CArray& axisDomainOrder = CArray()); - static StdString generateId(const CGrid* gridSrc, const CGrid* gridDest); - static CGrid* cloneGrid(const StdString& idNewGrid, CGrid* gridSrc); - - CDomain* getAssociatedDomain(const string& domainId, bool noError=false) ; - CAxis* getAssociatedAxis(const string& axisId, bool noError=false) ; - CScalar* getAssociatedScalar(const string& scalarId, bool noError=false) ; - public: - void solveDomainAxisRef(bool areAttributesChecked); - void checkElementsAttributes(void) ; - - void solveDomainRef(bool checkAtt); - void solveAxisRef(bool checkAtt); - void solveScalarRef(bool checkAtt); - void solveElementsRefInheritance(bool apply = true); - bool activateFieldWorkflow(CGarbageCollector& gc) ; - // void solveTransformations(); - void solveDomainAxisBaseRef(); - - CDomain* addDomain(const std::string& id=StdString()); - CAxis* addAxis(const std::string& id=StdString()); - CScalar* addScalar(const std::string& id=StdString()); - - public: - void sendGridToFileServer(CContextClient* client) ; - private: - std::set sendGridToFileServer_done_ ; - - public: - void sendGridToCouplerOut(CContextClient* client, const string& fieldId) ; - private: - std::set sendGridToCouplerOut_done_ ; - - public: - void makeAliasForCoupling(const string& fieldId) ; - string getCouplingAlias(const string& fieldId) ; - - public: - void sendAddDomain(const std::string& id,CContextClient* contextClient); - void sendAddAxis(const std::string& id,CContextClient* contextClient); - void sendAddScalar(const std::string& id,CContextClient* contextClient); - - static void recvAddDomain(CEventServer& event); - void recvAddDomain(CBufferIn& buffer); - static void recvAddAxis(CEventServer& event); - void recvAddAxis(CBufferIn& buffer); - static void recvAddScalar(CEventServer& event); - void recvAddScalar(CBufferIn& buffer); - - static bool dispatchEvent(CEventServer& event); - - public: - void setContextClient(CContextClient* contextClient); - - std::map getAttributesBufferSize(CContextClient* client, bool bufferForWriting = false); - std::map getDataBufferSize(CContextClient* client, const std::string& id = "", bool bufferForWriting = false); - std::vector getDomainList(); - std::vector getAxisList(); - std::vector getScalarList(); - std::vector getDomains(); - std::vector getAxis(); - std::vector getScalars(); - CDomain* getDomain(int domainIndex); - CAxis* getAxis(int axisIndex); - CScalar* getScalar(int scalarIndex); - std::vector getAxisOrder(); - std::vector getGlobalDimension(); - bool isScalarGrid() const; - - bool doGridHaveDataToWrite(); - bool doGridHaveDataDistributed(CContextClient* client = 0); - - /////////////////////////////////////////// - //////// TRANSFORMATIONS ///// - /////////////////////////////////////////// - public: - pair, shared_ptr > buildTransformationGraph(CGarbageCollector& gc, bool isSource, CGrid* gridSrc, double detectMissingValues, - double defaultValue, CGrid*& newGrid, bool graphEnabled=false, CField* field=0) ; - private: - shared_ptr gridAlgorithm_ = nullptr ; - public: - void setGridAlgorithm(shared_ptr gridAlgorithm) {gridAlgorithm_ = gridAlgorithm;} - shared_ptr getGridAlgorithm(void) { return gridAlgorithm_ ;} - - /////////////////////////////////////////// - public: - - size_t getGlobalWrittenSize(void) ; - - bool isCompleted(void) ; - void setCompleted(void) ; - void unsetCompleted(void) ; - - - bool hasMask(void) const; - /** get mask pointer stored in mask_1d, or mask_2d, or..., or mask_7d */ - CArray mask_ ; - CArray& getMask(void) ; - - private: - /** Client-like distribution calculated based on the knowledge of the entire grid */ - CDistributionClient* clientDistribution_; - public: - void computeClientDistribution(void) ; - private: - bool computeClientDistribution_done_ = false ; - public: - CDistributionClient* getClientDistribution(void); - - private: - void setVirtualDomainGroup(CDomainGroup* newVDomainGroup); - void setVirtualAxisGroup(CAxisGroup* newVAxisGroup); - void setVirtualScalarGroup(CScalarGroup* newVScalarGroup); - - void setDomainList(const std::vector domains = std::vector()); - void setAxisList(const std::vector axis = std::vector()); - void setScalarList(const std::vector scalars = std::vector()); - - CDomainGroup* getVirtualDomainGroup() const; - CAxisGroup* getVirtualAxisGroup() const; - CScalarGroup* getVirtualScalarGroup() const; - - int computeGridGlobalDimension(std::vector& globalDim, - const std::vector domains, - const std::vector axis, - const std::vector scalars, - const CArray& axisDomainOrder); - int getDistributedDimension(); - public: - - bool isDataDistributed(void) ; - private: - -/** Clients that have to send a grid. There can be multiple clients in case of secondary server, otherwise only one client. */ - std::list clients; - std::set clientsSet; - - private: - bool isChecked; - bool isDomainAxisChecked; - bool isIndexSent; - - CDomainGroup* vDomainGroup_; - CAxisGroup* vAxisGroup_; - CScalarGroup* vScalarGroup_; - std::vector axisList_, domList_, scalarList_; - bool isAxisListSet, isDomListSet, isScalarListSet; - -/** Map storing local ranks of connected receivers. Key = size of receiver's intracomm. - * It is calculated in computeConnectedClients(). */ - std::map > connectedServerRank_; - -/** Map storing the size of data to be send. Key = size of receiver's intracomm - * It is calculated in computeConnectedClients(). */ - std::map > connectedDataSize_; - -/** Ranks of connected receivers in case of reading. It is calculated in recvIndex(). */ - std::vector connectedServerRankRead_; - -/** Size of data to be send in case of reading. It is calculated in recvIndex(). */ - std::map connectedDataSizeRead_; - - //! True if and only if the data defined on the grid can be outputted in a compressed way - bool isCompressible_; - std::set relFilesCompressed; - - - std::vector axisPositionInGrid_; - void computeAxisPositionInGrid(void) ; - bool computeAxisPositionInGrid_done_ = false ; - std::vector& getAxisPositionInGrid(void) { if (!computeAxisPositionInGrid_done_) computeAxisPositionInGrid() ; return axisPositionInGrid_ ;} - - bool hasDomainAxisBaseRef_; - std::map > gridSrc_; - - ////////////////////////////////////////////////////////////////////////////////////// - // this part is related to distribution, element definition, views and connectors // - ////////////////////////////////////////////////////////////////////////////////////// - public: - CGrid* duplicateSentGrid(void) ; - private: - static void recvMask(CEventServer& event) ; - void receiveMask(CEventServer& event) ; - - private: - shared_ptr gridLocalElements_= nullptr ; - void computeGridLocalElements(void) ; - public: - shared_ptr getGridLocalElements(void) { if (gridLocalElements_==nullptr) computeGridLocalElements() ; return gridLocalElements_ ;} - - private: - shared_ptr modelToWorkflowConnector_ = nullptr ; - public: - void computeModelToWorkflowConnector(void) ; - shared_ptr getModelToWorkflowConnector(void) { if (modelToWorkflowConnector_==nullptr) computeModelToWorkflowConnector() ; return modelToWorkflowConnector_;} - - private: - shared_ptr workflowToModelConnector_ = nullptr; - public: - void computeWorkflowToModelConnector(void) ; - shared_ptr getWorkflowToModelConnector(void) { if (workflowToModelConnector_==nullptr) computeWorkflowToModelConnector() ; return workflowToModelConnector_;} - - public: //? - void distributeGridToServer(CContextClient* client, const string& fieldId=""); - - - private: - shared_ptr workflowToFullConnector_ = nullptr; - public: - void computeWorkflowToFullConnector(void) ; - shared_ptr getWorkflowToFullConnector(void) { if (workflowToFullConnector_==nullptr) computeWorkflowToFullConnector() ; return workflowToFullConnector_;} - - private: - shared_ptr fullToWorkflowConnector_ = nullptr; - public: - void computeFullToWorkflowConnector(void) ; - shared_ptr getFullToWorkflowConnector(void) { if (fullToWorkflowConnector_==nullptr) computeFullToWorkflowConnector() ; return fullToWorkflowConnector_;} - - - - private: - shared_ptr clientFromClientConnector_ = nullptr ; - public: - shared_ptr getClientFromClientConnector(void) { if (clientFromClientConnector_==nullptr) computeClientFromClientConnector() ; return clientFromClientConnector_;} - void computeClientFromClientConnector(void) ; - - private: - map> clientToClientConnector_ ; - public: - shared_ptr getClientToClientConnector(CContextClient* client) { return clientToClientConnector_[client] ;} // make some test to see if connector exits for the given client - - - private: - map> clientFromServerConnector_ ; - public: - shared_ptr getClientFromServerConnector(CContextClient* client) { return clientFromServerConnector_[client];} - void computeClientFromServerConnector(void) ; - - private: - shared_ptr serverToClientConnector_=nullptr ; - public: - shared_ptr getServerToClientConnector(void) { if (serverToClientConnector_==nullptr) computeServerToClientConnector() ; return serverToClientConnector_;} - void computeServerToClientConnector(void) ; - private: - map> clientToServerConnector_ ; - public: - shared_ptr getClientToServerConnector(CContextClient* client) { return clientToServerConnector_[client] ;} // make some test to see if connector exits for the given client - - private: - shared_ptr serverFromClientConnector_ = nullptr ; - public: - shared_ptr getServerFromClientConnector(void) { if (serverFromClientConnector_==nullptr) computeServerFromClientConnector() ; return serverFromClientConnector_;} - void computeServerFromClientConnector(void) ; - - }; // class CGrid - - // Declare/Define CGridGroup and CGridDefinition - DECLARE_GROUP(CGrid); - - ///-------------------------------------------------------------- - -} // namespace xios - -#endif // __XIOS_CGrid__ diff --git a/xios_2311_src/trunk/.svn/pristine/05/054f4feab019de8827c1b42a80621b7f706dbb8b.svn-base b/xios_2311_src/trunk/.svn/pristine/05/054f4feab019de8827c1b42a80621b7f706dbb8b.svn-base deleted file mode 100644 index 8d5c78498963a7add7f3056bfe64996e8a4e9354..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/05/054f4feab019de8827c1b42a80621b7f706dbb8b.svn-base +++ /dev/null @@ -1,8 +0,0 @@ -module purge -module load profile/advanced -module load bgq-xl/1.0 -module load netcdf/4.1.3_par--bgq-xl--1.0 -module load hdf5/1.8.9_par--bgq-xl--1.0 -module load szip/2.1--bgq-xl--1.0 -module load zlib/1.2.7--bgq-gnu--4.4.6 -module load mass diff --git a/xios_2311_src/trunk/.svn/pristine/05/055649da7635bb99931c00ef8ab48d1156669775.svn-base b/xios_2311_src/trunk/.svn/pristine/05/055649da7635bb99931c00ef8ab48d1156669775.svn-base deleted file mode 100644 index ca316cba67b9e6eed725123d8ca549253edf10b4..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/05/055649da7635bb99931c00ef8ab48d1156669775.svn-base +++ /dev/null @@ -1,110 +0,0 @@ -/********************************************************************* - * Copyright 1993, UCAR/Unidata - * See netcdf/COPYRIGHT file for copying and redistribution conditions. - * $Header: /upc/share/CVS/netcdf-3/libsrc4/nc4dispatch.c,v 1.5 2010/05/27 02:19:37 dmh Exp $ - *********************************************************************/ - -#include "config.h" -#include -#include "nc.h" -#include "ncdispatch.h" -#include "nc4dispatch.h" - -NC_Dispatch NC4_dispatcher = { - -NC_DISPATCH_NC4, - -NC4_new_nc, - -NC4_create, -NC4_open, - -NC4_redef, -NC4__enddef, -NC4_sync, -NC4_abort, -NC4_close, -NC4_set_fill, -NC4_inq_base_pe, -NC4_set_base_pe, -NC4_inq_format, - -NC4_inq, -NC4_inq_type, - -NC4_def_dim, -NC4_inq_dimid, -NC4_inq_dim, -NC4_inq_unlimdim, -NC4_rename_dim, - -NC4_inq_att, -NC4_inq_attid, -NC4_inq_attname, -NC4_rename_att, -NC4_del_att, -NC4_get_att, -NC4_put_att, - -NC4_def_var, -NC4_inq_varid, -NC4_rename_var, -NC4_get_vara, -NC4_put_vara, -NCDEFAULT_get_vars, -NCDEFAULT_put_vars, -NCDEFAULT_get_varm, -NCDEFAULT_put_varm, - -NC4_inq_var_all, - -NC4_show_metadata, -NC4_inq_unlimdims, - -NC4_var_par_access, - -NC4_inq_ncid, -NC4_inq_grps, -NC4_inq_grpname, -NC4_inq_grpname_full, -NC4_inq_grp_parent, -NC4_inq_grp_full_ncid, -NC4_inq_varids, -NC4_inq_dimids, -NC4_inq_typeids, -NC4_inq_type_equal, -NC4_def_grp, -NC4_inq_user_type, -NC4_inq_typeid, - -NC4_def_compound, -NC4_insert_compound, -NC4_insert_array_compound, -NC4_inq_compound_field, -NC4_inq_compound_fieldindex, -NC4_def_vlen, -NC4_put_vlen_element, -NC4_get_vlen_element, -NC4_def_enum, -NC4_insert_enum, -NC4_inq_enum_member, -NC4_inq_enum_ident, -NC4_def_opaque, -NC4_def_var_deflate, -NC4_def_var_fletcher32, -NC4_def_var_chunking, -NC4_def_var_fill, -NC4_def_var_endian, -NC4_set_var_chunk_cache, -NC4_get_var_chunk_cache, - -}; - -NC_Dispatch* NC4_dispatch_table = NULL; /* moved here from ddispatch.c */ - -int -NC4_initialize(void) -{ - NC4_dispatch_table = &NC4_dispatcher; - return NC_NOERR; -} diff --git a/xios_2311_src/trunk/.svn/pristine/05/05b75e37d5657ce2db2bf02d25f3da52192b7075.svn-base b/xios_2311_src/trunk/.svn/pristine/05/05b75e37d5657ce2db2bf02d25f3da52192b7075.svn-base deleted file mode 100644 index d63cbc971ceb11d6213de2906e498847453891a8..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/05/05b75e37d5657ce2db2bf02d25f3da52192b7075.svn-base +++ /dev/null @@ -1,192 +0,0 @@ -! * ************************************************************************** * -! * Interface auto generated - do not modify * -! * ************************************************************************** * -#include "../fortran/xios_fortran_prefix.hpp" - -MODULE interpolate_domain_interface_attr - USE, INTRINSIC :: ISO_C_BINDING - - INTERFACE - ! Do not call directly / interface FORTRAN 2003 <-> C99 - - SUBROUTINE cxios_set_interpolate_domain_detect_missing_value(interpolate_domain_hdl, detect_missing_value) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: interpolate_domain_hdl - LOGICAL (KIND=C_BOOL) , VALUE :: detect_missing_value - END SUBROUTINE cxios_set_interpolate_domain_detect_missing_value - - SUBROUTINE cxios_get_interpolate_domain_detect_missing_value(interpolate_domain_hdl, detect_missing_value) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: interpolate_domain_hdl - LOGICAL (KIND=C_BOOL) :: detect_missing_value - END SUBROUTINE cxios_get_interpolate_domain_detect_missing_value - - FUNCTION cxios_is_defined_interpolate_domain_detect_missing_value(interpolate_domain_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_interpolate_domain_detect_missing_value - INTEGER (kind = C_INTPTR_T), VALUE :: interpolate_domain_hdl - END FUNCTION cxios_is_defined_interpolate_domain_detect_missing_value - - - SUBROUTINE cxios_set_interpolate_domain_mode(interpolate_domain_hdl, mode, mode_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: interpolate_domain_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: mode - INTEGER (kind = C_INT) , VALUE :: mode_size - END SUBROUTINE cxios_set_interpolate_domain_mode - - SUBROUTINE cxios_get_interpolate_domain_mode(interpolate_domain_hdl, mode, mode_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: interpolate_domain_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: mode - INTEGER (kind = C_INT) , VALUE :: mode_size - END SUBROUTINE cxios_get_interpolate_domain_mode - - FUNCTION cxios_is_defined_interpolate_domain_mode(interpolate_domain_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_interpolate_domain_mode - INTEGER (kind = C_INTPTR_T), VALUE :: interpolate_domain_hdl - END FUNCTION cxios_is_defined_interpolate_domain_mode - - - SUBROUTINE cxios_set_interpolate_domain_order(interpolate_domain_hdl, order) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: interpolate_domain_hdl - INTEGER (KIND=C_INT) , VALUE :: order - END SUBROUTINE cxios_set_interpolate_domain_order - - SUBROUTINE cxios_get_interpolate_domain_order(interpolate_domain_hdl, order) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: interpolate_domain_hdl - INTEGER (KIND=C_INT) :: order - END SUBROUTINE cxios_get_interpolate_domain_order - - FUNCTION cxios_is_defined_interpolate_domain_order(interpolate_domain_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_interpolate_domain_order - INTEGER (kind = C_INTPTR_T), VALUE :: interpolate_domain_hdl - END FUNCTION cxios_is_defined_interpolate_domain_order - - - SUBROUTINE cxios_set_interpolate_domain_quantity(interpolate_domain_hdl, quantity) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: interpolate_domain_hdl - LOGICAL (KIND=C_BOOL) , VALUE :: quantity - END SUBROUTINE cxios_set_interpolate_domain_quantity - - SUBROUTINE cxios_get_interpolate_domain_quantity(interpolate_domain_hdl, quantity) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: interpolate_domain_hdl - LOGICAL (KIND=C_BOOL) :: quantity - END SUBROUTINE cxios_get_interpolate_domain_quantity - - FUNCTION cxios_is_defined_interpolate_domain_quantity(interpolate_domain_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_interpolate_domain_quantity - INTEGER (kind = C_INTPTR_T), VALUE :: interpolate_domain_hdl - END FUNCTION cxios_is_defined_interpolate_domain_quantity - - - SUBROUTINE cxios_set_interpolate_domain_read_write_convention(interpolate_domain_hdl, read_write_convention, read_write_conven& -&tion_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: interpolate_domain_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: read_write_convention - INTEGER (kind = C_INT) , VALUE :: read_write_convention_size - END SUBROUTINE cxios_set_interpolate_domain_read_write_convention - - SUBROUTINE cxios_get_interpolate_domain_read_write_convention(interpolate_domain_hdl, read_write_convention, read_write_conven& -&tion_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: interpolate_domain_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: read_write_convention - INTEGER (kind = C_INT) , VALUE :: read_write_convention_size - END SUBROUTINE cxios_get_interpolate_domain_read_write_convention - - FUNCTION cxios_is_defined_interpolate_domain_read_write_convention(interpolate_domain_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_interpolate_domain_read_write_convention - INTEGER (kind = C_INTPTR_T), VALUE :: interpolate_domain_hdl - END FUNCTION cxios_is_defined_interpolate_domain_read_write_convention - - - SUBROUTINE cxios_set_interpolate_domain_renormalize(interpolate_domain_hdl, renormalize) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: interpolate_domain_hdl - LOGICAL (KIND=C_BOOL) , VALUE :: renormalize - END SUBROUTINE cxios_set_interpolate_domain_renormalize - - SUBROUTINE cxios_get_interpolate_domain_renormalize(interpolate_domain_hdl, renormalize) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: interpolate_domain_hdl - LOGICAL (KIND=C_BOOL) :: renormalize - END SUBROUTINE cxios_get_interpolate_domain_renormalize - - FUNCTION cxios_is_defined_interpolate_domain_renormalize(interpolate_domain_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_interpolate_domain_renormalize - INTEGER (kind = C_INTPTR_T), VALUE :: interpolate_domain_hdl - END FUNCTION cxios_is_defined_interpolate_domain_renormalize - - - SUBROUTINE cxios_set_interpolate_domain_use_area(interpolate_domain_hdl, use_area) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: interpolate_domain_hdl - LOGICAL (KIND=C_BOOL) , VALUE :: use_area - END SUBROUTINE cxios_set_interpolate_domain_use_area - - SUBROUTINE cxios_get_interpolate_domain_use_area(interpolate_domain_hdl, use_area) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: interpolate_domain_hdl - LOGICAL (KIND=C_BOOL) :: use_area - END SUBROUTINE cxios_get_interpolate_domain_use_area - - FUNCTION cxios_is_defined_interpolate_domain_use_area(interpolate_domain_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_interpolate_domain_use_area - INTEGER (kind = C_INTPTR_T), VALUE :: interpolate_domain_hdl - END FUNCTION cxios_is_defined_interpolate_domain_use_area - - - SUBROUTINE cxios_set_interpolate_domain_weight_filename(interpolate_domain_hdl, weight_filename, weight_filename_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: interpolate_domain_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: weight_filename - INTEGER (kind = C_INT) , VALUE :: weight_filename_size - END SUBROUTINE cxios_set_interpolate_domain_weight_filename - - SUBROUTINE cxios_get_interpolate_domain_weight_filename(interpolate_domain_hdl, weight_filename, weight_filename_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: interpolate_domain_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: weight_filename - INTEGER (kind = C_INT) , VALUE :: weight_filename_size - END SUBROUTINE cxios_get_interpolate_domain_weight_filename - - FUNCTION cxios_is_defined_interpolate_domain_weight_filename(interpolate_domain_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_interpolate_domain_weight_filename - INTEGER (kind = C_INTPTR_T), VALUE :: interpolate_domain_hdl - END FUNCTION cxios_is_defined_interpolate_domain_weight_filename - - - SUBROUTINE cxios_set_interpolate_domain_write_weight(interpolate_domain_hdl, write_weight) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: interpolate_domain_hdl - LOGICAL (KIND=C_BOOL) , VALUE :: write_weight - END SUBROUTINE cxios_set_interpolate_domain_write_weight - - SUBROUTINE cxios_get_interpolate_domain_write_weight(interpolate_domain_hdl, write_weight) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: interpolate_domain_hdl - LOGICAL (KIND=C_BOOL) :: write_weight - END SUBROUTINE cxios_get_interpolate_domain_write_weight - - FUNCTION cxios_is_defined_interpolate_domain_write_weight(interpolate_domain_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_interpolate_domain_write_weight - INTEGER (kind = C_INTPTR_T), VALUE :: interpolate_domain_hdl - END FUNCTION cxios_is_defined_interpolate_domain_write_weight - - END INTERFACE - -END MODULE interpolate_domain_interface_attr diff --git a/xios_2311_src/trunk/.svn/pristine/05/05dd067413d84e0fd8caab1eedd0fdf1ade9f88c.svn-base b/xios_2311_src/trunk/.svn/pristine/05/05dd067413d84e0fd8caab1eedd0fdf1ade9f88c.svn-base deleted file mode 100644 index 5758589630574b7a5c23bf83e9bb52553d0398d7..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/05/05dd067413d84e0fd8caab1eedd0fdf1ade9f88c.svn-base +++ /dev/null @@ -1,297 +0,0 @@ -#ifndef __XIOS_CAxis__ -#define __XIOS_CAxis__ - -/// XIOS headers /// -#include "xios_spl.hpp" -#include "group_factory.hpp" -#include "virtual_node.hpp" - -#include "declare_group.hpp" -#include "declare_ref_func.hpp" -#include "declare_virtual_node.hpp" -#include "attribute_array.hpp" -#include "attribute_enum.hpp" -#include "attribute_enum_impl.hpp" -#include "server_distribution_description.hpp" -#include "transformation.hpp" -#include "transformation_enum.hpp" -#include "transformation_path.hpp" -#include "element.hpp" -#include "local_connector.hpp" -#include "scatterer_connector.hpp" -#include "gatherer_connector.hpp" -#include "distribution_type.hpp" -#include "generic_algorithm_transformation.hpp" -#include "grid_transformation_factory_impl.hpp" - - -namespace xios -{ - /// ////////////////////// Déclarations ////////////////////// /// - - class CAxisGroup; - class CAxisAttributes; - class CAxis; - class CField; - - ///-------------------------------------------------------------- - - // Declare/Define CAxisAttribute - BEGIN_DECLARE_ATTRIBUTE_MAP(CAxis) -# include "axis_attribute.conf" - END_DECLARE_ATTRIBUTE_MAP(CAxis) - - ///-------------------------------------------------------------- - - class CAxis - : public CObjectTemplate - , public CAxisAttributes - { - /// typedef /// - typedef CObjectTemplate SuperClass; - typedef CAxisAttributes SuperClassAttribute; - - public: - enum EEventId - { - EVENT_ID_AXIS_DISTRIBUTION, - EVENT_ID_SEND_DISTRIBUTED_ATTRIBUTE - } ; - - public: - typedef CAxisAttributes RelAttributes; - typedef CAxisGroup RelGroup; - - public: - /// Constructeurs /// - CAxis(void); - explicit CAxis(const StdString & id); - CAxis(const CAxis & axis); // Not implemented yet. - CAxis(const CAxis * const axis); // Not implemented yet. - static void releaseStaticAllocation(void) ; // release static allocation on heap - - static CAxis* createAxis(); - static CAxis* get(const string& id, bool noError=false) ; // & getRelFiles(void) const; - - std::map getAttributesBufferSize(CContextClient* client, const std::vector& globalDim, int orderPositionInGrid, - CServerDistributionDescription::ServerDistributionType disType = CServerDistributionDescription::BAND_DISTRIBUTION); - - /// Test /// - bool IsWritten(const StdString & filename) const; - bool isWrittenCompressed(const StdString& filename) const; - bool isDistributed(void) const; - - public: - /*! - \brief return if the axis can be written or not in a compressed way. - ie if there are some masked or indexed point on the domain. Valid only on server side. - \return true if domain can be writtedn in a compressed way - */ - bool isCompressible(void) { if (!isCompressibleComputed_) computeIsCompressible() ; return isCompressible_ ;} - private: - bool isCompressible_ ; /** specify if the domain can be written in a compressed way */ - bool isCompressibleComputed_=false ; /** Indicate if compressability has been computed*/ - void computeIsCompressible() ; - - public: - - /// Mutateur /// - void addRelFile(const StdString & filename); - void addRelFileCompressed(const StdString& filename); - - - - /// Destructeur /// - virtual ~CAxis(void); - - virtual void parse(xml::CXMLNode & node); - - void setContextClient(CContextClient* contextClient); - - /// Accesseurs statiques /// - static StdString GetName(void); - static StdString GetDefName(void); - static ENodeType GetType(void); - - static bool dispatchEvent(CEventServer& event); - - /// Vérifications /// - void checkAttributes(void); - bool checkAttributes_done_ = false ; - bool checkGeometricAttributes(bool generateError) ; - void setGeometricAttributes(const CAxis& axisSrc) ; - void resetGeometricAttributes(void) ; - - size_t getGlobalWrittenSize(void) ; - - ////////////////////////// - ///// transformations //// - ////////////////////////// - public: - typedef CTransformation::TransformationMapTypes TransMapTypes; - private: - static bool initializeTransformationMap(std::map& m); - static std::map transformationMapList_; - static bool dummyTransformationMapList_; - TransMapTypes transformationMap_; - - public: - CTransformation* addTransformation(ETranformationType transType, const StdString& id=""); - CTransformation* addTransformation(ETranformationType transType, CTransformation* transformation) ; - void setTransformations(const TransMapTypes&); - void duplicateTransformation(CAxis*); - TransMapTypes getAllTransformations(); - bool hasTransformation(); - void solveInheritanceTransformation_old(); // to remove later - void solveInheritanceTransformation(); - private: - bool solveInheritanceTransformation_done_= false ; - public: - bool activateFieldWorkflow(CGarbageCollector& gc) ; - private: - bool activateFieldWorkflow_done_=false ; - private: - shared_ptr transformationAlgorithm_ = nullptr ; - public: - void setTransformationAlgorithm(shared_ptr transformationAlgorithm) { transformationAlgorithm_=transformationAlgorithm ;} - shared_ptr getTransformationAlgorithm(void) { return transformationAlgorithm_ ;} - private: - CTransformationPaths transformationPaths_ ; - public: - CTransformationPaths getTransformationPaths(void) {return transformationPaths_;} - void setTransformationPaths(const CTransformationPaths& transformationPaths) { transformationPaths_=transformationPaths ;} - - //////////////////////////// - bool isEqual(CAxis* axis); - - public: - bool hasValue; - bool hasBounds; - bool hasLabel; - - private: - bool checkData(bool generateError); - bool checkMask(bool generateError); - bool checkBounds(bool generateError); - bool checkLabel(bool generateError); - - public: - void sendAxisToCouplerOut(CContextClient* client, const std::vector& globalDim, int orderPositionInGrid, const string& fieldId, int posInGrid) ; - private: - std::set sendAxisToCouplerOut_done_ ; - - public: - void makeAliasForCoupling(const string& fieldId, int posInGrid) ; - string getCouplingAlias(const string& fieldId, int posInGrid) ; - - private: - -/** Clients that have to send a axis. There can be multiple clients in case of secondary server, otherwise only one client. */ - std::list clients; - std::set clientsSet; - - private: - /** define if the axis is completed or not ie all attributes have been received before in case - of grid reading from file or coupling */ - bool isCompleted_=true ; - public: - /*! - \brief Check if a axis is completed - Before make any axis processing, we must be sure that all axis informations have - been sent, for exemple when reading a grid in a file or when grid elements are sent by an - other context (coupling). So all direct reference of the axis (axis_ref) must be also completed - \return true if axis and axis reference are completed - */ - bool isCompleted(void) - { - if (hasDirectAxisReference()) if (!getDirectAxisReference()->isCompleted()) return false; - else return isCompleted_ ; - - MISSING_RETURN( "bool CAxis::isCompleted() " ); - return true; - } - void setCompleted(void) { isCompleted_=true ; } - void unsetCompleted(void) { isCompleted_=false ; } - - private: - bool isChecked; - std::set relFiles, relFilesCompressed; - std::map > > indSrv_; // Global index of each client sent to server - std::map > connectedServerRank_; - - ////////////////////////////////////////////////////////////////////////////////////// - // this part is related to distribution, element definition, views and connectors // - ////////////////////////////////////////////////////////////////////////////////////// - - private: - shared_ptr localElement_ ; - void initializeLocalElement(void) ; - public: - shared_ptr getLocalElement(void) { if (localElement_==nullptr) initializeLocalElement() ; return localElement_ ; } - shared_ptr getLocalView(CElementView::type type) { return getLocalElement()->getView(type) ;} - private: - void addFullView(void) ; - void addWorkflowView(void) ; - void addModelView(void) ; - - private: - shared_ptr modelToWorkflowConnector_ ; - void computeModelToWorkflowConnector(void) ; - public: - shared_ptr getModelToWorkflowConnector(void) { if (modelToWorkflowConnector_==nullptr) computeModelToWorkflowConnector() ; return modelToWorkflowConnector_ ;} - - public: - void computeRemoteElement(CContextClient* client, EDistributionType) ; - void distributeToServer(CContextClient* client, std::map>& globalIndexOut, std::map>& globalIndexIn, - shared_ptr& scattererConnector, const string& axisId="") ; - - static void recvAxisDistribution(CEventServer& event) ; - void receivedAxisDistribution(CEventServer& event, int phasis) ; - void setServerMask(CArray& serverMask, CContextClient* client ) ; - void sendDistributedAttributes(CContextClient* client, shared_ptr scattererConnector, const string& axisId) ; - static void recvDistributedAttributes(CEventServer& event) ; - void recvDistributedAttributes(CEventServer& event, const string& type) ; - private: - map> remoteElement_ ; - public: - shared_ptr getRemoteElement(CContextClient* client) {return remoteElement_[client] ;} - private: - map> clientToServerConnector_ ; - public: - shared_ptr getClientToServerConnector(CContextClient* client) { return clientToServerConnector_[client] ;} - private: - shared_ptr gathererConnector_ ; - public: - shared_ptr getGathererConnector(void) { return gathererConnector_ ;} - private: - shared_ptr serverFromClientConnector_ ; - shared_ptr elementFrom_ ; - public: - shared_ptr getServerFromClientConnector(void) { return serverFromClientConnector_ ;} - - private: - shared_ptr serverToClientConnector_ = nullptr ; - shared_ptr elementTo_ ; - public: - shared_ptr getServerToClientConnector(void) { return serverToClientConnector_ ;} - - private: - map> clientFromServerConnector_ ; - public: - shared_ptr getClientFromServerConnector(CContextClient* client) { return clientFromServerConnector_[client] ;} - - DECLARE_REF_FUNC(Axis,axis) - }; // class CAxis - - ///-------------------------------------------------------------- - - // Declare/Define CAxisGroup and CAxisDefinition - DECLARE_GROUP(CAxis); -} // namespace xios - -#endif // __XIOS_CAxis__ diff --git a/xios_2311_src/trunk/.svn/pristine/05/05de388da9c1c09cf8f252895b39e7c5910c6007.svn-base b/xios_2311_src/trunk/.svn/pristine/05/05de388da9c1c09cf8f252895b39e7c5910c6007.svn-base deleted file mode 100644 index d3fa93eac19f946bdde2c8b27d54460a63deb7a5..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/05/05de388da9c1c09cf8f252895b39e7c5910c6007.svn-base +++ /dev/null @@ -1,50 +0,0 @@ -/*! - \file axis_algorithm_reduce_domain.hpp - \author Ha NGUYEN - \since 23 June 2016 - \date 23 June 2016 - - \brief Algorithm for reduce an axis to a axis - */ -#ifndef __XIOS_AXIS_ALGORITHM_TEMPORAL_SPLITTING_HPP__ -#define __XIOS_AXIS_ALGORITHM_TEMPORAL_SPLITTING_HPP__ - -#include "transformation.hpp" -#include "algorithm_transformation_no_data_modification.hpp" -namespace xios -{ - - class CAxis; - class CScalar; - class CTemporalSplitting; - - /*! - \class CAxisAlgorithmExtractDomain - Extract a domain to an axis - */ - class CAxisAlgorithmTemporalSplitting : public CAlgorithmTransformationNoDataModification - { - public: - CAxisAlgorithmTemporalSplitting(bool isSource, CAxis* axisDestination, CScalar* scalarSource, CTemporalSplitting* algo); - virtual ~CAxisAlgorithmTemporalSplitting(); - static bool registerTrans(); - virtual StdString getAlgoName() {return "\\ntemporal_splitting";} - - virtual CTransformFilter* createTransformFilter(CGarbageCollector& gc, shared_ptr algo, bool detectMissingValues, double defaultValue) ; - - static shared_ptr create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition); - private: - int nrecords_; - static bool dummyRegistered_; - }; - -} -#endif // __XIOS_AXIS_ALGORITHM_TEMPORAL_SPLITTING_HPP__ diff --git a/xios_2311_src/trunk/.svn/pristine/05/05f43d3c60ab2fba3374c2680620d7f967754230.svn-base b/xios_2311_src/trunk/.svn/pristine/05/05f43d3c60ab2fba3374c2680620d7f967754230.svn-base deleted file mode 100644 index 66929f0cce53338decebdfb798d36e501bdbd6b2..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/05/05f43d3c60ab2fba3374c2680620d7f967754230.svn-base +++ /dev/null @@ -1,129 +0,0 @@ -#ifndef __XIOS_CTransformation__ -#define __XIOS_CTransformation__ - -#include "xios_spl.hpp" -#include "xml_node.hpp" -#include "transformation_enum.hpp" -#include "exception.hpp" - -namespace xios { - - ///-------------------------------------------------------------- - /*! - \class CTransformation - This class describes inverse_axis in xml file. - */ - class CGenericAlgorithmTransformation; - class CGrid; - - template - class CTransformation - { - public: - typedef typename std::list* > > TransformationMapTypes; - typedef TransformationMapTypes TransMapTypes; - - public : - /// Constructeurs /// - CTransformation(void) {} - virtual void checkValid(T* dest) {} - - std::vector checkAuxInputs() { return checkAuxInputs_(); } - static CTransformation* createTransformation(ETranformationType transType, const StdString& id, xml::CXMLNode* node=0); - static CTransformation* getTransformation(ETranformationType transType, const StdString& id); - - virtual const string& getId(void) = 0 ; - virtual ETranformationType getTransformationType(void)=0; - virtual void inheritFrom(CTransformation* src) = 0 ; - - virtual const string& getId_(void) { ERROR("string Transformation::getId())",<< "unimplemented virtual function for child"); } ; - virtual const string& getName(void) { ERROR("string Transformation::getId())",<< "unimplemented virtual function for child"); } ; - virtual const string& getDefName(void) { ERROR("string Transformation::getId())",<< "unimplemented virtual function for child"); } ; - virtual shared_ptr createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) =0 ; - - /// Destructeur /// - public: - virtual ~CTransformation(void) {} - static void unregisterAllTransformations(); - protected: - typedef CTransformation* (*createTransformationCallBack)(const StdString&, xml::CXMLNode*); - typedef CTransformation* (*getIdTransformationCallBack)(const StdString&); - typedef std::map> callBackMap; - static callBackMap* callBacks_; - - static bool registerTransformation(ETranformationType transType, tuple callBackFunctions); - static bool unregisterTransformation(ETranformationType transType); - - - - protected: - virtual std::vector checkAuxInputs_() { return std::vector(); } - - }; // class CTransformation - - template - typename CTransformation::callBackMap* CTransformation::callBacks_ = 0; //CTransformation::CallBackMap(); - - template - CTransformation* CTransformation::createTransformation(ETranformationType transType, const StdString& id, xml::CXMLNode* node) - { - int transTypeInt = transType; - typename callBackMap::const_iterator it = (*callBacks_).find(transType); - if ((*callBacks_).end() == it) - { - ERROR("CTransformation::createTransformation(ETranformationType transType)", - << "Transformation type " << transType - << "doesn't exist. Please define."); - } - return (get<0>(it->second))(id,node); - } - - template - CTransformation* CTransformation::getTransformation(ETranformationType transType, const StdString& id) - { - int transTypeInt = transType; - typename callBackMap::const_iterator it = (*callBacks_).find(transType); - if ((*callBacks_).end() == it) - { - ERROR("CTransformation::getTransformation(ETranformationType transType, const StdString& id)", - << "Transformation type " << transType - << "doesn't exist. Please define."); - } - return (get<1>(it->second))(id); - } - - template - bool CTransformation::registerTransformation(ETranformationType transType, tuple functions) - { - if (0 == callBacks_) callBacks_ = new callBackMap(); - return (* callBacks_).insert(make_pair(transType, functions)).second; - } - - template - bool CTransformation::unregisterTransformation(ETranformationType transType) - { - int transTypeInt = transType; - return (1 == (*callBacks_).erase(transType)); - } - - template - void CTransformation::unregisterAllTransformations(void) - { - if (0 != callBacks_) - { - callBacks_->clear(); - delete callBacks_ ; - } - } - -} // namespace xios - -#endif // __XIOS_CTransformation__ diff --git a/xios_2311_src/trunk/.svn/pristine/06/061abb6e986921ee8584c2ea38500065d769cd96.svn-base b/xios_2311_src/trunk/.svn/pristine/06/061abb6e986921ee8584c2ea38500065d769cd96.svn-base deleted file mode 100644 index e7f73cfc3ef66674aade18ebf46dd669c838009e..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/06/061abb6e986921ee8584c2ea38500065d769cd96.svn-base +++ /dev/null @@ -1,1116 +0,0 @@ -! * ************************************************************************** * -! * Interface auto generated - do not modify * -! * ************************************************************************** * -#include "xios_fortran_prefix.hpp" - -MODULE ifield_attr - USE, INTRINSIC :: ISO_C_BINDING - USE ifield - USE field_interface_attr - -CONTAINS - - SUBROUTINE xios(set_field_attr) & - ( field_id, add_offset, axis_ref, cell_methods, cell_methods_mode, check_if_active, comment & - , compression_level, default_value, detect_missing_value, domain_ref, enabled, expr, field_ref & - , freq_offset, freq_op, grid_path, grid_ref, indexed_output, level, long_name, name, operation & - , prec, read_access, scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq, unit & - , valid_max, valid_min ) - - IMPLICIT NONE - TYPE(txios(field)) :: field_hdl - CHARACTER(LEN=*), INTENT(IN) ::field_id - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: add_offset - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: axis_ref - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: cell_methods - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: cell_methods_mode - LOGICAL , OPTIONAL, INTENT(IN) :: check_if_active - LOGICAL (KIND=C_BOOL) :: check_if_active_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: comment - INTEGER , OPTIONAL, INTENT(IN) :: compression_level - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: default_value - LOGICAL , OPTIONAL, INTENT(IN) :: detect_missing_value - LOGICAL (KIND=C_BOOL) :: detect_missing_value_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: domain_ref - LOGICAL , OPTIONAL, INTENT(IN) :: enabled - LOGICAL (KIND=C_BOOL) :: enabled_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: expr - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: field_ref - TYPE(txios(duration)) , OPTIONAL, INTENT(IN) :: freq_offset - TYPE(txios(duration)) , OPTIONAL, INTENT(IN) :: freq_op - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: grid_path - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: grid_ref - LOGICAL , OPTIONAL, INTENT(IN) :: indexed_output - LOGICAL (KIND=C_BOOL) :: indexed_output_tmp - INTEGER , OPTIONAL, INTENT(IN) :: level - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: long_name - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: operation - INTEGER , OPTIONAL, INTENT(IN) :: prec - LOGICAL , OPTIONAL, INTENT(IN) :: read_access - LOGICAL (KIND=C_BOOL) :: read_access_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: scalar_ref - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: scale_factor - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: standard_name - LOGICAL , OPTIONAL, INTENT(IN) :: ts_enabled - LOGICAL (KIND=C_BOOL) :: ts_enabled_tmp - TYPE(txios(duration)) , OPTIONAL, INTENT(IN) :: ts_split_freq - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: unit - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: valid_max - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: valid_min - - CALL xios(get_field_handle) & - (field_id,field_hdl) - CALL xios(set_field_attr_hdl_) & - ( field_hdl, add_offset, axis_ref, cell_methods, cell_methods_mode, check_if_active, comment & - , compression_level, default_value, detect_missing_value, domain_ref, enabled, expr, field_ref & - , freq_offset, freq_op, grid_path, grid_ref, indexed_output, level, long_name, name, operation & - , prec, read_access, scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq, unit & - , valid_max, valid_min ) - - END SUBROUTINE xios(set_field_attr) - - SUBROUTINE xios(set_field_attr_hdl) & - ( field_hdl, add_offset, axis_ref, cell_methods, cell_methods_mode, check_if_active, comment & - , compression_level, default_value, detect_missing_value, domain_ref, enabled, expr, field_ref & - , freq_offset, freq_op, grid_path, grid_ref, indexed_output, level, long_name, name, operation & - , prec, read_access, scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq, unit & - , valid_max, valid_min ) - - IMPLICIT NONE - TYPE(txios(field)) , INTENT(IN) :: field_hdl - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: add_offset - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: axis_ref - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: cell_methods - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: cell_methods_mode - LOGICAL , OPTIONAL, INTENT(IN) :: check_if_active - LOGICAL (KIND=C_BOOL) :: check_if_active_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: comment - INTEGER , OPTIONAL, INTENT(IN) :: compression_level - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: default_value - LOGICAL , OPTIONAL, INTENT(IN) :: detect_missing_value - LOGICAL (KIND=C_BOOL) :: detect_missing_value_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: domain_ref - LOGICAL , OPTIONAL, INTENT(IN) :: enabled - LOGICAL (KIND=C_BOOL) :: enabled_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: expr - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: field_ref - TYPE(txios(duration)) , OPTIONAL, INTENT(IN) :: freq_offset - TYPE(txios(duration)) , OPTIONAL, INTENT(IN) :: freq_op - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: grid_path - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: grid_ref - LOGICAL , OPTIONAL, INTENT(IN) :: indexed_output - LOGICAL (KIND=C_BOOL) :: indexed_output_tmp - INTEGER , OPTIONAL, INTENT(IN) :: level - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: long_name - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: operation - INTEGER , OPTIONAL, INTENT(IN) :: prec - LOGICAL , OPTIONAL, INTENT(IN) :: read_access - LOGICAL (KIND=C_BOOL) :: read_access_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: scalar_ref - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: scale_factor - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: standard_name - LOGICAL , OPTIONAL, INTENT(IN) :: ts_enabled - LOGICAL (KIND=C_BOOL) :: ts_enabled_tmp - TYPE(txios(duration)) , OPTIONAL, INTENT(IN) :: ts_split_freq - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: unit - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: valid_max - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: valid_min - - CALL xios(set_field_attr_hdl_) & - ( field_hdl, add_offset, axis_ref, cell_methods, cell_methods_mode, check_if_active, comment & - , compression_level, default_value, detect_missing_value, domain_ref, enabled, expr, field_ref & - , freq_offset, freq_op, grid_path, grid_ref, indexed_output, level, long_name, name, operation & - , prec, read_access, scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq, unit & - , valid_max, valid_min ) - - END SUBROUTINE xios(set_field_attr_hdl) - - SUBROUTINE xios(set_field_attr_hdl_) & - ( field_hdl, add_offset_, axis_ref_, cell_methods_, cell_methods_mode_, check_if_active_, comment_ & - , compression_level_, default_value_, detect_missing_value_, domain_ref_, enabled_, expr_, field_ref_ & - , freq_offset_, freq_op_, grid_path_, grid_ref_, indexed_output_, level_, long_name_, name_ & - , operation_, prec_, read_access_, scalar_ref_, scale_factor_, standard_name_, ts_enabled_, ts_split_freq_ & - , unit_, valid_max_, valid_min_ ) - - IMPLICIT NONE - TYPE(txios(field)) , INTENT(IN) :: field_hdl - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: add_offset_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: axis_ref_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: cell_methods_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: cell_methods_mode_ - LOGICAL , OPTIONAL, INTENT(IN) :: check_if_active_ - LOGICAL (KIND=C_BOOL) :: check_if_active__tmp - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: comment_ - INTEGER , OPTIONAL, INTENT(IN) :: compression_level_ - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: default_value_ - LOGICAL , OPTIONAL, INTENT(IN) :: detect_missing_value_ - LOGICAL (KIND=C_BOOL) :: detect_missing_value__tmp - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: domain_ref_ - LOGICAL , OPTIONAL, INTENT(IN) :: enabled_ - LOGICAL (KIND=C_BOOL) :: enabled__tmp - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: expr_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: field_ref_ - TYPE(txios(duration)) , OPTIONAL, INTENT(IN) :: freq_offset_ - TYPE(txios(duration)) , OPTIONAL, INTENT(IN) :: freq_op_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: grid_path_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: grid_ref_ - LOGICAL , OPTIONAL, INTENT(IN) :: indexed_output_ - LOGICAL (KIND=C_BOOL) :: indexed_output__tmp - INTEGER , OPTIONAL, INTENT(IN) :: level_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: long_name_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: operation_ - INTEGER , OPTIONAL, INTENT(IN) :: prec_ - LOGICAL , OPTIONAL, INTENT(IN) :: read_access_ - LOGICAL (KIND=C_BOOL) :: read_access__tmp - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: scalar_ref_ - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: scale_factor_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: standard_name_ - LOGICAL , OPTIONAL, INTENT(IN) :: ts_enabled_ - LOGICAL (KIND=C_BOOL) :: ts_enabled__tmp - TYPE(txios(duration)) , OPTIONAL, INTENT(IN) :: ts_split_freq_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: unit_ - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: valid_max_ - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: valid_min_ - - IF (PRESENT(add_offset_)) THEN - CALL cxios_set_field_add_offset & - (field_hdl%daddr, add_offset_) - ENDIF - - IF (PRESENT(axis_ref_)) THEN - CALL cxios_set_field_axis_ref & - (field_hdl%daddr, axis_ref_, len(axis_ref_)) - ENDIF - - IF (PRESENT(cell_methods_)) THEN - CALL cxios_set_field_cell_methods & - (field_hdl%daddr, cell_methods_, len(cell_methods_)) - ENDIF - - IF (PRESENT(cell_methods_mode_)) THEN - CALL cxios_set_field_cell_methods_mode & - (field_hdl%daddr, cell_methods_mode_, len(cell_methods_mode_)) - ENDIF - - IF (PRESENT(check_if_active_)) THEN - check_if_active__tmp = check_if_active_ - CALL cxios_set_field_check_if_active & - (field_hdl%daddr, check_if_active__tmp) - ENDIF - - IF (PRESENT(comment_)) THEN - CALL cxios_set_field_comment & - (field_hdl%daddr, comment_, len(comment_)) - ENDIF - - IF (PRESENT(compression_level_)) THEN - CALL cxios_set_field_compression_level & - (field_hdl%daddr, compression_level_) - ENDIF - - IF (PRESENT(default_value_)) THEN - CALL cxios_set_field_default_value & - (field_hdl%daddr, default_value_) - ENDIF - - IF (PRESENT(detect_missing_value_)) THEN - detect_missing_value__tmp = detect_missing_value_ - CALL cxios_set_field_detect_missing_value & - (field_hdl%daddr, detect_missing_value__tmp) - ENDIF - - IF (PRESENT(domain_ref_)) THEN - CALL cxios_set_field_domain_ref & - (field_hdl%daddr, domain_ref_, len(domain_ref_)) - ENDIF - - IF (PRESENT(enabled_)) THEN - enabled__tmp = enabled_ - CALL cxios_set_field_enabled & - (field_hdl%daddr, enabled__tmp) - ENDIF - - IF (PRESENT(expr_)) THEN - CALL cxios_set_field_expr & - (field_hdl%daddr, expr_, len(expr_)) - ENDIF - - IF (PRESENT(field_ref_)) THEN - CALL cxios_set_field_field_ref & - (field_hdl%daddr, field_ref_, len(field_ref_)) - ENDIF - - IF (PRESENT(freq_offset_)) THEN - CALL cxios_set_field_freq_offset & - (field_hdl%daddr, freq_offset_) - ENDIF - - IF (PRESENT(freq_op_)) THEN - CALL cxios_set_field_freq_op & - (field_hdl%daddr, freq_op_) - ENDIF - - IF (PRESENT(grid_path_)) THEN - CALL cxios_set_field_grid_path & - (field_hdl%daddr, grid_path_, len(grid_path_)) - ENDIF - - IF (PRESENT(grid_ref_)) THEN - CALL cxios_set_field_grid_ref & - (field_hdl%daddr, grid_ref_, len(grid_ref_)) - ENDIF - - IF (PRESENT(indexed_output_)) THEN - indexed_output__tmp = indexed_output_ - CALL cxios_set_field_indexed_output & - (field_hdl%daddr, indexed_output__tmp) - ENDIF - - IF (PRESENT(level_)) THEN - CALL cxios_set_field_level & - (field_hdl%daddr, level_) - ENDIF - - IF (PRESENT(long_name_)) THEN - CALL cxios_set_field_long_name & - (field_hdl%daddr, long_name_, len(long_name_)) - ENDIF - - IF (PRESENT(name_)) THEN - CALL cxios_set_field_name & - (field_hdl%daddr, name_, len(name_)) - ENDIF - - IF (PRESENT(operation_)) THEN - CALL cxios_set_field_operation & - (field_hdl%daddr, operation_, len(operation_)) - ENDIF - - IF (PRESENT(prec_)) THEN - CALL cxios_set_field_prec & - (field_hdl%daddr, prec_) - ENDIF - - IF (PRESENT(read_access_)) THEN - read_access__tmp = read_access_ - CALL cxios_set_field_read_access & - (field_hdl%daddr, read_access__tmp) - ENDIF - - IF (PRESENT(scalar_ref_)) THEN - CALL cxios_set_field_scalar_ref & - (field_hdl%daddr, scalar_ref_, len(scalar_ref_)) - ENDIF - - IF (PRESENT(scale_factor_)) THEN - CALL cxios_set_field_scale_factor & - (field_hdl%daddr, scale_factor_) - ENDIF - - IF (PRESENT(standard_name_)) THEN - CALL cxios_set_field_standard_name & - (field_hdl%daddr, standard_name_, len(standard_name_)) - ENDIF - - IF (PRESENT(ts_enabled_)) THEN - ts_enabled__tmp = ts_enabled_ - CALL cxios_set_field_ts_enabled & - (field_hdl%daddr, ts_enabled__tmp) - ENDIF - - IF (PRESENT(ts_split_freq_)) THEN - CALL cxios_set_field_ts_split_freq & - (field_hdl%daddr, ts_split_freq_) - ENDIF - - IF (PRESENT(unit_)) THEN - CALL cxios_set_field_unit & - (field_hdl%daddr, unit_, len(unit_)) - ENDIF - - IF (PRESENT(valid_max_)) THEN - CALL cxios_set_field_valid_max & - (field_hdl%daddr, valid_max_) - ENDIF - - IF (PRESENT(valid_min_)) THEN - CALL cxios_set_field_valid_min & - (field_hdl%daddr, valid_min_) - ENDIF - - END SUBROUTINE xios(set_field_attr_hdl_) - - SUBROUTINE xios(get_field_attr) & - ( field_id, add_offset, axis_ref, cell_methods, cell_methods_mode, check_if_active, comment & - , compression_level, default_value, detect_missing_value, domain_ref, enabled, expr, field_ref & - , freq_offset, freq_op, grid_path, grid_ref, indexed_output, level, long_name, name, operation & - , prec, read_access, scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq, unit & - , valid_max, valid_min ) - - IMPLICIT NONE - TYPE(txios(field)) :: field_hdl - CHARACTER(LEN=*), INTENT(IN) ::field_id - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: add_offset - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: axis_ref - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: cell_methods - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: cell_methods_mode - LOGICAL , OPTIONAL, INTENT(OUT) :: check_if_active - LOGICAL (KIND=C_BOOL) :: check_if_active_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: comment - INTEGER , OPTIONAL, INTENT(OUT) :: compression_level - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: default_value - LOGICAL , OPTIONAL, INTENT(OUT) :: detect_missing_value - LOGICAL (KIND=C_BOOL) :: detect_missing_value_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: domain_ref - LOGICAL , OPTIONAL, INTENT(OUT) :: enabled - LOGICAL (KIND=C_BOOL) :: enabled_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: expr - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: field_ref - TYPE(txios(duration)) , OPTIONAL, INTENT(OUT) :: freq_offset - TYPE(txios(duration)) , OPTIONAL, INTENT(OUT) :: freq_op - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: grid_path - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: grid_ref - LOGICAL , OPTIONAL, INTENT(OUT) :: indexed_output - LOGICAL (KIND=C_BOOL) :: indexed_output_tmp - INTEGER , OPTIONAL, INTENT(OUT) :: level - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: long_name - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: operation - INTEGER , OPTIONAL, INTENT(OUT) :: prec - LOGICAL , OPTIONAL, INTENT(OUT) :: read_access - LOGICAL (KIND=C_BOOL) :: read_access_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: scalar_ref - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: scale_factor - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: standard_name - LOGICAL , OPTIONAL, INTENT(OUT) :: ts_enabled - LOGICAL (KIND=C_BOOL) :: ts_enabled_tmp - TYPE(txios(duration)) , OPTIONAL, INTENT(OUT) :: ts_split_freq - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: unit - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: valid_max - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: valid_min - - CALL xios(get_field_handle) & - (field_id,field_hdl) - CALL xios(get_field_attr_hdl_) & - ( field_hdl, add_offset, axis_ref, cell_methods, cell_methods_mode, check_if_active, comment & - , compression_level, default_value, detect_missing_value, domain_ref, enabled, expr, field_ref & - , freq_offset, freq_op, grid_path, grid_ref, indexed_output, level, long_name, name, operation & - , prec, read_access, scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq, unit & - , valid_max, valid_min ) - - END SUBROUTINE xios(get_field_attr) - - SUBROUTINE xios(get_field_attr_hdl) & - ( field_hdl, add_offset, axis_ref, cell_methods, cell_methods_mode, check_if_active, comment & - , compression_level, default_value, detect_missing_value, domain_ref, enabled, expr, field_ref & - , freq_offset, freq_op, grid_path, grid_ref, indexed_output, level, long_name, name, operation & - , prec, read_access, scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq, unit & - , valid_max, valid_min ) - - IMPLICIT NONE - TYPE(txios(field)) , INTENT(IN) :: field_hdl - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: add_offset - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: axis_ref - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: cell_methods - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: cell_methods_mode - LOGICAL , OPTIONAL, INTENT(OUT) :: check_if_active - LOGICAL (KIND=C_BOOL) :: check_if_active_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: comment - INTEGER , OPTIONAL, INTENT(OUT) :: compression_level - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: default_value - LOGICAL , OPTIONAL, INTENT(OUT) :: detect_missing_value - LOGICAL (KIND=C_BOOL) :: detect_missing_value_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: domain_ref - LOGICAL , OPTIONAL, INTENT(OUT) :: enabled - LOGICAL (KIND=C_BOOL) :: enabled_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: expr - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: field_ref - TYPE(txios(duration)) , OPTIONAL, INTENT(OUT) :: freq_offset - TYPE(txios(duration)) , OPTIONAL, INTENT(OUT) :: freq_op - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: grid_path - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: grid_ref - LOGICAL , OPTIONAL, INTENT(OUT) :: indexed_output - LOGICAL (KIND=C_BOOL) :: indexed_output_tmp - INTEGER , OPTIONAL, INTENT(OUT) :: level - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: long_name - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: operation - INTEGER , OPTIONAL, INTENT(OUT) :: prec - LOGICAL , OPTIONAL, INTENT(OUT) :: read_access - LOGICAL (KIND=C_BOOL) :: read_access_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: scalar_ref - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: scale_factor - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: standard_name - LOGICAL , OPTIONAL, INTENT(OUT) :: ts_enabled - LOGICAL (KIND=C_BOOL) :: ts_enabled_tmp - TYPE(txios(duration)) , OPTIONAL, INTENT(OUT) :: ts_split_freq - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: unit - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: valid_max - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: valid_min - - CALL xios(get_field_attr_hdl_) & - ( field_hdl, add_offset, axis_ref, cell_methods, cell_methods_mode, check_if_active, comment & - , compression_level, default_value, detect_missing_value, domain_ref, enabled, expr, field_ref & - , freq_offset, freq_op, grid_path, grid_ref, indexed_output, level, long_name, name, operation & - , prec, read_access, scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq, unit & - , valid_max, valid_min ) - - END SUBROUTINE xios(get_field_attr_hdl) - - SUBROUTINE xios(get_field_attr_hdl_) & - ( field_hdl, add_offset_, axis_ref_, cell_methods_, cell_methods_mode_, check_if_active_, comment_ & - , compression_level_, default_value_, detect_missing_value_, domain_ref_, enabled_, expr_, field_ref_ & - , freq_offset_, freq_op_, grid_path_, grid_ref_, indexed_output_, level_, long_name_, name_ & - , operation_, prec_, read_access_, scalar_ref_, scale_factor_, standard_name_, ts_enabled_, ts_split_freq_ & - , unit_, valid_max_, valid_min_ ) - - IMPLICIT NONE - TYPE(txios(field)) , INTENT(IN) :: field_hdl - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: add_offset_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: axis_ref_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: cell_methods_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: cell_methods_mode_ - LOGICAL , OPTIONAL, INTENT(OUT) :: check_if_active_ - LOGICAL (KIND=C_BOOL) :: check_if_active__tmp - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: comment_ - INTEGER , OPTIONAL, INTENT(OUT) :: compression_level_ - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: default_value_ - LOGICAL , OPTIONAL, INTENT(OUT) :: detect_missing_value_ - LOGICAL (KIND=C_BOOL) :: detect_missing_value__tmp - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: domain_ref_ - LOGICAL , OPTIONAL, INTENT(OUT) :: enabled_ - LOGICAL (KIND=C_BOOL) :: enabled__tmp - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: expr_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: field_ref_ - TYPE(txios(duration)) , OPTIONAL, INTENT(OUT) :: freq_offset_ - TYPE(txios(duration)) , OPTIONAL, INTENT(OUT) :: freq_op_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: grid_path_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: grid_ref_ - LOGICAL , OPTIONAL, INTENT(OUT) :: indexed_output_ - LOGICAL (KIND=C_BOOL) :: indexed_output__tmp - INTEGER , OPTIONAL, INTENT(OUT) :: level_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: long_name_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: operation_ - INTEGER , OPTIONAL, INTENT(OUT) :: prec_ - LOGICAL , OPTIONAL, INTENT(OUT) :: read_access_ - LOGICAL (KIND=C_BOOL) :: read_access__tmp - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: scalar_ref_ - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: scale_factor_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: standard_name_ - LOGICAL , OPTIONAL, INTENT(OUT) :: ts_enabled_ - LOGICAL (KIND=C_BOOL) :: ts_enabled__tmp - TYPE(txios(duration)) , OPTIONAL, INTENT(OUT) :: ts_split_freq_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: unit_ - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: valid_max_ - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: valid_min_ - - IF (PRESENT(add_offset_)) THEN - CALL cxios_get_field_add_offset & - (field_hdl%daddr, add_offset_) - ENDIF - - IF (PRESENT(axis_ref_)) THEN - CALL cxios_get_field_axis_ref & - (field_hdl%daddr, axis_ref_, len(axis_ref_)) - ENDIF - - IF (PRESENT(cell_methods_)) THEN - CALL cxios_get_field_cell_methods & - (field_hdl%daddr, cell_methods_, len(cell_methods_)) - ENDIF - - IF (PRESENT(cell_methods_mode_)) THEN - CALL cxios_get_field_cell_methods_mode & - (field_hdl%daddr, cell_methods_mode_, len(cell_methods_mode_)) - ENDIF - - IF (PRESENT(check_if_active_)) THEN - CALL cxios_get_field_check_if_active & - (field_hdl%daddr, check_if_active__tmp) - check_if_active_ = check_if_active__tmp - ENDIF - - IF (PRESENT(comment_)) THEN - CALL cxios_get_field_comment & - (field_hdl%daddr, comment_, len(comment_)) - ENDIF - - IF (PRESENT(compression_level_)) THEN - CALL cxios_get_field_compression_level & - (field_hdl%daddr, compression_level_) - ENDIF - - IF (PRESENT(default_value_)) THEN - CALL cxios_get_field_default_value & - (field_hdl%daddr, default_value_) - ENDIF - - IF (PRESENT(detect_missing_value_)) THEN - CALL cxios_get_field_detect_missing_value & - (field_hdl%daddr, detect_missing_value__tmp) - detect_missing_value_ = detect_missing_value__tmp - ENDIF - - IF (PRESENT(domain_ref_)) THEN - CALL cxios_get_field_domain_ref & - (field_hdl%daddr, domain_ref_, len(domain_ref_)) - ENDIF - - IF (PRESENT(enabled_)) THEN - CALL cxios_get_field_enabled & - (field_hdl%daddr, enabled__tmp) - enabled_ = enabled__tmp - ENDIF - - IF (PRESENT(expr_)) THEN - CALL cxios_get_field_expr & - (field_hdl%daddr, expr_, len(expr_)) - ENDIF - - IF (PRESENT(field_ref_)) THEN - CALL cxios_get_field_field_ref & - (field_hdl%daddr, field_ref_, len(field_ref_)) - ENDIF - - IF (PRESENT(freq_offset_)) THEN - CALL cxios_get_field_freq_offset & - (field_hdl%daddr, freq_offset_) - ENDIF - - IF (PRESENT(freq_op_)) THEN - CALL cxios_get_field_freq_op & - (field_hdl%daddr, freq_op_) - ENDIF - - IF (PRESENT(grid_path_)) THEN - CALL cxios_get_field_grid_path & - (field_hdl%daddr, grid_path_, len(grid_path_)) - ENDIF - - IF (PRESENT(grid_ref_)) THEN - CALL cxios_get_field_grid_ref & - (field_hdl%daddr, grid_ref_, len(grid_ref_)) - ENDIF - - IF (PRESENT(indexed_output_)) THEN - CALL cxios_get_field_indexed_output & - (field_hdl%daddr, indexed_output__tmp) - indexed_output_ = indexed_output__tmp - ENDIF - - IF (PRESENT(level_)) THEN - CALL cxios_get_field_level & - (field_hdl%daddr, level_) - ENDIF - - IF (PRESENT(long_name_)) THEN - CALL cxios_get_field_long_name & - (field_hdl%daddr, long_name_, len(long_name_)) - ENDIF - - IF (PRESENT(name_)) THEN - CALL cxios_get_field_name & - (field_hdl%daddr, name_, len(name_)) - ENDIF - - IF (PRESENT(operation_)) THEN - CALL cxios_get_field_operation & - (field_hdl%daddr, operation_, len(operation_)) - ENDIF - - IF (PRESENT(prec_)) THEN - CALL cxios_get_field_prec & - (field_hdl%daddr, prec_) - ENDIF - - IF (PRESENT(read_access_)) THEN - CALL cxios_get_field_read_access & - (field_hdl%daddr, read_access__tmp) - read_access_ = read_access__tmp - ENDIF - - IF (PRESENT(scalar_ref_)) THEN - CALL cxios_get_field_scalar_ref & - (field_hdl%daddr, scalar_ref_, len(scalar_ref_)) - ENDIF - - IF (PRESENT(scale_factor_)) THEN - CALL cxios_get_field_scale_factor & - (field_hdl%daddr, scale_factor_) - ENDIF - - IF (PRESENT(standard_name_)) THEN - CALL cxios_get_field_standard_name & - (field_hdl%daddr, standard_name_, len(standard_name_)) - ENDIF - - IF (PRESENT(ts_enabled_)) THEN - CALL cxios_get_field_ts_enabled & - (field_hdl%daddr, ts_enabled__tmp) - ts_enabled_ = ts_enabled__tmp - ENDIF - - IF (PRESENT(ts_split_freq_)) THEN - CALL cxios_get_field_ts_split_freq & - (field_hdl%daddr, ts_split_freq_) - ENDIF - - IF (PRESENT(unit_)) THEN - CALL cxios_get_field_unit & - (field_hdl%daddr, unit_, len(unit_)) - ENDIF - - IF (PRESENT(valid_max_)) THEN - CALL cxios_get_field_valid_max & - (field_hdl%daddr, valid_max_) - ENDIF - - IF (PRESENT(valid_min_)) THEN - CALL cxios_get_field_valid_min & - (field_hdl%daddr, valid_min_) - ENDIF - - END SUBROUTINE xios(get_field_attr_hdl_) - - SUBROUTINE xios(is_defined_field_attr) & - ( field_id, add_offset, axis_ref, cell_methods, cell_methods_mode, check_if_active, comment & - , compression_level, default_value, detect_missing_value, domain_ref, enabled, expr, field_ref & - , freq_offset, freq_op, grid_path, grid_ref, indexed_output, level, long_name, name, operation & - , prec, read_access, scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq, unit & - , valid_max, valid_min ) - - IMPLICIT NONE - TYPE(txios(field)) :: field_hdl - CHARACTER(LEN=*), INTENT(IN) ::field_id - LOGICAL, OPTIONAL, INTENT(OUT) :: add_offset - LOGICAL(KIND=C_BOOL) :: add_offset_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: axis_ref - LOGICAL(KIND=C_BOOL) :: axis_ref_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: cell_methods - LOGICAL(KIND=C_BOOL) :: cell_methods_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: cell_methods_mode - LOGICAL(KIND=C_BOOL) :: cell_methods_mode_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: check_if_active - LOGICAL(KIND=C_BOOL) :: check_if_active_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: comment - LOGICAL(KIND=C_BOOL) :: comment_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: compression_level - LOGICAL(KIND=C_BOOL) :: compression_level_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: default_value - LOGICAL(KIND=C_BOOL) :: default_value_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: detect_missing_value - LOGICAL(KIND=C_BOOL) :: detect_missing_value_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: domain_ref - LOGICAL(KIND=C_BOOL) :: domain_ref_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: enabled - LOGICAL(KIND=C_BOOL) :: enabled_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: expr - LOGICAL(KIND=C_BOOL) :: expr_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: field_ref - LOGICAL(KIND=C_BOOL) :: field_ref_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: freq_offset - LOGICAL(KIND=C_BOOL) :: freq_offset_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: freq_op - LOGICAL(KIND=C_BOOL) :: freq_op_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: grid_path - LOGICAL(KIND=C_BOOL) :: grid_path_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: grid_ref - LOGICAL(KIND=C_BOOL) :: grid_ref_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: indexed_output - LOGICAL(KIND=C_BOOL) :: indexed_output_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: level - LOGICAL(KIND=C_BOOL) :: level_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: long_name - LOGICAL(KIND=C_BOOL) :: long_name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: name - LOGICAL(KIND=C_BOOL) :: name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: operation - LOGICAL(KIND=C_BOOL) :: operation_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: prec - LOGICAL(KIND=C_BOOL) :: prec_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: read_access - LOGICAL(KIND=C_BOOL) :: read_access_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: scalar_ref - LOGICAL(KIND=C_BOOL) :: scalar_ref_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: scale_factor - LOGICAL(KIND=C_BOOL) :: scale_factor_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: standard_name - LOGICAL(KIND=C_BOOL) :: standard_name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: ts_enabled - LOGICAL(KIND=C_BOOL) :: ts_enabled_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: ts_split_freq - LOGICAL(KIND=C_BOOL) :: ts_split_freq_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: unit - LOGICAL(KIND=C_BOOL) :: unit_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: valid_max - LOGICAL(KIND=C_BOOL) :: valid_max_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: valid_min - LOGICAL(KIND=C_BOOL) :: valid_min_tmp - - CALL xios(get_field_handle) & - (field_id,field_hdl) - CALL xios(is_defined_field_attr_hdl_) & - ( field_hdl, add_offset, axis_ref, cell_methods, cell_methods_mode, check_if_active, comment & - , compression_level, default_value, detect_missing_value, domain_ref, enabled, expr, field_ref & - , freq_offset, freq_op, grid_path, grid_ref, indexed_output, level, long_name, name, operation & - , prec, read_access, scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq, unit & - , valid_max, valid_min ) - - END SUBROUTINE xios(is_defined_field_attr) - - SUBROUTINE xios(is_defined_field_attr_hdl) & - ( field_hdl, add_offset, axis_ref, cell_methods, cell_methods_mode, check_if_active, comment & - , compression_level, default_value, detect_missing_value, domain_ref, enabled, expr, field_ref & - , freq_offset, freq_op, grid_path, grid_ref, indexed_output, level, long_name, name, operation & - , prec, read_access, scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq, unit & - , valid_max, valid_min ) - - IMPLICIT NONE - TYPE(txios(field)) , INTENT(IN) :: field_hdl - LOGICAL, OPTIONAL, INTENT(OUT) :: add_offset - LOGICAL(KIND=C_BOOL) :: add_offset_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: axis_ref - LOGICAL(KIND=C_BOOL) :: axis_ref_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: cell_methods - LOGICAL(KIND=C_BOOL) :: cell_methods_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: cell_methods_mode - LOGICAL(KIND=C_BOOL) :: cell_methods_mode_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: check_if_active - LOGICAL(KIND=C_BOOL) :: check_if_active_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: comment - LOGICAL(KIND=C_BOOL) :: comment_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: compression_level - LOGICAL(KIND=C_BOOL) :: compression_level_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: default_value - LOGICAL(KIND=C_BOOL) :: default_value_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: detect_missing_value - LOGICAL(KIND=C_BOOL) :: detect_missing_value_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: domain_ref - LOGICAL(KIND=C_BOOL) :: domain_ref_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: enabled - LOGICAL(KIND=C_BOOL) :: enabled_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: expr - LOGICAL(KIND=C_BOOL) :: expr_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: field_ref - LOGICAL(KIND=C_BOOL) :: field_ref_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: freq_offset - LOGICAL(KIND=C_BOOL) :: freq_offset_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: freq_op - LOGICAL(KIND=C_BOOL) :: freq_op_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: grid_path - LOGICAL(KIND=C_BOOL) :: grid_path_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: grid_ref - LOGICAL(KIND=C_BOOL) :: grid_ref_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: indexed_output - LOGICAL(KIND=C_BOOL) :: indexed_output_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: level - LOGICAL(KIND=C_BOOL) :: level_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: long_name - LOGICAL(KIND=C_BOOL) :: long_name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: name - LOGICAL(KIND=C_BOOL) :: name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: operation - LOGICAL(KIND=C_BOOL) :: operation_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: prec - LOGICAL(KIND=C_BOOL) :: prec_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: read_access - LOGICAL(KIND=C_BOOL) :: read_access_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: scalar_ref - LOGICAL(KIND=C_BOOL) :: scalar_ref_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: scale_factor - LOGICAL(KIND=C_BOOL) :: scale_factor_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: standard_name - LOGICAL(KIND=C_BOOL) :: standard_name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: ts_enabled - LOGICAL(KIND=C_BOOL) :: ts_enabled_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: ts_split_freq - LOGICAL(KIND=C_BOOL) :: ts_split_freq_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: unit - LOGICAL(KIND=C_BOOL) :: unit_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: valid_max - LOGICAL(KIND=C_BOOL) :: valid_max_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: valid_min - LOGICAL(KIND=C_BOOL) :: valid_min_tmp - - CALL xios(is_defined_field_attr_hdl_) & - ( field_hdl, add_offset, axis_ref, cell_methods, cell_methods_mode, check_if_active, comment & - , compression_level, default_value, detect_missing_value, domain_ref, enabled, expr, field_ref & - , freq_offset, freq_op, grid_path, grid_ref, indexed_output, level, long_name, name, operation & - , prec, read_access, scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq, unit & - , valid_max, valid_min ) - - END SUBROUTINE xios(is_defined_field_attr_hdl) - - SUBROUTINE xios(is_defined_field_attr_hdl_) & - ( field_hdl, add_offset_, axis_ref_, cell_methods_, cell_methods_mode_, check_if_active_, comment_ & - , compression_level_, default_value_, detect_missing_value_, domain_ref_, enabled_, expr_, field_ref_ & - , freq_offset_, freq_op_, grid_path_, grid_ref_, indexed_output_, level_, long_name_, name_ & - , operation_, prec_, read_access_, scalar_ref_, scale_factor_, standard_name_, ts_enabled_, ts_split_freq_ & - , unit_, valid_max_, valid_min_ ) - - IMPLICIT NONE - TYPE(txios(field)) , INTENT(IN) :: field_hdl - LOGICAL, OPTIONAL, INTENT(OUT) :: add_offset_ - LOGICAL(KIND=C_BOOL) :: add_offset__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: axis_ref_ - LOGICAL(KIND=C_BOOL) :: axis_ref__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: cell_methods_ - LOGICAL(KIND=C_BOOL) :: cell_methods__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: cell_methods_mode_ - LOGICAL(KIND=C_BOOL) :: cell_methods_mode__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: check_if_active_ - LOGICAL(KIND=C_BOOL) :: check_if_active__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: comment_ - LOGICAL(KIND=C_BOOL) :: comment__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: compression_level_ - LOGICAL(KIND=C_BOOL) :: compression_level__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: default_value_ - LOGICAL(KIND=C_BOOL) :: default_value__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: detect_missing_value_ - LOGICAL(KIND=C_BOOL) :: detect_missing_value__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: domain_ref_ - LOGICAL(KIND=C_BOOL) :: domain_ref__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: enabled_ - LOGICAL(KIND=C_BOOL) :: enabled__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: expr_ - LOGICAL(KIND=C_BOOL) :: expr__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: field_ref_ - LOGICAL(KIND=C_BOOL) :: field_ref__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: freq_offset_ - LOGICAL(KIND=C_BOOL) :: freq_offset__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: freq_op_ - LOGICAL(KIND=C_BOOL) :: freq_op__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: grid_path_ - LOGICAL(KIND=C_BOOL) :: grid_path__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: grid_ref_ - LOGICAL(KIND=C_BOOL) :: grid_ref__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: indexed_output_ - LOGICAL(KIND=C_BOOL) :: indexed_output__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: level_ - LOGICAL(KIND=C_BOOL) :: level__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: long_name_ - LOGICAL(KIND=C_BOOL) :: long_name__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: name_ - LOGICAL(KIND=C_BOOL) :: name__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: operation_ - LOGICAL(KIND=C_BOOL) :: operation__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: prec_ - LOGICAL(KIND=C_BOOL) :: prec__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: read_access_ - LOGICAL(KIND=C_BOOL) :: read_access__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: scalar_ref_ - LOGICAL(KIND=C_BOOL) :: scalar_ref__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: scale_factor_ - LOGICAL(KIND=C_BOOL) :: scale_factor__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: standard_name_ - LOGICAL(KIND=C_BOOL) :: standard_name__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: ts_enabled_ - LOGICAL(KIND=C_BOOL) :: ts_enabled__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: ts_split_freq_ - LOGICAL(KIND=C_BOOL) :: ts_split_freq__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: unit_ - LOGICAL(KIND=C_BOOL) :: unit__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: valid_max_ - LOGICAL(KIND=C_BOOL) :: valid_max__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: valid_min_ - LOGICAL(KIND=C_BOOL) :: valid_min__tmp - - IF (PRESENT(add_offset_)) THEN - add_offset__tmp = cxios_is_defined_field_add_offset & - (field_hdl%daddr) - add_offset_ = add_offset__tmp - ENDIF - - IF (PRESENT(axis_ref_)) THEN - axis_ref__tmp = cxios_is_defined_field_axis_ref & - (field_hdl%daddr) - axis_ref_ = axis_ref__tmp - ENDIF - - IF (PRESENT(cell_methods_)) THEN - cell_methods__tmp = cxios_is_defined_field_cell_methods & - (field_hdl%daddr) - cell_methods_ = cell_methods__tmp - ENDIF - - IF (PRESENT(cell_methods_mode_)) THEN - cell_methods_mode__tmp = cxios_is_defined_field_cell_methods_mode & - (field_hdl%daddr) - cell_methods_mode_ = cell_methods_mode__tmp - ENDIF - - IF (PRESENT(check_if_active_)) THEN - check_if_active__tmp = cxios_is_defined_field_check_if_active & - (field_hdl%daddr) - check_if_active_ = check_if_active__tmp - ENDIF - - IF (PRESENT(comment_)) THEN - comment__tmp = cxios_is_defined_field_comment & - (field_hdl%daddr) - comment_ = comment__tmp - ENDIF - - IF (PRESENT(compression_level_)) THEN - compression_level__tmp = cxios_is_defined_field_compression_level & - (field_hdl%daddr) - compression_level_ = compression_level__tmp - ENDIF - - IF (PRESENT(default_value_)) THEN - default_value__tmp = cxios_is_defined_field_default_value & - (field_hdl%daddr) - default_value_ = default_value__tmp - ENDIF - - IF (PRESENT(detect_missing_value_)) THEN - detect_missing_value__tmp = cxios_is_defined_field_detect_missing_value & - (field_hdl%daddr) - detect_missing_value_ = detect_missing_value__tmp - ENDIF - - IF (PRESENT(domain_ref_)) THEN - domain_ref__tmp = cxios_is_defined_field_domain_ref & - (field_hdl%daddr) - domain_ref_ = domain_ref__tmp - ENDIF - - IF (PRESENT(enabled_)) THEN - enabled__tmp = cxios_is_defined_field_enabled & - (field_hdl%daddr) - enabled_ = enabled__tmp - ENDIF - - IF (PRESENT(expr_)) THEN - expr__tmp = cxios_is_defined_field_expr & - (field_hdl%daddr) - expr_ = expr__tmp - ENDIF - - IF (PRESENT(field_ref_)) THEN - field_ref__tmp = cxios_is_defined_field_field_ref & - (field_hdl%daddr) - field_ref_ = field_ref__tmp - ENDIF - - IF (PRESENT(freq_offset_)) THEN - freq_offset__tmp = cxios_is_defined_field_freq_offset & - (field_hdl%daddr) - freq_offset_ = freq_offset__tmp - ENDIF - - IF (PRESENT(freq_op_)) THEN - freq_op__tmp = cxios_is_defined_field_freq_op & - (field_hdl%daddr) - freq_op_ = freq_op__tmp - ENDIF - - IF (PRESENT(grid_path_)) THEN - grid_path__tmp = cxios_is_defined_field_grid_path & - (field_hdl%daddr) - grid_path_ = grid_path__tmp - ENDIF - - IF (PRESENT(grid_ref_)) THEN - grid_ref__tmp = cxios_is_defined_field_grid_ref & - (field_hdl%daddr) - grid_ref_ = grid_ref__tmp - ENDIF - - IF (PRESENT(indexed_output_)) THEN - indexed_output__tmp = cxios_is_defined_field_indexed_output & - (field_hdl%daddr) - indexed_output_ = indexed_output__tmp - ENDIF - - IF (PRESENT(level_)) THEN - level__tmp = cxios_is_defined_field_level & - (field_hdl%daddr) - level_ = level__tmp - ENDIF - - IF (PRESENT(long_name_)) THEN - long_name__tmp = cxios_is_defined_field_long_name & - (field_hdl%daddr) - long_name_ = long_name__tmp - ENDIF - - IF (PRESENT(name_)) THEN - name__tmp = cxios_is_defined_field_name & - (field_hdl%daddr) - name_ = name__tmp - ENDIF - - IF (PRESENT(operation_)) THEN - operation__tmp = cxios_is_defined_field_operation & - (field_hdl%daddr) - operation_ = operation__tmp - ENDIF - - IF (PRESENT(prec_)) THEN - prec__tmp = cxios_is_defined_field_prec & - (field_hdl%daddr) - prec_ = prec__tmp - ENDIF - - IF (PRESENT(read_access_)) THEN - read_access__tmp = cxios_is_defined_field_read_access & - (field_hdl%daddr) - read_access_ = read_access__tmp - ENDIF - - IF (PRESENT(scalar_ref_)) THEN - scalar_ref__tmp = cxios_is_defined_field_scalar_ref & - (field_hdl%daddr) - scalar_ref_ = scalar_ref__tmp - ENDIF - - IF (PRESENT(scale_factor_)) THEN - scale_factor__tmp = cxios_is_defined_field_scale_factor & - (field_hdl%daddr) - scale_factor_ = scale_factor__tmp - ENDIF - - IF (PRESENT(standard_name_)) THEN - standard_name__tmp = cxios_is_defined_field_standard_name & - (field_hdl%daddr) - standard_name_ = standard_name__tmp - ENDIF - - IF (PRESENT(ts_enabled_)) THEN - ts_enabled__tmp = cxios_is_defined_field_ts_enabled & - (field_hdl%daddr) - ts_enabled_ = ts_enabled__tmp - ENDIF - - IF (PRESENT(ts_split_freq_)) THEN - ts_split_freq__tmp = cxios_is_defined_field_ts_split_freq & - (field_hdl%daddr) - ts_split_freq_ = ts_split_freq__tmp - ENDIF - - IF (PRESENT(unit_)) THEN - unit__tmp = cxios_is_defined_field_unit & - (field_hdl%daddr) - unit_ = unit__tmp - ENDIF - - IF (PRESENT(valid_max_)) THEN - valid_max__tmp = cxios_is_defined_field_valid_max & - (field_hdl%daddr) - valid_max_ = valid_max__tmp - ENDIF - - IF (PRESENT(valid_min_)) THEN - valid_min__tmp = cxios_is_defined_field_valid_min & - (field_hdl%daddr) - valid_min_ = valid_min__tmp - ENDIF - - END SUBROUTINE xios(is_defined_field_attr_hdl_) - -END MODULE ifield_attr diff --git a/xios_2311_src/trunk/.svn/pristine/06/0644f1b0600cbe87d36865c339bf0549f927afeb.svn-base b/xios_2311_src/trunk/.svn/pristine/06/0644f1b0600cbe87d36865c339bf0549f927afeb.svn-base deleted file mode 100644 index 5adc13393c2f10234655f27d062fcf94e115a287..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/06/0644f1b0600cbe87d36865c339bf0549f927afeb.svn-base +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef __WEIGHT_TRANSFORM_CONNECTOR_HPP__ -#define __WEIGHT_TRANSFORM_CONNECTOR_HPP__ - -#include "xios_spl.hpp" -#include "array_new.hpp" -#include "local_view.hpp" - - - -namespace xios -{ - - class CWeightTransformConnector - { - - private: - shared_ptr srcView_; - shared_ptr dstView_; - - vector weights_; // sizeof sum(nWeights_) - vector connector_; // sizeof sum(nWeights_) - vector nWeights_ ; // sizeof dstSize_ - int srcSize_ ; - int dstSize_ ; - - void computeConnector(unordered_map>& indexMap, unordered_map>& weightMap) ; - - public: - - CWeightTransformConnector(shared_ptr srcView, shared_ptr dstView, unordered_map>& indexMap, - unordered_map>& weightMap) ; - - void transfer(int repeat, int sizeT, const CArray& dataIn, CArray& dataOut) - { - int dstSlice = dstSize_*sizeT ; - int srcSlice = srcSize_*sizeT ; - dataOut.resize(repeat* dstSlice) ; - dataOut=0 ; // what to do about missing value => next step ? - - const double* input = dataIn.dataFirst() ; - double* output = dataOut.dataFirst() ; - - for(int r=0;r& dataIn, CArray& dataOut) - { - transfer(1,sizeT, dataIn, dataOut) ; - } - - void transfer(const CArray& dataIn, CArray& dataOut) - { - transfer(1,1,dataIn, dataOut) ; - } - - - }; - -} - -#endif \ No newline at end of file diff --git a/xios_2311_src/trunk/.svn/pristine/06/068658eb5cb1cf2fa11eaac688f7754cd10c8191.svn-base b/xios_2311_src/trunk/.svn/pristine/06/068658eb5cb1cf2fa11eaac688f7754cd10c8191.svn-base deleted file mode 100644 index 657159a7a1914a91b7ed0addb3cbbb24487e4eb8..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/06/068658eb5cb1cf2fa11eaac688f7754cd10c8191.svn-base +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef __BUFFER_SERVER_HPP__ -#define __BUFFER_SERVER_HPP__ - -#include "buffer_cs_base.hpp" -#include "xios_spl.hpp" -#include "buffer.hpp" -#include "mpi.hpp" -#include "cxios.hpp" - -namespace xios -{ - class CServerBuffer : public CBufferClientServerBase - { - public: - CServerBuffer(vector& windows, vector& winAddress, int windowsRank, StdSize bufSize) ; - ~CServerBuffer() ; - - bool isBufferFree(size_t count) ; - bool isResizing(void) { return resizingBuffer_ ;} - void* getBuffer(size_t count) ; - void freeBuffer(size_t count) ; - void popBuffer(size_t count) ; - void createWindows(MPI_Comm oneSidedComm) ; - bool getBufferFromClient(size_t timeLine, char* & buffer, size_t& count) ; - bool isBufferEmpty(void) ; - void updateCurrentWindows(void) ; - void lockBuffer(void) ; - void unlockBuffer(void) ; - void notifyClientFinalize(void) ; - void notifyBufferResizing(void) ; - size_t getUsed(void) { return used ;} - private: - char* buffer; - size_t first; // first occupied element - size_t current; // first free element - size_t end; - size_t size; - size_t used ; // count of element occupied - std::vector windows_ ; - std::vector winAddress_ ; - bool resizingBuffer_ = false ; - int currentWindows ; - bool hasWindows ; - int windowsRank_ ; - double bufferFromClientLatency_=0e-1 ; - double bufferFromClientTime_ = 0; - - }; -} - -#endif diff --git a/xios_2311_src/trunk/.svn/pristine/06/069fc563b506de6604f7893f20a3e55324110cd7.svn-base b/xios_2311_src/trunk/.svn/pristine/06/069fc563b506de6604f7893f20a3e55324110cd7.svn-base deleted file mode 100644 index 21731d31a4c9978e5c9ee684362730a39b8b7fe9..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/06/069fc563b506de6604f7893f20a3e55324110cd7.svn-base +++ /dev/null @@ -1,77 +0,0 @@ -/*! - \file max.cpp - \author Ha NGUYEN - \since 27 June 2016 - \date 27 June 2016 - - \brief max reduction - */ -#include "max_reduction.hpp" -#include "utils.hpp" - -namespace xios { - -CMaxReductionAlgorithm::CMaxReductionAlgorithm() - : CReductionAlgorithm() -{ -} - -CReductionAlgorithm* CMaxReductionAlgorithm::create() -{ - return (new CMaxReductionAlgorithm()); -} - -bool CMaxReductionAlgorithm::registerTrans() -{ - return registerOperation(TRANS_REDUCE_MAX, CMaxReductionAlgorithm::create); -} - -void CMaxReductionAlgorithm::apply(const std::vector >& localIndex, - const double* dataInput, - CArray& dataOut, - std::vector& flagInitial, - bool ignoreMissingValue, bool firstPass) -{ - if (ignoreMissingValue) - { - int nbLocalIndex = localIndex.size(); - int currentlocalIndex = 0; - if (firstPass) dataOut=std::numeric_limits::quiet_NaN(); - for (int idx = 0; idx < nbLocalIndex; ++idx) - { - currentlocalIndex = localIndex[idx].first; - if (!NumTraits::isNan(*(dataInput + idx))) - { - if (flagInitial[currentlocalIndex]) - { - dataOut(currentlocalIndex) = *(dataInput + idx); - flagInitial[currentlocalIndex] = false; - } - else - { - dataOut(currentlocalIndex) = std::max(*(dataInput + idx), dataOut(currentlocalIndex)); - } - } - } - } - else - { - int nbLocalIndex = localIndex.size(); - int currentlocalIndex = 0; - for (int idx = 0; idx < nbLocalIndex; ++idx) - { - currentlocalIndex = localIndex[idx].first; - if (flagInitial[currentlocalIndex]) - { - dataOut(currentlocalIndex) = *(dataInput + idx); - flagInitial[currentlocalIndex] = false; - } - else - { - dataOut(currentlocalIndex) = std::max(*(dataInput + idx), dataOut(currentlocalIndex)); - } - } - } -} - -} diff --git a/xios_2311_src/trunk/.svn/pristine/06/06abb9b9f417a46ac04551d647353e3775942a0a.svn-base b/xios_2311_src/trunk/.svn/pristine/06/06abb9b9f417a46ac04551d647353e3775942a0a.svn-base deleted file mode 100644 index 746df5f2b049545503196b2711954181567d12b7..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/06/06abb9b9f417a46ac04551d647353e3775942a0a.svn-base +++ /dev/null @@ -1,753 +0,0 @@ -/* - * Copyright 1996, University Corporation for Atmospheric Research - * See netcdf/COPYRIGHT file for copying and redistribution conditions. - */ -/* "$Id: ncx.h,v 1.65 2010/05/26 18:11:08 dmh Exp $" */ - -#ifndef _NCX_H_ -#define _NCX_H_ - -#include "ncdispatch.h" -#include "ncio.h" -#include "fbits.h" - -/* - * An external data representation interface. - - * - * This started out as a general replacement for ONC XDR, - * specifically, the xdrmem family of functions. - * - * We eventually realized that we could write more portable - * code if we decoupled any association between the 'C' types - * and the external types. (XDR has this association between the 'C' - * types and the external representations, like xdr_int() takes - * an int argument and goes to an external int representation.) - * So, now there is a matrix of functions. - * - */ - -#include /* output of 'configure' */ -#include "rnd.h" -#include /* size_t */ -#include -#include /* off_t */ -#include -#define longlong long long - -#if defined(_CRAY) && !defined(_CRAYIEEE) && !defined(__crayx1) -#define CRAYFLOAT 1 /* CRAY Floating point */ -#elif defined(_SX) && defined(_FLOAT2) /* NEC SUPER-UX in CRAY mode */ -#define CRAYFLOAT 1 /* CRAY Floating point */ -#endif - -/* - * The integer return code for the conversion routines - * is 0 (ENOERR) when no error occured, or NC_ERANGE as appropriate - * for an overflow conversion. - */ -#ifndef ENOERR -#define ENOERR 0 -#endif -#ifndef NC_ERANGE -#define NC_ERANGE (-60) /* N.B. must match value in netcdf.h */ -#endif -#ifndef NC_ENOMEM -#define NC_ENOMEM (-61) /* N.B. must match value in netcdf.h */ -#endif - - -/* - * External sizes of the primitive elements. - */ -#define X_SIZEOF_CHAR 1 -#define X_SIZEOF_SHORT 2 -#define X_SIZEOF_INT 4 /* xdr_int */ -#if 0 -#define X_SIZEOF_LONG 8 */ /* xdr_long_long */ -#endif -#define X_SIZEOF_FLOAT 4 -#define X_SIZEOF_DOUBLE 8 - -/* - * For now, netcdf is limited to 32 bit sizes, - * If compiled with support for "large files", then - * netcdf will use a 64 bit off_t and it can then write a file - * using 64 bit offsets. - * see also X_SIZE_MAX, X_OFF_MAX below - */ -#define X_SIZEOF_OFF_T (sizeof(off_t)) -#define X_SIZEOF_SIZE_T X_SIZEOF_INT - -/* - * limits of the external representation - */ -#define X_SCHAR_MIN (-128) -#define X_SCHAR_MAX 127 -#define X_UCHAR_MAX 255U -#define X_SHORT_MIN (-32768) -#define X_SHRT_MIN X_SHORT_MIN /* alias compatible with limits.h */ -#define X_SHORT_MAX 32767 -#define X_SHRT_MAX X_SHORT_MAX /* alias compatible with limits.h */ -#define X_USHORT_MAX 65535U -#define X_USHRT_MAX X_USHORT_MAX /* alias compatible with limits.h */ -#define X_INT_MIN (-2147483647-1) -#define X_INT_MAX 2147483647 -#define X_UINT_MAX 4294967295U -#define X_LONGLONG_MIN (-9223372036854775807LL-1LL) -#define X_LONGLONG_MAX 9223372036854775807LL -#define X_ULONGLONG_MAX 18446744073709551615ULL -#define X_FLOAT_MAX 3.402823466e+38f -#define X_FLOAT_MIN (-X_FLOAT_MAX) -#define X_FLT_MAX X_FLOAT_MAX /* alias compatible with limits.h */ -#if CRAYFLOAT -/* ldexp(1. - ldexp(.5 , -46), 1024) */ -#define X_DOUBLE_MAX 1.79769313486230e+308 -#else -/* scalb(1. - scalb(.5 , -52), 1024) */ -#define X_DOUBLE_MAX 1.7976931348623157e+308 -#endif -#define X_DOUBLE_MIN (-X_DOUBLE_MAX) -#define X_DBL_MAX X_DOUBLE_MAX /* alias compatible with limits.h */ - -#define X_SIZE_MAX X_UINT_MAX -#define X_OFF_MAX X_INT_MAX - - -/* Begin ncx_len */ - -/* - * ncx_len_xxx() interfaces are defined as macros below, - * These give the length of an array of nelems of the type. - * N.B. The 'char' and 'short' interfaces give the X_ALIGNED length. - */ -#define X_ALIGN 4 /* a.k.a. BYTES_PER_XDR_UNIT */ - -#define ncx_len_char(nelems) \ - _RNDUP((nelems), X_ALIGN) - -#define ncx_len_short(nelems) \ - (((nelems) + (nelems)%2) * X_SIZEOF_SHORT) - -#define ncx_len_int(nelems) \ - ((nelems) * X_SIZEOF_INT) - -#define ncx_len_long(nelems) \ - ((nelems) * X_SIZEOF_LONG) - -#define ncx_len_float(nelems) \ - ((nelems) * X_SIZEOF_FLOAT) - -#define ncx_len_double(nelems) \ - ((nelems) * X_SIZEOF_DOUBLE) - -/* End ncx_len */ - -#if __CHAR_UNSIGNED__ - /* 'char' is unsigned, declare ncbyte as 'signed char' */ -typedef signed char schar; - -#else - /* 'char' is signed */ -typedef signed char schar; - -#endif /* __CHAR_UNSIGNED__ */ - -/* - * Primitive numeric conversion functions. - * The `put' functions convert from native internal - * type to the external type, while the `get' functions - * convert from the external to the internal. - * - * These take the form - * int ncx_get_{external_type}_{internal_type}( - * const void *xp, - * internal_type *ip - * ); - * int ncx_put_{external_type}_{internal_type}( - * void *xp, - * const internal_type *ip - * ); - * where - * `external_type' and `internal_type' chosen from - schar - uchar - short - ushort - int - uint - long - ulong - float - double - * - * Not all combinations make sense. - * We may not implement all combinations that make sense. - * The netcdf functions that use this ncx interface don't - * use these primitive conversion functions. They use the - * aggregate conversion functions declared below. - * - * Storage for a single element of external type is at the `void * xp' - * argument. - * - * Storage for a single element of internal type is at `ip' argument. - * - * These functions return 0 (ENOERR) when no error occured, - * or NC_ERANGE when the value being converted is too large. - * When NC_ERANGE occurs, an undefined (implementation dependent) - * conversion may have occured. - * - * Note that loss of precision may occur silently. - * - */ - -#if 0 -extern int -ncx_get_schar_schar(const void *xp, schar *ip); -extern int -ncx_get_schar_uchar(const void *xp, uchar *ip); -extern int -ncx_get_schar_short(const void *xp, short *ip); -extern int -ncx_get_schar_int(const void *xp, int *ip); -extern int -ncx_get_schar_long(const void *xp, long *ip); -extern int -ncx_get_schar_float(const void *xp, float *ip); -extern int -ncx_get_schar_double(const void *xp, double *ip); - -extern int -ncx_put_schar_schar(void *xp, const schar *ip); -extern int -ncx_put_schar_uchar(void *xp, const uchar *ip); -extern int -ncx_put_schar_short(void *xp, const short *ip); -extern int -ncx_put_schar_int(void *xp, const int *ip); -extern int -ncx_put_schar_long(void *xp, const long *ip); -extern int -ncx_put_schar_float(void *xp, const float *ip); -extern int -ncx_put_schar_double(void *xp, const double *ip); -#endif - - -extern int -ncx_get_short_schar(const void *xp, schar *ip); -extern int -ncx_get_short_uchar(const void *xp, uchar *ip); -extern int -ncx_get_short_short(const void *xp, short *ip); -extern int -ncx_get_short_int(const void *xp, int *ip); -extern int -ncx_get_short_long(const void *xp, long *ip); -extern int -ncx_get_short_float(const void *xp, float *ip); -extern int -ncx_get_short_double(const void *xp, double *ip); - -extern int -ncx_put_short_schar(void *xp, const schar *ip); -extern int -ncx_put_short_uchar(void *xp, const uchar *ip); -extern int -ncx_put_short_short(void *xp, const short *ip); -extern int -ncx_put_short_int(void *xp, const int *ip); -extern int -ncx_put_short_long(void *xp, const long *ip); -extern int -ncx_put_short_float(void *xp, const float *ip); -extern int -ncx_put_short_double(void *xp, const double *ip); - - -extern int -ncx_get_int_schar(const void *xp, schar *ip); -extern int -ncx_get_int_uchar(const void *xp, uchar *ip); -extern int -ncx_get_int_short(const void *xp, short *ip); -extern int -ncx_get_int_int(const void *xp, int *ip); -extern int -ncx_get_int_long(const void *xp, long *ip); -extern int -ncx_get_int_float(const void *xp, float *ip); -extern int -ncx_get_int_double(const void *xp, double *ip); - -extern int -ncx_put_int_schar(void *xp, const schar *ip); -extern int -ncx_put_int_uchar(void *xp, const uchar *ip); -extern int -ncx_put_int_short(void *xp, const short *ip); -extern int -ncx_put_int_int(void *xp, const int *ip); -extern int -ncx_put_int_long(void *xp, const long *ip); -extern int -ncx_put_int_float(void *xp, const float *ip); -extern int -ncx_put_int_double(void *xp, const double *ip); - - -extern int -ncx_get_float_schar(const void *xp, schar *ip); -extern int -ncx_get_float_uchar(const void *xp, uchar *ip); -extern int -ncx_get_float_short(const void *xp, short *ip); -extern int -ncx_get_float_int(const void *xp, int *ip); -extern int -ncx_get_float_long(const void *xp, long *ip); -extern int -ncx_get_float_float(const void *xp, float *ip); -extern int -ncx_get_float_double(const void *xp, double *ip); - -extern int -ncx_put_float_schar(void *xp, const schar *ip); -extern int -ncx_put_float_uchar(void *xp, const uchar *ip); -extern int -ncx_put_float_short(void *xp, const short *ip); -extern int -ncx_put_float_int(void *xp, const int *ip); -extern int -ncx_put_float_long(void *xp, const long *ip); -extern int -ncx_put_float_float(void *xp, const float *ip); -extern int -ncx_put_float_double(void *xp, const double *ip); - - -extern int -ncx_get_double_schar(const void *xp, schar *ip); -extern int -ncx_get_double_uchar(const void *xp, uchar *ip); -extern int -ncx_get_double_short(const void *xp, short *ip); -extern int -ncx_get_double_int(const void *xp, int *ip); -extern int -ncx_get_double_long(const void *xp, long *ip); -extern int -ncx_get_double_float(const void *xp, float *ip); -extern int -ncx_get_double_double(const void *xp, double *ip); - -extern int -ncx_put_double_schar(void *xp, const schar *ip); -extern int -ncx_put_double_uchar(void *xp, const uchar *ip); -extern int -ncx_put_double_short(void *xp, const short *ip); -extern int -ncx_put_double_int(void *xp, const int *ip); -extern int -ncx_put_double_long(void *xp, const long *ip); -extern int -ncx_put_double_float(void *xp, const float *ip); -extern int -ncx_put_double_double(void *xp, const double *ip); - - -/* - * Other primitive conversion functions - * N.B. slightly different interface - * Used by netcdf. - */ - -/* ncx_get_int_size_t */ -extern int -ncx_get_size_t(const void **xpp, size_t *ulp); -/* ncx_get_int_off_t */ -extern int -ncx_get_off_t(const void **xpp, off_t *lp, size_t sizeof_off_t); - -/* ncx_put_int_size_t */ -extern int -ncx_put_size_t(void **xpp, const size_t *ulp); -/* ncx_put_int_off_t */ -extern int -ncx_put_off_t(void **xpp, const off_t *lp, size_t sizeof_off_t); - - -/* - * Aggregate numeric conversion functions. - * Convert an array. Replaces xdr_array(...). - * These functions are used by netcdf. Unlike the xdr - * interface, we optimize for aggregate conversions. - * This functions should be implemented to take advantage - * of multiple processor / parallel hardware where available. - * - * These take the form - * int ncx_getn_{external_type}_{internal_type}( - * const void *xpp, - * size_t nelems, - * internal_type *ip - * ); - * int ncx_putn_{external_type}_{internal_type}( - * void **xpp, - * size_t nelems, - * const internal_type *ip - * ); - * Where the types are as in the primitive numeric conversion functions. - * - * The value of the pointer to pointer argument, *xpp, is - * expected to reference storage for `nelems' of the external - * type. On return, it modified to reference just past the last - * converted external element. - * - * The types whose external size is less than X_ALIGN also have `pad' - * interfaces. These round (and zero fill on put) *xpp up to X_ALIGN - * boundaries. (This is the usual xdr behavior.) - * - * The `ip' argument should point to an array of `nelems' of - * internal_type. - * - * Range errors (NC_ERANGE) for a individual values in the array - * DO NOT terminate the array conversion. All elements are converted, - * with some having undefined values. - * If any range error occurs, the function returns NC_ERANGE. - * - */ - -extern int -ncx_getn_schar_schar(const void **xpp, size_t nelems, schar *ip); -extern int -ncx_getn_schar_uchar(const void **xpp, size_t nelems, uchar *ip); -extern int -ncx_getn_schar_short(const void **xpp, size_t nelems, short *ip); -extern int -ncx_getn_schar_int(const void **xpp, size_t nelems, int *ip); -extern int -ncx_getn_schar_long(const void **xpp, size_t nelems, long *ip); -extern int -ncx_getn_schar_float(const void **xpp, size_t nelems, float *ip); -extern int -ncx_getn_schar_double(const void **xpp, size_t nelems, double *ip); -extern int -ncx_getn_schar_uint(const void **xpp, size_t nelems, unsigned int *ip); -extern int -ncx_getn_schar_longlong(const void **xpp, size_t nelems, longlong *ip); -extern int -ncx_getn_schar_ulonglong(const void **xpp, size_t nelems, ulonglong *ip); - -extern int -ncx_pad_getn_schar_schar(const void **xpp, size_t nelems, schar *ip); -extern int -ncx_pad_getn_schar_uchar(const void **xpp, size_t nelems, uchar *ip); -extern int -ncx_pad_getn_schar_short(const void **xpp, size_t nelems, short *ip); -extern int -ncx_pad_getn_schar_int(const void **xpp, size_t nelems, int *ip); -extern int -ncx_pad_getn_schar_long(const void **xpp, size_t nelems, long *ip); -extern int -ncx_pad_getn_schar_float(const void **xpp, size_t nelems, float *ip); -extern int -ncx_pad_getn_schar_double(const void **xpp, size_t nelems, double *ip); -extern int -ncx_pad_getn_schar_uint(const void **xpp, size_t nelems, unsigned int *ip); -extern int -ncx_pad_getn_schar_longlong(const void **xpp, size_t nelems, longlong *ip); -extern int -ncx_pad_getn_schar_ulonglong(const void **xpp, size_t nelems, ulonglong *ip); - -extern int -ncx_putn_schar_schar(void **xpp, size_t nelems, const schar *ip); -extern int -ncx_putn_schar_uchar(void **xpp, size_t nelems, const uchar *ip); -extern int -ncx_putn_schar_short(void **xpp, size_t nelems, const short *ip); -extern int -ncx_putn_schar_int(void **xpp, size_t nelems, const int *ip); -extern int -ncx_putn_schar_long(void **xpp, size_t nelems, const long *ip); -extern int -ncx_putn_schar_float(void **xpp, size_t nelems, const float *ip); -extern int -ncx_putn_schar_double(void **xpp, size_t nelems, const double *ip); -extern int -ncx_putn_schar_uint(void **xpp, size_t nelems, const unsigned int *ip); -extern int -ncx_putn_schar_longlong(void **xpp, size_t nelems, const longlong *ip); -extern int -ncx_putn_schar_ulonglong(void **xpp, size_t nelems, const ulonglong *ip); - -extern int -ncx_pad_putn_schar_schar(void **xpp, size_t nelems, const schar *ip); -extern int -ncx_pad_putn_schar_uchar(void **xpp, size_t nelems, const uchar *ip); -extern int -ncx_pad_putn_schar_short(void **xpp, size_t nelems, const short *ip); -extern int -ncx_pad_putn_schar_int(void **xpp, size_t nelems, const int *ip); -extern int -ncx_pad_putn_schar_long(void **xpp, size_t nelems, const long *ip); -extern int -ncx_pad_putn_schar_float(void **xpp, size_t nelems, const float *ip); -extern int -ncx_pad_putn_schar_double(void **xpp, size_t nelems, const double *ip); -extern int -ncx_pad_putn_schar_uint(void **xpp, size_t nelems, const unsigned int *ip); -extern int -ncx_pad_putn_schar_longlong(void **xpp, size_t nelems, const longlong *ip); -extern int -ncx_pad_putn_schar_ulonglong(void **xpp, size_t nelems, const ulonglong *ip); - - -extern int -ncx_getn_short_schar(const void **xpp, size_t nelems, schar *ip); -extern int -ncx_getn_short_uchar(const void **xpp, size_t nelems, uchar *ip); -extern int -ncx_getn_short_short(const void **xpp, size_t nelems, short *ip); -extern int -ncx_getn_short_int(const void **xpp, size_t nelems, int *ip); -extern int -ncx_getn_short_long(const void **xpp, size_t nelems, long *ip); -extern int -ncx_getn_short_float(const void **xpp, size_t nelems, float *ip); -extern int -ncx_getn_short_double(const void **xpp, size_t nelems, double *ip); -extern int -ncx_getn_short_uint(const void **xpp, size_t nelems, unsigned int *ip); -extern int -ncx_getn_short_longlong(const void **xpp, size_t nelems, longlong *ip); -extern int -ncx_getn_short_ulonglong(const void **xpp, size_t nelems, ulonglong *ip); - -extern int -ncx_pad_getn_short_schar(const void **xpp, size_t nelems, schar *ip); -extern int -ncx_pad_getn_short_uchar(const void **xpp, size_t nelems, uchar *ip); -extern int -ncx_pad_getn_short_short(const void **xpp, size_t nelems, short *ip); -extern int -ncx_pad_getn_short_int(const void **xpp, size_t nelems, int *ip); -extern int -ncx_pad_getn_short_long(const void **xpp, size_t nelems, long *ip); -extern int -ncx_pad_getn_short_float(const void **xpp, size_t nelems, float *ip); -extern int -ncx_pad_getn_short_double(const void **xpp, size_t nelems, double *ip); -extern int -ncx_pad_getn_short_uint(const void **xpp, size_t nelems, unsigned int *ip); -extern int -ncx_pad_getn_short_longlong(const void **xpp, size_t nelems, longlong *ip); -extern int -ncx_pad_getn_short_ulonglong(const void **xpp, size_t nelems, ulonglong *ip); - -extern int -ncx_putn_short_schar(void **xpp, size_t nelems, const schar *ip); -extern int -ncx_putn_short_uchar(void **xpp, size_t nelems, const uchar *ip); -extern int -ncx_putn_short_short(void **xpp, size_t nelems, const short *ip); -extern int -ncx_putn_short_int(void **xpp, size_t nelems, const int *ip); -extern int -ncx_putn_short_long(void **xpp, size_t nelems, const long *ip); -extern int -ncx_putn_short_float(void **xpp, size_t nelems, const float *ip); -extern int -ncx_putn_short_double(void **xpp, size_t nelems, const double *ip); -extern int -ncx_putn_short_uint(void **xpp, size_t nelems, const unsigned int *ip); -extern int -ncx_putn_short_longlong(void **xpp, size_t nelems, const longlong *ip); -extern int -ncx_putn_short_ulonglong(void **xpp, size_t nelems, const ulonglong *ip); - -extern int -ncx_pad_putn_short_schar(void **xpp, size_t nelems, const schar *ip); -extern int -ncx_pad_putn_short_uchar(void **xpp, size_t nelems, const uchar *ip); -extern int -ncx_pad_putn_short_short(void **xpp, size_t nelems, const short *ip); -extern int -ncx_pad_putn_short_int(void **xpp, size_t nelems, const int *ip); -extern int -ncx_pad_putn_short_long(void **xpp, size_t nelems, const long *ip); -extern int -ncx_pad_putn_short_float(void **xpp, size_t nelems, const float *ip); -extern int -ncx_pad_putn_short_double(void **xpp, size_t nelems, const double *ip); -extern int -ncx_pad_putn_short_uint(void **xpp, size_t nelems, const unsigned int *ip); -extern int -ncx_pad_putn_short_longlong(void **xpp, size_t nelems, const longlong *ip); -extern int -ncx_pad_putn_short_ulonglong(void **xpp, size_t nelems, const ulonglong *ip); - - -extern int -ncx_getn_int_schar(const void **xpp, size_t nelems, schar *ip); -extern int -ncx_getn_int_uchar(const void **xpp, size_t nelems, uchar *ip); -extern int -ncx_getn_int_short(const void **xpp, size_t nelems, short *ip); -extern int -ncx_getn_int_int(const void **xpp, size_t nelems, int *ip); -extern int -ncx_getn_int_long(const void **xpp, size_t nelems, long *ip); -extern int -ncx_getn_int_float(const void **xpp, size_t nelems, float *ip); -extern int -ncx_getn_int_double(const void **xpp, size_t nelems, double *ip); -extern int -ncx_getn_int_uint(const void **xpp, size_t nelems, unsigned int *ip); -extern int -ncx_getn_int_longlong(const void **xpp, size_t nelems, longlong *ip); -extern int -ncx_getn_int_ulonglong(const void **xpp, size_t nelems, ulonglong *ip); - -extern int -ncx_putn_int_schar(void **xpp, size_t nelems, const schar *ip); -extern int -ncx_putn_int_uchar(void **xpp, size_t nelems, const uchar *ip); -extern int -ncx_putn_int_short(void **xpp, size_t nelems, const short *ip); -extern int -ncx_putn_int_int(void **xpp, size_t nelems, const int *ip); -extern int -ncx_putn_int_long(void **xpp, size_t nelems, const long *ip); -extern int -ncx_putn_int_float(void **xpp, size_t nelems, const float *ip); -extern int -ncx_putn_int_double(void **xpp, size_t nelems, const double *ip); -extern int -ncx_putn_int_uint(void **xpp, size_t nelems, const unsigned int *ip); -extern int -ncx_putn_int_longlong(void **xpp, size_t nelems, const longlong *ip); -extern int -ncx_putn_int_ulonglong(void **xpp, size_t nelems, const ulonglong *ip); - - -extern int -ncx_getn_float_schar(const void **xpp, size_t nelems, schar *ip); -extern int -ncx_getn_float_uchar(const void **xpp, size_t nelems, uchar *ip); -extern int -ncx_getn_float_short(const void **xpp, size_t nelems, short *ip); -extern int -ncx_getn_float_int(const void **xpp, size_t nelems, int *ip); -extern int -ncx_getn_float_long(const void **xpp, size_t nelems, long *ip); -extern int -ncx_getn_float_float(const void **xpp, size_t nelems, float *ip); -extern int -ncx_getn_float_double(const void **xpp, size_t nelems, double *ip); -extern int -ncx_getn_float_uint(const void **xpp, size_t nelems, unsigned int *ip); -extern int -ncx_getn_float_longlong(const void **xpp, size_t nelems, longlong *ip); -extern int -ncx_getn_float_ulonglong(const void **xpp, size_t nelems, ulonglong *ip); - -extern int -ncx_putn_float_schar(void **xpp, size_t nelems, const schar *ip); -extern int -ncx_putn_float_uchar(void **xpp, size_t nelems, const uchar *ip); -extern int -ncx_putn_float_short(void **xpp, size_t nelems, const short *ip); -extern int -ncx_putn_float_int(void **xpp, size_t nelems, const int *ip); -extern int -ncx_putn_float_long(void **xpp, size_t nelems, const long *ip); -extern int -ncx_putn_float_float(void **xpp, size_t nelems, const float *ip); -extern int -ncx_putn_float_double(void **xpp, size_t nelems, const double *ip); -extern int -ncx_putn_float_uint(void **xpp, size_t nelems, const unsigned int *ip); -extern int -ncx_putn_float_longlong(void **xpp, size_t nelems, const longlong *ip); -extern int -ncx_putn_float_ulonglong(void **xpp, size_t nelems, const ulonglong *ip); - - -extern int -ncx_getn_double_schar(const void **xpp, size_t nelems, schar *ip); -extern int -ncx_getn_double_uchar(const void **xpp, size_t nelems, uchar *ip); -extern int -ncx_getn_double_short(const void **xpp, size_t nelems, short *ip); -extern int -ncx_getn_double_int(const void **xpp, size_t nelems, int *ip); -extern int -ncx_getn_double_long(const void **xpp, size_t nelems, long *ip); -extern int -ncx_getn_double_float(const void **xpp, size_t nelems, float *ip); -extern int -ncx_getn_double_double(const void **xpp, size_t nelems, double *ip); -extern int -ncx_getn_double_uint(const void **xpp, size_t nelems, unsigned int *ip); -extern int -ncx_getn_double_longlong(const void **xpp, size_t nelems, longlong *ip); -extern int -ncx_getn_double_ulonglong(const void **xpp, size_t nelems, ulonglong *ip); - -extern int -ncx_putn_double_schar(void **xpp, size_t nelems, const schar *ip); -extern int -ncx_putn_double_uchar(void **xpp, size_t nelems, const uchar *ip); -extern int -ncx_putn_double_short(void **xpp, size_t nelems, const short *ip); -extern int -ncx_putn_double_int(void **xpp, size_t nelems, const int *ip); -extern int -ncx_putn_double_long(void **xpp, size_t nelems, const long *ip); -extern int -ncx_putn_double_float(void **xpp, size_t nelems, const float *ip); -extern int -ncx_putn_double_double(void **xpp, size_t nelems, const double *ip); -extern int -ncx_putn_double_uint(void **xpp, size_t nelems, const unsigned int *ip); -extern int -ncx_putn_double_longlong(void **xpp, size_t nelems, const longlong *ip); -extern int -ncx_putn_double_ulonglong(void **xpp, size_t nelems, const ulonglong *ip); - - -/* - * Other aggregate conversion functions. - */ - -/* read ASCII characters */ -extern int -ncx_getn_text(const void **xpp, size_t nchars, char *cp); -extern int -ncx_pad_getn_text(const void **xpp, size_t nchars, char *cp); - -/* write ASCII characters */ -extern int -ncx_putn_text(void **xpp, size_t nchars, const char *cp); -extern int -ncx_pad_putn_text(void **xpp, size_t nchars, const char *cp); - -/* for symmetry */ -#define ncx_getn_char_char(xpp, nelems, fillp) ncx_getn_text(xpp, nelems, fillp) -#define ncx_putn_char_char(xpp, nelems, fillp) ncx_putn_text(xpp, nelems, fillp) - -/* read opaque data */ -extern int -ncx_getn_void(const void **xpp, size_t nchars, void *vp); -extern int -ncx_pad_getn_void(const void **xpp, size_t nchars, void *vp); - -/* write opaque data */ -extern int -ncx_putn_void(void **xpp, size_t nchars, const void *vp); -extern int -ncx_pad_putn_void(void **xpp, size_t nchars, const void *vp); - -#endif /* _NCX_H_ */ diff --git a/xios_2311_src/trunk/.svn/pristine/06/06ae221ce9f206980ba38a2a70d0ea01093ad565.svn-base b/xios_2311_src/trunk/.svn/pristine/06/06ae221ce9f206980ba38a2a70d0ea01093ad565.svn-base deleted file mode 100644 index ab97007a1774e57a8e9ed1922bd6e96185afb850..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/06/06ae221ce9f206980ba38a2a70d0ea01093ad565.svn-base +++ /dev/null @@ -1,71 +0,0 @@ -/********************************************************************* - * Copyright 2010, UCAR/Unidata - * See netcdf/COPYRIGHT file for copying and redistribution conditions. - *********************************************************************/ - -#include "config.h" -#include "ncdispatch.h" - -extern int NC3_initialize(void); - -#ifdef USE_NETCDF4 -extern int NC4_initialize(void); -#endif - -#ifdef USE_DAP -extern int NCD3_initialize(void); -#ifdef USE_NETCDF4 -extern int NCD4_initialize(void); -#endif -#endif - -#ifdef USE_CDMREMOTE -extern int NCCR_initialize(void); -#endif - -#ifdef BUILD_RPC -extern int NCRPC_initialize(void); -#endif - -int -NC_initialize(void) -{ - int stat = NC_NOERR; - - /* Allow libdispatch to do initialization */ - if((stat = NCDISPATCH_initialize())) return stat; - - /* Initialize each active protocol */ - - if((stat = NC3_initialize())) return stat; - -#ifdef USE_DAP - if((stat = NCD3_initialize())) return stat; -#endif - -#ifdef USE_NETCDF4 - if((stat = NC4_initialize())) return stat; - - /* if((stat = NCD_initialize())) return stat; */ - -#ifdef USE_DAP -#ifdef NOTUSED - if((stat = NCD4_initialize())) return stat; -#endif -#endif - -#ifdef USE_CDMREMOTE - if((stat = NCCR_initialize())) return stat; -#endif - -#ifdef USE_RPC - if((stat = NCRPC_initialize())) return stat; -#endif - -#endif /* USE_NETCDF4 */ - - - return NC_NOERR; -} - - diff --git a/xios_2311_src/trunk/.svn/pristine/06/06c098773233f7b35015c0a0b52af22c4e12e575.svn-base b/xios_2311_src/trunk/.svn/pristine/06/06c098773233f7b35015c0a0b52af22c4e12e575.svn-base deleted file mode 100644 index 19c0247d76fe2188820f420e95ca36797ef42e19..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/06/06c098773233f7b35015c0a0b52af22c4e12e575.svn-base +++ /dev/null @@ -1,24 +0,0 @@ -/// Author /// -DECLARE_PROPERTY (StdString, AUTHOR, "OZDOBA Herve, MEURDESOIF Yann") - -/// Version number /// -DECLARE_PROPERTY (StdString, VERSION, "0.1") - -/// Time name /// -DECLARE_PROPERTY (StdString, TIME_NAME, "time") - -/// Output config /// -//DECLARE_PROPERTY (StdString, NETCDF_OUTPUT, "MULTI_FILE") // (ONE_FILE, TWO_FILE, MULTI_FILE) -DECLARE_PROPERTY (StdString, NETCDF_OUTPUT, "ONE_FILE") // (ONE_FILE, TWO_FILE, MULTI_FILE) -DECLARE_PROPERTY (StdString, FILE_SUFFIX, "_node" ) -DECLARE_PROPERTY (StdString, FILE_EXTENSION, ".nc" ) -DECLARE_PROPERTY (StdString, OUTPUT_PATH, "./data/" ) - -/// Default Value /// -DECLARE_PROPERTY (double, FIELD_DEFAULT_VALUE, 1E-10) - -/// Buffer Size /// -DECLARE_PROPERTY (StdSize, BUFFER_CLIENT_SIZE, 100E6) // 100 Mo -DECLARE_PROPERTY (StdSize, BUFFER_SERVER_SIZE, 1000E6) // 1000 Mo - - diff --git a/xios_2311_src/trunk/.svn/pristine/06/06e22b3bef1c755bf2062e6be9931af073213aa4.svn-base b/xios_2311_src/trunk/.svn/pristine/06/06e22b3bef1c755bf2062e6be9931af073213aa4.svn-base deleted file mode 100644 index 4902d32c3453ef68f0f2eb60e43073f158e22c7e..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/06/06e22b3bef1c755bf2062e6be9931af073213aa4.svn-base +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef __XIOS_NODE_TYPE__ -#define __XIOS_NODE_TYPE__ - -#include "axis.hpp" -#include "domain.hpp" -#include "field.hpp" -#include "file.hpp" -#include "coupler_in.hpp" -#include "coupler_out.hpp" -#include "grid.hpp" -#include "variable.hpp" -#include "context.hpp" -#include "transformation.hpp" -#include "inverse_axis.hpp" -#include "zoom_axis.hpp" -#include "interpolate_axis.hpp" -#include "extract_axis.hpp" -#include "zoom_domain.hpp" -#include "interpolate_domain.hpp" -#include "generate_rectilinear_domain.hpp" -#include "scalar.hpp" -#include "reduce_axis_to_scalar.hpp" -#include "reduce_domain_to_axis.hpp" -#include "reduce_axis_to_axis.hpp" -#include "extract_domain_to_axis.hpp" -#include "compute_connectivity_domain.hpp" -#include "expand_domain.hpp" -#include "extract_axis_to_scalar.hpp" -#include "reduce_domain_to_scalar.hpp" -#include "temporal_splitting.hpp" -#include "duplicate_scalar_to_axis.hpp" -#include "reduce_scalar_to_scalar.hpp" -#include "reorder_domain.hpp" -#include "extract_domain.hpp" - - -#endif // __XIOS_NODE_TYPE__ diff --git a/xios_2311_src/trunk/.svn/pristine/07/07d09b28bb3c3f22bc6f36013bd68c2d97c7ef8d.svn-base b/xios_2311_src/trunk/.svn/pristine/07/07d09b28bb3c3f22bc6f36013bd68c2d97c7ef8d.svn-base deleted file mode 100644 index b1c530d467f183162940532fd9ebffaf2b034d2b..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/07/07d09b28bb3c3f22bc6f36013bd68c2d97c7ef8d.svn-base +++ /dev/null @@ -1,41 +0,0 @@ -/*! - \file extract.hpp - \author Ha NGUYEN - \since 27 June 2016 - \date 27 June 2016 - - \brief Min reduction - */ -#ifndef __XIOS_REDUCTION_EXTRACT_ALGORITHM_HPP__ -#define __XIOS_REDUCTION_EXTRACT_ALGORITHM_HPP__ - -#include "reduction.hpp" - -namespace xios { - -/*! - \class CExtractReductionAlgorithm - Interface for all reduction alogrithms. -*/ -class CExtractReductionAlgorithm : public CReductionAlgorithm -{ -public: - CExtractReductionAlgorithm(); - - virtual void apply(const std::vector >& localIndex, - const double* dataInput, - CArray& dataOut, - std::vector& flagInitial, - bool ignoreMissingValue, bool firstPass); - - virtual ~CExtractReductionAlgorithm() {} - -public: - static bool registerTrans(); - -protected: - static CReductionAlgorithm* create(); -}; - -} -#endif // __XIOS_REDUCTION_EXTRACT_ALGORITHM_HPP__ diff --git a/xios_2311_src/trunk/.svn/pristine/08/084ec5864c77428e5ec400f8a10cf617b21d3df3.svn-base b/xios_2311_src/trunk/.svn/pristine/08/084ec5864c77428e5ec400f8a10cf617b21d3df3.svn-base deleted file mode 100644 index 719a9882ed68b42e5e942a82879cff4b72ae136c..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/08/084ec5864c77428e5ec400f8a10cf617b21d3df3.svn-base +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "Domain": ["nemo"], - "NumberServers": [2], - "DomMask": ["false","true"], - "AxisMask": ["false"] - } -] diff --git a/xios_2311_src/trunk/.svn/pristine/08/086ca47bf552f86fbe7bd59177c5591fd66081c6.svn-base b/xios_2311_src/trunk/.svn/pristine/08/086ca47bf552f86fbe7bd59177c5591fd66081c6.svn-base deleted file mode 100644 index 7988c9d991fcb0c618e36616235d3957d740bf2a..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/08/086ca47bf552f86fbe7bd59177c5591fd66081c6.svn-base +++ /dev/null @@ -1,1144 +0,0 @@ -! * ************************************************************************** * -! * Interface auto generated - do not modify * -! * ************************************************************************** * -#include "xios_fortran_prefix.hpp" - -MODULE ifieldgroup_attr - USE, INTRINSIC :: ISO_C_BINDING - USE ifield - USE fieldgroup_interface_attr - -CONTAINS - - SUBROUTINE xios(set_fieldgroup_attr) & - ( fieldgroup_id, add_offset, axis_ref, cell_methods, cell_methods_mode, check_if_active, comment & - , compression_level, default_value, detect_missing_value, domain_ref, enabled, expr, field_ref & - , freq_offset, freq_op, grid_path, grid_ref, group_ref, indexed_output, level, long_name, name & - , operation, prec, read_access, scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq & - , unit, valid_max, valid_min ) - - IMPLICIT NONE - TYPE(txios(fieldgroup)) :: fieldgroup_hdl - CHARACTER(LEN=*), INTENT(IN) ::fieldgroup_id - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: add_offset - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: axis_ref - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: cell_methods - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: cell_methods_mode - LOGICAL , OPTIONAL, INTENT(IN) :: check_if_active - LOGICAL (KIND=C_BOOL) :: check_if_active_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: comment - INTEGER , OPTIONAL, INTENT(IN) :: compression_level - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: default_value - LOGICAL , OPTIONAL, INTENT(IN) :: detect_missing_value - LOGICAL (KIND=C_BOOL) :: detect_missing_value_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: domain_ref - LOGICAL , OPTIONAL, INTENT(IN) :: enabled - LOGICAL (KIND=C_BOOL) :: enabled_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: expr - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: field_ref - TYPE(txios(duration)) , OPTIONAL, INTENT(IN) :: freq_offset - TYPE(txios(duration)) , OPTIONAL, INTENT(IN) :: freq_op - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: grid_path - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: grid_ref - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: group_ref - LOGICAL , OPTIONAL, INTENT(IN) :: indexed_output - LOGICAL (KIND=C_BOOL) :: indexed_output_tmp - INTEGER , OPTIONAL, INTENT(IN) :: level - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: long_name - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: operation - INTEGER , OPTIONAL, INTENT(IN) :: prec - LOGICAL , OPTIONAL, INTENT(IN) :: read_access - LOGICAL (KIND=C_BOOL) :: read_access_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: scalar_ref - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: scale_factor - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: standard_name - LOGICAL , OPTIONAL, INTENT(IN) :: ts_enabled - LOGICAL (KIND=C_BOOL) :: ts_enabled_tmp - TYPE(txios(duration)) , OPTIONAL, INTENT(IN) :: ts_split_freq - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: unit - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: valid_max - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: valid_min - - CALL xios(get_fieldgroup_handle) & - (fieldgroup_id,fieldgroup_hdl) - CALL xios(set_fieldgroup_attr_hdl_) & - ( fieldgroup_hdl, add_offset, axis_ref, cell_methods, cell_methods_mode, check_if_active, comment & - , compression_level, default_value, detect_missing_value, domain_ref, enabled, expr, field_ref & - , freq_offset, freq_op, grid_path, grid_ref, group_ref, indexed_output, level, long_name, name & - , operation, prec, read_access, scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq & - , unit, valid_max, valid_min ) - - END SUBROUTINE xios(set_fieldgroup_attr) - - SUBROUTINE xios(set_fieldgroup_attr_hdl) & - ( fieldgroup_hdl, add_offset, axis_ref, cell_methods, cell_methods_mode, check_if_active, comment & - , compression_level, default_value, detect_missing_value, domain_ref, enabled, expr, field_ref & - , freq_offset, freq_op, grid_path, grid_ref, group_ref, indexed_output, level, long_name, name & - , operation, prec, read_access, scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq & - , unit, valid_max, valid_min ) - - IMPLICIT NONE - TYPE(txios(fieldgroup)) , INTENT(IN) :: fieldgroup_hdl - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: add_offset - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: axis_ref - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: cell_methods - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: cell_methods_mode - LOGICAL , OPTIONAL, INTENT(IN) :: check_if_active - LOGICAL (KIND=C_BOOL) :: check_if_active_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: comment - INTEGER , OPTIONAL, INTENT(IN) :: compression_level - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: default_value - LOGICAL , OPTIONAL, INTENT(IN) :: detect_missing_value - LOGICAL (KIND=C_BOOL) :: detect_missing_value_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: domain_ref - LOGICAL , OPTIONAL, INTENT(IN) :: enabled - LOGICAL (KIND=C_BOOL) :: enabled_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: expr - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: field_ref - TYPE(txios(duration)) , OPTIONAL, INTENT(IN) :: freq_offset - TYPE(txios(duration)) , OPTIONAL, INTENT(IN) :: freq_op - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: grid_path - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: grid_ref - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: group_ref - LOGICAL , OPTIONAL, INTENT(IN) :: indexed_output - LOGICAL (KIND=C_BOOL) :: indexed_output_tmp - INTEGER , OPTIONAL, INTENT(IN) :: level - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: long_name - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: operation - INTEGER , OPTIONAL, INTENT(IN) :: prec - LOGICAL , OPTIONAL, INTENT(IN) :: read_access - LOGICAL (KIND=C_BOOL) :: read_access_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: scalar_ref - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: scale_factor - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: standard_name - LOGICAL , OPTIONAL, INTENT(IN) :: ts_enabled - LOGICAL (KIND=C_BOOL) :: ts_enabled_tmp - TYPE(txios(duration)) , OPTIONAL, INTENT(IN) :: ts_split_freq - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: unit - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: valid_max - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: valid_min - - CALL xios(set_fieldgroup_attr_hdl_) & - ( fieldgroup_hdl, add_offset, axis_ref, cell_methods, cell_methods_mode, check_if_active, comment & - , compression_level, default_value, detect_missing_value, domain_ref, enabled, expr, field_ref & - , freq_offset, freq_op, grid_path, grid_ref, group_ref, indexed_output, level, long_name, name & - , operation, prec, read_access, scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq & - , unit, valid_max, valid_min ) - - END SUBROUTINE xios(set_fieldgroup_attr_hdl) - - SUBROUTINE xios(set_fieldgroup_attr_hdl_) & - ( fieldgroup_hdl, add_offset_, axis_ref_, cell_methods_, cell_methods_mode_, check_if_active_ & - , comment_, compression_level_, default_value_, detect_missing_value_, domain_ref_, enabled_ & - , expr_, field_ref_, freq_offset_, freq_op_, grid_path_, grid_ref_, group_ref_, indexed_output_ & - , level_, long_name_, name_, operation_, prec_, read_access_, scalar_ref_, scale_factor_, standard_name_ & - , ts_enabled_, ts_split_freq_, unit_, valid_max_, valid_min_ ) - - IMPLICIT NONE - TYPE(txios(fieldgroup)) , INTENT(IN) :: fieldgroup_hdl - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: add_offset_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: axis_ref_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: cell_methods_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: cell_methods_mode_ - LOGICAL , OPTIONAL, INTENT(IN) :: check_if_active_ - LOGICAL (KIND=C_BOOL) :: check_if_active__tmp - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: comment_ - INTEGER , OPTIONAL, INTENT(IN) :: compression_level_ - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: default_value_ - LOGICAL , OPTIONAL, INTENT(IN) :: detect_missing_value_ - LOGICAL (KIND=C_BOOL) :: detect_missing_value__tmp - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: domain_ref_ - LOGICAL , OPTIONAL, INTENT(IN) :: enabled_ - LOGICAL (KIND=C_BOOL) :: enabled__tmp - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: expr_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: field_ref_ - TYPE(txios(duration)) , OPTIONAL, INTENT(IN) :: freq_offset_ - TYPE(txios(duration)) , OPTIONAL, INTENT(IN) :: freq_op_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: grid_path_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: grid_ref_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: group_ref_ - LOGICAL , OPTIONAL, INTENT(IN) :: indexed_output_ - LOGICAL (KIND=C_BOOL) :: indexed_output__tmp - INTEGER , OPTIONAL, INTENT(IN) :: level_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: long_name_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: operation_ - INTEGER , OPTIONAL, INTENT(IN) :: prec_ - LOGICAL , OPTIONAL, INTENT(IN) :: read_access_ - LOGICAL (KIND=C_BOOL) :: read_access__tmp - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: scalar_ref_ - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: scale_factor_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: standard_name_ - LOGICAL , OPTIONAL, INTENT(IN) :: ts_enabled_ - LOGICAL (KIND=C_BOOL) :: ts_enabled__tmp - TYPE(txios(duration)) , OPTIONAL, INTENT(IN) :: ts_split_freq_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: unit_ - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: valid_max_ - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: valid_min_ - - IF (PRESENT(add_offset_)) THEN - CALL cxios_set_fieldgroup_add_offset & - (fieldgroup_hdl%daddr, add_offset_) - ENDIF - - IF (PRESENT(axis_ref_)) THEN - CALL cxios_set_fieldgroup_axis_ref & - (fieldgroup_hdl%daddr, axis_ref_, len(axis_ref_)) - ENDIF - - IF (PRESENT(cell_methods_)) THEN - CALL cxios_set_fieldgroup_cell_methods & - (fieldgroup_hdl%daddr, cell_methods_, len(cell_methods_)) - ENDIF - - IF (PRESENT(cell_methods_mode_)) THEN - CALL cxios_set_fieldgroup_cell_methods_mode & - (fieldgroup_hdl%daddr, cell_methods_mode_, len(cell_methods_mode_)) - ENDIF - - IF (PRESENT(check_if_active_)) THEN - check_if_active__tmp = check_if_active_ - CALL cxios_set_fieldgroup_check_if_active & - (fieldgroup_hdl%daddr, check_if_active__tmp) - ENDIF - - IF (PRESENT(comment_)) THEN - CALL cxios_set_fieldgroup_comment & - (fieldgroup_hdl%daddr, comment_, len(comment_)) - ENDIF - - IF (PRESENT(compression_level_)) THEN - CALL cxios_set_fieldgroup_compression_level & - (fieldgroup_hdl%daddr, compression_level_) - ENDIF - - IF (PRESENT(default_value_)) THEN - CALL cxios_set_fieldgroup_default_value & - (fieldgroup_hdl%daddr, default_value_) - ENDIF - - IF (PRESENT(detect_missing_value_)) THEN - detect_missing_value__tmp = detect_missing_value_ - CALL cxios_set_fieldgroup_detect_missing_value & - (fieldgroup_hdl%daddr, detect_missing_value__tmp) - ENDIF - - IF (PRESENT(domain_ref_)) THEN - CALL cxios_set_fieldgroup_domain_ref & - (fieldgroup_hdl%daddr, domain_ref_, len(domain_ref_)) - ENDIF - - IF (PRESENT(enabled_)) THEN - enabled__tmp = enabled_ - CALL cxios_set_fieldgroup_enabled & - (fieldgroup_hdl%daddr, enabled__tmp) - ENDIF - - IF (PRESENT(expr_)) THEN - CALL cxios_set_fieldgroup_expr & - (fieldgroup_hdl%daddr, expr_, len(expr_)) - ENDIF - - IF (PRESENT(field_ref_)) THEN - CALL cxios_set_fieldgroup_field_ref & - (fieldgroup_hdl%daddr, field_ref_, len(field_ref_)) - ENDIF - - IF (PRESENT(freq_offset_)) THEN - CALL cxios_set_fieldgroup_freq_offset & - (fieldgroup_hdl%daddr, freq_offset_) - ENDIF - - IF (PRESENT(freq_op_)) THEN - CALL cxios_set_fieldgroup_freq_op & - (fieldgroup_hdl%daddr, freq_op_) - ENDIF - - IF (PRESENT(grid_path_)) THEN - CALL cxios_set_fieldgroup_grid_path & - (fieldgroup_hdl%daddr, grid_path_, len(grid_path_)) - ENDIF - - IF (PRESENT(grid_ref_)) THEN - CALL cxios_set_fieldgroup_grid_ref & - (fieldgroup_hdl%daddr, grid_ref_, len(grid_ref_)) - ENDIF - - IF (PRESENT(group_ref_)) THEN - CALL cxios_set_fieldgroup_group_ref & - (fieldgroup_hdl%daddr, group_ref_, len(group_ref_)) - ENDIF - - IF (PRESENT(indexed_output_)) THEN - indexed_output__tmp = indexed_output_ - CALL cxios_set_fieldgroup_indexed_output & - (fieldgroup_hdl%daddr, indexed_output__tmp) - ENDIF - - IF (PRESENT(level_)) THEN - CALL cxios_set_fieldgroup_level & - (fieldgroup_hdl%daddr, level_) - ENDIF - - IF (PRESENT(long_name_)) THEN - CALL cxios_set_fieldgroup_long_name & - (fieldgroup_hdl%daddr, long_name_, len(long_name_)) - ENDIF - - IF (PRESENT(name_)) THEN - CALL cxios_set_fieldgroup_name & - (fieldgroup_hdl%daddr, name_, len(name_)) - ENDIF - - IF (PRESENT(operation_)) THEN - CALL cxios_set_fieldgroup_operation & - (fieldgroup_hdl%daddr, operation_, len(operation_)) - ENDIF - - IF (PRESENT(prec_)) THEN - CALL cxios_set_fieldgroup_prec & - (fieldgroup_hdl%daddr, prec_) - ENDIF - - IF (PRESENT(read_access_)) THEN - read_access__tmp = read_access_ - CALL cxios_set_fieldgroup_read_access & - (fieldgroup_hdl%daddr, read_access__tmp) - ENDIF - - IF (PRESENT(scalar_ref_)) THEN - CALL cxios_set_fieldgroup_scalar_ref & - (fieldgroup_hdl%daddr, scalar_ref_, len(scalar_ref_)) - ENDIF - - IF (PRESENT(scale_factor_)) THEN - CALL cxios_set_fieldgroup_scale_factor & - (fieldgroup_hdl%daddr, scale_factor_) - ENDIF - - IF (PRESENT(standard_name_)) THEN - CALL cxios_set_fieldgroup_standard_name & - (fieldgroup_hdl%daddr, standard_name_, len(standard_name_)) - ENDIF - - IF (PRESENT(ts_enabled_)) THEN - ts_enabled__tmp = ts_enabled_ - CALL cxios_set_fieldgroup_ts_enabled & - (fieldgroup_hdl%daddr, ts_enabled__tmp) - ENDIF - - IF (PRESENT(ts_split_freq_)) THEN - CALL cxios_set_fieldgroup_ts_split_freq & - (fieldgroup_hdl%daddr, ts_split_freq_) - ENDIF - - IF (PRESENT(unit_)) THEN - CALL cxios_set_fieldgroup_unit & - (fieldgroup_hdl%daddr, unit_, len(unit_)) - ENDIF - - IF (PRESENT(valid_max_)) THEN - CALL cxios_set_fieldgroup_valid_max & - (fieldgroup_hdl%daddr, valid_max_) - ENDIF - - IF (PRESENT(valid_min_)) THEN - CALL cxios_set_fieldgroup_valid_min & - (fieldgroup_hdl%daddr, valid_min_) - ENDIF - - END SUBROUTINE xios(set_fieldgroup_attr_hdl_) - - SUBROUTINE xios(get_fieldgroup_attr) & - ( fieldgroup_id, add_offset, axis_ref, cell_methods, cell_methods_mode, check_if_active, comment & - , compression_level, default_value, detect_missing_value, domain_ref, enabled, expr, field_ref & - , freq_offset, freq_op, grid_path, grid_ref, group_ref, indexed_output, level, long_name, name & - , operation, prec, read_access, scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq & - , unit, valid_max, valid_min ) - - IMPLICIT NONE - TYPE(txios(fieldgroup)) :: fieldgroup_hdl - CHARACTER(LEN=*), INTENT(IN) ::fieldgroup_id - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: add_offset - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: axis_ref - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: cell_methods - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: cell_methods_mode - LOGICAL , OPTIONAL, INTENT(OUT) :: check_if_active - LOGICAL (KIND=C_BOOL) :: check_if_active_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: comment - INTEGER , OPTIONAL, INTENT(OUT) :: compression_level - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: default_value - LOGICAL , OPTIONAL, INTENT(OUT) :: detect_missing_value - LOGICAL (KIND=C_BOOL) :: detect_missing_value_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: domain_ref - LOGICAL , OPTIONAL, INTENT(OUT) :: enabled - LOGICAL (KIND=C_BOOL) :: enabled_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: expr - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: field_ref - TYPE(txios(duration)) , OPTIONAL, INTENT(OUT) :: freq_offset - TYPE(txios(duration)) , OPTIONAL, INTENT(OUT) :: freq_op - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: grid_path - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: grid_ref - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: group_ref - LOGICAL , OPTIONAL, INTENT(OUT) :: indexed_output - LOGICAL (KIND=C_BOOL) :: indexed_output_tmp - INTEGER , OPTIONAL, INTENT(OUT) :: level - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: long_name - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: operation - INTEGER , OPTIONAL, INTENT(OUT) :: prec - LOGICAL , OPTIONAL, INTENT(OUT) :: read_access - LOGICAL (KIND=C_BOOL) :: read_access_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: scalar_ref - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: scale_factor - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: standard_name - LOGICAL , OPTIONAL, INTENT(OUT) :: ts_enabled - LOGICAL (KIND=C_BOOL) :: ts_enabled_tmp - TYPE(txios(duration)) , OPTIONAL, INTENT(OUT) :: ts_split_freq - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: unit - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: valid_max - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: valid_min - - CALL xios(get_fieldgroup_handle) & - (fieldgroup_id,fieldgroup_hdl) - CALL xios(get_fieldgroup_attr_hdl_) & - ( fieldgroup_hdl, add_offset, axis_ref, cell_methods, cell_methods_mode, check_if_active, comment & - , compression_level, default_value, detect_missing_value, domain_ref, enabled, expr, field_ref & - , freq_offset, freq_op, grid_path, grid_ref, group_ref, indexed_output, level, long_name, name & - , operation, prec, read_access, scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq & - , unit, valid_max, valid_min ) - - END SUBROUTINE xios(get_fieldgroup_attr) - - SUBROUTINE xios(get_fieldgroup_attr_hdl) & - ( fieldgroup_hdl, add_offset, axis_ref, cell_methods, cell_methods_mode, check_if_active, comment & - , compression_level, default_value, detect_missing_value, domain_ref, enabled, expr, field_ref & - , freq_offset, freq_op, grid_path, grid_ref, group_ref, indexed_output, level, long_name, name & - , operation, prec, read_access, scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq & - , unit, valid_max, valid_min ) - - IMPLICIT NONE - TYPE(txios(fieldgroup)) , INTENT(IN) :: fieldgroup_hdl - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: add_offset - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: axis_ref - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: cell_methods - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: cell_methods_mode - LOGICAL , OPTIONAL, INTENT(OUT) :: check_if_active - LOGICAL (KIND=C_BOOL) :: check_if_active_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: comment - INTEGER , OPTIONAL, INTENT(OUT) :: compression_level - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: default_value - LOGICAL , OPTIONAL, INTENT(OUT) :: detect_missing_value - LOGICAL (KIND=C_BOOL) :: detect_missing_value_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: domain_ref - LOGICAL , OPTIONAL, INTENT(OUT) :: enabled - LOGICAL (KIND=C_BOOL) :: enabled_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: expr - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: field_ref - TYPE(txios(duration)) , OPTIONAL, INTENT(OUT) :: freq_offset - TYPE(txios(duration)) , OPTIONAL, INTENT(OUT) :: freq_op - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: grid_path - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: grid_ref - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: group_ref - LOGICAL , OPTIONAL, INTENT(OUT) :: indexed_output - LOGICAL (KIND=C_BOOL) :: indexed_output_tmp - INTEGER , OPTIONAL, INTENT(OUT) :: level - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: long_name - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: operation - INTEGER , OPTIONAL, INTENT(OUT) :: prec - LOGICAL , OPTIONAL, INTENT(OUT) :: read_access - LOGICAL (KIND=C_BOOL) :: read_access_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: scalar_ref - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: scale_factor - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: standard_name - LOGICAL , OPTIONAL, INTENT(OUT) :: ts_enabled - LOGICAL (KIND=C_BOOL) :: ts_enabled_tmp - TYPE(txios(duration)) , OPTIONAL, INTENT(OUT) :: ts_split_freq - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: unit - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: valid_max - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: valid_min - - CALL xios(get_fieldgroup_attr_hdl_) & - ( fieldgroup_hdl, add_offset, axis_ref, cell_methods, cell_methods_mode, check_if_active, comment & - , compression_level, default_value, detect_missing_value, domain_ref, enabled, expr, field_ref & - , freq_offset, freq_op, grid_path, grid_ref, group_ref, indexed_output, level, long_name, name & - , operation, prec, read_access, scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq & - , unit, valid_max, valid_min ) - - END SUBROUTINE xios(get_fieldgroup_attr_hdl) - - SUBROUTINE xios(get_fieldgroup_attr_hdl_) & - ( fieldgroup_hdl, add_offset_, axis_ref_, cell_methods_, cell_methods_mode_, check_if_active_ & - , comment_, compression_level_, default_value_, detect_missing_value_, domain_ref_, enabled_ & - , expr_, field_ref_, freq_offset_, freq_op_, grid_path_, grid_ref_, group_ref_, indexed_output_ & - , level_, long_name_, name_, operation_, prec_, read_access_, scalar_ref_, scale_factor_, standard_name_ & - , ts_enabled_, ts_split_freq_, unit_, valid_max_, valid_min_ ) - - IMPLICIT NONE - TYPE(txios(fieldgroup)) , INTENT(IN) :: fieldgroup_hdl - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: add_offset_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: axis_ref_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: cell_methods_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: cell_methods_mode_ - LOGICAL , OPTIONAL, INTENT(OUT) :: check_if_active_ - LOGICAL (KIND=C_BOOL) :: check_if_active__tmp - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: comment_ - INTEGER , OPTIONAL, INTENT(OUT) :: compression_level_ - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: default_value_ - LOGICAL , OPTIONAL, INTENT(OUT) :: detect_missing_value_ - LOGICAL (KIND=C_BOOL) :: detect_missing_value__tmp - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: domain_ref_ - LOGICAL , OPTIONAL, INTENT(OUT) :: enabled_ - LOGICAL (KIND=C_BOOL) :: enabled__tmp - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: expr_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: field_ref_ - TYPE(txios(duration)) , OPTIONAL, INTENT(OUT) :: freq_offset_ - TYPE(txios(duration)) , OPTIONAL, INTENT(OUT) :: freq_op_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: grid_path_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: grid_ref_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: group_ref_ - LOGICAL , OPTIONAL, INTENT(OUT) :: indexed_output_ - LOGICAL (KIND=C_BOOL) :: indexed_output__tmp - INTEGER , OPTIONAL, INTENT(OUT) :: level_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: long_name_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: operation_ - INTEGER , OPTIONAL, INTENT(OUT) :: prec_ - LOGICAL , OPTIONAL, INTENT(OUT) :: read_access_ - LOGICAL (KIND=C_BOOL) :: read_access__tmp - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: scalar_ref_ - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: scale_factor_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: standard_name_ - LOGICAL , OPTIONAL, INTENT(OUT) :: ts_enabled_ - LOGICAL (KIND=C_BOOL) :: ts_enabled__tmp - TYPE(txios(duration)) , OPTIONAL, INTENT(OUT) :: ts_split_freq_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: unit_ - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: valid_max_ - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: valid_min_ - - IF (PRESENT(add_offset_)) THEN - CALL cxios_get_fieldgroup_add_offset & - (fieldgroup_hdl%daddr, add_offset_) - ENDIF - - IF (PRESENT(axis_ref_)) THEN - CALL cxios_get_fieldgroup_axis_ref & - (fieldgroup_hdl%daddr, axis_ref_, len(axis_ref_)) - ENDIF - - IF (PRESENT(cell_methods_)) THEN - CALL cxios_get_fieldgroup_cell_methods & - (fieldgroup_hdl%daddr, cell_methods_, len(cell_methods_)) - ENDIF - - IF (PRESENT(cell_methods_mode_)) THEN - CALL cxios_get_fieldgroup_cell_methods_mode & - (fieldgroup_hdl%daddr, cell_methods_mode_, len(cell_methods_mode_)) - ENDIF - - IF (PRESENT(check_if_active_)) THEN - CALL cxios_get_fieldgroup_check_if_active & - (fieldgroup_hdl%daddr, check_if_active__tmp) - check_if_active_ = check_if_active__tmp - ENDIF - - IF (PRESENT(comment_)) THEN - CALL cxios_get_fieldgroup_comment & - (fieldgroup_hdl%daddr, comment_, len(comment_)) - ENDIF - - IF (PRESENT(compression_level_)) THEN - CALL cxios_get_fieldgroup_compression_level & - (fieldgroup_hdl%daddr, compression_level_) - ENDIF - - IF (PRESENT(default_value_)) THEN - CALL cxios_get_fieldgroup_default_value & - (fieldgroup_hdl%daddr, default_value_) - ENDIF - - IF (PRESENT(detect_missing_value_)) THEN - CALL cxios_get_fieldgroup_detect_missing_value & - (fieldgroup_hdl%daddr, detect_missing_value__tmp) - detect_missing_value_ = detect_missing_value__tmp - ENDIF - - IF (PRESENT(domain_ref_)) THEN - CALL cxios_get_fieldgroup_domain_ref & - (fieldgroup_hdl%daddr, domain_ref_, len(domain_ref_)) - ENDIF - - IF (PRESENT(enabled_)) THEN - CALL cxios_get_fieldgroup_enabled & - (fieldgroup_hdl%daddr, enabled__tmp) - enabled_ = enabled__tmp - ENDIF - - IF (PRESENT(expr_)) THEN - CALL cxios_get_fieldgroup_expr & - (fieldgroup_hdl%daddr, expr_, len(expr_)) - ENDIF - - IF (PRESENT(field_ref_)) THEN - CALL cxios_get_fieldgroup_field_ref & - (fieldgroup_hdl%daddr, field_ref_, len(field_ref_)) - ENDIF - - IF (PRESENT(freq_offset_)) THEN - CALL cxios_get_fieldgroup_freq_offset & - (fieldgroup_hdl%daddr, freq_offset_) - ENDIF - - IF (PRESENT(freq_op_)) THEN - CALL cxios_get_fieldgroup_freq_op & - (fieldgroup_hdl%daddr, freq_op_) - ENDIF - - IF (PRESENT(grid_path_)) THEN - CALL cxios_get_fieldgroup_grid_path & - (fieldgroup_hdl%daddr, grid_path_, len(grid_path_)) - ENDIF - - IF (PRESENT(grid_ref_)) THEN - CALL cxios_get_fieldgroup_grid_ref & - (fieldgroup_hdl%daddr, grid_ref_, len(grid_ref_)) - ENDIF - - IF (PRESENT(group_ref_)) THEN - CALL cxios_get_fieldgroup_group_ref & - (fieldgroup_hdl%daddr, group_ref_, len(group_ref_)) - ENDIF - - IF (PRESENT(indexed_output_)) THEN - CALL cxios_get_fieldgroup_indexed_output & - (fieldgroup_hdl%daddr, indexed_output__tmp) - indexed_output_ = indexed_output__tmp - ENDIF - - IF (PRESENT(level_)) THEN - CALL cxios_get_fieldgroup_level & - (fieldgroup_hdl%daddr, level_) - ENDIF - - IF (PRESENT(long_name_)) THEN - CALL cxios_get_fieldgroup_long_name & - (fieldgroup_hdl%daddr, long_name_, len(long_name_)) - ENDIF - - IF (PRESENT(name_)) THEN - CALL cxios_get_fieldgroup_name & - (fieldgroup_hdl%daddr, name_, len(name_)) - ENDIF - - IF (PRESENT(operation_)) THEN - CALL cxios_get_fieldgroup_operation & - (fieldgroup_hdl%daddr, operation_, len(operation_)) - ENDIF - - IF (PRESENT(prec_)) THEN - CALL cxios_get_fieldgroup_prec & - (fieldgroup_hdl%daddr, prec_) - ENDIF - - IF (PRESENT(read_access_)) THEN - CALL cxios_get_fieldgroup_read_access & - (fieldgroup_hdl%daddr, read_access__tmp) - read_access_ = read_access__tmp - ENDIF - - IF (PRESENT(scalar_ref_)) THEN - CALL cxios_get_fieldgroup_scalar_ref & - (fieldgroup_hdl%daddr, scalar_ref_, len(scalar_ref_)) - ENDIF - - IF (PRESENT(scale_factor_)) THEN - CALL cxios_get_fieldgroup_scale_factor & - (fieldgroup_hdl%daddr, scale_factor_) - ENDIF - - IF (PRESENT(standard_name_)) THEN - CALL cxios_get_fieldgroup_standard_name & - (fieldgroup_hdl%daddr, standard_name_, len(standard_name_)) - ENDIF - - IF (PRESENT(ts_enabled_)) THEN - CALL cxios_get_fieldgroup_ts_enabled & - (fieldgroup_hdl%daddr, ts_enabled__tmp) - ts_enabled_ = ts_enabled__tmp - ENDIF - - IF (PRESENT(ts_split_freq_)) THEN - CALL cxios_get_fieldgroup_ts_split_freq & - (fieldgroup_hdl%daddr, ts_split_freq_) - ENDIF - - IF (PRESENT(unit_)) THEN - CALL cxios_get_fieldgroup_unit & - (fieldgroup_hdl%daddr, unit_, len(unit_)) - ENDIF - - IF (PRESENT(valid_max_)) THEN - CALL cxios_get_fieldgroup_valid_max & - (fieldgroup_hdl%daddr, valid_max_) - ENDIF - - IF (PRESENT(valid_min_)) THEN - CALL cxios_get_fieldgroup_valid_min & - (fieldgroup_hdl%daddr, valid_min_) - ENDIF - - END SUBROUTINE xios(get_fieldgroup_attr_hdl_) - - SUBROUTINE xios(is_defined_fieldgroup_attr) & - ( fieldgroup_id, add_offset, axis_ref, cell_methods, cell_methods_mode, check_if_active, comment & - , compression_level, default_value, detect_missing_value, domain_ref, enabled, expr, field_ref & - , freq_offset, freq_op, grid_path, grid_ref, group_ref, indexed_output, level, long_name, name & - , operation, prec, read_access, scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq & - , unit, valid_max, valid_min ) - - IMPLICIT NONE - TYPE(txios(fieldgroup)) :: fieldgroup_hdl - CHARACTER(LEN=*), INTENT(IN) ::fieldgroup_id - LOGICAL, OPTIONAL, INTENT(OUT) :: add_offset - LOGICAL(KIND=C_BOOL) :: add_offset_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: axis_ref - LOGICAL(KIND=C_BOOL) :: axis_ref_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: cell_methods - LOGICAL(KIND=C_BOOL) :: cell_methods_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: cell_methods_mode - LOGICAL(KIND=C_BOOL) :: cell_methods_mode_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: check_if_active - LOGICAL(KIND=C_BOOL) :: check_if_active_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: comment - LOGICAL(KIND=C_BOOL) :: comment_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: compression_level - LOGICAL(KIND=C_BOOL) :: compression_level_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: default_value - LOGICAL(KIND=C_BOOL) :: default_value_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: detect_missing_value - LOGICAL(KIND=C_BOOL) :: detect_missing_value_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: domain_ref - LOGICAL(KIND=C_BOOL) :: domain_ref_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: enabled - LOGICAL(KIND=C_BOOL) :: enabled_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: expr - LOGICAL(KIND=C_BOOL) :: expr_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: field_ref - LOGICAL(KIND=C_BOOL) :: field_ref_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: freq_offset - LOGICAL(KIND=C_BOOL) :: freq_offset_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: freq_op - LOGICAL(KIND=C_BOOL) :: freq_op_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: grid_path - LOGICAL(KIND=C_BOOL) :: grid_path_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: grid_ref - LOGICAL(KIND=C_BOOL) :: grid_ref_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: group_ref - LOGICAL(KIND=C_BOOL) :: group_ref_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: indexed_output - LOGICAL(KIND=C_BOOL) :: indexed_output_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: level - LOGICAL(KIND=C_BOOL) :: level_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: long_name - LOGICAL(KIND=C_BOOL) :: long_name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: name - LOGICAL(KIND=C_BOOL) :: name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: operation - LOGICAL(KIND=C_BOOL) :: operation_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: prec - LOGICAL(KIND=C_BOOL) :: prec_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: read_access - LOGICAL(KIND=C_BOOL) :: read_access_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: scalar_ref - LOGICAL(KIND=C_BOOL) :: scalar_ref_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: scale_factor - LOGICAL(KIND=C_BOOL) :: scale_factor_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: standard_name - LOGICAL(KIND=C_BOOL) :: standard_name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: ts_enabled - LOGICAL(KIND=C_BOOL) :: ts_enabled_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: ts_split_freq - LOGICAL(KIND=C_BOOL) :: ts_split_freq_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: unit - LOGICAL(KIND=C_BOOL) :: unit_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: valid_max - LOGICAL(KIND=C_BOOL) :: valid_max_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: valid_min - LOGICAL(KIND=C_BOOL) :: valid_min_tmp - - CALL xios(get_fieldgroup_handle) & - (fieldgroup_id,fieldgroup_hdl) - CALL xios(is_defined_fieldgroup_attr_hdl_) & - ( fieldgroup_hdl, add_offset, axis_ref, cell_methods, cell_methods_mode, check_if_active, comment & - , compression_level, default_value, detect_missing_value, domain_ref, enabled, expr, field_ref & - , freq_offset, freq_op, grid_path, grid_ref, group_ref, indexed_output, level, long_name, name & - , operation, prec, read_access, scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq & - , unit, valid_max, valid_min ) - - END SUBROUTINE xios(is_defined_fieldgroup_attr) - - SUBROUTINE xios(is_defined_fieldgroup_attr_hdl) & - ( fieldgroup_hdl, add_offset, axis_ref, cell_methods, cell_methods_mode, check_if_active, comment & - , compression_level, default_value, detect_missing_value, domain_ref, enabled, expr, field_ref & - , freq_offset, freq_op, grid_path, grid_ref, group_ref, indexed_output, level, long_name, name & - , operation, prec, read_access, scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq & - , unit, valid_max, valid_min ) - - IMPLICIT NONE - TYPE(txios(fieldgroup)) , INTENT(IN) :: fieldgroup_hdl - LOGICAL, OPTIONAL, INTENT(OUT) :: add_offset - LOGICAL(KIND=C_BOOL) :: add_offset_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: axis_ref - LOGICAL(KIND=C_BOOL) :: axis_ref_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: cell_methods - LOGICAL(KIND=C_BOOL) :: cell_methods_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: cell_methods_mode - LOGICAL(KIND=C_BOOL) :: cell_methods_mode_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: check_if_active - LOGICAL(KIND=C_BOOL) :: check_if_active_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: comment - LOGICAL(KIND=C_BOOL) :: comment_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: compression_level - LOGICAL(KIND=C_BOOL) :: compression_level_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: default_value - LOGICAL(KIND=C_BOOL) :: default_value_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: detect_missing_value - LOGICAL(KIND=C_BOOL) :: detect_missing_value_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: domain_ref - LOGICAL(KIND=C_BOOL) :: domain_ref_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: enabled - LOGICAL(KIND=C_BOOL) :: enabled_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: expr - LOGICAL(KIND=C_BOOL) :: expr_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: field_ref - LOGICAL(KIND=C_BOOL) :: field_ref_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: freq_offset - LOGICAL(KIND=C_BOOL) :: freq_offset_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: freq_op - LOGICAL(KIND=C_BOOL) :: freq_op_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: grid_path - LOGICAL(KIND=C_BOOL) :: grid_path_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: grid_ref - LOGICAL(KIND=C_BOOL) :: grid_ref_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: group_ref - LOGICAL(KIND=C_BOOL) :: group_ref_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: indexed_output - LOGICAL(KIND=C_BOOL) :: indexed_output_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: level - LOGICAL(KIND=C_BOOL) :: level_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: long_name - LOGICAL(KIND=C_BOOL) :: long_name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: name - LOGICAL(KIND=C_BOOL) :: name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: operation - LOGICAL(KIND=C_BOOL) :: operation_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: prec - LOGICAL(KIND=C_BOOL) :: prec_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: read_access - LOGICAL(KIND=C_BOOL) :: read_access_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: scalar_ref - LOGICAL(KIND=C_BOOL) :: scalar_ref_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: scale_factor - LOGICAL(KIND=C_BOOL) :: scale_factor_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: standard_name - LOGICAL(KIND=C_BOOL) :: standard_name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: ts_enabled - LOGICAL(KIND=C_BOOL) :: ts_enabled_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: ts_split_freq - LOGICAL(KIND=C_BOOL) :: ts_split_freq_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: unit - LOGICAL(KIND=C_BOOL) :: unit_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: valid_max - LOGICAL(KIND=C_BOOL) :: valid_max_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: valid_min - LOGICAL(KIND=C_BOOL) :: valid_min_tmp - - CALL xios(is_defined_fieldgroup_attr_hdl_) & - ( fieldgroup_hdl, add_offset, axis_ref, cell_methods, cell_methods_mode, check_if_active, comment & - , compression_level, default_value, detect_missing_value, domain_ref, enabled, expr, field_ref & - , freq_offset, freq_op, grid_path, grid_ref, group_ref, indexed_output, level, long_name, name & - , operation, prec, read_access, scalar_ref, scale_factor, standard_name, ts_enabled, ts_split_freq & - , unit, valid_max, valid_min ) - - END SUBROUTINE xios(is_defined_fieldgroup_attr_hdl) - - SUBROUTINE xios(is_defined_fieldgroup_attr_hdl_) & - ( fieldgroup_hdl, add_offset_, axis_ref_, cell_methods_, cell_methods_mode_, check_if_active_ & - , comment_, compression_level_, default_value_, detect_missing_value_, domain_ref_, enabled_ & - , expr_, field_ref_, freq_offset_, freq_op_, grid_path_, grid_ref_, group_ref_, indexed_output_ & - , level_, long_name_, name_, operation_, prec_, read_access_, scalar_ref_, scale_factor_, standard_name_ & - , ts_enabled_, ts_split_freq_, unit_, valid_max_, valid_min_ ) - - IMPLICIT NONE - TYPE(txios(fieldgroup)) , INTENT(IN) :: fieldgroup_hdl - LOGICAL, OPTIONAL, INTENT(OUT) :: add_offset_ - LOGICAL(KIND=C_BOOL) :: add_offset__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: axis_ref_ - LOGICAL(KIND=C_BOOL) :: axis_ref__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: cell_methods_ - LOGICAL(KIND=C_BOOL) :: cell_methods__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: cell_methods_mode_ - LOGICAL(KIND=C_BOOL) :: cell_methods_mode__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: check_if_active_ - LOGICAL(KIND=C_BOOL) :: check_if_active__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: comment_ - LOGICAL(KIND=C_BOOL) :: comment__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: compression_level_ - LOGICAL(KIND=C_BOOL) :: compression_level__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: default_value_ - LOGICAL(KIND=C_BOOL) :: default_value__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: detect_missing_value_ - LOGICAL(KIND=C_BOOL) :: detect_missing_value__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: domain_ref_ - LOGICAL(KIND=C_BOOL) :: domain_ref__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: enabled_ - LOGICAL(KIND=C_BOOL) :: enabled__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: expr_ - LOGICAL(KIND=C_BOOL) :: expr__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: field_ref_ - LOGICAL(KIND=C_BOOL) :: field_ref__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: freq_offset_ - LOGICAL(KIND=C_BOOL) :: freq_offset__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: freq_op_ - LOGICAL(KIND=C_BOOL) :: freq_op__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: grid_path_ - LOGICAL(KIND=C_BOOL) :: grid_path__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: grid_ref_ - LOGICAL(KIND=C_BOOL) :: grid_ref__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: group_ref_ - LOGICAL(KIND=C_BOOL) :: group_ref__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: indexed_output_ - LOGICAL(KIND=C_BOOL) :: indexed_output__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: level_ - LOGICAL(KIND=C_BOOL) :: level__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: long_name_ - LOGICAL(KIND=C_BOOL) :: long_name__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: name_ - LOGICAL(KIND=C_BOOL) :: name__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: operation_ - LOGICAL(KIND=C_BOOL) :: operation__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: prec_ - LOGICAL(KIND=C_BOOL) :: prec__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: read_access_ - LOGICAL(KIND=C_BOOL) :: read_access__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: scalar_ref_ - LOGICAL(KIND=C_BOOL) :: scalar_ref__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: scale_factor_ - LOGICAL(KIND=C_BOOL) :: scale_factor__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: standard_name_ - LOGICAL(KIND=C_BOOL) :: standard_name__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: ts_enabled_ - LOGICAL(KIND=C_BOOL) :: ts_enabled__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: ts_split_freq_ - LOGICAL(KIND=C_BOOL) :: ts_split_freq__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: unit_ - LOGICAL(KIND=C_BOOL) :: unit__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: valid_max_ - LOGICAL(KIND=C_BOOL) :: valid_max__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: valid_min_ - LOGICAL(KIND=C_BOOL) :: valid_min__tmp - - IF (PRESENT(add_offset_)) THEN - add_offset__tmp = cxios_is_defined_fieldgroup_add_offset & - (fieldgroup_hdl%daddr) - add_offset_ = add_offset__tmp - ENDIF - - IF (PRESENT(axis_ref_)) THEN - axis_ref__tmp = cxios_is_defined_fieldgroup_axis_ref & - (fieldgroup_hdl%daddr) - axis_ref_ = axis_ref__tmp - ENDIF - - IF (PRESENT(cell_methods_)) THEN - cell_methods__tmp = cxios_is_defined_fieldgroup_cell_methods & - (fieldgroup_hdl%daddr) - cell_methods_ = cell_methods__tmp - ENDIF - - IF (PRESENT(cell_methods_mode_)) THEN - cell_methods_mode__tmp = cxios_is_defined_fieldgroup_cell_methods_mode & - (fieldgroup_hdl%daddr) - cell_methods_mode_ = cell_methods_mode__tmp - ENDIF - - IF (PRESENT(check_if_active_)) THEN - check_if_active__tmp = cxios_is_defined_fieldgroup_check_if_active & - (fieldgroup_hdl%daddr) - check_if_active_ = check_if_active__tmp - ENDIF - - IF (PRESENT(comment_)) THEN - comment__tmp = cxios_is_defined_fieldgroup_comment & - (fieldgroup_hdl%daddr) - comment_ = comment__tmp - ENDIF - - IF (PRESENT(compression_level_)) THEN - compression_level__tmp = cxios_is_defined_fieldgroup_compression_level & - (fieldgroup_hdl%daddr) - compression_level_ = compression_level__tmp - ENDIF - - IF (PRESENT(default_value_)) THEN - default_value__tmp = cxios_is_defined_fieldgroup_default_value & - (fieldgroup_hdl%daddr) - default_value_ = default_value__tmp - ENDIF - - IF (PRESENT(detect_missing_value_)) THEN - detect_missing_value__tmp = cxios_is_defined_fieldgroup_detect_missing_value & - (fieldgroup_hdl%daddr) - detect_missing_value_ = detect_missing_value__tmp - ENDIF - - IF (PRESENT(domain_ref_)) THEN - domain_ref__tmp = cxios_is_defined_fieldgroup_domain_ref & - (fieldgroup_hdl%daddr) - domain_ref_ = domain_ref__tmp - ENDIF - - IF (PRESENT(enabled_)) THEN - enabled__tmp = cxios_is_defined_fieldgroup_enabled & - (fieldgroup_hdl%daddr) - enabled_ = enabled__tmp - ENDIF - - IF (PRESENT(expr_)) THEN - expr__tmp = cxios_is_defined_fieldgroup_expr & - (fieldgroup_hdl%daddr) - expr_ = expr__tmp - ENDIF - - IF (PRESENT(field_ref_)) THEN - field_ref__tmp = cxios_is_defined_fieldgroup_field_ref & - (fieldgroup_hdl%daddr) - field_ref_ = field_ref__tmp - ENDIF - - IF (PRESENT(freq_offset_)) THEN - freq_offset__tmp = cxios_is_defined_fieldgroup_freq_offset & - (fieldgroup_hdl%daddr) - freq_offset_ = freq_offset__tmp - ENDIF - - IF (PRESENT(freq_op_)) THEN - freq_op__tmp = cxios_is_defined_fieldgroup_freq_op & - (fieldgroup_hdl%daddr) - freq_op_ = freq_op__tmp - ENDIF - - IF (PRESENT(grid_path_)) THEN - grid_path__tmp = cxios_is_defined_fieldgroup_grid_path & - (fieldgroup_hdl%daddr) - grid_path_ = grid_path__tmp - ENDIF - - IF (PRESENT(grid_ref_)) THEN - grid_ref__tmp = cxios_is_defined_fieldgroup_grid_ref & - (fieldgroup_hdl%daddr) - grid_ref_ = grid_ref__tmp - ENDIF - - IF (PRESENT(group_ref_)) THEN - group_ref__tmp = cxios_is_defined_fieldgroup_group_ref & - (fieldgroup_hdl%daddr) - group_ref_ = group_ref__tmp - ENDIF - - IF (PRESENT(indexed_output_)) THEN - indexed_output__tmp = cxios_is_defined_fieldgroup_indexed_output & - (fieldgroup_hdl%daddr) - indexed_output_ = indexed_output__tmp - ENDIF - - IF (PRESENT(level_)) THEN - level__tmp = cxios_is_defined_fieldgroup_level & - (fieldgroup_hdl%daddr) - level_ = level__tmp - ENDIF - - IF (PRESENT(long_name_)) THEN - long_name__tmp = cxios_is_defined_fieldgroup_long_name & - (fieldgroup_hdl%daddr) - long_name_ = long_name__tmp - ENDIF - - IF (PRESENT(name_)) THEN - name__tmp = cxios_is_defined_fieldgroup_name & - (fieldgroup_hdl%daddr) - name_ = name__tmp - ENDIF - - IF (PRESENT(operation_)) THEN - operation__tmp = cxios_is_defined_fieldgroup_operation & - (fieldgroup_hdl%daddr) - operation_ = operation__tmp - ENDIF - - IF (PRESENT(prec_)) THEN - prec__tmp = cxios_is_defined_fieldgroup_prec & - (fieldgroup_hdl%daddr) - prec_ = prec__tmp - ENDIF - - IF (PRESENT(read_access_)) THEN - read_access__tmp = cxios_is_defined_fieldgroup_read_access & - (fieldgroup_hdl%daddr) - read_access_ = read_access__tmp - ENDIF - - IF (PRESENT(scalar_ref_)) THEN - scalar_ref__tmp = cxios_is_defined_fieldgroup_scalar_ref & - (fieldgroup_hdl%daddr) - scalar_ref_ = scalar_ref__tmp - ENDIF - - IF (PRESENT(scale_factor_)) THEN - scale_factor__tmp = cxios_is_defined_fieldgroup_scale_factor & - (fieldgroup_hdl%daddr) - scale_factor_ = scale_factor__tmp - ENDIF - - IF (PRESENT(standard_name_)) THEN - standard_name__tmp = cxios_is_defined_fieldgroup_standard_name & - (fieldgroup_hdl%daddr) - standard_name_ = standard_name__tmp - ENDIF - - IF (PRESENT(ts_enabled_)) THEN - ts_enabled__tmp = cxios_is_defined_fieldgroup_ts_enabled & - (fieldgroup_hdl%daddr) - ts_enabled_ = ts_enabled__tmp - ENDIF - - IF (PRESENT(ts_split_freq_)) THEN - ts_split_freq__tmp = cxios_is_defined_fieldgroup_ts_split_freq & - (fieldgroup_hdl%daddr) - ts_split_freq_ = ts_split_freq__tmp - ENDIF - - IF (PRESENT(unit_)) THEN - unit__tmp = cxios_is_defined_fieldgroup_unit & - (fieldgroup_hdl%daddr) - unit_ = unit__tmp - ENDIF - - IF (PRESENT(valid_max_)) THEN - valid_max__tmp = cxios_is_defined_fieldgroup_valid_max & - (fieldgroup_hdl%daddr) - valid_max_ = valid_max__tmp - ENDIF - - IF (PRESENT(valid_min_)) THEN - valid_min__tmp = cxios_is_defined_fieldgroup_valid_min & - (fieldgroup_hdl%daddr) - valid_min_ = valid_min__tmp - ENDIF - - END SUBROUTINE xios(is_defined_fieldgroup_attr_hdl_) - -END MODULE ifieldgroup_attr diff --git a/xios_2311_src/trunk/.svn/pristine/08/089c3277857d0c4814b866bbfe5113d89a527198.svn-base b/xios_2311_src/trunk/.svn/pristine/08/089c3277857d0c4814b866bbfe5113d89a527198.svn-base deleted file mode 100644 index 73f962683011bda9f3c1cccfe076bd2dbf7a10a1..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/08/089c3277857d0c4814b866bbfe5113d89a527198.svn-base +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef __XIOS_MPI_HPP__ -#define __XIOS_MPI_HPP__ - -/* skip C++ Binding for mpich , intel MPI */ -#define MPICH_SKIP_MPICXX - -/* skip C++ Binding for SGI MPI library */ -#define MPI_NO_CPPBIND - -/* skip C++ Binding for OpenMPI */ -#define OMPI_SKIP_MPICXX - -#include -#include -#include - -#if SIZE_MAX == UCHAR_MAX - #define MPI_SIZE_T MPI_UNSIGNED_CHAR -#elif SIZE_MAX == USHRT_MAX - #define MPI_SIZE_T MPI_UNSIGNED_SHORT -#elif SIZE_MAX == UINT_MAX - #define MPI_SIZE_T MPI_UNSIGNED -#elif SIZE_MAX == ULONG_MAX - #define MPI_SIZE_T MPI_UNSIGNED_LONG -#elif SIZE_MAX == ULLONG_MAX - #define MPI_SIZE_T MPI_UNSIGNED_LONG_LONG -#else - #error "Unable to find MPI_SIZE_T equivalent type" -#endif - -#include "mpi_tools.hpp" - -#endif diff --git a/xios_2311_src/trunk/.svn/pristine/08/08ba91dfd77e6e090706b8c0a74b760aa61cbdd3.svn-base b/xios_2311_src/trunk/.svn/pristine/08/08ba91dfd77e6e090706b8c0a74b760aa61cbdd3.svn-base deleted file mode 100644 index 6617bbf982d5529e8a0700aa23a1cde14fde2fc6..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/08/08ba91dfd77e6e090706b8c0a74b760aa61cbdd3.svn-base +++ /dev/null @@ -1,51 +0,0 @@ -/* ************************************************************************** * - * Copyright © IPSL/LSCE, xios, Avril 2010 - Octobre 2011 * - * ************************************************************************** */ - -#include -#include - -#include "xios.hpp" - -#include "object_template.hpp" -#include "group_template.hpp" -#include "attribute_template.hpp" - -#include "icutil.hpp" -#include "timer.hpp" -#include "extract_axis_to_scalar.hpp" - -extern "C" -{ -// /////////////////////////////// Définitions ////////////////////////////// // - - // ----------------------- Redéfinition de types ---------------------------- - - typedef xios::CExtractAxisToScalar * XExtractAxisToScalarPtr; - - // ------------------------ Création des handle ----------------------------- - void cxios_extract_axis_to_scalar_handle_create(XExtractAxisToScalarPtr * _ret, const char * _id, int _id_len) - TRY - { - std::string id; - if (!cstr2string(_id, _id_len, id)) return; - CTimer::get("XIOS").resume() ; - *_ret = xios::CExtractAxisToScalar::get(id); - CTimer::get("XIOS").suspend() ; - } - CATCH_DUMP_STACK - - // -------------------- Vérification des identifiants ----------------------- - void cxios_extract_axis_to_scalar_valid_id(bool * _ret, const char * _id, int _id_len) - TRY - { - std::string id; - if (!cstr2string(_id, _id_len, id)) return; - - CTimer::get("XIOS").resume() ; - *_ret = xios::CExtractAxisToScalar::has(id); - CTimer::get("XIOS").suspend() ; - } - CATCH_DUMP_STACK - -} // extern "C" diff --git a/xios_2311_src/trunk/.svn/pristine/08/08ebbd565988e3b01a64f458e355159a70528f38.svn-base b/xios_2311_src/trunk/.svn/pristine/08/08ebbd565988e3b01a64f458e355159a70528f38.svn-base deleted file mode 100644 index e765d2b9f8f084722b12c20da7a7e82c3788bece..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/08/08ebbd565988e3b01a64f458e355159a70528f38.svn-base +++ /dev/null @@ -1,422 +0,0 @@ -#ifndef __XIOS_CField__ -#define __XIOS_CField__ - -/// XIOS headers /// -#include "xios_spl.hpp" -#include "group_factory.hpp" -#include "functor.hpp" -#include "functor_type.hpp" -#include "duration.hpp" -#include "date.hpp" -#include "declare_group.hpp" -#include "calendar_util.hpp" -#include "array_new.hpp" -#include "attribute_array.hpp" -#include "declare_ref_func.hpp" -#include "transformation_enum.hpp" -#include "variable.hpp" -#include "context_client.hpp" -#include "pass_through_filter.hpp" -#include "temporal_filter.hpp" -#include "model_to_client_source_filter.hpp" -#include "client_from_client_source_filter.hpp" -#include "client_from_server_source_filter.hpp" -#include "client_to_model_store_filter.hpp" -#include "server_to_client_store_filter.hpp" -#include "server_from_client_source_filter.hpp" -#include "file_writer_store_filter.hpp" -#include "client_to_server_store_filter.hpp" -#include "file_reader_source_filter.hpp" - - - - - -namespace xios -{ - - /// ////////////////////// Déclarations ////////////////////// /// - - class CFieldGroup; - class CFieldAttributes; - class CField; - - class CFile; - class CCouplerIn ; - class CCouplerOut ; - class CGrid; - class CContext; - class CGenericFilter; - class CDomain ; - class CAxis ; - class CScalar ; - - class CGarbageCollector; - class COutputPin; - class CSourceFilter; - class CServerToClientFilter; - ///-------------------------------------------------------------- - - // Declare/Define CFieldAttribute - BEGIN_DECLARE_ATTRIBUTE_MAP(CField) -# include "field_attribute.conf" - END_DECLARE_ATTRIBUTE_MAP(CField) - - class CContextClient ; - - ///-------------------------------------------------------------- - class CField - : public CObjectTemplate - , public CFieldAttributes - { - /// friend /// - friend class CFile; - - /// typedef /// - typedef CObjectTemplate SuperClass; - typedef CFieldAttributes SuperClassAttribute; - - public : - enum EReadField - { - RF_NODATA, RF_EOF, RF_DATA - }; - - public: - - typedef CFieldAttributes RelAttributes; - typedef CFieldGroup RelGroup; - - enum EEventId - { - EVENT_ID_UPDATE_DATA, EVENT_ID_READ_DATA, EVENT_ID_READ_DATA_READY, - EVENT_ID_ADD_VARIABLE, EVENT_ID_ADD_VARIABLE_GROUP, EVENT_ID_GRID_COMPLETED - }; - - /// Constructeurs /// - CField(void); - explicit CField(const StdString& id); - CField(const CField& field); // Not implemented yet. - CField(const CField* const field); // Not implemented yet. - - /// Accesseurs /// - - CGrid* getRelGrid(void) const; - CFile* getRelFile(void) const; - CGrid* getAssociatedGrid(void) const ; - CDomain* getAssociatedDomain(const std::string& domainId, bool noError=false) const; - CAxis* getAssociatedAxis(const std::string& axisId, bool noError=false) const; - CScalar* getAssociatedScalar(const std::string& scalarId, bool noError=false) const; - - func::CFunctor::ETimeType getOperationTimeType() const; - - public: - template void getData(CArray& _data) const; - - std::map getGridAttributesBufferSize(CContextClient* client, bool bufferForWriting = false); - // Grid data buffer size for each connection of contextclient - std::map getGridDataBufferSize(CContextClient* client, bool bufferForWriting = false); - - // evaluation the size of the buffer for the field - bool evaluateBufferSize(map>& evaluateBuffer, bool isOptPerformance) ; - public: - void makeGridAliasForCoupling(void) ; - public: - bool isActive(bool atCurrentTimestep = false) const; - bool hasOutputFile; - - bool wasWritten() const; - void setWritten(); - - bool getUseCompressedOutput() const; - void setUseCompressedOutput(); - - /// Traitements /// - void solveGridReference(void); - void solveServerOperation(void); - void solveCheckMaskIndex(bool doSendingIndex); - void solveGridDomainAxisRef(bool checkAtt); - void solveGridDomainAxisBaseRef(); - - void checkGridOfEnabledFields(); - void sendGridOfEnabledFields(); - void sendGridComponentOfEnabledFields(); - - void sendFieldToFileServer(void) ; - void sendCloseDefinition(void) ; - - public: - void sendFieldToCouplerOut(void) ; - private: - bool sendFieldToCouplerOut_done_=false; - public: - - void sendFieldToInputFileServer(void) ; - - /// Vérifications /// - void checkTimeAttributes(CDuration* freqOp=NULL); - - bool buildWorkflowGraph(CGarbageCollector& gc) ; - bool buildWorkflowGraphDone_ = false ; - - size_t getGlobalWrittenSize(void) ; - - - std::shared_ptr getSelfReference(CGarbageCollector& gc); - std::shared_ptr getTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq); - std::shared_ptr getSelfTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq); - -// virtual void fromBinary(StdIStream& is); - - /// Destructeur /// - virtual ~CField(void); - - /// Accesseurs statiques /// - static StdString GetName(void); - static StdString GetDefName(void); - - static ENodeType GetType(void); - - template void setData(const CArray& _data); - static bool dispatchEvent(CEventServer& event); - static bool isCollectiveEvent(CEventServer& event); - void sendAllAttributesToServer(CContextClient* client) ; - - static void recvUpdateData(CEventServer& event); - void receiveUpdateData(CEventServer& event); - - bool sendReadDataRequest(const CDate& tsDataRequested); - bool sendReadDataRequestIfNeeded(void); - static void recvReadDataRequest(CEventServer& event); - void recvReadDataRequest(void); - static void recvReadDataReady(CEventServer& event); - void receiveReadDataReady(CEventServer& event); - void recvReadDataReady(vector ranks, vector buffers); // old interface to remove - void recvDataFromCoupler(vector ranks, vector buffers) ; // old interface to remove - void checkForLateDataFromServer(void); - void checkForLateDataFromCoupler(void) ; - - void checkIfMustAutoTrigger(void); // ym obsolete - void autoTriggerIfNeeded(void); //ym obsolete - void triggerLateField(void) ; - - void parse(xml::CXMLNode& node); - - void setVirtualVariableGroup(CVariableGroup* newVVariableGroup); - CVariableGroup* getVirtualVariableGroup(void) const; - vector getAllVariables(void) const; - virtual void solveDescInheritance(bool apply, const CAttributeMap* const parent = 0); - - CVariable* addVariable(const string& id = ""); - CVariableGroup* addVariableGroup(const string& id = ""); - void sendAddVariable(const string& id, CContextClient* client); - void sendAddVariableGroup(const string& id, CContextClient* client); - static void recvAddVariable(CEventServer& event); - void recvAddVariable(CBufferIn& buffer); - static void recvAddVariableGroup(CEventServer& event); - void recvAddVariableGroup(CBufferIn& buffer); - void sendAddAllVariables(CContextClient* client); - - const std::vector& getRefDomainAxisIds(); - - const string& getExpression(void); - bool hasExpression(void) const; - - bool hasGridMask(void) const; - - void connectToFileServer(CGarbageCollector& gc) ; - void connectToCouplerOut(CGarbageCollector& gc) ; - void connectToCouplerIn(CGarbageCollector& gc) ; - void connectToModelInput(CGarbageCollector& gc) ; - void connectToFileWriter(CGarbageCollector& gc) ; - void connectToClientInput(CGarbageCollector& gc) ; - void connectToServerInput(CGarbageCollector& gc) ; - void connectToModelOutput(CGarbageCollector& gc); - void connectToFileReader(CGarbageCollector& gc) ; - void connectToServerToClient(CGarbageCollector& gc) ; - - void setContextClientDataBufferSize(map>& bufferSize, - map>& maxEventSize, - bool bufferForWriting) ; - void setContextClientAttributesBufferSize(map>& bufferSize, - map>& maxEventSize, - bool bufferForWriting) ; - private: - bool isGridCompleted_ = true ; - public: - bool isGridCompleted() ; - void setGridCompleted(void) { isGridCompleted_= true; } - void unsetGridCompleted(void) { isGridCompleted_ = false ;} - - public: - void sendGridCompleted(void) ; - private: - static void recvGridCompleted(CEventServer& event); - void recvGridCompleted(CBufferIn& buffer); - - - private: - std::vector getGridPath(void) ; - - public: - /// Propriétés privées /// - CVariableGroup* vVariableGroup; - - CGrid* grid_=nullptr; - CGrid* getGrid(void) { return grid_; } - - private: - CGrid* sentGrid_=nullptr ; - public: - CGrid* getSentGrid(void) { return sentGrid_; } - - public: -// CFile* file; - - CFile* fileIn_ = nullptr ; // domAxisScalarIds_; - bool useCompressedOutput; - - // Two variables to identify the time_counter meta data written in file, which has no time_counter - bool hasTimeInstant; - bool hasTimeCentered; - - - DECLARE_REF_FUNC(Field,field) - - private: - CContextClient* client; - public: - void setContextClient(CContextClient* newContextClient); - CContextClient* getContextClient(void) {return client;} - - private: - - bool areAllReferenceSolved; - bool isReferenceSolved; - bool isReferenceSolvedAndTransformed; - bool isGridChecked; - - private: - //! define if the field is part of the active workflow. It will be tagged to true when CField::buildWorkflowGraph is successfull - bool workflowEnabled_ = false ; - public: - /*! workflowEnabled_ public accessor - * \return Value of workflowEnabled_ */ - bool getWorkflowEnabled(void) { return workflowEnabled_; } - - - private: - - //! The type of operation attached to the field - func::CFunctor::ETimeType operationTimeType; - - //! The output pin of the input filter of the field - std::shared_ptr inputFilter; - - //! The self temporal data filter - std::shared_ptr selfTemporalDataFilter ; - - //! The output pin of the filter providing the instant data for the field - std::shared_ptr instantDataFilter; - public: - std::shared_ptr getInstantDataFilter(void) { return instantDataFilter;} - - private: - - //! The output pin of the filters providing the result of the field's temporal operation - std::map, DurationFakeLessComparator> temporalDataFilters; - - //! The output pin of the filter providing the instant data for self references - std::shared_ptr selfReferenceFilter; // probably redondant with inputFilter - - //! The source filter for data provided by the client -// std::shared_ptr clientSourceFilter; // obsolete to remove - - //! The source filter for data provided by the model to enter the client workflow - std::shared_ptr modelToClientSourceFilter_; - - //! The source filter for data provided by the model to enter the client workflow - std::shared_ptr clientToModelStoreFilter_; - - //! The source filter for data provided by the client that send data to server workflow - std::shared_ptr serverFromClientSourceFilter_; - - //! The source filter for data provided by an other to enter the current client workflow (coupling mode) - std::shared_ptr clientFromClientSourceFilter_; - - //! The source filter for data provided by server to enter the current client workflow (reading mode) - std::shared_ptr clientFromServerSourceFilter_; - - //! The source filter for data read from file on server side - std::shared_ptr fileReaderSourceFilter_; - - //! The source filter for data provided by the server -// std::shared_ptr serverSourceFilter; // obsolete to remove - - //! The terminal filter which send data to server for writing - std::shared_ptr clientToServerStoreFilter_; - - //! The terminal filter which writes data to file - std::shared_ptr fileWriterStoreFilter_; - - //! The terminal filter which send data from server to client - std::shared_ptr serverToClientStoreFilter_; - - - }; // class CField - - ///-------------------------------------------------------------- - - // Declare/Define CFieldGroup and CFieldDefinition - DECLARE_GROUP(CField); - - ///----------------------------------------------------------------- - - template <> - void CGroupTemplate::solveRefInheritance(void); - - ///----------------------------------------------------------------- -} // namespace xios - - -#endif // __XIOS_CField__ diff --git a/xios_2311_src/trunk/.svn/pristine/09/0963f7df151c62c183cc3ad49a661b86460d813b.svn-base b/xios_2311_src/trunk/.svn/pristine/09/0963f7df151c62c183cc3ad49a661b86460d813b.svn-base deleted file mode 100644 index bfc3b82e0bb0b835abbe8183f92eacd860984c30..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/09/0963f7df151c62c183cc3ad49a661b86460d813b.svn-base +++ /dev/null @@ -1,206 +0,0 @@ -/* Copyright 2009, UCAR/Unidata and OPeNDAP, Inc. - See the COPYRIGHT file for more information. */ - -#include "config.h" -#include "ocinternal.h" -#include "ocdebug.h" -#include "ocdata.h" -#include "occontent.h" - -#include "ocrc.h" - -/* Condition on libcurl version */ -/* Set up an alias as needed */ -#ifndef HAVE_CURLOPT_KEYPASSWD -#define CURLOPT_KEYPASSWD CURLOPT_SSLKEYPASSWD -#endif - -static char* combinecredentials(const char* user, const char* pwd); - - -/* Set various general curl flags */ -int -ocset_curl_flags(OCstate* state) -{ - CURLcode cstat = CURLE_OK; - CURL* curl = state->curl; - struct OCcurlflags* flags = &state->curlflags; - -#ifdef CURLOPT_ENCODING - if (flags->compress) { - cstat = curl_easy_setopt(curl, CURLOPT_ENCODING,"deflate, gzip"); - if(cstat != CURLE_OK) goto done; - OCDBG(1,"CURLOPT_ENCODING=deflate, gzip"); - } -#endif - if (flags->cookiejar || flags->cookiefile) { - cstat = curl_easy_setopt(curl, CURLOPT_COOKIESESSION, 1); - if (cstat != CURLE_OK) goto done; - OCDBG(1,"CURLOPT_COOKIESESSION=1"); - } - if (flags->cookiejar) { - cstat = curl_easy_setopt(curl, CURLOPT_COOKIEJAR, flags->cookiejar); - if (cstat != CURLE_OK) goto done; - OCDBG1(1,"CURLOPT_COOKIEJAR=%s",flags->cookiejar); - } - if (flags->cookiefile) { - cstat = curl_easy_setopt(curl, CURLOPT_COOKIEFILE, flags->cookiefile); - if (cstat != CURLE_OK) goto done; - OCDBG1(1,"CURLOPT_COOKIEFILE=%s",flags->cookiefile); - } - if (flags->verbose) { - cstat = curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); - if (cstat != CURLE_OK) goto done; - OCDBG1(1,"CURLOPT_VERBOSE=%ld",1L); - } - - if (flags->timeout) { - cstat = curl_easy_setopt(curl, CURLOPT_TIMEOUT, (long)flags->timeout); - if (cstat != CURLE_OK) goto done; - OCDBG1(1,"CURLOPT_TIMEOUT=%ld",1L); - } - - /* Following are always set */ - cstat = curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); - OCDBG1(1,"CURLOPT_FOLLOWLOCATION=%ld",1L); - cstat = curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 10L); - OCDBG1(1,"CURLOPT_FOLLOWLOCATION=%ld",1L); - - cstat = curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, state->error.curlerrorbuf); - OCDBG1(1,"CURLOPT_ERRORBUFFER",0); - -done: - return cstat; -} - -int -ocset_proxy(OCstate* state) -{ - CURLcode cstat; - CURL* curl = state->curl; - struct OCproxy *proxy = &state->proxy; - struct OCcredentials *creds = &state->creds; - - cstat = curl_easy_setopt(curl, CURLOPT_PROXY, proxy->host); - if (cstat != CURLE_OK) return OC_ECURL; - OCDBG1(1,"CURLOPT_PROXY=%s",proxy->host); - - cstat = curl_easy_setopt(curl, CURLOPT_PROXYPORT, proxy->port); - if (cstat != CURLE_OK) return OC_ECURL; - OCDBG1(1,"CURLOPT_PROXYPORT=%d",proxy->port); - - if (creds->username) { - char *combined = combinecredentials(creds->username,creds->password); - if (!combined) return OC_ENOMEM; - cstat = curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, combined); - if (cstat != CURLE_OK) return OC_ECURL; - OCDBG1(1,"CURLOPT_PROXYUSERPWD=%s",combined); -#ifdef CURLOPT_PROXYAUTH - cstat = curl_easy_setopt(curl, CURLOPT_PROXYAUTH, (long)CURLAUTH_ANY); - if(cstat != CURLE_OK) goto fail; - OCDBG1(1,"CURLOPT_PROXYAUTH=%ld",(long)CURLAUTH_ANY); -#endif - free(combined); - } - return OC_NOERR; -} - -int -ocset_ssl(OCstate* state) -{ - CURLcode cstat = CURLE_OK; - CURL* curl = state->curl; - struct OCSSL* ssl = &state->ssl; - long verify = (ssl->validate?1L:0L); - cstat=curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, verify); - if (cstat != CURLE_OK) goto fail; - OCDBG1(1,"CURLOPT_SSL_VERIFYPEER=%ld",verify); - cstat=curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, (verify?2L:0L)); - if (cstat != CURLE_OK) goto fail; - OCDBG1(1,"CURLOPT_SSL_VERIFYHOST=%ld",(verify?2L:0L)); -#ifdef OCIGNORE - if(verify) -#endif - { - if(ssl->certificate) { - cstat = curl_easy_setopt(curl, CURLOPT_SSLCERT, ssl->certificate); - if(cstat != CURLE_OK) goto fail; - OCDBG1(1,"CURLOPT_SSLCERT=%s",ssl->certificate); - } - if(ssl->key) { - cstat = curl_easy_setopt(curl, CURLOPT_SSLKEY, ssl->key); - if(cstat != CURLE_OK) goto fail; - OCDBG1(1,"CURLOPT_SSLKEY=%s",ssl->key); - } - if(ssl->keypasswd) { - /* libcurl prior to 7.16.4 used 'CURLOPT_SSLKEYPASSWD' */ - cstat = curl_easy_setopt(curl, CURLOPT_KEYPASSWD, ssl->keypasswd); - if(cstat != CURLE_OK) goto fail; - OCDBG1(1,"CURLOPT_SSLKEY=%s",ssl->key); - } - if(ssl->cainfo) { - cstat = curl_easy_setopt(curl, CURLOPT_CAINFO, ssl->cainfo); - if(cstat != CURLE_OK) goto fail; - OCDBG1(1,"CURLOPT_CAINFO=%s",ssl->cainfo); - } - if(ssl->capath) { - cstat = curl_easy_setopt(curl, CURLOPT_CAPATH, ssl->capath); - if(cstat != CURLE_OK) goto fail; - OCDBG1(1,"CURLOPT_CAPATH=%s",ssl->capath); - } - { - cstat = curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, ssl->verifypeer); - if(cstat != CURLE_OK) goto fail; - OCDBG1(1,"CURLOPT_SSL_VERIFYPEER=%d",ssl->verifypeer); - } - } - return OC_NOERR; - -fail: - return OC_ECURL; -} - -/* This is called with arguments while the other functions in this file are - * used with global values read from the.dodsrc file. The reason is that - * we may have multiple password sources. - */ -int -ocset_user_password(OCstate* state) -{ - CURLcode cstat; - CURL* curl = state->curl; - char* combined = NULL; - const char* userC = state->creds.username; - const char* passwordC = state->creds.password; - - if(userC == NULL || passwordC == NULL) return OC_NOERR; - - combined = combinecredentials(userC,passwordC); - if (!combined) return OC_ENOMEM; - cstat = curl_easy_setopt(curl, CURLOPT_USERPWD, combined); - if (cstat != CURLE_OK) goto done; - OCDBG1(1,"CURLOPT_USERPWD=%s",combined); - cstat = curl_easy_setopt(curl, CURLOPT_HTTPAUTH, (long) CURLAUTH_ANY); - if (cstat != CURLE_OK) goto done; - OCDBG1(1,"CURLOPT_HTTPAUTH=%ld",(long)CURLAUTH_ANY); - -done: - if(combined != NULL) free(combined); - return (cstat == CURLE_OK?OC_NOERR:OC_ECURL); -} - - -static char* -combinecredentials(const char* user, const char* pwd) -{ - int userPassSize = strlen(user) + strlen(pwd) + 2; - char *userPassword = malloc(sizeof(char) * userPassSize); - if (!userPassword) { - oc_log(LOGERR,"Out of Memory\n"); - return NULL; - } - strcpy(userPassword, user); - strcat(userPassword, ":"); - strcat(userPassword, pwd); - return userPassword; -} diff --git a/xios_2311_src/trunk/.svn/pristine/09/097fdccec82fd40cd3620a7f09d5c9d26a1e5271.svn-base b/xios_2311_src/trunk/.svn/pristine/09/097fdccec82fd40cd3620a7f09d5c9d26a1e5271.svn-base deleted file mode 100644 index 2454dc15df4164c1bc6ec4a293840a1b149ace24..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/09/097fdccec82fd40cd3620a7f09d5c9d26a1e5271.svn-base +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef __XIOS_CLIENT_TO_SERVER_STORE_FILTER__ -#define __XIOS_CLIENT_TO_SERVER_STORE_FILTER__ - -#include "input_pin.hpp" -#include "graph_package.hpp" - -namespace xios -{ - class CField; - class CContextClient ; - - /*! - * A terminal filter which transmits the packets it receives to a field for writting in a file. - */ - class CClientToServerStoreFilter : public CInputPin - { - public: - /*! - * Constructs the filter (with one input slot) associated to the specified field - * and a garbage collector. - * - * \param gc the associated garbage collector - * \param field the associated field - */ - CClientToServerStoreFilter(CGarbageCollector& gc, CField* field, CContextClient* client); - /*! - * Get the size of data transfered by call. Needed for context client buffer size evaluation - * - * \param size : map returning the size for each server rank - * \return the associated context client - */ - CContextClient* getTransferedDataSize(map& size) ; - - /*! - * Tests if the filter must auto-trigger. - * - * \return true if the filter must auto-trigger - */ - bool virtual mustAutoTrigger() const; - - void buildWorkflowGraph(std::vector data); - - /*! - * Tests whether data is expected for the specified date. - * - * \param date the date associated to the data - */ - bool virtual isDataExpected(const CDate& date) const; - CGraphPackage * graphPackage; - bool graphEnabled; - - protected: - /*! - * Callbacks a field to write a packet to a file. - * - * \param data a vector of packets corresponding to each slot - */ - void virtual onInputReady(std::vector data); - - private: - CField* field_; // - - - - - - - - - - - - - - - - - - - - - diff --git a/xios_2311_src/trunk/.svn/pristine/09/09eeff6558bf202b4b4e6c7be37ed8d270d90ff5.svn-base b/xios_2311_src/trunk/.svn/pristine/09/09eeff6558bf202b4b4e6c7be37ed8d270d90ff5.svn-base deleted file mode 100644 index d88a873a6575f12a6bd08718024757b7f766b9b1..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/09/09eeff6558bf202b4b4e6c7be37ed8d270d90ff5.svn-base +++ /dev/null @@ -1,80 +0,0 @@ -#ifndef __TRANSFORM_CONNECTOR_HPP__ -#define __TRANSFORM_CONNECTOR_HPP__ - -#include "xios_spl.hpp" -#include "array_new.hpp" -#include "distributed_view.hpp" -#include "local_view.hpp" -#include "scatterer_connector.hpp" -#include "gatherer_connector.hpp" -#include "mpi.hpp" - -namespace xios -{ - - - class CTransformConnector - { - - public: - CTransformConnector(shared_ptr srcView, shared_ptr dstView, MPI_Comm localComm) - : srcView_(srcView), dstView_(dstView), localComm_(localComm) {} - - void computeConnector(void) ; - private: - - MPI_Comm localComm_ ; - shared_ptr srcView_ ; - shared_ptr dstView_ ; - map recvRankSize_ ; - shared_ptr scattererConnector_ ; - shared_ptr gathererConnector_ ; - - public: - template - void transfer(int repeat, int sizeT, const CArray& dataIn, CArray& dataOut) - { - map> tmpArrayIn ; - scattererConnector_->transfer(repeat, sizeT, dataIn, tmpArrayIn) ; - vector requests ; - MPI_Request request ; - for(auto it : tmpArrayIn) - { - auto& array = it.second ; - MPI_Issend(array.dataFirst(), array.numElements(), MPI_GetType(), it.first, 0, localComm_, &request) ; - requests.push_back(request) ; - } - - map> tmpArrayOut ; - for(auto it : recvRankSize_) - { - auto& array = tmpArrayOut[it.first] ; - array.resize(it.second*repeat*sizeT) ; - MPI_Irecv(array.dataFirst(), array.numElements(), MPI_GetType(), it.first, 0, localComm_, &request) ; - requests.push_back(request) ; - } - - vector status(requests.size()) ; - MPI_Waitall(requests.size(), requests.data(),status.data()) ; - - const double nanValue = std::numeric_limits::quiet_NaN(); - gathererConnector_->transfer(repeat, sizeT , tmpArrayOut, dataOut, nanValue) ; - } - - template - void transfer(int sizeT, const CArray& dataIn, CArray& dataOut) - { - transfer(1, sizeT, dataIn, dataOut) ; - } - - template - void transfer(const CArray& dataIn, CArray& dataOut) - { - transfer(1, 1, dataIn, dataOut) ; - } - - }; - -} - -#endif \ No newline at end of file diff --git a/xios_2311_src/trunk/.svn/pristine/0a/0a53b978b70605823bfb5dbf206e820891b9c6cc.svn-base b/xios_2311_src/trunk/.svn/pristine/0a/0a53b978b70605823bfb5dbf206e820891b9c6cc.svn-base deleted file mode 100644 index 3f7fd2f106d627ca613ec22b81c742982e8316a9..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/0a/0a53b978b70605823bfb5dbf206e820891b9c6cc.svn-base +++ /dev/null @@ -1,379 +0,0 @@ -#ifndef __XIOS_FILTER_EXPR_NODE_HPP__ -#define __XIOS_FILTER_EXPR_NODE_HPP__ - -#include -#include -#include "scalar_expr_node.hpp" - -namespace xios -{ - class COutputPin; - class CGarbageCollector; - class CField; - - /*! - * Interface implemented by all the nodes of a tree representing an expression - * which can be transformed into a filter graph representation. - */ - struct IFilterExprNode - { - /*! - * Builds a filter graph corresponding to the expression tree. - * - * \param gc the garbage collector to associated with the filter graph - * \param thisField the field to which the expression is attached - * \return the output pin of the filter producing the result of the expression - */ - virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField) const = 0; - }; - - /*! - * Expression node corresponding to a field. - */ - class CFilterFieldExprNode : public IFilterExprNode - { - public: - /*! - * Constructs an expression node corresponding - * to the field whose id is provided. - * - * \param fieldId the identifier of the field - */ - CFilterFieldExprNode(const std::string& fieldId); - - virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField) const; - - private: - std::string fieldId; //!< The identifier of the field - }; - - /*! - * Expression node corresponding to a field for which the result of - * the temporal operation is requested instead of the instant value. - */ - class CFilterTemporalFieldExprNode : public IFilterExprNode - { - public: - /*! - * Constructs an expression node corresponding - * to the field whose id is provided. - * - * \param fieldId the identifier of the field - */ - CFilterTemporalFieldExprNode(const std::string& fieldId); - - virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField) const; - - private: - std::string fieldId; //!< The identifier of the field - }; - - /*! - * Expression node corresponding to a unary operation on a field. - */ - class CFilterUnaryOpExprNode : public IFilterExprNode - { - public: - /*! - * Constructs an expression node corresponding to the specified unary operation - * applied to the provided child node. - * Note that the child node will be destroyed automatically when the parent node - * is destroyed. - * - * \param opId the identifier of the operator - * \param child the child node to which the operator is applied - */ - CFilterUnaryOpExprNode(const std::string& opId, IFilterExprNode* child); - - virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField) const; - - private: - std::string opId; //!< The identifier of the field - boost::scoped_ptr child; //!< The child node to which the operator is applied - }; - - /*! - * Expression node corresponding to a binary operation on a scalar and a field. - */ - class CFilterScalarFieldOpExprNode : public IFilterExprNode - { - public: - /*! - * Constructs an expression node corresponding to the specified binary operation - * applied to the provided scalar and field child nodes. - * Note that the child nodes will be destroyed automatically when the parent node - * is destroyed. - * - * \param child1 the scalar child node to which the operator is applied - * \param opId the identifier of the operator - * \param child2 the field child node to which the operator is applied - */ - CFilterScalarFieldOpExprNode(IScalarExprNode* child1, const std::string& opId, IFilterExprNode* child2); - - virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField) const; - - private: - std::string opId; //!< The identifier of the field - boost::scoped_ptr child1; //!< The scalar child node to which the operator is applied - boost::scoped_ptr child2; //!< The field child node to which the operator is applied - }; - - /*! - * Expression node corresponding to a binary operation on a field and a scalar. - */ - class CFilterFieldScalarOpExprNode : public IFilterExprNode - { - public: - /*! - * Constructs an expression node corresponding to the specified binary operation - * applied to the provided field and scalar child nodes. - * Note that the child nodes will be destroyed automatically when the parent node - * is destroyed. - * - * \param child1 the field child node to which the operator is applied - * \param opId the identifier of the operator - * \param child2 the scalar child node to which the operator is applied - */ - CFilterFieldScalarOpExprNode(IFilterExprNode* child1, const std::string& opId, IScalarExprNode* child2); - - virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField) const; - - private: - std::string opId; //!< The identifier of the field - boost::scoped_ptr child1; //!< The field child node to which the operator is applied - boost::scoped_ptr child2; //!< The scalar child node to which the operator is applied - }; - - /*! - * Expression node corresponding to a binary operation on two fields. - */ - class CFilterFieldFieldOpExprNode : public IFilterExprNode - { - public: - /*! - * Constructs an expression node corresponding to the specified binary operation - * applied to the provided field child nodes. - * Note that the child nodes will be destroyed automatically when the parent node - * is destroyed. - * - * \param opId the identifier of the operator - * \param child1, child2 the field child nodes to which the operator is applied - */ - CFilterFieldFieldOpExprNode(IFilterExprNode* child1, const std::string& opId, IFilterExprNode* child2); - - virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField) const; - - private: - std::string opId; //!< The identifier of the field - boost::scoped_ptr child1, child2; //!< The field child nodes to which the operator is applied - }; - - - - /*! - * Expression node corresponding to a ternary operation on a scalar-scalar-field. - */ - class CFilterScalarScalarFieldOpExprNode : public IFilterExprNode - { - public: - /*! - * Constructs an expression node corresponding to the specified ternary operation - * applied to the provided fields and scalars child nodes. - * Note that the child nodes will be destroyed automatically when the parent node - * is destroyed. - * - * \param child1 the scalar child node to which the operator is applied - * \param opId the identifier of the operator - * \param child2 the scalar child node to which the operator is applied - * \param child3 the field child node to which the operator is applied - */ - CFilterScalarScalarFieldOpExprNode(IScalarExprNode* child1, const std::string& opId, IScalarExprNode* child2, IFilterExprNode* child3); - - virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField) const; - - private: - std::string opId; //!< The identifier of the field - boost::scoped_ptr child1; //!< The scalar child node to which the operator is applied - boost::scoped_ptr child2; //!< The scalar child node to which the operator is applied - boost::scoped_ptr child3; //!< The field child node to which the operator is applied - }; - - - /*! - * Expression node corresponding to a ternary operation on a scalar-field-scalar. - */ - class CFilterScalarFieldScalarOpExprNode : public IFilterExprNode - { - public: - /*! - * Constructs an expression node corresponding to the specified ternary operation - * applied to the provided fields and scalars child nodes. - * Note that the child nodes will be destroyed automatically when the parent node - * is destroyed. - * - * \param child1 the scalar child node to which the operator is applied - * \param opId the identifier of the operator - * \param child2 the field child node to which the operator is applied - * \param child3 the scalar child node to which the operator is applied - */ - CFilterScalarFieldScalarOpExprNode(IScalarExprNode* child1, const std::string& opId, IFilterExprNode* child2, IScalarExprNode* child3); - - virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField) const; - - private: - std::string opId; //!< The identifier of the field - boost::scoped_ptr child1; //!< The scalar child node to which the operator is applied - boost::scoped_ptr child2; //!< The field child node to which the operator is applied - boost::scoped_ptr child3; //!< The scalar child node to which the operator is applied - }; - - - /*! - * Expression node corresponding to a ternary operation on a scalar-field-field. - */ - class CFilterScalarFieldFieldOpExprNode : public IFilterExprNode - { - public: - /*! - * Constructs an expression node corresponding to the specified ternary operation - * applied to the provided fields and scalars child nodes. - * Note that the child nodes will be destroyed automatically when the parent node - * is destroyed. - * - * \param child1 the scalar child node to which the operator is applied - * \param opId the identifier of the operator - * \param child2 the field child node to which the operator is applied - * \param child3 the field child node to which the operator is applied - */ - CFilterScalarFieldFieldOpExprNode(IScalarExprNode* child1, const std::string& opId, IFilterExprNode* child2, IFilterExprNode* child3); - - virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField) const; - - private: - std::string opId; //!< The identifier of the field - boost::scoped_ptr child1; //!< The scalar child node to which the operator is applied - boost::scoped_ptr child2; //!< The field child node to which the operator is applied - boost::scoped_ptr child3; //!< The field child node to which the operator is applied - }; - - - -/*! - * Expression node corresponding to a ternary operation on a field-scalar-scalar. - */ - class CFilterFieldScalarScalarOpExprNode : public IFilterExprNode - { - public: - /*! - * Constructs an expression node corresponding to the specified ternary operation - * applied to the provided fields and scalars child nodes. - * Note that the child nodes will be destroyed automatically when the parent node - * is destroyed. - * - * \param child1 the field child node to which the operator is applied - * \param opId the identifier of the operator - * \param child2 the scalar child node to which the operator is applied - * \param child3 the scalar child node to which the operator is applied - */ - CFilterFieldScalarScalarOpExprNode(IFilterExprNode* child1, const std::string& opId, IScalarExprNode* child2, IScalarExprNode* child3); - - virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField) const; - - private: - std::string opId; //!< The identifier of the field - boost::scoped_ptr child1; //!< The field child node to which the operator is applied - boost::scoped_ptr child2; //!< The scalar child node to which the operator is applied - boost::scoped_ptr child3; //!< The scalar child node to which the operator is applied - }; - - -/*! - * Expression node corresponding to a ternary operation on a field-scalar-field. - */ - class CFilterFieldScalarFieldOpExprNode : public IFilterExprNode - { - public: - /*! - * Constructs an expression node corresponding to the specified ternary operation - * applied to the provided fields and scalars child nodes. - * Note that the child nodes will be destroyed automatically when the parent node - * is destroyed. - * - * \param child1 the field child node to which the operator is applied - * \param opId the identifier of the operator - * \param child2 the scalar child node to which the operator is applied - * \param child3 the field child node to which the operator is applied - */ - CFilterFieldScalarFieldOpExprNode(IFilterExprNode* child1, const std::string& opId, IScalarExprNode* child2, IFilterExprNode* child3); - - virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField) const; - - private: - std::string opId; //!< The identifier of the field - boost::scoped_ptr child1; //!< The field child node to which the operator is applied - boost::scoped_ptr child2; //!< The scalar child node to which the operator is applied - boost::scoped_ptr child3; //!< The field child node to which the operator is applied - }; - - /*! - * Expression node corresponding to a ternary operation on a field-field-scalar. - */ - class CFilterFieldFieldScalarOpExprNode : public IFilterExprNode - { - public: - /*! - * Constructs an expression node corresponding to the specified ternary operation - * applied to the provided fields and scalars child nodes. - * Note that the child nodes will be destroyed automatically when the parent node - * is destroyed. - * - * \param child1 the field child node to which the operator is applied - * \param opId the identifier of the operator - * \param child2 the field child node to which the operator is applied - * \param child3 the scalar child node to which the operator is applied - */ - CFilterFieldFieldScalarOpExprNode(IFilterExprNode* child1, const std::string& opId, IFilterExprNode* child2, IScalarExprNode* child3); - - virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField) const; - - private: - std::string opId; //!< The identifier of the field - boost::scoped_ptr child1; //!< The field child node to which the operator is applied - boost::scoped_ptr child2; //!< The field child node to which the operator is applied - boost::scoped_ptr child3; //!< The scalar child node to which the operator is applied - }; - - - /*! - * Expression node corresponding to a ternary operation on a field-field-field. - */ - class CFilterFieldFieldFieldOpExprNode : public IFilterExprNode - { - public: - /*! - * Constructs an expression node corresponding to the specified ternary operation - * applied to the provided fields and scalars child nodes. - * Note that the child nodes will be destroyed automatically when the parent node - * is destroyed. - * - * \param child1 the field child node to which the operator is applied - * \param opId the identifier of the operator - * \param child2 the field child node to which the operator is applied - * \param child3 the field child node to which the operator is applied - */ - CFilterFieldFieldFieldOpExprNode(IFilterExprNode* child1, const std::string& opId, IFilterExprNode* child2, IFilterExprNode* child3); - - virtual std::shared_ptr reduce(CGarbageCollector& gc, CField& thisField) const; - - private: - std::string opId; //!< The identifier of the field - boost::scoped_ptr child1; //!< The field child node to which the operator is applied - boost::scoped_ptr child2; //!< The field child node to which the operator is applied - boost::scoped_ptr child3; //!< The field child node to which the operator is applied - }; - - - -} - -#endif // __XIOS_FILTER_EXPR_NODE_HPP__ diff --git a/xios_2311_src/trunk/.svn/pristine/0a/0a8aff6580311eed6c01e940724241896bfd037d.svn-base b/xios_2311_src/trunk/.svn/pristine/0a/0a8aff6580311eed6c01e940724241896bfd037d.svn-base deleted file mode 100644 index 846754d35b9791ba7c2fd7099796ea2647b8555b..0000000000000000000000000000000000000000 Binary files a/xios_2311_src/trunk/.svn/pristine/0a/0a8aff6580311eed6c01e940724241896bfd037d.svn-base and /dev/null differ diff --git a/xios_2311_src/trunk/.svn/pristine/0a/0aa66ae11e350e622a8dd1c99cdc1930bec2157b.svn-base b/xios_2311_src/trunk/.svn/pristine/0a/0aa66ae11e350e622a8dd1c99cdc1930bec2157b.svn-base deleted file mode 100644 index 3ca36380f7205b89b664d0e67a4ca392775ed843..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/0a/0aa66ae11e350e622a8dd1c99cdc1930bec2157b.svn-base +++ /dev/null @@ -1,711 +0,0 @@ -! * ************************************************************************** * -! * Interface auto generated - do not modify * -! * ************************************************************************** * -#include "../fortran/xios_fortran_prefix.hpp" - -MODULE file_interface_attr - USE, INTRINSIC :: ISO_C_BINDING - - INTERFACE - ! Do not call directly / interface FORTRAN 2003 <-> C99 - - SUBROUTINE cxios_set_file_append(file_hdl, append) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - LOGICAL (KIND=C_BOOL) , VALUE :: append - END SUBROUTINE cxios_set_file_append - - SUBROUTINE cxios_get_file_append(file_hdl, append) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - LOGICAL (KIND=C_BOOL) :: append - END SUBROUTINE cxios_get_file_append - - FUNCTION cxios_is_defined_file_append(file_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_file_append - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - END FUNCTION cxios_is_defined_file_append - - - SUBROUTINE cxios_set_file_comment(file_hdl, comment, comment_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: comment - INTEGER (kind = C_INT) , VALUE :: comment_size - END SUBROUTINE cxios_set_file_comment - - SUBROUTINE cxios_get_file_comment(file_hdl, comment, comment_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: comment - INTEGER (kind = C_INT) , VALUE :: comment_size - END SUBROUTINE cxios_get_file_comment - - FUNCTION cxios_is_defined_file_comment(file_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_file_comment - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - END FUNCTION cxios_is_defined_file_comment - - - SUBROUTINE cxios_set_file_compression_level(file_hdl, compression_level) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - INTEGER (KIND=C_INT) , VALUE :: compression_level - END SUBROUTINE cxios_set_file_compression_level - - SUBROUTINE cxios_get_file_compression_level(file_hdl, compression_level) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - INTEGER (KIND=C_INT) :: compression_level - END SUBROUTINE cxios_get_file_compression_level - - FUNCTION cxios_is_defined_file_compression_level(file_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_file_compression_level - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - END FUNCTION cxios_is_defined_file_compression_level - - - SUBROUTINE cxios_set_file_convention(file_hdl, convention, convention_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: convention - INTEGER (kind = C_INT) , VALUE :: convention_size - END SUBROUTINE cxios_set_file_convention - - SUBROUTINE cxios_get_file_convention(file_hdl, convention, convention_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: convention - INTEGER (kind = C_INT) , VALUE :: convention_size - END SUBROUTINE cxios_get_file_convention - - FUNCTION cxios_is_defined_file_convention(file_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_file_convention - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - END FUNCTION cxios_is_defined_file_convention - - - SUBROUTINE cxios_set_file_convention_str(file_hdl, convention_str, convention_str_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: convention_str - INTEGER (kind = C_INT) , VALUE :: convention_str_size - END SUBROUTINE cxios_set_file_convention_str - - SUBROUTINE cxios_get_file_convention_str(file_hdl, convention_str, convention_str_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: convention_str - INTEGER (kind = C_INT) , VALUE :: convention_str_size - END SUBROUTINE cxios_get_file_convention_str - - FUNCTION cxios_is_defined_file_convention_str(file_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_file_convention_str - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - END FUNCTION cxios_is_defined_file_convention_str - - - SUBROUTINE cxios_set_file_cyclic(file_hdl, cyclic) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - LOGICAL (KIND=C_BOOL) , VALUE :: cyclic - END SUBROUTINE cxios_set_file_cyclic - - SUBROUTINE cxios_get_file_cyclic(file_hdl, cyclic) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - LOGICAL (KIND=C_BOOL) :: cyclic - END SUBROUTINE cxios_get_file_cyclic - - FUNCTION cxios_is_defined_file_cyclic(file_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_file_cyclic - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - END FUNCTION cxios_is_defined_file_cyclic - - - SUBROUTINE cxios_set_file_description(file_hdl, description, description_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: description - INTEGER (kind = C_INT) , VALUE :: description_size - END SUBROUTINE cxios_set_file_description - - SUBROUTINE cxios_get_file_description(file_hdl, description, description_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: description - INTEGER (kind = C_INT) , VALUE :: description_size - END SUBROUTINE cxios_get_file_description - - FUNCTION cxios_is_defined_file_description(file_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_file_description - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - END FUNCTION cxios_is_defined_file_description - - - SUBROUTINE cxios_set_file_enabled(file_hdl, enabled) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - LOGICAL (KIND=C_BOOL) , VALUE :: enabled - END SUBROUTINE cxios_set_file_enabled - - SUBROUTINE cxios_get_file_enabled(file_hdl, enabled) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - LOGICAL (KIND=C_BOOL) :: enabled - END SUBROUTINE cxios_get_file_enabled - - FUNCTION cxios_is_defined_file_enabled(file_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_file_enabled - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - END FUNCTION cxios_is_defined_file_enabled - - - SUBROUTINE cxios_set_file_format(file_hdl, format, format_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: format - INTEGER (kind = C_INT) , VALUE :: format_size - END SUBROUTINE cxios_set_file_format - - SUBROUTINE cxios_get_file_format(file_hdl, format, format_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: format - INTEGER (kind = C_INT) , VALUE :: format_size - END SUBROUTINE cxios_get_file_format - - FUNCTION cxios_is_defined_file_format(file_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_file_format - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - END FUNCTION cxios_is_defined_file_format - - - SUBROUTINE cxios_set_file_min_digits(file_hdl, min_digits) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - INTEGER (KIND=C_INT) , VALUE :: min_digits - END SUBROUTINE cxios_set_file_min_digits - - SUBROUTINE cxios_get_file_min_digits(file_hdl, min_digits) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - INTEGER (KIND=C_INT) :: min_digits - END SUBROUTINE cxios_get_file_min_digits - - FUNCTION cxios_is_defined_file_min_digits(file_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_file_min_digits - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - END FUNCTION cxios_is_defined_file_min_digits - - - SUBROUTINE cxios_set_file_mode(file_hdl, mode, mode_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: mode - INTEGER (kind = C_INT) , VALUE :: mode_size - END SUBROUTINE cxios_set_file_mode - - SUBROUTINE cxios_get_file_mode(file_hdl, mode, mode_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: mode - INTEGER (kind = C_INT) , VALUE :: mode_size - END SUBROUTINE cxios_get_file_mode - - FUNCTION cxios_is_defined_file_mode(file_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_file_mode - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - END FUNCTION cxios_is_defined_file_mode - - - SUBROUTINE cxios_set_file_name(file_hdl, name, name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: name - INTEGER (kind = C_INT) , VALUE :: name_size - END SUBROUTINE cxios_set_file_name - - SUBROUTINE cxios_get_file_name(file_hdl, name, name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: name - INTEGER (kind = C_INT) , VALUE :: name_size - END SUBROUTINE cxios_get_file_name - - FUNCTION cxios_is_defined_file_name(file_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_file_name - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - END FUNCTION cxios_is_defined_file_name - - - SUBROUTINE cxios_set_file_name_suffix(file_hdl, name_suffix, name_suffix_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: name_suffix - INTEGER (kind = C_INT) , VALUE :: name_suffix_size - END SUBROUTINE cxios_set_file_name_suffix - - SUBROUTINE cxios_get_file_name_suffix(file_hdl, name_suffix, name_suffix_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: name_suffix - INTEGER (kind = C_INT) , VALUE :: name_suffix_size - END SUBROUTINE cxios_get_file_name_suffix - - FUNCTION cxios_is_defined_file_name_suffix(file_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_file_name_suffix - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - END FUNCTION cxios_is_defined_file_name_suffix - - - SUBROUTINE cxios_set_file_output_freq(file_hdl, output_freq) BIND(C) - USE ISO_C_BINDING - USE IDURATION - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - TYPE(txios(duration)), VALUE :: output_freq - END SUBROUTINE cxios_set_file_output_freq - - SUBROUTINE cxios_get_file_output_freq(file_hdl, output_freq) BIND(C) - USE ISO_C_BINDING - USE IDURATION - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - TYPE(txios(duration)) :: output_freq - END SUBROUTINE cxios_get_file_output_freq - - FUNCTION cxios_is_defined_file_output_freq(file_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_file_output_freq - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - END FUNCTION cxios_is_defined_file_output_freq - - - SUBROUTINE cxios_set_file_output_level(file_hdl, output_level) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - INTEGER (KIND=C_INT) , VALUE :: output_level - END SUBROUTINE cxios_set_file_output_level - - SUBROUTINE cxios_get_file_output_level(file_hdl, output_level) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - INTEGER (KIND=C_INT) :: output_level - END SUBROUTINE cxios_get_file_output_level - - FUNCTION cxios_is_defined_file_output_level(file_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_file_output_level - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - END FUNCTION cxios_is_defined_file_output_level - - - SUBROUTINE cxios_set_file_par_access(file_hdl, par_access, par_access_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: par_access - INTEGER (kind = C_INT) , VALUE :: par_access_size - END SUBROUTINE cxios_set_file_par_access - - SUBROUTINE cxios_get_file_par_access(file_hdl, par_access, par_access_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: par_access - INTEGER (kind = C_INT) , VALUE :: par_access_size - END SUBROUTINE cxios_get_file_par_access - - FUNCTION cxios_is_defined_file_par_access(file_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_file_par_access - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - END FUNCTION cxios_is_defined_file_par_access - - - SUBROUTINE cxios_set_file_read_metadata_par(file_hdl, read_metadata_par) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - LOGICAL (KIND=C_BOOL) , VALUE :: read_metadata_par - END SUBROUTINE cxios_set_file_read_metadata_par - - SUBROUTINE cxios_get_file_read_metadata_par(file_hdl, read_metadata_par) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - LOGICAL (KIND=C_BOOL) :: read_metadata_par - END SUBROUTINE cxios_get_file_read_metadata_par - - FUNCTION cxios_is_defined_file_read_metadata_par(file_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_file_read_metadata_par - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - END FUNCTION cxios_is_defined_file_read_metadata_par - - - SUBROUTINE cxios_set_file_record_offset(file_hdl, record_offset) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - INTEGER (KIND=C_INT) , VALUE :: record_offset - END SUBROUTINE cxios_set_file_record_offset - - SUBROUTINE cxios_get_file_record_offset(file_hdl, record_offset) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - INTEGER (KIND=C_INT) :: record_offset - END SUBROUTINE cxios_get_file_record_offset - - FUNCTION cxios_is_defined_file_record_offset(file_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_file_record_offset - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - END FUNCTION cxios_is_defined_file_record_offset - - - SUBROUTINE cxios_set_file_split_end_offset(file_hdl, split_end_offset) BIND(C) - USE ISO_C_BINDING - USE IDURATION - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - TYPE(txios(duration)), VALUE :: split_end_offset - END SUBROUTINE cxios_set_file_split_end_offset - - SUBROUTINE cxios_get_file_split_end_offset(file_hdl, split_end_offset) BIND(C) - USE ISO_C_BINDING - USE IDURATION - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - TYPE(txios(duration)) :: split_end_offset - END SUBROUTINE cxios_get_file_split_end_offset - - FUNCTION cxios_is_defined_file_split_end_offset(file_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_file_split_end_offset - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - END FUNCTION cxios_is_defined_file_split_end_offset - - - SUBROUTINE cxios_set_file_split_freq(file_hdl, split_freq) BIND(C) - USE ISO_C_BINDING - USE IDURATION - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - TYPE(txios(duration)), VALUE :: split_freq - END SUBROUTINE cxios_set_file_split_freq - - SUBROUTINE cxios_get_file_split_freq(file_hdl, split_freq) BIND(C) - USE ISO_C_BINDING - USE IDURATION - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - TYPE(txios(duration)) :: split_freq - END SUBROUTINE cxios_get_file_split_freq - - FUNCTION cxios_is_defined_file_split_freq(file_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_file_split_freq - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - END FUNCTION cxios_is_defined_file_split_freq - - - SUBROUTINE cxios_set_file_split_freq_format(file_hdl, split_freq_format, split_freq_format_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: split_freq_format - INTEGER (kind = C_INT) , VALUE :: split_freq_format_size - END SUBROUTINE cxios_set_file_split_freq_format - - SUBROUTINE cxios_get_file_split_freq_format(file_hdl, split_freq_format, split_freq_format_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: split_freq_format - INTEGER (kind = C_INT) , VALUE :: split_freq_format_size - END SUBROUTINE cxios_get_file_split_freq_format - - FUNCTION cxios_is_defined_file_split_freq_format(file_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_file_split_freq_format - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - END FUNCTION cxios_is_defined_file_split_freq_format - - - SUBROUTINE cxios_set_file_split_last_date(file_hdl, split_last_date, split_last_date_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: split_last_date - INTEGER (kind = C_INT) , VALUE :: split_last_date_size - END SUBROUTINE cxios_set_file_split_last_date - - SUBROUTINE cxios_get_file_split_last_date(file_hdl, split_last_date, split_last_date_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: split_last_date - INTEGER (kind = C_INT) , VALUE :: split_last_date_size - END SUBROUTINE cxios_get_file_split_last_date - - FUNCTION cxios_is_defined_file_split_last_date(file_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_file_split_last_date - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - END FUNCTION cxios_is_defined_file_split_last_date - - - SUBROUTINE cxios_set_file_split_start_offset(file_hdl, split_start_offset) BIND(C) - USE ISO_C_BINDING - USE IDURATION - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - TYPE(txios(duration)), VALUE :: split_start_offset - END SUBROUTINE cxios_set_file_split_start_offset - - SUBROUTINE cxios_get_file_split_start_offset(file_hdl, split_start_offset) BIND(C) - USE ISO_C_BINDING - USE IDURATION - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - TYPE(txios(duration)) :: split_start_offset - END SUBROUTINE cxios_get_file_split_start_offset - - FUNCTION cxios_is_defined_file_split_start_offset(file_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_file_split_start_offset - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - END FUNCTION cxios_is_defined_file_split_start_offset - - - SUBROUTINE cxios_set_file_sync_freq(file_hdl, sync_freq) BIND(C) - USE ISO_C_BINDING - USE IDURATION - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - TYPE(txios(duration)), VALUE :: sync_freq - END SUBROUTINE cxios_set_file_sync_freq - - SUBROUTINE cxios_get_file_sync_freq(file_hdl, sync_freq) BIND(C) - USE ISO_C_BINDING - USE IDURATION - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - TYPE(txios(duration)) :: sync_freq - END SUBROUTINE cxios_get_file_sync_freq - - FUNCTION cxios_is_defined_file_sync_freq(file_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_file_sync_freq - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - END FUNCTION cxios_is_defined_file_sync_freq - - - SUBROUTINE cxios_set_file_time_counter(file_hdl, time_counter, time_counter_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: time_counter - INTEGER (kind = C_INT) , VALUE :: time_counter_size - END SUBROUTINE cxios_set_file_time_counter - - SUBROUTINE cxios_get_file_time_counter(file_hdl, time_counter, time_counter_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: time_counter - INTEGER (kind = C_INT) , VALUE :: time_counter_size - END SUBROUTINE cxios_get_file_time_counter - - FUNCTION cxios_is_defined_file_time_counter(file_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_file_time_counter - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - END FUNCTION cxios_is_defined_file_time_counter - - - SUBROUTINE cxios_set_file_time_counter_name(file_hdl, time_counter_name, time_counter_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: time_counter_name - INTEGER (kind = C_INT) , VALUE :: time_counter_name_size - END SUBROUTINE cxios_set_file_time_counter_name - - SUBROUTINE cxios_get_file_time_counter_name(file_hdl, time_counter_name, time_counter_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: time_counter_name - INTEGER (kind = C_INT) , VALUE :: time_counter_name_size - END SUBROUTINE cxios_get_file_time_counter_name - - FUNCTION cxios_is_defined_file_time_counter_name(file_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_file_time_counter_name - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - END FUNCTION cxios_is_defined_file_time_counter_name - - - SUBROUTINE cxios_set_file_time_stamp_format(file_hdl, time_stamp_format, time_stamp_format_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: time_stamp_format - INTEGER (kind = C_INT) , VALUE :: time_stamp_format_size - END SUBROUTINE cxios_set_file_time_stamp_format - - SUBROUTINE cxios_get_file_time_stamp_format(file_hdl, time_stamp_format, time_stamp_format_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: time_stamp_format - INTEGER (kind = C_INT) , VALUE :: time_stamp_format_size - END SUBROUTINE cxios_get_file_time_stamp_format - - FUNCTION cxios_is_defined_file_time_stamp_format(file_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_file_time_stamp_format - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - END FUNCTION cxios_is_defined_file_time_stamp_format - - - SUBROUTINE cxios_set_file_time_stamp_name(file_hdl, time_stamp_name, time_stamp_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: time_stamp_name - INTEGER (kind = C_INT) , VALUE :: time_stamp_name_size - END SUBROUTINE cxios_set_file_time_stamp_name - - SUBROUTINE cxios_get_file_time_stamp_name(file_hdl, time_stamp_name, time_stamp_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: time_stamp_name - INTEGER (kind = C_INT) , VALUE :: time_stamp_name_size - END SUBROUTINE cxios_get_file_time_stamp_name - - FUNCTION cxios_is_defined_file_time_stamp_name(file_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_file_time_stamp_name - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - END FUNCTION cxios_is_defined_file_time_stamp_name - - - SUBROUTINE cxios_set_file_time_units(file_hdl, time_units, time_units_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: time_units - INTEGER (kind = C_INT) , VALUE :: time_units_size - END SUBROUTINE cxios_set_file_time_units - - SUBROUTINE cxios_get_file_time_units(file_hdl, time_units, time_units_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: time_units - INTEGER (kind = C_INT) , VALUE :: time_units_size - END SUBROUTINE cxios_get_file_time_units - - FUNCTION cxios_is_defined_file_time_units(file_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_file_time_units - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - END FUNCTION cxios_is_defined_file_time_units - - - SUBROUTINE cxios_set_file_timeseries(file_hdl, timeseries, timeseries_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: timeseries - INTEGER (kind = C_INT) , VALUE :: timeseries_size - END SUBROUTINE cxios_set_file_timeseries - - SUBROUTINE cxios_get_file_timeseries(file_hdl, timeseries, timeseries_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: timeseries - INTEGER (kind = C_INT) , VALUE :: timeseries_size - END SUBROUTINE cxios_get_file_timeseries - - FUNCTION cxios_is_defined_file_timeseries(file_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_file_timeseries - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - END FUNCTION cxios_is_defined_file_timeseries - - - SUBROUTINE cxios_set_file_ts_prefix(file_hdl, ts_prefix, ts_prefix_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: ts_prefix - INTEGER (kind = C_INT) , VALUE :: ts_prefix_size - END SUBROUTINE cxios_set_file_ts_prefix - - SUBROUTINE cxios_get_file_ts_prefix(file_hdl, ts_prefix, ts_prefix_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: ts_prefix - INTEGER (kind = C_INT) , VALUE :: ts_prefix_size - END SUBROUTINE cxios_get_file_ts_prefix - - FUNCTION cxios_is_defined_file_ts_prefix(file_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_file_ts_prefix - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - END FUNCTION cxios_is_defined_file_ts_prefix - - - SUBROUTINE cxios_set_file_type(file_hdl, type, type_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: type - INTEGER (kind = C_INT) , VALUE :: type_size - END SUBROUTINE cxios_set_file_type - - SUBROUTINE cxios_get_file_type(file_hdl, type, type_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: type - INTEGER (kind = C_INT) , VALUE :: type_size - END SUBROUTINE cxios_get_file_type - - FUNCTION cxios_is_defined_file_type(file_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_file_type - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - END FUNCTION cxios_is_defined_file_type - - - SUBROUTINE cxios_set_file_uuid_format(file_hdl, uuid_format, uuid_format_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: uuid_format - INTEGER (kind = C_INT) , VALUE :: uuid_format_size - END SUBROUTINE cxios_set_file_uuid_format - - SUBROUTINE cxios_get_file_uuid_format(file_hdl, uuid_format, uuid_format_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: uuid_format - INTEGER (kind = C_INT) , VALUE :: uuid_format_size - END SUBROUTINE cxios_get_file_uuid_format - - FUNCTION cxios_is_defined_file_uuid_format(file_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_file_uuid_format - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - END FUNCTION cxios_is_defined_file_uuid_format - - - SUBROUTINE cxios_set_file_uuid_name(file_hdl, uuid_name, uuid_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: uuid_name - INTEGER (kind = C_INT) , VALUE :: uuid_name_size - END SUBROUTINE cxios_set_file_uuid_name - - SUBROUTINE cxios_get_file_uuid_name(file_hdl, uuid_name, uuid_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: uuid_name - INTEGER (kind = C_INT) , VALUE :: uuid_name_size - END SUBROUTINE cxios_get_file_uuid_name - - FUNCTION cxios_is_defined_file_uuid_name(file_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_file_uuid_name - INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl - END FUNCTION cxios_is_defined_file_uuid_name - - END INTERFACE - -END MODULE file_interface_attr diff --git a/xios_2311_src/trunk/.svn/pristine/0a/0ab5feebe983ae91cd829c3bee6b4c22c3234dc6.svn-base b/xios_2311_src/trunk/.svn/pristine/0a/0ab5feebe983ae91cd829c3bee6b4c22c3234dc6.svn-base deleted file mode 100644 index 3bacf778421a935afbcea22bb854e7b967cc6053..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/0a/0ab5feebe983ae91cd829c3bee6b4c22c3234dc6.svn-base +++ /dev/null @@ -1,61 +0,0 @@ -/*! - \file domain_algorithm_expand.hpp - \author Ha NGUYEN - \since 08 Aug 2016 - \date 08 Aug 2016 - - \brief Algorithm for expanding an domain. - */ -#ifndef __XIOS_DOMAIN_ALGORITHM_EXPAND_HPP__ -#define __XIOS_DOMAIN_ALGORITHM_EXPAND_HPP__ - -#include "algorithm_transformation_transfer.hpp" -#include "transformation.hpp" - -namespace xios { -class CDomain; -class CExpandDomain; - -/*! - \class CDomainAlgorithmExpand -*/ -class CDomainAlgorithmExpand : public CAlgorithmTransformationTransfer -{ -public: - CDomainAlgorithmExpand(bool isSource, CDomain* domainDestination, CDomain* domainSource, CExpandDomain* expandDomain); - - virtual ~CDomainAlgorithmExpand() {} - - static bool registerTrans(); - virtual StdString getAlgoName() {return "\\nexpand_domain";} - -protected: - bool isXPeriodic_; // Flag to determine the periodicity of expansion (only for rectilinear) - bool isYPeriodic_; // Flag to determine the periodicity of expansion (only for rectilinear) - -protected: - void expandDomainEdgeConnectivity(CDomain* domainDestination, CDomain* domainSource); - void expandDomainNodeConnectivity(CDomain* domainDestination, CDomain* domainSource); - void updateRectilinearDomainAttributes(CDomain* domainDestination, - CDomain* domainSource, - CArray& neighborsDomainSrc); - - void updateUnstructuredDomainAttributes(CDomain* domainDestination, - CDomain* domainSource, - CArray& neighborsDomainSrc); - -public: - static shared_ptr create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition); - static bool dummyRegistered_; -}; - -} -#endif // __XIOS_DOMAIN_ALGORITHM_EXPAND_HPP__ diff --git a/xios_2311_src/trunk/.svn/pristine/0a/0ac4b8f50ea240dcbe814b56cb51a831a29769d8.svn-base b/xios_2311_src/trunk/.svn/pristine/0a/0ac4b8f50ea240dcbe814b56cb51a831a29769d8.svn-base deleted file mode 100644 index bcf3cf606ad59aba3ed2cfd4b93852c0a27087fd..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/0a/0ac4b8f50ea240dcbe814b56cb51a831a29769d8.svn-base +++ /dev/null @@ -1,90 +0,0 @@ -#include "xios_fortran_prefix.hpp" - -MODULE ICONTEXT - USE, INTRINSIC :: ISO_C_BINDING - USE CONTEXT_INTERFACE - USE IDATE - USE IDURATION -! USE icontext_attr - - - TYPE txios(context) - INTEGER(kind = C_INTPTR_T) :: daddr - END TYPE txios(context) - - INTERFACE xios(set_current_context) - MODULE PROCEDURE xios(set_current_context_hdl), xios(set_current_context_id) - END INTERFACE xios(set_current_context) - - INTERFACE xios(get_current_context) - MODULE PROCEDURE xios(get_current_context_hdl), xios(get_current_context_id) - END INTERFACE xios(get_current_context) - - CONTAINS ! Fonctions disponibles pour les utilisateurs. - - SUBROUTINE xios(get_context_handle)(idt,ret) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: idt - TYPE(txios(context)), INTENT(OUT):: ret - - CALL cxios_context_handle_create(ret%daddr, idt, len(idt)) - END SUBROUTINE xios(get_context_handle) - - SUBROUTINE xios(get_current_context_hdl)(context) - IMPLICIT NONE - - TYPE(txios(context)), INTENT(OUT) :: context - - CALL cxios_context_get_current(context%daddr) - - END SUBROUTINE xios(get_current_context_hdl) - - SUBROUTINE xios(get_current_context_id)(idt) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(OUT) :: idt - TYPE(txios(context)) :: context - - CALL cxios_context_get_current(context%daddr) - CALL cxios_context_get_id(context%daddr, idt, len(idt)) - - END SUBROUTINE xios(get_current_context_id) - - SUBROUTINE xios(set_current_context_hdl)(context, withswap) - IMPLICIT NONE - - TYPE(txios(context)) , INTENT(IN) :: context - LOGICAL , OPTIONAL, INTENT(IN) :: withswap - LOGICAL (kind = 1) :: wswap - - IF (PRESENT(withswap)) THEN - wswap = withswap - ELSE - wswap = .FALSE. - END IF - CALL cxios_context_set_current(context%daddr, wswap) - - END SUBROUTINE xios(set_current_context_hdl) - - SUBROUTINE xios(set_current_context_id)(idt) - IMPLICIT NONE - - CHARACTER(len = *) , INTENT(IN) :: idt - LOGICAL :: withswap - TYPE(xios_context):: ret - - CALL xios(get_context_handle)(idt,ret) - CALL xios(set_current_context_hdl)(ret, withswap) - END SUBROUTINE xios(set_current_context_id) - - LOGICAL FUNCTION xios(is_valid_context)(idt) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: idt - LOGICAL (kind = 1) :: val - - CALL cxios_context_valid_id(val, idt, len(idt)); - xios(is_valid_context) = val - - END FUNCTION xios(is_valid_context) - - -END MODULE ICONTEXT diff --git a/xios_2311_src/trunk/.svn/pristine/0a/0af6195d18cae94c032330026f944e8bc8f7e696.svn-base b/xios_2311_src/trunk/.svn/pristine/0a/0af6195d18cae94c032330026f944e8bc8f7e696.svn-base deleted file mode 100644 index 4a18b6986ac3aae028a6fe77c3bd0f25fdb6a58f..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/0a/0af6195d18cae94c032330026f944e8bc8f7e696.svn-base +++ /dev/null @@ -1,434 +0,0 @@ -#include "globalScopeData.hpp" -#include "xios_spl.hpp" -#include "cxios.hpp" -#include "server.hpp" -#include "client.hpp" -#include "type.hpp" -#include "context.hpp" -#include "object_template.hpp" -#include "oasis_cinterface.hpp" -#include -#include -#include "mpi.hpp" -#include "tracer.hpp" -#include "timer.hpp" -#include "event_scheduler.hpp" -#include "string_tools.hpp" -#include "ressources_manager.hpp" -#include "services_manager.hpp" -#include "contexts_manager.hpp" -#include "servers_ressource.hpp" -#include -#include "workflow_graph.hpp" -#include "release_static_allocation.hpp" - - - -namespace xios -{ - MPI_Comm CServer::intraComm ; - MPI_Comm CServer::serversComm_ ; - std::list CServer::interCommLeft ; - std::list CServer::interCommRight ; - std::list CServer::contextInterComms; - std::list CServer::contextIntraComms; - int CServer::serverLevel = 0 ; - int CServer::nbContexts = 0; - bool CServer::isRoot = false ; - int CServer::rank_ = INVALID_RANK; - StdOFStream CServer::m_infoStream; - StdOFStream CServer::m_errorStream; - map CServer::contextList ; - vector CServer::sndServerGlobalRanks; - bool CServer::finished=false ; - bool CServer::is_MPI_Initialized ; - CEventScheduler* CServer::eventScheduler = 0; - CServersRessource* CServer::serversRessource_=nullptr ; - - - void CServer::initialize(void) - { - - MPI_Comm serverComm ; - int initialized ; - MPI_Initialized(&initialized) ; - if (initialized) is_MPI_Initialized=true ; - else is_MPI_Initialized=false ; - MPI_Comm globalComm=CXios::getGlobalComm() ; - - ///////////////////////////////////////// - ///////////// PART 1 //////////////////// - ///////////////////////////////////////// - // don't use OASIS - if (!CXios::usingOasis) - { - if (!is_MPI_Initialized) MPI_Init(NULL, NULL); - - // split the global communicator - // get hash from all model to attribute a unique color (int) and then split to get client communicator - // every mpi process of globalComm (MPI_COMM_WORLD) must participate - - int commRank, commSize ; - MPI_Comm_rank(globalComm,&commRank) ; - MPI_Comm_size(globalComm,&commSize) ; - - std::hash hashString ; - size_t hashServer=hashString(CXios::xiosCodeId) ; - - size_t* hashAll = new size_t[commSize] ; - MPI_Allgather(&hashServer,1,MPI_SIZE_T,hashAll,1,MPI_SIZE_T,globalComm) ; - - int color=0 ; - map listHash ; - for(int i=0 ; i<=commSize ; i++) - if (listHash.count(hashAll[i])==0) - { - listHash[hashAll[i]]=color ; - color=color+1 ; - } - color=listHash[hashServer] ; - delete[] hashAll ; - - MPI_Comm_split(globalComm, color, commRank, &serverComm) ; - } - else // using OASIS - { - if (!is_MPI_Initialized) oasis_init(CXios::xiosCodeId); - - oasis_get_localcomm(serverComm); - } - CTimer::get("XIOS").resume() ; - CTimer::get("XIOS initialize").resume() ; - - ///////////////////////////////////////// - ///////////// PART 2 //////////////////// - ///////////////////////////////////////// - - - // Create the XIOS communicator for every process which is related - // to XIOS, as well on client side as on server side - MPI_Comm xiosGlobalComm ; - string strIds=CXios::getin("clients_code_id","") ; - vector clientsCodeId=splitRegex(strIds,"\\s*,\\s*") ; - if (strIds.empty()) - { - // no code Ids given, suppose XIOS initialisation is global - int commRank, commGlobalRank, serverLeader, clientLeader,serverRemoteLeader,clientRemoteLeader ; - MPI_Comm splitComm,interComm ; - MPI_Comm_rank(globalComm,&commGlobalRank) ; - MPI_Comm_split(globalComm, 1, commGlobalRank, &splitComm) ; - MPI_Comm_rank(splitComm,&commRank) ; - if (commRank==0) serverLeader=commGlobalRank ; - else serverLeader=0 ; - clientLeader=0 ; - MPI_Allreduce(&clientLeader,&clientRemoteLeader,1,MPI_INT,MPI_SUM,globalComm) ; - MPI_Allreduce(&serverLeader,&serverRemoteLeader,1,MPI_INT,MPI_SUM,globalComm) ; - MPI_Intercomm_create(splitComm, 0, globalComm, clientRemoteLeader,1341,&interComm) ; - MPI_Intercomm_merge(interComm,false,&xiosGlobalComm) ; - CXios::setXiosComm(xiosGlobalComm) ; - } - else - { - - xiosGlobalCommByFileExchange(serverComm) ; - - } - - ///////////////////////////////////////// - ///////////// PART 4 //////////////////// - // create servers intra communicator // - ///////////////////////////////////////// - - int commRank ; - MPI_Comm_rank(CXios::getXiosComm(), &commRank) ; - MPI_Comm_split(CXios::getXiosComm(),true,commRank,&serversComm_) ; - - CXios::setUsingServer() ; - - ///////////////////////////////////////// - ///////////// PART 5 //////////////////// - // redirect files output // - ///////////////////////////////////////// - - CServer::openInfoStream(CXios::serverFile); - CServer::openErrorStream(CXios::serverFile); - - ///////////////////////////////////////// - ///////////// PART 4 //////////////////// - ///////////////////////////////////////// - - CXios::launchDaemonsManager(true) ; - - ///////////////////////////////////////// - ///////////// PART 5 //////////////////// - ///////////////////////////////////////// - - // create the services - - auto ressourcesManager=CXios::getRessourcesManager() ; - auto servicesManager=CXios::getServicesManager() ; - auto contextsManager=CXios::getContextsManager() ; - auto daemonsManager=CXios::getDaemonsManager() ; - auto serversRessource=CServer::getServersRessource() ; - - if (serversRessource->isServerLeader()) - { - int nbRessources = ressourcesManager->getRessourcesSize() ; - if (!CXios::usingServer2) - { - ressourcesManager->createPool(CXios::defaultPoolId, nbRessources) ; - servicesManager->createServices(CXios::defaultPoolId, CXios::defaultServerId, CServicesManager::IO_SERVER,nbRessources,1) ; - } - else - { - int nprocsServer = nbRessources*CXios::ratioServer2/100.; - int nprocsGatherer = nbRessources - nprocsServer ; - - int nbPoolsServer2 = CXios::nbPoolsServer2 ; - if (nbPoolsServer2 == 0) nbPoolsServer2 = nprocsServer; - ressourcesManager->createPool(CXios::defaultPoolId, nbRessources) ; - servicesManager->createServices(CXios::defaultPoolId, CXios::defaultGathererId, CServicesManager::GATHERER, nprocsGatherer, 1) ; - servicesManager->createServices(CXios::defaultPoolId, CXios::defaultServerId, CServicesManager::OUT_SERVER, nprocsServer, nbPoolsServer2) ; - } - } - CTimer::get("XIOS initialize").suspend() ; - - ///////////////////////////////////////// - ///////////// PART 5 //////////////////// - ///////////////////////////////////////// - // loop on event loop - - bool finished=false ; - CTimer::get("XIOS event loop").resume() ; - - while (!finished) - { - finished=daemonsManager->eventLoop() ; - } - CTimer::get("XIOS event loop").suspend() ; - - // Delete CContext - //CObjectTemplate::cleanStaticDataStructure(); - } - - - - - - void CServer::xiosGlobalCommByFileExchange(MPI_Comm serverComm) - { - - MPI_Comm globalComm=CXios::getGlobalComm() ; - MPI_Comm xiosGlobalComm ; - - string strIds=CXios::getin("clients_code_id","") ; - vector clientsCodeId=splitRegex(strIds,"\\s*,\\s*") ; - - int commRank, globalRank ; - MPI_Comm_rank(serverComm, &commRank) ; - MPI_Comm_rank(globalComm, &globalRank) ; - string serverFileName("__xios_publisher::"+CXios::xiosCodeId+"__to_remove__") ; - - if (commRank==0) // if root process publish name - { - std::ofstream ofs (serverFileName, std::ofstream::out); - ofs< clientsRank(clientsCodeId.size()) ; - for(int i=0;i>clientsRank[i] ; - ifs.close() ; - } - - MPI_Comm intraComm ; - MPI_Comm_dup(serverComm,&intraComm) ; - MPI_Comm interComm ; - for(int i=0 ; i::iterator it = contextInterComms.begin(); it != contextInterComms.end(); it++) - MPI_Comm_free(&(*it)); - - for (std::list::iterator it = contextIntraComms.begin(); it != contextIntraComms.end(); it++) - MPI_Comm_free(&(*it)); - - for (std::list::iterator it = interCommRight.begin(); it != interCommRight.end(); it++) - MPI_Comm_free(&(*it)); - -// MPI_Comm_free(&intraComm); - CXios::finalizeDaemonsManager(); - finalizeServersRessource(); - - CContext::removeAllContexts() ; // free memory for related context - - CXios::getMpiGarbageCollector().release() ; // release unfree MPI ressources - - if (!is_MPI_Initialized) - { - if (CXios::usingOasis) oasis_finalize(); - else MPI_Finalize() ; - } - report(0)<<"Performance report : Time spent for XIOS : "<open(fileNameServer.str().c_str(), std::ios::out); - if (!fb->is_open()) - ERROR("void CServer::openStream(const StdString& fileName, const StdString& ext, std::filebuf* fb)", - << std::endl << "Can not open <" << fileNameServer.str() << "> file to write the server log(s)."); - } - - /*! - * \brief Open a file stream to write the info logs - * Open a file stream with a specific file name suffix+rank - * to write the info logs. - * \param fileName [in] protype file name - */ - void CServer::openInfoStream(const StdString& fileName) - { - std::filebuf* fb = m_infoStream.rdbuf(); - openStream(fileName, ".out", fb); - - info.write2File(fb); - report.write2File(fb); - } - - //! Write the info logs to standard output - void CServer::openInfoStream() - { - info.write2StdOut(); - report.write2StdOut(); - } - - //! Close the info logs file if it opens - void CServer::closeInfoStream() - { - if (m_infoStream.is_open()) m_infoStream.close(); - } - - /*! - * \brief Open a file stream to write the error log - * Open a file stream with a specific file name suffix+rank - * to write the error log. - * \param fileName [in] protype file name - */ - void CServer::openErrorStream(const StdString& fileName) - { - std::filebuf* fb = m_errorStream.rdbuf(); - openStream(fileName, ".err", fb); - - error.write2File(fb); - } - - //! Write the error log to standard error output - void CServer::openErrorStream() - { - error.write2StdErr(); - } - - //! Close the error log file if it opens - void CServer::closeErrorStream() - { - if (m_errorStream.is_open()) m_errorStream.close(); - } - - void CServer::launchServersRessource(MPI_Comm serverComm) - { - serversRessource_ = new CServersRessource(serverComm) ; - } - - void CServer::finalizeServersRessource(void) - { - delete serversRessource_; serversRessource_=nullptr ; - } -} diff --git a/xios_2311_src/trunk/.svn/pristine/0a/0af792afd2353f6b1e5e58444a2653c61564cf71.svn-base b/xios_2311_src/trunk/.svn/pristine/0a/0af792afd2353f6b1e5e58444a2653c61564cf71.svn-base deleted file mode 100644 index e9b73970ca83b3cfd284fcc82f61937fa3d1f21c..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/0a/0af792afd2353f6b1e5e58444a2653c61564cf71.svn-base +++ /dev/null @@ -1,10 +0,0 @@ -/* GLOBAL */ -DECLARE_ATTRIBUTE(double , bounds_lon_start) -DECLARE_ATTRIBUTE(double , bounds_lon_end) -DECLARE_ATTRIBUTE(double , bounds_lat_start) -DECLARE_ATTRIBUTE(double , bounds_lat_end) - -DECLARE_ATTRIBUTE(double , lon_start) -DECLARE_ATTRIBUTE(double , lon_end) -DECLARE_ATTRIBUTE(double , lat_start) -DECLARE_ATTRIBUTE(double , lat_end) diff --git a/xios_2311_src/trunk/.svn/pristine/0a/0af980428ffd1022354f6b6813dd153be96f626e.svn-base b/xios_2311_src/trunk/.svn/pristine/0a/0af980428ffd1022354f6b6813dd153be96f626e.svn-base deleted file mode 100644 index b36484f798015d53e5a04203191b9bc2449fa721..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/0a/0af980428ffd1022354f6b6813dd153be96f626e.svn-base +++ /dev/null @@ -1,34 +0,0 @@ -#include "algorithm_transformation_transfer.hpp" -#include "array_new.hpp" -#include "local_view.hpp" -#include "transform_connector.hpp" -#include "context.hpp" - -namespace xios -{ - - void CAlgorithmTransformationTransfer::computeAlgorithm(shared_ptr srcView, shared_ptr dstView) - { - this->computeRecvElement(srcView, dstView) ; - transferTransformConnector_ = make_shared( recvElement_->getView(CElementView::FULL), dstView, transformationMapping_) ; - } - - - void CAlgorithmTransformationTransfer::apply(int dimBefore, int dimAfter, const CArray& dataIn, CArray& dataOut) - { - transferTransformConnector_ -> transfer(dimBefore, dimAfter, dataIn, dataOut) ; - } - - void CAlgorithmTransformationTransfer::computeRecvElement(shared_ptr srcView, shared_ptr dstView) - { - set srcIndex ; - for(auto& it : transformationMapping_) srcIndex.insert(it.second) ; - - CArray srcArrayIndex(srcIndex.size()) ; - int i=0 ; - for(size_t index : srcIndex) { srcArrayIndex(i) = index ; i++ ;} - recvElement_ = make_shared(CContext::getCurrent()->getIntraCommRank(), srcView->getGlobalSize(), srcArrayIndex) ; - recvElement_->addFullView() ; - } - -} \ No newline at end of file diff --git a/xios_2311_src/trunk/.svn/pristine/0a/0affe6201e46effc4f4dd5051b220ea9d4231350.svn-base b/xios_2311_src/trunk/.svn/pristine/0a/0affe6201e46effc4f4dd5051b220ea9d4231350.svn-base deleted file mode 100644 index 7689ff51de2d8f13ecf07a702f3b0e6b5f0f70a2..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/0a/0affe6201e46effc4f4dd5051b220ea9d4231350.svn-base +++ /dev/null @@ -1,493 +0,0 @@ -#include "xios.hpp" -#include "generate_interface.hpp" -#include "indent.hpp" -#include "attribute_template.hpp" -#include "object_template.hpp" -#include "group_template.hpp" -#include "node_type.hpp" - -int main (int argc, char ** argv, char ** UNUSED (env)) -{ -// string path="./src/attr_interface/"; - string path="./interface/"; - - CContext* context=CContext::create("interface"); - CCalendarWrapper calendarWrapper; - CScalar scalar; - CScalarGroup scalargroup; - CAxis axis; - CAxisGroup axisgroup; - CField field; - CFieldGroup fieldgroup; - CVariable variable; - CVariableGroup variablegroup; - CDomain domain; - CDomainGroup domaingroup; - CGrid grid; - CGridGroup gridgroup; - - CFile afile; - CFileGroup filegroup; - - CInterpolateDomain interpolateDomain; - CZoomDomain zoomDomain; - CGenerateRectilinearDomain genDomain; - CComputeConnectivityDomain compConDomain; - CExpandDomain expandDomain; - CReorderDomain reorderDomain; - CExtractDomain extractDomain; - - CInterpolateAxis interpolateAxis; - CZoomAxis zoomAxis; - CInverseAxis inverseAxis; - CExtractAxis extractAxis; - - CReduceDomainToAxis reduceDomainToAxis; - CReduceAxisToAxis reduceAxisToAxis; - CExtractDomainToAxis extractDomainToAxis; - CTemporalSplitting temporalSplitting; - - CReduceAxisToScalar reduceAxisToScalar; - CExtractAxisToScalar extractAxisToScalar; - CReduceDomainToScalar reduceDomainToScalar; - CDuplicateScalarToAxis duplicateScalarToAxis; - CReduceScalarToScalar reduceScalarToScalar; - - ostringstream oss; - ofstream file; - - file.open((path+"scalar_interface_attr.F90").c_str()); - scalar.generateFortran2003Interface(file); - file.close(); - - file.open((path+"icscalar_attr.cpp").c_str()); - scalar.generateCInterface(file); - file.close(); - - file.open((path+"iscalar_attr.F90").c_str()); - scalar.generateFortranInterface(file); - file.close(); - - file.open((path+"scalargroup_interface_attr.F90").c_str()); - scalargroup.generateFortran2003Interface(file); - file.close(); - - file.open((path+"icscalargroup_attr.cpp").c_str()); - scalargroup.generateCInterface(file); - file.close(); - - file.open((path+"iscalargroup_attr.F90").c_str()); - scalargroup.generateFortranInterface(file); - file.close(); - - file.open((path+"axis_interface_attr.F90").c_str()); - axis.generateFortran2003Interface(file); - file.close(); - - file.open((path+"icaxis_attr.cpp").c_str()); - axis.generateCInterface(file); - file.close(); - - file.open((path+"iaxis_attr.F90").c_str()); - axis.generateFortranInterface(file); - file.close(); - - file.open((path+"axisgroup_interface_attr.F90").c_str()); - axisgroup.generateFortran2003Interface(file); - file.close(); - - file.open((path+"icaxisgroup_attr.cpp").c_str()); - axisgroup.generateCInterface(file); - file.close(); - - file.open((path+"iaxisgroup_attr.F90").c_str()); - axisgroup.generateFortranInterface(file); - file.close(); - - file.open((path+"domain_interface_attr.F90").c_str()); - domain.generateFortran2003Interface(file); - file.close(); - - file.open((path+"icdomain_attr.cpp").c_str()); - domain.generateCInterface(file); - file.close(); - - file.open((path+"idomain_attr.F90").c_str()); - domain.generateFortranInterface(file); - file.close(); - - file.open((path+"domaingroup_interface_attr.F90").c_str()); - domaingroup.generateFortran2003Interface(file); - file.close(); - - file.open((path+"icdomaingroup_attr.cpp").c_str()); - domaingroup.generateCInterface(file); - file.close(); - - file.open((path+"idomaingroup_attr.F90").c_str()); - domaingroup.generateFortranInterface(file); - file.close(); - - - file.open((path+"grid_interface_attr.F90").c_str()); - grid.generateFortran2003Interface(file); - file.close(); - - file.open((path+"icgrid_attr.cpp").c_str()); - grid.generateCInterface(file); - file.close(); - - file.open((path+"igrid_attr.F90").c_str()); - grid.generateFortranInterface(file); - file.close(); - - file.open((path+"gridgroup_interface_attr.F90").c_str()); - gridgroup.generateFortran2003Interface(file); - file.close(); - - file.open((path+"icgridgroup_attr.cpp").c_str()); - gridgroup.generateCInterface(file); - file.close(); - - file.open((path+"igridgroup_attr.F90").c_str()); - gridgroup.generateFortranInterface(file); - file.close(); - - - file.open((path+"field_interface_attr.F90").c_str()); - field.generateFortran2003Interface(file); - file.close(); - - file.open((path+"icfield_attr.cpp").c_str()); - field.generateCInterface(file); - file.close(); - - file.open((path+"ifield_attr.F90").c_str()); - field.generateFortranInterface(file); - file.close(); - - file.open((path+"fieldgroup_interface_attr.F90").c_str()); - fieldgroup.generateFortran2003Interface(file); - file.close(); - - file.open((path+"icfieldgroup_attr.cpp").c_str()); - fieldgroup.generateCInterface(file); - file.close(); - - file.open((path+"ifieldgroup_attr.F90").c_str()); - fieldgroup.generateFortranInterface(file); - file.close(); - - - - file.open((path+"variable_interface_attr.F90").c_str()); - variable.generateFortran2003Interface(file); - file.close(); - - file.open((path+"icvariable_attr.cpp").c_str()); - variable.generateCInterface(file); - file.close(); - - file.open((path+"ivariable_attr.F90").c_str()); - variable.generateFortranInterface(file); - file.close(); - - file.open((path+"variablegroup_interface_attr.F90").c_str()); - variablegroup.generateFortran2003Interface(file); - file.close(); - - file.open((path+"icvariablegroup_attr.cpp").c_str()); - variablegroup.generateCInterface(file); - file.close(); - - file.open((path+"ivariablegroup_attr.F90").c_str()); - variablegroup.generateFortranInterface(file); - file.close(); - - - - file.open((path+"file_interface_attr.F90").c_str()); - afile.generateFortran2003Interface(file); - file.close(); - - file.open((path+"icfile_attr.cpp").c_str()); - afile.generateCInterface(file); - file.close(); - - file.open((path+"ifile_attr.F90").c_str()); - afile.generateFortranInterface(file); - file.close(); - - file.open((path+"filegroup_interface_attr.F90").c_str()); - filegroup.generateFortran2003Interface(file); - file.close(); - - file.open((path+"icfilegroup_attr.cpp").c_str()); - filegroup.generateCInterface(file); - file.close(); - - file.open((path+"ifilegroup_attr.F90").c_str()); - filegroup.generateFortranInterface(file); - file.close(); - - - file.open((path+"calendar_wrapper_interface_attr.F90").c_str()); - calendarWrapper.generateFortran2003Interface(file); - file.close(); - - file.open((path+"iccalendar_wrapper_attr.cpp").c_str()); - calendarWrapper.generateCInterface(file); - file.close(); - - file.open((path+"icalendar_wrapper_attr.F90").c_str()); - calendarWrapper.generateFortranInterface(file); - file.close(); - - /*! - Domain transformations - */ - file.open((path+"zoom_domain_interface_attr.F90").c_str()); - zoomDomain.generateFortran2003Interface(file); - file.close(); - - file.open((path+"iczoom_domain_attr.cpp").c_str()); - zoomDomain.generateCInterface(file); - file.close(); - - file.open((path+"izoom_domain_attr.F90").c_str()); - zoomDomain.generateFortranInterface(file); - file.close(); - - file.open((path+"interpolate_domain_interface_attr.F90").c_str()); - interpolateDomain.generateFortran2003Interface(file); - file.close(); - - file.open((path+"icinterpolate_domain_attr.cpp").c_str()); - interpolateDomain.generateCInterface(file); - file.close(); - - file.open((path+"iinterpolate_domain_attr.F90").c_str()); - interpolateDomain.generateFortranInterface(file); - file.close(); - - file.open((path+"generate_rectilinear_domain_interface_attr.F90").c_str()); - genDomain.generateFortran2003Interface(file); - file.close(); - - file.open((path+"icgenerate_rectilinear_domain_attr.cpp").c_str()); - genDomain.generateCInterface(file); - file.close(); - - file.open((path+"igenerate_rectilinear_domain_attr.F90").c_str()); - genDomain.generateFortranInterface(file); - file.close(); - - file.open((path+"compute_connectivity_domain_interface_attr.F90").c_str()); - compConDomain.generateFortran2003Interface(file); - file.close(); - - file.open((path+"iccompute_connectivity_domain_attr.cpp").c_str()); - compConDomain.generateCInterface(file); - file.close(); - - file.open((path+"icompute_connectivity_domain_attr.F90").c_str()); - compConDomain.generateFortranInterface(file); - file.close(); - - file.open((path+"expand_domain_interface_attr.F90").c_str()); - expandDomain.generateFortran2003Interface(file); - file.close(); - - file.open((path+"icexpand_domain_attr.cpp").c_str()); - expandDomain.generateCInterface(file); - file.close(); - - file.open((path+"iexpand_domain_attr.F90").c_str()); - expandDomain.generateFortranInterface(file); - file.close(); - - file.open((path+"reorder_domain_interface_attr.F90").c_str()); - reorderDomain.generateFortran2003Interface(file); - file.close(); - - file.open((path+"icreorder_domain_attr.cpp").c_str()); - reorderDomain.generateCInterface(file); - file.close(); - - file.open((path+"ireorder_domain_attr.F90").c_str()); - reorderDomain.generateFortranInterface(file); - file.close(); - - /*! - Axis transformations - */ - file.open((path+"zoom_axis_interface_attr.F90").c_str()); - zoomAxis.generateFortran2003Interface(file); - file.close(); - - file.open((path+"iczoom_axis_attr.cpp").c_str()); - zoomAxis.generateCInterface(file); - file.close(); - - file.open((path+"izoom_axis_attr.F90").c_str()); - zoomAxis.generateFortranInterface(file); - file.close(); - - file.open((path+"interpolate_axis_interface_attr.F90").c_str()); - interpolateAxis.generateFortran2003Interface(file); - file.close(); - - file.open((path+"icinterpolate_axis_attr.cpp").c_str()); - interpolateAxis.generateCInterface(file); - file.close(); - - file.open((path+"iinterpolate_axis_attr.F90").c_str()); - interpolateAxis.generateFortranInterface(file); - file.close(); - - file.open((path+"inverse_axis_interface_attr.F90").c_str()); - inverseAxis.generateFortran2003Interface(file); - file.close(); - - file.open((path+"extract_axis_interface_attr.F90").c_str()); - extractAxis.generateFortran2003Interface(file); - file.close(); - - file.open((path+"icinverse_axis_attr.cpp").c_str()); - inverseAxis.generateCInterface(file); - file.close(); - - file.open((path+"iinverse_axis_attr.F90").c_str()); - inverseAxis.generateFortranInterface(file); - file.close(); - - file.open((path+"reduce_domain_to_axis_interface_attr.F90").c_str()); - reduceDomainToAxis.generateFortran2003Interface(file); - file.close(); - - file.open((path+"icreduce_domain_to_axis_attr.cpp").c_str()); - reduceDomainToAxis.generateCInterface(file); - file.close(); - - file.open((path+"ireduce_domain_to_axis_attr.F90").c_str()); - reduceDomainToAxis.generateFortranInterface(file); - file.close(); - - file.open((path+"reduce_axis_to_axis_interface_attr.F90").c_str()); - reduceAxisToAxis.generateFortran2003Interface(file); - file.close(); - - file.open((path+"icreduce_axis_to_axis_attr.cpp").c_str()); - reduceAxisToAxis.generateCInterface(file); - file.close(); - - file.open((path+"ireduce_axis_to_axis_attr.F90").c_str()); - reduceAxisToAxis.generateFortranInterface(file); - file.close(); - - file.open((path+"extract_domain_to_axis_interface_attr.F90").c_str()); - extractDomainToAxis.generateFortran2003Interface(file); - file.close(); - - file.open((path+"icextract_domain_to_axis_attr.cpp").c_str()); - extractDomainToAxis.generateCInterface(file); - file.close(); - - file.open((path+"iextract_domain_to_axis_attr.F90").c_str()); - extractDomainToAxis.generateFortranInterface(file); - file.close(); - - - file.open((path+"temporal_splitting_interface_attr.F90").c_str()); - temporalSplitting.generateFortran2003Interface(file); - file.close(); - - file.open((path+"ictemporal_splitting_attr.cpp").c_str()); - temporalSplitting.generateCInterface(file); - file.close(); - - file.open((path+"itemporal_splitting_attr.F90").c_str()); - temporalSplitting.generateFortranInterface(file); - file.close(); - - - file.open((path+"duplicate_scalar_to_axis_interface_attr.F90").c_str()); - duplicateScalarToAxis.generateFortran2003Interface(file); - file.close(); - - file.open((path+"icduplicate_scalar_to_axis_attr.cpp").c_str()); - duplicateScalarToAxis.generateCInterface(file); - file.close(); - - file.open((path+"iduplicate_scalar_to_axis_attr.F90").c_str()); - duplicateScalarToAxis.generateFortranInterface(file); - file.close(); - /*! - Scalar transformations - */ - file.open((path+"reduce_axis_to_scalar_interface_attr.F90").c_str()); - reduceAxisToScalar.generateFortran2003Interface(file); - file.close(); - - file.open((path+"icreduce_axis_to_scalar_attr.cpp").c_str()); - reduceAxisToScalar.generateCInterface(file); - file.close(); - - file.open((path+"ireduce_axis_to_scalar_attr.F90").c_str()); - reduceAxisToScalar.generateFortranInterface(file); - file.close(); - - file.open((path+"extract_axis_to_scalar_interface_attr.F90").c_str()); - extractAxisToScalar.generateFortran2003Interface(file); - file.close(); - - file.open((path+"icextract_axis_to_scalar_attr.cpp").c_str()); - extractAxisToScalar.generateCInterface(file); - file.close(); - - file.open((path+"iextract_axis_to_scalar_attr.F90").c_str()); - extractAxisToScalar.generateFortranInterface(file); - file.close(); - - - file.open((path+"reduce_domain_to_scalar_interface_attr.F90").c_str()); - reduceDomainToScalar.generateFortran2003Interface(file); - file.close(); - - file.open((path+"icreduce_domain_to_scalar_attr.cpp").c_str()); - reduceDomainToScalar.generateCInterface(file); - file.close(); - - file.open((path+"ireduce_domain_to_scalar_attr.F90").c_str()); - reduceDomainToScalar.generateFortranInterface(file); - file.close(); - - - file.open((path+"reduce_scalar_to_scalar_interface_attr.F90").c_str()); - reduceScalarToScalar.generateFortran2003Interface(file); - file.close(); - - file.open((path+"icreduce_scalar_to_scalar_attr.cpp").c_str()); - reduceScalarToScalar.generateCInterface(file); - file.close(); - - file.open((path+"ireduce_scalar_to_scalar_attr.F90").c_str()); - reduceScalarToScalar.generateFortranInterface(file); - file.close(); - - - - - - file.open((path+"context_interface_attr.F90").c_str()); - context->generateFortran2003Interface(file); - file.close(); - - file.open((path+"iccontext_attr.cpp").c_str()); - context->generateCInterface(file); - file.close(); - - file.open((path+"icontext_attr.F90").c_str()); - context->generateFortranInterface(file); - file.close(); -} diff --git a/xios_2311_src/trunk/.svn/pristine/0b/0b0add2da7903aa8b3d4a867a2e675fddefc5ef4.svn-base b/xios_2311_src/trunk/.svn/pristine/0b/0b0add2da7903aa8b3d4a867a2e675fddefc5ef4.svn-base deleted file mode 100644 index 89e699eae72773ba0d79444d9cb42b7b63b7f7d1..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/0b/0b0add2da7903aa8b3d4a867a2e675fddefc5ef4.svn-base +++ /dev/null @@ -1,2448 +0,0 @@ -#line 2 "lex_parser.cpp" - -#line 4 "lex_parser.cpp" - -#define YY_INT_ALIGNED short int - -/* A lexical scanner generated by flex */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 37 -#if YY_FLEX_SUBMINOR_VERSION > 0 -#define FLEX_BETA -#endif - -/* First, we deal with platform-specific or compiler-specific issues. */ - -/* begin standard C headers. */ -#include -#include -#include -#include - -/* end standard C headers. */ - -/* flex integer type definitions */ - -#ifndef FLEXINT_H -#define FLEXINT_H - -/* C99 systems have . Non-C99 systems may or may not. */ - -#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - -/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, - * if you want the limit (max/min) macros for int types. - */ -#ifndef __STDC_LIMIT_MACROS -#define __STDC_LIMIT_MACROS 1 -#endif - -#include -typedef int8_t flex_int8_t; -typedef uint8_t flex_uint8_t; -typedef int16_t flex_int16_t; -typedef uint16_t flex_uint16_t; -typedef int32_t flex_int32_t; -typedef uint32_t flex_uint32_t; -#else -typedef signed char flex_int8_t; -typedef short int flex_int16_t; -typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; -typedef unsigned short int flex_uint16_t; -typedef unsigned int flex_uint32_t; - -/* Limits of integral types. */ -#ifndef INT8_MIN -#define INT8_MIN (-128) -#endif -#ifndef INT16_MIN -#define INT16_MIN (-32767-1) -#endif -#ifndef INT32_MIN -#define INT32_MIN (-2147483647-1) -#endif -#ifndef INT8_MAX -#define INT8_MAX (127) -#endif -#ifndef INT16_MAX -#define INT16_MAX (32767) -#endif -#ifndef INT32_MAX -#define INT32_MAX (2147483647) -#endif -#ifndef UINT8_MAX -#define UINT8_MAX (255U) -#endif -#ifndef UINT16_MAX -#define UINT16_MAX (65535U) -#endif -#ifndef UINT32_MAX -#define UINT32_MAX (4294967295U) -#endif - -#endif /* ! C99 */ - -#endif /* ! FLEXINT_H */ - -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) - -#define YY_USE_CONST - -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN (yy_start) = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START (((yy_start) - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart(yyin ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#ifndef YY_BUF_SIZE -#define YY_BUF_SIZE 16384 -#endif - -/* The state buf must be large enough to hold one state per character in the main buffer. - */ -#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) - -#ifndef YY_TYPEDEF_YY_BUFFER_STATE -#define YY_TYPEDEF_YY_BUFFER_STATE -typedef struct yy_buffer_state *YY_BUFFER_STATE; -#endif - -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - -extern yy_size_t yyleng; - -extern FILE *yyin, *yyout; - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - - #define YY_LESS_LINENO(n) - -/* Return all but the first "n" matched characters back to the input stream. */ -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - *yy_cp = (yy_hold_char); \ - YY_RESTORE_YY_MORE_OFFSET \ - (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) - -#define unput(c) yyunput( c, (yytext_ptr) ) - -#ifndef YY_STRUCT_YY_BUFFER_STATE -#define YY_STRUCT_YY_BUFFER_STATE -struct yy_buffer_state - { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - yy_size_t yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - int yy_bs_lineno; /**< The line count. */ - int yy_bs_column; /**< The column count. */ - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; - -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - - }; -#endif /* !YY_STRUCT_YY_BUFFER_STATE */ - -/* Stack of input buffers. */ -static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ -static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - * - * Returns the top of the stack, or NULL. - */ -#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ - ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ - : NULL) - -/* Same as previous macro, but useful when we know that the buffer stack is not - * NULL or when we need an lvalue. For internal use only. - */ -#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] - -/* yy_hold_char holds the character lost when yytext is formed. */ -static char yy_hold_char; -static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ -yy_size_t yyleng; - -/* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; -static int yy_init = 0; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ - -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... - */ -static int yy_did_buffer_switch_on_eof; - -void yyrestart (FILE *input_file ); -void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); -void yy_delete_buffer (YY_BUFFER_STATE b ); -void yy_flush_buffer (YY_BUFFER_STATE b ); -void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); -void yypop_buffer_state (void ); - -static void yyensure_buffer_stack (void ); -static void yy_load_buffer_state (void ); -static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); - -#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) - -YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); -YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ); - -void *yyalloc (yy_size_t ); -void *yyrealloc (void *,yy_size_t ); -void yyfree (void * ); - -#define yy_new_buffer yy_create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! YY_CURRENT_BUFFER ){ \ - yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if ( ! YY_CURRENT_BUFFER ){\ - yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ - } - -#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) - -#define yywrap() 1 -#define YY_SKIP_YYWRAP - -typedef char YY_CHAR; - -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; - -typedef int yy_state_type; - -extern int yylineno; - -int yylineno = 1; - -extern char *yytext; -#define yytext_ptr yytext -static yyconst flex_int16_t yy_nxt[][128] = - { - { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 - }, - - { - 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 5, 4, 4, 4, 6, 4, 4, 4, - 7, 8, 9, 10, 4, 11, 4, 12, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 14, 4, - 15, 16, 17, 18, 19, 20, 20, 20, 20, 20, - - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 4, 4, 4, 21, 4, 4, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 4, 4, 4, 4, 4 - }, - - { - 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 5, 4, 4, 4, 6, 4, 4, 4, - - 7, 8, 9, 10, 4, 11, 4, 12, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 14, 4, - 15, 16, 17, 18, 19, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 4, 4, 4, 21, 4, 4, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 4, 4, 4, 4, 4 - }, - - { - -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, - - -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, - -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, - -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, - -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, - -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, - -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, - -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, - -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, - -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, - -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, - - -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, - -3, -3, -3, -3, -3, -3, -3, -3 - }, - - { - 3, -4, -4, -4, -4, -4, -4, -4, -4, -4, - -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, - -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, - -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, - -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, - -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, - -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, - -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, - - -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, - -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, - -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, - -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, - -4, -4, -4, -4, -4, -4, -4, -4 - }, - - { - 3, -5, -5, -5, -5, -5, -5, -5, -5, 23, - -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, - -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, - -5, -5, 23, -5, -5, -5, -5, -5, -5, -5, - -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, - - -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, - -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, - -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, - -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, - -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, - -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, - -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, - -5, -5, -5, -5, -5, -5, -5, -5 - }, - - { - 3, -6, -6, -6, -6, -6, -6, -6, -6, -6, - -6, -6, -6, -6, -6, -6, -6, -6, -6, -6, - - -6, -6, -6, -6, -6, -6, -6, -6, -6, -6, - -6, -6, -6, -6, -6, -6, -6, -6, -6, -6, - -6, -6, -6, -6, -6, -6, -6, -6, -6, -6, - -6, -6, -6, -6, -6, -6, -6, -6, -6, -6, - -6, -6, -6, -6, -6, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, -6, -6, -6, -6, -6, -6, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - - 24, 24, 24, -6, -6, -6, -6, -6 - }, - - { - 3, -7, -7, -7, -7, -7, -7, -7, -7, -7, - -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, - -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, - -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, - -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, - -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, - -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, - -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, - -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, - - -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, - -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, - -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, - -7, -7, -7, -7, -7, -7, -7, -7 - }, - - { - 3, -8, -8, -8, -8, -8, -8, -8, -8, -8, - -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, - -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, - -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, - -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, - -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, - - -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, - -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, - -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, - -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, - -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, - -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, - -8, -8, -8, -8, -8, -8, -8, -8 - }, - - { - 3, -9, -9, -9, -9, -9, -9, -9, -9, -9, - -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, - -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, - - -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, - -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, - -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, - -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, - -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, - -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, - -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, - -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, - -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, - -9, -9, -9, -9, -9, -9, -9, -9 - - }, - - { - 3, -10, -10, -10, -10, -10, -10, -10, -10, -10, - -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, - -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, - -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, - -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, - -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, - -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, - -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, - -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, - -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, - - -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, - -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, - -10, -10, -10, -10, -10, -10, -10, -10 - }, - - { - 3, -11, -11, -11, -11, -11, -11, -11, -11, -11, - -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, - -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, - -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, - -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, - -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, - -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, - - -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, - -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, - -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, - -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, - -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, - -11, -11, -11, -11, -11, -11, -11, -11 - }, - - { - 3, -12, -12, -12, -12, -12, -12, -12, -12, -12, - -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, - -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, - -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, - - -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, - -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, - -12, 25, -12, -12, -12, -12, -12, -12, -12, -12, - -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, - -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, - -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, - -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, - -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, - -12, -12, -12, -12, -12, -12, -12, -12 - }, - - { - 3, -13, -13, -13, -13, -13, -13, -13, -13, -13, - - -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, - -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, - -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, - -13, -13, -13, -13, -13, -13, 26, -13, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, -13, -13, - -13, -13, -13, -13, -13, -13, -13, -13, -13, 28, - -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, - -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, - -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, - -13, 28, -13, -13, -13, -13, -13, -13, -13, -13, - - -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, - -13, -13, -13, -13, -13, -13, -13, -13 - }, - - { - 3, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, - - -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14, -14, -14 - }, - - { - 3, -15, -15, -15, -15, -15, -15, -15, -15, -15, - -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, - -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, - -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, - -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, - - -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, - -15, 29, -15, -15, -15, -15, -15, -15, -15, -15, - -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, - -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, - -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, - -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, - -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, - -15, -15, -15, -15, -15, -15, -15, -15 - }, - - { - 3, -16, -16, -16, -16, -16, -16, -16, -16, -16, - -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, - - -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, - -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, - -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, - -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, - -16, 30, -16, -16, -16, -16, -16, -16, -16, -16, - -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, - -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, - -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, - -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, - -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, - - -16, -16, -16, -16, -16, -16, -16, -16 - }, - - { - 3, -17, -17, -17, -17, -17, -17, -17, -17, -17, - -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, - -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, - -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, - -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, - -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, - -17, 31, -17, -17, -17, -17, -17, -17, -17, -17, - -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, - -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, - - -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, - -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, - -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, - -17, -17, -17, -17, -17, -17, -17, -17 - }, - - { - 3, -18, -18, -18, -18, -18, -18, -18, -18, -18, - -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, - -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, - -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, - -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, - -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, - - -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, - -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, - -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, - -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, - -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, - -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, - -18, -18, -18, -18, -18, -18, -18, -18 - }, - - { - 3, -19, -19, -19, -19, -19, -19, -19, -19, -19, - -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, - -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, - - -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, - -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, - -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, - -19, -19, -19, -19, -19, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, -19, -19, -19, -19, -19, -19, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, -19, -19, -19, -19, -19 - - }, - - { - 3, -20, -20, -20, -20, -20, -20, -20, -20, -20, - -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, - -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, - -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, - -20, -20, -20, -20, -20, -20, -20, -20, 33, 33, - 33, 33, 33, 33, 33, 33, 33, 33, -20, -20, - -20, -20, -20, -20, -20, 33, 33, 33, 33, 33, - 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, - 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, - 33, -20, -20, -20, -20, 33, -20, 33, 33, 33, - - 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, - 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, - 33, 33, 33, -20, -20, -20, -20, -20 - }, - - { - 3, -21, -21, -21, -21, -21, -21, -21, -21, -21, - -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, - -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, - -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, - -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, - -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, - -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, - - -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, - -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, - -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, - -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, - -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, - -21, -21, -21, -21, -21, -21, -21, -21 - }, - - { - 3, -22, -22, -22, -22, -22, -22, -22, -22, -22, - -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, - -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, - -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, - - -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, - -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, - -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, - -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, - -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, - -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, - -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, - -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, - -22, -22, -22, -22, -22, -22, -22, -22 - }, - - { - 3, -23, -23, -23, -23, -23, -23, -23, -23, 23, - - -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, - -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, - -23, -23, 23, -23, -23, -23, -23, -23, -23, -23, - -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, - -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, - -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, - -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, - -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, - -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, - -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, - - -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, - -23, -23, -23, -23, -23, -23, -23, -23 - }, - - { - 3, -24, -24, -24, -24, -24, -24, -24, -24, -24, - -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, - -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, - -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, - -24, -24, -24, -24, -24, -24, -24, -24, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, -24, -24, - -24, -24, -24, -24, -24, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, -24, -24, -24, -24, 34, -24, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, -24, -24, -24, -24, -24 - }, - - { - 3, -25, -25, -25, -25, -25, -25, -25, -25, -25, - -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, - -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, - -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, - -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, - - -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, - -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, - -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, - -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, - -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, - -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, - -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, - -25, -25, -25, -25, -25, -25, -25, -25 - }, - - { - 3, -26, -26, -26, -26, -26, -26, -26, -26, -26, - -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, - - -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, - -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, - -26, -26, -26, -26, -26, -26, -26, -26, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, -26, -26, - -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, - -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, - -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, - -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, - -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, - -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, - - -26, -26, -26, -26, -26, -26, -26, -26 - }, - - { - 3, -27, -27, -27, -27, -27, -27, -27, -27, -27, - -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, - -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, - -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, - -27, -27, -27, -27, -27, -27, 26, -27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, -27, -27, - -27, -27, -27, -27, -27, -27, -27, -27, -27, 28, - -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, - -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, - - -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, - -27, 28, -27, -27, -27, -27, -27, -27, -27, -27, - -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, - -27, -27, -27, -27, -27, -27, -27, -27 - }, - - { - 3, -28, -28, -28, -28, -28, -28, -28, -28, -28, - -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, - -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, - -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, - -28, -28, -28, 36, -28, 36, -28, -28, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, -28, -28, - - -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, - -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, - -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, - -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, - -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, - -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, - -28, -28, -28, -28, -28, -28, -28, -28 - }, - - { - 3, -29, -29, -29, -29, -29, -29, -29, -29, -29, - -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, - -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, - - -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, - -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, - -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, - -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, - -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, - -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, - -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, - -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, - -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, - -29, -29, -29, -29, -29, -29, -29, -29 - - }, - - { - 3, -30, -30, -30, -30, -30, -30, -30, -30, -30, - -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, - -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, - -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, - -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, - -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, - -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, - -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, - -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, - -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, - - -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, - -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, - -30, -30, -30, -30, -30, -30, -30, -30 - }, - - { - 3, -31, -31, -31, -31, -31, -31, -31, -31, -31, - -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, - -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, - -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, - -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, - -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, - -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, - - -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, - -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, - -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, - -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, - -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, - -31, -31, -31, -31, -31, -31, -31, -31 - }, - - { - 3, -32, -32, -32, -32, -32, -32, -32, -32, -32, - -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, - -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, - -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, - - -32, -32, -32, -32, -32, -32, -32, -32, 38, 38, - 38, 38, 38, 38, 38, 38, 38, 38, -32, -32, - -32, -32, -32, -32, -32, 38, 38, 38, 38, 38, - 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, - 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, - 38, -32, -32, -32, -32, 38, -32, 38, 38, 38, - 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, - 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, - 38, 38, 38, -32, -32, -32, -32, -32 - }, - - { - 3, -33, -33, -33, -33, -33, -33, -33, -33, -33, - - -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, - -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, - -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, - -33, -33, -33, -33, -33, -33, -33, -33, 33, 33, - 33, 33, 33, 33, 33, 33, 33, 33, -33, -33, - -33, -33, -33, -33, -33, 33, 33, 33, 33, 33, - 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, - 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, - 33, -33, -33, -33, -33, 33, -33, 33, 33, 33, - 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, - - 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, - 33, 33, 33, -33, -33, -33, -33, -33 - }, - - { - 3, -34, -34, -34, -34, -34, -34, -34, -34, -34, - -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, - -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, - -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, - -34, -34, -34, -34, -34, -34, -34, -34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, -34, -34, - -34, -34, -34, -34, -34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, -34, -34, -34, -34, 34, -34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, -34, -34, -34, -34, -34 - }, - - { - 3, -35, -35, -35, -35, -35, -35, -35, -35, -35, - -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, - -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, - -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, - -35, -35, -35, -35, -35, -35, -35, -35, 35, 35, - - 35, 35, 35, 35, 35, 35, 35, 35, -35, -35, - -35, -35, -35, -35, -35, -35, -35, -35, -35, 28, - -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, - -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, - -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, - -35, 28, -35, -35, -35, -35, -35, -35, -35, -35, - -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, - -35, -35, -35, -35, -35, -35, -35, -35 - }, - - { - 3, -36, -36, -36, -36, -36, -36, -36, -36, -36, - -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, - - -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, - -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, - -36, -36, -36, -36, -36, -36, -36, -36, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, -36, -36, - -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, - -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, - -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, - -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, - -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, - -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, - - -36, -36, -36, -36, -36, -36, -36, -36 - }, - - { - 3, -37, -37, -37, -37, -37, -37, -37, -37, -37, - -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, - -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, - -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, - -37, -37, -37, -37, -37, -37, -37, -37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, -37, -37, - -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, - -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, - -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, - - -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, - -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, - -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, - -37, -37, -37, -37, -37, -37, -37, -37 - }, - - { - 3, -38, -38, -38, -38, -38, -38, -38, -38, -38, - -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, - -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, - -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, - -38, -38, -38, -38, -38, -38, -38, -38, 38, 38, - 38, 38, 38, 38, 38, 38, 38, 38, -38, -38, - - -38, -38, -38, -38, -38, 38, 38, 38, 38, 38, - 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, - 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, - 38, -38, -38, -38, -38, 38, -38, 38, 38, 38, - 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, - 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, - 38, 38, 38, -38, -38, -38, -38, -38 - }, - - } ; - -static yy_state_type yy_get_previous_state (void ); -static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); -static int yy_get_next_buffer (void ); -static void yy_fatal_error (yyconst char msg[] ); - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ -#define YY_DO_BEFORE_ACTION \ - (yytext_ptr) = yy_bp; \ - yyleng = (size_t) (yy_cp - yy_bp); \ - (yy_hold_char) = *yy_cp; \ - *yy_cp = '\0'; \ - (yy_c_buf_p) = yy_cp; - -#define YY_NUM_RULES 22 -#define YY_END_OF_BUFFER 23 -/* This struct is not used in this scanner, - but its presence is necessary. */ -struct yy_trans_info - { - flex_int32_t yy_verify; - flex_int32_t yy_nxt; - }; -static yyconst flex_int16_t yy_accept[39] = - { 0, - 0, 0, 23, 22, 1, 22, 19, 20, 8, 6, - 7, 9, 2, 18, 12, 22, 13, 17, 22, 5, - 10, 21, 1, 4, 16, 0, 2, 0, 14, 11, - 15, 3, 5, 4, 2, 0, 2, 3 - } ; - -static yy_state_type yy_last_accepting_state; -static char *yy_last_accepting_cpos; - -static yyconst yy_state_type yy_NUL_trans[39] = - { 0, - 22, 22, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 - } ; - -extern int yy_flex_debug; -int yy_flex_debug = 0; - -/* The intent behind this definition is that it'll catch - * any uses of REJECT which flex missed. - */ -#define REJECT reject_used_but_not_detected -#define yymore() yymore_used_but_not_detected -#define YY_MORE_ADJ 0 -#define YY_RESTORE_YY_MORE_OFFSET -char *yytext; -#line 1 "lex_parser.lex" -#line 3 "lex_parser.lex" - -extern "C" -{ - int yylex(void); -} -#undef YY_INPUT -#define YY_INPUT(b, r, s) readInputForLexer(b, &r, s) -#include - -int readInputForLexer(char* buffer, size_t* numBytesRead, size_t maxBytesToRead); - -#include "filter_expr_node.hpp" -#include "yacc_parser.hpp" - -#line 1098 "lex_parser.cpp" - -#define INITIAL 0 - -#ifndef YY_NO_UNISTD_H -/* Special case for "unistd.h", since it is non-ANSI. We include it way - * down here because we want the user's section 1 to have been scanned first. - * The user has a chance to override it with an option. - */ -#include -#endif - -#ifndef YY_EXTRA_TYPE -#define YY_EXTRA_TYPE void * -#endif - -static int yy_init_globals (void ); - -/* Accessor methods to globals. - These are made visible to non-reentrant scanners for convenience. */ - -int yylex_destroy (void ); - -int yyget_debug (void ); - -void yyset_debug (int debug_flag ); - -YY_EXTRA_TYPE yyget_extra (void ); - -void yyset_extra (YY_EXTRA_TYPE user_defined ); - -FILE *yyget_in (void ); - -void yyset_in (FILE * in_str ); - -FILE *yyget_out (void ); - -void yyset_out (FILE * out_str ); - -yy_size_t yyget_leng (void ); - -char *yyget_text (void ); - -int yyget_lineno (void ); - -void yyset_lineno (int line_number ); - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int yywrap (void ); -#else -extern int yywrap (void ); -#endif -#endif - - static void yyunput (int c,char *buf_ptr ); - -#ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ); -#endif - -#ifndef YY_NO_INPUT - -#ifdef __cplusplus -static int yyinput (void ); -#else -static int input (void ); -#endif - -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#define YY_READ_BUF_SIZE 8192 -#endif - -/* Copy whatever the last rule matched to the standard output. */ -#ifndef ECHO -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ - errno=0; \ - while ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \ - { \ - if( errno != EINTR) \ - { \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - break; \ - } \ - errno=0; \ - clearerr(yyin); \ - }\ -\ - -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) -#endif - -/* end tables serialization structures and prototypes */ - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -#define YY_DECL_IS_OURS 1 - -extern int yylex (void); - -#define YY_DECL int yylex (void) -#endif /* !YY_DECL */ - -/* Code executed at the beginning of each rule, after yytext and yyleng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK break; -#endif - -#define YY_RULE_SETUP \ - YY_USER_ACTION - -/** The main scanner function which does all the work. - */ -YY_DECL -{ - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; - -#line 29 "lex_parser.lex" - - -#line 1267 "lex_parser.cpp" - - if ( !(yy_init) ) - { - (yy_init) = 1; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! (yy_start) ) - (yy_start) = 1; /* first start state */ - - if ( ! yyin ) - yyin = stdin; - - if ( ! yyout ) - yyout = stdout; - - if ( ! YY_CURRENT_BUFFER ) { - yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ); - } - - yy_load_buffer_state( ); - } - - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = (yy_c_buf_p); - - /* Support of yytext. */ - *yy_cp = (yy_hold_char); - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - - yy_current_state = (yy_start); -yy_match: - while ( (yy_current_state = yy_nxt[yy_current_state][ YY_SC_TO_UI(*yy_cp) ]) > 0 ) - { - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - - ++yy_cp; - } - - yy_current_state = -yy_current_state; - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - - YY_DO_BEFORE_ACTION; - -do_action: /* This label is used only to access EOF actions. */ - - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = (yy_hold_char); - yy_cp = (yy_last_accepting_cpos) + 1; - yy_current_state = (yy_last_accepting_state); - goto yy_find_action; - -case 1: -YY_RULE_SETUP -#line 31 "lex_parser.lex" -{ /* We ignore white characters */ } - YY_BREAK -case 2: -YY_RULE_SETUP -#line 33 "lex_parser.lex" -{ - yylval.str = new std::string(yytext); - return NUMBER; - } - YY_BREAK -case 3: -YY_RULE_SETUP -#line 38 "lex_parser.lex" -{ - yylval.str = new std::string(yytext + 1); - return AVERAGE; - } - YY_BREAK -case 4: -YY_RULE_SETUP -#line 43 "lex_parser.lex" -{ - yylval.str = new std::string(yytext + 1); - return VAR; - } - YY_BREAK -case 5: -YY_RULE_SETUP -#line 48 "lex_parser.lex" -{ - yylval.str = new std::string(yytext); - return ID; - } - YY_BREAK -case 6: -YY_RULE_SETUP -#line 54 "lex_parser.lex" -return PLUS; - YY_BREAK -case 7: -YY_RULE_SETUP -#line 55 "lex_parser.lex" -return MINUS; - YY_BREAK -case 8: -YY_RULE_SETUP -#line 57 "lex_parser.lex" -return TIMES; - YY_BREAK -case 9: -YY_RULE_SETUP -#line 58 "lex_parser.lex" -return DIVIDE; - YY_BREAK -case 10: -YY_RULE_SETUP -#line 60 "lex_parser.lex" -return POWER; - YY_BREAK -case 11: -YY_RULE_SETUP -#line 62 "lex_parser.lex" -return EQ; - YY_BREAK -case 12: -YY_RULE_SETUP -#line 63 "lex_parser.lex" -return LT; - YY_BREAK -case 13: -YY_RULE_SETUP -#line 64 "lex_parser.lex" -return GT; - YY_BREAK -case 14: -YY_RULE_SETUP -#line 65 "lex_parser.lex" -return LE; - YY_BREAK -case 15: -YY_RULE_SETUP -#line 66 "lex_parser.lex" -return GE; - YY_BREAK -case 16: -YY_RULE_SETUP -#line 67 "lex_parser.lex" -return NE; - YY_BREAK -case 17: -YY_RULE_SETUP -#line 68 "lex_parser.lex" -return QUESTION_MARK; - YY_BREAK -case 18: -YY_RULE_SETUP -#line 69 "lex_parser.lex" -return COLON; - YY_BREAK -case 19: -YY_RULE_SETUP -#line 70 "lex_parser.lex" -return LEFT_PARENTHESIS; - YY_BREAK -case 20: -YY_RULE_SETUP -#line 71 "lex_parser.lex" -return RIGHT_PARENTHESIS; - YY_BREAK -case 21: -YY_RULE_SETUP -#line 73 "lex_parser.lex" -return END; - YY_BREAK -case 22: -YY_RULE_SETUP -#line 74 "lex_parser.lex" -ECHO; - YY_BREAK -#line 1460 "lex_parser.cpp" -case YY_STATE_EOF(INITIAL): - yyterminate(); - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = (yy_hold_char); - YY_RESTORE_YY_MORE_OFFSET - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between YY_CURRENT_BUFFER and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++(yy_c_buf_p); - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = (yy_c_buf_p); - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_END_OF_FILE: - { - (yy_did_buffer_switch_on_eof) = 0; - - if ( yywrap( ) ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = - (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - (yy_c_buf_p) = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ -} /* end of yylex */ - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ -static int yy_get_next_buffer (void) -{ - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = (yytext_ptr); - register int number_to_move, i; - int ret_val; - - if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; - - else - { - yy_size_t num_to_read = - YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; - - int yy_c_buf_p_offset = - (int) ((yy_c_buf_p) - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - yy_size_t new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - - number_to_move - 1; - - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - (yy_n_chars), num_to_read ); - - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - if ( (yy_n_chars) == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart(yyin ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { - /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); - if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); - } - - (yy_n_chars) += number_to_move; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - - (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; - - return ret_val; -} - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - - static yy_state_type yy_get_previous_state (void) -{ - register yy_state_type yy_current_state; - register char *yy_cp; - - yy_current_state = (yy_start); - - for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) - { - if ( *yy_cp ) - { - yy_current_state = yy_nxt[yy_current_state][YY_SC_TO_UI(*yy_cp)]; - } - else - yy_current_state = yy_NUL_trans[yy_current_state]; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - } - - return yy_current_state; -} - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) -{ - register int yy_is_jam; - register char *yy_cp = (yy_c_buf_p); - - yy_current_state = yy_NUL_trans[yy_current_state]; - yy_is_jam = (yy_current_state == 0); - - if ( ! yy_is_jam ) - { - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - } - - return yy_is_jam ? 0 : yy_current_state; -} - - static void yyunput (int c, register char * yy_bp ) -{ - register char *yy_cp; - - yy_cp = (yy_c_buf_p); - - /* undo effects of setting up yytext */ - *yy_cp = (yy_hold_char); - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register yy_size_t number_to_move = (yy_n_chars) + 2; - register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - register char *source = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; -} - -#ifndef YY_NO_INPUT -#ifdef __cplusplus - static int yyinput (void) -#else - static int input (void) -#endif - -{ - int c; - - *(yy_c_buf_p) = (yy_hold_char); - - if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - /* This was really a NUL. */ - *(yy_c_buf_p) = '\0'; - - else - { /* need more input */ - yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); - ++(yy_c_buf_p); - - switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - yyrestart(yyin ); - - /*FALLTHROUGH*/ - - case EOB_ACT_END_OF_FILE: - { - if ( yywrap( ) ) - return EOF; - - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(); -#else - return input(); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = (yytext_ptr) + offset; - break; - } - } - } - - c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve yytext */ - (yy_hold_char) = *++(yy_c_buf_p); - - return c; -} -#endif /* ifndef YY_NO_INPUT */ - -/** Immediately switch to a different input stream. - * @param input_file A readable stream. - * - * @note This function does not reset the start condition to @c INITIAL . - */ - void yyrestart (FILE * input_file ) -{ - - if ( ! YY_CURRENT_BUFFER ){ - yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ); - } - - yy_init_buffer(YY_CURRENT_BUFFER,input_file ); - yy_load_buffer_state( ); -} - -/** Switch to a different input buffer. - * @param new_buffer The new input buffer. - * - */ - void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) -{ - - /* TODO. We should be able to replace this entire function body - * with - * yypop_buffer_state(); - * yypush_buffer_state(new_buffer); - */ - yyensure_buffer_stack (); - if ( YY_CURRENT_BUFFER == new_buffer ) - return; - - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - YY_CURRENT_BUFFER_LVALUE = new_buffer; - yy_load_buffer_state( ); - - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - (yy_did_buffer_switch_on_eof) = 1; -} - -static void yy_load_buffer_state (void) -{ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; - (yy_hold_char) = *(yy_c_buf_p); -} - -/** Allocate and initialize an input buffer state. - * @param file A readable stream. - * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. - * - * @return the allocated buffer state. - */ - YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) -{ - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_is_our_buffer = 1; - - yy_init_buffer(b,file ); - - return b; -} - -/** Destroy the buffer. - * @param b a buffer created with yy_create_buffer() - * - */ - void yy_delete_buffer (YY_BUFFER_STATE b ) -{ - - if ( ! b ) - return; - - if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ - YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - yyfree((void *) b->yy_ch_buf ); - - yyfree((void *) b ); -} - -/* Initializes or reinitializes a buffer. - * This function is sometimes called more than once on the same buffer, - * such as during a yyrestart() or at EOF. - */ - static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) - -{ - int oerrno = errno; - - yy_flush_buffer(b ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - - /* If b is the current buffer, then yy_init_buffer was _probably_ - * called from yyrestart() or through yy_get_next_buffer. - * In that case, we don't want to reset the lineno or column. - */ - if (b != YY_CURRENT_BUFFER){ - b->yy_bs_lineno = 1; - b->yy_bs_column = 0; - } - - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; - - errno = oerrno; -} - -/** Discard all buffered characters. On the next scan, YY_INPUT will be called. - * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. - * - */ - void yy_flush_buffer (YY_BUFFER_STATE b ) -{ - if ( ! b ) - return; - - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == YY_CURRENT_BUFFER ) - yy_load_buffer_state( ); -} - -/** Pushes the new state onto the stack. The new state becomes - * the current state. This function will allocate the stack - * if necessary. - * @param new_buffer The new state. - * - */ -void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) -{ - if (new_buffer == NULL) - return; - - yyensure_buffer_stack(); - - /* This block is copied from yy_switch_to_buffer. */ - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - /* Only push if top exists. Otherwise, replace top. */ - if (YY_CURRENT_BUFFER) - (yy_buffer_stack_top)++; - YY_CURRENT_BUFFER_LVALUE = new_buffer; - - /* copied from yy_switch_to_buffer. */ - yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; -} - -/** Removes and deletes the top of the stack, if present. - * The next element becomes the new top. - * - */ -void yypop_buffer_state (void) -{ - if (!YY_CURRENT_BUFFER) - return; - - yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - if ((yy_buffer_stack_top) > 0) - --(yy_buffer_stack_top); - - if (YY_CURRENT_BUFFER) { - yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; - } -} - -/* Allocates the stack if it does not exist. - * Guarantees space for at least one push. - */ -static void yyensure_buffer_stack (void) -{ - yy_size_t num_to_alloc; - - if (!(yy_buffer_stack)) { - - /* First allocation is just for 2 elements, since we don't know if this - * scanner will even need a stack. We use 2 instead of 1 to avoid an - * immediate realloc on the next call. - */ - num_to_alloc = 1; - (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc - (num_to_alloc * sizeof(struct yy_buffer_state*) - ); - if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - - memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - - (yy_buffer_stack_max) = num_to_alloc; - (yy_buffer_stack_top) = 0; - return; - } - - if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ - - /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; - - num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc - ((yy_buffer_stack), - num_to_alloc * sizeof(struct yy_buffer_state*) - ); - if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - - /* zero only the new slots.*/ - memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); - (yy_buffer_stack_max) = num_to_alloc; - } -} - -/** Setup the input buffer state to scan directly from a user-specified character buffer. - * @param base the character buffer - * @param size the size in bytes of the character buffer - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) -{ - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - yy_switch_to_buffer(b ); - - return b; -} - -/** Setup the input buffer state to scan a string. The next call to yylex() will - * scan from a @e copy of @a str. - * @param yystr a NUL-terminated string to scan - * - * @return the newly allocated buffer state object. - * @note If you want to scan bytes that may contain NUL values, then use - * yy_scan_bytes() instead. - */ -YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) -{ - - return yy_scan_bytes(yystr,strlen(yystr) ); -} - -/** Setup the input buffer state to scan the given bytes. The next call to yylex() will - * scan from a @e copy of @a bytes. - * @param yybytes the byte buffer to scan - * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) -{ - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; - buf = (char *) yyalloc(n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - - for ( i = 0; i < _yybytes_len; ++i ) - buf[i] = yybytes[i]; - - buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - - b = yy_scan_buffer(buf,n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; -} - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -static void yy_fatal_error (yyconst char* msg ) -{ - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); -} - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - yytext[yyleng] = (yy_hold_char); \ - (yy_c_buf_p) = yytext + yyless_macro_arg; \ - (yy_hold_char) = *(yy_c_buf_p); \ - *(yy_c_buf_p) = '\0'; \ - yyleng = yyless_macro_arg; \ - } \ - while ( 0 ) - -/* Accessor methods (get/set functions) to struct members. */ - -/** Get the current line number. - * - */ -int yyget_lineno (void) -{ - - return yylineno; -} - -/** Get the input stream. - * - */ -FILE *yyget_in (void) -{ - return yyin; -} - -/** Get the output stream. - * - */ -FILE *yyget_out (void) -{ - return yyout; -} - -/** Get the length of the current token. - * - */ -yy_size_t yyget_leng (void) -{ - return yyleng; -} - -/** Get the current token. - * - */ - -char *yyget_text (void) -{ - return yytext; -} - -/** Set the current line number. - * @param line_number - * - */ -void yyset_lineno (int line_number ) -{ - - yylineno = line_number; -} - -/** Set the input stream. This does not discard the current - * input buffer. - * @param in_str A readable stream. - * - * @see yy_switch_to_buffer - */ -void yyset_in (FILE * in_str ) -{ - yyin = in_str ; -} - -void yyset_out (FILE * out_str ) -{ - yyout = out_str ; -} - -int yyget_debug (void) -{ - return yy_flex_debug; -} - -void yyset_debug (int bdebug ) -{ - yy_flex_debug = bdebug ; -} - -static int yy_init_globals (void) -{ - /* Initialization is the same as for the non-reentrant scanner. - * This function is called from yylex_destroy(), so don't allocate here. - */ - - (yy_buffer_stack) = 0; - (yy_buffer_stack_top) = 0; - (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = (char *) 0; - (yy_init) = 0; - (yy_start) = 0; - -/* Defined in main.c */ -#ifdef YY_STDINIT - yyin = stdin; - yyout = stdout; -#else - yyin = (FILE *) 0; - yyout = (FILE *) 0; -#endif - - /* For future reference: Set errno on error, since we are called by - * yylex_init() - */ - return 0; -} - -/* yylex_destroy is for both reentrant and non-reentrant scanners. */ -int yylex_destroy (void) -{ - - /* Pop the buffer stack, destroying each element. */ - while(YY_CURRENT_BUFFER){ - yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - yypop_buffer_state(); - } - - /* Destroy the stack itself. */ - yyfree((yy_buffer_stack) ); - (yy_buffer_stack) = NULL; - - /* Reset the globals. This is important in a non-reentrant scanner so the next time - * yylex() is called, initialization will occur. */ - yy_init_globals( ); - - return 0; -} - -/* - * Internal utility routines. - */ - -#ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) -{ - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; -} -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * s ) -{ - register int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; -} -#endif - -void *yyalloc (yy_size_t size ) -{ - return (void *) malloc( size ); -} - -void *yyrealloc (void * ptr, yy_size_t size ) -{ - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); -} - -void yyfree (void * ptr ) -{ - free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ -} - -#define YYTABLES_NAME "yytables" - -#line 74 "lex_parser.lex" diff --git a/xios_2311_src/trunk/.svn/pristine/0b/0b1d8d613a742d02b1dc4d36842bdbf3a598a48b.svn-base b/xios_2311_src/trunk/.svn/pristine/0b/0b1d8d613a742d02b1dc4d36842bdbf3a598a48b.svn-base deleted file mode 100644 index 816db1486b180bb23c71112e75e426d7b9f6806a..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/0b/0b1d8d613a742d02b1dc4d36842bdbf3a598a48b.svn-base +++ /dev/null @@ -1,11 +0,0 @@ -module purge -module load flavor/buildcompiler/gcc/8 -module load mpi/openmpi/4.0.2 - -module load flavor/hdf5/parallel -module load netcdf-fortran/4.4.4 -module load hdf5/1.8.20 -module load gnu/8.3.0 - -module load totalview -module load perl/5.30.2 diff --git a/xios_2311_src/trunk/.svn/pristine/0b/0b21c090e5ede7692c8b2f5e88ec8773ab0e5eb7.svn-base b/xios_2311_src/trunk/.svn/pristine/0b/0b21c090e5ede7692c8b2f5e88ec8773ab0e5eb7.svn-base deleted file mode 100644 index 9aac1a5d13c857a1e9f381ce07910c00eb2dfbe0..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/0b/0b21c090e5ede7692c8b2f5e88ec8773ab0e5eb7.svn-base +++ /dev/null @@ -1,67 +0,0 @@ -#include "exception.hpp" - -/// boost headers /// -#include -#include "client.hpp" -#include "server.hpp" -#include "log.hpp" - -namespace xios -{ - /// ////////////////////// Définitions ////////////////////// /// - CException::CException(void) - : CObject(), desc_rethrow(true), stream() - { /* Ne rien faire de plus */ } - - CException::CException(const std::string & id) - : CObject(id), desc_rethrow(true), stream() - { /* Ne rien faire de plus */ } - - CException::CException(const CException & exception) -// : std::basic_ios() - : CObject(exception.getId()) -// , StdOStringStream() -// , desc_rethrow(false) - { (*this) << exception.str(); } - - CException::~CException(void) - { -// if (desc_rethrow) -//#ifdef __XIOS_NOABORT -// { -// throw (*this); -// } -//#else -// { -// error << this->getMessage() << std::endl; -// throw 4; -// MPI_Abort(CXios::globalComm, -1); //abort(); -// } -//#endif - } - - //--------------------------------------------------------------- - - std::string CException::getMessage(void) const - { -// StdOStringStream oss; -// oss << "> Error [" << this->getId() << "] : " << this->str(); -// return (oss.str()); - return (stream.str()); - } - - StdOStringStream & CException::getStream(void) -// { return (*boost::polymorphic_cast(this)); } - { return stream; } - - std::string CException::toString(void) const -// { return (std::string(this->getMessage())); } - { return stream.str(); } - - void CException::fromString(const std::string & str) - { } -// { this->str(str); } - - //--------------------------------------------------------------- - -} // namespace xios diff --git a/xios_2311_src/trunk/.svn/pristine/0b/0b2b6b865225bcde3284eb146c5e84c6e036c513.svn-base b/xios_2311_src/trunk/.svn/pristine/0b/0b2b6b865225bcde3284eb146c5e84c6e036c513.svn-base deleted file mode 100644 index 0e7caea2b1166bb38abd380cd6ed86a72986b3ca..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/0b/0b2b6b865225bcde3284eb146c5e84c6e036c513.svn-base +++ /dev/null @@ -1,58 +0,0 @@ -#ifndef __XIOS_CDataPacket__ -#define __XIOS_CDataPacket__ - -#include - -#include "array_new.hpp" -#include "date.hpp" -#include "graph_package.hpp" - -namespace xios -{ - /*! - * A packet corresponds to a timestamped array of data. - */ - struct CDataPacket - { - /*! - * Describes the status associated to a packet - */ - enum StatusCode { - NO_ERROR, //!< No error were encountered when handling the packet - END_OF_STREAM //!< Last packet of the stream, does not have data - }; - - CGraphDataPackage * graphPackage; - - CArray data; //!< Array containing the data - CDate date; //!< Date associated to the data - Time timestamp; //!< Timestamp of the data - StatusCode status; //!< Status of the packet - - /*! - * Creates a deep copy of the packet. - * - * \return a deep copy of the packet - */ - CDataPacket* copy() const - { - CDataPacket* p = new CDataPacket; - p->data.resize(data.shape()); - p->data = data; - p->date = date; - p->timestamp = timestamp; - p->status = status; - p->graphPackage = graphPackage; - return p; - }; - - - CDataPacket() : graphPackage(nullptr) {} - - }; // struct CDataPacket - - typedef std::shared_ptr CDataPacketPtr; - typedef std::shared_ptr CConstDataPacketPtr; -} // namespace xios - -#endif //__XIOS_CDataPacket__ diff --git a/xios_2311_src/trunk/.svn/pristine/0b/0b9992fbfbd8ee7669a384043de4f5cbe890a0c8.svn-base b/xios_2311_src/trunk/.svn/pristine/0b/0b9992fbfbd8ee7669a384043de4f5cbe890a0c8.svn-base deleted file mode 100644 index 93b269c0fce9093ed71638aaf82e68df1c04f6fe..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/0b/0b9992fbfbd8ee7669a384043de4f5cbe890a0c8.svn-base +++ /dev/null @@ -1,440 +0,0 @@ -/* -This file is part of netcdf-4, a netCDF-like interface for HDF5, or a -HDF5 backend for netCDF, depending on your point of view. - -This file handles the nc4 groups. - -Copyright 2005, University Corporation for Atmospheric Research. See -netcdf-4/docs/COPYRIGHT file for copying and redistribution -conditions. - -$Id: nc4grp.c,v 1.44 2010/05/25 17:54:23 dmh Exp $ -*/ - -#include "nc4internal.h" -#include "nc4dispatch.h" - -/* Create a group. It's ncid is returned in the new_ncid pointer. */ -int -NC4_def_grp(int parent_ncid, const char *name, int *new_ncid) -{ - NC_GRP_INFO_T *grp, *g; - NC_HDF5_FILE_INFO_T *h5; - char norm_name[NC_MAX_NAME + 1]; - int retval; - - LOG((2, "nc_def_grp: parent_ncid 0x%x name %s", parent_ncid, name)); - - /* Find info for this file and group, and set pointer to each. */ - if ((retval = nc4_find_grp_h5(parent_ncid, &grp, &h5))) - return retval; - if (!h5) - return NC_ENOTNC4; - - /* Check and normalize the name. */ - if ((retval = nc4_check_name(name, norm_name))) - return retval; - - /* Check that this name is not in use as a var, grp, or type. */ - if ((retval = nc4_check_dup_name(grp, norm_name))) - return retval; - - /* No groups in netcdf-3! */ - if (h5->cmode & NC_CLASSIC_MODEL) - return NC_ESTRICTNC3; - - /* If it's not in define mode, switch to define mode. */ - if (!(h5->flags & NC_INDEF)) - if ((retval = NC4_redef(parent_ncid))) - return retval; - - /* Update internal lists to reflect new group. The actual HDF5 - * group creation will be done when metadata is written by a - * sync. */ - if ((retval = nc4_grp_list_add(&(grp->children), h5->next_nc_grpid, - grp, grp->file, norm_name, &g))) - return retval; - if (new_ncid) - *new_ncid = grp->file->ext_ncid | h5->next_nc_grpid; - h5->next_nc_grpid++; - - return NC_NOERR; -} - -/* Given an ncid and group name (NULL gets root group), return - * the ncid of that group. */ -int -NC4_inq_ncid(int ncid, const char *name, int *grp_ncid) -{ - NC_GRP_INFO_T *grp, *g; - NC_HDF5_FILE_INFO_T *h5; - char norm_name[NC_MAX_NAME + 1]; - int retval; - - LOG((2, "nc_inq_ncid: ncid 0x%x name %s", ncid, name)); - - /* Find info for this file and group, and set pointer to each. */ - if ((retval = nc4_find_grp_h5(ncid, &grp, &h5))) - return retval; - - /* Groups only work with netCDF-4/HDF5 files... */ - if (!h5) - return NC_ENOTNC4; - - /* Normalize name. */ - if ((retval = nc4_normalize_name(name, norm_name))) - return retval; - - /* Look through groups for one of this name. */ - for (g = grp->children; g; g = g->next) - if (!strcmp(norm_name, g->name)) /* found it! */ - { - if (grp_ncid) - *grp_ncid = grp->file->ext_ncid | g->nc_grpid; - return NC_NOERR; - } - - /* If we got here, we didn't find the named group. */ - return NC_ENOGRP; -} - -/* Given a location id, return the number of groups it contains, and - * an array of their locids. */ -int -NC4_inq_grps(int ncid, int *numgrps, int *ncids) -{ - NC_GRP_INFO_T *grp, *g; - NC_HDF5_FILE_INFO_T *h5; - int num = 0; - int retval; - - LOG((2, "nc_inq_grps: ncid 0x%x", ncid)); - - /* Find info for this file and group, and set pointer to each. */ - if ((retval = nc4_find_grp_h5(ncid, &grp, &h5))) - return retval; - - /* For netCDF-3 files, just report zero groups. */ - if (!h5) - { - if (numgrps) - *numgrps = 0; - return NC_NOERR; - } - - /* Count the number of groups in this group. */ - for (g = grp->children; g; g = g->next) - { - if (ncids) - { - /* Combine the nc_grpid in a bitwise or with the ext_ncid, - * which allows the returned ncid to carry both file and - * group information. */ - *ncids = g->nc_grpid | g->file->ext_ncid; - ncids++; - } - num++; - } - - if (numgrps) - *numgrps = num; - - return NC_NOERR; -} - -/* Given locid, find name of group. (Root group is named "/".) */ -int -NC4_inq_grpname(int ncid, char *name) -{ - NC_GRP_INFO_T *grp; - NC_HDF5_FILE_INFO_T *h5; - int retval; - - LOG((2, "nc_inq_grpname: ncid 0x%x", ncid)); - - /* Find info for this file and group, and set pointer to each. */ - if ((retval = nc4_find_grp_h5(ncid, &grp, &h5))) - return retval; - if (name) - { - if (!h5) - strcpy(name, "/"); - else - strcpy(name, grp->name); - } - - return NC_NOERR; -} - -/* Find the full path name to the group represented by ncid. Either - * pointer argument may be NULL; pass a NULL for the third parameter - * to get the length of the full path name. The length will not - * include room for a null pointer. */ -int -NC4_inq_grpname_full(int ncid, size_t *lenp, char *full_name) -{ - char *name, grp_name[NC_MAX_NAME + 1]; - int g, id = ncid, parent_id, *gid; - int i, ret = NC_NOERR; - - /* How many generations? */ - for (g = 0; !nc_inq_grp_parent(id, &parent_id); g++, id = parent_id) - ; - - /* Allocate storage. */ - if (!(name = malloc((g + 1) * (NC_MAX_NAME + 1) + 1))) - return NC_ENOMEM; - if (!(gid = malloc((g + 1) * sizeof(int)))) - { - free(name); - return NC_ENOMEM; - } - assert(name && gid); - - /* Always start with a "/" for the root group. */ - strcpy(name, "/"); - - /* Get the ncids for all generations. */ - gid[0] = ncid; - for (i = 1; i < g && !ret; i++) - ret = nc_inq_grp_parent(gid[i - 1], &gid[i]); - - /* Assemble the full name. */ - for (i = g - 1; !ret && i >= 0 && !ret; i--) - { - if ((ret = nc_inq_grpname(gid[i], grp_name))) - break; - strcat(name, grp_name); - if (i) - strcat(name, "/"); - } - - /* Give the user the length of the name, if he wants it. */ - if (!ret && lenp) - *lenp = strlen(name); - - /* Give the user the name, if he wants it. */ - if (!ret && full_name) - strcpy(full_name, name); - - free(gid); - free(name); - - return ret; -} - -/* Find the parent ncid of a group. For the root group, return - * NC_ENOGRP error. *Now* I know what kind of tinfoil hat wearing nut - * job would call this function with a NULL pointer for parent_ncid - - * Russ Rew!! */ -int -NC4_inq_grp_parent(int ncid, int *parent_ncid) -{ - NC_GRP_INFO_T *grp; - NC_HDF5_FILE_INFO_T *h5; - int retval; - - LOG((2, "nc_inq_grp_parent: ncid 0x%x", ncid)); - - /* Find info for this file and group. */ - if ((retval = nc4_find_grp_h5(ncid, &grp, &h5))) - return retval; - - /* Groups only work with netCDF-4/HDF5 files... */ - if (!h5) - return NC_ENOGRP; - - /* Set the parent ncid, if there is one. */ - if (grp->parent) - { - if (parent_ncid) - *parent_ncid = grp->file->ext_ncid | grp->parent->nc_grpid; - } - else - return NC_ENOGRP; - - return NC_NOERR; -} - -/* Given a full name and ncid, find group ncid. */ -int -NC4_inq_grp_full_ncid(int ncid, const char *full_name, int *grp_ncid) -{ - NC_GRP_INFO_T *grp; - NC_HDF5_FILE_INFO_T *h5; - int id1 = ncid, id2; - char *cp, *full_name_cpy; - int ret; - - if (!full_name) - return NC_EINVAL; - - /* Find info for this file and group, and set pointer to each. */ - if ((ret = nc4_find_grp_h5(ncid, &grp, &h5))) - return ret; - - /* Copy full_name because strtok messes with the value it works - * with, and we don't want to mess up full_name. */ - if (!(full_name_cpy = malloc(strlen(full_name) + 1))) - return NC_ENOMEM; - strcpy(full_name_cpy, full_name); - - /* Get the first part of the name. */ - if (!(cp = strtok(full_name_cpy, "/"))) - { - /* If "/" is passed, and this is the root group, return the root - * group id. */ - if (!grp->parent) - id2 = ncid; - else - { - free(full_name_cpy); - return NC_ENOGRP; - } - } - else - { - /* Keep parsing the string. */ - for (; cp; id1 = id2) - { - if ((ret = nc_inq_grp_ncid(id1, cp, &id2))) - { - free(full_name_cpy); - return ret; - } - cp = strtok(NULL, "/"); - } - } - - /* Give the user the requested value. */ - if (grp_ncid) - *grp_ncid = id2; - - free(full_name_cpy); - - return NC_NOERR; -} - -/* Get a list of ids for all the variables in a group. */ -int -NC4_inq_varids(int ncid, int *nvars, int *varids) -{ - NC_GRP_INFO_T *grp; - NC_HDF5_FILE_INFO_T *h5; - NC_VAR_INFO_T *var; - int v, num_vars = 0; - int retval; - - LOG((2, "nc_inq_varids: ncid 0x%x", ncid)); - - /* Find info for this file and group, and set pointer to each. */ - if ((retval = nc4_find_grp_h5(ncid, &grp, &h5))) - return retval; - - if (!h5) - { - /* If this is a netcdf-3 file, there is only one group, the root - * group, and its vars have ids 0 thru nvars - 1. */ - if ((retval = nc_inq(ncid, NULL, &num_vars, NULL, NULL))) - return retval; - if (varids) - for (v = 0; v < num_vars; v++) - varids[v] = v; - } - else - { - /* This is a netCDF-4 group. Round up them doggies and count - * 'em. The list is in correct (i.e. creation) order. */ - if (grp->var) - { - for (var = grp->var; var; var = var->next) - { - if (varids) - varids[num_vars] = var->varid; - num_vars++; - } - } - } - - /* If the user wants to know how many vars in the group, tell - * him. */ - if (nvars) - *nvars = num_vars; - - return NC_NOERR; -} - -/* This is the comparison function used for sorting dim ids. Integer - comparison: returns negative if b > a and positive if a > b. */ -int int_cmp(const void *a, const void *b) -{ - const int *ia = (const int *)a; - const int *ib = (const int *)b; - return *ia - *ib; -} - -/* Find all dimids for a location. This finds all dimensions in a - * group, with or without any of its parents, depending on last - * parameter. */ -int -NC4_inq_dimids(int ncid, int *ndims, int *dimids, int include_parents) -{ - NC_GRP_INFO_T *grp, *g; - NC_HDF5_FILE_INFO_T *h5; - NC_DIM_INFO_T *dim; - int d, num = 0; - int retval; - - LOG((2, "nc_inq_dimids: ncid 0x%x include_parents: %d", ncid, - include_parents)); - - /* Find info for this file and group, and set pointer to each. */ - if ((retval = nc4_find_grp_h5(ncid, &grp, &h5))) - return retval; - - if (!h5) - { - /* If this is a netcdf-3 file, then the dimids are going to be 0 - * thru ndims-1, so just provide them. */ - if ((retval = nc_inq(ncid, &num, NULL, NULL, NULL))) - return retval; - if (dimids) - for (d = 0; d < num; d++) - dimids[d] = d; - } - else - { - /* First count them. */ - for (dim = grp->dim; dim; dim = dim->next) - num++; - if (include_parents) - for (g = grp->parent; g; g = g->parent) - for (dim = g->dim; dim; dim = dim->next) - num++; - - /* If the user wants the dimension ids, get them. */ - if (dimids) - { - int n = 0; - - /* Get dimension ids from this group. */ - for (dim = grp->dim; dim; dim = dim->next) - dimids[n++] = dim->dimid; - - /* Get dimension ids from parent groups. */ - if (include_parents) - for (g = grp->parent; g; g = g->parent) - for (dim = g->dim; dim; dim = dim->next) - dimids[n++] = dim->dimid; - - qsort(dimids, num, sizeof(int), int_cmp); - } - } - - /* If the user wants the number of dims, give it. */ - if (ndims) - *ndims = num; - - return NC_NOERR; -} - diff --git a/xios_2311_src/trunk/.svn/pristine/0b/0b9ab46c7e26c911b3aad59eea0504625dfaa1a0.svn-base b/xios_2311_src/trunk/.svn/pristine/0b/0b9ab46c7e26c911b3aad59eea0504625dfaa1a0.svn-base deleted file mode 100644 index 76d4846ce77394fecabaa0668ae55454f4885991..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/0b/0b9ab46c7e26c911b3aad59eea0504625dfaa1a0.svn-base +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "Domain": ["lmdz"], - "NumberServers": [2, 4], - "AxisMask": ["false","true"], - "DomMask": ["false","true"] - } -] diff --git a/xios_2311_src/trunk/.svn/pristine/0b/0b9ddc800bc0229eb8269a832b8230ea1a56a7ae.svn-base b/xios_2311_src/trunk/.svn/pristine/0b/0b9ddc800bc0229eb8269a832b8230ea1a56a7ae.svn-base deleted file mode 100644 index bde4910c6c8b1b7113b558289c5f8847bc2f7ef1..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/0b/0b9ddc800bc0229eb8269a832b8230ea1a56a7ae.svn-base +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef __XIOS_CXMLNode__ -#define __XIOS_CXMLNode__ - -/// rapidXML headers /// -#include - -/// XIOS headers /// -#include "xios_spl.hpp" - -namespace xios -{ - namespace xml - { - /// ////////////////////// Déclarations ////////////////////// /// - typedef xios_map THashAttributes; - - class CXMLNode - { - public : - - /// Constructeurs /// - CXMLNode(rapidxml::xml_node * const root); - - /// Destructeur /// - ~CXMLNode(void); - - /// Accesseurs /// - StdString getElementName(void) const; - THashAttributes getAttributes(void) const; - - /// Mutateurs /// - bool goToNextElement(void); - bool goToChildElement(void); - bool goToParentElement(void); - bool getContent(StdString & content); - - /// Accesseurs statiques /// - static const StdString & GetRootName(void); - - private : - - /// Constructeurs /// - CXMLNode(void); // Not implemented yet. - CXMLNode(const CXMLNode & node); // Not implemented yet. - CXMLNode(const CXMLNode * const node); // Not implemented yet. - - rapidxml::xml_node * node; - int level; - - static StdString RootName; - - }; //class CXMLParser - - }// namespace xml -} // namespace xios - -#endif // __XIOS_CXMLNode__ diff --git a/xios_2311_src/trunk/.svn/pristine/0c/0c13852711e73155bbec19c782e8f77e76de3a5b.svn-base b/xios_2311_src/trunk/.svn/pristine/0c/0c13852711e73155bbec19c782e8f77e76de3a5b.svn-base deleted file mode 100644 index 908ce6d5b43fc0527b8fde6048c2fa2a315de11f..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/0c/0c13852711e73155bbec19c782e8f77e76de3a5b.svn-base +++ /dev/null @@ -1,112 +0,0 @@ -! * ************************************************************************** * -! * Interface auto generated - do not modify * -! * ************************************************************************** * -#include "xios_fortran_prefix.hpp" - -MODULE iduplicate_scalar_to_axis_attr - USE, INTRINSIC :: ISO_C_BINDING - USE iduplicate_scalar_to_axis - USE duplicate_scalar_to_axis_interface_attr - -CONTAINS - - SUBROUTINE xios(set_duplicate_scalar_to_axis_attr) & - ( duplicate_scalar_to_axis_id ) - - IMPLICIT NONE - TYPE(txios(duplicate_scalar_to_axis)) :: duplicate_scalar_to_axis_hdl - CHARACTER(LEN=*), INTENT(IN) ::duplicate_scalar_to_axis_id - - CALL xios(get_duplicate_scalar_to_axis_handle) & - (duplicate_scalar_to_axis_id,duplicate_scalar_to_axis_hdl) - CALL xios(set_duplicate_scalar_to_axis_attr_hdl_) & - ( duplicate_scalar_to_axis_hdl ) - - END SUBROUTINE xios(set_duplicate_scalar_to_axis_attr) - - SUBROUTINE xios(set_duplicate_scalar_to_axis_attr_hdl) & - ( duplicate_scalar_to_axis_hdl ) - - IMPLICIT NONE - TYPE(txios(duplicate_scalar_to_axis)) , INTENT(IN) :: duplicate_scalar_to_axis_hdl - - CALL xios(set_duplicate_scalar_to_axis_attr_hdl_) & - ( duplicate_scalar_to_axis_hdl ) - - END SUBROUTINE xios(set_duplicate_scalar_to_axis_attr_hdl) - - SUBROUTINE xios(set_duplicate_scalar_to_axis_attr_hdl_) & - ( duplicate_scalar_to_axis_hdl ) - - IMPLICIT NONE - TYPE(txios(duplicate_scalar_to_axis)) , INTENT(IN) :: duplicate_scalar_to_axis_hdl - - END SUBROUTINE xios(set_duplicate_scalar_to_axis_attr_hdl_) - - SUBROUTINE xios(get_duplicate_scalar_to_axis_attr) & - ( duplicate_scalar_to_axis_id ) - - IMPLICIT NONE - TYPE(txios(duplicate_scalar_to_axis)) :: duplicate_scalar_to_axis_hdl - CHARACTER(LEN=*), INTENT(IN) ::duplicate_scalar_to_axis_id - - CALL xios(get_duplicate_scalar_to_axis_handle) & - (duplicate_scalar_to_axis_id,duplicate_scalar_to_axis_hdl) - CALL xios(get_duplicate_scalar_to_axis_attr_hdl_) & - ( duplicate_scalar_to_axis_hdl ) - - END SUBROUTINE xios(get_duplicate_scalar_to_axis_attr) - - SUBROUTINE xios(get_duplicate_scalar_to_axis_attr_hdl) & - ( duplicate_scalar_to_axis_hdl ) - - IMPLICIT NONE - TYPE(txios(duplicate_scalar_to_axis)) , INTENT(IN) :: duplicate_scalar_to_axis_hdl - - CALL xios(get_duplicate_scalar_to_axis_attr_hdl_) & - ( duplicate_scalar_to_axis_hdl ) - - END SUBROUTINE xios(get_duplicate_scalar_to_axis_attr_hdl) - - SUBROUTINE xios(get_duplicate_scalar_to_axis_attr_hdl_) & - ( duplicate_scalar_to_axis_hdl ) - - IMPLICIT NONE - TYPE(txios(duplicate_scalar_to_axis)) , INTENT(IN) :: duplicate_scalar_to_axis_hdl - - END SUBROUTINE xios(get_duplicate_scalar_to_axis_attr_hdl_) - - SUBROUTINE xios(is_defined_duplicate_scalar_to_axis_attr) & - ( duplicate_scalar_to_axis_id ) - - IMPLICIT NONE - TYPE(txios(duplicate_scalar_to_axis)) :: duplicate_scalar_to_axis_hdl - CHARACTER(LEN=*), INTENT(IN) ::duplicate_scalar_to_axis_id - - CALL xios(get_duplicate_scalar_to_axis_handle) & - (duplicate_scalar_to_axis_id,duplicate_scalar_to_axis_hdl) - CALL xios(is_defined_duplicate_scalar_to_axis_attr_hdl_) & - ( duplicate_scalar_to_axis_hdl ) - - END SUBROUTINE xios(is_defined_duplicate_scalar_to_axis_attr) - - SUBROUTINE xios(is_defined_duplicate_scalar_to_axis_attr_hdl) & - ( duplicate_scalar_to_axis_hdl ) - - IMPLICIT NONE - TYPE(txios(duplicate_scalar_to_axis)) , INTENT(IN) :: duplicate_scalar_to_axis_hdl - - CALL xios(is_defined_duplicate_scalar_to_axis_attr_hdl_) & - ( duplicate_scalar_to_axis_hdl ) - - END SUBROUTINE xios(is_defined_duplicate_scalar_to_axis_attr_hdl) - - SUBROUTINE xios(is_defined_duplicate_scalar_to_axis_attr_hdl_) & - ( duplicate_scalar_to_axis_hdl ) - - IMPLICIT NONE - TYPE(txios(duplicate_scalar_to_axis)) , INTENT(IN) :: duplicate_scalar_to_axis_hdl - - END SUBROUTINE xios(is_defined_duplicate_scalar_to_axis_attr_hdl_) - -END MODULE iduplicate_scalar_to_axis_attr diff --git a/xios_2311_src/trunk/.svn/pristine/0c/0c1b53fe0f03e0deef14aecaeb33df0540f4261f.svn-base b/xios_2311_src/trunk/.svn/pristine/0c/0c1b53fe0f03e0deef14aecaeb33df0540f4261f.svn-base deleted file mode 100644 index 99bc5d8ff4385ed25e118292c45a37ba2d8e95ba..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/0c/0c1b53fe0f03e0deef14aecaeb33df0540f4261f.svn-base +++ /dev/null @@ -1,2349 +0,0 @@ -#include "context.hpp" -#include "attribute_template.hpp" -#include "object_template.hpp" -#include "group_template.hpp" - -#include "calendar_type.hpp" -#include "duration.hpp" - -#include "context_client.hpp" -#include "context_server.hpp" -#include "nc4_data_output.hpp" -#include "node_type.hpp" -#include "message.hpp" -#include "type.hpp" -#include "xios_spl.hpp" -#include "timer.hpp" -#include "memtrack.hpp" -#include -#include -#include "server.hpp" -#include "distribute_file_server2.hpp" -#include "services_manager.hpp" -#include "contexts_manager.hpp" -#include "cxios.hpp" -#include "client.hpp" -#include "coupler_in.hpp" -#include "coupler_out.hpp" -#include "servers_ressource.hpp" -#include "pool_ressource.hpp" -#include "services.hpp" -#include "contexts_manager.hpp" -#include -#include - -namespace xios -{ - - std::shared_ptr CContext::root; - - /// ////////////////////// Définitions ////////////////////// /// - - CContext::CContext(void) - : CObjectTemplate(), CContextAttributes() - , calendar(), hasClient(false), hasServer(false) - , isPostProcessed(false), finalized(false) - , client(nullptr), server(nullptr) - , allProcessed(false), countChildContextFinalized_(0), isProcessingEvent_(false) - - { /* Ne rien faire de plus */ } - - CContext::CContext(const StdString & id) - : CObjectTemplate(id), CContextAttributes() - , calendar(), hasClient(false), hasServer(false) - , isPostProcessed(false), finalized(false) - , client(nullptr), server(nullptr) - , allProcessed(false), countChildContextFinalized_(0), isProcessingEvent_(false) - { /* Ne rien faire de plus */ } - - CContext::~CContext(void) - { - delete client; - delete server; - for (std::vector::iterator it = clientPrimServer.begin(); it != clientPrimServer.end(); it++) delete *it; - for (std::vector::iterator it = serverPrimServer.begin(); it != serverPrimServer.end(); it++) delete *it; - if (registryIn!=nullptr) delete registryIn ; - if (registryOut!=nullptr) delete registryOut ; - } - - //---------------------------------------------------------------- - //! Get name of context - StdString CContext::GetName(void) { return (StdString("context")); } - StdString CContext::GetDefName(void){ return (CContext::GetName()); } - ENodeType CContext::GetType(void) { return (eContext); } - - //---------------------------------------------------------------- - - void CContext::initEventScheduler(void) - { - SRegisterContextInfo contextInfo ; - CXios::getContextsManager()->getContextInfo(this->getId(), contextInfo, getIntraComm()) ; - - eventScheduler_=CXios::getPoolRessource()->getService(contextInfo.serviceId,contextInfo.partitionId)->getEventScheduler() ; - - // generate unique hash for server - auto time=chrono::system_clock::now().time_since_epoch().count() ; - std::default_random_engine rd(time); // not reproducible from a run to another - std::uniform_int_distribution dist; - hashId_=dist(rd) ; - MPI_Bcast(&hashId_,1,MPI_SIZE_T,0,getIntraComm()) ; // Bcast to all server of the context - } - /*! - \brief Get context group (context root) - \return Context root - */ - CContextGroup* CContext::getRoot(void) - TRY - { - if (root.get()==NULL) root=std::shared_ptr(new CContextGroup(xml::CXMLNode::GetRootName())); - return root.get(); - } - CATCH - - void CContext::releaseStaticAllocation(void) - TRY - { - CDomain::releaseStaticAllocation(); - CAxis::releaseStaticAllocation(); - CScalar::releaseStaticAllocation(); - if (root) root.reset() ; - } - CATCH - - //---------------------------------------------------------------- - - /*! - \brief Get calendar of a context - \return Calendar - */ - std::shared_ptr CContext::getCalendar(void) const - TRY - { - return (this->calendar); - } - CATCH - - //---------------------------------------------------------------- - - /*! - \brief Set a context with a calendar - \param[in] newCalendar new calendar - */ - void CContext::setCalendar(std::shared_ptr newCalendar) - TRY - { - this->calendar = newCalendar; - } - CATCH_DUMP_ATTR - - //---------------------------------------------------------------- - /*! - \brief Parse xml file and write information into context object - \param [in] node xmld node corresponding in xml file - */ - void CContext::parse(xml::CXMLNode & node) - TRY - { - CContext::SuperClass::parse(node); - - // PARSING POUR GESTION DES ENFANTS - xml::THashAttributes attributes = node.getAttributes(); - - if (attributes.end() != attributes.find("src")) - { - StdIFStream ifs ( attributes["src"].c_str() , StdIFStream::in ); - if ( (ifs.rdstate() & std::ifstream::failbit ) != 0 ) - ERROR("void CContext::parse(xml::CXMLNode & node)", - < file" ); - if (!ifs.good()) - ERROR("CContext::parse(xml::CXMLNode & node)", - << "[ filename = " << attributes["src"] << " ] Bad xml stream !"); - xml::CXMLParser::ParseInclude(ifs, attributes["src"], *this); - } - - if (node.getElementName().compare(CContext::GetName())) - DEBUG("Le noeud is wrong defined but will be considered as a context !"); - - if (!(node.goToChildElement())) - { - DEBUG("Le context ne contient pas d'enfant !"); - } - else - { - do { // Parcours des contextes pour traitement. - - StdString name = node.getElementName(); - attributes.clear(); - attributes = node.getAttributes(); - - if (attributes.end() != attributes.find("id")) - { - DEBUG(<< "Definition node has an id," - << "it will not be taking account !"); - } - -#define DECLARE_NODE(Name_, name_) \ - if (name.compare(C##Name_##Definition::GetDefName()) == 0) \ - { C##Name_##Definition::create(C##Name_##Definition::GetDefName()) -> parse(node); continue; } -#define DECLARE_NODE_PAR(Name_, name_) -#include "node_type.conf" - - DEBUG(<< "The element \'" << name - << "\' in the context \'" << CContext::getCurrent()->getId() - << "\' is not a definition !"); - - } while (node.goToNextElement()); - - node.goToParentElement(); // Retour au parent - } - } - CATCH_DUMP_ATTR - - //---------------------------------------------------------------- - //! Show tree structure of context - void CContext::ShowTree(StdOStream & out) - TRY - { - StdString currentContextId = CContext::getCurrent() -> getId(); - std::vector def_vector = - CContext::getRoot()->getChildList(); - std::vector::iterator - it = def_vector.begin(), end = def_vector.end(); - - out << "" << std::endl; - out << "<" << xml::CXMLNode::GetRootName() << " >" << std::endl; - - for (; it != end; it++) - { - CContext* context = *it; - CContext::setCurrent(context->getId()); - out << *context << std::endl; - } - - out << "" << std::endl; - CContext::setCurrent(currentContextId); - } - CATCH - - //---------------------------------------------------------------- - - //! Convert context object into string (to print) - StdString CContext::toString(void) const - TRY - { - StdOStringStream oss; - oss << "<" << CContext::GetName() - << " id=\"" << this->getId() << "\" " - << SuperClassAttribute::toString() << ">" << std::endl; - if (!this->hasChild()) - { - //oss << "" << std::endl; // fait planter l'incrémentation - } - else - { - -#define DECLARE_NODE(Name_, name_) \ - if (C##Name_##Definition::has(C##Name_##Definition::GetDefName())) \ - oss << * C##Name_##Definition::get(C##Name_##Definition::GetDefName()) << std::endl; -#define DECLARE_NODE_PAR(Name_, name_) -#include "node_type.conf" - - } - oss << ""; - return (oss.str()); - } - CATCH - - //---------------------------------------------------------------- - - /*! - \brief Find all inheritace among objects in a context. - \param [in] apply (true) write attributes of parent into ones of child if they are empty - (false) write attributes of parent into a new container of child - \param [in] parent unused - */ - void CContext::solveDescInheritance(bool apply, const CAttributeMap * const UNUSED(parent)) - TRY - { -#define DECLARE_NODE(Name_, name_) \ - if (C##Name_##Definition::has(C##Name_##Definition::GetDefName())) \ - C##Name_##Definition::get(C##Name_##Definition::GetDefName())->solveDescInheritance(apply); -#define DECLARE_NODE_PAR(Name_, name_) -#include "node_type.conf" - } - CATCH_DUMP_ATTR - - //---------------------------------------------------------------- - - //! Verify if all root definition in the context have child. - bool CContext::hasChild(void) const - TRY - { - return ( -#define DECLARE_NODE(Name_, name_) \ - C##Name_##Definition::has(C##Name_##Definition::GetDefName()) || -#define DECLARE_NODE_PAR(Name_, name_) -#include "node_type.conf" - false); -} - CATCH - - //---------------------------------------------------------------- - - void CContext::CleanTree(void) - TRY - { -#define DECLARE_NODE(Name_, name_) C##Name_##Definition::ClearAllAttributes(); -#define DECLARE_NODE_PAR(Name_, name_) -#include "node_type.conf" - } - CATCH - -void CContext::removeContext(const string& contextId) -{ - #define DECLARE_NODE(Name_, name_) CObjectFactory::deleteContext< C##Name_ >(contextId); - #define DECLARE_NODE_PAR(Name_, name_) CObjectFactory::deleteContext< C##Name_ >(contextId); - #include "node_type.conf" - #define DECLARE_NODE(Name_, name_) CObjectFactory::deleteContext< C##Name_##Group >(contextId); - #define DECLARE_NODE_PAR(Name_, name_) - #include "node_type.conf" - -/* - #define DECLARE_NODE(Name_, name_) CObjectFactory::dumpObjects< C##Name_##Group >(); - #define DECLARE_NODE_PAR(Name_, name_) - #include "node_type.conf" - - #define DECLARE_NODE(Name_, name_) CObjectFactory::dumpObjects< C##Name_>(); - #define DECLARE_NODE_PAR(Name_, name_) - #include "node_type.conf" -*/ -} - -void CContext::removeAllContexts(void) -{ - #define DECLARE_NODE(Name_, name_) CObjectFactory::deleteAllContexts< C##Name_ >(); - #define DECLARE_NODE_PAR(Name_, name_) CObjectFactory::deleteAllContexts< C##Name_ >(); - #include "node_type.conf" - #define DECLARE_NODE(Name_, name_) CObjectFactory::deleteAllContexts< C##Name_##Group >(); - #define DECLARE_NODE_PAR(Name_, name_) - #include "node_type.conf" -/* - #define DECLARE_NODE(Name_, name_) CObjectFactory::dumpObjects< C##Name_##Group >(); - #define DECLARE_NODE_PAR(Name_, name_) - #include "node_type.conf" - - #define DECLARE_NODE(Name_, name_) CObjectFactory::dumpObjects< C##Name_>(); - #define DECLARE_NODE_PAR(Name_, name_) - #include "node_type.conf" -*/ - CObjectFactory::deleteAllContexts() ; - CObjectFactory::deleteAllContexts() ; - CObjectFactory::clearCurrentContextId(); - CGroupFactory::clearCurrentContextId(); -} - ///--------------------------------------------------------------- - - - /*! - * Compute the required buffer size to send the fields data. - * \param maxEventSize [in/out] the size of the bigger event for each connected server - * \param [in] contextClient - * \param [in] bufferForWriting True if buffers are used for sending data for writing - This flag is only true for client and server-1 for communication with server-2 - */ - std::map CContext::getDataBufferSize(std::map& maxEventSize, - CContextClient* contextClient, bool bufferForWriting /*= "false"*/) - TRY - { - std::map dataSize; - - // Find all reference domain and axis of all active fields - std::vector& fileList = bufferForWriting ? this->enabledWriteModeFiles : this->enabledReadModeFiles; - size_t numEnabledFiles = fileList.size(); - for (size_t i = 0; i < numEnabledFiles; ++i) - { - CFile* file = fileList[i]; - if (file->getContextClient() == contextClient) - { - std::vector enabledFields = file->getEnabledFields(); - size_t numEnabledFields = enabledFields.size(); - for (size_t j = 0; j < numEnabledFields; ++j) - { - // const std::vector > mapSize = enabledFields[j]->getGridDataBufferSize(contextClient); - const std::map mapSize = enabledFields[j]->getGridDataBufferSize(contextClient,bufferForWriting); - std::map::const_iterator it = mapSize.begin(), itE = mapSize.end(); - for (; it != itE; ++it) - { - // If dataSize[it->first] does not exist, it will be zero-initialized - // so we can use it safely without checking for its existance - if (CXios::isOptPerformance) - dataSize[it->first] += it->second; - else if (dataSize[it->first] < it->second) - dataSize[it->first] = it->second; - - if (maxEventSize[it->first] < it->second) - maxEventSize[it->first] = it->second; - } - } - } - } - return dataSize; - } - CATCH_DUMP_ATTR - -/*! - * Compute the required buffer size to send the attributes (mostly those grid related). - * \param maxEventSize [in/out] the size of the bigger event for each connected server - * \param [in] contextClient - * \param [in] bufferForWriting True if buffers are used for sending data for writing - This flag is only true for client and server-1 for communication with server-2 - */ - std::map CContext::getAttributesBufferSize(std::map& maxEventSize, - CContextClient* contextClient, bool bufferForWriting /*= "false"*/) - TRY - { - // As calendar attributes are sent even if there are no active files or fields, maps are initialized according the size of calendar attributes - std::map attributesSize = CCalendarWrapper::get(CCalendarWrapper::GetDefName())->getMinimumBufferSizeForAttributes(contextClient); - maxEventSize = CCalendarWrapper::get(CCalendarWrapper::GetDefName())->getMinimumBufferSizeForAttributes(contextClient); - - std::vector& fileList = this->enabledFiles; - size_t numEnabledFiles = fileList.size(); - for (size_t i = 0; i < numEnabledFiles; ++i) - { -// CFile* file = this->enabledWriteModeFiles[i]; - CFile* file = fileList[i]; - std::vector enabledFields = file->getEnabledFields(); - size_t numEnabledFields = enabledFields.size(); - for (size_t j = 0; j < numEnabledFields; ++j) - { - const std::map mapSize = enabledFields[j]->getGridAttributesBufferSize(contextClient, bufferForWriting); - std::map::const_iterator it = mapSize.begin(), itE = mapSize.end(); - for (; it != itE; ++it) - { - // If attributesSize[it->first] does not exist, it will be zero-initialized - // so we can use it safely without checking for its existence - if (attributesSize[it->first] < it->second) - attributesSize[it->first] = it->second; - - if (maxEventSize[it->first] < it->second) - maxEventSize[it->first] = it->second; - } - } - } - return attributesSize; - } - CATCH_DUMP_ATTR - - - - //! Verify whether a context is initialized - bool CContext::isInitialized(void) - TRY - { - return hasClient; - } - CATCH_DUMP_ATTR - - - void CContext::init(CServerContext* parentServerContext, MPI_Comm intraComm, int serviceType) - TRY - { - parentServerContext_ = parentServerContext ; - if (serviceType==CServicesManager::CLIENT) - initClient(intraComm, serviceType) ; - else - initServer(intraComm, serviceType) ; - initEventScheduler() ; - } - CATCH_DUMP_ATTR - - - -//! Initialize client side - void CContext::initClient(MPI_Comm intraComm, int serviceType) - TRY - { - intraComm_=intraComm ; - MPI_Comm_rank(intraComm_, &intraCommRank_) ; - MPI_Comm_size(intraComm_, &intraCommSize_) ; - - serviceType_ = CServicesManager::CLIENT ; - if (serviceType_==CServicesManager::CLIENT) - { - hasClient=true ; - hasServer=false ; - } - contextId_ = getId() ; - - attached_mode=true ; - if (!CXios::isUsingServer()) attached_mode=false ; - - - string contextRegistryId=getId() ; - registryIn=new CRegistry(CXios::getRegistryManager()->getRegistryIn()); - registryIn->setPath(contextRegistryId) ; - - registryOut=new CRegistry(intraComm_) ; - registryOut->setPath(contextRegistryId) ; - - } - CATCH_DUMP_ATTR - - - void CContext::initServer(MPI_Comm intraComm, int serviceType) - TRY - { - hasServer=true; - intraComm_=intraComm ; - MPI_Comm_rank(intraComm_, &intraCommRank_) ; - MPI_Comm_size(intraComm_, &intraCommSize_) ; - - serviceType_=serviceType ; - - if (serviceType_==CServicesManager::GATHERER) - { - hasClient=true ; - hasServer=true ; - } - else if (serviceType_==CServicesManager::IO_SERVER || serviceType_==CServicesManager::OUT_SERVER) - { - hasClient=false ; - hasServer=true ; - } - - CXios::getContextsManager()->getContextId(getId(), contextId_, intraComm) ; - - string contextRegistryId=getId() ; - registryIn=new CRegistry(CXios::getRegistryManager()->getRegistryIn()); - registryIn->setPath(contextRegistryId) ; - - registryOut=new CRegistry(intraComm_) ; - registryOut->setPath(contextRegistryId) ; - - } - CATCH_DUMP_ATTR - - - void CContext::createClientInterComm(MPI_Comm interCommClient, MPI_Comm interCommServer) // for servers - TRY - { - MPI_Comm intraCommClient ; - MPI_Comm_dup(intraComm_, &intraCommClient); - comms.push_back(intraCommClient); - // attached_mode=parentServerContext_->isAttachedMode() ; //ym probably inherited from source context - server = new CContextServer(this,intraComm_, interCommServer); // check if we need to dupl. intraComm_ ? - client = new CContextClient(this,intraCommClient,interCommClient); - client->setAssociatedServer(server) ; - server->setAssociatedClient(client) ; - - } - CATCH_DUMP_ATTR - - void CContext::createServerInterComm(void) - TRY - { - - MPI_Comm interCommClient, interCommServer ; - - if (serviceType_ == CServicesManager::CLIENT) - { - - int commRank ; - MPI_Comm_rank(intraComm_,&commRank) ; - if (commRank==0) - { - if (attached_mode) CXios::getContextsManager()->createServerContext(CClient::getPoolRessource()->getId(), getContextId()+"_"+CXios::defaultServerId, 0, getContextId()) ; - else if (CXios::usingServer2) CXios::getContextsManager()->createServerContext(CXios::defaultPoolId, CXios::defaultGathererId, 0, getContextId()) ; - else CXios::getContextsManager()->createServerContext(CXios::defaultPoolId, CXios::defaultServerId, 0, getContextId()) ; - } - - MPI_Comm interComm ; - - if (attached_mode) - { - parentServerContext_->createIntercomm(CClient::getPoolRessource()->getId(), getContextId()+"_"+CXios::defaultServerId, 0, getContextId(), intraComm_, - interCommClient, interCommServer) ; - int type ; - if (commRank==0) CXios::getServicesManager()->getServiceType(CClient::getPoolRessource()->getId(), CXios::defaultServerId, 0, type) ; - MPI_Bcast(&type,1,MPI_INT,0,intraComm_) ; - setCurrent(getId()) ; // getCurrent/setCurrent may be supress, it can cause a lot of trouble - } - else if (CXios::usingServer2) - { -// CXios::getContextsManager()->createServerContextIntercomm(CXios::defaultPoolId, CXios::defaultGathererId, 0, getContextId(), intraComm_, interComm) ; - parentServerContext_->createIntercomm(CXios::defaultPoolId, CXios::defaultGathererId, 0, getContextId(), intraComm_, - interCommClient, interCommServer) ; - int type ; - if (commRank==0) CXios::getServicesManager()->getServiceType(CXios::defaultPoolId, CXios::defaultGathererId, 0, type) ; - MPI_Bcast(&type,1,MPI_INT,0,intraComm_) ; - } - else - { - //CXios::getContextsManager()->createServerContextIntercomm(CXios::defaultPoolId, CXios::defaultServerId, 0, getContextId(), intraComm_, interComm) ; - parentServerContext_->createIntercomm(CXios::defaultPoolId, CXios::defaultServerId, 0, getContextId(), intraComm_, - interCommClient, interCommServer) ; - int type ; - if (commRank==0) CXios::getServicesManager()->getServiceType(CXios::defaultPoolId, CXios::defaultServerId, 0, type) ; - MPI_Bcast(&type,1,MPI_INT,0,intraComm_) ; - } - - // intraComm client is not duplicated. In all the code we use client->intraComm for MPI - // in future better to replace it by intracommuncator associated to the context - - MPI_Comm intraCommClient, intraCommServer ; - intraCommClient=intraComm_ ; - MPI_Comm_dup(intraComm_, &intraCommServer) ; - client = new CContextClient(this, intraCommClient, interCommClient); - server = new CContextServer(this, intraCommServer, interCommServer); - client->setAssociatedServer(server) ; - server->setAssociatedClient(client) ; - } - - if (serviceType_ == CServicesManager::GATHERER) - { - int commRank ; - MPI_Comm_rank(intraComm_,&commRank) ; - - int nbPartitions ; - if (commRank==0) - { - CXios::getServicesManager()->getServiceNbPartitions(CXios::defaultPoolId, CXios::defaultServerId, 0, nbPartitions) ; - for(int i=0 ; icreateServerContext(CXios::defaultPoolId, CXios::defaultServerId, i, getContextId()) ; - } - MPI_Bcast(&nbPartitions, 1, MPI_INT, 0, intraComm_) ; - - MPI_Comm interComm ; - for(int i=0 ; icreateIntercomm(CXios::defaultPoolId, CXios::defaultServerId, i, getContextId(), intraComm_, interCommClient, interCommServer) ; - int type ; - if (commRank==0) CXios::getServicesManager()->getServiceType(CXios::defaultPoolId, CXios::defaultServerId, 0, type) ; - MPI_Bcast(&type,1,MPI_INT,0,intraComm_) ; - primServerId_.push_back(CXios::getContextsManager()->getServerContextName(CXios::defaultPoolId, CXios::defaultServerId, i, type, getContextId())) ; - - // intraComm client is not duplicated. In all the code we use client->intraComm for MPI - // in future better to replace it by intracommuncator associated to the context - - MPI_Comm intraCommClient, intraCommServer ; - - intraCommClient=intraComm_ ; - MPI_Comm_dup(intraComm_, &intraCommServer) ; - - CContextClient* client = new CContextClient(this, intraCommClient, interCommClient) ; - CContextServer* server = new CContextServer(this, intraCommServer, interCommServer) ; - client->setAssociatedServer(server) ; - server->setAssociatedClient(client) ; - clientPrimServer.push_back(client); - serverPrimServer.push_back(server); - - - } - } - } - CATCH_DUMP_ATTR - - void CContext::globalEventLoop(void) - { - lockContext() ; - CXios::getDaemonsManager()->eventLoop() ; - unlockContext() ; - setCurrent(getId()) ; - } - - bool CContext::scheduledEventLoop(bool enableEventsProcessing) - { - bool out, finished; - size_t timeLine=timeLine_ ; - if (serviceType_==CServicesManager::CLIENT) - { - timeLine_++ ; - eventScheduler_->registerEvent(timeLine, hashId_) ; - } - - do - { - finished=eventLoop(enableEventsProcessing) ; - if (serviceType_==CServicesManager::CLIENT) - { - out = eventScheduler_->queryEvent(timeLine,hashId_) ; - if (out) eventScheduler_->popEvent() ; - } - - else out=true ; - } while(!out) ; - - return finished ; - } - - bool CContext::eventLoop(bool enableEventsProcessing) - { - bool finished(true); - if (isLockedContext()) return false; - - setCurrent(getId()) ; - - if (client!=nullptr && !finalized) client->checkBuffers(); - - for (int i = 0; i < clientPrimServer.size(); ++i) - { - if (!finalized) clientPrimServer[i]->checkBuffers(); - if (!finalized) finished &= serverPrimServer[i]->eventLoop(enableEventsProcessing); - } - - for (auto couplerOut : couplerOutClient_) - if (!finalized) couplerOut.second->checkBuffers(); - - for (auto couplerIn : couplerInClient_) - if (!finalized) couplerIn.second->checkBuffers(); - - for (auto couplerOut : couplerOutServer_) - if (!finalized) couplerOut.second->eventLoop(enableEventsProcessing); - - for (auto couplerIn : couplerInServer_) - if (!finalized) couplerIn.second->eventLoop(enableEventsProcessing); - - if (server!=nullptr) if (!finalized) finished &= server->eventLoop(enableEventsProcessing); - setCurrent(getId()) ; - return finalized && finished ; - } - - void CContext::addCouplingChanel(const std::string& fullContextId, bool out) - { - int contextLeader ; - - if (out) - { - if (couplerOutClient_.find(fullContextId)==couplerOutClient_.end()) - { - bool ok=CXios::getContextsManager()->getContextLeader(fullContextId, contextLeader, getIntraComm()) ; - - MPI_Comm interComm, interCommClient, interCommServer ; - MPI_Comm intraCommClient, intraCommServer ; - - if (ok) MPI_Intercomm_create(getIntraComm(), 0, CXios::getXiosComm(), contextLeader, 0, &interComm) ; - - MPI_Comm_dup(intraComm_, &intraCommClient) ; - MPI_Comm_dup(intraComm_, &intraCommServer) ; - MPI_Comm_dup(interComm, &interCommClient) ; - MPI_Comm_dup(interComm, &interCommServer) ; - CContextClient* client = new CContextClient(this, intraCommClient, interCommClient); - CContextServer* server = new CContextServer(this, intraCommServer, interCommServer); - client->setAssociatedServer(server) ; - server->setAssociatedClient(client) ; - MPI_Comm_free(&interComm) ; - couplerOutClient_[fullContextId] = client ; - couplerOutServer_[fullContextId] = server ; - } - } - else if (couplerInClient_.find(fullContextId)==couplerInClient_.end()) - { - bool ok=CXios::getContextsManager()->getContextLeader(fullContextId, contextLeader, getIntraComm()) ; - - MPI_Comm interComm, interCommClient, interCommServer ; - MPI_Comm intraCommClient, intraCommServer ; - - if (ok) MPI_Intercomm_create(getIntraComm(), 0, CXios::getXiosComm(), contextLeader, 0, &interComm) ; - - MPI_Comm_dup(intraComm_, &intraCommClient) ; - MPI_Comm_dup(intraComm_, &intraCommServer) ; - MPI_Comm_dup(interComm, &interCommServer) ; - MPI_Comm_dup(interComm, &interCommClient) ; - CContextServer* server = new CContextServer(this, intraCommServer, interCommServer); - CContextClient* client = new CContextClient(this, intraCommClient, interCommClient); - client->setAssociatedServer(server) ; - server->setAssociatedClient(client) ; - MPI_Comm_free(&interComm) ; - - couplerInClient_[fullContextId] = client ; - couplerInServer_[fullContextId] = server ; - } - } - - void CContext::finalize(void) - TRY - { - registryOut->hierarchicalGatherRegistry() ; - if (server->intraCommRank==0) CXios::getRegistryManager()->merge(*registryOut) ; - - if (serviceType_==CServicesManager::CLIENT) - { -//ym doPreTimestepOperationsForEnabledReadModeFiles(); // For now we only use server level 1 to read data - - triggerLateFields() ; - - // inform couplerIn that I am finished - for(auto& couplerInClient : couplerInClient_) sendCouplerInContextFinalized(couplerInClient.second) ; - - // wait until received message from couplerOut that they have finished - bool couplersInFinalized ; - do - { - couplersInFinalized=true ; - for(auto& couplerOutClient : couplerOutClient_) couplersInFinalized &= isCouplerInContextFinalized(couplerOutClient.second) ; - globalEventLoop() ; - } while (!couplersInFinalized) ; - - info(100)<<"DEBUG: context "<finalize(); - info(100)<<"DEBUG: context "<havePendingRequests()) client->checkBuffers(); - info(100)<<"DEBUG: context "<isNotifiedFinalized() ; - } while (!notifiedFinalized) ; - - server->releaseBuffers(); - client->releaseBuffers(); - info(100)<<"DEBUG: context "<finalize(); - bool bufferReleased; - do - { - clientPrimServer[i]->checkBuffers(); - bufferReleased = !clientPrimServer[i]->havePendingRequests(); - } while (!bufferReleased); - - bool notifiedFinalized=false ; - do - { - notifiedFinalized=clientPrimServer[i]->isNotifiedFinalized() ; - } while (!notifiedFinalized) ; - clientPrimServer[i]->releaseBuffers(); - } - closeAllFile(); - - } - else if (serviceType_==CServicesManager::IO_SERVER || serviceType_==CServicesManager::OUT_SERVER) - { - closeAllFile(); - client->releaseBuffers(); - server->releaseBuffers(); - } - - freeComms() ; - - parentServerContext_->freeComm() ; - finalized = true; - info(20)<<"CContext: Context <"< is finalized."<::iterator it = comms.begin(); it != comms.end(); ++it) - MPI_Comm_free(&(*it)); - comms.clear(); - } - CATCH_DUMP_ATTR - - //! Deallocate buffers allocated by clientContexts - void CContext::releaseClientBuffers(void) - TRY - { - client->releaseBuffers(); - for (int i = 0; i < clientPrimServer.size(); ++i) - clientPrimServer[i]->releaseBuffers(); - } - CATCH_DUMP_ATTR - - - /*! - \brief Close all the context defintion and do processing data - After everything is well defined on client side, they will be processed and sent to server - From the version 2.0, sever and client work no more on the same database. Moreover, client(s) will send - all necessary information to server, from which each server can build its own database. - Because the role of server is to write out field data on a specific netcdf file, - the only information that it needs is the enabled files - and the active fields (fields will be written onto active files) - */ - void CContext::closeDefinition(void) - TRY - { - CTimer::get("Context : close definition").resume() ; - - // create intercommunicator with servers. - // not sure it is the good place to be called here - createServerInterComm() ; - - - // After xml is parsed, there are some more works with post processing -// postProcessing(); - - - // Make sure the calendar was correctly created - if (serviceType_!=CServicesManager::CLIENT) CCalendarWrapper::get(CCalendarWrapper::GetDefName())->createCalendar(); - if (!calendar) - ERROR("CContext::postProcessing()", << "A calendar must be defined for the context \"" << getId() << "!\"") - else if (calendar->getTimeStep() == NoneDu) - ERROR("CContext::postProcessing()", << "A timestep must be defined for the context \"" << getId() << "!\"") - // Calendar first update to set the current date equals to the start date - calendar->update(0); - - // Résolution des héritages descendants (càd des héritages de groupes) - // pour chacun des contextes. - solveDescInheritance(true); - - // Solve inheritance for field to know if enabled or not. - for (auto field : CField::getAll()) field->solveRefInheritance(); - - // Check if some axis, domains or grids are eligible to for compressed indexed output. - // Warning: This must be done after solving the inheritance and before the rest of post-processing - // --> later ???? checkAxisDomainsGridsEligibilityForCompressedOutput(); - - // Check if some automatic time series should be generated - // Warning: This must be done after solving the inheritance and before the rest of post-processing - - // The timeseries should only be prepared in client - prepareTimeseries(); - - //Initialisation du vecteur 'enabledFiles' contenant la liste des fichiers à sortir. - findEnabledFiles(); - findEnabledWriteModeFiles(); - findEnabledReadModeFiles(); - findEnabledCouplerIn(); - findEnabledCouplerOut(); - createCouplerInterCommunicator() ; - - // Find all enabled fields of each file - vector&& fileOutField = findAllEnabledFieldsInFileOut(this->enabledWriteModeFiles); - vector&& fileInField = findAllEnabledFieldsInFileIn(this->enabledReadModeFiles); - vector&& couplerOutField = findAllEnabledFieldsCouplerOut(this->enabledCouplerOut); - vector&& couplerInField = findAllEnabledFieldsCouplerIn(this->enabledCouplerIn); - findFieldsWithReadAccess(); - vector& fieldWithReadAccess = fieldsWithReadAccess_ ; - vector fieldModelIn ; // fields potentially from model - - // define if files are on clientSied or serverSide - if (serviceType_==CServicesManager::CLIENT) - { - for (auto& file : enabledWriteModeFiles) file->setClientSide() ; - for (auto& file : enabledReadModeFiles) file->setClientSide() ; - } - else - { - for (auto& file : enabledWriteModeFiles) file->setServerSide() ; - for (auto& file : enabledReadModeFiles) file->setServerSide() ; - } - - - for (auto& field : couplerInField) - { - field->unsetGridCompleted() ; - } -// find all field potentially at workflow end - vector endWorkflowFields ; - endWorkflowFields.reserve(fileOutField.size()+couplerOutField.size()+fieldWithReadAccess.size()) ; - endWorkflowFields.insert(endWorkflowFields.end(),fileOutField.begin(), fileOutField.end()) ; - endWorkflowFields.insert(endWorkflowFields.end(),couplerOutField.begin(), couplerOutField.end()) ; - endWorkflowFields.insert(endWorkflowFields.end(),fieldWithReadAccess.begin(), fieldWithReadAccess.end()) ; - - bool workflowGraphIsCompleted ; - - bool first=true ; - - do - { - workflowGraphIsCompleted=true; - for(auto endWorkflowField : endWorkflowFields) - { - workflowGraphIsCompleted &= endWorkflowField->buildWorkflowGraph(garbageCollector) ; - } - - for(auto couplerIn : enabledCouplerIn) couplerIn->assignContext() ; - for(auto field : couplerInField) field->makeGridAliasForCoupling(); - for(auto field : couplerInField) this->sendCouplerInReady(field->getContextClient()) ; - - - // assign context to coupler out and related fields - for(auto couplerOut : enabledCouplerOut) couplerOut->assignContext() ; - // for now supose that all coupling out endpoint are succesfull. The difficultie is client/server buffer evaluation - for(auto field : couplerOutField) - { - // connect to couplerOut -> to do - } - - bool couplersReady ; - do - { - couplersReady=true ; - for(auto field : couplerOutField) - { - bool ready = isCouplerInReady(field->getContextClient()) ; - if (ready) field->sendFieldToCouplerOut() ; - couplersReady &= ready ; - } - this->scheduledEventLoop() ; - - } while (!couplersReady) ; - - first=false ; - this->scheduledEventLoop() ; - - } while (!workflowGraphIsCompleted) ; - - - for( auto field : couplerInField) couplerInFields_.push_back(field) ; - - // get all field coming potentially from model - for (auto field : CField::getAll() ) if (field->getModelIn()) fieldModelIn.push_back(field) ; - - // Distribute files between secondary servers according to the data size => assign a context to a file and then to fields - if (serviceType_==CServicesManager::GATHERER) distributeFiles(this->enabledWriteModeFiles); - else if (serviceType_==CServicesManager::CLIENT) for(auto file : this->enabledWriteModeFiles) file->setContextClient(client) ; - - // client side, assign context for file reading - if (serviceType_==CServicesManager::CLIENT) for(auto file : this->enabledReadModeFiles) file->setContextClient(client) ; - - // server side, assign context where to send file data read - if (serviceType_==CServicesManager::CServicesManager::GATHERER || serviceType_==CServicesManager::IO_SERVER) - for(auto file : this->enabledReadModeFiles) file->setContextClient(client) ; - - // workflow endpoint => sent to IO/SERVER - if (serviceType_==CServicesManager::CLIENT || serviceType_==CServicesManager::GATHERER) - { - for(auto field : fileOutField) - { - field->connectToFileServer(garbageCollector) ; // connect the field to server filter - } - for(auto field : fileOutField) field->sendFieldToFileServer() ; - } - - // workflow endpoint => write to file - if (serviceType_==CServicesManager::IO_SERVER || serviceType_==CServicesManager::OUT_SERVER) - { - for(auto field : fileOutField) - { - field->connectToFileWriter(garbageCollector) ; // connect the field to server filter - } - } - - // workflow endpoint => Send data from server to client - if (serviceType_==CServicesManager::IO_SERVER || serviceType_==CServicesManager::GATHERER) - { - for(auto field : fileInField) - { - field->connectToServerToClient(garbageCollector) ; - } - } - - // workflow endpoint => sent to model on client side - if (serviceType_==CServicesManager::CLIENT) - { - for(auto field : fieldWithReadAccess) field->connectToModelOutput(garbageCollector) ; - } - - - // workflow startpoint => data from model - if (serviceType_==CServicesManager::CLIENT) - { - for(auto field : fieldModelIn) - { - field->connectToModelInput(garbageCollector) ; // connect the field to server filter - // grid index will be computed on the fly - } - } - - // workflow startpoint => data from client on server side - if (serviceType_==CServicesManager::IO_SERVER || serviceType_==CServicesManager::GATHERER || serviceType_==CServicesManager::OUT_SERVER) - { - for(auto field : fieldModelIn) - { - field->connectToClientInput(garbageCollector) ; // connect the field to server filter - } - } - - - for(auto field : couplerInField) - { - field->connectToCouplerIn(garbageCollector) ; // connect the field to server filter - } - - - for(auto field : couplerOutField) - { - field->connectToCouplerOut(garbageCollector) ; // for now the same kind of filter that for file server - } - - // workflow startpoint => data from server on client side - if (serviceType_==CServicesManager::CLIENT) - { - for(auto field : fileInField) - { - field->sendFieldToInputFileServer() ; - field->connectToServerInput(garbageCollector) ; // connect the field to server filter - fileInFields_.push_back(field) ; - } - } - - // workflow startpoint => data read from file on server side - if (serviceType_==CServicesManager::IO_SERVER || serviceType_==CServicesManager::GATHERER) - { - for(auto field : fileInField) - { - field->connectToFileReader(garbageCollector) ; - } - } - - // construct slave server list - if (serviceType_==CServicesManager::CLIENT || serviceType_==CServicesManager::GATHERER) - { - for(auto field : fileOutField) slaveServers_.insert(field->getContextClient()) ; - for(auto field : fileInField) slaveServers_.insert(field->getContextClient()) ; - } - - for(auto& slaveServer : slaveServers_) sendCloseDefinition(slaveServer) ; - - if (serviceType_==CServicesManager::IO_SERVER || serviceType_==CServicesManager::OUT_SERVER) - { - createFileHeader(); - } - - if (serviceType_==CServicesManager::CLIENT) startPrefetchingOfEnabledReadModeFiles(); - - // send signal to couplerIn context that definition phasis is done - - for(auto& couplerInClient : couplerInClient_) sendCouplerInCloseDefinition(couplerInClient.second) ; - - // wait until all couplerIn signal that closeDefition is done. - bool ok; - do - { - ok = true ; - for(auto& couplerOutClient : couplerOutClient_) ok &= isCouplerInCloseDefinition(couplerOutClient.second) ; - this->scheduledEventLoop() ; - } while (!ok) ; - - // Now evaluate the size of the context client buffers - map> fieldBufferEvaluation ; - for(auto field : fileOutField) field->evaluateBufferSize(fieldBufferEvaluation, CXios::isOptPerformance) ; // output to server - for(auto field : couplerOutField) field->evaluateBufferSize(fieldBufferEvaluation, CXios::isOptPerformance) ; // output to coupler - for(auto field : fieldModelIn) field->evaluateBufferSize(fieldBufferEvaluation, CXios::isOptPerformance) ; // server to client (for io servers) - - // fix size for each context client - for(auto& it : fieldBufferEvaluation) it.first->setBufferSize(it.second) ; - - - CTimer::get("Context : close definition").suspend() ; - } - CATCH_DUMP_ATTR - - - vector CContext::findAllEnabledFieldsInFileOut(const std::vector& activeFiles) - TRY - { - vector fields ; - for(auto file : activeFiles) - { - const vector&& fieldList=file->getEnabledFields() ; - for(auto field : fieldList) field->setFileOut(file) ; - fields.insert(fields.end(),fieldList.begin(),fieldList.end()); - } - return fields ; - } - CATCH_DUMP_ATTR - - vector CContext::findAllEnabledFieldsInFileIn(const std::vector& activeFiles) - TRY - { - vector fields ; - for(auto file : activeFiles) - { - const vector&& fieldList=file->getEnabledFields() ; - for(auto field : fieldList) field->setFileIn(file) ; - fields.insert(fields.end(),fieldList.begin(),fieldList.end()); - } - return fields ; - } - CATCH_DUMP_ATTR - - vector CContext::findAllEnabledFieldsCouplerOut(const std::vector& activeCouplerOut) - TRY - { - vector fields ; - for (auto couplerOut :activeCouplerOut) - { - const vector&& fieldList=couplerOut->getEnabledFields() ; - for(auto field : fieldList) field->setCouplerOut(couplerOut) ; - fields.insert(fields.end(),fieldList.begin(),fieldList.end()); - } - return fields ; - } - CATCH_DUMP_ATTR - - vector CContext::findAllEnabledFieldsCouplerIn(const std::vector& activeCouplerIn) - TRY - { - vector fields ; - for (auto couplerIn :activeCouplerIn) - { - const vector&& fieldList=couplerIn->getEnabledFields() ; - for(auto field : fieldList) field->setCouplerIn(couplerIn) ; - fields.insert(fields.end(),fieldList.begin(),fieldList.end()); - } - return fields ; - } - CATCH_DUMP_ATTR - - /*! - * Send context attribute and calendar to file server, it must be done once by context file server - * \param[in] client : context client to send - */ - void CContext::sendContextToFileServer(CContextClient* client) - { - if (sendToFileServer_done_.count(client)!=0) return ; - else sendToFileServer_done_.insert(client) ; - - this->sendAllAttributesToServer(client); // Send all attributes of current context to server - CCalendarWrapper::get(CCalendarWrapper::GetDefName())->sendAllAttributesToServer(client); // Send all attributes of current cale - } - - - void CContext::readAttributesOfEnabledFieldsInReadModeFiles() - TRY - { - for (unsigned int i = 0; i < this->enabledReadModeFiles.size(); ++i) - (void)this->enabledReadModeFiles[i]->readAttributesOfEnabledFieldsInReadMode(); - } - CATCH_DUMP_ATTR - - - void CContext::postProcessFilterGraph() - TRY - { - int size = enabledFiles.size(); - for (int i = 0; i < size; ++i) - { - enabledFiles[i]->postProcessFilterGraph(); - } - } - CATCH_DUMP_ATTR - - void CContext::startPrefetchingOfEnabledReadModeFiles() - TRY - { - int size = enabledReadModeFiles.size(); - for (int i = 0; i < size; ++i) - { - enabledReadModeFiles[i]->prefetchEnabledReadModeFields(); - } - } - CATCH_DUMP_ATTR - - void CContext::doPreTimestepOperationsForEnabledReadModeFiles() - TRY - { - int size = enabledReadModeFiles.size(); - for (int i = 0; i < size; ++i) - { - enabledReadModeFiles[i]->doPreTimestepOperationsForEnabledReadModeFields(); - } - } - CATCH_DUMP_ATTR - - void CContext::doPostTimestepOperationsForEnabledReadModeFiles() - TRY - { - int size = enabledReadModeFiles.size(); - for (int i = 0; i < size; ++i) - { - enabledReadModeFiles[i]->doPostTimestepOperationsForEnabledReadModeFields(); - } - } - CATCH_DUMP_ATTR - - void CContext::findFieldsWithReadAccess(void) - TRY - { - fieldsWithReadAccess_.clear(); - const vector allFields = CField::getAll(); - for (size_t i = 0; i < allFields.size(); ++i) - { - CField* field = allFields[i]; - if (!field->read_access.isEmpty() && field->read_access && (field->enabled.isEmpty() || field->enabled)) - { - fieldsWithReadAccess_.push_back(field); - field->setModelOut() ; - } - } - } - CATCH_DUMP_ATTR - - - void CContext::solveAllInheritance(bool apply) - TRY - { - // Résolution des héritages descendants (càd des héritages de groupes) - // pour chacun des contextes. - solveDescInheritance(apply); - - // Résolution des héritages par référence au niveau des fichiers. - const vector allFiles=CFile::getAll(); - const vector allCouplerIn=CCouplerIn::getAll(); - const vector allCouplerOut=CCouplerOut::getAll(); - const vector allGrids= CGrid::getAll(); - - if (serviceType_==CServicesManager::CLIENT) - { - for (unsigned int i = 0; i < allFiles.size(); i++) - allFiles[i]->solveFieldRefInheritance(apply); - - for (unsigned int i = 0; i < allCouplerIn.size(); i++) - allCouplerIn[i]->solveFieldRefInheritance(apply); - - for (unsigned int i = 0; i < allCouplerOut.size(); i++) - allCouplerOut[i]->solveFieldRefInheritance(apply); - } - - unsigned int vecSize = allGrids.size(); - unsigned int i = 0; - for (i = 0; i < vecSize; ++i) - allGrids[i]->solveElementsRefInheritance(apply); - - } - CATCH_DUMP_ATTR - - void CContext::findEnabledFiles(void) - TRY - { - const std::vector allFiles = CFile::getAll(); - const CDate& initDate = calendar->getInitDate(); - - for (unsigned int i = 0; i < allFiles.size(); i++) - if (!allFiles[i]->enabled.isEmpty()) // Si l'attribut 'enabled' est défini. - { - if (allFiles[i]->enabled.getValue()) // Si l'attribut 'enabled' est fixé à vrai. - { - if (allFiles[i]->output_freq.isEmpty()) - { - ERROR("CContext::findEnabledFiles()", - << "Mandatory attribute output_freq must be defined for file \""<getFileOutputName() - <<" \".") - } - if ((initDate + allFiles[i]->output_freq.getValue()) < (initDate + this->getCalendar()->getTimeStep())) - { - error(0)<<"WARNING: void CContext::findEnabledFiles()"<getFileOutputName() - <<"\" is less than the time step. File will not be written."<output_freq.isEmpty()) - { - ERROR("CContext::findEnabledFiles()", - << "Mandatory attribute output_freq must be defined for file \""<getFileOutputName() - <<" \".") - } - if ( (initDate + allFiles[i]->output_freq.getValue()) < (initDate + this->getCalendar()->getTimeStep())) - { - error(0)<<"WARNING: void CContext::findEnabledFiles()"<getFileOutputName() - <<"\" is less than the time step. File will not be written."< allCouplerIn = CCouplerIn::getAll(); - bool enabled ; - for (size_t i = 0; i < allCouplerIn.size(); i++) - { - if (allCouplerIn[i]->enabled.isEmpty()) enabled=true ; - else enabled=allCouplerIn[i]->enabled ; - if (enabled) enabledCouplerIn.push_back(allCouplerIn[i]) ; - } - } - CATCH_DUMP_ATTR - - void CContext::findEnabledCouplerOut(void) - TRY - { - const std::vector allCouplerOut = CCouplerOut::getAll(); - bool enabled ; - for (size_t i = 0; i < allCouplerOut.size(); i++) - { - if (allCouplerOut[i]->enabled.isEmpty()) enabled=true ; - else enabled=allCouplerOut[i]->enabled ; - if (enabled) enabledCouplerOut.push_back(allCouplerOut[i]) ; - } - } - CATCH_DUMP_ATTR - - - - - void CContext::distributeFiles(const vector& files) - TRY - { - bool distFileMemory=false ; - distFileMemory=CXios::getin("server2_dist_file_memory", distFileMemory); - - if (distFileMemory) distributeFileOverMemoryBandwith(files) ; - else distributeFileOverBandwith(files) ; - } - CATCH_DUMP_ATTR - - void CContext::distributeFileOverBandwith(const vector& files) - TRY - { - double eps=std::numeric_limits::epsilon()*10 ; - - std::ofstream ofs(("distribute_file_"+getId()+".dat").c_str(), std::ofstream::out); - int nbPools = clientPrimServer.size(); - - // (1) Find all enabled files in write mode - // for (int i = 0; i < this->enabledFiles.size(); ++i) - // { - // if (enabledFiles[i]->mode.isEmpty() || (!enabledFiles[i]->mode.isEmpty() && enabledFiles[i]->mode.getValue() == CFile::mode_attr::write )) - // enabledWriteModeFiles.push_back(enabledFiles[i]); - // } - - // (2) Estimate the data volume for each file - int size = files.size(); - std::vector > dataSizeMap; - double dataPerPool = 0; - int nfield=0 ; - ofs<getId()< enabledFields = file->getEnabledFields(); - size_t numEnabledFields = enabledFields.size(); - ofs<getGlobalWrittenSize() ; - ofs<getGrid()->getId()<getGlobalWrittenSize()<getCurrentDate()+file->output_freq)-(Time)(calendar->getCurrentDate()) ; - double dataSizeSec= dataSize/ outFreqSec; - ofs< poolDataSize ; -// multimap is not garanty to preserve stable sorting in c++98 but it seems it does for c++11 - - int j; - double dataSize ; - for (j = 0 ; j < nbPools ; ++j) poolDataSize.insert(std::pair(0.,j)) ; - - for (int i = dataSizeMap.size()-1; i >= 0; --i) - { - dataSize=(*poolDataSize.begin()).first ; - j=(*poolDataSize.begin()).second ; - dataSizeMap[i].second->setContextClient(clientPrimServer[j]); - dataSize+=dataSizeMap[i].first; - poolDataSize.erase(poolDataSize.begin()) ; - poolDataSize.insert(std::pair(dataSize,j)) ; - } - - for (std::multimap:: iterator it=poolDataSize.begin() ; it!=poolDataSize.end(); ++it) info(30)<<"Load Balancing for servers (perfect=1) : "<second<<" : ratio "<first*1./dataPerPool<& filesList) - TRY - { - int nbPools = clientPrimServer.size(); - double ratio=0.5 ; - ratio=CXios::getin("server2_dist_file_memory_ratio", ratio); - - int nFiles = filesList.size(); - vector files(nFiles); - vector grids; - map gridMap ; - string gridId; - int gridIndex=0 ; - - for (size_t i = 0; i < nFiles; ++i) - { - StdSize dataSize=0; - CFile* file = filesList[i]; - std::vector enabledFields = file->getEnabledFields(); - size_t numEnabledFields = enabledFields.size(); - - files[i].id_=file->getId() ; - files[i].nbGrids_=numEnabledFields; - files[i].assignedGrid_ = new int[files[i].nbGrids_] ; - - for (size_t j = 0; j < numEnabledFields; ++j) - { - gridId=enabledFields[j]->getGrid()->getId() ; - if (gridMap.find(gridId)==gridMap.end()) - { - gridMap[gridId]=gridIndex ; - SDistGrid newGrid; - grids.push_back(newGrid) ; - gridIndex++ ; - } - files[i].assignedGrid_[j]=gridMap[gridId] ; - grids[files[i].assignedGrid_[j]].size_=enabledFields[j]->getGlobalWrittenSize() ; - dataSize += enabledFields[j]->getGlobalWrittenSize() ; // usefull - } - double outFreqSec = (Time)(calendar->getCurrentDate()+file->output_freq)-(Time)(calendar->getCurrentDate()) ; - files[i].bandwith_= dataSize/ outFreqSec ; - } - - double bandwith=0 ; - double memory=0 ; - - for(int i=0; i memorySize(nbPools,0.) ; - vector< set > serverGrids(nbPools) ; - vector bandwithSize(nbPools,0.) ; - - for (size_t i = 0; i < nFiles; ++i) - { - bandwithSize[files[i].assignedServer_] += files[i].bandwith_* bandwith /ratio ; - for(int j=0 ; jsetContextClient(clientPrimServer[files[i].assignedServer_]) ; - delete [] files[i].assignedGrid_ ; - } - - for (int i = 0; i < nbPools; ++i) info(100)<<"Pool server level2 "<enabledFiles.size(); - for (int i = 0; i < size; ++i) - { - if (enabledFiles[i]->mode.isEmpty() || - (!enabledFiles[i]->mode.isEmpty() && enabledFiles[i]->mode.getValue() == CFile::mode_attr::write )) - enabledWriteModeFiles.push_back(enabledFiles[i]); - } - } - CATCH_DUMP_ATTR - - /*! - Find all files in read mode - */ - void CContext::findEnabledReadModeFiles(void) - TRY - { - int size = this->enabledFiles.size(); - for (int i = 0; i < size; ++i) - { - if (!enabledFiles[i]->mode.isEmpty() && enabledFiles[i]->mode.getValue() == CFile::mode_attr::read) - enabledReadModeFiles.push_back(enabledFiles[i]); - } - } - CATCH_DUMP_ATTR - - void CContext::closeAllFile(void) - TRY - { - std::vector::const_iterator - it = this->enabledFiles.begin(), end = this->enabledFiles.end(); - - for (; it != end; it++) - { - info(30)<<"Closing File : "<<(*it)->getId()<close(); - } - } - CATCH_DUMP_ATTR - - /*! - \brief Dispatch event received from client - Whenever a message is received in buffer of server, it will be processed depending on - its event type. A new event type should be added in the switch list to make sure - it processed on server side. - \param [in] event: Received message - */ - bool CContext::dispatchEvent(CEventServer& event) - TRY - { - - if (SuperClass::dispatchEvent(event)) return true; - else - { - switch(event.type) - { - case EVENT_ID_CLOSE_DEFINITION : - recvCloseDefinition(event); - return true; - break; - case EVENT_ID_UPDATE_CALENDAR: - recvUpdateCalendar(event); - return true; - break; - case EVENT_ID_CREATE_FILE_HEADER : - recvCreateFileHeader(event); - return true; - break; - case EVENT_ID_COUPLER_IN_READY: - recvCouplerInReady(event); - return true; - break; - case EVENT_ID_COUPLER_IN_CLOSE_DEFINITION: - recvCouplerInCloseDefinition(event); - return true; - break; - case EVENT_ID_COUPLER_IN_CONTEXT_FINALIZED: - recvCouplerInContextFinalized(event); - return true; - break; - default : - ERROR("bool CContext::dispatchEvent(CEventServer& event)", - <<"Unknown Event"); - return false; - } - } - } - CATCH - - //! Client side: Send a message to server to make it close - // ym obsolete - void CContext::sendCloseDefinition(void) - TRY - { - int nbSrvPools ; - if (serviceType_==CServicesManager::CLIENT) nbSrvPools = 1 ; - else if (serviceType_==CServicesManager::GATHERER) nbSrvPools = this->clientPrimServer.size() ; - else nbSrvPools = 0 ; - CContextClient* contextClientTmp ; - - for (int i = 0; i < nbSrvPools; ++i) - { - if (serviceType_==CServicesManager::CLIENT) contextClientTmp = client ; - else if (serviceType_==CServicesManager::GATHERER ) contextClientTmp = clientPrimServer[i] ; - CEventClient event(getType(),EVENT_ID_CLOSE_DEFINITION); - if (contextClientTmp->isServerLeader()) - { - CMessage msg; - const std::list& ranks = contextClientTmp->getRanksServerLeader(); - for (std::list::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) - event.push(*itRank,1,msg); - contextClientTmp->sendEvent(event); - } - else contextClientTmp->sendEvent(event); - } - } - CATCH_DUMP_ATTR - - // ! Client side: Send a message to server to make it close - void CContext::sendCloseDefinition(CContextClient* client) - TRY - { - if (sendCloseDefinition_done_.count(client)!=0) return ; - else sendCloseDefinition_done_.insert(client) ; - - CEventClient event(getType(),EVENT_ID_CLOSE_DEFINITION); - if (client->isServerLeader()) - { - CMessage msg; - for(auto rank : client->getRanksServerLeader()) event.push(rank,1,msg); - client->sendEvent(event); - } - else client->sendEvent(event); - } - CATCH_DUMP_ATTR - - //! Server side: Receive a message of client announcing a context close - void CContext::recvCloseDefinition(CEventServer& event) - TRY - { - CBufferIn* buffer=event.subEvents.begin()->buffer; - getCurrent()->closeDefinition(); - } - CATCH - - //! Client side: Send a message to update calendar in each time step - void CContext::sendUpdateCalendar(int step) - TRY - { - CEventClient event(getType(),EVENT_ID_UPDATE_CALENDAR); - for(auto client : slaveServers_) - { - if (client->isServerLeader()) - { - CMessage msg; - msg<getRanksServerLeader() ) event.push(rank,1,msg); - client->sendEvent(event); - } - else client->sendEvent(event); - } - } - CATCH_DUMP_ATTR - - //! Server side: Receive a message of client annoucing calendar update - void CContext::recvUpdateCalendar(CEventServer& event) - TRY - { - CBufferIn* buffer=event.subEvents.begin()->buffer; - getCurrent()->recvUpdateCalendar(*buffer); - } - CATCH - - //! Server side: Receive a message of client annoucing calendar update - void CContext::recvUpdateCalendar(CBufferIn& buffer) - TRY - { - int step; - buffer>>step; - updateCalendar(step); - if (serviceType_==CServicesManager::GATHERER) - { - sendUpdateCalendar(step); - } - } - CATCH_DUMP_ATTR - - //! Client side: Send a message to create header part of netcdf file - void CContext::sendCreateFileHeader(void) - TRY - { - int nbSrvPools ; - if (serviceType_==CServicesManager::CLIENT) nbSrvPools = 1 ; - else if (serviceType_==CServicesManager::GATHERER) nbSrvPools = this->clientPrimServer.size() ; - else nbSrvPools = 0 ; - CContextClient* contextClientTmp ; - - for (int i = 0; i < nbSrvPools; ++i) - { - if (serviceType_==CServicesManager::CLIENT) contextClientTmp = client ; - else if (serviceType_==CServicesManager::GATHERER ) contextClientTmp = clientPrimServer[i] ; - CEventClient event(getType(),EVENT_ID_CREATE_FILE_HEADER); - - if (contextClientTmp->isServerLeader()) - { - CMessage msg; - const std::list& ranks = contextClientTmp->getRanksServerLeader(); - for (std::list::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) - event.push(*itRank,1,msg) ; - contextClientTmp->sendEvent(event); - } - else contextClientTmp->sendEvent(event); - } - } - CATCH_DUMP_ATTR - - //! Server side: Receive a message of client annoucing the creation of header part of netcdf file - void CContext::recvCreateFileHeader(CEventServer& event) - TRY - { - CBufferIn* buffer=event.subEvents.begin()->buffer; - getCurrent()->recvCreateFileHeader(*buffer); - } - CATCH - - //! Server side: Receive a message of client annoucing the creation of header part of netcdf file - void CContext::recvCreateFileHeader(CBufferIn& buffer) - TRY - { - if (serviceType_==CServicesManager::IO_SERVER || serviceType_==CServicesManager::OUT_SERVER) - createFileHeader(); - } - CATCH_DUMP_ATTR - - void CContext::createCouplerInterCommunicator(void) - TRY - { - int rank=this->getIntraCommRank() ; - map> listCouplerOut ; - map> listCouplerIn ; - - for(auto couplerOut : enabledCouplerOut) listCouplerOut[couplerOut->getCouplingContextId()].push_back(couplerOut) ; - for(auto couplerIn : enabledCouplerIn) listCouplerIn[couplerIn->getCouplingContextId()].push_back(couplerIn) ; - - CCouplerManager* couplerManager = CXios::getCouplerManager() ; - if (rank==0) - { - for(auto couplerOut : listCouplerOut) couplerManager->registerCoupling(this->getContextId(),couplerOut.first) ; - for(auto couplerIn : listCouplerIn) couplerManager->registerCoupling(couplerIn.first,this->getContextId()) ; - } - - do - { - for(auto couplerOut : listCouplerOut) - { - bool isNextCoupling ; - if (rank==0) isNextCoupling = couplerManager->isNextCoupling(this->getContextId(),couplerOut.first) ; - MPI_Bcast(&isNextCoupling,1,MPI_C_BOOL, 0, getIntraComm()) ; - if (isNextCoupling) - { - addCouplingChanel(couplerOut.first, true) ; - listCouplerOut.erase(couplerOut.first) ; - break ; - } - } - for(auto couplerIn : listCouplerIn) - { - bool isNextCoupling ; - if (rank==0) isNextCoupling = couplerManager->isNextCoupling(couplerIn.first,this->getContextId()); - MPI_Bcast(&isNextCoupling,1,MPI_C_BOOL, 0, getIntraComm()) ; - if (isNextCoupling) - { - addCouplingChanel(couplerIn.first, false) ; - listCouplerIn.erase(couplerIn.first) ; - break ; - } - } - - } while (!listCouplerOut.empty() || !listCouplerIn.empty()) ; - - } - CATCH_DUMP_ATTR - - - //! Client side: Send infomation of active files (files are enabled to write out) - void CContext::sendEnabledFiles(const std::vector& activeFiles) - TRY - { - int size = activeFiles.size(); - - // In a context, each type has a root definition, e.g: axis, domain, field. - // Every object must be a child of one of these root definition. In this case - // all new file objects created on server must be children of the root "file_definition" - StdString fileDefRoot("file_definition"); - CFileGroup* cfgrpPtr = CFileGroup::get(fileDefRoot); - - for (int i = 0; i < size; ++i) - { - CFile* f = activeFiles[i]; - cfgrpPtr->sendCreateChild(f->getId(),f->getContextClient()); - f->sendAllAttributesToServer(f->getContextClient()); - f->sendAddAllVariables(f->getContextClient()); - } - } - CATCH_DUMP_ATTR - - //! Client side: Send information of active fields (ones are written onto files) - void CContext::sendEnabledFieldsInFiles(const std::vector& activeFiles) - TRY - { - int size = activeFiles.size(); - for (int i = 0; i < size; ++i) - { - activeFiles[i]->sendEnabledFields(activeFiles[i]->getContextClient()); - } - } - CATCH_DUMP_ATTR - - - //! Client side: Prepare the timeseries by adding the necessary files - void CContext::prepareTimeseries() - TRY - { - const std::vector allFiles = CFile::getAll(); - for (size_t i = 0; i < allFiles.size(); i++) - { - CFile* file = allFiles[i]; - - std::vector fileVars, fieldVars, vars = file->getAllVariables(); - for (size_t k = 0; k < vars.size(); k++) - { - CVariable* var = vars[k]; - - if (var->ts_target.isEmpty() - || var->ts_target == CVariable::ts_target_attr::file || var->ts_target == CVariable::ts_target_attr::both) - fileVars.push_back(var); - - if (!var->ts_target.isEmpty() - && (var->ts_target == CVariable::ts_target_attr::field || var->ts_target == CVariable::ts_target_attr::both)) - fieldVars.push_back(var); - } - - if (!file->timeseries.isEmpty() && file->timeseries != CFile::timeseries_attr::none) - { - StdString fileNameStr("%file_name%") ; - StdString tsPrefix = !file->ts_prefix.isEmpty() ? file->ts_prefix : fileNameStr ; - - StdString fileName=file->getFileOutputName(); - size_t pos=tsPrefix.find(fileNameStr) ; - while (pos!=std::string::npos) - { - tsPrefix=tsPrefix.replace(pos,fileNameStr.size(),fileName) ; - pos=tsPrefix.find(fileNameStr) ; - } - - const std::vector allFields = file->getAllFields(); - for (size_t j = 0; j < allFields.size(); j++) - { - CField* field = allFields[j]; - - if (!field->ts_enabled.isEmpty() && field->ts_enabled) - { - CFile* tsFile = CFile::create(); - tsFile->duplicateAttributes(file); - - // Add variables originating from file and targeted to timeserie file - for (size_t k = 0; k < fileVars.size(); k++) - tsFile->getVirtualVariableGroup()->addChild(fileVars[k]); - - - tsFile->name = tsPrefix + "_"; - if (!field->name.isEmpty()) - tsFile->name.get() += field->name; - else if (field->hasDirectFieldReference()) // We cannot use getBaseFieldReference() just yet - tsFile->name.get() += field->field_ref; - else - tsFile->name.get() += field->getId(); - - if (!field->ts_split_freq.isEmpty()) - tsFile->split_freq = field->ts_split_freq; - - CField* tsField = tsFile->addField(); - tsField->field_ref = field->getId(); - - // Add variables originating from file and targeted to timeserie field - for (size_t k = 0; k < fieldVars.size(); k++) - tsField->getVirtualVariableGroup()->addChild(fieldVars[k]); - - vars = field->getAllVariables(); - for (size_t k = 0; k < vars.size(); k++) - { - CVariable* var = vars[k]; - - // Add variables originating from field and targeted to timeserie field - if (var->ts_target.isEmpty() - || var->ts_target == CVariable::ts_target_attr::field || var->ts_target == CVariable::ts_target_attr::both) - tsField->getVirtualVariableGroup()->addChild(var); - - // Add variables originating from field and targeted to timeserie file - if (!var->ts_target.isEmpty() - && (var->ts_target == CVariable::ts_target_attr::file || var->ts_target == CVariable::ts_target_attr::both)) - tsFile->getVirtualVariableGroup()->addChild(var); - } - - tsFile->solveFieldRefInheritance(true); - - if (file->timeseries == CFile::timeseries_attr::exclusive) - field->enabled = false; - } - } - - // Finally disable the original file is need be - if (file->timeseries == CFile::timeseries_attr::only) - file->enabled = false; - } - } - } - CATCH_DUMP_ATTR - - - //! Client side: Send information of reference domain, axis and scalar of active fields - void CContext::sendRefDomainsAxisScalars(const std::vector& activeFiles) - TRY - { - std::set> domainIds, axisIds, scalarIds; - - // Find all reference domain and axis of all active fields - int numEnabledFiles = activeFiles.size(); - for (int i = 0; i < numEnabledFiles; ++i) - { - std::vector enabledFields = activeFiles[i]->getEnabledFields(); - int numEnabledFields = enabledFields.size(); - for (int j = 0; j < numEnabledFields; ++j) - { - CContextClient* contextClient=enabledFields[j]->getContextClient() ; - const std::vector& prDomAxisScalarId = enabledFields[j]->getRefDomainAxisIds(); - if ("" != prDomAxisScalarId[0]) domainIds.insert(make_pair(prDomAxisScalarId[0],contextClient)); - if ("" != prDomAxisScalarId[1]) axisIds.insert(make_pair(prDomAxisScalarId[1],contextClient)); - if ("" != prDomAxisScalarId[2]) scalarIds.insert(make_pair(prDomAxisScalarId[2],contextClient)); - } - } - - // Create all reference axis on server side - std::set::iterator itDom, itAxis, itScalar; - std::set::const_iterator itE; - - StdString scalarDefRoot("scalar_definition"); - CScalarGroup* scalarPtr = CScalarGroup::get(scalarDefRoot); - - for (auto itScalar = scalarIds.begin(); itScalar != scalarIds.end(); ++itScalar) - { - if (!itScalar->first.empty()) - { - scalarPtr->sendCreateChild(itScalar->first,itScalar->second); - CScalar::get(itScalar->first)->sendAllAttributesToServer(itScalar->second); - } - } - - StdString axiDefRoot("axis_definition"); - CAxisGroup* axisPtr = CAxisGroup::get(axiDefRoot); - - for (auto itAxis = axisIds.begin(); itAxis != axisIds.end(); ++itAxis) - { - if (!itAxis->first.empty()) - { - axisPtr->sendCreateChild(itAxis->first, itAxis->second); - CAxis::get(itAxis->first)->sendAllAttributesToServer(itAxis->second); - } - } - - // Create all reference domains on server side - StdString domDefRoot("domain_definition"); - CDomainGroup* domPtr = CDomainGroup::get(domDefRoot); - - for (auto itDom = domainIds.begin(); itDom != domainIds.end(); ++itDom) - { - if (!itDom->first.empty()) { - domPtr->sendCreateChild(itDom->first, itDom->second); - CDomain::get(itDom->first)->sendAllAttributesToServer(itDom->second); - } - } - } - CATCH_DUMP_ATTR - - void CContext::triggerLateFields(void) - TRY - { - for(auto& field : fileInFields_) field->triggerLateField() ; - for(auto& field : couplerInFields_) field->triggerLateField() ; - } - CATCH_DUMP_ATTR - - //! Update calendar in each time step - void CContext::updateCalendar(int step) - TRY - { - int prevStep = calendar->getStep(); - - if (prevStep < step) - { - if (serviceType_==CServicesManager::CLIENT) // For now we only use server level 1 to read data - { - triggerLateFields(); - } - - info(50) << "updateCalendar : before : " << calendar->getCurrentDate() << endl; - calendar->update(step); - info(50) << "updateCalendar : after : " << calendar->getCurrentDate() << endl; - #ifdef XIOS_MEMTRACK_LIGHT - info(50) << " Current memory used by XIOS : "<< MemTrack::getCurrentMemorySize()*1.0/(1024*1024)<<" Mbyte, at timestep "<getId()<getCurrentDate()); - } - } - else if (prevStep == step) - info(50) << "updateCalendar: already at step " << step << ", no operation done." << endl; - else // if (prevStep > step) - ERROR("void CContext::updateCalendar(int step)", - << "Illegal calendar update: previous step was " << prevStep << ", new step " << step << "is in the past!") - } - CATCH_DUMP_ATTR - - void CContext::initReadFiles(void) - TRY - { - vector::const_iterator it; - - for (it=enabledReadModeFiles.begin(); it != enabledReadModeFiles.end(); it++) - { - (*it)->initRead(); - } - } - CATCH_DUMP_ATTR - - //! Server side: Create header of netcdf file - void CContext::createFileHeader(void) - TRY - { - vector::const_iterator it; - - //for (it=enabledFiles.begin(); it != enabledFiles.end(); it++) - for (it=enabledWriteModeFiles.begin(); it != enabledWriteModeFiles.end(); it++) - { - (*it)->initWrite(); - } - } - CATCH_DUMP_ATTR - - //! Get current context - CContext* CContext::getCurrent(void) - TRY - { - return CObjectFactory::GetObject(CObjectFactory::GetCurrentContextId()).get(); - } - CATCH - - /*! - \brief Set context with an id be the current context - \param [in] id identity of context to be set to current - */ - void CContext::setCurrent(const string& id) - TRY - { - CObjectFactory::SetCurrentContextId(id); - CGroupFactory::SetCurrentContextId(id); - } - CATCH - - /*! - \brief Create a context with specific id - \param [in] id identity of new context - \return pointer to the new context or already-existed one with identity id - */ - CContext* CContext::create(const StdString& id) - TRY - { - CContext::setCurrent(id); - - bool hasctxt = CContext::has(id); - CContext* context = CObjectFactory::CreateObject(id).get(); - getRoot(); - if (!hasctxt) CGroupFactory::AddChild(root, context->getShared()); - -#define DECLARE_NODE(Name_, name_) \ - C##Name_##Definition::create(C##Name_##Definition::GetDefName()); -#define DECLARE_NODE_PAR(Name_, name_) -#include "node_type.conf" - - return (context); - } - CATCH - - - void CContext::sendFinalizeClient(CContextClient* contextClient, const string& contextClientId) - TRY - { - CEventClient event(getType(),EVENT_ID_CONTEXT_FINALIZE_CLIENT); - if (contextClient->isServerLeader()) - { - CMessage msg; - msg<& ranks = contextClient->getRanksServerLeader(); - for (std::list::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) - event.push(*itRank,1,msg); - contextClient->sendEvent(event); - } - else contextClient->sendEvent(event); - } - CATCH_DUMP_ATTR - - - void CContext::recvFinalizeClient(CEventServer& event) - TRY - { - CBufferIn* buffer=event.subEvents.begin()->buffer; - string id; - *buffer>>id; - get(id)->recvFinalizeClient(*buffer); - } - CATCH - - void CContext::recvFinalizeClient(CBufferIn& buffer) - TRY - { - countChildContextFinalized_++ ; - } - CATCH_DUMP_ATTR - - - - - //! Client side: Send a message announcing that context can receive grid definition from coupling - void CContext::sendCouplerInReady(CContextClient* client) - TRY - { - if (sendCouplerInReady_done_.count(client)!=0) return ; - else sendCouplerInReady_done_.insert(client) ; - - CEventClient event(getType(),EVENT_ID_COUPLER_IN_READY); - - if (client->isServerLeader()) - { - CMessage msg; - msg<getId(); - for (auto& rank : client->getRanksServerLeader()) event.push(rank,1,msg); - client->sendEvent(event); - } - else client->sendEvent(event); - } - CATCH_DUMP_ATTR - - //! Server side: Receive a message announcing that context can send grid definition for context coupling - void CContext::recvCouplerInReady(CEventServer& event) - TRY - { - CBufferIn* buffer=event.subEvents.begin()->buffer; - getCurrent()->recvCouplerInReady(*buffer); - } - CATCH - - //! Server side: Receive a message announcing that context can send grid definition for context coupling - void CContext::recvCouplerInReady(CBufferIn& buffer) - TRY - { - string contextId ; - buffer>>contextId; - couplerInReady_.insert(getCouplerOutClient(contextId)) ; - } - CATCH_DUMP_ATTR - - - - - - //! Client side: Send a message announcing that a coupling context have done it closeDefinition, so data can be sent now. - void CContext::sendCouplerInCloseDefinition(CContextClient* client) - TRY - { - if (sendCouplerInCloseDefinition_done_.count(client)!=0) return ; - else sendCouplerInCloseDefinition_done_.insert(client) ; - - CEventClient event(getType(),EVENT_ID_COUPLER_IN_CLOSE_DEFINITION); - - if (client->isServerLeader()) - { - CMessage msg; - msg<getId(); - for (auto& rank : client->getRanksServerLeader()) event.push(rank,1,msg); - client->sendEvent(event); - } - else client->sendEvent(event); - } - CATCH_DUMP_ATTR - - //! Server side: Receive a message announcing that a coupling context have done it closeDefinition, so data can be sent now. - void CContext::recvCouplerInCloseDefinition(CEventServer& event) - TRY - { - CBufferIn* buffer=event.subEvents.begin()->buffer; - getCurrent()->recvCouplerInCloseDefinition(*buffer); - } - CATCH - - //! Server side: Receive a message announcing that a coupling context have done it closeDefinition, so data can be sent now. - void CContext::recvCouplerInCloseDefinition(CBufferIn& buffer) - TRY - { - string contextId ; - buffer>>contextId; - couplerInCloseDefinition_.insert(getCouplerOutClient(contextId)) ; - } - CATCH_DUMP_ATTR - - - - -//! Client side: Send a message announcing that a coupling context have done it contextFinalize, so it can also close it own context. - void CContext::sendCouplerInContextFinalized(CContextClient* client) - TRY - { - if (sendCouplerInContextFinalized_done_.count(client)!=0) return ; - else sendCouplerInContextFinalized_done_.insert(client) ; - - CEventClient event(getType(),EVENT_ID_COUPLER_IN_CONTEXT_FINALIZED); - - if (client->isServerLeader()) - { - CMessage msg; - msg<getId(); - for (auto& rank : client->getRanksServerLeader()) event.push(rank,1,msg); - client->sendEvent(event); - } - else client->sendEvent(event); - } - CATCH_DUMP_ATTR - - //! Server side: Receive a message announcing that a coupling context have done it contextFinalize, so it can also close it own context. - void CContext::recvCouplerInContextFinalized(CEventServer& event) - TRY - { - CBufferIn* buffer=event.subEvents.begin()->buffer; - getCurrent()->recvCouplerInContextFinalized(*buffer); - } - CATCH - - //! Server side: Receive a message announcing that a coupling context have done it contextFinalize, so it can also close it own context. - void CContext::recvCouplerInContextFinalized(CBufferIn& buffer) - TRY - { - string contextId ; - buffer>>contextId; - couplerInContextFinalized_.insert(getCouplerOutClient(contextId)) ; - } - CATCH_DUMP_ATTR - - - - - /*! - * \fn bool CContext::isFinalized(void) - * Context is finalized if it received context post finalize event. - */ - bool CContext::isFinalized(void) - TRY - { - return finalized; - } - CATCH_DUMP_ATTR - ///-------------------------------------------------------------- - StdString CContext::dumpClassAttributes(void) - { - StdString str; - str.append("enabled files=\""); - int size = this->enabledFiles.size(); - for (int i = 0; i < size; ++i) - { - str.append(enabledFiles[i]->getId()); - str.append(" "); - } - str.append("\""); - return str; - } - -} // namespace xios diff --git a/xios_2311_src/trunk/.svn/pristine/0c/0c4a28ac09a8afd7eacae367ddcad1276e66f70e.svn-base b/xios_2311_src/trunk/.svn/pristine/0c/0c4a28ac09a8afd7eacae367ddcad1276e66f70e.svn-base deleted file mode 100644 index cfdc501a78ae9d3e71294842f707dbdbe1bc1f3c..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/0c/0c4a28ac09a8afd7eacae367ddcad1276e66f70e.svn-base +++ /dev/null @@ -1,166 +0,0 @@ -/** \file -Attribute functions - -These functions read and write attributes. - -Copyright 2010 University Corporation for Atmospheric -Research/Unidata. See \ref copyright file for more info. */ - -#include "ncdispatch.h" - -/** \defgroup attributes Attributes - -Attributes hold metadata about data and files. - -\image html ncatts.png "Attributes store metadata." - -Attributes may be associated with a netCDF variable to specify such -properties as units, special values, maximum and minimum valid values, -scaling factors, and offsets. - -Attributes for a netCDF dataset are defined when the dataset is first -created, while the netCDF dataset is in define mode. Additional -attributes may be added later by reentering define mode. - -A netCDF attribute has a netCDF variable to which it is assigned, a -name, a type, a length, and a sequence of one or more values. - -An attribute is designated by its variable ID and name. When an -attribute name is not known, it may be designated by its variable ID -and number in order to determine its name, using the function -nc_inq_attname(). - -The attributes associated with a variable are typically defined -immediately after the variable is created, while still in define -mode. The data type, length, and value of an attribute may be changed -even when in data mode, as long as the changed attribute requires no -more space than the attribute as originally defined. - -It is also possible to have attributes that are not associated with -any variable. These are called global attributes and are identified by -using ::NC_GLOBAL as a variable pseudo-ID. Global attributes are usually -related to the netCDF dataset as a whole and may be used for purposes -such as providing a title or processing history for a netCDF dataset. - -Operations supported on attributes are: -- Create an attribute, given its variable ID, name, data type, length, - and value. -- Get attribute's data type and length from its variable ID and name. -- Get attribute's value from its variable ID and name. -- Copy attribute from one netCDF variable to another. -- Get name of attribute from its number. -- Rename an attribute. -- Delete an attribute. -*/ - -/*! \{*/ /* All these functions are part of the above defgroup... */ - - -/** \name Deleting and Renaming Attributes - -Functions to delete or rename an attribute. */ -/*! \{ */ /* All these functions are part of this named group... */ - -/*! -Rename an attribute. - -The function nc_rename_att() changes the name of an attribute. If the -new name is longer than the original name, the netCDF dataset must be -in define mode. You cannot rename an attribute to have the same name -as another attribute of the same variable. - -\param ncid NetCDF or group ID, from a previous call to nc_open(), -nc_create(), nc_def_grp(), or associated inquiry functions such as -nc_inq_ncid(). - -\param varid Variable ID of the attribute's variable, or ::NC_GLOBAL for -a global attribute. - -\param name Attribute \ref object_name. - -\param newname The new attribute \ref object_name. - -

Example

- -Here is an example using nc_rename_att() to rename the variable -attribute units to Units for a variable rh in an existing netCDF -dataset named foo.nc: - -\code - #include - ... - int status; - int ncid; - int rh_id; - ... - status = nc_open("foo.nc", NC_NOWRITE, &ncid); - if (status != NC_NOERR) handle_error(status); - ... - status = nc_inq_varid (ncid, "rh", &rh_id); - if (status != NC_NOERR) handle_error(status); - ... - status = nc_rename_att(ncid, rh_id, "units", "Units"); - if (status != NC_NOERR) handle_error(status); -\endcode - */ -int -nc_rename_att(int ncid, int varid, const char *name, const char *newname) -{ - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return ncp->dispatch->rename_att(ncid, varid, name, newname); -} - -/*! -Delete an attribute. - -The function nc_del_att() deletes a netCDF attribute from an open -netCDF dataset. The netCDF dataset must be in define mode. - -\param ncid NetCDF or group ID, from a previous call to nc_open(), -nc_create(), nc_def_grp(), or associated inquiry functions such as -nc_inq_ncid(). - -\param varid Variable ID of the attribute's variable, or ::NC_GLOBAL -for a global attribute. - -\param name Attribute name. - -

Example

- -Here is an example using nc_del_att() to delete the variable attribute -Units for a variable rh in an existing netCDF dataset named foo.nc: - -\code - #include - ... - int status; - int ncid; - int rh_id; - ... - status = nc_open("foo.nc", NC_WRITE, &ncid); - if (status != NC_NOERR) handle_error(status); - ... - status = nc_inq_varid (ncid, "rh", &rh_id); - if (status != NC_NOERR) handle_error(status); - ... - status = nc_redef(ncid); - if (status != NC_NOERR) handle_error(status); - status = nc_del_att(ncid, rh_id, "Units"); - if (status != NC_NOERR) handle_error(status); - status = nc_enddef(ncid); - if (status != NC_NOERR) handle_error(status); -\endcode - */ -int -nc_del_att(int ncid, int varid, const char *name) -{ - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return ncp->dispatch->del_att(ncid, varid, name); -} -/*! \} */ /* End of named group ...*/ - -/*! \} */ /* End of defgroup. */ diff --git a/xios_2311_src/trunk/.svn/pristine/0c/0c51b61367deb566298778b2248924c0b67f703d.svn-base b/xios_2311_src/trunk/.svn/pristine/0c/0c51b61367deb566298778b2248924c0b67f703d.svn-base deleted file mode 100644 index c34c84c328729be5d260013832254c77de768e18..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/0c/0c51b61367deb566298778b2248924c0b67f703d.svn-base +++ /dev/null @@ -1,106 +0,0 @@ -#include "transform_connector.hpp" -#include "element.hpp" -#include "scatterer_connector.hpp" -#include "gatherer_connector.hpp" -#include "client_client_dht_template.hpp" - - -namespace xios -{ - void CTransformConnector::computeConnector(void) - { - CClientClientDHTTemplate::Index2VectorInfoTypeMap info ; - - // first, insert destination global index into DHT - int rank ; - MPI_Comm_rank(localComm_, &rank) ; - CArray globalIndex ; - dstView_->getGlobalIndexView(globalIndex) ; - for(int i=0;i dataRanks(info, localComm_) ; - - // get global src index from src view. - set setGlobalIndex ; // all global index from src - srcView_->getGlobalIndexView(globalIndex) ; - for(int i=0;i srcGlobalIndex(setGlobalIndex.size()) ; - int i=0 ; - for(auto& globalIndex : setGlobalIndex) - { - srcGlobalIndex(i) = globalIndex ; - i++ ; - } - - dataRanks.computeIndexInfoMapping(srcGlobalIndex) ; - const auto& returnInfo = dataRanks.getInfoIndexMap() ; - - map> vectorIndex ; - for(auto& rankIndGlo : returnInfo) - { - size_t indGlo = rankIndGlo.first ; - auto& listRank = rankIndGlo.second ; - for (auto& rank : listRank) vectorIndex[rank].push_back(indGlo); - } - - // convert vectorIndex into array - map> dstArrayIndex ; - for(auto& rankIndGlo : vectorIndex) - { - int rank = rankIndGlo.first ; - auto& indexVector = rankIndGlo.second ; - auto& arrayIndex = dstArrayIndex[rank] ; - CArray arrayTmp(indexVector.data(), shape(indexVector.size()), duplicateData) ; - dstArrayIndex[rank].reference(arrayTmp) ; - } - - // distributed element : where to send data - auto dstElement = make_shared(srcView_->getGlobalSize(), dstArrayIndex) ; - dstElement->addFullView() ; - - // create scatterer connector - int commSize ; - MPI_Comm_size(localComm_, &commSize) ; - scattererConnector_ = make_shared(srcView_, dstElement->getView(CElementView::FULL), localComm_, commSize ) ; - scattererConnector_->computeConnector() ; - - // how much sender ? - vector nbSenders(commSize) ; - int nbSender ; - for(auto& it : dstArrayIndex) nbSenders[it.first]=1 ; - vector recvCounts(commSize,1) ; - MPI_Reduce_scatter(nbSenders.data(), &nbSender, recvCounts.data(), MPI_INT, MPI_SUM, localComm_) ; - - // transfer global index - map> remoteArrayIndex ; - - vector sendReq ; - for(auto& it : dstArrayIndex) - { - MPI_Request req ; - MPI_Isend(it.second.dataFirst(), it.second.numElements(), MPI_SIZE_T, it.first,0, localComm_,&req) ; - sendReq.push_back(req) ; - } - - for(int i=0; i recvBuff(size) ; - MPI_Recv(recvBuff.data(), size, MPI_SIZE_T, status.MPI_SOURCE,0,localComm_,&status) ; - CArray arrayTmp(recvBuff.data(), shape(recvBuff.size()), duplicateData) ; - remoteArrayIndex[status.MPI_SOURCE].reference(arrayTmp) ; - recvRankSize_[status.MPI_SOURCE] = size ; - } - vector sendStatus(sendReq.size()) ; - MPI_Waitall(sendReq.size(),sendReq.data(),sendStatus.data()) ; - - auto remoteElement = make_shared(dstView_->getGlobalSize(), remoteArrayIndex) ; - remoteElement->addFullView() ; - gathererConnector_= make_shared(remoteElement->getView(CElementView::FULL),dstView_) ; - gathererConnector_->computeConnector() ; - - } -} \ No newline at end of file diff --git a/xios_2311_src/trunk/.svn/pristine/0c/0c7d7d58b3b85f4643d98e4f1ed08acae4b55302.svn-base b/xios_2311_src/trunk/.svn/pristine/0c/0c7d7d58b3b85f4643d98e4f1ed08acae4b55302.svn-base deleted file mode 100644 index c5ba4b2211499d36ec74cf69cbfe18cbfc5c3fb3..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/0c/0c7d7d58b3b85f4643d98e4f1ed08acae4b55302.svn-base +++ /dev/null @@ -1,92 +0,0 @@ -/* ************************************************************************** * - * Interface auto generated - do not modify * - * ************************************************************************** */ - -#include -#include "xios.hpp" -#include "attribute_template.hpp" -#include "object_template.hpp" -#include "group_template.hpp" -#include "icutil.hpp" -#include "icdate.hpp" -#include "timer.hpp" -#include "node_type.hpp" - -extern "C" -{ - typedef xios::CReduceDomainToAxis* reduce_domain_to_axis_Ptr; - - void cxios_set_reduce_domain_to_axis_direction(reduce_domain_to_axis_Ptr reduce_domain_to_axis_hdl, const char * direction, int direction_size) - { - std::string direction_str; - if (!cstr2string(direction, direction_size, direction_str)) return; - CTimer::get("XIOS").resume(); - reduce_domain_to_axis_hdl->direction.fromString(direction_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_reduce_domain_to_axis_direction(reduce_domain_to_axis_Ptr reduce_domain_to_axis_hdl, char * direction, int direction_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(reduce_domain_to_axis_hdl->direction.getInheritedStringValue(), direction, direction_size)) - ERROR("void cxios_get_reduce_domain_to_axis_direction(reduce_domain_to_axis_Ptr reduce_domain_to_axis_hdl, char * direction, int direction_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_reduce_domain_to_axis_direction(reduce_domain_to_axis_Ptr reduce_domain_to_axis_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = reduce_domain_to_axis_hdl->direction.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_reduce_domain_to_axis_local(reduce_domain_to_axis_Ptr reduce_domain_to_axis_hdl, bool local) - { - CTimer::get("XIOS").resume(); - reduce_domain_to_axis_hdl->local.setValue(local); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_reduce_domain_to_axis_local(reduce_domain_to_axis_Ptr reduce_domain_to_axis_hdl, bool* local) - { - CTimer::get("XIOS").resume(); - *local = reduce_domain_to_axis_hdl->local.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_reduce_domain_to_axis_local(reduce_domain_to_axis_Ptr reduce_domain_to_axis_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = reduce_domain_to_axis_hdl->local.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_reduce_domain_to_axis_operation(reduce_domain_to_axis_Ptr reduce_domain_to_axis_hdl, const char * operation, int operation_size) - { - std::string operation_str; - if (!cstr2string(operation, operation_size, operation_str)) return; - CTimer::get("XIOS").resume(); - reduce_domain_to_axis_hdl->operation.fromString(operation_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_reduce_domain_to_axis_operation(reduce_domain_to_axis_Ptr reduce_domain_to_axis_hdl, char * operation, int operation_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(reduce_domain_to_axis_hdl->operation.getInheritedStringValue(), operation, operation_size)) - ERROR("void cxios_get_reduce_domain_to_axis_operation(reduce_domain_to_axis_Ptr reduce_domain_to_axis_hdl, char * operation, int operation_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_reduce_domain_to_axis_operation(reduce_domain_to_axis_Ptr reduce_domain_to_axis_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = reduce_domain_to_axis_hdl->operation.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } -} diff --git a/xios_2311_src/trunk/.svn/pristine/0c/0c992e6746676b0183d0c967ee5c80f335535ccb.svn-base b/xios_2311_src/trunk/.svn/pristine/0c/0c992e6746676b0183d0c967ee5c80f335535ccb.svn-base deleted file mode 100644 index 6a334bae984fbb4c728510dff226dc61eda6e94d..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/0c/0c992e6746676b0183d0c967ee5c80f335535ccb.svn-base +++ /dev/null @@ -1,799 +0,0 @@ -/* A portable stdint.h - **************************************************************************** - * BSD License: - **************************************************************************** - * - * Copyright (c) 2005-2007 Paul Hsieh - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - **************************************************************************** - * - * Version 0.1.11 - * - * The ANSI C standard committee, for the C99 standard, specified the - * inclusion of a new standard include file called stdint.h. This is - * a very useful and long desired include file which contains several - * very precise definitions for integer scalar types that is - * critically important for making portable several classes of - * applications including cryptography, hashing, variable length - * integer libraries and so on. But for most developers its likely - * useful just for programming sanity. - * - * The problem is that most compiler vendors have decided not to - * implement the C99 standard, and the next C++ language standard - * (which has a lot more mindshare these days) will be a long time in - * coming and its unknown whether or not it will include stdint.h or - * how much adoption it will have. Either way, it will be a long time - * before all compilers come with a stdint.h and it also does nothing - * for the extremely large number of compilers available today which - * do not include this file, or anything comparable to it. - * - * So that's what this file is all about. Its an attempt to build a - * single universal include file that works on as many platforms as - * possible to deliver what stdint.h is supposed to. A few things - * that should be noted about this file: - * - * 1) It is not guaranteed to be portable and/or present an identical - * interface on all platforms. The extreme variability of the - * ANSI C standard makes this an impossibility right from the - * very get go. Its really only meant to be useful for the vast - * majority of platforms that possess the capability of - * implementing usefully and precisely defined, standard sized - * integer scalars. Systems which are not intrinsically 2s - * complement may produce invalid constants. - * - * 2) There is an unavoidable use of non-reserved symbols. - * - * 3) Other standard include files are invoked. - * - * 4) This file may come in conflict with future platforms that do - * include stdint.h. The hope is that one or the other can be - * used with no real difference. - * - * 5) In the current verison, if your platform can't represent - * int32_t, int16_t and int8_t, it just dumps out with a compiler - * error. - * - * 6) 64 bit integers may or may not be defined. Test for their - * presence with the test: #ifdef INT64_MAX or #ifdef UINT64_MAX. - * Note that this is different from the C99 specification which - * requires the existence of 64 bit support in the compiler. If - * this is not defined for your platform, yet it is capable of - * dealing with 64 bits then it is because this file has not yet - * been extended to cover all of your system's capabilities. - * - * 7) (u)intptr_t may or may not be defined. Test for its presence - * with the test: #ifdef PTRDIFF_MAX. If this is not defined - * for your platform, then it is because this file has not yet - * been extended to cover all of your system's capabilities, not - * because its optional. - * - * 8) The following might not been defined even if your platform is - * capable of defining it: - * - * WCHAR_MIN - * WCHAR_MAX - * (u)int64_t - * PTRDIFF_MIN - * PTRDIFF_MAX - * (u)intptr_t - * - * 9) The following have not been defined: - * - * WINT_MIN - * WINT_MAX - * - * 10) The criteria for defining (u)int_least(*)_t isn't clear, - * except for systems which don't have a type that precisely - * defined 8, 16, or 32 bit types (which this include file does - * not support anyways). Default definitions have been given. - * - * 11) The criteria for defining (u)int_fast(*)_t isn't something I - * would trust to any particular compiler vendor or the ANSI C - * committee. It is well known that "compatible systems" are - * commonly created that have very different performance - * characteristics from the systems they are compatible with, - * especially those whose vendors make both the compiler and the - * system. Default definitions have been given, but its strongly - * recommended that users never use these definitions for any - * reason (they do *NOT* deliver any serious guarantee of - * improved performance -- not in this file, nor any vendor's - * stdint.h). - * - * 12) The following macros: - * - * PRINTF_INTMAX_MODIFIER - * PRINTF_INT64_MODIFIER - * PRINTF_INT32_MODIFIER - * PRINTF_INT16_MODIFIER - * PRINTF_LEAST64_MODIFIER - * PRINTF_LEAST32_MODIFIER - * PRINTF_LEAST16_MODIFIER - * PRINTF_INTPTR_MODIFIER - * - * are strings which have been defined as the modifiers required - * for the "d", "u" and "x" printf formats to correctly output - * (u)intmax_t, (u)int64_t, (u)int32_t, (u)int16_t, (u)least64_t, - * (u)least32_t, (u)least16_t and (u)intptr_t types respectively. - * PRINTF_INTPTR_MODIFIER is not defined for some systems which - * provide their own stdint.h. PRINTF_INT64_MODIFIER is not - * defined if INT64_MAX is not defined. These are an extension - * beyond what C99 specifies must be in stdint.h. - * - * In addition, the following macros are defined: - * - * PRINTF_INTMAX_HEX_WIDTH - * PRINTF_INT64_HEX_WIDTH - * PRINTF_INT32_HEX_WIDTH - * PRINTF_INT16_HEX_WIDTH - * PRINTF_INT8_HEX_WIDTH - * PRINTF_INTMAX_DEC_WIDTH - * PRINTF_INT64_DEC_WIDTH - * PRINTF_INT32_DEC_WIDTH - * PRINTF_INT16_DEC_WIDTH - * PRINTF_INT8_DEC_WIDTH - * - * Which specifies the maximum number of characters required to - * print the number of that type in either hexadecimal or decimal. - * These are an extension beyond what C99 specifies must be in - * stdint.h. - * - * Compilers tested (all with 0 warnings at their highest respective - * settings): Borland Turbo C 2.0, WATCOM C/C++ 11.0 (16 bits and 32 - * bits), Microsoft Visual C++ 6.0 (32 bit), Microsoft Visual Studio - * .net (VC7), Intel C++ 4.0, GNU gcc v3.3.3 - * - * This file should be considered a work in progress. Suggestions for - * improvements, especially those which increase coverage are strongly - * encouraged. - * - * Acknowledgements - * - * The following people have made significant contributions to the - * development and testing of this file: - * - * Chris Howie - * John Steele Scott - * Dave Thorup - * - */ - -#include -#include -#include - -/* - * For gcc with _STDINT_H, fill in the PRINTF_INT*_MODIFIER macros, and - * do nothing else. On the Mac OS X version of gcc this is _STDINT_H_. - */ - -#if ((defined(__STDC__) && __STDC__ && __STDC_VERSION__ >= 199901L) || (defined (__WATCOMC__) && (defined (_STDINT_H_INCLUDED) || __WATCOMC__ >= 1250)) || (defined(__GNUC__) && (defined(_STDINT_H) || defined(_STDINT_H_)) )) && !defined (_PSTDINT_H_INCLUDED) -#include -#define _PSTDINT_H_INCLUDED -# ifndef PRINTF_INT64_MODIFIER -# define PRINTF_INT64_MODIFIER "ll" -# endif -# ifndef PRINTF_INT32_MODIFIER -# define PRINTF_INT32_MODIFIER "l" -# endif -# ifndef PRINTF_INT16_MODIFIER -# define PRINTF_INT16_MODIFIER "h" -# endif -# ifndef PRINTF_INTMAX_MODIFIER -# define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER -# endif -# ifndef PRINTF_INT64_HEX_WIDTH -# define PRINTF_INT64_HEX_WIDTH "16" -# endif -# ifndef PRINTF_INT32_HEX_WIDTH -# define PRINTF_INT32_HEX_WIDTH "8" -# endif -# ifndef PRINTF_INT16_HEX_WIDTH -# define PRINTF_INT16_HEX_WIDTH "4" -# endif -# ifndef PRINTF_INT8_HEX_WIDTH -# define PRINTF_INT8_HEX_WIDTH "2" -# endif -# ifndef PRINTF_INT64_DEC_WIDTH -# define PRINTF_INT64_DEC_WIDTH "20" -# endif -# ifndef PRINTF_INT32_DEC_WIDTH -# define PRINTF_INT32_DEC_WIDTH "10" -# endif -# ifndef PRINTF_INT16_DEC_WIDTH -# define PRINTF_INT16_DEC_WIDTH "5" -# endif -# ifndef PRINTF_INT8_DEC_WIDTH -# define PRINTF_INT8_DEC_WIDTH "3" -# endif -# ifndef PRINTF_INTMAX_HEX_WIDTH -# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH -# endif -# ifndef PRINTF_INTMAX_DEC_WIDTH -# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH -# endif - -/* - * Something really weird is going on with Open Watcom. Just pull some of - * these duplicated definitions from Open Watcom's stdint.h file for now. - */ - -# if defined (__WATCOMC__) && __WATCOMC__ >= 1250 -# if !defined (INT64_C) -# define INT64_C(x) (x + (INT64_MAX - INT64_MAX)) -# endif -# if !defined (UINT64_C) -# define UINT64_C(x) (x + (UINT64_MAX - UINT64_MAX)) -# endif -# if !defined (INT32_C) -# define INT32_C(x) (x + (INT32_MAX - INT32_MAX)) -# endif -# if !defined (UINT32_C) -# define UINT32_C(x) (x + (UINT32_MAX - UINT32_MAX)) -# endif -# if !defined (INT16_C) -# define INT16_C(x) (x) -# endif -# if !defined (UINT16_C) -# define UINT16_C(x) (x) -# endif -# if !defined (INT8_C) -# define INT8_C(x) (x) -# endif -# if !defined (UINT8_C) -# define UINT8_C(x) (x) -# endif -# if !defined (UINT64_MAX) -# define UINT64_MAX 18446744073709551615ULL -# endif -# if !defined (INT64_MAX) -# define INT64_MAX 9223372036854775807LL -# endif -# if !defined (UINT32_MAX) -# define UINT32_MAX 4294967295UL -# endif -# if !defined (INT32_MAX) -# define INT32_MAX 2147483647L -# endif -# if !defined (INTMAX_MAX) -# define INTMAX_MAX INT64_MAX -# endif -# if !defined (INTMAX_MIN) -# define INTMAX_MIN INT64_MIN -# endif -# endif -#endif - -#ifndef _PSTDINT_H_INCLUDED -#define _PSTDINT_H_INCLUDED - -#ifndef SIZE_MAX -# define SIZE_MAX (~(size_t)0) -#endif - -/* - * Deduce the type assignments from limits.h under the assumption that - * integer sizes in bits are powers of 2, and follow the ANSI - * definitions. - */ - -#ifndef UINT8_MAX -# define UINT8_MAX 0xff -#endif -#ifndef uint8_t -# if (UCHAR_MAX == UINT8_MAX) || defined (S_SPLINT_S) - typedef unsigned char uint8_t; -# define UINT8_C(v) ((uint8_t) v) -# else -# error "Platform not supported" -# endif -#endif - -#ifndef INT8_MAX -# define INT8_MAX 0x7f -#endif -#ifndef INT8_MIN -# define INT8_MIN INT8_C(0x80) -#endif -#ifndef int8_t -# if (SCHAR_MAX == INT8_MAX) || defined (S_SPLINT_S) - typedef signed char int8_t; -# define INT8_C(v) ((int8_t) v) -# else -# error "Platform not supported" -# endif -#endif - -#ifndef UINT16_MAX -# define UINT16_MAX 0xffff -#endif -#ifndef uint16_t -#if (UINT_MAX == UINT16_MAX) || defined (S_SPLINT_S) - typedef unsigned int uint16_t; -# ifndef PRINTF_INT16_MODIFIER -# define PRINTF_INT16_MODIFIER "" -# endif -# define UINT16_C(v) ((uint16_t) (v)) -#elif (USHRT_MAX == UINT16_MAX) - typedef unsigned short uint16_t; -# define UINT16_C(v) ((uint16_t) (v)) -# ifndef PRINTF_INT16_MODIFIER -# define PRINTF_INT16_MODIFIER "h" -# endif -#else -#error "Platform not supported" -#endif -#endif - -#ifndef INT16_MAX -# define INT16_MAX 0x7fff -#endif -#ifndef INT16_MIN -# define INT16_MIN INT16_C(0x8000) -#endif -#ifndef int16_t -#if (INT_MAX == INT16_MAX) || defined (S_SPLINT_S) - typedef signed int int16_t; -# define INT16_C(v) ((int16_t) (v)) -# ifndef PRINTF_INT16_MODIFIER -# define PRINTF_INT16_MODIFIER "" -# endif -#elif (SHRT_MAX == INT16_MAX) - typedef signed short int16_t; -# define INT16_C(v) ((int16_t) (v)) -# ifndef PRINTF_INT16_MODIFIER -# define PRINTF_INT16_MODIFIER "h" -# endif -#else -#error "Platform not supported" -#endif -#endif - -#ifndef UINT32_MAX -# define UINT32_MAX (0xffffffffUL) -#endif -#ifndef uint32_t -#if (ULONG_MAX == UINT32_MAX) || defined (S_SPLINT_S) - typedef unsigned long uint32_t; -# define UINT32_C(v) v ## UL -# ifndef PRINTF_INT32_MODIFIER -# define PRINTF_INT32_MODIFIER "l" -# endif -#elif (UINT_MAX == UINT32_MAX) - typedef unsigned int uint32_t; -# ifndef PRINTF_INT32_MODIFIER -# define PRINTF_INT32_MODIFIER "" -# endif -# define UINT32_C(v) v ## U -#elif (USHRT_MAX == UINT32_MAX) - typedef unsigned short uint32_t; -# define UINT32_C(v) ((unsigned short) (v)) -# ifndef PRINTF_INT32_MODIFIER -# define PRINTF_INT32_MODIFIER "" -# endif -#else -#error "Platform not supported" -#endif -#endif - -#ifndef INT32_MAX -# define INT32_MAX (0x7fffffffL) -#endif -#ifndef INT32_MIN -# define INT32_MIN INT32_C(0x80000000) -#endif -#ifndef int32_t -#if (LONG_MAX == INT32_MAX) || defined (S_SPLINT_S) - typedef signed long int32_t; -# define INT32_C(v) v ## L -# ifndef PRINTF_INT32_MODIFIER -# define PRINTF_INT32_MODIFIER "l" -# endif -#elif (INT_MAX == INT32_MAX) - typedef signed int int32_t; -# define INT32_C(v) v -# ifndef PRINTF_INT32_MODIFIER -# define PRINTF_INT32_MODIFIER "" -# endif -#elif (SHRT_MAX == INT32_MAX) - typedef signed short int32_t; -# define INT32_C(v) ((short) (v)) -# ifndef PRINTF_INT32_MODIFIER -# define PRINTF_INT32_MODIFIER "" -# endif -#else -#error "Platform not supported" -#endif -#endif - -/* - * The macro stdint_int64_defined is temporarily used to record - * whether or not 64 integer support is available. It must be - * defined for any 64 integer extensions for new platforms that are - * added. - */ - -#undef stdint_int64_defined -#if (defined(__STDC__) && defined(__STDC_VERSION__)) || defined (S_SPLINT_S) -# if (__STDC__ && __STDC_VERSION >= 199901L) || defined (S_SPLINT_S) -# define stdint_int64_defined - typedef long long int64_t; - typedef unsigned long long uint64_t; -# define UINT64_C(v) v ## ULL -# define INT64_C(v) v ## LL -# ifndef PRINTF_INT64_MODIFIER -# define PRINTF_INT64_MODIFIER "ll" -# endif -# endif -#endif - -#if !defined (stdint_int64_defined) -# if defined(__GNUC__) -# define stdint_int64_defined - __extension__ typedef long long int64_t; - __extension__ typedef unsigned long long uint64_t; -# define UINT64_C(v) v ## ULL -# define INT64_C(v) v ## LL -# ifndef PRINTF_INT64_MODIFIER -# define PRINTF_INT64_MODIFIER "ll" -# endif -# elif defined(__MWERKS__) || defined (__SUNPRO_C) || defined (__SUNPRO_CC) || defined (__APPLE_CC__) || defined (_LONG_LONG) || defined (_CRAYC) || defined (S_SPLINT_S) -# define stdint_int64_defined - typedef long long int64_t; - typedef unsigned long long uint64_t; -# define UINT64_C(v) v ## ULL -# define INT64_C(v) v ## LL -# ifndef PRINTF_INT64_MODIFIER -# define PRINTF_INT64_MODIFIER "ll" -# endif -# elif (defined(__WATCOMC__) && defined(__WATCOM_INT64__)) || (defined(_MSC_VER) && _INTEGRAL_MAX_BITS >= 64) || (defined (__BORLANDC__) && __BORLANDC__ > 0x460) || defined (__alpha) || defined (__DECC) -# define stdint_int64_defined - typedef __int64 int64_t; - typedef unsigned __int64 uint64_t; -# define UINT64_C(v) v ## UI64 -# define INT64_C(v) v ## I64 -# ifndef PRINTF_INT64_MODIFIER -# define PRINTF_INT64_MODIFIER "I64" -# endif -# endif -#endif - -#if !defined (LONG_LONG_MAX) && defined (INT64_C) -# define LONG_LONG_MAX INT64_C (9223372036854775807) -#endif -#ifndef ULONG_LONG_MAX -# define ULONG_LONG_MAX UINT64_C (18446744073709551615) -#endif - -#if !defined (INT64_MAX) && defined (INT64_C) -# define INT64_MAX INT64_C (9223372036854775807) -#endif -#if !defined (INT64_MIN) && defined (INT64_C) -# define INT64_MIN INT64_C (-9223372036854775808) -#endif -#if !defined (UINT64_MAX) && defined (INT64_C) -# define UINT64_MAX UINT64_C (18446744073709551615) -#endif - -/* - * Width of hexadecimal for number field. - */ - -#ifndef PRINTF_INT64_HEX_WIDTH -# define PRINTF_INT64_HEX_WIDTH "16" -#endif -#ifndef PRINTF_INT32_HEX_WIDTH -# define PRINTF_INT32_HEX_WIDTH "8" -#endif -#ifndef PRINTF_INT16_HEX_WIDTH -# define PRINTF_INT16_HEX_WIDTH "4" -#endif -#ifndef PRINTF_INT8_HEX_WIDTH -# define PRINTF_INT8_HEX_WIDTH "2" -#endif - -#ifndef PRINTF_INT64_DEC_WIDTH -# define PRINTF_INT64_DEC_WIDTH "20" -#endif -#ifndef PRINTF_INT32_DEC_WIDTH -# define PRINTF_INT32_DEC_WIDTH "10" -#endif -#ifndef PRINTF_INT16_DEC_WIDTH -# define PRINTF_INT16_DEC_WIDTH "5" -#endif -#ifndef PRINTF_INT8_DEC_WIDTH -# define PRINTF_INT8_DEC_WIDTH "3" -#endif - -/* - * Ok, lets not worry about 128 bit integers for now. Moore's law says - * we don't need to worry about that until about 2040 at which point - * we'll have bigger things to worry about. - */ - -#ifdef stdint_int64_defined - typedef int64_t intmax_t; - typedef uint64_t uintmax_t; -# define INTMAX_MAX INT64_MAX -# define INTMAX_MIN INT64_MIN -# define UINTMAX_MAX UINT64_MAX -# define UINTMAX_C(v) UINT64_C(v) -# define INTMAX_C(v) INT64_C(v) -# ifndef PRINTF_INTMAX_MODIFIER -# define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER -# endif -# ifndef PRINTF_INTMAX_HEX_WIDTH -# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH -# endif -# ifndef PRINTF_INTMAX_DEC_WIDTH -# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH -# endif -#else - typedef int32_t intmax_t; - typedef uint32_t uintmax_t; -# define INTMAX_MAX INT32_MAX -# define UINTMAX_MAX UINT32_MAX -# define UINTMAX_C(v) UINT32_C(v) -# define INTMAX_C(v) INT32_C(v) -# ifndef PRINTF_INTMAX_MODIFIER -# define PRINTF_INTMAX_MODIFIER PRINTF_INT32_MODIFIER -# endif -# ifndef PRINTF_INTMAX_HEX_WIDTH -# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT32_HEX_WIDTH -# endif -# ifndef PRINTF_INTMAX_DEC_WIDTH -# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT32_DEC_WIDTH -# endif -#endif - -/* - * Because this file currently only supports platforms which have - * precise powers of 2 as bit sizes for the default integers, the - * least definitions are all trivial. Its possible that a future - * version of this file could have different definitions. - */ - -#ifndef stdint_least_defined - typedef int8_t int_least8_t; - typedef uint8_t uint_least8_t; - typedef int16_t int_least16_t; - typedef uint16_t uint_least16_t; - typedef int32_t int_least32_t; - typedef uint32_t uint_least32_t; -# define PRINTF_LEAST32_MODIFIER PRINTF_INT32_MODIFIER -# define PRINTF_LEAST16_MODIFIER PRINTF_INT16_MODIFIER -# define UINT_LEAST8_MAX UINT8_MAX -# define INT_LEAST8_MAX INT8_MAX -# define UINT_LEAST16_MAX UINT16_MAX -# define INT_LEAST16_MAX INT16_MAX -# define UINT_LEAST32_MAX UINT32_MAX -# define INT_LEAST32_MAX INT32_MAX -# define INT_LEAST8_MIN INT8_MIN -# define INT_LEAST16_MIN INT16_MIN -# define INT_LEAST32_MIN INT32_MIN -# ifdef stdint_int64_defined - typedef int64_t int_least64_t; - typedef uint64_t uint_least64_t; -# define PRINTF_LEAST64_MODIFIER PRINTF_INT64_MODIFIER -# define UINT_LEAST64_MAX UINT64_MAX -# define INT_LEAST64_MAX INT64_MAX -# define INT_LEAST64_MIN INT64_MIN -# endif -#endif -#undef stdint_least_defined - -/* - * The ANSI C committee pretending to know or specify anything about - * performance is the epitome of misguided arrogance. The mandate of - * this file is to *ONLY* ever support that absolute minimum - * definition of the fast integer types, for compatibility purposes. - * No extensions, and no attempt to suggest what may or may not be a - * faster integer type will ever be made in this file. Developers are - * warned to stay away from these types when using this or any other - * stdint.h. - */ - -typedef int_least8_t int_fast8_t; -typedef uint_least8_t uint_fast8_t; -typedef int_least16_t int_fast16_t; -typedef uint_least16_t uint_fast16_t; -typedef int_least32_t int_fast32_t; -typedef uint_least32_t uint_fast32_t; -#define UINT_FAST8_MAX UINT_LEAST8_MAX -#define INT_FAST8_MAX INT_LEAST8_MAX -#define UINT_FAST16_MAX UINT_LEAST16_MAX -#define INT_FAST16_MAX INT_LEAST16_MAX -#define UINT_FAST32_MAX UINT_LEAST32_MAX -#define INT_FAST32_MAX INT_LEAST32_MAX -#define INT_FAST8_MIN INT_LEAST8_MIN -#define INT_FAST16_MIN INT_LEAST16_MIN -#define INT_FAST32_MIN INT_LEAST32_MIN -#ifdef stdint_int64_defined - typedef int_least64_t int_fast64_t; - typedef uint_least64_t uint_fast64_t; -# define UINT_FAST64_MAX UINT_LEAST64_MAX -# define INT_FAST64_MAX INT_LEAST64_MAX -# define INT_FAST64_MIN INT_LEAST64_MIN -#endif - -#undef stdint_int64_defined - -/* - * Whatever piecemeal, per compiler thing we can do about the wchar_t - * type limits. - */ - -#if defined(__WATCOMC__) || defined(_MSC_VER) || defined (__GNUC__) -# include -# ifndef WCHAR_MIN -# define WCHAR_MIN 0 -# endif -# ifndef WCHAR_MAX -# define WCHAR_MAX ((wchar_t)-1) -# endif -#endif - -/* - * Whatever piecemeal, per compiler/platform thing we can do about the - * (u)intptr_t types and limits. - */ - -#if defined (_MSC_VER) && defined (_UINTPTR_T_DEFINED) -# define STDINT_H_UINTPTR_T_DEFINED -#endif - -#ifndef STDINT_H_UINTPTR_T_DEFINED -# if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (_WIN64) -# define stdint_intptr_bits 64 -# elif defined (__WATCOMC__) || defined (__TURBOC__) -# if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__) -# define stdint_intptr_bits 16 -# else -# define stdint_intptr_bits 32 -# endif -# elif defined (__i386__) || defined (_WIN32) || defined (WIN32) -# define stdint_intptr_bits 32 -# elif defined (__INTEL_COMPILER) -/* TODO -- what will Intel do about x86-64? */ -# endif - -# ifdef stdint_intptr_bits -# define stdint_intptr_glue3_i(a,b,c) a##b##c -# define stdint_intptr_glue3(a,b,c) stdint_intptr_glue3_i(a,b,c) -# ifndef PRINTF_INTPTR_MODIFIER -# define PRINTF_INTPTR_MODIFIER stdint_intptr_glue3(PRINTF_INT,stdint_intptr_bits,_MODIFIER) -# endif -# ifndef PTRDIFF_MAX -# define PTRDIFF_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX) -# endif -# ifndef PTRDIFF_MIN -# define PTRDIFF_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN) -# endif -# ifndef UINTPTR_MAX -# define UINTPTR_MAX stdint_intptr_glue3(UINT,stdint_intptr_bits,_MAX) -# endif -# ifndef INTPTR_MAX -# define INTPTR_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX) -# endif -# ifndef INTPTR_MIN -# define INTPTR_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN) -# endif -# ifndef INTPTR_C -# define INTPTR_C(x) stdint_intptr_glue3(INT,stdint_intptr_bits,_C)(x) -# endif -# ifndef UINTPTR_C -# define UINTPTR_C(x) stdint_intptr_glue3(UINT,stdint_intptr_bits,_C)(x) -# endif - typedef stdint_intptr_glue3(uint,stdint_intptr_bits,_t) uintptr_t; - typedef stdint_intptr_glue3( int,stdint_intptr_bits,_t) intptr_t; -# else -/* TODO -- This following is likely wrong for some platforms, and does - nothing for the definition of uintptr_t. */ - typedef ptrdiff_t intptr_t; -# endif -# define STDINT_H_UINTPTR_T_DEFINED -#endif - -/* - * Assumes sig_atomic_t is signed and we have a 2s complement machine. - */ - -#ifndef SIG_ATOMIC_MAX -# define SIG_ATOMIC_MAX ((((sig_atomic_t) 1) << (sizeof (sig_atomic_t)*CHAR_BIT-1)) - 1) -#endif - -#endif - -#if defined (__TEST_PSTDINT_FOR_CORRECTNESS) - -/* - * Please compile with the maximum warning settings to make sure macros are not - * defined more than once. - */ - -#include -#include -#include - -#define glue3_aux(x,y,z) x ## y ## z -#define glue3(x,y,z) glue3_aux(x,y,z) - -#define DECLU(bits) glue3(uint,bits,_t) glue3(u,bits,=) glue3(UINT,bits,_C) (0); -#define DECLI(bits) glue3(int,bits,_t) glue3(i,bits,=) glue3(INT,bits,_C) (0); - -#define DECL(us,bits) glue3(DECL,us,) (bits) - -#define TESTUMAX(bits) glue3(u,bits,=) glue3(~,u,bits); if (glue3(UINT,bits,_MAX) glue3(!=,u,bits)) printf ("Something wrong with UINT%d_MAX\n", bits) - -int main () { - DECL(I,8) - DECL(U,8) - DECL(I,16) - DECL(U,16) - DECL(I,32) - DECL(U,32) -#ifdef INT64_MAX - DECL(I,64) - DECL(U,64) -#endif - intmax_t imax = INTMAX_C(0); - uintmax_t umax = UINTMAX_C(0); - char str0[256], str1[256]; - - sprintf (str0, "%d %x\n", 0, ~0); - - sprintf (str1, "%d %x\n", i8, ~0); - if (0 != strcmp (str0, str1)) printf ("Something wrong with i8 : %s\n", str1); - sprintf (str1, "%u %x\n", u8, ~0); - if (0 != strcmp (str0, str1)) printf ("Something wrong with u8 : %s\n", str1); - sprintf (str1, "%d %x\n", i16, ~0); - if (0 != strcmp (str0, str1)) printf ("Something wrong with i16 : %s\n", str1); - sprintf (str1, "%u %x\n", u16, ~0); - if (0 != strcmp (str0, str1)) printf ("Something wrong with u16 : %s\n", str1); - sprintf (str1, "%" PRINTF_INT32_MODIFIER "d %x\n", i32, ~0); - if (0 != strcmp (str0, str1)) printf ("Something wrong with i32 : %s\n", str1); - sprintf (str1, "%" PRINTF_INT32_MODIFIER "u %x\n", u32, ~0); - if (0 != strcmp (str0, str1)) printf ("Something wrong with u32 : %s\n", str1); -#ifdef INT64_MAX - sprintf (str1, "%" PRINTF_INT64_MODIFIER "d %x\n", i64, ~0); - if (0 != strcmp (str0, str1)) printf ("Something wrong with i64 : %s\n", str1); -#endif - sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "d %x\n", imax, ~0); - if (0 != strcmp (str0, str1)) printf ("Something wrong with imax : %s\n", str1); - sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "u %x\n", umax, ~0); - if (0 != strcmp (str0, str1)) printf ("Something wrong with umax : %s\n", str1); - - TESTUMAX(8); - TESTUMAX(16); - TESTUMAX(32); -#ifdef INT64_MAX - TESTUMAX(64); -#endif - - return EXIT_SUCCESS; -} - -#endif diff --git a/xios_2311_src/trunk/.svn/pristine/0d/0d364f894cfdda4f40ec60aa9aa8575015f7bf5e.svn-base b/xios_2311_src/trunk/.svn/pristine/0d/0d364f894cfdda4f40ec60aa9aa8575015f7bf5e.svn-base deleted file mode 100644 index 1a97bc9e5b07d922239d731d50b23934e1025949..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/0d/0d364f894cfdda4f40ec60aa9aa8575015f7bf5e.svn-base +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef __XIOS_MEMORY_HPP__ -#define __XIOS_MEMORY_HPP__ - -namespace xios -{ - void noMemory(void) ; - - -} - -#endif diff --git a/xios_2311_src/trunk/.svn/pristine/0d/0db62b41428f8463d53c257e34a5e0c6832421c4.svn-base b/xios_2311_src/trunk/.svn/pristine/0d/0db62b41428f8463d53c257e34a5e0c6832421c4.svn-base deleted file mode 100644 index 231f366fa847b0d27b62bef302ce00114549daae..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/0d/0db62b41428f8463d53c257e34a5e0c6832421c4.svn-base +++ /dev/null @@ -1,23 +0,0 @@ -NETCDF_INCDIR="-I $NETCDF_INCDIR" -NETCDF_LIBDIR="-L $NETCDF_LIBDIR" -NETCDF_LIB="-lnetcdf" - -MPI_INCDIR="" -MPI_LIBDIR="" -MPI_LIB="" - -HDF5_INCDIR="" -HDF5_LIBDIR="" -HDF5_LIB="" - -BOOST_INCDIR="-I $BOOST_INCDIR" -BOOST_LIBDIR="-L $BOOST_LIBDIR" -BOOST_LIB="" - -BLITZ_INCDIR="-I $BLITZ_INCDIR" -BLITZ_LIBDIR="-L $BLITZ_LIBDIR" -BLITZ_LIB="" - -OASIS_INCDIR="-I$PWD/../../oasis3-mct/BLD/build/lib/psmile.MPI1" -OASIS_LIBDIR="-L$PWD/../../oasis3-mct/BLD/lib" -OASIS_LIB="-lpsmile.MPI1 -lscrip -lmct -lmpeu" diff --git a/xios_2311_src/trunk/.svn/pristine/0e/0e349060a206ee5fb7c8bb3e20129408caea47a0.svn-base b/xios_2311_src/trunk/.svn/pristine/0e/0e349060a206ee5fb7c8bb3e20129408caea47a0.svn-base deleted file mode 100644 index 8ecebb61e6ccf425373b60917acc47b3b17db817..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/0e/0e349060a206ee5fb7c8bb3e20129408caea47a0.svn-base +++ /dev/null @@ -1,511 +0,0 @@ -#LyX 2.1 created this file. For more info see http://www.lyx.org/ -\lyxformat 474 -\begin_document -\begin_header -\textclass book -\use_default_options true -\master ../../XIOS_user_guide.lyx -\maintain_unincluded_children false -\language english -\language_package default -\inputencoding auto -\fontencoding global -\font_roman default -\font_sans default -\font_typewriter default -\font_math auto -\font_default_family default -\use_non_tex_fonts false -\font_sc false -\font_osf false -\font_sf_scale 100 -\font_tt_scale 100 -\graphics default -\default_output_format default -\output_sync 0 -\bibtex_command default -\index_command default -\float_placement !tph -\paperfontsize default -\spacing single -\use_hyperref false -\papersize a4paper -\use_geometry false -\use_package amsmath 1 -\use_package amssymb 1 -\use_package cancel 1 -\use_package esint 1 -\use_package mathdots 1 -\use_package mathtools 1 -\use_package mhchem 1 -\use_package stackrel 1 -\use_package stmaryrd 1 -\use_package undertilde 1 -\cite_engine basic -\cite_engine_type default -\biblio_style plain -\use_bibtopic false -\use_indices false -\paperorientation portrait -\suppress_date false -\justification true -\use_refstyle 1 -\index Index -\shortcut idx -\color #008000 -\end_index -\secnumdepth 3 -\tocdepth 3 -\paragraph_separation indent -\paragraph_indentation default -\quotes_language english -\papercolumns 1 -\papersides 1 -\paperpagestyle default -\tracking_changes false -\output_changes false -\html_math_output 0 -\html_css_as_file 0 -\html_be_strict false -\end_header - -\begin_body - -\begin_layout Chapter -Grid -\end_layout - -\begin_layout Section -Overview -\end_layout - -\begin_layout Standard -Grid plays an important role in XIOS. - Same as Field, Grid is one of the basic elements in XIOS, which should - be well defined, not only in the configuration file but also in the FORTRAN - code. - Because, until now, XIOS has mainly served for writing NetCDF data format, - most of its components are inspired from NetCDF Data Model, and Grid is - not an exception. - Grid is a concept describing dimensions that contain the axes of the data - arrays. - Moreover, Grid always consists of an unlimited dimension whose length can - be expanded at any time. - Other dimensions can be described with Domain and Axis. - The followings describe how to make use of Grid in XIOS. - Details of its attributes and operations can be found in XIOS reference - guide. -\end_layout - -\begin_layout Section -Working with configuration file -\end_layout - -\begin_layout Standard -As mentioned above, a grid contains the axes of the data arrays, which are - characterized by Domain and/or Axis. - A domain is composed of a 2-dimension array, meanwhile an axis is, as its - name, an 1-dimension array. - -\end_layout - -\begin_layout Standard -Like other components of XIOS, a grid is defined inside its definition part - with the tag -\series bold -\color black -grid_definition -\series default -\color inherit - -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status collapsed - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -As XIOS supports netCDF-4/HDF5, it allows user to gather several grids into - groups to better organize data. - Very often, grids are grouped, basing on the dimensions that they describe. - However, there is not a limit for user to group out the grids. - The more important thing than grid_group is grid. - A grid is defined with the tag -\series bold -\color black -grid. - -\end_layout - -\begin_layout Standard -While it is not crucial for a grid group not to have an identification specified - by attribute id, a grid must be assigned an id to become useful. - Unlike grid group is a way of hierarchically organizing related grid only, - a grid itself is referenced by fields with its id. - Without the id, a grid can not be made used of by a field. - Id is a string of anything but there is one thing to remember: id of a - grid as well as id of any component in XIOS are -\shape italic -\color black -unique -\shape default -\color inherit - among this kind of components. - It is not allowed to have two grids with a same id, but it is permitted - a grid and, for example, a domain to share a same one. - -\end_layout - -\begin_layout Standard -A grid is defined by domain(s) and axis. - A domain represents two-dimension data while an axis serves as one-dimension - data. - They are defined inside the grid definition. - One of the convenient and effective way to reuse the definitions in XIOS - is to take advantage of attribute *_ref. - On using *_ref, the referencing component has all attributes from its reference -d one. - As the example below, grid with id -\begin_inset Quotes eld -\end_inset - -grid_A -\begin_inset Quotes erd -\end_inset - - (from now one, called grid_A), is composed of one domain whose attributes - derived directly from another one-domain_A, and one axis whose attributes - are taken from axis axis_C, which are defined previously. -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -The *_ref can only used to reference to a already defined element (e.g domain, - axis, grid, etc). - If these *_ref have not been defined yet, there will be a runtime error. -\end_layout - -\begin_layout Standard -Details about domain and axis can be found in other sections but there is - one thing to bear in mind: A domain represents two-dimension data and it - also contains several special information: longitude, latitude, bound, - etc. - For the meteorological mind, domain indicates a surface with latitude and - longitude, whereas axis represents a vertical level. - -\end_layout - -\begin_layout Standard -In general cases, there is only a need of writing some multidimensional - data to a netCDF without any specific information, then comes the following - definition of grid. -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -The grid_All_Axis is similar to grid_A, but with three dimensions defined - by 3 axis that can be described in any way on demand of user. - For example, the axis_A and the axis_B can have corresponding name latitude - and longitude to characterize a two-dimension surface with latitude and - longitude. -\end_layout - -\begin_layout Standard -Very often, one dimensional data needs writing to netCDF, it can be easily - done with the following XML code -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -As it is discussed more details in the next section, but remember that even - the non-distributed one dimensional data can be well processed by XIOS. - -\end_layout - -\begin_layout Standard -As mentioned above, grid includes by default one unlimited dimension which - is often used as time step axis. - In order to write only time step to netCDF, XIOS provides a special way - to do: empty grid - a grid without any domain or axis. -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -∆The order of domain and/or in grid definition decides order of data written - to netCDF: data on domain or axis appearing firstly in grid definition - will vary the most. - For example, on using ncdump command on netCDF which contains data written - on the grid_A . -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - float field_A(time_counter, axis_A, y, x) ; -\end_layout - -\begin_layout Plain Layout - - field_A:online_operation = "average" ; -\end_layout - -\begin_layout Plain Layout - - field_A:interval_operation = "3600s" ; -\end_layout - -\begin_layout Plain Layout - - field_A:interval_write = "6h" ; -\end_layout - -\begin_layout Plain Layout - - field_A:coordinates = "time_centered axis_A nav_lat nav_lon" ; -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -The data vary most quickly on dimension y, x which are two axes of domain_A. - These are the default name of these dimension of a domain. - The data on axis_C vary slower than on the domain and all the data are - written one time step defined by time_counter at a time. -\end_layout - -\begin_layout Standard -Although a grid can be easily configured in XML file, it also needs defining - in the FORTRAN via the definition of domain and axis for a model to work - fully and correctly. - All these instruction will be detailed in the next section. -\end_layout - -\begin_layout Section -Working with FORTRAN code -\end_layout - -\begin_layout Standard -Because grid is composed of domain and axis, all processing are taken grid - via Domain and Axis. - The next chapters supply the detail of these two sub components. - -\end_layout - -\end_body -\end_document diff --git a/xios_2311_src/trunk/.svn/pristine/0e/0e6e410860c535b9a0a6c97b6de152eb3660eefe.svn-base b/xios_2311_src/trunk/.svn/pristine/0e/0e6e410860c535b9a0a6c97b6de152eb3660eefe.svn-base deleted file mode 100644 index ad06a0ca7bb8555061989fb3126f87bc6ae9ad78..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/0e/0e6e410860c535b9a0a6c97b6de152eb3660eefe.svn-base +++ /dev/null @@ -1,42 +0,0 @@ -#include "local_view.hpp" -#include "element.hpp" -#include "array_new.hpp" -#include "remote_connector.hpp" - -namespace xios -{ - CLocalView::CLocalView(shared_ptr parent, CElementView::type type, const CArray& indexView) - : CDistributedView( parent, type, {{ parent->localRank_, indexView }} ), - localRank_(parent->localRank_), - globalIndex_(parent->globalIndex_), size_(CDistributedView::size_[parent->localRank_]), - index_(CDistributedView::index_[parent->localRank_]), localSize_(CDistributedView::localSize_[parent->localRank_]) - { - - } - - CLocalView::CLocalView(shared_ptr parent, CElementView::type type, const CArray& maskView) - : CDistributedView( parent, type, {{ parent->localRank_, maskView }} ), - localRank_(parent->localRank_), - globalIndex_(parent->globalIndex_), size_(CDistributedView::size_[parent->localRank_]), - index_(CDistributedView::index_[parent->localRank_]), localSize_(CDistributedView::localSize_[parent->localRank_]) - { - - } - - void CLocalView::sendRemoteElement(shared_ptr connector, CContextClient* client, CEventClient& event, const CMessage& messageHeader) - { - int n = index_.numElements() ; - int nglo=globalIndex_.numElements() ; - CArray ind(n) ; - for(int i=0; i=0 && index_(i)transferToServer(ind, client, event, message) ; - } - - -} \ No newline at end of file diff --git a/xios_2311_src/trunk/.svn/pristine/0e/0e917691c51bd0ec97516575d302b9f19c48b7e6.svn-base b/xios_2311_src/trunk/.svn/pristine/0e/0e917691c51bd0ec97516575d302b9f19c48b7e6.svn-base deleted file mode 100644 index 058b3049b8781c65bd36afb7405eec7546bdbce1..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/0e/0e917691c51bd0ec97516575d302b9f19c48b7e6.svn-base +++ /dev/null @@ -1,419 +0,0 @@ -! * ************************************************************************** * -! * Interface auto generated - do not modify * -! * ************************************************************************** * -#include "xios_fortran_prefix.hpp" - -MODULE iinterpolate_domain_attr - USE, INTRINSIC :: ISO_C_BINDING - USE iinterpolate_domain - USE interpolate_domain_interface_attr - -CONTAINS - - SUBROUTINE xios(set_interpolate_domain_attr) & - ( interpolate_domain_id, detect_missing_value, mode, order, quantity, read_write_convention & - , renormalize, use_area, weight_filename, write_weight ) - - IMPLICIT NONE - TYPE(txios(interpolate_domain)) :: interpolate_domain_hdl - CHARACTER(LEN=*), INTENT(IN) ::interpolate_domain_id - LOGICAL , OPTIONAL, INTENT(IN) :: detect_missing_value - LOGICAL (KIND=C_BOOL) :: detect_missing_value_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: mode - INTEGER , OPTIONAL, INTENT(IN) :: order - LOGICAL , OPTIONAL, INTENT(IN) :: quantity - LOGICAL (KIND=C_BOOL) :: quantity_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: read_write_convention - LOGICAL , OPTIONAL, INTENT(IN) :: renormalize - LOGICAL (KIND=C_BOOL) :: renormalize_tmp - LOGICAL , OPTIONAL, INTENT(IN) :: use_area - LOGICAL (KIND=C_BOOL) :: use_area_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: weight_filename - LOGICAL , OPTIONAL, INTENT(IN) :: write_weight - LOGICAL (KIND=C_BOOL) :: write_weight_tmp - - CALL xios(get_interpolate_domain_handle) & - (interpolate_domain_id,interpolate_domain_hdl) - CALL xios(set_interpolate_domain_attr_hdl_) & - ( interpolate_domain_hdl, detect_missing_value, mode, order, quantity, read_write_convention & - , renormalize, use_area, weight_filename, write_weight ) - - END SUBROUTINE xios(set_interpolate_domain_attr) - - SUBROUTINE xios(set_interpolate_domain_attr_hdl) & - ( interpolate_domain_hdl, detect_missing_value, mode, order, quantity, read_write_convention & - , renormalize, use_area, weight_filename, write_weight ) - - IMPLICIT NONE - TYPE(txios(interpolate_domain)) , INTENT(IN) :: interpolate_domain_hdl - LOGICAL , OPTIONAL, INTENT(IN) :: detect_missing_value - LOGICAL (KIND=C_BOOL) :: detect_missing_value_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: mode - INTEGER , OPTIONAL, INTENT(IN) :: order - LOGICAL , OPTIONAL, INTENT(IN) :: quantity - LOGICAL (KIND=C_BOOL) :: quantity_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: read_write_convention - LOGICAL , OPTIONAL, INTENT(IN) :: renormalize - LOGICAL (KIND=C_BOOL) :: renormalize_tmp - LOGICAL , OPTIONAL, INTENT(IN) :: use_area - LOGICAL (KIND=C_BOOL) :: use_area_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: weight_filename - LOGICAL , OPTIONAL, INTENT(IN) :: write_weight - LOGICAL (KIND=C_BOOL) :: write_weight_tmp - - CALL xios(set_interpolate_domain_attr_hdl_) & - ( interpolate_domain_hdl, detect_missing_value, mode, order, quantity, read_write_convention & - , renormalize, use_area, weight_filename, write_weight ) - - END SUBROUTINE xios(set_interpolate_domain_attr_hdl) - - SUBROUTINE xios(set_interpolate_domain_attr_hdl_) & - ( interpolate_domain_hdl, detect_missing_value_, mode_, order_, quantity_, read_write_convention_ & - , renormalize_, use_area_, weight_filename_, write_weight_ ) - - IMPLICIT NONE - TYPE(txios(interpolate_domain)) , INTENT(IN) :: interpolate_domain_hdl - LOGICAL , OPTIONAL, INTENT(IN) :: detect_missing_value_ - LOGICAL (KIND=C_BOOL) :: detect_missing_value__tmp - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: mode_ - INTEGER , OPTIONAL, INTENT(IN) :: order_ - LOGICAL , OPTIONAL, INTENT(IN) :: quantity_ - LOGICAL (KIND=C_BOOL) :: quantity__tmp - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: read_write_convention_ - LOGICAL , OPTIONAL, INTENT(IN) :: renormalize_ - LOGICAL (KIND=C_BOOL) :: renormalize__tmp - LOGICAL , OPTIONAL, INTENT(IN) :: use_area_ - LOGICAL (KIND=C_BOOL) :: use_area__tmp - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: weight_filename_ - LOGICAL , OPTIONAL, INTENT(IN) :: write_weight_ - LOGICAL (KIND=C_BOOL) :: write_weight__tmp - - IF (PRESENT(detect_missing_value_)) THEN - detect_missing_value__tmp = detect_missing_value_ - CALL cxios_set_interpolate_domain_detect_missing_value & - (interpolate_domain_hdl%daddr, detect_missing_value__tmp) - ENDIF - - IF (PRESENT(mode_)) THEN - CALL cxios_set_interpolate_domain_mode & - (interpolate_domain_hdl%daddr, mode_, len(mode_)) - ENDIF - - IF (PRESENT(order_)) THEN - CALL cxios_set_interpolate_domain_order & - (interpolate_domain_hdl%daddr, order_) - ENDIF - - IF (PRESENT(quantity_)) THEN - quantity__tmp = quantity_ - CALL cxios_set_interpolate_domain_quantity & - (interpolate_domain_hdl%daddr, quantity__tmp) - ENDIF - - IF (PRESENT(read_write_convention_)) THEN - CALL cxios_set_interpolate_domain_read_write_convention & - (interpolate_domain_hdl%daddr, read_write_convention_, len(read_write_convention_)) - ENDIF - - IF (PRESENT(renormalize_)) THEN - renormalize__tmp = renormalize_ - CALL cxios_set_interpolate_domain_renormalize & - (interpolate_domain_hdl%daddr, renormalize__tmp) - ENDIF - - IF (PRESENT(use_area_)) THEN - use_area__tmp = use_area_ - CALL cxios_set_interpolate_domain_use_area & - (interpolate_domain_hdl%daddr, use_area__tmp) - ENDIF - - IF (PRESENT(weight_filename_)) THEN - CALL cxios_set_interpolate_domain_weight_filename & - (interpolate_domain_hdl%daddr, weight_filename_, len(weight_filename_)) - ENDIF - - IF (PRESENT(write_weight_)) THEN - write_weight__tmp = write_weight_ - CALL cxios_set_interpolate_domain_write_weight & - (interpolate_domain_hdl%daddr, write_weight__tmp) - ENDIF - - END SUBROUTINE xios(set_interpolate_domain_attr_hdl_) - - SUBROUTINE xios(get_interpolate_domain_attr) & - ( interpolate_domain_id, detect_missing_value, mode, order, quantity, read_write_convention & - , renormalize, use_area, weight_filename, write_weight ) - - IMPLICIT NONE - TYPE(txios(interpolate_domain)) :: interpolate_domain_hdl - CHARACTER(LEN=*), INTENT(IN) ::interpolate_domain_id - LOGICAL , OPTIONAL, INTENT(OUT) :: detect_missing_value - LOGICAL (KIND=C_BOOL) :: detect_missing_value_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: mode - INTEGER , OPTIONAL, INTENT(OUT) :: order - LOGICAL , OPTIONAL, INTENT(OUT) :: quantity - LOGICAL (KIND=C_BOOL) :: quantity_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: read_write_convention - LOGICAL , OPTIONAL, INTENT(OUT) :: renormalize - LOGICAL (KIND=C_BOOL) :: renormalize_tmp - LOGICAL , OPTIONAL, INTENT(OUT) :: use_area - LOGICAL (KIND=C_BOOL) :: use_area_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: weight_filename - LOGICAL , OPTIONAL, INTENT(OUT) :: write_weight - LOGICAL (KIND=C_BOOL) :: write_weight_tmp - - CALL xios(get_interpolate_domain_handle) & - (interpolate_domain_id,interpolate_domain_hdl) - CALL xios(get_interpolate_domain_attr_hdl_) & - ( interpolate_domain_hdl, detect_missing_value, mode, order, quantity, read_write_convention & - , renormalize, use_area, weight_filename, write_weight ) - - END SUBROUTINE xios(get_interpolate_domain_attr) - - SUBROUTINE xios(get_interpolate_domain_attr_hdl) & - ( interpolate_domain_hdl, detect_missing_value, mode, order, quantity, read_write_convention & - , renormalize, use_area, weight_filename, write_weight ) - - IMPLICIT NONE - TYPE(txios(interpolate_domain)) , INTENT(IN) :: interpolate_domain_hdl - LOGICAL , OPTIONAL, INTENT(OUT) :: detect_missing_value - LOGICAL (KIND=C_BOOL) :: detect_missing_value_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: mode - INTEGER , OPTIONAL, INTENT(OUT) :: order - LOGICAL , OPTIONAL, INTENT(OUT) :: quantity - LOGICAL (KIND=C_BOOL) :: quantity_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: read_write_convention - LOGICAL , OPTIONAL, INTENT(OUT) :: renormalize - LOGICAL (KIND=C_BOOL) :: renormalize_tmp - LOGICAL , OPTIONAL, INTENT(OUT) :: use_area - LOGICAL (KIND=C_BOOL) :: use_area_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: weight_filename - LOGICAL , OPTIONAL, INTENT(OUT) :: write_weight - LOGICAL (KIND=C_BOOL) :: write_weight_tmp - - CALL xios(get_interpolate_domain_attr_hdl_) & - ( interpolate_domain_hdl, detect_missing_value, mode, order, quantity, read_write_convention & - , renormalize, use_area, weight_filename, write_weight ) - - END SUBROUTINE xios(get_interpolate_domain_attr_hdl) - - SUBROUTINE xios(get_interpolate_domain_attr_hdl_) & - ( interpolate_domain_hdl, detect_missing_value_, mode_, order_, quantity_, read_write_convention_ & - , renormalize_, use_area_, weight_filename_, write_weight_ ) - - IMPLICIT NONE - TYPE(txios(interpolate_domain)) , INTENT(IN) :: interpolate_domain_hdl - LOGICAL , OPTIONAL, INTENT(OUT) :: detect_missing_value_ - LOGICAL (KIND=C_BOOL) :: detect_missing_value__tmp - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: mode_ - INTEGER , OPTIONAL, INTENT(OUT) :: order_ - LOGICAL , OPTIONAL, INTENT(OUT) :: quantity_ - LOGICAL (KIND=C_BOOL) :: quantity__tmp - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: read_write_convention_ - LOGICAL , OPTIONAL, INTENT(OUT) :: renormalize_ - LOGICAL (KIND=C_BOOL) :: renormalize__tmp - LOGICAL , OPTIONAL, INTENT(OUT) :: use_area_ - LOGICAL (KIND=C_BOOL) :: use_area__tmp - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: weight_filename_ - LOGICAL , OPTIONAL, INTENT(OUT) :: write_weight_ - LOGICAL (KIND=C_BOOL) :: write_weight__tmp - - IF (PRESENT(detect_missing_value_)) THEN - CALL cxios_get_interpolate_domain_detect_missing_value & - (interpolate_domain_hdl%daddr, detect_missing_value__tmp) - detect_missing_value_ = detect_missing_value__tmp - ENDIF - - IF (PRESENT(mode_)) THEN - CALL cxios_get_interpolate_domain_mode & - (interpolate_domain_hdl%daddr, mode_, len(mode_)) - ENDIF - - IF (PRESENT(order_)) THEN - CALL cxios_get_interpolate_domain_order & - (interpolate_domain_hdl%daddr, order_) - ENDIF - - IF (PRESENT(quantity_)) THEN - CALL cxios_get_interpolate_domain_quantity & - (interpolate_domain_hdl%daddr, quantity__tmp) - quantity_ = quantity__tmp - ENDIF - - IF (PRESENT(read_write_convention_)) THEN - CALL cxios_get_interpolate_domain_read_write_convention & - (interpolate_domain_hdl%daddr, read_write_convention_, len(read_write_convention_)) - ENDIF - - IF (PRESENT(renormalize_)) THEN - CALL cxios_get_interpolate_domain_renormalize & - (interpolate_domain_hdl%daddr, renormalize__tmp) - renormalize_ = renormalize__tmp - ENDIF - - IF (PRESENT(use_area_)) THEN - CALL cxios_get_interpolate_domain_use_area & - (interpolate_domain_hdl%daddr, use_area__tmp) - use_area_ = use_area__tmp - ENDIF - - IF (PRESENT(weight_filename_)) THEN - CALL cxios_get_interpolate_domain_weight_filename & - (interpolate_domain_hdl%daddr, weight_filename_, len(weight_filename_)) - ENDIF - - IF (PRESENT(write_weight_)) THEN - CALL cxios_get_interpolate_domain_write_weight & - (interpolate_domain_hdl%daddr, write_weight__tmp) - write_weight_ = write_weight__tmp - ENDIF - - END SUBROUTINE xios(get_interpolate_domain_attr_hdl_) - - SUBROUTINE xios(is_defined_interpolate_domain_attr) & - ( interpolate_domain_id, detect_missing_value, mode, order, quantity, read_write_convention & - , renormalize, use_area, weight_filename, write_weight ) - - IMPLICIT NONE - TYPE(txios(interpolate_domain)) :: interpolate_domain_hdl - CHARACTER(LEN=*), INTENT(IN) ::interpolate_domain_id - LOGICAL, OPTIONAL, INTENT(OUT) :: detect_missing_value - LOGICAL(KIND=C_BOOL) :: detect_missing_value_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: mode - LOGICAL(KIND=C_BOOL) :: mode_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: order - LOGICAL(KIND=C_BOOL) :: order_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: quantity - LOGICAL(KIND=C_BOOL) :: quantity_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: read_write_convention - LOGICAL(KIND=C_BOOL) :: read_write_convention_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: renormalize - LOGICAL(KIND=C_BOOL) :: renormalize_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: use_area - LOGICAL(KIND=C_BOOL) :: use_area_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: weight_filename - LOGICAL(KIND=C_BOOL) :: weight_filename_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: write_weight - LOGICAL(KIND=C_BOOL) :: write_weight_tmp - - CALL xios(get_interpolate_domain_handle) & - (interpolate_domain_id,interpolate_domain_hdl) - CALL xios(is_defined_interpolate_domain_attr_hdl_) & - ( interpolate_domain_hdl, detect_missing_value, mode, order, quantity, read_write_convention & - , renormalize, use_area, weight_filename, write_weight ) - - END SUBROUTINE xios(is_defined_interpolate_domain_attr) - - SUBROUTINE xios(is_defined_interpolate_domain_attr_hdl) & - ( interpolate_domain_hdl, detect_missing_value, mode, order, quantity, read_write_convention & - , renormalize, use_area, weight_filename, write_weight ) - - IMPLICIT NONE - TYPE(txios(interpolate_domain)) , INTENT(IN) :: interpolate_domain_hdl - LOGICAL, OPTIONAL, INTENT(OUT) :: detect_missing_value - LOGICAL(KIND=C_BOOL) :: detect_missing_value_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: mode - LOGICAL(KIND=C_BOOL) :: mode_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: order - LOGICAL(KIND=C_BOOL) :: order_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: quantity - LOGICAL(KIND=C_BOOL) :: quantity_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: read_write_convention - LOGICAL(KIND=C_BOOL) :: read_write_convention_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: renormalize - LOGICAL(KIND=C_BOOL) :: renormalize_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: use_area - LOGICAL(KIND=C_BOOL) :: use_area_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: weight_filename - LOGICAL(KIND=C_BOOL) :: weight_filename_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: write_weight - LOGICAL(KIND=C_BOOL) :: write_weight_tmp - - CALL xios(is_defined_interpolate_domain_attr_hdl_) & - ( interpolate_domain_hdl, detect_missing_value, mode, order, quantity, read_write_convention & - , renormalize, use_area, weight_filename, write_weight ) - - END SUBROUTINE xios(is_defined_interpolate_domain_attr_hdl) - - SUBROUTINE xios(is_defined_interpolate_domain_attr_hdl_) & - ( interpolate_domain_hdl, detect_missing_value_, mode_, order_, quantity_, read_write_convention_ & - , renormalize_, use_area_, weight_filename_, write_weight_ ) - - IMPLICIT NONE - TYPE(txios(interpolate_domain)) , INTENT(IN) :: interpolate_domain_hdl - LOGICAL, OPTIONAL, INTENT(OUT) :: detect_missing_value_ - LOGICAL(KIND=C_BOOL) :: detect_missing_value__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: mode_ - LOGICAL(KIND=C_BOOL) :: mode__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: order_ - LOGICAL(KIND=C_BOOL) :: order__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: quantity_ - LOGICAL(KIND=C_BOOL) :: quantity__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: read_write_convention_ - LOGICAL(KIND=C_BOOL) :: read_write_convention__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: renormalize_ - LOGICAL(KIND=C_BOOL) :: renormalize__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: use_area_ - LOGICAL(KIND=C_BOOL) :: use_area__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: weight_filename_ - LOGICAL(KIND=C_BOOL) :: weight_filename__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: write_weight_ - LOGICAL(KIND=C_BOOL) :: write_weight__tmp - - IF (PRESENT(detect_missing_value_)) THEN - detect_missing_value__tmp = cxios_is_defined_interpolate_domain_detect_missing_value & - (interpolate_domain_hdl%daddr) - detect_missing_value_ = detect_missing_value__tmp - ENDIF - - IF (PRESENT(mode_)) THEN - mode__tmp = cxios_is_defined_interpolate_domain_mode & - (interpolate_domain_hdl%daddr) - mode_ = mode__tmp - ENDIF - - IF (PRESENT(order_)) THEN - order__tmp = cxios_is_defined_interpolate_domain_order & - (interpolate_domain_hdl%daddr) - order_ = order__tmp - ENDIF - - IF (PRESENT(quantity_)) THEN - quantity__tmp = cxios_is_defined_interpolate_domain_quantity & - (interpolate_domain_hdl%daddr) - quantity_ = quantity__tmp - ENDIF - - IF (PRESENT(read_write_convention_)) THEN - read_write_convention__tmp = cxios_is_defined_interpolate_domain_read_write_convention & - (interpolate_domain_hdl%daddr) - read_write_convention_ = read_write_convention__tmp - ENDIF - - IF (PRESENT(renormalize_)) THEN - renormalize__tmp = cxios_is_defined_interpolate_domain_renormalize & - (interpolate_domain_hdl%daddr) - renormalize_ = renormalize__tmp - ENDIF - - IF (PRESENT(use_area_)) THEN - use_area__tmp = cxios_is_defined_interpolate_domain_use_area & - (interpolate_domain_hdl%daddr) - use_area_ = use_area__tmp - ENDIF - - IF (PRESENT(weight_filename_)) THEN - weight_filename__tmp = cxios_is_defined_interpolate_domain_weight_filename & - (interpolate_domain_hdl%daddr) - weight_filename_ = weight_filename__tmp - ENDIF - - IF (PRESENT(write_weight_)) THEN - write_weight__tmp = cxios_is_defined_interpolate_domain_write_weight & - (interpolate_domain_hdl%daddr) - write_weight_ = write_weight__tmp - ENDIF - - END SUBROUTINE xios(is_defined_interpolate_domain_attr_hdl_) - -END MODULE iinterpolate_domain_attr diff --git a/xios_2311_src/trunk/.svn/pristine/0e/0e9ce7c56fc9c31b4459e173e944c530201c314b.svn-base b/xios_2311_src/trunk/.svn/pristine/0e/0e9ce7c56fc9c31b4459e173e944c530201c314b.svn-base deleted file mode 100644 index 8ec2c0da2dd9db8275eb734ee4ba5189a8f64c90..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/0e/0e9ce7c56fc9c31b4459e173e944c530201c314b.svn-base +++ /dev/null @@ -1,31 +0,0 @@ -/********************************************************************* - * Copyright 1993, UCAR/Unidata - * See netcdf/COPYRIGHT file for copying and redistribution conditions. - *********************************************************************/ -/* $Header$ */ - -#ifndef CECONSTRAINTS_H -#define CECONSTRAINTS_H - -#ifndef NC_MAX_VAR_DIMS -#define NC_MAX_VAR_DIMS 1024 -#endif - -typedef enum CEops { -CEO_NIL=0,CEO_EQ=1,CEO_NEQ=2,CEO_GE=3,CEO_GT=4,CEO_LT=5,CEO_LE=6,CEO_RE=7 -} CEops; - -/* Must match NCCops */ -#define OPSTRINGS {"?","=","!=",">=",">","<=","<","=~"} - -typedef enum CEsort { -CES_NIL=0, -CES_STR=8,CES_INT=9,CES_FLOAT=10, -CES_VAR=11,CES_FCN=12,CES_CONST=13, -CES_SELECT=14, CES_PROJECT=15, -CES_SEGMENT=16, CES_CONSTRAINT=17, -CES_VALUE=18, CES_SLICE=19 -} CEsort; - -#endif /*CECONSTRAINTS_H*/ - diff --git a/xios_2311_src/trunk/.svn/pristine/0f/0f0d39d84e6a213cf5e904842b9b0b64f86d6c77.svn-base b/xios_2311_src/trunk/.svn/pristine/0f/0f0d39d84e6a213cf5e904842b9b0b64f86d6c77.svn-base deleted file mode 100644 index 4aeadcdd98dfa838a8b7576d57ecdce14f170289..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/0f/0f0d39d84e6a213cf5e904842b9b0b64f86d6c77.svn-base +++ /dev/null @@ -1,24 +0,0 @@ -#include "object_factory_decl_macro.hpp" - -namespace xios -{ - macro(CExtractAxis) - macro(CZoomDomain) - macro(CInterpolateDomain) - macro(CGenerateRectilinearDomain) - macro(CScalar) - macro(CReduceAxisToScalar) - macro(CReduceDomainToAxis) - macro(CReduceAxisToAxis) - macro(CExtractDomainToAxis) - macro(CComputeConnectivityDomain) - macro(CExpandDomain) - macro(CExtractAxisToScalar) - macro(CReduceDomainToScalar) - macro(CTemporalSplitting) - macro(CDuplicateScalarToAxis) - macro(CReduceScalarToScalar) - macro(CReorderDomain) - macro(CExtractDomain) -} - diff --git a/xios_2311_src/trunk/.svn/pristine/0f/0f13cab8e17a9431a0870c422605e74a8d96468e.svn-base b/xios_2311_src/trunk/.svn/pristine/0f/0f13cab8e17a9431a0870c422605e74a8d96468e.svn-base deleted file mode 100644 index dca7b3804930d5b672599ee6339c08b664a760a1..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/0f/0f13cab8e17a9431a0870c422605e74a8d96468e.svn-base +++ /dev/null @@ -1,1725 +0,0 @@ -# Doxyfile 1.7.4 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project -# -# All text after a hash (#) is considered a comment and will be ignored -# The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" ") - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all -# text before the first occurrence of this tag. Doxygen uses libiconv (or the -# iconv built into libc) for the transcoding. See -# http://www.gnu.org/software/libiconv for the list of possible encodings. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded -# by quotes) that should identify the project. - -PROJECT_NAME = XIOS - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. - -PROJECT_NUMBER = 1.0 - -# Using the PROJECT_BRIEF tag one can provide an optional one line description -# for a project that appears at the top of each page and should give viewer -# a quick idea about the purpose of the project. Keep the description short. - -PROJECT_BRIEF = "Xml I/O Server" - -# With the PROJECT_LOGO tag one can specify an logo or icon that is -# included in the documentation. The maximum height of the logo should not -# exceed 55 pixels and the maximum width should not exceed 200 pixels. -# Doxygen will copy the logo to the output directory. - -PROJECT_LOGO = - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - -OUTPUT_DIRECTORY = ./doc - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of -# source files, where putting all generated files in the same directory would -# otherwise cause performance problems for the file system. - -CREATE_SUBDIRS = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, -# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, -# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English -# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, -# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, -# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. - -OUTPUT_LANGUAGE = French - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is -# used as the annotated text. Otherwise, the brief description is used as-is. -# If left blank, the following values are used ("$name" is automatically -# replaced with the name of the entity): "The $name class" "The $name widget" -# "The $name file" "is" "provides" "specifies" "contains" -# "represents" "a" "an" "the" - -ABBREVIATE_BRIEF = "The $name class" \ - "The $name widget" \ - "The $name file" \ - is \ - provides \ - specifies \ - contains \ - represents \ - a \ - an \ - the - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief -# description. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - -FULL_PATH_NAMES = YES - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful if your file system -# doesn't support long names like on DOS, Mac, or CD-ROM. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like regular Qt-style comments -# (thus requiring an explicit @brief command for a brief description.) - -JAVADOC_AUTOBRIEF = NO - -# If the QT_AUTOBRIEF tag is set to YES then Doxygen will -# interpret the first line (until the first dot) of a Qt-style -# comment as the brief description. If set to NO, the comments -# will behave just like regular Qt-style comments (thus requiring -# an explicit \brief command for a brief description.) - -QT_AUTOBRIEF = YES - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce -# a new page for each member. If set to NO, the documentation of a member will -# be part of the file/class/namespace that contains it. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - -TAB_SIZE = 8 - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - -ALIASES = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C -# sources only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. - -OPTIMIZE_OUTPUT_FOR_C = NO - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java -# sources only. Doxygen will then generate output that is more tailored for -# Java. For instance, namespaces will be presented as packages, qualified -# scopes will look different, etc. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources only. Doxygen will then generate output that is more tailored for -# Fortran. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for -# VHDL. - -OPTIMIZE_OUTPUT_VHDL = NO - -# Doxygen selects the parser to use depending on the extension of the files it -# parses. With this tag you can assign which parser to use for a given extension. -# Doxygen has a built-in mapping, but you can override or extend it using this -# tag. The format is ext=language, where ext is a file extension, and language -# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, -# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make -# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C -# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions -# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. - -EXTENSION_MAPPING = - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should -# set this tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. -# func(std::string) {}). This also makes the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. - -BUILTIN_STL_SUPPORT = YES - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. -# Doxygen will parse them like normal C++ but will assume all classes use public -# instead of private inheritance when no explicit protection keyword is present. - -SIP_SUPPORT = NO - -# For Microsoft's IDL there are propget and propput attributes to indicate getter -# and setter methods for a property. Setting this option to YES (the default) -# will make doxygen replace the get and set methods by a property in the -# documentation. This will only work if the methods are indeed getting or -# setting a simple type. If this is not the case, or you want to show the -# methods anyway, you should set this option to NO. - -IDL_PROPERTY_SUPPORT = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. - -DISTRIBUTE_GROUP_DOC = NO - -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. - -SUBGROUPING = YES - -# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and -# unions are shown inside the group in which they are included (e.g. using -# @ingroup) instead of on a separate page (for HTML and Man pages) or -# section (for LaTeX and RTF). - -INLINE_GROUPED_CLASSES = NO - -# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum -# is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically -# be useful for C code in case the coding convention dictates that all compound -# types are typedef'ed and only the typedef is referenced, never the tag name. - -TYPEDEF_HIDES_STRUCT = NO - -# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to -# determine which symbols to keep in memory and which to flush to disk. -# When the cache is full, less often used symbols will be written to disk. -# For small to medium size projects (<1000 input files) the default value is -# probably good enough. For larger projects a too small cache size can cause -# doxygen to be busy swapping symbols to and from disk most of the time -# causing a significant performance penalty. -# If the system has enough physical memory increasing the cache will improve the -# performance by keeping more symbols in memory. Note that the value works on -# a logarithmic scale so increasing the size by one will roughly double the -# memory usage. The cache size is given by this formula: -# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, -# corresponding to a cache size of 2^16 = 65536 symbols - -SYMBOL_CACHE_SIZE = 0 - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES - -EXTRACT_ALL = YES - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = YES - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = YES - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. - -EXTRACT_LOCAL_METHODS = YES - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base -# name of the file that contains the anonymous namespace. By default -# anonymous namespaces are hidden. - -EXTRACT_ANON_NSPACES = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. - -CASE_SENSE_NAMES = NO - -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. - -HIDE_SCOPE_NAMES = NO - -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. - -SHOW_INCLUDE_FILES = YES - -# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen -# will list include files with double quotes in the documentation -# rather than with sharp brackets. - -FORCE_LOCAL_INCLUDES = NO - -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. - -SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. - -SORT_BRIEF_DOCS = NO - -# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen -# will sort the (brief and detailed) documentation of class members so that -# constructors and destructors are listed first. If set to NO (the default) -# the constructors will appear in the respective orders defined by -# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. -# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO -# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. - -SORT_MEMBERS_CTORS_1ST = NO - -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the -# hierarchy of group names into alphabetical order. If set to NO (the default) -# the group names will appear in their defined order. - -SORT_GROUP_NAMES = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. - -SORT_BY_SCOPE_NAME = NO - -# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to -# do proper type resolution of all parameters of a function it will reject a -# match between the prototype and the implementation of a member function even -# if there is only one candidate or it is obvious which candidate to choose -# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen -# will still accept a match between prototype and implementation in such cases. - -STRICT_PROTO_MATCHING = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if sectionname ... \endif. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or macro consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and macros in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the -# list will mention the files that were used to generate the documentation. - -SHOW_USED_FILES = YES - -# If the sources in your project are distributed over multiple directories -# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy -# in the documentation. The default is NO. - -SHOW_DIRECTORIES = YES - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. -# This will remove the Files entry from the Quick Index and from the -# Folder Tree View (if specified). The default is YES. - -SHOW_FILES = YES - -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the -# Namespaces page. This will remove the Namespaces entry from the Quick Index -# and from the Folder Tree View (if specified). The default is YES. - -SHOW_NAMESPACES = YES - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command , where is the value of -# the FILE_VERSION_FILTER tag, and is the name of an input file -# provided by doxygen. Whatever the program writes to standard output -# is used as the file version. See the manual for examples. - -FILE_VERSION_FILTER = - -# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed -# by doxygen. The layout file controls the global structure of the generated -# output files in an output format independent way. The create the layout file -# that represents doxygen's defaults, run doxygen with the -l option. -# You can optionally specify a file name after the option, if omitted -# DoxygenLayout.xml will be used as the name of the layout file. - -LAYOUT_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. - -WARN_IF_UNDOCUMENTED = YES - -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. - -WARN_IF_DOC_ERROR = YES - -# The WARN_NO_PARAMDOC option can be enabled to get warnings for -# functions that are documented, but have no documentation for their parameters -# or return value. If set to NO (the default) doxygen will only warn about -# wrong or incomplete parameter documentation, but not about the absence of -# documentation. - -WARN_NO_PARAMDOC = YES - -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. Optionally the format may contain -# $version, which will be replaced by the version of the file (if it could -# be obtained via FILE_VERSION_FILTER) - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - -INPUT = src - -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is -# also the default input encoding. Doxygen uses libiconv (or the iconv built -# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for -# the list of possible encodings. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh -# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py -# *.f90 *.f *.for *.vhd *.vhdl - -FILE_PATTERNS = *.cpp \ - *.hpp \ - *.conf - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = YES - -# The EXCLUDE tag can be used to specify files and/or directories that should -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. - -EXCLUDE = - -# The EXCLUDE_SYMLINKS tag can be used select whether or not files or -# directories that are symbolic links (a Unix file system feature) are excluded -# from the input. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. Note that the wildcards are matched -# against the file with absolute path, so to exclude all test directories -# for example use the pattern */test/* - -EXCLUDE_PATTERNS = - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test - -EXCLUDE_SYMBOLS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -EXAMPLE_PATTERNS = * - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command , where -# is the value of the INPUT_FILTER tag, and is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. If FILTER_PATTERNS is specified, this tag will be -# ignored. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty or if -# non of the patterns match the file name, INPUT_FILTER is applied. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). - -FILTER_SOURCE_FILES = NO - -# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file -# pattern. A pattern will override the setting for FILTER_PATTERN (if any) -# and it is also possible to disable source filtering for a specific pattern -# using *.ext= (so without naming a filter). This option only has effect when -# FILTER_SOURCE_FILES is enabled. - -FILTER_SOURCE_PATTERNS = - -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. - -SOURCE_BROWSER = YES - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C and C++ comments will always remain visible. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES -# then for each documented function all documented -# functions referencing it will be listed. - -REFERENCED_BY_RELATION = YES - -# If the REFERENCES_RELATION tag is set to YES -# then for each documented function all documented entities -# called/used by that function will be listed. - -REFERENCES_RELATION = YES - -# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) -# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from -# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will -# link to the source code. Otherwise they will link to the documentation. - -REFERENCES_LINK_SOURCE = YES - -# If the USE_HTAGS tag is set to YES then the references to source code -# will point to the HTML generated by the htags(1) tool instead of doxygen -# built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You -# will need version 4.8.6 or higher. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = YES - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = YES - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. Note that when using a custom header you are responsible -# for the proper inclusion of any scripts and style sheets that doxygen -# needs, which is dependent on the configuration options used. -# It is adviced to generate a default header using "doxygen -w html -# header.html footer.html stylesheet.css YourConfigFile" and then modify -# that header. Note that the header is subject to change so you typically -# have to redo this when upgrading to a newer version of doxygen or when -# changing the value of configuration settings such as GENERATE_TREEVIEW! - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = - -# If the HTML_TIMESTAMP tag is set to YES then the generated HTML -# documentation will contain the timesstamp. - -HTML_TIMESTAMP = YES - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet. Note that doxygen will try to copy -# the style sheet file to the HTML output directory, so don't put your own -# stylesheet in the HTML output directory as well, or it will be erased! - -HTML_STYLESHEET = - -# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or -# other source files which should be copied to the HTML output directory. Note -# that these files will be copied to the base HTML output directory. Use the -# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these -# files. In the HTML_STYLESHEET file, use the file name only. Also note that -# the files will be copied as-is; there are no commands or markers available. - -HTML_EXTRA_FILES = - -# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. -# Doxygen will adjust the colors in the stylesheet and background images -# according to this color. Hue is specified as an angle on a colorwheel, -# see http://en.wikipedia.org/wiki/Hue for more information. -# For instance the value 0 represents red, 60 is yellow, 120 is green, -# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. -# The allowed range is 0 to 359. - -HTML_COLORSTYLE_HUE = 224 - -# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of -# the colors in the HTML output. For a value of 0 the output will use -# grayscales only. A value of 255 will produce the most vivid colors. - -HTML_COLORSTYLE_SAT = 63 - -# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to -# the luminance component of the colors in the HTML output. Values below -# 100 gradually make the output lighter, whereas values above 100 make -# the output darker. The value divided by 100 is the actual gamma applied, -# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, -# and 100 does not change the gamma. - -HTML_COLORSTYLE_GAMMA = 152 - -# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML -# page will contain the date and time when the page was generated. Setting -# this to NO can help when comparing the output of multiple runs. - -HTML_TIMESTAMP = YES - -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to -# NO a bullet list will be used. - -HTML_ALIGN_MEMBERS = YES - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. For this to work a browser that supports -# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox -# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). - -HTML_DYNAMIC_SECTIONS = YES - -# If the GENERATE_DOCSET tag is set to YES, additional index files -# will be generated that can be used as input for Apple's Xcode 3 -# integrated development environment, introduced with OSX 10.5 (Leopard). -# To create a documentation set, doxygen will generate a Makefile in the -# HTML output directory. Running make will produce the docset in that -# directory and running "make install" will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find -# it at startup. -# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html -# for more information. - -GENERATE_DOCSET = NO - -# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the -# feed. A documentation feed provides an umbrella under which multiple -# documentation sets from a single provider (such as a company or product suite) -# can be grouped. - -DOCSET_FEEDNAME = "Doxygen generated docs" - -# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that -# should uniquely identify the documentation set bundle. This should be a -# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen -# will append .docset to the name. - -DOCSET_BUNDLE_ID = org.doxygen.Project - -# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify -# the documentation publisher. This should be a reverse domain-name style -# string, e.g. com.mycompany.MyDocSet.documentation. - -DOCSET_PUBLISHER_ID = org.doxygen.Publisher - -# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. - -DOCSET_PUBLISHER_NAME = Publisher - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be -# written to the html output directory. - -CHM_FILE = - -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. - -HHC_LOCATION = - -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). - -GENERATE_CHI = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING -# is used to encode HtmlHelp index (hhk), content (hhc) and project file -# content. - -CHM_INDEX_ENCODING = - -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. - -TOC_EXPAND = NO - -# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and -# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated -# that can be used as input for Qt's qhelpgenerator to generate a -# Qt Compressed Help (.qch) of the generated HTML documentation. - -GENERATE_QHP = NO - -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can -# be used to specify the file name of the resulting .qch file. -# The path specified is relative to the HTML output folder. - -QCH_FILE = - -# The QHP_NAMESPACE tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#namespace - -QHP_NAMESPACE = org.doxygen.Project - -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#virtual-folders - -QHP_VIRTUAL_FOLDER = doc - -# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to -# add. For more information please see -# http://doc.trolltech.com/qthelpproject.html#custom-filters - -QHP_CUST_FILTER_NAME = - -# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the -# custom filter to add. For more information please see -# -# Qt Help Project / Custom Filters. - -QHP_CUST_FILTER_ATTRS = - -# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this -# project's -# filter section matches. -# -# Qt Help Project / Filter Attributes. - -QHP_SECT_FILTER_ATTRS = - -# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can -# be used to specify the location of Qt's qhelpgenerator. -# If non-empty doxygen will try to run qhelpgenerator on the generated -# .qhp file. - -QHG_LOCATION = - -# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files -# will be generated, which together with the HTML files, form an Eclipse help -# plugin. To install this plugin and make it available under the help contents -# menu in Eclipse, the contents of the directory containing the HTML and XML -# files needs to be copied into the plugins directory of eclipse. The name of -# the directory within the plugins directory should be the same as -# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before -# the help appears. - -GENERATE_ECLIPSEHELP = NO - -# A unique identifier for the eclipse help plugin. When installing the plugin -# the directory name containing the HTML and XML files should also have -# this name. - -ECLIPSE_DOC_ID = org.doxygen.Project - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index at -# top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. - -DISABLE_INDEX = NO - -# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values -# (range [0,1..20]) that doxygen will group on one line in the generated HTML -# documentation. Note that a value of 0 will completely suppress the enum -# values from appearing in the overview section. - -ENUM_VALUES_PER_LINE = 4 - -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. -# If the tag value is set to YES, a side panel will be generated -# containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). -# Windows users are probably better off using the HTML help feature. - -GENERATE_TREEVIEW = YES - -# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, -# and Class Hierarchy pages using a tree view instead of an ordered list. - -USE_INLINE_TREES = YES - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. - -TREEVIEW_WIDTH = 250 - -# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open -# links to external symbols imported via tag files in a separate window. - -EXT_LINKS_IN_WINDOW = NO - -# Use this tag to change the font size of Latex formulas included -# as images in the HTML documentation. The default is 10. Note that -# when you change the font size after a successful doxygen run you need -# to manually remove any form_*.png images from the HTML output directory -# to force them to be regenerated. - -FORMULA_FONTSIZE = 10 - -# Use the FORMULA_TRANPARENT tag to determine whether or not the images -# generated for formulas are transparent PNGs. Transparent PNGs are -# not supported properly for IE 6.0, but are supported on all modern browsers. -# Note that when changing this option you need to delete any form_*.png files -# in the HTML output before the changes have effect. - -FORMULA_TRANSPARENT = YES - -# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax -# (see http://www.mathjax.org) which uses client side Javascript for the -# rendering instead of using prerendered bitmaps. Use this if you do not -# have LaTeX installed or if you want to formulas look prettier in the HTML -# output. When enabled you also need to install MathJax separately and -# configure the path to it using the MATHJAX_RELPATH option. - -USE_MATHJAX = NO - -# When MathJax is enabled you need to specify the location relative to the -# HTML output directory using the MATHJAX_RELPATH option. The destination -# directory should contain the MathJax.js script. For instance, if the mathjax -# directory is located at the same level as the HTML output directory, then -# MATHJAX_RELPATH should be ../mathjax. The default value points to the -# mathjax.org site, so you can quickly see the result without installing -# MathJax, but it is strongly recommended to install a local copy of MathJax -# before deployment. - -MATHJAX_RELPATH = http://www.mathjax.org/mathjax - -# When the SEARCHENGINE tag is enabled doxygen will generate a search box -# for the HTML output. The underlying search engine uses javascript -# and DHTML and should work on any modern browser. Note that when using -# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets -# (GENERATE_DOCSET) there is already a search function so this one should -# typically be disabled. For large projects the javascript based search engine -# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. - -SEARCHENGINE = YES - -# When the SERVER_BASED_SEARCH tag is enabled the search engine will be -# implemented using a PHP enabled web server instead of at the web client -# using Javascript. Doxygen will generate the search PHP script and index -# file to put on the web server. The advantage of the server -# based approach is that it scales better to large projects and allows -# full text search. The disadvantages are that it is more difficult to setup -# and does not have live searching capabilities. - -SERVER_BASED_SEARCH = NO - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = NO - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. If left blank `latex' will be used as the default command name. -# Note that when enabling USE_PDFLATEX this option is only used for -# generating bitmaps for formulas in the HTML output, but not in the -# Makefile that is written to the output directory. - -LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the -# default command name. - -MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, letter, legal and -# executive. If left blank a4wide will be used. - -PAPER_TYPE = a4 - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! - -LATEX_HEADER = - -# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for -# the generated latex document. The footer should contain everything after -# the last chapter. If it is left blank doxygen will generate a -# standard footer. Notice: only use this tag if you know what you are doing! - -LATEX_FOOTER = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. - -PDF_HYPERLINKS = YES - -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a -# higher quality PDF documentation. - -USE_PDFLATEX = YES - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. - -LATEX_BATCHMODE = NO - -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) -# in the output. - -LATEX_HIDE_INDICES = NO - -# If LATEX_SOURCE_CODE is set to YES then doxygen will include -# source code with syntax highlighting in the LaTeX output. -# Note that which sources are shown also depends on other settings -# such as SOURCE_BROWSER. - -LATEX_SOURCE_CODE = NO - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimized for Word 97 and may not look very pretty with -# other RTF readers or editors. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. - -RTF_OUTPUT = rtf - -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. -# Note: wordpad (write) and others do not support links. - -RTF_HYPERLINKS = NO - -# Load stylesheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assignments. You only have to provide -# replacements, missing definitions are set to their default value. - -RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an rtf document. -# Syntax is similar to doxygen's config file. - -RTF_EXTENSIONS_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command -# would be unable to find the correct page. The default is NO. - -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of -# the code including all documentation. - -GENERATE_XML = NO - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `xml' will be used as the default path. - -XML_OUTPUT = xml - -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_DTD = - -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will -# dump the program listings (including syntax highlighting -# and cross-referencing information) to the XML output. Note that -# enabling this will significantly increase the size of the XML output. - -XML_PROGRAMLISTING = YES - -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental -# and incomplete at the moment. - -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the -# moment. - -GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able -# to generate PDF and DVI output from the Perl module output. - -PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. This is useful -# if you want to understand what is going on. On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller -# and Perl will parse it just the same. - -PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same -# Makefile don't overwrite each other's variables. - -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled -# way by setting EXPAND_ONLY_PREDEF to YES. - -MACRO_EXPANSION = YES - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED and EXPAND_AS_DEFINED tags. - -EXPAND_ONLY_PREDEF = NO - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# pointed to by INCLUDE_PATH will be searched when a #include is found. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will -# be used. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. To prevent a macro definition from being -# undefined via #undef or recursively expanded use the := operator -# instead of the = operator. - -PREDEFINED = - -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition that -# overrules the definition found in the source code. - -EXPAND_AS_DEFINED = - -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all references to function-like macros -# that are alone on a line, have an all uppercase name, and do not end with a -# semicolon, because these will confuse the parser if not removed. - -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES option can be used to specify one or more tagfiles. -# Optionally an initial location of the external documentation -# can be added for each tagfile. The format of a tag file without -# this location is as follows: -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths or -# URLs. If a location is present for each tag, the installdox tool -# does not have to be run to correct the links. -# Note that each tag file must have a unique name -# (where the name does NOT include the path) -# If a tag file is not located in the directory in which doxygen -# is run, you must also specify the path to the tagfile here. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will -# be listed. - -EXTERNAL_GROUPS = YES - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base -# or super classes. Setting the tag to NO turns the diagrams off. Note that -# this option also works with HAVE_DOT disabled, but it is recommended to -# install and use dot, since it yields more powerful graphs. - -CLASS_DIAGRAMS = YES - -# You can define message sequence charts within doxygen comments using the \msc -# command. Doxygen will then run the mscgen tool (see -# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the -# documentation. The MSCGEN_PATH tag allows you to specify the directory where -# the mscgen tool resides. If left empty the tool is assumed to be found in the -# default search path. - -MSCGEN_PATH = - -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented -# or is not a class. - -HIDE_UNDOC_RELATIONS = YES - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - -HAVE_DOT = YES - -# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is -# allowed to run in parallel. When set to 0 (the default) doxygen will -# base this on the number of processors available in the system. You can set it -# explicitly to a value larger than 0 to get control over the balance -# between CPU load and processing speed. - -DOT_NUM_THREADS = 0 - -# By default doxygen will write a font called Helvetica to the output -# directory and reference it in all dot files that doxygen generates. -# When you want a differently looking font you can specify the font name -# using DOT_FONTNAME. You need to make sure dot is able to find the font, -# which can be done by putting it in a standard location or by setting the -# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory -# containing the font. - -DOT_FONTNAME = Helvetica - -# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. -# The default size is 10pt. - -DOT_FONTSIZE = 10 - -# By default doxygen will tell dot to use the output directory to look for the -# FreeSans.ttf font (which doxygen will put there itself). If you specify a -# different font using DOT_FONTNAME you can set the path where dot -# can find it using this tag. - -DOT_FONTPATH = - -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the -# the CLASS_DIAGRAMS tag to NO. - -CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. - -COLLABORATION_GRAPH = YES - -# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for groups, showing the direct groups dependencies - -GROUP_GRAPHS = YES - -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling -# Language. - -UML_LOOK = YES - -# If set to YES, the inheritance and collaboration graphs will show the -# relations between templates and their instances. - -TEMPLATE_RELATIONS = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with -# other documented files. - -INCLUDE_GRAPH = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or -# indirectly include this file. - -INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH and HAVE_DOT options are set to YES then -# doxygen will generate a call dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable call graphs -# for selected functions only using the \callgraph command. - -CALL_GRAPH = YES - -# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then -# doxygen will generate a caller dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable caller -# graphs for selected functions only using the \callergraph command. - -CALLER_GRAPH = YES - -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will generate a graphical hierarchy of all classes instead of a textual one. - -GRAPHICAL_HIERARCHY = YES - -# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES -# then doxygen will show the dependencies a directory has on other directories -# in a graphical way. The dependency relations are determined by the #include -# relations between the files in the directories. - -DIRECTORY_GRAPH = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are svg, png, jpg, or gif. -# If left blank png will be used. - -DOT_IMAGE_FORMAT = png - -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found in the path. - -DOT_PATH = - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the -# \dotfile command). - -DOTFILE_DIRS = - -# The MSCFILE_DIRS tag can be used to specify one or more directories that -# contain msc files that are included in the documentation (see the -# \mscfile command). - -MSCFILE_DIRS = - -# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of -# nodes that will be shown in the graph. If the number of nodes in a graph -# becomes larger than this value, doxygen will truncate the graph, which is -# visualized by representing a node as a red box. Note that doxygen if the -# number of direct children of the root node in a graph is already larger than -# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note -# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. - -DOT_GRAPH_MAX_NODES = 50 - -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the -# graphs generated by dot. A depth value of 3 means that only nodes reachable -# from the root by following a path via at most 3 edges will be shown. Nodes -# that lay further from the root node will be omitted. Note that setting this -# option to 1 or 2 may greatly reduce the computation time needed for large -# code bases. Also note that the size of a graph can be further restricted by -# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. - -MAX_DOT_GRAPH_DEPTH = 0 - -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, because dot on Windows does not -# seem to support this out of the box. Warning: Depending on the platform used, -# enabling this option may lead to badly anti-aliased labels on the edges of -# a graph (i.e. they become hard to read). - -DOT_TRANSPARENT = NO - -# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output -# files in one run (i.e. multiple -o and -T options on the command line). This -# makes dot run faster, but since only newer versions of dot (>1.8.10) -# support this, this feature is disabled by default. - -DOT_MULTI_TARGETS = NO - -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and -# arrows in the dot generated graphs. - -GENERATE_LEGEND = YES - -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate -# the various graphs. - -DOT_CLEANUP = YES diff --git a/xios_2311_src/trunk/.svn/pristine/0f/0f2f156c6b843d4f32ec8303ec59d8368bb03cc7.svn-base b/xios_2311_src/trunk/.svn/pristine/0f/0f2f156c6b843d4f32ec8303ec59d8368bb03cc7.svn-base deleted file mode 100644 index abbc22ae1044a85f915fa7eb9022d5e49eb143cc..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/0f/0f2f156c6b843d4f32ec8303ec59d8368bb03cc7.svn-base +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef __XIOS_CGenerateRectilinearDomain__ -#define __XIOS_CGenerateRectilinearDomain__ - -/// xios headers /// -#include "xios_spl.hpp" -#include "attribute_enum.hpp" -#include "attribute_enum_impl.hpp" -#include "attribute_array.hpp" -#include "declare_attribute.hpp" -#include "object_template.hpp" -#include "group_factory.hpp" -#include "declare_group.hpp" -#include "transformation.hpp" -#include "domain.hpp" - -namespace xios { - /// ////////////////////// Déclarations ////////////////////// /// - class CGenerateRectilinearDomainGroup; - class CGenerateRectilinearDomainAttributes; - class CGenerateRectilinearDomain; - class CDomain; - class CGenericAlgorithmTransformation ; - class CGrid; - ///-------------------------------------------------------------- - - // Declare/Define CFileAttribute - BEGIN_DECLARE_ATTRIBUTE_MAP(CGenerateRectilinearDomain) -#include "generate_rectilinear_domain_attribute.conf" - END_DECLARE_ATTRIBUTE_MAP(CGenerateRectilinearDomain) - - ///-------------------------------------------------------------- - /*! - \class CGenerateRectilinearDomain - This class describes zoom_domain in xml file. - */ - class CGenerateRectilinearDomain - : public CObjectTemplate - , public CGenerateRectilinearDomainAttributes - , public CTransformation - { - public : - typedef CObjectTemplate SuperClass; - typedef CGenerateRectilinearDomainAttributes SuperClassAttribute; - typedef CGenerateRectilinearDomain MyClass ; - typedef CTransformation SuperTransform ; - - public : - /// Constructeurs /// - CGenerateRectilinearDomain(void); - explicit CGenerateRectilinearDomain(const StdString& id); - - /// Destructeur /// - virtual ~CGenerateRectilinearDomain(void); - - virtual void checkValid(CDomain* axisDest); - - /// Accesseurs statiques /// - static StdString GetName(void); - static StdString GetDefName(void); - static ENodeType GetType(void); - const string& getId(void) { return this->SuperClass::getId();} - ETranformationType getTransformationType(void) { return TRANS_GENERATE_RECTILINEAR_DOMAIN ;} - static CTransformation* getTransformation(const StdString& id) { return SuperClass::get(id);} - virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} - virtual shared_ptr createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) ; - private: - static bool registerTrans(); - static CTransformation* create(const StdString& id, xml::CXMLNode* node); - static bool _dummyRegistered; - }; // class CGenerateRectilinearDomain - - DECLARE_GROUP(CGenerateRectilinearDomain); -} // namespace xios - -#endif // __XIOS_CGenerateRectilinearDomain__ diff --git a/xios_2311_src/trunk/.svn/pristine/0f/0f3dad789cea33ba230ef4f090badf13ece6743a.svn-base b/xios_2311_src/trunk/.svn/pristine/0f/0f3dad789cea33ba230ef4f090badf13ece6743a.svn-base deleted file mode 100644 index 889e06c3b3cd9f404baa785c1eb273d0943c0765..0000000000000000000000000000000000000000 Binary files a/xios_2311_src/trunk/.svn/pristine/0f/0f3dad789cea33ba230ef4f090badf13ece6743a.svn-base and /dev/null differ diff --git a/xios_2311_src/trunk/.svn/pristine/0f/0f428130e9c9195d3b84d1e745afc2eff5c2bd89.svn-base b/xios_2311_src/trunk/.svn/pristine/0f/0f428130e9c9195d3b84d1e745afc2eff5c2bd89.svn-base deleted file mode 100644 index e21cb980d9b8704d2caa5ee33a8f1294fd0fb80b..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/0f/0f428130e9c9195d3b84d1e745afc2eff5c2bd89.svn-base +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef __XIOS_CInterpolateDomain__ -#define __XIOS_CInterpolateDomain__ - -/// xios headers /// -#include "xios_spl.hpp" -#include "attribute_enum.hpp" -#include "attribute_enum_impl.hpp" -#include "attribute_array.hpp" -#include "declare_attribute.hpp" -#include "object_template.hpp" -#include "group_factory.hpp" -#include "declare_group.hpp" -#include "transformation.hpp" -#include "domain.hpp" - -namespace xios { - /// ////////////////////// Déclarations ////////////////////// /// - class CInterpolateDomainGroup; - class CInterpolateDomainAttributes; - class CInterpolateDomain; - class CDomain; - class CGenericAlgorithmTransformation ; - class CGrid; - ///-------------------------------------------------------------- - - // Declare/Define CFileAttribute - BEGIN_DECLARE_ATTRIBUTE_MAP(CInterpolateDomain) -#include "interpolate_domain_attribute.conf" - END_DECLARE_ATTRIBUTE_MAP(CInterpolateDomain) - - ///-------------------------------------------------------------- - /*! - \class CInterpolateDomain - This class describes interpolate_from_file_domain in xml file. - */ - class CInterpolateDomain - : public CObjectTemplate - , public CInterpolateDomainAttributes - , public CTransformation - { - public : - typedef CObjectTemplate SuperClass; - typedef CInterpolateDomainAttributes SuperClassAttribute; - typedef CInterpolateDomain MyClass ; - typedef CTransformation SuperTransform ; - - public : - /// Constructeurs /// - CInterpolateDomain(void); - explicit CInterpolateDomain(const StdString& id); - - /// Destructeur /// - virtual ~CInterpolateDomain(void); - - virtual void checkValid(CDomain* domainSource); - - /// Accesseurs statiques /// - static StdString GetName(void); - static StdString GetDefName(void); - static ENodeType GetType(void); - const string& getId(void) { return this->SuperClass::getId();} - ETranformationType getTransformationType(void) { return TRANS_INTERPOLATE_DOMAIN ;} - static CTransformation* getTransformation(const StdString& id) { return SuperClass::get(id);} - virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} - virtual shared_ptr createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) ; - private: - static bool registerTrans(); - static CTransformation* create(const StdString& id, xml::CXMLNode* node); - static bool _dummyRegistered; - }; // class CInterpolateDomain - - DECLARE_GROUP(CInterpolateDomain); -} // namespace xios - -#endif // __XIOS_CInterpolateDomain__ diff --git a/xios_2311_src/trunk/.svn/pristine/0f/0fb844d38eb0bd09cb71bb5209673974042909ef.svn-base b/xios_2311_src/trunk/.svn/pristine/0f/0fb844d38eb0bd09cb71bb5209673974042909ef.svn-base deleted file mode 100644 index dd29572ea91cfe0922a4f56ab26ff4c5d0451819..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/0f/0fb844d38eb0bd09cb71bb5209673974042909ef.svn-base +++ /dev/null @@ -1,25 +0,0 @@ -################################################################################ -#################### Projet XIOS ################### -################################################################################# - - -%CCOMPILER mpiicc -%FCOMPILER mpiifort -%LINKER mpiifort -nofor-main - -%BASE_CFLAGS -std=c++11 -diag-disable 1125 -diag-disable 279 -%PROD_CFLAGS -O3 -D BOOST_DISABLE_ASSERTS -%DEV_CFLAGS -g -traceback -%DEBUG_CFLAGS -DBZ_DEBUG -g -traceback -fno-inline - -%BASE_FFLAGS -D__NONE__ -%PROD_FFLAGS -O3 -%DEV_FFLAGS -g -O2 -traceback -%DEBUG_FFLAGS -g -traceback - -%BASE_INC -D__NONE__ -%BASE_LD -lstdc++ - -%CPP mpiicc -EP -%FPP cpp -P -%MAKE gmake diff --git a/xios_2311_src/trunk/.svn/pristine/0f/0ff2e82a62c42ad11f830d2082e3258393ebbab4.svn-base b/xios_2311_src/trunk/.svn/pristine/0f/0ff2e82a62c42ad11f830d2082e3258393ebbab4.svn-base deleted file mode 100644 index e5f9f48540024ab6479057eee283a8fd1a6034e8..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/0f/0ff2e82a62c42ad11f830d2082e3258393ebbab4.svn-base +++ /dev/null @@ -1,374 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/xios_2311_src/trunk/.svn/pristine/10/107c4cb05805962bddaa7becd69b0359ebe2a45a.svn-base b/xios_2311_src/trunk/.svn/pristine/10/107c4cb05805962bddaa7becd69b0359ebe2a45a.svn-base deleted file mode 100644 index 88aa4d877ffebe542484eb1f01d57d86d7a92581..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/10/107c4cb05805962bddaa7becd69b0359ebe2a45a.svn-base +++ /dev/null @@ -1,22 +0,0 @@ -MODULE FIELDGROUP_INTERFACE - USE, INTRINSIC :: ISO_C_BINDING - - INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99 - - SUBROUTINE cxios_fieldgroup_handle_create(ret, idt, idt_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_fieldgroup_handle_create - - SUBROUTINE cxios_fieldgroup_valid_id(ret, idt, idt_size) BIND(C) - USE ISO_C_BINDING - LOGICAL (kind = C_BOOL) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_fieldgroup_valid_id - - END INTERFACE - -END MODULE FIELDGROUP_INTERFACE diff --git a/xios_2311_src/trunk/.svn/pristine/10/10c41619c79f80dd1c1acb16cb129087e08af7b9.svn-base b/xios_2311_src/trunk/.svn/pristine/10/10c41619c79f80dd1c1acb16cb129087e08af7b9.svn-base deleted file mode 100644 index b12549be74612f0d0b1e81b03bd355fd46f06351..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/10/10c41619c79f80dd1c1acb16cb129087e08af7b9.svn-base +++ /dev/null @@ -1,156 +0,0 @@ -#include "xios_fortran_prefix.hpp" - -MODULE XIOS - -USE icalendar, ONLY : xios(define_calendar), xios(set_timestep), xios(set_start_date), xios(set_time_origin), & - xios(get_calendar_type), xios(get_timestep), xios(get_start_date), xios(get_time_origin), & - xios(update_calendar), xios(get_current_date), & - xios(get_year_length_in_seconds), xios(get_day_length_in_seconds) - -USE icontext, ONLY : txios(context), xios(set_current_context), xios(get_current_context), xios(is_valid_context) - -USE icontext_attr, ONLY : xios(set_context_attr), xios(get_context_attr), xios(is_defined_context_attr) - -USE idata, ONLY : xios(initialize), xios(init_server), xios(finalize), xios(context_initialize), xios(context_is_initialized), & - xios(close_context_definition), xios(context_finalize), xios(solve_inheritance), xios(oasis_enddef) - -USE idomain, ONLY : txios(domain), txios(domaingroup), xios(is_valid_domain), xios(is_valid_domaingroup) - -USE idomain_attr, ONLY : xios(set_domain_attr), xios(get_domain_attr), xios(is_defined_domain_attr) - -USE idomaingroup_attr, ONLY : xios(set_domaingroup_attr), xios(get_domaingroup_attr), xios(is_defined_domaingroup_attr) - -USE iduration, ONLY: txios(duration), & - xios(year), xios(month), xios(day), xios(hour), xios(minute), xios(second), xios(timestep), & - xios(duration_convert_to_string), xios(duration_convert_from_string), & - xios(duration_add), xios(duration_sub), xios(duration_mult), xios(duration_neg), & - xios(duration_eq), xios(duration_neq), & - OPERATOR(+), OPERATOR(-), OPERATOR(*) - -USE idate, ONLY : txios(date), & - xios(date_convert_to_seconds), xios(date_convert_to_string), xios(date_convert_from_string), & - xios(date_add_duration), xios(date_sub_duration), xios(date_sub), & - xios(date_eq), xios(date_neq), xios(date_lt), xios(date_le), xios(date_gt), xios(date_ge), & - xios(date_get_second_of_year), xios(date_get_day_of_year), xios(date_get_fraction_of_year), & - xios(date_get_second_of_day), xios(date_get_fraction_of_day), & - OPERATOR(+), OPERATOR(-), & - OPERATOR(==), OPERATOR(/=), OPERATOR(<), OPERATOR(<=), OPERATOR(>), OPERATOR(>=), & - ASSIGNMENT(=) -USE itimer, ONLY : xios(timer_resume), xios(timer_suspend), xios(timer_reset), xios(timer_get_time) - -USE ifield, ONLY : txios(field), txios(fieldgroup), xios(is_valid_field), xios(is_valid_fieldgroup) - -USE ifield_attr, ONLY : xios(set_field_attr), xios(get_field_attr), xios(is_defined_field_attr) - -USE ifieldgroup_attr, ONLY : xios(set_fieldgroup_attr), xios(get_fieldgroup_attr), xios(is_defined_fieldgroup_attr) - -USE ivariable, ONLY : txios(variable), txios(variablegroup), xios(is_valid_variable), xios(is_valid_variablegroup) - -USE ivariable_attr, ONLY : xios(set_variable_attr), xios(get_variable_attr), xios(is_defined_variable_attr) - -USE ivariablegroup_attr, ONLY : xios(set_variablegroup_attr), xios(get_variablegroup_attr), xios(is_defined_variablegroup_attr) - -USE ifile, ONLY : txios(file), txios(filegroup), xios(is_valid_file), xios(is_valid_filegroup) - -USE ifile_attr, ONLY : xios(set_file_attr), xios(get_file_attr), xios(is_defined_file_attr) - -USE ifilegroup_attr, ONLY : xios(set_filegroup_attr), xios(get_filegroup_attr), xios(is_defined_filegroup_attr) - -USE igrid, ONLY : txios(grid), txios(gridgroup), xios(is_valid_grid), xios(is_valid_gridgroup) - -USE igrid_attr, ONLY : xios(set_grid_attr), xios(get_grid_attr), xios(is_defined_grid_attr) - -USE igridgroup_attr, ONLY : xios(set_gridgroup_attr), xios(get_gridgroup_attr), xios(is_defined_gridgroup_attr) - -USE iaxis, ONLY : txios(axis), txios(axisgroup), xios(is_valid_axis), xios(is_valid_axisgroup) - -USE iaxis_attr, ONLY : xios(set_axis_attr), xios(get_axis_attr), xios(is_defined_axis_attr) - -USE iaxisgroup_attr, ONLY : xios(set_axisgroup_attr), xios(get_axisgroup_attr), xios(is_defined_axisgroup_attr) - -USE iscalar, ONLY : txios(scalar), txios(scalargroup), xios(is_valid_scalar), xios(is_valid_scalargroup) - -USE iscalar_attr, ONLY : xios(set_scalar_attr), xios(get_scalar_attr), xios(is_defined_scalar_attr) - -USE iscalargroup_attr, ONLY : xios(set_scalargroup_attr), xios(get_scalargroup_attr), xios(is_defined_scalargroup_attr) - -!------------------------------------------------------------------------------- -!!! Transformation INTERFACES -!------------------------------------------------------------------------------- -!!! DOMAIN TRANSFORMATIONS -USE izoom_domain, ONLY : txios(zoom_domain), xios(is_valid_zoom_domain) - -USE izoom_domain_attr, ONLY : xios(set_zoom_domain_attr), xios(get_zoom_domain_attr), xios(is_defined_zoom_domain_attr) - -USE iinterpolate_domain, ONLY : txios(interpolate_domain), xios(is_valid_interpolate_domain) - -USE iinterpolate_domain_attr, ONLY : xios(set_interpolate_domain_attr), xios(get_interpolate_domain_attr), & - xios(is_defined_interpolate_domain_attr) - -USE igenerate_rectilinear_domain, ONLY : txios(generate_rectilinear_domain), xios(is_valid_generate_rectilinear_domain) - -USE igenerate_rectilinear_domain_attr, ONLY : xios(set_generate_rectilinear_domain_attr), & - xios(get_generate_rectilinear_domain_attr), & - xios(is_defined_generate_rectilinear_domain_attr) - -USE icompute_connectivity_domain, ONLY : txios(compute_connectivity_domain), xios(is_valid_compute_connectivity_domain) - -USE icompute_connectivity_domain_attr, ONLY : xios(set_compute_connectivity_domain_attr), & - xios(get_compute_connectivity_domain_attr), & - xios(is_defined_compute_connectivity_domain_attr) - -USE iexpand_domain, ONLY : txios(expand_domain), xios(is_valid_expand_domain) - -USE iexpand_domain_attr, ONLY : xios(set_expand_domain_attr), & - xios(get_expand_domain_attr), & - xios(is_defined_expand_domain_attr) - -!!! AXIS TRANSFORMATIONS -USE izoom_axis, ONLY : txios(zoom_axis), xios(is_valid_zoom_axis) - -USE izoom_axis_attr, ONLY : xios(set_zoom_axis_attr), xios(get_zoom_axis_attr), xios(is_defined_zoom_axis_attr) - - -USE iinterpolate_axis, ONLY : txios(interpolate_axis), xios(is_valid_interpolate_axis) - -USE iinterpolate_axis_attr, ONLY : xios(set_interpolate_axis_attr), xios(get_interpolate_axis_attr), & - xios(is_defined_interpolate_axis_attr) - -USE iinverse_axis, ONLY : txios(inverse_axis), xios(is_valid_inverse_axis) - -USE iinverse_axis_attr, ONLY : xios(set_inverse_axis_attr), xios(get_inverse_axis_attr), xios(is_defined_inverse_axis_attr) - -USE ireduce_domain_to_axis, ONLY : txios(reduce_domain_to_axis), xios(is_valid_reduce_domain_to_axis) - -USE ireduce_domain_to_axis_attr, ONLY : xios(set_reduce_domain_to_axis_attr), & - xios(get_reduce_domain_to_axis_attr), & - xios(is_defined_reduce_domain_to_axis_attr) - -USE iextract_domain_to_axis, ONLY : txios(extract_domain_to_axis), xios(is_valid_extract_domain_to_axis) - -USE iextract_domain_to_axis_attr, ONLY : xios(set_extract_domain_to_axis_attr), & - xios(get_extract_domain_to_axis_attr), & - xios(is_defined_extract_domain_to_axis_attr) - -!!! SCALAR TRANSFORMATIONS -USE ireduce_domain_to_scalar, ONLY : txios(reduce_domain_to_scalar), xios(is_valid_reduce_domain_to_scalar) - -USE ireduce_domain_to_scalar_attr, ONLY : xios(set_reduce_domain_to_scalar_attr), xios(get_reduce_domain_to_scalar_attr), & - xios(is_defined_reduce_domain_to_scalar_attr) - -USE ireduce_axis_to_scalar, ONLY : txios(reduce_axis_to_scalar), xios(is_valid_reduce_axis_to_scalar) - -USE ireduce_axis_to_scalar_attr, ONLY : xios(set_reduce_axis_to_scalar_attr), xios(get_reduce_axis_to_scalar_attr), & - xios(is_defined_reduce_axis_to_scalar_attr) - -USE iextract_axis_to_scalar, ONLY : txios(extract_axis_to_scalar), xios(is_valid_extract_axis_to_scalar) - -USE iextract_axis_to_scalar_attr, ONLY : xios(set_extract_axis_to_scalar_attr), & - xios(get_extract_axis_to_scalar_attr), & - xios(is_defined_extract_axis_to_scalar_attr) - -USE XIOS_INTERFACES, ONLY : xios(set_attr), xios(get_attr), xios(is_defined_attr), xios(get_handle), xios(add_child), & - xios(send_field), xios(recv_field), xios(field_is_active), xios(getVar), xios(setVar), & - xios(field_get_domain),xios(field_get_axis),xios(field_get_scalar) - -END MODULE XIOS diff --git a/xios_2311_src/trunk/.svn/pristine/10/10c5c4085be37be329a1d5142cc3c2053aeadf50.svn-base b/xios_2311_src/trunk/.svn/pristine/10/10c5c4085be37be329a1d5142cc3c2053aeadf50.svn-base deleted file mode 100644 index 45a5a2f3b2cf85ca5692ba5d96ca2a433d4e6749..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/10/10c5c4085be37be329a1d5142cc3c2053aeadf50.svn-base +++ /dev/null @@ -1,10613 +0,0 @@ -#LyX 2.1 created this file. For more info see http://www.lyx.org/ -\lyxformat 474 -\begin_document -\begin_header -\textclass book -\use_default_options true -\begin_modules -logicalmkup -\end_modules -\maintain_unincluded_children false -\language english -\language_package auto -\inputencoding auto -\fontencoding global -\font_roman default -\font_sans default -\font_typewriter default -\font_math auto -\font_default_family default -\use_non_tex_fonts false -\font_sc false -\font_osf false -\font_sf_scale 100 -\font_tt_scale 100 -\graphics default -\default_output_format default -\output_sync 0 -\bibtex_command default -\index_command default -\paperfontsize default -\spacing single -\use_hyperref false -\papersize a4paper -\use_geometry false -\use_package amsmath 1 -\use_package amssymb 1 -\use_package cancel 1 -\use_package esint 1 -\use_package mathdots 1 -\use_package mathtools 1 -\use_package mhchem 1 -\use_package stackrel 1 -\use_package stmaryrd 1 -\use_package undertilde 1 -\cite_engine basic -\cite_engine_type default -\biblio_style plain -\use_bibtopic false -\use_indices false -\paperorientation portrait -\suppress_date false -\justification true -\use_refstyle 0 -\index Index -\shortcut idx -\color #008000 -\end_index -\secnumdepth 3 -\tocdepth 3 -\paragraph_separation indent -\paragraph_indentation default -\quotes_language english -\papercolumns 1 -\papersides 1 -\paperpagestyle default -\tracking_changes false -\output_changes false -\html_math_output 0 -\html_css_as_file 0 -\html_be_strict false -\end_header - -\begin_body - -\begin_layout Title -XIOS Fortran Reference Guide -\end_layout - -\begin_layout Author -Yann Meurdesoif -\end_layout - -\begin_layout Chapter -Attribute reference -\end_layout - -\begin_layout Section -Context attribute reference -\end_layout - -\begin_layout Section -Calendar attribute reference -\end_layout - -\begin_layout Subsection* -type: -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -enumeration {Gregorian, Julian, D360, AllLeap, NoLeap, user_defined} -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: type -\end_layout - -\begin_layout Standard -Define the calendar used for the current context. - This attribute is mandatory and cannot be modified once it has been set. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -When using the Fortran interface, this attribute must be defined using the - following subroutine: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_define_calendar(type, timestep, start_date, time_origin, -\begin_inset Newline newline -\end_inset - - day_length, month_lengths, year_length, -\begin_inset Newline newline -\end_inset - - leap_year_month, leap_year_drift, -\begin_inset Newline newline -\end_inset - - leap_year_drift_offset) -\end_layout - -\begin_layout Subsection* -start_date: -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -date -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -TYPE(xios_date) :: start_date -\end_layout - -\begin_layout Standard -Define the start date of the simulation for the current context. - This attribute is optional, the default value is -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout - -\series bold -0000-01-01 00:00:00 -\end_layout - -\end_inset - -. - The -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -type -\end_layout - -\end_inset - - attribute must always be set at the same time or before this attribute - is defined. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -A partial date is allowed in the configuration file as long as the omitted - parts are at the end, in which case they are initialized as in the default - value. - Optionally an offset can be added to the date using the notation " -\emph on -+ duration -\emph default -". - -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -When using the Fortran interface, this attribute can be defined at the same - time as the calendar -\series bold -type -\series default -: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_define_calendar(type, timestep, start_date, time_origin, -\begin_inset Newline newline -\end_inset - - day_length, month_lengths, year_length, -\begin_inset Newline newline -\end_inset - - leap_year_month, leap_year_drift, -\begin_inset Newline newline -\end_inset - - leap_year_drift_offset) -\end_layout - -\begin_layout Standard -or later using the following subroutine: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_set_start_date(start_date) -\end_layout - -\begin_layout Subsection* -time_origin: -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -date -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -TYPE(xios_date) :: time_origin -\end_layout - -\begin_layout Standard -Define the time origin of a time axis. - It will appear as metadata attached to the time axis in an output file. - This attribute is optional, the default value is -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout - -\series bold -0000-01-01 00:00:00 -\end_layout - -\end_inset - -. - The -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -type -\end_layout - -\end_inset - - attribute must always be set at the same time or before this attribute - is defined. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -A partial date is allowed in the configuration file as long as the omitted - parts are at the end, in which case they are initialized as in the default - value. - Optionally an offset can be added to the date using the notation " -\emph on -+ duration -\emph default -". - -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -When using the Fortran interface, this attribute can be defined at the same - time as the calendar -\series bold -type -\series default -: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_define_calendar(type, timestep, start_date, time_origin, -\begin_inset Newline newline -\end_inset - - day_length, month_lengths, year_length, -\begin_inset Newline newline -\end_inset - - leap_year_month, leap_year_drift, -\begin_inset Newline newline -\end_inset - - leap_year_drift_offset) -\end_layout - -\begin_layout Standard -or later using the following subroutine: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_set_time_origin(time_origin) -\end_layout - -\begin_layout Subsection* -timestep: -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -duration -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -TYPE(xios_duration) :: timestep -\end_layout - -\begin_layout Standard -Define the time step of the simulation for the current context. - This attribute is mandatory. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -When using the Fortran interface, this attribute can be defined at the same - time as the calendar -\series bold -type -\series default -: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_define_calendar(type, timestep, start_date, time_origin, -\begin_inset Newline newline -\end_inset - - day_length, month_lengths, year_length, -\begin_inset Newline newline -\end_inset - - leap_year_month, leap_year_drift, -\begin_inset Newline newline -\end_inset - - leap_year_drift_offset) -\end_layout - -\begin_layout Standard -or using the following subroutine: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_set_timestep(timestep) -\end_layout - -\begin_layout Subsection* -day_length: -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: day_length -\end_layout - -\begin_layout Standard -Define the duration of a day in seconds when using a custom calendar. - This attribute is mandatory if the calendar -\series bold -type -\series default - is set to " -\emph on -user_defined -\emph default -", otherwise it must not be defined. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -When using the Fortran interface, this attribute must be defined at the - same time as the calendar -\series bold -type -\series default -: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_define_calendar(type, timestep, start_date, time_origin, -\begin_inset Newline newline -\end_inset - - day_length, month_lengths, year_length, -\begin_inset Newline newline -\end_inset - - leap_year_month, leap_year_drift, -\begin_inset Newline newline -\end_inset - - leap_year_drift_offset) -\end_layout - -\begin_layout Subsection* -month_lengths: -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -1D-array of integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: month_lengths(:) -\end_layout - -\begin_layout Standard -Define the duration of each month, in days, when using a custom calendar. - The number of elements in the array defines the number of months in a year - and the sum of all elements is the total number of days in a year. - This attribute is mandatory if the calendar -\series bold -type -\series default - is set to -\series bold -\emph on -user_defined -\series default -\emph default - and the -\series bold -year_length -\series default - attribute is not used, otherwise it must not be defined. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -When using the Fortran interface, this attribute must be defined at the - same time as the calendar -\series bold -type -\series default -: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_define_calendar(type, timestep, start_date, time_origin, -\begin_inset Newline newline -\end_inset - - day_length, month_lengths, year_length, -\begin_inset Newline newline -\end_inset - - leap_year_month, leap_year_drift, -\begin_inset Newline newline -\end_inset - - leap_year_drift_offset) -\end_layout - -\begin_layout Subsection* -year_length: -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: year_length -\end_layout - -\begin_layout Standard -Define the duration of a year, in seconds, when using a custom calendar. - This attribute is mandatory if the calendar -\series bold -type -\series default - is set to -\series bold -\emph on -user_defined -\series default -\emph default - and the -\series bold -month_lengths -\series default - attribute is not used, otherwise it must not be defined. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -Note that the date format is modified when using this attribute: the month - must be always be omitted and the day must also be omitted if -\begin_inset Formula $year\_length\leq day\_length$ -\end_inset - -. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -When using the Fortran interface, this attribute must be defined at the - same time as the calendar -\series bold -type -\series default -: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_define_calendar(type, timestep, start_date, time_origin, -\begin_inset Newline newline -\end_inset - - day_length, month_lengths, year_length, -\begin_inset Newline newline -\end_inset - - leap_year_month, leap_year_drift, -\begin_inset Newline newline -\end_inset - - leap_year_drift_offset) -\end_layout - -\begin_layout Subsection* -leap_year_month: -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: leap_year_month -\end_layout - -\begin_layout Standard -Define the month to which the extra day will be added in case of leap year, - when using a custom calendar. - This attribute is optional if the calendar -\series bold -type -\series default - is set to -\series bold -\emph on -user_defined -\series default -\emph default - and the -\series bold -month_lengths -\series default - attribute is used, otherwise it must not be defined. - The default behavior is not to have any leap year. - If defined, this attribute must comply with the following constraint: -\begin_inset Formula $1\leq leap\_year\_month\leq size(month\_lengths)$ -\end_inset - - and the -\series bold -leap_year_drift -\series default - attribute must also be defined. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -When using the Fortran interface, this attribute must be defined at the - same time as the calendar -\series bold -type -\series default -: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_define_calendar(type, timestep, start_date, time_origin, -\begin_inset Newline newline -\end_inset - - day_length, month_lengths, year_length, -\begin_inset Newline newline -\end_inset - - leap_year_month, leap_year_drift, -\begin_inset Newline newline -\end_inset - - leap_year_drift_offset) -\end_layout - -\begin_layout Subsection* -leap_year_drift: -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -double -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: leap_year_drift -\end_layout - -\begin_layout Standard -Define the yearly drift, expressed as a fraction of a day, between the calendar - year and the astronomical year, when using a custom calendar. - This attribute is optional if the calendar -\series bold -type -\series default - is set to -\series bold -\emph on -user_defined -\series default -\emph default - and the -\series bold -month_lengths -\series default - attribute is used, otherwise it must not be defined. - The default behavior is not to have any leap year, i.e. - the default value is -\begin_inset Formula $\mathbf{0}$ -\end_inset - -. - If defined, this attribute must comply with the following constraint: -\begin_inset Formula $0\leq leap\_year\_drift<1$ -\end_inset - - and the -\series bold -leap_year_month -\series default - attribute must also be defined. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -When using the Fortran interface, this attribute must be defined at the - same time as the calendar -\series bold -type -\series default -: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_define_calendar(type, timestep, start_date, time_origin, -\begin_inset Newline newline -\end_inset - - day_length, month_lengths, year_length, -\begin_inset Newline newline -\end_inset - - leap_year_month, leap_year_drift, -\begin_inset Newline newline -\end_inset - - leap_year_drift_offset) -\end_layout - -\begin_layout Subsection* -leap_year_drift_offset: -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -double -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: leap_year_drift_offset -\end_layout - -\begin_layout Standard -Define the initial drift between the calendar year and the astronomical - year, expressed as a fraction of a day, at the beginning of the time origin's - year, when using a custom calendar. - This attribute is optional if the -\series bold -leap_year_month -\series default - and -\series bold -leap_year_drift -\series default - attributes are used, otherwise it must not be defined. - The default value is -\begin_inset Formula $\mathbf{0}$ -\end_inset - -. - If defined, this attribute must comply with the following constraint: -\begin_inset Formula $0\leq leap\_year\_drift\_offset<1$ -\end_inset - -. - If -\begin_inset Formula $leap\_yeap\_drift\_offset+leap\_yeap\_drift$ -\end_inset - - is greater or equal to 1, then the first year will be a leap year. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -When using the Fortran interface, this attribute must be defined at the - same time as the calendar -\series bold -type -\series default -: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_define_calendar(type, timestep, start_date, time_origin, -\begin_inset Newline newline -\end_inset - - day_length, month_lengths, year_length, -\begin_inset Newline newline -\end_inset - - leap_year_month, leap_year_drift, -\begin_inset Newline newline -\end_inset - - leap_year_drift_offset) -\end_layout - -\begin_layout Section -Scalar attribute reference -\end_layout - -\begin_layout Subsection* -name (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: name -\end_layout - -\begin_layout Standard -Defines the name of a scalar as it will appear in a file. - If not defined, the name will be generated automatically based on the id. - If multiple scalars are defined in the same file, each scalar must have - a unique name. - -\end_layout - -\begin_layout Subsection* -standard_name (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: standard_name -\end_layout - -\begin_layout Standard -Defines the standard name of a scalar as it will appear in the scalar's - metadata in an output file. - -\end_layout - -\begin_layout Subsection* -long_name (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: long_name -\end_layout - -\begin_layout Standard -Defines the long name of a scalar as it will appear in the scalar's metadata - in an output file. - -\end_layout - -\begin_layout Subsection* -unit (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: unit -\end_layout - -\begin_layout Standard -Defines the scalar unit as it will appear in the scalar's metadata in an - output file. -\end_layout - -\begin_layout Subsection* -value (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -double -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: value -\end_layout - -\begin_layout Standard -Defines the value of a scalar. - If both, the label and the value, are set then only the label will be written - into a file. -\end_layout - -\begin_layout Subsection* -bounds (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -1D-array of double -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: bounds(:) -\end_layout - -\begin_layout Standard -Defines (two) scalar boundaries. - The array size must should be equal to 2. -\end_layout - -\begin_layout Subsection* -bounds_name (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: bounds_name -\end_layout - -\begin_layout Standard -Defines the name of scalar bounds as it will appear in a file. - If not defined, the name will be generated automatically based on the scalar - id. -\end_layout - -\begin_layout Subsection* -prec (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: prec -\end_layout - -\begin_layout Standard -Defines the precision in bytes of scalar value and boundaries as it will - be written into an output file. - Available values are: 2 (integer), 4 (float single precision) and 8 (float - double precision). - The default value is 8. -\end_layout - -\begin_layout Subsection* -label (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: label -\end_layout - -\begin_layout Standard -Defines the label of a scalar. - If both, the label and the value, are set then only the label will be output - into a file. -\end_layout - -\begin_layout Subsection* -scalar_ref (optional): string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: scalar_ref -\end_layout - -\begin_layout Standard -Defines the reference to a scalar. - All attributes will be inherited from the referenced scalar via the classical - inheritance mechanism. - The value assigned to the referenced scalar will be transmitted to the - current scalar. -\end_layout - -\begin_layout Subsection* -positive (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -enumeration {up, down} -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: positive -\end_layout - -\begin_layout Standard -Defines the positive direction for fields representing height or depth. -\end_layout - -\begin_layout Subsection* -axis_type (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -enumeration {X, Y, Z, T} -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: axis_type -\end_layout - -\begin_layout Standard -Defines the type of a (scalar) axis. - The values correspond to the following axis types: -\end_layout - -\begin_layout Itemize - -\series bold -\shape italic -X: -\series default -\shape default - longitude -\end_layout - -\begin_layout Itemize - -\series bold -\shape italic -\emph on -Y -\emph default -: -\series default -\shape default - latitude -\end_layout - -\begin_layout Itemize - -\series bold -\shape italic -\emph on -Z -\emph default -: -\series default -\shape default - vertical axis -\end_layout - -\begin_layout Itemize - -\series bold -\shape italic -T: -\series default -\shape default -time axis. -\end_layout - -\begin_layout Subsection* -comment: -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: comment -\end_layout - -\begin_layout Standard -Allows a user to set a comment. - -\end_layout - -\begin_layout Section -Axis attribute reference -\end_layout - -\begin_layout Subsection* -name (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: name -\end_layout - -\begin_layout Standard -Defines the name of a vertical axis as it will appear in an output file. - If not defined, the name will be generated automatically based on the axis - id. - If multiple vertical axes are defined in the same file, each axis must - have a unique name. - -\end_layout - -\begin_layout Subsection* -standard_name (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: standard_name -\end_layout - -\begin_layout Standard -Defines the standard name of a vertical axis as it will appear in the axis' - metadata in an output file. - -\end_layout - -\begin_layout Subsection* -long_name (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: long_name -\end_layout - -\begin_layout Standard -Defines the long name of a vertical axis as it will appear in the axis' - metadata in an output file. - -\end_layout - -\begin_layout Subsection* -unit (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: unit -\end_layout - -\begin_layout Standard -Defines the unit of an axis as it will appear in the axis' metadata in an - output file. -\end_layout - -\begin_layout Subsection* -dim_name (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: dim_name -\end_layout - -\begin_layout Standard -Defines the name of axis dimension as it will appear in the file's metadata. -\end_layout - -\begin_layout Subsection* -formula (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: formula -\end_layout - -\begin_layout Standard -Adds the formula attribute to a parametric vertical axis. -\end_layout - -\begin_layout Subsection* -formula_term (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: formula_term -\end_layout - -\begin_layout Standard -Adds the formula terms attribute to a parametric vertical axis. -\end_layout - -\begin_layout Subsection* -formula_bounds (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: formula_bounds -\end_layout - -\begin_layout Standard -Adds the formula attribute to the bounds of a parametric vertical axis. - The attribute is mandatory if the -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -formula -\end_layout - -\end_inset - - attribute is defined for the axis. -\end_layout - -\begin_layout Subsection* -formula_term_bounds (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: formula_term_bounds -\end_layout - -\begin_layout Standard -Adds the formula terms attribute to the bounds of a parametric vertical - axis. - The attribute is mandatory if the -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -formula -\end_layout - -\end_inset - - attribute is defined for the axis. -\end_layout - -\begin_layout Subsection* -n_glo (mandatory): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: n_glo -\end_layout - -\begin_layout Standard -Defines the global size of an axis. -\end_layout - -\begin_layout Subsection* -begin (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: begin -\end_layout - -\begin_layout Standard -Defines the beginning index of the local domain. - It can take value between 0 and -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -n_glo-1 -\end_layout - -\end_inset - -. - If not specified the default value is 0. -\end_layout - -\begin_layout Subsection* -n (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: zoom_size -\end_layout - -\begin_layout Standard -Defines the local size of an axis. - It can take value between 0 and -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -n_glo -\end_layout - -\end_inset - -. - If not specified the default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -n_glo -\end_layout - -\end_inset - -. - Local axis decomposition can be declared either with attributes -\series bold -\shape italic -{n, begin} -\series default -\shape default - or with -\series bold -\shape italic -index -\series default -\shape default -. -\end_layout - -\begin_layout Subsection* -index (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -1D-array of double -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: index(:) -\end_layout - -\begin_layout Standard -Defines the global indexes of a local axis held by each process. - If the attribute is specified, its array size must be equal to -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -n -\end_layout - -\end_inset - -. - Local axis decomposition can be declared either with attributes -\series bold -\shape italic -{n, begin} -\series default -\shape default - or with -\series bold -\shape italic -index -\series default -\shape default -. -\end_layout - -\begin_layout Subsection* -value (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -1D-array of double -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: value(:) -\end_layout - -\begin_layout Standard -Defines the value of each level of a vertical axis. - The array size must be equal to the value of the attribute -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -n -\end_layout - -\end_inset - -. - If the label is provided then only the label will be written into a file - and not the axis value and the axis boundaries. -\end_layout - -\begin_layout Subsection* -bounds (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -2D-array of double -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: bounds(:,:) -\end_layout - -\begin_layout Standard -Defines the boundaries of each level of a vertical axis. - The dimensions of the array must be -\begin_inset Formula $2\times n$ -\end_inset - -. -\end_layout - -\begin_layout Subsection* -bounds_name (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: bounds_name -\end_layout - -\begin_layout Standard -Defines the name of axis boundaries as it will appear in a file. - If not defined, the name will be generated automatically based on the axis - id. -\end_layout - -\begin_layout Subsection* -prec (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: prec -\end_layout - -\begin_layout Standard -Defines the precision in bytes of axis value and boundaries as it will be - written into an output file. - Available values are: 2 (integer), 4 (float single precision) and 8 (float - double precision). - The default value is 8. -\end_layout - -\begin_layout Subsection* -label (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER, ALLOCATABLE :: label(:) -\end_layout - -\begin_layout Standard -Defines the label of an axis. - The size of the array must be equal to the value of the attribute -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -n -\end_layout - -\end_inset - -. - If the label is provided then only the label will be written into a file - and not the axis value and the axis boundaries. -\end_layout - -\begin_layout Subsection* -data_begin (optional): -\emph on - integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: data_begin -\end_layout - -\begin_layout Standard -Defines the beginning index of local field data owned by each process. - The attribute is an offset relative to the local axis, so the value can - be negative. - A negative value indicates that only some valid part of the data will extracted -, for example in the case of a ghost cell. - A positive value indicates that the local domain is greater than the data - stored in memory. - The 0-value means that the local domain matches the data in memory. - The default value is 0. - The attributes -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -data_begin -\end_layout - -\end_inset - - and -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -data_n -\end_layout - -\end_inset - - must be defined together. -\end_layout - -\begin_layout Subsection* -data_n (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: data_n -\end_layout - -\begin_layout Standard -Defines the size of local field data. - The attribute can take value starting from 0 (no data on a process). - The default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -n -\end_layout - -\end_inset - -. - The attributes -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -data_begin -\end_layout - -\end_inset - - and -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -data_n -\end_layout - -\end_inset - - must be defined together. -\end_layout - -\begin_layout Subsection* -data_index (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: data_index -\end_layout - -\begin_layout Standard -In case of a compressed vertical axis, the attribute defines the position - of data points stored in the memory. - The array size has to be equal to -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -data_n -\end_layout - -\end_inset - -. - For example, for a local axis of size -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -n=3 -\end_layout - -\end_inset - - and local data size of -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -data_n=5 -\end_layout - -\end_inset - -, if -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -data_index=(/ -1, 2, 1, 0, -1 /) -\end_layout - -\end_inset - - then the first and the last data points are ghosts and only the three middle - values will be written in the reversed order. -\end_layout - -\begin_layout Subsection* -mask (optional): -\emph on -1D-array of bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: mask(:) -\end_layout - -\begin_layout Standard -Defines the mask of the local axis. - The masked value will be replaced by the value of the field attribute -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -default_value -\end_layout - -\end_inset - - in an output file. -\end_layout - -\begin_layout Subsection* -n_distributed_partition (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: n_distributed_partition -\end_layout - -\begin_layout Standard -Defines the number of local axes in case if the axis is generated automatically - by XIOS. - The default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -1 -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Subsection* -axis_ref (optional): string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: axis_ref -\end_layout - -\begin_layout Standard -Defines the reference of an axis. - All attributes will be inherited from the referenced axis with the classical - inheritance mechanism. - The value assigned to the referenced axis will be transmitted to the current - axis. -\end_layout - -\begin_layout Subsection* -positive (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -enumeration {up, down} -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: positive -\end_layout - -\begin_layout Standard -Defines the positive direction for fields representing height or depth. -\end_layout - -\begin_layout Subsection* -axis_type (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -enumeration {X, Y, Z, T} -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: axis_type -\end_layout - -\begin_layout Standard -Defines the type of an axis. - The values correspond to the following axis types: -\end_layout - -\begin_layout Itemize - -\series bold -\shape italic -X: -\series default -\shape default - longitude -\end_layout - -\begin_layout Itemize - -\series bold -\shape italic -\emph on -Y -\emph default -: -\series default -\shape default - latitude -\end_layout - -\begin_layout Itemize - -\series bold -\shape italic -\emph on -Z -\emph default -: -\series default -\shape default - vertical axis -\end_layout - -\begin_layout Itemize - -\series bold -\shape italic -T: -\series default -\shape default -time axis. -\end_layout - -\begin_layout Subsection* -comment (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: comment -\end_layout - -\begin_layout Standard -Allows a user to set a comment. - -\end_layout - -\begin_layout Section -Domain attribute reference -\end_layout - -\begin_layout Subsection* -name (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: name -\end_layout - -\begin_layout Standard -Defines the name of a horizontal domain. - This attribute may be used in case of multiple domains defined in the same - file. - In this case, the -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -name -\end_layout - -\end_inset - - attribute will be suffixed to the longitude and latitude dimensions and - axis name. - If the domain name is not provided, it will be generated automatically. -\end_layout - -\begin_layout Subsection* -standard_name (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: standard_name -\end_layout - -\begin_layout Standard -Defines the standard name of a domain as it will appear in the domain's - metadata in an output file. - -\end_layout - -\begin_layout Subsection* -long_name (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: long_name -\end_layout - -\begin_layout Standard -Defines the long name of a domain as it will appear in the domain's metadata - in an output file. - -\end_layout - -\begin_layout Subsection* -type (mandatory): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -enumeration {rectilinear, curvilinear, unstructured, gaussian} -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: type -\end_layout - -\begin_layout Standard -Defines the type of a grid. -\end_layout - -\begin_layout Subsection* -dim_i_name (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: dim_i_name -\end_layout - -\begin_layout Standard -Defines the name of the first domain dimension as it will appear in the - file's metadata. -\end_layout - -\begin_layout Subsection* -dim_j_name (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: dim_j_name -\end_layout - -\begin_layout Standard -Defines the name of the second domain dimension as it will appear in file's - metadata. -\end_layout - -\begin_layout Subsection* -ni_glo (mandatory): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: ni_glo -\end_layout - -\begin_layout Standard -Defines the size of the first dimension of the global domain. -\end_layout - -\begin_layout Subsection* -nj_glo (mandatory): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: nj_glo -\end_layout - -\begin_layout Standard -Defines the size of the second dimension of the global domain. -\end_layout - -\begin_layout Subsection* -ibegin (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: ibegin -\end_layout - -\begin_layout Standard -Defines the beginning index of the first dimension of a local domain. - The attribute takes value between -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -0 -\end_layout - -\end_inset - - and -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -ni_glo-1 -\end_layout - -\end_inset - -. - If not specified the default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -0 -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Subsection* -ni (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: ni -\end_layout - -\begin_layout Standard -Defines the size of the first dimension of a local domain. - The attribute takes value between -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -1 -\end_layout - -\end_inset - -and -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -ni_glo -\end_layout - -\end_inset - -. - If not specified the default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -ni_glo -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Subsection* -jbegin (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: jbegin -\end_layout - -\begin_layout Standard -Defines the beginning index of the second dimension of a local domain. - The attribute takes value between -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -0 -\end_layout - -\end_inset - - and -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -nj_glo-1 -\end_layout - -\end_inset - -. - If not specified the default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -0 -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Subsection* -nj (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: nj -\end_layout - -\begin_layout Standard -Defines the size of the second dimension of a local domain. - he attribute takes value between -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -1 -\end_layout - -\end_inset - -and -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -nj_glo -\end_layout - -\end_inset - -. - If not specified the default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -nj_glo -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Subsection* -lonvalue_1d (optional): -\emph on -1D-array of double -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: lonvalue(:) -\end_layout - -\begin_layout Standard -Defines the longitude values of a local domain. - For a cartesian grid, the array size should be -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -ni -\end_layout - -\end_inset - -. - For a curvilinear grid, the array size should be -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -ni -\begin_inset Formula $\times$ -\end_inset - -nj -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Subsection* -lonvalue_2d (optional): -\emph on -2D-array of double -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: lonvalue(:,:) -\end_layout - -\begin_layout Standard -Defines the longitude values of a local domain. - For cartesian and curvilinear grids the array size should be -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -ni -\begin_inset Formula $\times$ -\end_inset - -nj -\end_layout - -\end_inset - -. - Only lonvalue_1d or lonvalue_2d can be defined. - Also the layout of latitude and longitude should be in conformance with - each other: either 1D or 2D. -\end_layout - -\begin_layout Subsection* -latvalue_1d (optional): -\emph on -1D-array of double -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: latvalue(:) -\end_layout - -\begin_layout Standard -Defines the latitude values of a local domain. - For a cartesian grid, the size of the array will be nj. - For a curvilinear grid, the size of the array will be -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -ni -\begin_inset Formula $\times$ -\end_inset - -nj -\end_layout - -\end_inset - -. - -\end_layout - -\begin_layout Subsection* -latvalue_2d (optional): -\emph on -2D-array of double -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: latvalue(:,:) -\end_layout - -\begin_layout Standard -Defines the latitude values of a local domain. - For cartesian and curvilinear grids the array size should be -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -ni -\begin_inset Formula $\times$ -\end_inset - -nj -\end_layout - -\end_inset - -. - Only latvalue_1d or latvalue_2d can be defined. - Also the layout of latitude and longitude should be in conformance with - each other: either 1D or 2D. -\end_layout - -\begin_layout Subsection* -lon_name (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: lon_name -\end_layout - -\begin_layout Standard -Defines the longitude name as it will appear in an output file. -\end_layout - -\begin_layout Subsection* -lat_name (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: lat_name -\end_layout - -\begin_layout Standard -Defines the latitude name as it will appear in an output file. -\end_layout - -\begin_layout Subsection* -nvertex (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: nvertex -\end_layout - -\begin_layout Standard -Defines the maximum number of vertices for a grid. - The attribute is required for specifying the cell boundaries of unstructured - meshes. -\end_layout - -\begin_layout Subsection* -bounds_lon_1d (optional): -\emph on -2D-array of double -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: bounds_lon(:,:) -\end_layout - -\begin_layout Standard -Defines the longitude values of domain vertexes. - The attribute -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -nvertex -\end_layout - -\end_inset - - must be also defined. - The array dimensions must be -\begin_inset Formula $\textbf{nvertex}\times\textbf{ni}$ -\end_inset - -. -\end_layout - -\begin_layout Subsection* -bounds_lon_2d (optional): -\emph on -3D-array of double -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: bounds_lon(:,:,:) -\end_layout - -\begin_layout Standard -Defines the longitude values of domain vertexes. - The attribute -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -nvertex -\end_layout - -\end_inset - - must be also defined. - This attribute is useful when lonvalue_2d is defined. - The array dimensions must be -\begin_inset Formula $\textbf{nvertex}\times\textbf{ni}\times\textbf{nj}$ -\end_inset - -. - Either bounds_lon_1d or bounds_lon_2d can be defined. -\end_layout - -\begin_layout Subsection* -bounds_lat_1d (optional): -\emph on -2D-array of double -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: bounds_lat(:,:) -\end_layout - -\begin_layout Standard -Defines the latitude values of domain vertexes. - The attribute -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -nvertex -\end_layout - -\end_inset - - must be also defined. - The array dimensions must be -\begin_inset Formula $\textbf{nvertex}\times\textbf{ni}$ -\end_inset - -. -\end_layout - -\begin_layout Subsection* -bounds_lat_2d (optional): -\emph on -3D-array of double -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: bounds_lat(:,:) -\end_layout - -\begin_layout Standard -Defines the latitude values of domain vertexes. - The attribute -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -nvertex -\end_layout - -\end_inset - - must be also defined. - The attribute is useful when lonvalue_2d is defined. - The array dimensions must be -\begin_inset Formula $\textbf{nvertex}\times\textbf{ni}\times\textbf{nj}$ -\end_inset - -. - Either bounds_lon_1d or bounds_lon_2d can be defined. -\end_layout - -\begin_layout Subsection* -bounds_lon_name (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: lon_name -\end_layout - -\begin_layout Standard -Defines the longitude name of domain vertexes as it will appear in an output - file. -\end_layout - -\begin_layout Subsection* -bounds_lat_name (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: lat_name -\end_layout - -\begin_layout Standard -Defines the latitude name of domain vertexes as it will appear in an output - file. -\end_layout - -\begin_layout Subsection* -area (optional): -\emph on -2D-array of double -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: area(:,:) -\end_layout - -\begin_layout Standard -The area of cells. - The size of the array must be -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -ni -\begin_inset Formula $\times$ -\end_inset - -nj -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Subsection* -prec (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: prec -\end_layout - -\begin_layout Standard -Defines the precision in bytes of domain attributes. - Available values are: 2 (integer), 4 (float single precision) and 8 (float - double precision). - The default value of 8. -\end_layout - -\begin_layout Subsection* -data_dim (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: datadim -\end_layout - -\begin_layout Standard -Defines how a field is stored on memory for the client code. - The value can be either -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -1 -\end_layout - -\end_inset - - or -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -2 -\end_layout - -\end_inset - -. - The value of -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -1 -\end_layout - -\end_inset - - indicates that the horizontal layer of the field is stored as a 1D array. - The value of -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -2 -\end_layout - -\end_inset - - indicates that the horizontal layer is stored as a 2D array. - The default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -1 -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Subsection* -data_ibegin (optional): -\emph on - integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: data_ibegin -\end_layout - -\begin_layout Standard -Defines the beginning index of field data for the first dimension. - This attribute is an offset relative to the local domain, so the value - can be negative. - A negative value indicates that only some valid part of the data will extracted -, for example in the case of a ghost cell. - A positive value indicates that the local domain is greater than the data - stored in memory. - A 0-value means that the local domain matches the data in memory. - The default value is 0. - The attributes -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -data_ibegin -\end_layout - -\end_inset - - and -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -data_ni -\end_layout - -\end_inset - - must be defined together. -\end_layout - -\begin_layout Subsection* -data_ni (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: data_ni -\end_layout - -\begin_layout Standard -Defines the size of field data for the first dimension. - The default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -ni -\end_layout - -\end_inset - -. - The attributes -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -data_ibegin -\end_layout - -\end_inset - - and -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -data_ni -\end_layout - -\end_inset - - must be defined together. -\end_layout - -\begin_layout Subsection* -data_jbegin (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: data_jbegin -\end_layout - -\begin_layout Standard -Defines the beginning index of field data for the second dimension. - The attribute is taken into account only if -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout - data_dim=2 -\end_layout - -\end_inset - -. - The attribute is an offset relative to the local domain, so the value can - be negative. - A negative value indicate that only some valid part of the data will extracted, - for example in case of ghost cell. - A positive value indicate that the local domain is greater than the data - stored in memory. - The 0-value means that the local domain matches the data in memory. - The default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -0 -\end_layout - -\end_inset - -. - The attributes -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -data_jbegin -\end_layout - -\end_inset - - and -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -data_nj -\end_layout - -\end_inset - - must be defined together. -\end_layout - -\begin_layout Subsection* -data_nj (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: data_nj -\end_layout - -\begin_layout Standard -Defines the size of field data for the second dimension. - The attribute is taken account only if -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -data_dim=2 -\end_layout - -\end_inset - -. - The default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -nj -\end_layout - -\end_inset - -. - The attributes -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -data_jbegin -\end_layout - -\end_inset - - and -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -data_nj -\end_layout - -\end_inset - - must be defined together. -\end_layout - -\begin_layout Subsection* -data_i_index (optional): -\emph on -1D-array of integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: data_i_index(:) -\end_layout - -\begin_layout Standard -In case of a compressed horizontal domain, define the data indexation for - the first dimension. - The array size must be -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -data_n -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Subsection* -data_j_index (optional): -\emph on -1D-array of integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: data_j_index(:) -\end_layout - -\begin_layout Standard -In case of a compressed horizontal domain, defines the data indexation for - the second dimension. - The attribute is meaningful only if -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -data_dim=2 -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Subsection* -mask_1d (optional): -\emph on -1D-array of bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: mask(:) -\end_layout - -\begin_layout Standard -Defines the 1D mask of a local domain. - The masked value will be replaced by the value of the field attribute -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -default_value -\end_layout - -\end_inset - - in an output file. - This value is useful in case a field is stored linearly in memory. - By default none of the values are masked. -\end_layout - -\begin_layout Subsection* -mask_2d (optional): -\emph on -2D-array of bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: mask(:,:) -\end_layout - -\begin_layout Standard -Defines the 2D mask of a local domain. - The masked values will be replaced by the value of the field attribute - -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -default_value -\end_layout - -\end_inset - - in an output file. - By default, none of the values are masked. - Only mask_2d or mask_1d can be defined. -\end_layout - -\begin_layout Subsection* -domain_ref (optional): string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: domain_ref -\end_layout - -\begin_layout Standard -Defines the reference to a domain. - All attributes are inherited from the referenced domain with the classic - inheritance mechanism. - The value assigned to the referenced domain is transmitted to to current - domain. -\end_layout - -\begin_layout Subsection* -i_index (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -1D-array of double -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: i_index(:) -\end_layout - -\begin_layout Standard -Defines the global index of the first dimension of a local domain held by - a process. - By default the size of the array is equal to -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -ni*nj -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Subsection* -j_index (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -1D-array of double -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: j_index(:) -\end_layout - -\begin_layout Standard -Defines the global index of the second dimension of a local domain held - by a process. - By default the size of the array is equal to -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -ni*nj -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Subsection* -comment (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: comment -\end_layout - -\begin_layout Standard -Allows a user to set a comment. -\end_layout - -\begin_layout Section -Grid attribute reference -\end_layout - -\begin_layout Subsection* -name (optional): string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: name -\end_layout - -\begin_layout Standard -Defines the name of a grid. -\end_layout - -\begin_layout Subsection* -description (optional): string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: description -\end_layout - -\begin_layout Standard -Defines the descriptions of a grid. -\end_layout - -\begin_layout Subsection* -mask_1d (optional): -\emph on -1D-array of bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: mask_1d(:) -\end_layout - -\begin_layout Standard -Defines the mask of a local 1D grid. - Masked values will be replaced by the value of the field attribute -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -default_value -\end_layout - -\end_inset - - in an output file. - By default none of the value are masked. -\end_layout - -\begin_layout Subsection* -mask_2d (optional): -\emph on -2D-array of bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: mask_2d(:,:) -\end_layout - -\begin_layout Standard -Defines the mask of a local 2D grid. - Masked values will be replaced by the value of the field attribute -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -default_value -\end_layout - -\end_inset - - in an output file. - By default none of the value are masked. -\end_layout - -\begin_layout Subsection* -mask_3d (optional): -\emph on -3D-array of bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: mask_3d(:,:,:) -\end_layout - -\begin_layout Standard -Define the mask of a local 3D grid. - Masked values will be replaced by the value of the field attribute -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -default_value -\end_layout - -\end_inset - - in an output file. - By default none of the value are masked. -\end_layout - -\begin_layout Subsection* -mask_4d (optional): -\emph on -4D-array of bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: mask_4d(:,:,:) -\end_layout - -\begin_layout Standard -Define the mask of a local 4D grid. - Masked values will be replaced by the value of the field attribute -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -default_value -\end_layout - -\end_inset - - in an output file. - By default none of the value are masked. -\end_layout - -\begin_layout Subsection* -mask_5d (optional): -\emph on -5D-array of bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: mask_5d(:,:,:) -\end_layout - -\begin_layout Standard -Define the mask of a local 5D grid. - Masked values will be replaced by the value of the field attribute -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -default_value -\end_layout - -\end_inset - - in an output file. - By default none of the value are masked. -\end_layout - -\begin_layout Subsection* -mask_6d (optional): -\emph on -6D-array of bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: mask_6d(:,:,:) -\end_layout - -\begin_layout Standard -Define the mask of a local 6D grid. - Masked values will be replaced by the value of the field attribute -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -default_value -\end_layout - -\end_inset - - in an output file. - By default none of the value are masked. -\end_layout - -\begin_layout Subsection* -mask_7d (optional): -\emph on -7D-array of bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: mask_7d(:,:,:) -\end_layout - -\begin_layout Standard -Define the mask of a local 7D grid. - Masked values will be replaced by the value of the field attribute -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -default_value -\end_layout - -\end_inset - - in an output file. - By default none of the value are masked. -\end_layout - -\begin_layout Subsection* -comment (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: comment -\end_layout - -\begin_layout Standard -Allows a user to set a comment. -\end_layout - -\begin_layout Section -Field attribute reference -\end_layout - -\begin_layout Subsection* -name (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: name -\end_layout - -\begin_layout Standard -Defines the name of a field as it will appear in an output file. - If not present, the identifier -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -id -\end_layout - -\end_inset - - will be substituted. -\end_layout - -\begin_layout Subsection* -standard_name (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: standard_name -\end_layout - -\begin_layout Standard -Defines the -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -standard_name -\end_layout - -\end_inset - - attribute as it will appear in the metadata of an output file. -\end_layout - -\begin_layout Subsection* -long_name (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: long_name -\end_layout - -\begin_layout Standard -Defines the long name as it will appear in the metadata of an output file. -\end_layout - -\begin_layout Subsection* -expr (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: expr -\end_layout - -\begin_layout Standard -Defines the expression for arithmetic or time-integration operations performed - on a field. - For example if -\series bold -expr= -\begin_inset Quotes erd -\end_inset - -sqrt(@temp2 - pow(@temp, 2)) -\begin_inset Quotes erd -\end_inset - - -\series default - then the variance will be calculated on the incoming flux of the field - -\series bold -temp -\series default - (given that field temp2 that holds the square of temp was correctly defined). - -\end_layout - -\begin_layout Subsection* -unit (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: unit -\end_layout - -\begin_layout Standard -Defines the unit of a field. -\end_layout - -\begin_layout Subsection* -operation (mandatory): enumeration -\emph on - {once, instant, average, maximum, minimum, accumulate} -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: operation -\end_layout - -\begin_layout Standard -Defines the temporal operation applied to a field. -\end_layout - -\begin_layout Subsection* -freq_op (optional): -\emph on -duration -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -TYPE(xios_duration) :: freq_op -\end_layout - -\begin_layout Standard -Defines the sampling frequency of a temporal operation, so that field values - will be used for temporal sampling at frequency -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -freq_op -\end_layout - -\end_inset - -. - It is useful for sub-processes called at different frequency in a model. - The default value is equal to the file attribute -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -output_freq -\end_layout - -\end_inset - - for -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -instant -\end_layout - -\end_inset - - operations and -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -1ts -\end_layout - -\end_inset - - (1 time step) otherwise. -\end_layout - -\begin_layout Subsection* -freq_offset (optional): -\emph on -duration -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -TYPE(xios_duration) :: freq_offset -\end_layout - -\begin_layout Standard -Defines the offset when -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -freq_op -\end_layout - -\end_inset - - is defined. - Accepted values lie between -\series bold -0 -\series default - and -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -freq_op -\end_layout - -\end_inset - -. - The default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -freq_op - 1ts -\end_layout - -\end_inset - - for fields in the -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -write -\end_layout - -\end_inset - - mode and -\series bold -0 -\series default - for fields in the -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -read -\end_layout - -\end_inset - - mode. -\end_layout - -\begin_layout Subsection* -level (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: level -\end_layout - -\begin_layout Standard -Defines the output level of a field. - The field will be output only if the file attribute -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout - output_level -\begin_inset Formula $\geq$ -\end_inset - -level -\end_layout - -\end_inset - -. - The default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -0 -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Subsection* -prec (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: prec -\end_layout - -\begin_layout Standard -Defines the precision in bytes of a field in an output file. - Available values are: 2 (integer), 4 (float single precision) and 8 (float - double precision). - The default value of 8. -\end_layout - -\begin_layout Subsection* -enabled (optional): -\emph on -bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: enabled -\end_layout - -\begin_layout Standard -Defines if a field must be output or not. - The default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -true -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Subsection* -check_if_active (optional): -\emph on -bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: check_if_active -\end_layout - -\begin_layout Standard -Sets a check if a field will be used at a given time step. - Activating the check may improve performance for fields which are not used - frequently, while it can detoriate performance for fields used at each - time step. - The default value is false. -\end_layout - -\begin_layout Subsection* -read_access (optional): -\emph on -bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: read_access -\end_layout - -\begin_layout Standard -Defines whether a field can be read from the model or not. - The default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -false -\end_layout - -\end_inset - -. - Note that for fields belonging to a file in -\series bold -\emph on -read -\series default -\emph default - -\series bold -mode -\series default -, this attribute is always -\series bold -true -\series default -. -\end_layout - -\begin_layout Subsection* -field_ref (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: field_ref -\end_layout - -\begin_layout Standard -Defines the field reference. - All attributes will be inherited from the referenced field via the classical - inheritance mechanism. - The values assigned to the referenced field will be transmitted to the - current field to perform temporal operation. -\end_layout - -\begin_layout Subsection* -grid_ref (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: grid_ref -\end_layout - -\begin_layout Standard -Defines the field grid. - Note that only either -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -grid_ref -\end_layout - -\end_inset - - or a combination of -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -domain_ref -\end_layout - -\end_inset - -, -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -scalar_ref -\end_layout - -\end_inset - - or -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -axis_ref -\end_layout - -\end_inset - - can be specified. -\end_layout - -\begin_layout Subsection* -domain_ref (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: domain_ref -\end_layout - -\begin_layout Standard -Defines the field domain. - If the attribute is defined, the attribute -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -grid_ref -\end_layout - -\end_inset - - must not be specified. -\end_layout - -\begin_layout Subsection* -axis_ref (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: axis_ref -\end_layout - -\begin_layout Standard -Defines an axis for the current field. - If the attribute is defined, the attribute -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -grid_ref -\end_layout - -\end_inset - - must not be specified. -\end_layout - -\begin_layout Subsection* -scalar_ref (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: scalar_ref -\end_layout - -\begin_layout Standard -Defines a scalar domain for the current field. - If the attribute is defined, the attribute -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -grid_ref -\end_layout - -\end_inset - - must not be specified. -\end_layout - -\begin_layout Subsection* -grid_path (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: grid_path -\end_layout - -\begin_layout Standard -Defines the way operations pass from a grid to other grids. -\end_layout - -\begin_layout Subsection* -default_value (optional): -\emph on -double -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: default_value -\end_layout - -\begin_layout Standard -Defines the value which will be used instead of missing field data. - If no value is provided, the missing data will be replaced by uninitialized - values what can lead to undefined behavior. -\end_layout - -\begin_layout Subsection* -valid_min (optional): -\emph on -double -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: valid_min -\end_layout - -\begin_layout Standard -All field values below -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -valid_min -\end_layout - -\end_inset - - attribute value will be set to missing value. -\end_layout - -\begin_layout Subsection* -valid_max (optional): -\emph on -double -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: valid_max -\end_layout - -\begin_layout Standard -All field values above -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -valid_max -\end_layout - -\end_inset - - attribute value will be set to missing value. -\end_layout - -\begin_layout Subsection* -detect_missing_value (optional): -\emph on -bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL: detect_missing_value -\end_layout - -\begin_layout Standard -When XIOS detects a default value in a field, it does not take into account - the value during arithmetic operations such as averaging, minimum, maximum, - etc. -\end_layout - -\begin_layout Subsection* -add_offset (optional): -\emph on -double -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION: add_offset -\end_layout - -\begin_layout Standard -Sets the -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -add_offset -\end_layout - -\end_inset - - metadata CF attribute in an output file. - In output, the -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -add_offset -\end_layout - -\end_inset - - value will be subtracted from the field values. -\end_layout - -\begin_layout Subsection* -scale_factor: -\emph on -double -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION: scale_factor -\end_layout - -\begin_layout Standard -Sets the -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -scale_factor -\end_layout - -\end_inset - - metadata CF attribute in an output file. - In output, the field values will be divided by the -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -scale_factor -\end_layout - -\end_inset - - value. -\end_layout - -\begin_layout Subsection* -compression_level (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: compression_level -\end_layout - -\begin_layout Standard -Defines whether a field should be compressed using NetCDF-4 built-in compression. - The compression level must range from 0 to 9. - A higher compression level means a better compression at the cost of using - more processing power. - The default value is inherited from the file attribute -\series bold -compression_level -\series default -. -\end_layout - -\begin_layout Subsection* -indexed_output (optional): -\emph on -bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: indexed_output -\end_layout - -\begin_layout Standard -Defines whether field data must be output as an indexed grid instead of - a full grid whenever possible. - The default value is -\series bold -\emph on -false -\series default -\emph default -. -\end_layout - -\begin_layout Subsection* -ts_enabled (optional): -\emph on -bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: ts_enabled -\end_layout - -\begin_layout Standard -Defines whether a field can be output as a timeseries. - The default value is -\series bold -\emph on -false -\series default -\emph default -. -\end_layout - -\begin_layout Subsection* -ts_split_freq (optional): -\emph on -duration -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -TYPE(xios_duration) :: ts_split_freq -\end_layout - -\begin_layout Standard -Defines the splitting frequency that should be used for a timeseries if - it has been requested. - By default the attribute value is inherited from the file attribute -\series bold -split_freq -\series default -. -\end_layout - -\begin_layout Subsection* -cell_methods (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: cell_methods -\end_layout - -\begin_layout Standard -Defines the cell methods field attribute. -\end_layout - -\begin_layout Subsection* -cell_methods_mode (optional): enumeration -\emph on - {overwrite, prefix, suffix, none} -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: cell_methods_mode -\end_layout - -\begin_layout Standard -Defines the cell methods mode of a field. -\end_layout - -\begin_layout Subsection* -comment (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: comment -\end_layout - -\begin_layout Standard -Allows a user to set a comment. -\end_layout - -\begin_layout Section -Variable attribute reference -\end_layout - -\begin_layout Subsection* -name (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: name -\end_layout - -\begin_layout Standard -Defines the name of a variable as it will appear in an output file. - If not present, the variable -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -id -\end_layout - -\end_inset - - will be used. -\end_layout - -\begin_layout Subsection* -type (mandatory): enumeration {bool, int, int32, int16, int64, float, double, - string} -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: type -\end_layout - -\begin_layout Standard -Defines the type of a variable. - Note that the -\series bold -\emph on -int -\series default -\emph default - type is a synonym for -\series bold -\emph on -int32 -\series default -\emph default -. -\end_layout - -\begin_layout Subsection* -ts_target (optional): enumeration {file, field, both, none} -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: ts_target -\end_layout - -\begin_layout Section -File attribute reference -\end_layout - -\begin_layout Subsection* -name (mandatory): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: name -\end_layout - -\begin_layout Standard -Defines the name of a file. -\end_layout - -\begin_layout Subsection* -description (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: description -\end_layout - -\begin_layout Standard -Defines the description of a file. -\end_layout - -\begin_layout Subsection* -name_suffix (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: name_suffix -\end_layout - -\begin_layout Standard -Defines a suffix added to the file name. -\end_layout - -\begin_layout Subsection* -min_digits (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: min_digits -\end_layout - -\begin_layout Standard -For the -\series bold -multiple_file -\series default - mode defines the minimum number of digits of the suffix describing the - server rank which will be appended to the file name. - The default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -0 -\end_layout - -\end_inset - - (no server rank suffix is added). -\end_layout - -\begin_layout Subsection* -output_freq (mandatory): -\emph on -duration -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -TYPE(xios_duration) :: output_freq -\end_layout - -\begin_layout Standard -Defines the output frequency for the current file. -\end_layout - -\begin_layout Subsection* -output_level (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: output_level -\end_layout - -\begin_layout Standard -Defines the output level for all fields of the current file. - The field is output only if the field attribute -\series bold -level -\series default - is less or equal to the file attribute -\series bold -output_level -\series default -. -\end_layout - -\begin_layout Subsection* -sync_freq (optional): -\emph on -duration -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -TYPE(xios_duration) :: sync_freq -\end_layout - -\begin_layout Standard -Defines the frequency for flushing the current file onto a disk. - It may result in poor performances but data will be written even if a file - is not yet closed. -\end_layout - -\begin_layout Subsection* -split_freq (optional): -\emph on -duration -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -TYPE(xios_duration) :: split_freq -\end_layout - -\begin_layout Standard -Defines the frequency for splitting the current file. - The start and end dates will be added to the file name (see -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout - -\series bold -\emph on -split_freq_format -\end_layout - -\end_inset - - attribute). - By default no splitting is done. -\end_layout - -\begin_layout Subsection* -split_freq_format (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: split_freq_format -\end_layout - -\begin_layout Standard -Defines the format of the split date suffixed to a file. - It can contain any character, -\emph on - -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -%y -\end_layout - -\end_inset - - -\emph default - will be replaced by the year (4 characters), -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -%mo -\end_layout - -\end_inset - - by the month (2 char), -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -%d -\end_layout - -\end_inset - - by the day (2 char), -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -%h -\end_layout - -\end_inset - - by the hour (2 char), -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -%mi -\end_layout - -\end_inset - - by the minute (2 char), -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -%s -\end_layout - -\end_inset - - by the second (2 char), -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -%S -\end_layout - -\end_inset - - by the number of seconds since the time origin and -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -%D -\end_layout - -\end_inset - - by the number of full days since the time origin. - The default behavior is to create a suffix with the date until the smaller - non zero unit. - For example, in one day split frequency, the hour, minute and second will - not appear in the suffix, only year, month and day. -\end_layout - -\begin_layout Subsection* -split_start_offset(optional): -\emph on -duration -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -TYPE(xios_duration) :: split_start_offset -\end_layout - -\begin_layout Standard -Defines the offset of file splitting. - -\end_layout - -\begin_layout Subsection* -split_end_offset(optional): -\emph on -duration -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -TYPE(xios_duration) :: split_end_offset -\end_layout - -\begin_layout Subsection* -split_last_date (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: split_last_date -\end_layout - -\begin_layout Subsection* -enabled (optional): -\emph on -bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: enabled -\end_layout - -\begin_layout Standard -Defines if a file must be written/read or not. - The default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -true -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Subsection* -mode (optional): -\emph on -enumeration {read, write} -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: mode -\end_layout - -\begin_layout Standard -Defines whether a file will be read or written. - The default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -write -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Subsection* -type (mandatory): -\emph on -enumeration {one_file, multiple_file} -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: type -\end_layout - -\begin_layout Standard -Defines the type of a file: -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout - -\emph on -multiple_file -\end_layout - -\end_inset - -: one file by server using sequential netcdf writing, -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout - -\emph on -one_file -\end_layout - -\end_inset - -: one single global file is wrote using netcdf4 parallel access. -\end_layout - -\begin_layout Subsection* -format (optional): -\emph on -enumeration {netcdf4, netcdf4_classic} -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: format -\end_layout - -\begin_layout Standard -Define the format of a file: -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout - -\emph on -netcdf4 -\end_layout - -\end_inset - -: the HDF5 format will be used, -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout - -\emph on -netcdf4 -\emph default -_ -\emph on -classic -\end_layout - -\end_inset - -: the classic NetCDF format will be used. - The default value is -\series bold -\emph on -netcdf4 -\series default -\emph default -. - Note that the -\series bold -\emph on -netcdf4 -\emph default -_ -\emph on -classic -\series default -\emph default - format can be used with the attribute -\series bold -type -\series default - set to -\series bold -\emph on -one_file -\series default -\emph default - only if the NetCDF4 library was compiled with Parallel NetCDF support (--enable --pnetcdf). -\end_layout - -\begin_layout Subsection* -par_access (optional): -\emph on -enumeration {collective, independent} -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: par_access -\end_layout - -\begin_layout Standard -For parallel writing, defines which type of MPI calls will be used. - The default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout - -\emph on -collective -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Subsection* -read_metadata_par (optional): -\emph on -bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: read_metadata_par -\end_layout - -\begin_layout Standard -For files in the read mode, defines if parallel or serial I/O will be used - by model processes for reading file metadata. - The default value is false implying serial I/O for reading metadata. -\end_layout - -\begin_layout Subsection* -convention (optional): -\emph on -enumeration {CF, UGRID} -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: convention -\end_layout - -\begin_layout Standard -Defines the file conventions. - By default the CF conventions are followed. -\end_layout - -\begin_layout Subsection* -convention_str (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: convention_str -\end_layout - -\begin_layout Standard -Defines the -\series bold -Conventions -\series default -attribute to be added to file global attributes. -\end_layout - -\begin_layout Subsection* -append (optional): -\emph on -bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: append -\end_layout - -\begin_layout Standard -Defines whether data is to be appended at the end of a file if it already - exists or if the existing file is to be overwritten. - The default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout - -\emph on -false -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Subsection* -compression_level (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: compression_level -\end_layout - -\begin_layout Standard -Defines whether the fields should be compressed using NetCDF-4 built-in - compression by default. - The compression level must range from 0 to 9. - A higher compression level means a better compression at the cost of using - more processing power. - The default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout - -\emph on -0 -\end_layout - -\end_inset - - (no compression). -\end_layout - -\begin_layout Subsection* -time_counter (optional): -\emph on -enumeration {centered, instant, record, exclusive, centered_exclusive, instant_e -xclusive, none} -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: time_counter -\end_layout - -\begin_layout Standard -Defines how the -\begin_inset Quotes eld -\end_inset - -time_counter -\begin_inset Quotes erd -\end_inset - - variable will be output: -\end_layout - -\begin_layout Itemize - -\series bold -\emph on -centered -\series default -\emph default -: use centered times (default option for all field operations except for - instant) -\end_layout - -\begin_layout Itemize - -\series bold -\emph on -instant -\series default -\emph default -: use instant times (default option for field operation -\series bold -instant -\series default -) -\end_layout - -\begin_layout Itemize - -\series bold -\emph on -record -\series default -\emph default -: use record indexes -\end_layout - -\begin_layout Itemize - -\series bold -\shape italic -centered_exclusive: -\series default -\shape default -do not include centered times into an output file -\end_layout - -\begin_layout Itemize - -\series bold -\shape italic -\emph on -instant_ -\emph default -exclusive: -\series default -\shape default -do not include instant times into an output file -\end_layout - -\begin_layout Itemize - -\series bold -\shape italic -exclusive: -\series default -\shape default -include neither instant times nor centered times into an output file -\end_layout - -\begin_layout Itemize - -\series bold -\emph on -none -\series default -\emph default -: do not output the variable. -\end_layout - -\begin_layout Standard -The default value is -\series bold -\emph on -centered -\series default -\emph default -. -\end_layout - -\begin_layout Subsection* -time_counter_name (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: time_counter_name -\end_layout - -\begin_layout Standard -Define the name of a time counter. -\end_layout - -\begin_layout Subsection* -timeseries (optional): -\emph on -enumeration {none, only, both, exclusive} -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: time_series -\end_layout - -\begin_layout Standard -Defines whether the timeseries must be output: -\end_layout - -\begin_layout Itemize - -\series bold -\emph on -none -\series default -\emph default -: no timeseries is outputted, only the regular file -\end_layout - -\begin_layout Itemize - -\series bold -\emph on -only -\series default -\emph default -: only the timeseries is outputted, the regular file is not created -\end_layout - -\begin_layout Itemize - -\series bold -\emph on -both -\series default -\emph default -: both the timeseries and the regular file are outputted. -\end_layout - -\begin_layout Itemize - -\series bold -\emph on -exclusive -\series default -\emph default -: the timeseries is outputted and a regular file is created with only the - fields which were not marked for output as a timeseries (if any). -\end_layout - -\begin_layout Standard -The default value is -\series bold -\emph on -none -\series default -\emph default -. -\end_layout - -\begin_layout Subsection* -ts_prefix (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: ts_prefix -\end_layout - -\begin_layout Standard -Defines the prefix to use for the name of the timeseries files. - By default the file name will be used. -\end_layout - -\begin_layout Subsection* -time_units (optional): -\emph on -enumeration {seconds, days} -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: time_units -\end_layout - -\begin_layout Subsection* -record_offset (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: record_offset -\end_layout - -\begin_layout Standard -Defines the offset of a record from the beginning record. - The default value is 0. -\end_layout - -\begin_layout Subsection* -cyclic (optional): -\emph on -bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: cyclic -\end_layout - -\begin_layout Standard -If the option is activated for fields to be read, then upon reaching the - last time record, reading will continue -\begin_inset Quotes eld -\end_inset - -cycle -\begin_inset Quotes erd -\end_inset - - at the first time record. - The default value is false. -\end_layout - -\begin_layout Subsection* -time_stamp_name (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: time_stamp_name -\end_layout - -\begin_layout Standard -Defines the timestamp name of the date and time when the program was executed - which will be written into an output file. - The default value is -\begin_inset Quotes eld -\end_inset - -timeStamp -\begin_inset Quotes erd -\end_inset - -. -\end_layout - -\begin_layout Subsection* -time_stamp_format (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: time_stamp_format -\end_layout - -\begin_layout Standard -Defines the timestamp format of the date and time when the program was executed - to be written into an output file. - It can contain any character. - -\emph on - -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -%Y -\end_layout - -\end_inset - - -\emph default - will be replaced by the 4-digit year (4 digits), while -\emph on - -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -%y -\end_layout - -\end_inset - - -\emph default - will be replaced by the 2-digit year. - -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -%m -\end_layout - -\end_inset - - will be by the 2-digit month, while %b will be replaced by the 3-character - month. - -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -%d -\end_layout - -\end_inset - - will be replaced by the day (2 char), -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -%H -\end_layout - -\end_inset - - by the hour (2 char), -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -%M -\end_layout - -\end_inset - - by the minute (2 char), -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -%S -\end_layout - -\end_inset - - by the number of seconds, -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -%D -\end_layout - -\end_inset - - by the date in the MM/DD/YY format. -\end_layout - -\begin_layout Subsection* -uuid_name (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: uuid_name -\end_layout - -\begin_layout Standard -Defines the name of file's UUID. -\end_layout - -\begin_layout Subsection* -uuid_format (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: uuid_format -\end_layout - -\begin_layout Standard -Defines the format of file's UUID. -\end_layout - -\begin_layout Subsection* -comment (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -string -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: comment -\end_layout - -\begin_layout Standard -Allows a user to set a comment. -\end_layout - -\begin_layout Section -Transformation attribute reference -\end_layout - -\begin_layout Subsection -reduce_scalar_to_scalar -\end_layout - -\begin_layout Subsection* -operation (mandatory): -\emph on -enumeration {min, max, sum, average} -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: operation -\end_layout - -\begin_layout Standard -Defines a reduction operation performed on a scalar across model processes. - (It is analogous to MPI_Allreduce.) -\end_layout - -\begin_layout Subsection -extract_axis_to_scalar -\end_layout - -\begin_layout Subsection* -position: -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: position -\end_layout - -\begin_layout Standard -Global index of a point on an axis to be extracted into a scalar. -\end_layout - -\begin_layout Standard - -\end_layout - -\begin_layout Subsection -interpolate_axis -\end_layout - -\begin_layout Subsection* -type (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: type -\end_layout - -\begin_layout Standard -Defines the interpolation type on an axis. - For now only polynomial interpolation is available. -\end_layout - -\begin_layout Subsection* -order (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: order -\end_layout - -\begin_layout Standard -Defines the order of interpolation. - The default value is 2. -\end_layout - -\begin_layout Subsection* -coordinate (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: coordinate -\end_layout - -\begin_layout Standard -Defines the coordinate associated with an axis on which interpolation will - be performed. -\end_layout - -\begin_layout Subsection -reduce_axis_to_axis -\end_layout - -\begin_layout Subsection* -operation (mandatory): -\emph on -enumeration {min, max, sum, average} -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: operation -\end_layout - -\begin_layout Standard -Defines a reduction operation performed on an axis across model processes. - (It is analogous to MPI_Allreduce.) -\end_layout - -\begin_layout Subsection -reduce_axis_to_scalar -\end_layout - -\begin_layout Standard -Reduces data defined on an axis into a scalar value. -\end_layout - -\begin_layout Subsection* -operation (mandatory): -\emph on -enumeration {min, max, sum, average} -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: operation -\end_layout - -\begin_layout Subsection -zoom_axis -\end_layout - -\begin_layout Subsection* -begin (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: begin -\end_layout - -\begin_layout Standard -Defines the beginning index of a zoomed region on a global axis. - The attribute value should be an integer between -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -0 -\end_layout - -\end_inset - - and -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -ni_glo-1 -\end_layout - -\end_inset - - of the associated axis. - If not specified the default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -0 -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Subsection* -n (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: n -\end_layout - -\begin_layout Standard -Defines the size of a zoomed region on a global axis. - The attribute value should be an integer between -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -1 -\end_layout - -\end_inset - -and -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -nj_glo -\end_layout - -\end_inset - - of the associated axis. - If not specified the default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -nj_glo -\end_layout - -\end_inset - - of the associated axis. -\end_layout - -\begin_layout Subsection -compute_connectivity_domain -\end_layout - -\begin_layout Subsection* -n_neighbor: -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -1D-array of integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: n_neighbor(:) -\end_layout - -\begin_layout Subsection* -local_neighbor: -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -2D-array of integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: local_neighbor(:,:) -\end_layout - -\begin_layout Subsection* -n_neighbor_max: -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: n_neighbor_max -\end_layout - -\begin_layout Subsection -extract_domain_to_axis -\end_layout - -\begin_layout Subsection* -position (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: position -\end_layout - -\begin_layout Standard -Defines the index on a domain starting which an axis will be extracted along - the direction specified with the -\series bold -direction -\series default - attribute. -\end_layout - -\begin_layout Subsection* -direction (mandatory): -\emph on -enumeration {iDir, jDir} -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: direction -\end_layout - -\begin_layout Standard -Defines the domain dimension along which an axis will be extracted. -\end_layout - -\begin_layout Subsection -interpolate_domain -\end_layout - -\begin_layout Subsection* -file (optional): -\emph on -string -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: type -\end_layout - -\begin_layout Standard -Define a file which contains the weight values for interpolation from domain - source to domain destination. - If not specified, the internal interpolation module will be used. -\end_layout - -\begin_layout Subsection* -order (optional): -\emph on -integer -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: order -\end_layout - -\begin_layout Standard -Defines the order of interpolation. - This attribute is only for internal interpolation module. - The default value is 2. -\end_layout - -\begin_layout Subsection -reduce_domain_to_axis -\end_layout - -\begin_layout Subsection* -direction: -\emph on -enumeration {iDir, jDir} -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: direction -\end_layout - -\begin_layout Standard -Defines the domain dimension along which a reduction of the domain into - an axis will be performed. -\end_layout - -\begin_layout Subsection* -operation (mandatory): -\emph on -enumeration {min, max, sum, average} -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: operation -\end_layout - -\begin_layout Subsection* -local: -\emph on -bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: local -\end_layout - -\begin_layout Standard -Defines whether the reduction should be performed locally on data owned - by each process. -\end_layout - -\begin_layout Subsection -reduce_domain_to_scalar -\end_layout - -\begin_layout Standard -Reduces data defined on a domain into a scalar value. -\end_layout - -\begin_layout Subsection* -operation (mandatory): -\emph on -enumeration {min, max, sum, average} -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: operation -\end_layout - -\begin_layout Subsection* -local: -\emph on -bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: local -\end_layout - -\begin_layout Standard -Defines whether the reduction should be performed locally on data owned - by each process. -\end_layout - -\begin_layout Subsection -reorder_domain -\end_layout - -\begin_layout Subsection* -invert_lat (optional): -\emph on -bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: invert_lat -\end_layout - -\begin_layout Standard -Defines whether the latitude should be inverted. - The default value is false. -\end_layout - -\begin_layout Subsection* -shift_lon_fraction (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -double -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: shift_lon_fraction -\end_layout - -\begin_layout Standard -Defines the longitude offset. - The value of the parameter represents a fraction of -\series bold -ni_glo -\series default -. -\end_layout - -\begin_layout Subsection* -min_lon (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -double -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: min_lon -\end_layout - -\begin_layout Standard -If both, -\series bold -min_lon -\series default - and -\series bold -max_lon -\series default -, are defined, a domain will be reordered with latitude values starting - from -\series bold -min_lon -\series default - and ending at -\series bold -max_lon -\series default -. -\end_layout - -\begin_layout Subsection* -max_lon (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -double -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: max_lon -\end_layout - -\begin_layout Standard -If both, -\series bold -min_lon -\series default - and -\series bold -max_lon -\series default -, are defined, a domain will be reordered with latitude values starting - from -\series bold -min_lon -\series default - and ending at -\series bold -max_lon -\series default -. -\end_layout - -\begin_layout Subsection -expand_domain -\end_layout - -\begin_layout Subsection* -order: -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: order -\end_layout - -\begin_layout Subsection* -type (optional): -\emph on -enumeration {node, edge} -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*) :: type -\end_layout - -\begin_layout Standard -Defines whether the node or edge connectivity should be calculated for the - expanded domain. -\end_layout - -\begin_layout Subsection* -i_periodic (optional): -\emph on -bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: i_periodic -\end_layout - -\begin_layout Standard -If the attribute value is true, values of fields defined on the expanded - domain will be duplicated from those of the original domain periodically - along the first dimension. - The default value is false (masked values on the expanded domain). -\end_layout - -\begin_layout Subsection* -j_periodic (optional): -\emph on -bool -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -LOGICAL :: j_periodic -\end_layout - -\begin_layout Standard -If the attribute value is true, values of fields defined on the expanded - domain will be duplicated from those of the original domain periodically - along the second dimension. - The default value is false (masked values on the expanded domain). -\end_layout - -\begin_layout Subsection -zoom_domain -\end_layout - -\begin_layout Subsection* -ibegin (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: ibegin -\end_layout - -\begin_layout Standard -Defines the beginning index of the zoomed region on the first dimension - of the global domain. - This must be an integer between -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -0 -\end_layout - -\end_inset - - and -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -ni_glo-1 -\end_layout - -\end_inset - - of the associated dimension of domain. - If not specified the default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -0 -\end_layout - -\end_inset - -. - Note that if one of the zoom attributes (ibegin, ni, jbegin or nj) is defined - then all the rest should be specified by a user as well. -\end_layout - -\begin_layout Subsection* -ni (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: ni -\end_layout - -\begin_layout Standard -Define the size of zoomed region on the first dimension of the global domain. - This must be an integer between -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -1 -\end_layout - -\end_inset - -and -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -ni_glo -\end_layout - -\end_inset - - of the associated dimension of domain. - If not specified the default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -ni_glo -\end_layout - -\end_inset - - of the dimension of domain. - Note that if one of the zoom attributes (ibegin, ni, jbegin or nj) is defined - then all the rest should be specified by a user as well. -\end_layout - -\begin_layout Subsection* -jbegin (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: jbegin -\end_layout - -\begin_layout Standard -Define the beginning index of the zoomed region on the second dimension - of the global domain. - This must be an integer between -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -0 -\end_layout - -\end_inset - - and -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -nj_glo-1 -\end_layout - -\end_inset - - of the associated dimension of domain. - If not specified the default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -0 -\end_layout - -\end_inset - -. - Note that if one of the zoom attributes (ibegin, ni, jbegin or nj) is defined - then all the rest should be specified by a user as well. -\end_layout - -\begin_layout Subsection* -nj (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -integer -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -INTEGER :: nj -\end_layout - -\begin_layout Standard -Define the size of zoomed region on the second dimension of the global domain. - The attribute value should be an integer between -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -1 -\end_layout - -\end_inset - -and -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -nj_glo -\end_layout - -\end_inset - - of the associated dimension of domain. - If not specified the default value is -\begin_inset Flex Strong -status collapsed - -\begin_layout Plain Layout -nj_glo -\end_layout - -\end_inset - - of the dimension of domain. - Note that if one of the zoom attributes (ibegin, ni, jbegin or nj) is defined - then all the rest should be specified by a user as well. -\end_layout - -\begin_layout Subsection -generate_rectilinear_domain -\end_layout - -\begin_layout Subsection* -lon_start (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -double -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: lon_start -\end_layout - -\begin_layout Standard -Along with -\series bold -lon_end -\series default -, the attribute defines the longitude range of a generated domain. -\end_layout - -\begin_layout Subsection* -lon_end (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -double -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: lon_end -\end_layout - -\begin_layout Standard -Along with -\series bold -lon_start -\series default -, the attribute defines the longitude range of a generated domain. -\end_layout - -\begin_layout Subsection* -lat_start (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -double -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: lat_start -\end_layout - -\begin_layout Standard -Along with -\series bold -lat_end -\series default -, the attribute defines the latitude range of a generated domain. -\end_layout - -\begin_layout Subsection* -lat_end (optional): -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -double -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: lat_end -\end_layout - -\begin_layout Standard -Along with -\series bold -lat_start -\series default -, the attribute defines the latitude range of a generated domain. -\end_layout - -\begin_layout Subsection* -bounds_lon_start: -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -double -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: bounds_lon_start -\end_layout - -\begin_layout Standard -Attributes -\series bold -bounds_lon_start -\series default - and -\series bold -bounds_lon_start -\series default - set the longitude range of a generated domain. - If both sets, -\series bold -(lon_start, lon_end) -\series default - and -\series bold -(bounds_lon_start, bounds_lon_end) -\series default -, are specified then the bound attributes will be ignored. -\end_layout - -\begin_layout Subsection* -bounds_lon_end: -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -double -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: bounds_lon_end -\end_layout - -\begin_layout Standard -Attributes -\series bold -bounds_lon_start -\series default - and -\series bold -bounds_lon_start -\series default - set the longitude range of a generated domain. - If both sets, -\series bold -(lon_start, lon_end) -\series default - and -\series bold -(bounds_lon_start, bounds_lon_end) -\series default -, are specified then the bound attributes will be ignored. -\end_layout - -\begin_layout Subsection* -bounds_lat_start: -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -double -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: bounds_lat_start -\end_layout - -\begin_layout Standard -Attributes -\series bold -bounds_lat_start -\series default - and -\series bold -bounds_lat_start -\series default - set the latitude range of a generated domain. - If both sets, -\series bold -(lat_start, lat_end) -\series default - and -\series bold -(bounds_lat_start, bounds_lat_end) -\series default -, are specified then the bound attributes will be ignored. -\end_layout - -\begin_layout Subsection* -bounds_lat_end: -\begin_inset Flex Emph -status collapsed - -\begin_layout Plain Layout -double -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Fortran: -\end_layout - -\begin_layout LyX-Code -DOUBLE PRECISION :: bounds_lat_end -\end_layout - -\begin_layout Standard -Attributes -\series bold -bounds_lat_start -\series default - and -\series bold -bounds_lat_start -\series default - set the latitude range of a generated domain. - If both sets, -\series bold -(lat_start, lat_end) -\series default - and -\series bold -(bounds_lat_start, bounds_lat_end) -\series default -, are specified then the bound attributes will be ignored. -\end_layout - -\begin_layout Chapter -Fortran interface reference -\end_layout - -\begin_layout Section* -Initialization -\end_layout - -\begin_layout Subsection* -XIOS initialization -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_initialize(client_id, local_comm, return_comm) -\end_layout - -\begin_layout LyX-Code - CHARACTER(LEN=*),INTENT(IN) :: client_id -\end_layout - -\begin_layout LyX-Code - INTEGER,INTENT(IN),OPTIONAL :: local_comm -\end_layout - -\begin_layout LyX-Code - INTEGER,INTENT(OUT),OPTIONAL :: return_comm -\end_layout - -\begin_layout Subsubsection* -Argument: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -client_id -\end_layout - -\end_inset - -: client identifier -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -local_comm -\end_layout - -\end_inset - -: MPI communicator of the client -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -return_comm -\end_layout - -\end_inset - -: split return MPI communicator -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This subroutine must be called before any other call of MPI client library. - It may be able to initialize MPI library (calling -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -MPI_Init -\end_layout - -\end_inset - -) if not already initialized. - Since XIOS is able to work in client/server mode (parameter -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -using_server=true -\end_layout - -\end_inset - -), the global communicator must be split and a local split communicator - is returned to be used by the client model for it own purpose. - If more than one model is present, XIOS could be interfaced with the OASIS - coupler (compiled with -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout --using_oasis -\end_layout - -\end_inset - - option and parameter -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -using_oasis=true -\end_layout - -\end_inset - -), so in this case, the splitting would be done globally by OASIS. -\end_layout - -\begin_layout Itemize -If MPI is not initialized, XIOS would initialize it calling MPI_Init function. - In this case, the MPI finalization would be done by XIOS in the -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_finalize -\end_layout - -\end_inset - - subroutine, and must not be done by the model. -\end_layout - -\begin_layout Itemize -If OASIS coupler is not used (using_oasis=false) -\end_layout - -\begin_deeper -\begin_layout Itemize -If server mode is not activated ( -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -using_server=false -\end_layout - -\end_inset - -): if local_comm MPI communicator is specified then it would be used for - internal MPI communication otherwise -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -MPI_COMM_WORLD -\end_layout - -\end_inset - - communicator would be used by default. - A copy of the communicator (of -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -local_comm -\end_layout - -\end_inset - - or -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -MPI_COMM_WORLD -\end_layout - -\end_inset - -) would be returned in return_comm argument. - If -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -return_comm -\end_layout - -\end_inset - - is not specified, then -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -local_comm -\end_layout - -\end_inset - - or -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -MPI_COMM_WORLD -\end_layout - -\end_inset - - can be used by the model for it own communication. -\end_layout - -\begin_layout Itemize -If server mode is activated ( -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -using_server=true -\end_layout - -\end_inset - -): -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -local_comm -\end_layout - -\end_inset - - must not be specified since the global -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -MPI_COMM_WORLD -\end_layout - -\end_inset - - communicator would be split by XIOS. - The split communicator is returned in -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -return_comm -\end_layout - -\end_inset - - argument. -\end_layout - -\end_deeper -\begin_layout Itemize -If OASIS coupler is used ( -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -using_oasis=true -\end_layout - -\end_inset - -) -\end_layout - -\begin_deeper -\begin_layout Itemize -If server mode is not enabled ( -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -using_server=false -\end_layout - -\end_inset - -) -\end_layout - -\begin_deeper -\begin_layout Itemize -If -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -local_comm -\end_layout - -\end_inset - - is specified, it means that OASIS has been initialized by the model and - global communicator has been already split previously by OASIS, and passed - as -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -local_comm -\end_layout - -\end_inset - - argument. - The returned communicator would be a duplicate copy of -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -local_comm -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Itemize -Otherwise: if MPI was not initialized, OASIS will be initialized calling - -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -prism_init_comp_proto -\end_layout - -\end_inset - - subroutine. - In this case, XIOS will call -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -prism_terminate_proto -\end_layout - -\end_inset - - when -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_finalized -\end_layout - -\end_inset - - is called. - The split communicator is returned in -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -return_comm -\end_layout - -\end_inset - - argument using -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -prism_get_localcomm_proto -\end_layout - -\end_inset - - return argument. -\end_layout - -\end_deeper -\begin_layout Itemize -If server mode is enabled ( -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -using_server=true -\end_layout - -\end_inset - -) -\end_layout - -\begin_deeper -\begin_layout Itemize -If -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -local_comm -\end_layout - -\end_inset - - is specified, it means that OASIS has been initialized by the model and - global communicator has been already split previously by OASIS, and passed - as local_comm argument. - The returned communicator return_comm would be a split communicator given - by OASIS. -\end_layout - -\begin_layout Itemize -Otherwise: if MPI was not initialized, OASIS will be initialized calling - -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -prism_init_comp_proto -\end_layout - -\end_inset - - subroutine. - In this case, XIOS will call -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -prism_terminate_proto -\end_layout - -\end_inset - - when -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_finalized -\end_layout - -\end_inset - - is called. - The split communicator is returned in -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -return_comm -\end_layout - -\end_inset - - argument using -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -prism_get_localcomm_proto -\end_layout - -\end_inset - - return argument. -\end_layout - -\end_deeper -\end_deeper -\begin_layout Section* -Finalization -\end_layout - -\begin_layout Subsection* -XIOS finalization -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_finalize() -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Standard -None -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This call must be done at the end of the simulation for a successful execution. - It gives the end signal to the xios server pools to finish it execution. - If MPI has been initialize by XIOS the MPI_Finalize will be called. - If OASIS coupler has been initialized by XIOS, then finalization will be - done calling -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -prism_terminate_proto -\end_layout - -\end_inset - - subroutine. -\end_layout - -\begin_layout Section* -Tree elements management subroutines -\end_layout - -\begin_layout Standard -This set of subroutines enables the models to interact, complete or query - the XML tree data base. - New elements or group of elements can be added as child in the tree, attributes - of the elements can be set or query. - The type of elements currently available are: context, axis, domain, grid, - field, variable and file. - An element can be identified by a string or by an handle associated to - the type of the element. - Root element (ex: -\begin_inset Quotes eld -\end_inset - -axis_definition -\begin_inset Quotes erd -\end_inset - -, -\begin_inset Quotes eld -\end_inset - -field_definition -\begin_inset Quotes erd -\end_inset - -,....) are considered like a group of element and are identified by a specific - string -\begin_inset Quotes eld -\end_inset - -element_definition -\begin_inset Quotes erd -\end_inset - - where element can be any one of the existing elements. -\end_layout - -\begin_layout Subsection* -Fortran type of the handles element -\end_layout - -\begin_layout Quotation -TYPE(xios_element) -\end_layout - -\begin_layout Standard -where -\begin_inset Quotes eld -\end_inset - -element -\begin_inset Quotes erd -\end_inset - - can be any one among -\begin_inset Quotes eld -\end_inset - -context -\begin_inset Quotes erd -\end_inset - -, -\begin_inset Quotes eld -\end_inset - -axis -\begin_inset Quotes erd -\end_inset - -, -\begin_inset Quotes eld -\end_inset - -domain -\begin_inset Quotes erd -\end_inset - -, -\begin_inset Quotes eld -\end_inset - -grid -\begin_inset Quotes erd -\end_inset - -, -\begin_inset Quotes eld -\end_inset - -field -\begin_inset Quotes erd -\end_inset - -, -\begin_inset Quotes eld -\end_inset - -variable -\begin_inset Quotes erd -\end_inset - - or -\begin_inset Quotes eld -\end_inset - -file -\begin_inset Quotes erd -\end_inset - -, or the associated group (excepted for context): -\begin_inset Quotes eld -\end_inset - -axis_group -\begin_inset Quotes erd -\end_inset - -, -\begin_inset Quotes eld -\end_inset - -domain_group -\begin_inset Quotes erd -\end_inset - -, -\begin_inset Quotes eld -\end_inset - -grid_group -\begin_inset Quotes erd -\end_inset - -, -\begin_inset Quotes eld -\end_inset - -field_group -\begin_inset Quotes erd -\end_inset - -, -\begin_inset Quotes eld -\end_inset - -variable_group -\begin_inset Quotes erd -\end_inset - - or -\begin_inset Quotes eld -\end_inset - -file_group -\begin_inset Quotes erd -\end_inset - -. -\end_layout - -\begin_layout Subsection* -Getting handles -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_get_element_handle(id,handle) -\end_layout - -\begin_layout LyX-Code -CHARACTER(len = *) , INTENT(IN) :: id -\end_layout - -\begin_layout LyX-Code -TYPE(xios_element), INTENT(OUT):: handle -\end_layout - -\begin_layout Standard -where element is one of the existing elements or group of elements. -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -id -\end_layout - -\end_inset - -: string identifier. -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -handle -\end_layout - -\end_inset - -: element handle -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This subroutine returns the handle of the specified element identified by - its string. - The element must be existing otherwise an error is raised. -\end_layout - -\begin_layout Subsection* -Query for a valid element -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -LOGICAL FUNCTION xios_is_valid_element(id) -\end_layout - -\begin_layout LyX-Code -CHARACTER(len = *) , INTENT(IN) :: id -\end_layout - -\begin_layout Standard -where element is one of the existing elements or group of elements. -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -id -\end_layout - -\end_inset - -: string identifier. -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This function returns .TRUE. - if the element defined by the string identifier -\begin_inset Quotes eld -\end_inset - -id -\begin_inset Quotes erd -\end_inset - - exists in the data base, otherwise it returns .FALSE. - . -\end_layout - -\begin_layout Subsection* -Adding child -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_add_element(parent_handle, child_handle, child_id) -\end_layout - -\begin_layout LyX-Code -TYPE(xios_element) , INTENT(IN) :: parent_handle -\end_layout - -\begin_layout LyX-Code -TYPE(xios_element) , INTENT(OUT):: child_handle -\end_layout - -\begin_layout LyX-Code -CHARACTER(len = *), OPTIONAL, INTENT(IN) :: child_id -\end_layout - -\begin_layout Standard -where element is one of the existing elements or element groups. -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -parent_handle -\end_layout - -\end_inset - -: handle of the parent element. -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -child_handle -\end_layout - -\end_inset - -: handle of the child element. -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -child_id -\end_layout - -\end_inset - -: string identifier of the child. -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This subroutine adds a child to an existing parent element. - The identifier of the child, if existing, can be specified optionally. - All group elements can contain child of the same type, provided generic - inheritance. - Some elements can contain children of another type for a specific behavior. - File element may contain field_group, field, variable and variable_group - child elements. - Field elements may contain variable_group of variable child element. -\end_layout - -\begin_layout Subsection* -Query if the value of an element attribute is defined (by handle) -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_is_defined_attr(handle, attr_1=attribute_1, attr_2=attribute_2, - ...) -\end_layout - -\begin_layout LyX-Code -TYPE(xios_element) , INTENT(IN) :: handle -\end_layout - -\begin_layout LyX-Code -LOGICAL, OPTIONAL , INTENT(OUT) :: attr_1 -\end_layout - -\begin_layout LyX-Code -LOGICAL, OPTIONAL , INTENT(OUT) :: attr_2 -\end_layout - -\begin_layout LyX-Code -.... -\end_layout - -\begin_layout Standard -where element is one of the existing elements or element groups. - attribute_x is describing in the chapter dedicated to the attribute description. -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -handle -\end_layout - -\end_inset - -: element handle. -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -attr_x -\end_layout - -\end_inset - -: return true if the attribute as a defined value. -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This subroutine can be used to query if one or more attributes of an element - have a defined value. - The list of attributes and their type are described in a specific chapter - of the documentation. - -\end_layout - -\begin_layout Subsection* -Query if a value of an element attributes is defined (by identifier) -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_is_defined_element_attr(id, attr_1=attribute_1, attr_2=attribute -_2, ...) -\end_layout - -\begin_layout LyX-Code -CHARACTER(len = *) , INTENT(IN) :: id -\end_layout - -\begin_layout LyX-Code -LOGICAL, OPTIONAL , INTENT(OUT) :: attr_1 -\end_layout - -\begin_layout LyX-Code -LOGICAL, OPTIONAL , INTENT(OUT) :: attr_2 -\end_layout - -\begin_layout LyX-Code -.... -\end_layout - -\begin_layout Standard -where element is one of the existing elements or element groups. - attribute_x is describing in the chapter dedicated to the attribute description. -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -id -\end_layout - -\end_inset - -: element identifier. -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -attr_x -\end_layout - -\end_inset - -: return true if the attribute as a defined value. -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This subroutine can be used to query if one or more attributes of an element - have a defined value. - The list of available attributes and their type are described in a specific - chapter of the documentation. - -\end_layout - -\begin_layout Subsection* -Setting element attributes value by handle -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_set_attr(handle, attr_1=attribute_1, attr_2=attribute_2, - ...) -\end_layout - -\begin_layout LyX-Code -TYPE(xios_element) , INTENT(IN) :: handle -\end_layout - -\begin_layout LyX-Code -attribute_type_1, OPTIONAL , INTENT(IN) :: attr_1 -\end_layout - -\begin_layout LyX-Code -attribute_type_2, OPTIONAL , INTENT(IN) :: attr_2 -\end_layout - -\begin_layout LyX-Code -.... -\end_layout - -\begin_layout Standard -where element is one of the existing elements or element groups. - attribute_x and attribute_type_x are describing in the chapter dedicated - to the attribute description. -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -handle -\end_layout - -\end_inset - -: element handle. -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -attr_x -\end_layout - -\end_inset - -: value of the attribute to be set. -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This subroutine can be used to set one or more attributes of an element - defined by its handle. - The list of available attributes and their types are described in corresponding - chapters of the documentation. - -\end_layout - -\begin_layout Subsection* -Setting element attributes value by id -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_set_element_attr(id, attr_1=attribute_1, attr_2=attribute_2, - ...) -\end_layout - -\begin_layout LyX-Code -CHARACTER(len = *), INTENT(IN) :: id -\end_layout - -\begin_layout LyX-Code -attribute_type_1, OPTIONAL , INTENT(IN) :: attr_1 -\end_layout - -\begin_layout LyX-Code -attribute_type_2, OPTIONAL , INTENT(IN) :: attr_2 -\end_layout - -\begin_layout LyX-Code -.... -\end_layout - -\begin_layout Standard -where element is one of the existing elements or element groups. - The attributes attribute_x and attribute_type_x are described in corresponding - chapters. -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -id -\end_layout - -\end_inset - -: string identifier. -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -attr_x -\end_layout - -\end_inset - -: value of the attribute to be set. -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This subroutine can be used to set one or more attributes of an element - defined by its string id. - The list of available attributes and their type are described in corresponding - chapters of the documentation. -\end_layout - -\begin_layout Subsection* -Getting element attributes value (by handle) -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_get_attr(handle, attr_1=attribute_1, attr_2=attribute_2, - ...) -\end_layout - -\begin_layout LyX-Code -TYPE(xios_element) , INTENT(IN) :: handle -\end_layout - -\begin_layout LyX-Code -attribute_type_1, OPTIONAL , INTENT(OUT) :: attr_1 -\end_layout - -\begin_layout LyX-Code -attribute_type_2, OPTIONAL , INTENT(OUT) :: attr_2 -\end_layout - -\begin_layout LyX-Code -.... -\end_layout - -\begin_layout Standard -where element is one of the existing elements or element groups. - attribute_x and attribute_type_x are describing in the chapter dedicated - to the attribute description. -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -handle -\end_layout - -\end_inset - -: element handle. -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -attr_x -\end_layout - -\end_inset - -: value of the attribute to be get. -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This subroutine can be used to get one or more attribute value of an element - defined by its handle. - All attributes in the arguments list must be defined. - The list of available attributes and their type are described in a specific - chapter of the documentation. - -\end_layout - -\begin_layout Subsection* -Getting element attributes value (by identifier) -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_get_element_attr(id, attr_1=attribute_1, attr_2=attribute_2, - ...) -\end_layout - -\begin_layout LyX-Code -CHARACTER(len = *), INTENT(IN) :: id -\end_layout - -\begin_layout LyX-Code -attribute_type_1, OPTIONAL , INTENT(OUT) :: attr_1 -\end_layout - -\begin_layout LyX-Code -attribute_type_2, OPTIONAL , INTENT(OUT) :: attr_2 -\end_layout - -\begin_layout LyX-Code -.... -\end_layout - -\begin_layout Standard -where element is one of the existing elements or element groups. - attribute_x is describing in the chapter dedicated to the attribute description. -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -id -\end_layout - -\end_inset - -: element string identifier. -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -attr_x -\end_layout - -\end_inset - -: value of the attribute to be get. -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This subroutine can be used to get one or more attribute value of an element - defined by its handle. - All attributes in the arguments list must have a defined value. - The list of available attributes and their type are described in a specific - chapter of the documentation. -\end_layout - -\begin_layout Section* -Context management interface -\end_layout - -\begin_layout Subsection* -XIOS context initialization -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_context_initialize(context_id, context_comm) -\end_layout - -\begin_layout LyX-Code - CHARACTER(LEN=*),INTENT(IN) :: context_id -\end_layout - -\begin_layout LyX-Code - INTEGER,INTENT(IN) :: context_comm -\end_layout - -\begin_layout Subsubsection* -Argument: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -context_id -\end_layout - -\end_inset - -: context identifier -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -context_comm -\end_layout - -\end_inset - -: MPI communicator of the context -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This subroutine initializes a context identified by -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -context_id -\end_layout - -\end_inset - - string and must be called before any call related to this context. - A context must be associated to a communicator, which can be the returned - communicator of the -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_initialize -\end_layout - -\end_inset - - subroutine or a sub-communicator of this. - The context initialization is dynamic and can be done at any time before - the -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_finalize -\end_layout - -\end_inset - - call. -\end_layout - -\begin_layout Subsection* -XIOS context finalization -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_context_finalize() -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Standard -None -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This subroutine must be called to close a context before the -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_finalize -\end_layout - -\end_inset - - call. - It waits until that all pending requests sent to the servers will be processed - and all opened files will be closed. -\end_layout - -\begin_layout Subsection* -Setting current active context -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_set_current_context(context_handle) -\end_layout - -\begin_layout LyX-Code -TYPE(xios_context),INTENT(IN) :: context_handle -\end_layout - -\begin_layout Standard -or -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_set_current_context(context_id) -\end_layout - -\begin_layout LyX-Code -CHARACTER(LEN=*),INTENT(IN) :: context_id -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -context_handle -\end_layout - -\end_inset - -: handle of the context -\end_layout - -\begin_layout Standard -or -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -context_id -\end_layout - -\end_inset - -: string context identifier -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -These subroutines set the current active context. - All following XIOS calls will refer to this active context. - If only one context is defined, it will be set automatically as the active - context. - -\end_layout - -\begin_layout Subsection* -Closing definition -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_close_context_definition() -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Standard -None -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This subroutine must be called when all definitions of a context are finished - at the end of the initialization and before entering to the time loop. - A lot of operations are performed internally (inheritance, grid definition, - contacting servers,...) so this call is mandatory. - Any call related to the tree management definition done after will have - an undefined effect. -\end_layout - -\begin_layout Section* -Calendar management interface -\end_layout - -\begin_layout Subsection* -Creating the calendar -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_define_calendar(type, timestep, start_date, time_origin, - & -\begin_inset Newline newline -\end_inset - - day_length, month_lengths, year_length, - & -\begin_inset Newline newline -\end_inset - - leap_year_month, leap_year_drift, & -\begin_inset Newline newline -\end_inset - - leap_year_drift_offset) -\begin_inset Newline newline -\end_inset - -CHARACTER(len = *), INTENT(IN) :: type -\begin_inset Newline newline -\end_inset - -TYPE(xios_duration), OPTIONAL, INTENT(IN) :: timestep -\begin_inset Newline newline -\end_inset - -TYPE(xios_date), OPTIONAL, INTENT(IN) :: start_date -\begin_inset Newline newline -\end_inset - -TYPE(xios_date), OPTIONAL, INTENT(IN) :: time_origin -\begin_inset Newline newline -\end_inset - -INTEGER, OPTIONAL, INTENT(IN) :: day_length -\begin_inset Newline newline -\end_inset - -INTEGER, OPTIONAL, INTENT(IN) :: month_lengths(:) -\begin_inset Newline newline -\end_inset - -INTEGER, OPTIONAL, INTENT(IN) :: year_length -\begin_inset Newline newline -\end_inset - -DOUBLE PRECISION, OPTIONAL, INTENT(IN) :: leap_year_drift -\begin_inset Newline newline -\end_inset - -DOUBLE PRECISION, OPTIONAL, INTENT(IN) :: leap_year_drift_offset -\begin_inset Newline newline -\end_inset - -INTEGER, OPTIONAL, INTENT(IN) :: leap_year_month -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -type -\end_layout - -\end_inset - -: the calendar type, one of -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -"Gregorian" -\end_layout - -\end_inset - -, -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -"Julian" -\end_layout - -\end_inset - -, -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -"D360" -\end_layout - -\end_inset - -, -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -"AllLeap" -\end_layout - -\end_inset - -, -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -"NoLeap" -\end_layout - -\end_inset - -, -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -"user_defined" -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -timestep -\end_layout - -\end_inset - -: the time step of the simulation (optional, can be set later) -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -start_date -\end_layout - -\end_inset - -: the start date of the simulation (optional, -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_date(0000, 01, 01, 00, 00, 00) -\end_layout - -\end_inset - - is used by default) -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -time_origin -\end_layout - -\end_inset - -: the origin of the time axis (optional, -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_date(0000, 01, 01, 00, 00, 00) -\end_layout - -\end_inset - - is used by default) -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -day_length -\end_layout - -\end_inset - -: the length of a day in seconds (mandatory when creating an user defined - calendar, must not be set otherwise) -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -month_lengths -\end_layout - -\end_inset - -: the length of each month of the year in days (either -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -month_lengths -\end_layout - -\end_inset - - or -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -year_length -\end_layout - -\end_inset - - must be set when creating an user defined calendar, must not be set otherwise) -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -year_length -\end_layout - -\end_inset - -: the length of a year in seconds (either -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -month_lengths -\end_layout - -\end_inset - - or -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -year_length -\end_layout - -\end_inset - - must be set when creating an user defined calendar, must not be set otherwise) -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -leap_year_drift -\end_layout - -\end_inset - -: the yearly drift between the user defined calendar and the astronomical - calendar, expressed as a fraction of day (can optionally be set when creating - an user defined calendar in which case -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -leap_year_month -\end_layout - -\end_inset - - must be set too) -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -leap_year_drift_offset -\end_layout - -\end_inset - -: the initial drift between the user defined calendar and the astronomical - calendar at the time origin, expressed as a fraction of day (can optionally - be set if -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -leap_year_drift -\end_layout - -\end_inset - - and -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -leap_year_month -\end_layout - -\end_inset - - are set) -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -leap_year_month -\end_layout - -\end_inset - -: the month to which an extra day must be added in case of leap year (can - optionally be set when creating an user defined calendar in which case - -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -leap_year_drift -\end_layout - -\end_inset - - must be set too) -\end_layout - -\begin_layout Standard -For a more detailed description of those arguments, see the description - of the corresponding attributes in section 1.2 -\begin_inset Quotes eld -\end_inset - -Calendar attribute reference -\begin_inset Quotes erd -\end_inset - -. -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This subroutine creates the calendar for the current context. - Note that the calendar is created once and for all, either from the XML - configuration file or the Fortran interface. - If it was not created from the configuration file, then this subroutine - must be called once and only once before the context definition is closed. - The calendar features can be used immediately after the calendar was created. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -If an user defined calendar is created, the following arguments must also - be provided: -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -day_length -\end_layout - -\end_inset - - and either -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -month_lengths -\end_layout - -\end_inset - - or -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -year_length -\end_layout - -\end_inset - -. - Optionally it is possible to configure the user defined calendar to have - leap years. - In this case, -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -leap_year_drift -\end_layout - -\end_inset - - and -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -leap_year_month -\end_layout - -\end_inset - - must also be provided and -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -leap_year_drift_offset -\end_layout - -\end_inset - - might be used. -\end_layout - -\begin_layout Subsection* -Accessing the calendar type of the current calendar -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_get_calendar_type(calendar_type) -\begin_inset Newline newline -\end_inset - -CHARACTER(len=*), INTENT(OUT) :: calendar_type -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -calendar_type -\end_layout - -\end_inset - -: on output, the type of the calendar attached to the current context -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This subroutine gets the calendar type associated to the current context. - It will raise an error if used before the calendar was created. -\end_layout - -\begin_layout Subsection* -Accessing and defining the time step of the current calendar -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_get_timestep(timestep) -\begin_inset Newline newline -\end_inset - -TYPE(xios_duration), INTENT(OUT) :: timestep -\end_layout - -\begin_layout Standard -and -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_set_timestep(timestep) -\begin_inset Newline newline -\end_inset - -TYPE(xios_duration), INTENT(IN) :: timestep -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -timestep -\end_layout - -\end_inset - -: a duration corresponding to the time step of the simulation -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -Those subroutines respectively gets and sets the time step associated to - the calendar of the current context. - Note that the time step must always be set before the context definition - is closed and that an error will be raised if the getter subroutine is - used before the time step is defined. -\end_layout - -\begin_layout Subsection* -Accessing and defining the start date of the current calendar -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_get_start_date(start_date) -\begin_inset Newline newline -\end_inset - -TYPE(xios_date), INTENT(OUT) :: start_date -\end_layout - -\begin_layout Standard -and -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_set_start_date(start_date) -\begin_inset Newline newline -\end_inset - -TYPE(xios_date), INTENT(IN) :: start_date -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -start_date -\end_layout - -\end_inset - -: a date corresponding to the beginning of the simulation -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -Those subroutines respectively gets and sets the start date associated to - the calendar of the current context. - They must not be used before the calendar was created. -\end_layout - -\begin_layout Subsection* -Accessing and defining the time origin of the current calendar -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_get_time_origin(time_origin) -\begin_inset Newline newline -\end_inset - -TYPE(xios_date), INTENT(OUT) :: time_origin -\end_layout - -\begin_layout Standard -and -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_set_time_date(time_origin) -\begin_inset Newline newline -\end_inset - -TYPE(xios_date), INTENT(IN) :: time_origin -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -start_date -\end_layout - -\end_inset - -: a date corresponding to the origin of the time axis -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -Those subroutines respectively gets and sets the origin of time associated - to the calendar of the current context. - They must not be used before the calendar was created. -\end_layout - -\begin_layout Subsection* -Updating the current date of the current calendar -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_update_calendar(step) -\begin_inset Newline newline -\end_inset - -INTEGER, INTENT(IN) :: step -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -step -\end_layout - -\end_inset - -: the current iteration number -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This subroutine sets the current date associated to the calendar of the - current context based on the current iteration number: -\begin_inset Formula $current\_date=start\_date+step\times timestep$ -\end_inset - -. - It must not be used before the calendar was created. -\end_layout - -\begin_layout Subsection* -Accessing the current date of the current calendar -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -SUBROUTINE xios_get_current_date(current_date) -\begin_inset Newline newline -\end_inset - -TYPE(xios_date), INTENT(OUT) :: current_date -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -current_date -\end_layout - -\end_inset - -: on output, the current date -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This subroutine gets the current date associated to the calendar of the - current context. - It must not be used before the calendar was created. -\end_layout - -\begin_layout Subsection* -Accessing the year length of the current calendar -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -INTEGER FUNCTION xios_get_year_length_in_seconds(year) -\begin_inset Newline newline -\end_inset - -INTEGER, INTENT(IN) :: year -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -year -\end_layout - -\end_inset - -: the year whose length is requested -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This function returns the duration in seconds of the specified year, taking - leap years into account based on the calendar of the current context. - It must not be used before the calendar was created. -\end_layout - -\begin_layout Subsection* -Accessing the day length of the current calendar -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -INTEGER FUNCTION xios_get_day_length_in_seconds() -\end_layout - -\begin_layout Subsubsection* -Arguments: None -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This function returns the duration in seconds of a day, based on the calendar - of the current context. - It must not be used before the calendar was created. -\end_layout - -\begin_layout Section* -Duration handling interface -\end_layout - -\begin_layout Subsection* -Duration constants -\end_layout - -\begin_layout Standard -Some duration constants are available to ease duration handling: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_year -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_month -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_day -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_hour -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_minute -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_second -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_timestep -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Subsection* -Arithmetic operations on durations -\end_layout - -\begin_layout Standard -The following arithmetic operations on durations are available: -\end_layout - -\begin_layout Itemize -Addition: -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_duration = xios_duration + xios_duration -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -Subtraction: -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_duration = xios_duration - xios_duration -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -Multiplication by a scalar value: -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_duration = scalar * xios_duration -\end_layout - -\end_inset - - or -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_duration = xios_duration * scalar -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -Negation: -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_duration = -xios_duration -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Subsection* -Comparison operations on durations -\end_layout - -\begin_layout Standard -The following comparison operations on durations are available: -\end_layout - -\begin_layout Itemize -Equality: -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -LOGICAL = xios_duration == xios_duration -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -Inequality: -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -LOGICAL = xios_duration /= xios_duration -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Section* -Interface relative to date handling -\end_layout - -\begin_layout Subsection* -Arithmetic operations on dates -\end_layout - -\begin_layout Standard -The following arithmetic operations on dates are available: -\end_layout - -\begin_layout Itemize -Addition of a duration: -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_date = xios_date + xios_duration -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -Subtraction of a duration: -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_date = xios_date - xios_duration -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -Subtraction of two dates: -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -xios_duration = xios_date - xios_date -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Subsection* -Comparison operations on dates -\end_layout - -\begin_layout Standard -The following comparison operations on dates are available: -\end_layout - -\begin_layout Itemize -Equality: -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -LOGICAL = xios_date == xios_date -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -Inequality: -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -LOGICAL = xios_date /= xios_date -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -Less than: -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -LOGICAL = xios_date < xios_date -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -Less or equal: -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -LOGICAL = xios_date <= xios_date -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -Greater than: -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -LOGICAL = xios_date > xios_date -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -Greater or equal: -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -LOGICAL = xios_date >= xios_date -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Subsection* -Converting a date to a number of seconds since the time origin -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -FUNCTION INTEGER(kind = 8) xios_date_convert_to_seconds(date) -\begin_inset Newline newline -\end_inset - -TYPE(xios_date), INTENT(IN) :: date -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -date -\end_layout - -\end_inset - -: the date to convert -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This function returns the number of seconds since the time origin for the - specified date, based on the calendar of the current context. - It must not be used before the calendar was created. -\end_layout - -\begin_layout Subsection* -Converting a date to a number of seconds since the beginning of the year -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -FUNCTION INTEGER xios(date_get_second_of_year)(date) -\begin_inset Newline newline -\end_inset - -TYPE(xios_date), INTENT(IN) :: date -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -date -\end_layout - -\end_inset - -: the date to convert -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This function returns the number of seconds since the beginning of the year - for the specified date, based on the calendar of the current context. - It must not be used before the calendar was created. -\end_layout - -\begin_layout Subsection* -Converting a date to a number of days since the beginning of the year -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -FUNCTION DOUBLE_PRECISION xios_date_get_day_of_year(date) -\begin_inset Newline newline -\end_inset - -TYPE(xios_date), INTENT(IN) :: date -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -date -\end_layout - -\end_inset - -: the date to convert -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This function returns the number of days since the beginning of the year - for the specified date, based on the calendar of the current context. - It must not be used before the calendar was created. -\end_layout - -\begin_layout Subsection* -Converting a date to a fraction of the current year -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -FUNCTION DOUBLE_PRECISION xios_date_get_fraction_of_year(date) -\begin_inset Newline newline -\end_inset - -TYPE(xios_date), INTENT(IN) :: date -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -date -\end_layout - -\end_inset - -: the date to convert -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This function returns the fraction of year corresponding to the specified - date, based on the calendar of the current context. - It must not be used before the calendar was created. -\end_layout - -\begin_layout Subsection* -Converting a date to a number of seconds since the beginning of the day -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -FUNCTION INTEGER xios(date_get_second_of_day)(date) -\begin_inset Newline newline -\end_inset - -TYPE(xios_date), INTENT(IN) :: date -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -date -\end_layout - -\end_inset - -: the date to convert -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This function returns the number of seconds since the beginning of the day - for the specified date, based on the calendar of the current context. - It should not be used before the calendar was created. -\end_layout - -\begin_layout Subsection* -Converting a date to a fraction of the current day -\end_layout - -\begin_layout Subsubsection* -Synopsis: -\end_layout - -\begin_layout LyX-Code -FUNCTION DOUBLE_PRECISION xios_date_get_fraction_of_day(date) -\begin_inset Newline newline -\end_inset - -TYPE(xios_date), INTENT(IN) :: date -\end_layout - -\begin_layout Subsubsection* -Arguments: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status collapsed - -\begin_layout Plain Layout -date -\end_layout - -\end_inset - -: the date to convert -\end_layout - -\begin_layout Subsubsection* -Description: -\end_layout - -\begin_layout Standard -This function returns the fraction of day corresponding to the specified - date based on the calendar of the current context. - It should not be used before the calendar was created. -\end_layout - -\end_body -\end_document diff --git a/xios_2311_src/trunk/.svn/pristine/10/10d9f9df52a9741b046c64c5386d5519c2780c22.svn-base b/xios_2311_src/trunk/.svn/pristine/10/10d9f9df52a9741b046c64c5386d5519c2780c22.svn-base deleted file mode 100644 index badc53bd9c7aa793fb7bc1e1250c0ddcbc71e54d..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/10/10d9f9df52a9741b046c64c5386d5519c2780c22.svn-base +++ /dev/null @@ -1,22 +0,0 @@ -MODULE ZOOM_DOMAIN_INTERFACE - USE, INTRINSIC :: ISO_C_BINDING - - INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99 - - SUBROUTINE cxios_zoom_domain_handle_create(ret, idt, idt_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_zoom_domain_handle_create - - SUBROUTINE cxios_zoom_domain_valid_id(ret, idt, idt_size) BIND(C) - USE ISO_C_BINDING - LOGICAL (kind = C_BOOL) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_zoom_domain_valid_id - - END INTERFACE - -END MODULE ZOOM_DOMAIN_INTERFACE diff --git a/xios_2311_src/trunk/.svn/pristine/10/10dfa619607dfad0b66d6a8957932e0557b7f118.svn-base b/xios_2311_src/trunk/.svn/pristine/10/10dfa619607dfad0b66d6a8957932e0557b7f118.svn-base deleted file mode 100644 index 71eb05222b34a6f7dcf989af3bb86b19c798ee6c..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/10/10dfa619607dfad0b66d6a8957932e0557b7f118.svn-base +++ /dev/null @@ -1,1026 +0,0 @@ -/* ************************************************************************** * - * Interface auto generated - do not modify * - * ************************************************************************** */ - -#include -#include "xios.hpp" -#include "attribute_template.hpp" -#include "object_template.hpp" -#include "group_template.hpp" -#include "icutil.hpp" -#include "icdate.hpp" -#include "timer.hpp" -#include "node_type.hpp" - -extern "C" -{ - typedef xios::CDomain* domain_Ptr; - - void cxios_set_domain_area(domain_Ptr domain_hdl, double* area, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(area, shape(extent[0], extent[1]), neverDeleteData); - domain_hdl->area.reference(tmp.copy()); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_domain_area(domain_Ptr domain_hdl, double* area, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(area, shape(extent[0], extent[1]), neverDeleteData); - tmp=domain_hdl->area.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_domain_area(domain_Ptr domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = domain_hdl->area.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_domain_bounds_lat_1d(domain_Ptr domain_hdl, double* bounds_lat_1d, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(bounds_lat_1d, shape(extent[0], extent[1]), neverDeleteData); - domain_hdl->bounds_lat_1d.reference(tmp.copy()); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_domain_bounds_lat_1d(domain_Ptr domain_hdl, double* bounds_lat_1d, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(bounds_lat_1d, shape(extent[0], extent[1]), neverDeleteData); - tmp=domain_hdl->bounds_lat_1d.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_domain_bounds_lat_1d(domain_Ptr domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = domain_hdl->bounds_lat_1d.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_domain_bounds_lat_2d(domain_Ptr domain_hdl, double* bounds_lat_2d, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(bounds_lat_2d, shape(extent[0], extent[1], extent[2]), neverDeleteData); - domain_hdl->bounds_lat_2d.reference(tmp.copy()); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_domain_bounds_lat_2d(domain_Ptr domain_hdl, double* bounds_lat_2d, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(bounds_lat_2d, shape(extent[0], extent[1], extent[2]), neverDeleteData); - tmp=domain_hdl->bounds_lat_2d.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_domain_bounds_lat_2d(domain_Ptr domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = domain_hdl->bounds_lat_2d.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_domain_bounds_lat_name(domain_Ptr domain_hdl, const char * bounds_lat_name, int bounds_lat_name_size) - { - std::string bounds_lat_name_str; - if (!cstr2string(bounds_lat_name, bounds_lat_name_size, bounds_lat_name_str)) return; - CTimer::get("XIOS").resume(); - domain_hdl->bounds_lat_name.setValue(bounds_lat_name_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_domain_bounds_lat_name(domain_Ptr domain_hdl, char * bounds_lat_name, int bounds_lat_name_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(domain_hdl->bounds_lat_name.getInheritedValue(), bounds_lat_name, bounds_lat_name_size)) - ERROR("void cxios_get_domain_bounds_lat_name(domain_Ptr domain_hdl, char * bounds_lat_name, int bounds_lat_name_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_domain_bounds_lat_name(domain_Ptr domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = domain_hdl->bounds_lat_name.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_domain_bounds_lon_1d(domain_Ptr domain_hdl, double* bounds_lon_1d, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(bounds_lon_1d, shape(extent[0], extent[1]), neverDeleteData); - domain_hdl->bounds_lon_1d.reference(tmp.copy()); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_domain_bounds_lon_1d(domain_Ptr domain_hdl, double* bounds_lon_1d, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(bounds_lon_1d, shape(extent[0], extent[1]), neverDeleteData); - tmp=domain_hdl->bounds_lon_1d.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_domain_bounds_lon_1d(domain_Ptr domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = domain_hdl->bounds_lon_1d.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_domain_bounds_lon_2d(domain_Ptr domain_hdl, double* bounds_lon_2d, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(bounds_lon_2d, shape(extent[0], extent[1], extent[2]), neverDeleteData); - domain_hdl->bounds_lon_2d.reference(tmp.copy()); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_domain_bounds_lon_2d(domain_Ptr domain_hdl, double* bounds_lon_2d, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(bounds_lon_2d, shape(extent[0], extent[1], extent[2]), neverDeleteData); - tmp=domain_hdl->bounds_lon_2d.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_domain_bounds_lon_2d(domain_Ptr domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = domain_hdl->bounds_lon_2d.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_domain_bounds_lon_name(domain_Ptr domain_hdl, const char * bounds_lon_name, int bounds_lon_name_size) - { - std::string bounds_lon_name_str; - if (!cstr2string(bounds_lon_name, bounds_lon_name_size, bounds_lon_name_str)) return; - CTimer::get("XIOS").resume(); - domain_hdl->bounds_lon_name.setValue(bounds_lon_name_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_domain_bounds_lon_name(domain_Ptr domain_hdl, char * bounds_lon_name, int bounds_lon_name_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(domain_hdl->bounds_lon_name.getInheritedValue(), bounds_lon_name, bounds_lon_name_size)) - ERROR("void cxios_get_domain_bounds_lon_name(domain_Ptr domain_hdl, char * bounds_lon_name, int bounds_lon_name_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_domain_bounds_lon_name(domain_Ptr domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = domain_hdl->bounds_lon_name.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_domain_comment(domain_Ptr domain_hdl, const char * comment, int comment_size) - { - std::string comment_str; - if (!cstr2string(comment, comment_size, comment_str)) return; - CTimer::get("XIOS").resume(); - domain_hdl->comment.setValue(comment_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_domain_comment(domain_Ptr domain_hdl, char * comment, int comment_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(domain_hdl->comment.getInheritedValue(), comment, comment_size)) - ERROR("void cxios_get_domain_comment(domain_Ptr domain_hdl, char * comment, int comment_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_domain_comment(domain_Ptr domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = domain_hdl->comment.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_domain_data_dim(domain_Ptr domain_hdl, int data_dim) - { - CTimer::get("XIOS").resume(); - domain_hdl->data_dim.setValue(data_dim); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_domain_data_dim(domain_Ptr domain_hdl, int* data_dim) - { - CTimer::get("XIOS").resume(); - *data_dim = domain_hdl->data_dim.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_domain_data_dim(domain_Ptr domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = domain_hdl->data_dim.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_domain_data_i_index(domain_Ptr domain_hdl, int* data_i_index, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(data_i_index, shape(extent[0]), neverDeleteData); - domain_hdl->data_i_index.reference(tmp.copy()); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_domain_data_i_index(domain_Ptr domain_hdl, int* data_i_index, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(data_i_index, shape(extent[0]), neverDeleteData); - tmp=domain_hdl->data_i_index.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_domain_data_i_index(domain_Ptr domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = domain_hdl->data_i_index.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_domain_data_ibegin(domain_Ptr domain_hdl, int data_ibegin) - { - CTimer::get("XIOS").resume(); - domain_hdl->data_ibegin.setValue(data_ibegin); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_domain_data_ibegin(domain_Ptr domain_hdl, int* data_ibegin) - { - CTimer::get("XIOS").resume(); - *data_ibegin = domain_hdl->data_ibegin.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_domain_data_ibegin(domain_Ptr domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = domain_hdl->data_ibegin.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_domain_data_j_index(domain_Ptr domain_hdl, int* data_j_index, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(data_j_index, shape(extent[0]), neverDeleteData); - domain_hdl->data_j_index.reference(tmp.copy()); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_domain_data_j_index(domain_Ptr domain_hdl, int* data_j_index, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(data_j_index, shape(extent[0]), neverDeleteData); - tmp=domain_hdl->data_j_index.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_domain_data_j_index(domain_Ptr domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = domain_hdl->data_j_index.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_domain_data_jbegin(domain_Ptr domain_hdl, int data_jbegin) - { - CTimer::get("XIOS").resume(); - domain_hdl->data_jbegin.setValue(data_jbegin); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_domain_data_jbegin(domain_Ptr domain_hdl, int* data_jbegin) - { - CTimer::get("XIOS").resume(); - *data_jbegin = domain_hdl->data_jbegin.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_domain_data_jbegin(domain_Ptr domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = domain_hdl->data_jbegin.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_domain_data_ni(domain_Ptr domain_hdl, int data_ni) - { - CTimer::get("XIOS").resume(); - domain_hdl->data_ni.setValue(data_ni); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_domain_data_ni(domain_Ptr domain_hdl, int* data_ni) - { - CTimer::get("XIOS").resume(); - *data_ni = domain_hdl->data_ni.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_domain_data_ni(domain_Ptr domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = domain_hdl->data_ni.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_domain_data_nj(domain_Ptr domain_hdl, int data_nj) - { - CTimer::get("XIOS").resume(); - domain_hdl->data_nj.setValue(data_nj); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_domain_data_nj(domain_Ptr domain_hdl, int* data_nj) - { - CTimer::get("XIOS").resume(); - *data_nj = domain_hdl->data_nj.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_domain_data_nj(domain_Ptr domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = domain_hdl->data_nj.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_domain_dim_i_name(domain_Ptr domain_hdl, const char * dim_i_name, int dim_i_name_size) - { - std::string dim_i_name_str; - if (!cstr2string(dim_i_name, dim_i_name_size, dim_i_name_str)) return; - CTimer::get("XIOS").resume(); - domain_hdl->dim_i_name.setValue(dim_i_name_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_domain_dim_i_name(domain_Ptr domain_hdl, char * dim_i_name, int dim_i_name_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(domain_hdl->dim_i_name.getInheritedValue(), dim_i_name, dim_i_name_size)) - ERROR("void cxios_get_domain_dim_i_name(domain_Ptr domain_hdl, char * dim_i_name, int dim_i_name_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_domain_dim_i_name(domain_Ptr domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = domain_hdl->dim_i_name.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_domain_dim_j_name(domain_Ptr domain_hdl, const char * dim_j_name, int dim_j_name_size) - { - std::string dim_j_name_str; - if (!cstr2string(dim_j_name, dim_j_name_size, dim_j_name_str)) return; - CTimer::get("XIOS").resume(); - domain_hdl->dim_j_name.setValue(dim_j_name_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_domain_dim_j_name(domain_Ptr domain_hdl, char * dim_j_name, int dim_j_name_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(domain_hdl->dim_j_name.getInheritedValue(), dim_j_name, dim_j_name_size)) - ERROR("void cxios_get_domain_dim_j_name(domain_Ptr domain_hdl, char * dim_j_name, int dim_j_name_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_domain_dim_j_name(domain_Ptr domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = domain_hdl->dim_j_name.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_domain_domain_ref(domain_Ptr domain_hdl, const char * domain_ref, int domain_ref_size) - { - std::string domain_ref_str; - if (!cstr2string(domain_ref, domain_ref_size, domain_ref_str)) return; - CTimer::get("XIOS").resume(); - domain_hdl->domain_ref.setValue(domain_ref_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_domain_domain_ref(domain_Ptr domain_hdl, char * domain_ref, int domain_ref_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(domain_hdl->domain_ref.getInheritedValue(), domain_ref, domain_ref_size)) - ERROR("void cxios_get_domain_domain_ref(domain_Ptr domain_hdl, char * domain_ref, int domain_ref_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_domain_domain_ref(domain_Ptr domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = domain_hdl->domain_ref.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_domain_i_index(domain_Ptr domain_hdl, int* i_index, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(i_index, shape(extent[0]), neverDeleteData); - domain_hdl->i_index.reference(tmp.copy()); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_domain_i_index(domain_Ptr domain_hdl, int* i_index, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(i_index, shape(extent[0]), neverDeleteData); - tmp=domain_hdl->i_index.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_domain_i_index(domain_Ptr domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = domain_hdl->i_index.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_domain_ibegin(domain_Ptr domain_hdl, int ibegin) - { - CTimer::get("XIOS").resume(); - domain_hdl->ibegin.setValue(ibegin); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_domain_ibegin(domain_Ptr domain_hdl, int* ibegin) - { - CTimer::get("XIOS").resume(); - *ibegin = domain_hdl->ibegin.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_domain_ibegin(domain_Ptr domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = domain_hdl->ibegin.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_domain_j_index(domain_Ptr domain_hdl, int* j_index, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(j_index, shape(extent[0]), neverDeleteData); - domain_hdl->j_index.reference(tmp.copy()); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_domain_j_index(domain_Ptr domain_hdl, int* j_index, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(j_index, shape(extent[0]), neverDeleteData); - tmp=domain_hdl->j_index.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_domain_j_index(domain_Ptr domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = domain_hdl->j_index.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_domain_jbegin(domain_Ptr domain_hdl, int jbegin) - { - CTimer::get("XIOS").resume(); - domain_hdl->jbegin.setValue(jbegin); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_domain_jbegin(domain_Ptr domain_hdl, int* jbegin) - { - CTimer::get("XIOS").resume(); - *jbegin = domain_hdl->jbegin.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_domain_jbegin(domain_Ptr domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = domain_hdl->jbegin.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_domain_lat_name(domain_Ptr domain_hdl, const char * lat_name, int lat_name_size) - { - std::string lat_name_str; - if (!cstr2string(lat_name, lat_name_size, lat_name_str)) return; - CTimer::get("XIOS").resume(); - domain_hdl->lat_name.setValue(lat_name_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_domain_lat_name(domain_Ptr domain_hdl, char * lat_name, int lat_name_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(domain_hdl->lat_name.getInheritedValue(), lat_name, lat_name_size)) - ERROR("void cxios_get_domain_lat_name(domain_Ptr domain_hdl, char * lat_name, int lat_name_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_domain_lat_name(domain_Ptr domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = domain_hdl->lat_name.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_domain_latvalue_1d(domain_Ptr domain_hdl, double* latvalue_1d, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(latvalue_1d, shape(extent[0]), neverDeleteData); - domain_hdl->latvalue_1d.reference(tmp.copy()); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_domain_latvalue_1d(domain_Ptr domain_hdl, double* latvalue_1d, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(latvalue_1d, shape(extent[0]), neverDeleteData); - tmp=domain_hdl->latvalue_1d.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_domain_latvalue_1d(domain_Ptr domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = domain_hdl->latvalue_1d.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_domain_latvalue_2d(domain_Ptr domain_hdl, double* latvalue_2d, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(latvalue_2d, shape(extent[0], extent[1]), neverDeleteData); - domain_hdl->latvalue_2d.reference(tmp.copy()); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_domain_latvalue_2d(domain_Ptr domain_hdl, double* latvalue_2d, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(latvalue_2d, shape(extent[0], extent[1]), neverDeleteData); - tmp=domain_hdl->latvalue_2d.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_domain_latvalue_2d(domain_Ptr domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = domain_hdl->latvalue_2d.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_domain_lon_name(domain_Ptr domain_hdl, const char * lon_name, int lon_name_size) - { - std::string lon_name_str; - if (!cstr2string(lon_name, lon_name_size, lon_name_str)) return; - CTimer::get("XIOS").resume(); - domain_hdl->lon_name.setValue(lon_name_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_domain_lon_name(domain_Ptr domain_hdl, char * lon_name, int lon_name_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(domain_hdl->lon_name.getInheritedValue(), lon_name, lon_name_size)) - ERROR("void cxios_get_domain_lon_name(domain_Ptr domain_hdl, char * lon_name, int lon_name_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_domain_lon_name(domain_Ptr domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = domain_hdl->lon_name.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_domain_long_name(domain_Ptr domain_hdl, const char * long_name, int long_name_size) - { - std::string long_name_str; - if (!cstr2string(long_name, long_name_size, long_name_str)) return; - CTimer::get("XIOS").resume(); - domain_hdl->long_name.setValue(long_name_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_domain_long_name(domain_Ptr domain_hdl, char * long_name, int long_name_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(domain_hdl->long_name.getInheritedValue(), long_name, long_name_size)) - ERROR("void cxios_get_domain_long_name(domain_Ptr domain_hdl, char * long_name, int long_name_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_domain_long_name(domain_Ptr domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = domain_hdl->long_name.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_domain_lonvalue_1d(domain_Ptr domain_hdl, double* lonvalue_1d, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(lonvalue_1d, shape(extent[0]), neverDeleteData); - domain_hdl->lonvalue_1d.reference(tmp.copy()); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_domain_lonvalue_1d(domain_Ptr domain_hdl, double* lonvalue_1d, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(lonvalue_1d, shape(extent[0]), neverDeleteData); - tmp=domain_hdl->lonvalue_1d.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_domain_lonvalue_1d(domain_Ptr domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = domain_hdl->lonvalue_1d.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_domain_lonvalue_2d(domain_Ptr domain_hdl, double* lonvalue_2d, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(lonvalue_2d, shape(extent[0], extent[1]), neverDeleteData); - domain_hdl->lonvalue_2d.reference(tmp.copy()); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_domain_lonvalue_2d(domain_Ptr domain_hdl, double* lonvalue_2d, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(lonvalue_2d, shape(extent[0], extent[1]), neverDeleteData); - tmp=domain_hdl->lonvalue_2d.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_domain_lonvalue_2d(domain_Ptr domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = domain_hdl->lonvalue_2d.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_domain_mask_1d(domain_Ptr domain_hdl, bool* mask_1d, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(mask_1d, shape(extent[0]), neverDeleteData); - domain_hdl->mask_1d.reference(tmp.copy()); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_domain_mask_1d(domain_Ptr domain_hdl, bool* mask_1d, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(mask_1d, shape(extent[0]), neverDeleteData); - tmp=domain_hdl->mask_1d.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_domain_mask_1d(domain_Ptr domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = domain_hdl->mask_1d.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_domain_mask_2d(domain_Ptr domain_hdl, bool* mask_2d, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(mask_2d, shape(extent[0], extent[1]), neverDeleteData); - domain_hdl->mask_2d.reference(tmp.copy()); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_domain_mask_2d(domain_Ptr domain_hdl, bool* mask_2d, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(mask_2d, shape(extent[0], extent[1]), neverDeleteData); - tmp=domain_hdl->mask_2d.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_domain_mask_2d(domain_Ptr domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = domain_hdl->mask_2d.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_domain_name(domain_Ptr domain_hdl, const char * name, int name_size) - { - std::string name_str; - if (!cstr2string(name, name_size, name_str)) return; - CTimer::get("XIOS").resume(); - domain_hdl->name.setValue(name_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_domain_name(domain_Ptr domain_hdl, char * name, int name_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(domain_hdl->name.getInheritedValue(), name, name_size)) - ERROR("void cxios_get_domain_name(domain_Ptr domain_hdl, char * name, int name_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_domain_name(domain_Ptr domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = domain_hdl->name.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_domain_ni(domain_Ptr domain_hdl, int ni) - { - CTimer::get("XIOS").resume(); - domain_hdl->ni.setValue(ni); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_domain_ni(domain_Ptr domain_hdl, int* ni) - { - CTimer::get("XIOS").resume(); - *ni = domain_hdl->ni.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_domain_ni(domain_Ptr domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = domain_hdl->ni.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_domain_ni_glo(domain_Ptr domain_hdl, int ni_glo) - { - CTimer::get("XIOS").resume(); - domain_hdl->ni_glo.setValue(ni_glo); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_domain_ni_glo(domain_Ptr domain_hdl, int* ni_glo) - { - CTimer::get("XIOS").resume(); - *ni_glo = domain_hdl->ni_glo.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_domain_ni_glo(domain_Ptr domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = domain_hdl->ni_glo.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_domain_nj(domain_Ptr domain_hdl, int nj) - { - CTimer::get("XIOS").resume(); - domain_hdl->nj.setValue(nj); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_domain_nj(domain_Ptr domain_hdl, int* nj) - { - CTimer::get("XIOS").resume(); - *nj = domain_hdl->nj.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_domain_nj(domain_Ptr domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = domain_hdl->nj.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_domain_nj_glo(domain_Ptr domain_hdl, int nj_glo) - { - CTimer::get("XIOS").resume(); - domain_hdl->nj_glo.setValue(nj_glo); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_domain_nj_glo(domain_Ptr domain_hdl, int* nj_glo) - { - CTimer::get("XIOS").resume(); - *nj_glo = domain_hdl->nj_glo.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_domain_nj_glo(domain_Ptr domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = domain_hdl->nj_glo.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_domain_nvertex(domain_Ptr domain_hdl, int nvertex) - { - CTimer::get("XIOS").resume(); - domain_hdl->nvertex.setValue(nvertex); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_domain_nvertex(domain_Ptr domain_hdl, int* nvertex) - { - CTimer::get("XIOS").resume(); - *nvertex = domain_hdl->nvertex.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_domain_nvertex(domain_Ptr domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = domain_hdl->nvertex.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_domain_prec(domain_Ptr domain_hdl, int prec) - { - CTimer::get("XIOS").resume(); - domain_hdl->prec.setValue(prec); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_domain_prec(domain_Ptr domain_hdl, int* prec) - { - CTimer::get("XIOS").resume(); - *prec = domain_hdl->prec.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_domain_prec(domain_Ptr domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = domain_hdl->prec.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_domain_radius(domain_Ptr domain_hdl, double radius) - { - CTimer::get("XIOS").resume(); - domain_hdl->radius.setValue(radius); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_domain_radius(domain_Ptr domain_hdl, double* radius) - { - CTimer::get("XIOS").resume(); - *radius = domain_hdl->radius.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_domain_radius(domain_Ptr domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = domain_hdl->radius.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_domain_standard_name(domain_Ptr domain_hdl, const char * standard_name, int standard_name_size) - { - std::string standard_name_str; - if (!cstr2string(standard_name, standard_name_size, standard_name_str)) return; - CTimer::get("XIOS").resume(); - domain_hdl->standard_name.setValue(standard_name_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_domain_standard_name(domain_Ptr domain_hdl, char * standard_name, int standard_name_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(domain_hdl->standard_name.getInheritedValue(), standard_name, standard_name_size)) - ERROR("void cxios_get_domain_standard_name(domain_Ptr domain_hdl, char * standard_name, int standard_name_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_domain_standard_name(domain_Ptr domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = domain_hdl->standard_name.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_domain_type(domain_Ptr domain_hdl, const char * type, int type_size) - { - std::string type_str; - if (!cstr2string(type, type_size, type_str)) return; - CTimer::get("XIOS").resume(); - domain_hdl->type.fromString(type_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_domain_type(domain_Ptr domain_hdl, char * type, int type_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(domain_hdl->type.getInheritedStringValue(), type, type_size)) - ERROR("void cxios_get_domain_type(domain_Ptr domain_hdl, char * type, int type_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_domain_type(domain_Ptr domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = domain_hdl->type.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } -} diff --git a/xios_2311_src/trunk/.svn/pristine/11/1110ac81ae2f116c4651b6c45d9e87325a85bf52.svn-base b/xios_2311_src/trunk/.svn/pristine/11/1110ac81ae2f116c4651b6c45d9e87325a85bf52.svn-base deleted file mode 100644 index 876647ad22a6d0c800391c856ca2e095b0ab2562..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/11/1110ac81ae2f116c4651b6c45d9e87325a85bf52.svn-base +++ /dev/null @@ -1,25 +0,0 @@ -/********************************************************************* - * Copyright 2010, UCAR/Unidata - * See netcdf/COPYRIGHT file for copying and redistribution conditions. - * $Id$ - * $Header$ - *********************************************************************/ - -#ifndef NCAUX_H -#define NCAUX_H - -#define NCAUX_ALIGN_C 0 -#define NCAUX_ALIGN_UNIFORM 1 - -extern int ncaux_begin_compound(int ncid, const char *name, int alignmode, - void** tag); - -extern int ncaux_end_compound(void* tag, nc_type* typeid); - -extern int ncaux_abort_compound(void* tag); - -extern int ncaux_add_field(void* tag, const char *name, nc_type field_type, - int ndims, const int* dimsizes); - -#endif /*NCAUX_H*/ - diff --git a/xios_2311_src/trunk/.svn/pristine/11/114e20de02ea366675f47d88fd9828eaeedb76f2.svn-base b/xios_2311_src/trunk/.svn/pristine/11/114e20de02ea366675f47d88fd9828eaeedb76f2.svn-base deleted file mode 100644 index 5bbf359f00825eaa781802a4c6d44f2e42e535a1..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/11/114e20de02ea366675f47d88fd9828eaeedb76f2.svn-base +++ /dev/null @@ -1,84 +0,0 @@ -#ifndef __XIOS_CExpandDomain__ -#define __XIOS_CExpandDomain__ - -/// xios headers /// -#include "xios_spl.hpp" -#include "attribute_enum.hpp" -#include "attribute_enum_impl.hpp" -#include "attribute_array.hpp" -#include "declare_attribute.hpp" -#include "object_template.hpp" -#include "group_factory.hpp" -#include "declare_group.hpp" -#include "transformation.hpp" -#include "domain.hpp" - -namespace xios { - /// ////////////////////// Déclarations ////////////////////// /// - class CExpandDomainGroup; - class CExpandDomainAttributes; - class CExpandDomain; - class CDomain; - class CGenericAlgorithmTransformation ; - class CGrid; - - ///-------------------------------------------------------------- - - // Declare/Define CFileAttribute - BEGIN_DECLARE_ATTRIBUTE_MAP(CExpandDomain) -#include "expand_domain_attribute.conf" - END_DECLARE_ATTRIBUTE_MAP(CExpandDomain) - - ///-------------------------------------------------------------- - /*! - \class CExpandDomain - This class describes expand_domain in xml file. - */ - class CExpandDomain - : public CObjectTemplate - , public CExpandDomainAttributes - , public CTransformation - { - public : - typedef CObjectTemplate SuperClass; - typedef CExpandDomainAttributes SuperClassAttribute; - typedef CExpandDomain MyClass ; - typedef CTransformation SuperTransform ; - - public : - /// Constructeurs /// - CExpandDomain(void); - explicit CExpandDomain(const StdString& id); - - /// Destructeur /// - virtual ~CExpandDomain(void); - - virtual void checkValid(CDomain* domain); - - /// Accesseurs statiques /// - static StdString GetName(void); - static StdString GetDefName(void); - static ENodeType GetType(void); - const string& getId(void) { return this->SuperClass::getId();} - ETranformationType getTransformationType(void) { return TRANS_EXPAND_DOMAIN ;} - static CTransformation* getTransformation(const StdString& id) { return SuperClass::get(id);} - virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} - virtual shared_ptr createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) ; - private: - static bool registerTrans(); - static CTransformation* create(const StdString& id, xml::CXMLNode* node); - static bool _dummyRegistered; - }; // class CExpandDomain - - DECLARE_GROUP(CExpandDomain); -} // namespace xios - -#endif // __XIOS_CExpandDomain__ diff --git a/xios_2311_src/trunk/.svn/pristine/11/116422c0c8d331bd66430c3a710419df64cdb868.svn-base b/xios_2311_src/trunk/.svn/pristine/11/116422c0c8d331bd66430c3a710419df64cdb868.svn-base deleted file mode 100644 index 2c14b21698128b89eee62b52c5746c6283d2e205..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/11/116422c0c8d331bd66430c3a710419df64cdb868.svn-base +++ /dev/null @@ -1,6 +0,0 @@ -NETCDF_INCDIR="-I /usr/local/install/netcdf-4.3.2p/include" -NETCDF_LIBDIR="-L/usr/local/install/netcdf-4.3.2p/lib" -NETCDF_LIB="-lnetcdf -lnetcdff" -HDF5_INCDIR="-I /usr/local/install/hdf5-1.8.9p/include" -HDF5_LIBDIR="-L/usr/local/install/hdf5-1.8.9p/lib" -HDF5_LIB="-lhdf5_hl -lhdf5 -lhdf5 -lz -lcurl" diff --git a/xios_2311_src/trunk/.svn/pristine/11/117ceaf1d446b7f56d19c4e954ee6fad2512cfd8.svn-base b/xios_2311_src/trunk/.svn/pristine/11/117ceaf1d446b7f56d19c4e954ee6fad2512cfd8.svn-base deleted file mode 100644 index 7f0323f24a0cf8409c5f9a7962970d50bca28a76..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/11/117ceaf1d446b7f56d19c4e954ee6fad2512cfd8.svn-base +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright 1993-1996 University Corporation for Atmospheric Research/Unidata - * - * Portions of this software were developed by the Unidata Program at the - * University Corporation for Atmospheric Research. - * - * Access and use of this software shall impose the following obligations - * and understandings on the user. The user is granted the right, without - * any fee or cost, to use, copy, modify, alter, enhance and distribute - * this software, and any derivative works thereof, and its supporting - * documentation for any purpose whatsoever, provided that this entire - * notice appears in all copies of the software, derivative works and - * supporting documentation. Further, UCAR requests that the user credit - * UCAR/Unidata in any publications that result from the use of this - * software or in any product that includes this software. The names UCAR - * and/or Unidata, however, may not be used in any advertising or publicity - * to endorse or promote any products or commercial entity unless specific - * written permission is obtained from UCAR/Unidata. The user also - * understands that UCAR/Unidata is not obligated to provide the user with - * any support, consulting, training or assistance of any kind with regard - * to the use, operation and performance of this software nor to provide - * the user with any updates, revisions, new versions or "bug fixes." - * - * THIS SOFTWARE IS PROVIDED BY UCAR/UNIDATA "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL UCAR/UNIDATA BE LIABLE FOR ANY SPECIAL, - * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE. - */ -/* "$Id: nc3dispatch.h,v 2.8 2010/05/26 18:11:08 dmh Exp $" */ - -#ifndef _NC3DISPATCH_H -#define _NC3DISPATCH_H - -#include /* size_t, ptrdiff_t */ -#include "netcdf.h" -#include "ncdispatch.h" - - - -#if defined(__cplusplus) -extern "C" { -#endif - -/* - * The Interface - */ - -/* WARNING: this signature differs from external nc_create API*/ -EXTERNL int -NC3_create(const char *path, int cmode, - size_t initialsz, int basepe, size_t *chunksizehintp, - int useparallel, void* mpidata, - struct NC_Dispatch*, NC** ncp); - -/* WARNING: this signature differs from external nc_open API*/ -EXTERNL int -NC3_open(const char *path, int mode, - int basepe, size_t *chunksizehintp, - int use_parallel, void* mpidata, - NC_Dispatch*, NC** ncp); - -EXTERNL int -NC3_new_nc(NC**); - -EXTERNL int -NC3_redef(int ncid); - -EXTERNL int -NC3__enddef(int ncid, size_t h_minfree, size_t v_align, - size_t v_minfree, size_t r_align); - -EXTERNL int -NC3_sync(int ncid); - -EXTERNL int -NC3_abort(int ncid); - -EXTERNL int -NC3_close(int ncid); - -EXTERNL int -NC3_set_fill(int ncid, int fillmode, int *old_modep); - -EXTERNL int -NC3_set_base_pe(int ncid, int pe); - -EXTERNL int -NC3_inq_base_pe(int ncid, int *pe); - -EXTERNL int -NC3_inq_format(int ncid, int *formatp); - -EXTERNL int -NC3_inq(int ncid, int *ndimsp, int *nvarsp, int *nattsp, int *unlimdimidp); - -EXTERNL int -NC3_inq_type(int, nc_type, char *, size_t *); - -/* Begin _dim */ - -EXTERNL int -NC3_def_dim(int ncid, const char *name, size_t len, int *idp); - -EXTERNL int -NC3_inq_dimid(int ncid, const char *name, int *idp); - -EXTERNL int -NC3_inq_dim(int ncid, int dimid, char *name, size_t *lenp); - -EXTERNL int -NC3_inq_unlimdim(int ncid, int *unlimdimidp); - -EXTERNL int -NC3_rename_dim(int ncid, int dimid, const char *name); - -/* End _dim */ -/* Begin _att */ - -EXTERNL int -NC3_inq_att(int ncid, int varid, const char *name, - nc_type *xtypep, size_t *lenp); - -EXTERNL int -NC3_inq_attid(int ncid, int varid, const char *name, int *idp); - -EXTERNL int -NC3_inq_attname(int ncid, int varid, int attnum, char *name); - -EXTERNL int -NC3_rename_att(int ncid, int varid, const char *name, const char *newname); - -EXTERNL int -NC3_del_att(int ncid, int varid, const char*); - -/* End _att */ -/* Begin {put,get}_att */ - -EXTERNL int -NC3_get_att(int ncid, int varid, const char *name, void *value, nc_type); - -EXTERNL int -NC3_put_att(int ncid, int varid, const char *name, nc_type datatype, - size_t len, const void *value, nc_type); - -/* End {put,get}_att */ -/* Begin _var */ - -EXTERNL int -NC3_def_var(int ncid, const char *name, - nc_type xtype, int ndims, const int *dimidsp, int *varidp); - -EXTERNL int -NC3_inq_var(int ncid, int varid, char *name, - nc_type *xtypep, int *ndimsp, int *dimidsp, int *nattsp); - -EXTERNL int -NC3_inq_varid(int ncid, const char *name, int *varidp); - -EXTERNL int -NC3_rename_var(int ncid, int varid, const char *name); - - -EXTERNL int -NC3_put_vara(int ncid, int varid, - const size_t *start, const size_t *count, - const void *value, nc_type); - -EXTERNL int -NC3_get_vara(int ncid, int varid, - const size_t *start, const size_t *count, - void *value, nc_type); - -/* End _var */ - -extern int NC3_initialize(); - - -#if defined(__cplusplus) -} -#endif - -#endif /*_NC3DISPATCH_H*/ diff --git a/xios_2311_src/trunk/.svn/pristine/11/11af44e30d8a3084d37c9d204c01464f6d8f4515.svn-base b/xios_2311_src/trunk/.svn/pristine/11/11af44e30d8a3084d37c9d204c01464f6d8f4515.svn-base deleted file mode 100644 index 0787cc19f73c3f6801aae7a3213beb26328c64c4..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/11/11af44e30d8a3084d37c9d204c01464f6d8f4515.svn-base +++ /dev/null @@ -1,26 +0,0 @@ -################################################################################ -################### Projet XIOS ################### -################################################################################ - -%CCOMPILER scorep --nocompiler --nomemory --mpp=mpi --user mpicc -DSCOREP -%FCOMPILER scorep --nocompiler --nomemory --mpp=mpi --user mpif90 -DSCOREP -%LINKER scorep --nocompiler --nomemory --mpp=mpi --user mpif90 -DSCOREP -nofor-main - -%BASE_CFLAGS -std=c++11 -diag-disable 1125 -diag-disable 279 -%PROD_CFLAGS -Ofast -xHost -D BOOST_DISABLE_ASSERTS -#%DEV_CFLAGS -g -traceback -%DEV_CFLAGS -g -%DEBUG_CFLAGS -DBZ_DEBUG -g -traceback -fno-inline - -%BASE_FFLAGS -D__NONE__ -%PROD_FFLAGS -O3 -g -traceback -#%DEV_FFLAGS -g -traceback -%DEV_FFLAGS -g -%DEBUG_FFLAGS -g -traceback - -%BASE_INC -D__NONE__ -%BASE_LD -lstdc++ - -%CPP mpicc -EP -%FPP cpp -P -%MAKE gmake diff --git a/xios_2311_src/trunk/.svn/pristine/12/1232b14d5ad63af45f1cdd4f060578cb2c7857e3.svn-base b/xios_2311_src/trunk/.svn/pristine/12/1232b14d5ad63af45f1cdd4f060578cb2c7857e3.svn-base deleted file mode 100644 index 97f9f8370d8b3b21db83000c0456e7bacd338a27..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/12/1232b14d5ad63af45f1cdd4f060578cb2c7857e3.svn-base +++ /dev/null @@ -1,19 +0,0 @@ -NETCDF_INCDIR="-I $NETCDF_INC" -NETCDF_LIBDIR="-L $NETCDF_LIB" -NETCDF_LIB="-lnetcdf" - -MPI_INCDIR="" -MPI_LIBDIR="" -MPI_LIB="" - -HDF5_INCDIR="-I$HDF5_INC" -HDF5_LIBDIR="-L$HDF5_LIB -L$SZIP_LIB -L$ZLIB_LIB" -HDF5_LIB="-lhdf5_hl -lhdf5 -lsz -lz" - -OASIS_INCDIR="-I$PWD/../../oasis3-mct/BLD/build/lib/psmile.MPI1" -OASIS_LIBDIR="-L$PWD/../../oasis3-mct/BLD/lib" -OASIS_LIB="-lpsmile.MPI1 -lscrip -lmct -lmpeu" - -#only for MEMTRACK debuging : developper only -ADDR2LINE_LIBDIR="-L${WORKDIR}/ADDR2LINE_LIB" -ADDR2LINE_LIB="-laddr2line" diff --git a/xios_2311_src/trunk/.svn/pristine/12/129fcc1bed1f93515c05fb139713e99a19598632.svn-base b/xios_2311_src/trunk/.svn/pristine/12/129fcc1bed1f93515c05fb139713e99a19598632.svn-base deleted file mode 100644 index 1a6006cce2040e865f1d80f1d837feb493b73696..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/12/129fcc1bed1f93515c05fb139713e99a19598632.svn-base +++ /dev/null @@ -1,224 +0,0 @@ -! * ************************************************************************** * -! * Interface auto generated - do not modify * -! * ************************************************************************** * -#include "xios_fortran_prefix.hpp" - -MODULE ivariablegroup_attr - USE, INTRINSIC :: ISO_C_BINDING - USE ivariable - USE variablegroup_interface_attr - -CONTAINS - - SUBROUTINE xios(set_variablegroup_attr) & - ( variablegroup_id, group_ref, name, ts_target, type ) - - IMPLICIT NONE - TYPE(txios(variablegroup)) :: variablegroup_hdl - CHARACTER(LEN=*), INTENT(IN) ::variablegroup_id - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: group_ref - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: ts_target - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type - - CALL xios(get_variablegroup_handle) & - (variablegroup_id,variablegroup_hdl) - CALL xios(set_variablegroup_attr_hdl_) & - ( variablegroup_hdl, group_ref, name, ts_target, type ) - - END SUBROUTINE xios(set_variablegroup_attr) - - SUBROUTINE xios(set_variablegroup_attr_hdl) & - ( variablegroup_hdl, group_ref, name, ts_target, type ) - - IMPLICIT NONE - TYPE(txios(variablegroup)) , INTENT(IN) :: variablegroup_hdl - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: group_ref - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: ts_target - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type - - CALL xios(set_variablegroup_attr_hdl_) & - ( variablegroup_hdl, group_ref, name, ts_target, type ) - - END SUBROUTINE xios(set_variablegroup_attr_hdl) - - SUBROUTINE xios(set_variablegroup_attr_hdl_) & - ( variablegroup_hdl, group_ref_, name_, ts_target_, type_ ) - - IMPLICIT NONE - TYPE(txios(variablegroup)) , INTENT(IN) :: variablegroup_hdl - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: group_ref_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: ts_target_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type_ - - IF (PRESENT(group_ref_)) THEN - CALL cxios_set_variablegroup_group_ref & - (variablegroup_hdl%daddr, group_ref_, len(group_ref_)) - ENDIF - - IF (PRESENT(name_)) THEN - CALL cxios_set_variablegroup_name & - (variablegroup_hdl%daddr, name_, len(name_)) - ENDIF - - IF (PRESENT(ts_target_)) THEN - CALL cxios_set_variablegroup_ts_target & - (variablegroup_hdl%daddr, ts_target_, len(ts_target_)) - ENDIF - - IF (PRESENT(type_)) THEN - CALL cxios_set_variablegroup_type & - (variablegroup_hdl%daddr, type_, len(type_)) - ENDIF - - END SUBROUTINE xios(set_variablegroup_attr_hdl_) - - SUBROUTINE xios(get_variablegroup_attr) & - ( variablegroup_id, group_ref, name, ts_target, type ) - - IMPLICIT NONE - TYPE(txios(variablegroup)) :: variablegroup_hdl - CHARACTER(LEN=*), INTENT(IN) ::variablegroup_id - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: group_ref - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: ts_target - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type - - CALL xios(get_variablegroup_handle) & - (variablegroup_id,variablegroup_hdl) - CALL xios(get_variablegroup_attr_hdl_) & - ( variablegroup_hdl, group_ref, name, ts_target, type ) - - END SUBROUTINE xios(get_variablegroup_attr) - - SUBROUTINE xios(get_variablegroup_attr_hdl) & - ( variablegroup_hdl, group_ref, name, ts_target, type ) - - IMPLICIT NONE - TYPE(txios(variablegroup)) , INTENT(IN) :: variablegroup_hdl - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: group_ref - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: ts_target - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type - - CALL xios(get_variablegroup_attr_hdl_) & - ( variablegroup_hdl, group_ref, name, ts_target, type ) - - END SUBROUTINE xios(get_variablegroup_attr_hdl) - - SUBROUTINE xios(get_variablegroup_attr_hdl_) & - ( variablegroup_hdl, group_ref_, name_, ts_target_, type_ ) - - IMPLICIT NONE - TYPE(txios(variablegroup)) , INTENT(IN) :: variablegroup_hdl - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: group_ref_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: ts_target_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type_ - - IF (PRESENT(group_ref_)) THEN - CALL cxios_get_variablegroup_group_ref & - (variablegroup_hdl%daddr, group_ref_, len(group_ref_)) - ENDIF - - IF (PRESENT(name_)) THEN - CALL cxios_get_variablegroup_name & - (variablegroup_hdl%daddr, name_, len(name_)) - ENDIF - - IF (PRESENT(ts_target_)) THEN - CALL cxios_get_variablegroup_ts_target & - (variablegroup_hdl%daddr, ts_target_, len(ts_target_)) - ENDIF - - IF (PRESENT(type_)) THEN - CALL cxios_get_variablegroup_type & - (variablegroup_hdl%daddr, type_, len(type_)) - ENDIF - - END SUBROUTINE xios(get_variablegroup_attr_hdl_) - - SUBROUTINE xios(is_defined_variablegroup_attr) & - ( variablegroup_id, group_ref, name, ts_target, type ) - - IMPLICIT NONE - TYPE(txios(variablegroup)) :: variablegroup_hdl - CHARACTER(LEN=*), INTENT(IN) ::variablegroup_id - LOGICAL, OPTIONAL, INTENT(OUT) :: group_ref - LOGICAL(KIND=C_BOOL) :: group_ref_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: name - LOGICAL(KIND=C_BOOL) :: name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: ts_target - LOGICAL(KIND=C_BOOL) :: ts_target_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: type - LOGICAL(KIND=C_BOOL) :: type_tmp - - CALL xios(get_variablegroup_handle) & - (variablegroup_id,variablegroup_hdl) - CALL xios(is_defined_variablegroup_attr_hdl_) & - ( variablegroup_hdl, group_ref, name, ts_target, type ) - - END SUBROUTINE xios(is_defined_variablegroup_attr) - - SUBROUTINE xios(is_defined_variablegroup_attr_hdl) & - ( variablegroup_hdl, group_ref, name, ts_target, type ) - - IMPLICIT NONE - TYPE(txios(variablegroup)) , INTENT(IN) :: variablegroup_hdl - LOGICAL, OPTIONAL, INTENT(OUT) :: group_ref - LOGICAL(KIND=C_BOOL) :: group_ref_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: name - LOGICAL(KIND=C_BOOL) :: name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: ts_target - LOGICAL(KIND=C_BOOL) :: ts_target_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: type - LOGICAL(KIND=C_BOOL) :: type_tmp - - CALL xios(is_defined_variablegroup_attr_hdl_) & - ( variablegroup_hdl, group_ref, name, ts_target, type ) - - END SUBROUTINE xios(is_defined_variablegroup_attr_hdl) - - SUBROUTINE xios(is_defined_variablegroup_attr_hdl_) & - ( variablegroup_hdl, group_ref_, name_, ts_target_, type_ ) - - IMPLICIT NONE - TYPE(txios(variablegroup)) , INTENT(IN) :: variablegroup_hdl - LOGICAL, OPTIONAL, INTENT(OUT) :: group_ref_ - LOGICAL(KIND=C_BOOL) :: group_ref__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: name_ - LOGICAL(KIND=C_BOOL) :: name__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: ts_target_ - LOGICAL(KIND=C_BOOL) :: ts_target__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: type_ - LOGICAL(KIND=C_BOOL) :: type__tmp - - IF (PRESENT(group_ref_)) THEN - group_ref__tmp = cxios_is_defined_variablegroup_group_ref & - (variablegroup_hdl%daddr) - group_ref_ = group_ref__tmp - ENDIF - - IF (PRESENT(name_)) THEN - name__tmp = cxios_is_defined_variablegroup_name & - (variablegroup_hdl%daddr) - name_ = name__tmp - ENDIF - - IF (PRESENT(ts_target_)) THEN - ts_target__tmp = cxios_is_defined_variablegroup_ts_target & - (variablegroup_hdl%daddr) - ts_target_ = ts_target__tmp - ENDIF - - IF (PRESENT(type_)) THEN - type__tmp = cxios_is_defined_variablegroup_type & - (variablegroup_hdl%daddr) - type_ = type__tmp - ENDIF - - END SUBROUTINE xios(is_defined_variablegroup_attr_hdl_) - -END MODULE ivariablegroup_attr diff --git a/xios_2311_src/trunk/.svn/pristine/12/12a5fbc5bbc2bfbf12e715c5e581f184e3525dbf.svn-base b/xios_2311_src/trunk/.svn/pristine/12/12a5fbc5bbc2bfbf12e715c5e581f184e3525dbf.svn-base deleted file mode 100644 index e2f804b3d4b85f8f97bfdf14ae47091c0c975c4c..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/12/12a5fbc5bbc2bfbf12e715c5e581f184e3525dbf.svn-base +++ /dev/null @@ -1,81 +0,0 @@ -#include "temporal_transform_filter.hpp" -#include "workflow_graph.hpp" - -namespace xios -{ - - CTemporalTransformFilter::CTemporalTransformFilter(CGarbageCollector& gc, int slots, shared_ptr algo, int nrecords, bool detectMissingValues, double defaultValue) - : CTransformFilter(gc, slots, algo, detectMissingValues, defaultValue), nrecords_(nrecords), graphCycleCompleted(true) - { - } - - void CTemporalTransformFilter::buildWorkflowGraph(std::vector data) - { - if(this->graphEnabled ) - { - if(!data[0]->graphPackage) - { - data[0]->graphPackage = new CGraphDataPackage; - } - - if(graphCycleCompleted) - { - this->graphPackage->filterId = CWorkflowGraph::getNodeSize(); - CWorkflowGraph::addNode("Temporal splitting filter", 7, false, 0, data[0]); - graphCycleCompleted = false; - } - - data[0]->graphPackage->currentField = this->graphPackage->inFields[0]; - std::rotate(this->graphPackage->inFields.begin(), this->graphPackage->inFields.begin() + 1, this->graphPackage->inFields.end()); - - CWorkflowGraph::addEdge(data[0]->graphPackage->fromFilter, this->graphPackage->filterId, data[0]); - data[0]->graphPackage->fromFilter = this->graphPackage->filterId; - data[0]->graphPackage->currentField = this->graphPackage->inFields[0]; - std::rotate(this->graphPackage->inFields.begin(), this->graphPackage->inFields.begin() + 1, this->graphPackage->inFields.end()); - } - - } - - CDataPacketPtr CTemporalTransformFilter::apply(std::vector data) - { - if (data[0]->status == CDataPacket::NO_ERROR) - { - buildWorkflowGraph(data); - if (record_==0) tmpData_.resize(nrecords_) ; - algorithm_->apply(data[0]->data, tmpData_[record_]); - record_++ ; - if (record_==nrecords_) - { - size_t size=0 ; - for(auto& it : tmpData_) size += it.numElements() ; - // for now, no auxilliairy field - CDataPacketPtr packet(new CDataPacket); - packet->date = data[0]->date; - packet->timestamp = data[0]->timestamp; - packet->status = data[0]->status; - packet->data.resize(size) ; - packet->graphPackage = data[0]->graphPackage; - double* out = packet->data.dataFirst() ; - for(auto& it : tmpData_) - { - size = it.numElements() ; - double* tmp = it.dataFirst() ; - for(size_t i=0 ; idate = data[0]->date; - packet->timestamp = data[0]->timestamp; - packet->status = data[0]->status; - return packet ; - } - } -} \ No newline at end of file diff --git a/xios_2311_src/trunk/.svn/pristine/12/12ed39e78e31023bc1d764eb23533b29299c3977.svn-base b/xios_2311_src/trunk/.svn/pristine/12/12ed39e78e31023bc1d764eb23533b29299c3977.svn-base deleted file mode 100644 index e8894918b2c152cd4d98bcf7e2dd8e37bc5eff92..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/12/12ed39e78e31023bc1d764eb23533b29299c3977.svn-base +++ /dev/null @@ -1,30 +0,0 @@ -#include "xios_fortran_prefix.hpp" - -MODULE IREDUCE_AXIS_TO_SCALAR - USE, INTRINSIC :: ISO_C_BINDING - USE REDUCE_AXIS_TO_SCALAR_INTERFACE - - TYPE txios(reduce_axis_to_scalar) - INTEGER(kind = C_INTPTR_T) :: daddr - END TYPE txios(reduce_axis_to_scalar) - - CONTAINS ! Fonctions disponibles pour les utilisateurs. - - SUBROUTINE xios(get_reduce_axis_to_scalar_handle)(idt,ret) - IMPLICIT NONE - CHARACTER(len = *), INTENT(IN) :: idt - TYPE(txios(reduce_axis_to_scalar)) , INTENT(OUT):: ret - CALL cxios_reduce_axis_to_scalar_handle_create(ret%daddr, idt, len(idt)) - END SUBROUTINE xios(get_reduce_axis_to_scalar_handle) - - LOGICAL FUNCTION xios(is_valid_reduce_axis_to_scalar)(idt) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: idt - LOGICAL (kind = 1) :: val - - CALL cxios_reduce_axis_to_scalar_valid_id(val, idt, len(idt)) - xios(is_valid_reduce_axis_to_scalar) = val - - END FUNCTION xios(is_valid_reduce_axis_to_scalar) - -END MODULE IREDUCE_AXIS_TO_SCALAR diff --git a/xios_2311_src/trunk/.svn/pristine/12/12f21d8b79ceee6e2748b050d6cf9800855633e0.svn-base b/xios_2311_src/trunk/.svn/pristine/12/12f21d8b79ceee6e2748b050d6cf9800855633e0.svn-base deleted file mode 100644 index ad0815396d6512be8c0c89b01d342d06af0811c3..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/12/12f21d8b79ceee6e2748b050d6cf9800855633e0.svn-base +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef __XIOS_CReduceScalarToScalar__ -#define __XIOS_CReduceScalarToScalar__ - -/// xios headers /// -#include "xios_spl.hpp" -#include "attribute_enum.hpp" -#include "attribute_enum_impl.hpp" -#include "attribute_array.hpp" -#include "declare_attribute.hpp" -#include "object_template.hpp" -#include "group_factory.hpp" -#include "declare_group.hpp" -#include "transformation.hpp" - -namespace xios { - /// ////////////////////// Déclarations ////////////////////// /// - class CReduceScalarToScalarGroup; - class CReduceScalarToScalarAttributes; - class CReduceScalarToScalar; - class CScalar; - class CGenericAlgorithmTransformation ; - class CGrid; - ///-------------------------------------------------------------- - - // Declare/Define CFileAttribute - BEGIN_DECLARE_ATTRIBUTE_MAP(CReduceScalarToScalar) -#include "reduce_scalar_to_scalar_attribute.conf" - END_DECLARE_ATTRIBUTE_MAP(CReduceScalarToScalar) - - ///-------------------------------------------------------------- - /*! - \class CReduceScalarToScalar - This class describes reduce_scalar in xml file. - */ - class CReduceScalarToScalar - : public CObjectTemplate - , public CReduceScalarToScalarAttributes - , public CTransformation - { - public : - typedef CObjectTemplate SuperClass; - typedef CReduceScalarToScalarAttributes SuperClassAttribute; - typedef CReduceScalarToScalar MyClass ; - typedef CTransformation SuperTransform ; - - public : - /// Constructeurs /// - CReduceScalarToScalar(void); - explicit CReduceScalarToScalar(const StdString& id); - - /// Destructeur /// - virtual ~CReduceScalarToScalar(void); - - virtual void checkValid(CScalar* scalarDst); - - /// Accesseurs statiques /// - static StdString GetName(void); - static StdString GetDefName(void); - static ENodeType GetType(void); - const string& getId(void) { return this->SuperClass::getId();} - ETranformationType getTransformationType(void) { return TRANS_REDUCE_SCALAR_TO_SCALAR ;} - static CTransformation* getTransformation(const StdString& id) { return SuperClass::get(id);} - virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} - virtual shared_ptr createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) ; - private: - static bool registerTrans(); - static CTransformation* create(const StdString& id, xml::CXMLNode* node); - static bool _dummyRegistered; - }; // class CReduceScalarToScalar - - DECLARE_GROUP(CReduceScalarToScalar); -} // namespace xios - -#endif // __XIOS_CReduceScalarToScalar__ diff --git a/xios_2311_src/trunk/.svn/pristine/12/12fd2fb1ba609edb305de7e2bcf510df2434f107.svn-base b/xios_2311_src/trunk/.svn/pristine/12/12fd2fb1ba609edb305de7e2bcf510df2434f107.svn-base deleted file mode 100644 index 41fd52947ec3da18d15d1ef91f2e665a8b38d152..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/12/12fd2fb1ba609edb305de7e2bcf510df2434f107.svn-base +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef __XIOS_IMPL_HPP__ -#define __XIOS_IMPL_HPP__ - -#include "xios_spl.hpp" -#include "variable.hpp" -#include "object_template.hpp" -#include "cxios.hpp" - -namespace xios -{ - template - T CXios::getin(const string& id) - { - return CVariable::get("xios",id)->getData() ; - } - - template - T CXios::getin(const string& id, const T& defaultValue) - { - if (CVariable::has("xios",id)) return CVariable::get("xios",id)->getData() ; - else return defaultValue ; - } - - -} -#endif diff --git a/xios_2311_src/trunk/.svn/pristine/13/13912e4fd27d0ecf7c7af4e9d4cde4a416a31b28.svn-base b/xios_2311_src/trunk/.svn/pristine/13/13912e4fd27d0ecf7c7af4e9d4cde4a416a31b28.svn-base deleted file mode 100644 index b94647ac024fab76c87d20708b4131722fa83f37..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/13/13912e4fd27d0ecf7c7af4e9d4cde4a416a31b28.svn-base +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -THREDDS_DIR=$xios_thredds_dir -files=$* - -for file in $files -do - cp $file $THREDDS_DIR ; chmod --quiet g+wr $THREDDS_DIR/$file ; chmod --quiet o+r $THREDDS_DIR/$file -done diff --git a/xios_2311_src/trunk/.svn/pristine/13/13a3702e107ac5b0c60240f09c1c31ddfd13fe39.svn-base b/xios_2311_src/trunk/.svn/pristine/13/13a3702e107ac5b0c60240f09c1c31ddfd13fe39.svn-base deleted file mode 100644 index e6518207305a70cc5d046af393de366832a3db1a..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/13/13a3702e107ac5b0c60240f09c1c31ddfd13fe39.svn-base +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef __CONTEXT_INFO_HPP__ -#define __CONTEXT_INFO_HPP__ - -#include "services_manager.hpp" - -namespace xios -{ - struct SRegisterContextInfo - { - string poolId ; - string serviceId; - int partitionId ; - int serviceType ; - string id ; - int size ; - int leader ; - } ; -} - - -#endif \ No newline at end of file diff --git a/xios_2311_src/trunk/.svn/pristine/13/13e3658358bf9d952c3aadf7eab20caac1ce775e.svn-base b/xios_2311_src/trunk/.svn/pristine/13/13e3658358bf9d952c3aadf7eab20caac1ce775e.svn-base deleted file mode 100644 index 633c7bf5ac51c4ee644a43968cc36af9e4acd7b2..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/13/13e3658358bf9d952c3aadf7eab20caac1ce775e.svn-base +++ /dev/null @@ -1,26 +0,0 @@ -NETCDF_INCDIR="" -NETCDF_LIBDIR="" -NETCDF_LIB="" - -MPI_INCDIR="" -MPI_LIBDIR="" -MPI_LIB="" - -HDF5_INCDIR="" -HDF5_LIBDIR="" -HDF5_LIB="" - -BOOST_INCDIR="-I$BOOST_INCDIR" -BOOST_LIBDIR="-L$BOOST_LIBDIR" -BOOST_LIB="" - -BLITZ_INCDIR="-I$BLITZ_INCDIR" -BLITZ_LIBDIR="-L$BLITZ_LIBDIR" -BLITZ_LIB="" - -OASIS_INCDIR="" -OASIS_LIBDIR="" -OASIS_LIB="" -#OASIS_INCDIR="-I$PWD/../../oasis3-mct/BLD/build/lib/psmile.MPI1" -#OASIS_LIBDIR="-L$PWD/../../oasis3-mct/BLD/lib" -#OASIS_LIB="-lpsmile.MPI1 -lscrip -lmct -lmpeu" diff --git a/xios_2311_src/trunk/.svn/pristine/14/146015bc0c3ee896045050282b0cc66909c2a45e.svn-base b/xios_2311_src/trunk/.svn/pristine/14/146015bc0c3ee896045050282b0cc66909c2a45e.svn-base deleted file mode 100644 index addccf90c696c10aff2b4e30504b97fd5131c787..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/14/146015bc0c3ee896045050282b0cc66909c2a45e.svn-base +++ /dev/null @@ -1,71 +0,0 @@ -#ifndef __XIOS_DATA_OUTPUT__ -#define __XIOS_DATA_OUTPUT__ - -/// XIOS headers /// -#include "xios_spl.hpp" -#include "exception.hpp" -#include "grid.hpp" -#include "field.hpp" - - -namespace xios -{ - /// ////////////////////// Déclarations ////////////////////// /// - class CDataOutput - { - public : - - /// Définition de type /// - typedef enum { ONE_FILE = 0, MULTI_GROUP, MULTI_FILE } EDataOutputType; - - /// Ecriture /// - void writeFile (CFile* file); - void writeAttribute(CVariable* var); - void syncFile (void); - void closeFile (void); - void writeField (CField* field); - void writeFieldTimeAxis(CField* field) ; - void writeFieldGrid(CField* field); - void writeTimeDimension(void); - int writeFieldData(CField* field, const CArray& data, const CDate& lastWrite, const CDate& currentWrite, int nstep); - - virtual void definition_start(void) = 0; - virtual void definition_end(void) = 0; - - //!< Test if the file was opened in append mode - virtual bool IsInAppendMode() const { return appendMode; }; - - virtual ~CDataOutput(void); - - protected: - - /// Ecriture /// - void writeGrid(CGrid* grid, bool allowCompressedOutput = false); - void writeGrid(CDomain* domain, CAxis* axis); - void writeGrid(CDomain* domain); - void writeGrid(std::vector domain, std::vector axis); - void writeGrid(std::vector domains, std::vector axis, std::vector scalars); - - virtual void writeFile_ (CFile* file) = 0; - virtual void writeAttribute_(CVariable* var) = 0; - virtual void closeFile_ (void) = 0; - virtual void syncFile_ (void) = 0; - virtual void writeField_ (CField* field) = 0; - virtual int writeFieldData_ (CField* field, const CArray& data, const CDate& lastWrite, const CDate& currentWrite, int nstep) = 0; - virtual void writeDomain_ (CDomain* domain) = 0; - virtual void writeAxis_ (CAxis* axis) = 0; - virtual void writeScalar_ (CScalar* scalar) = 0; - virtual void writeGridCompressed_(CGrid* grid) = 0; - virtual void writeTimeDimension_(void) = 0; - virtual void writeTimeAxis_ (CField* field, - const std::shared_ptr cal) = 0; - - /// Propriétés protégées /// - EDataOutputType type; - bool appendMode; //!< If true, we are appending data to an existing file - - }; // class CDataOutput - -} // namespace xios - -#endif //__XIOS_DATA_OUTPUT__ diff --git a/xios_2311_src/trunk/.svn/pristine/14/14888fa9195ae66db453a7ef922ac61376aca05d.svn-base b/xios_2311_src/trunk/.svn/pristine/14/14888fa9195ae66db453a7ef922ac61376aca05d.svn-base deleted file mode 100644 index 42c049bea624d3e67db6be474ebc741eed501b7e..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/14/14888fa9195ae66db453a7ef922ac61376aca05d.svn-base +++ /dev/null @@ -1,58 +0,0 @@ -#include "xios_spl.hpp" -#include "event_client.hpp" -#include "buffer_out.hpp" -#include "message.hpp" -#include "type.hpp" -#include "mpi.hpp" -#include "cxios.hpp" - -namespace xios -{ - const size_t CEventClient::headerSize = sizeof(int) + sizeof(size_t) + sizeof(int) + sizeof(int) + sizeof(int); // The two last one signify sizeof(classId) and sizeof(typeId) - - - CEventClient::CEventClient(int classId_, int typeId_) - { - classId = classId_; - typeId = typeId_; - } - - void CEventClient::push(int rank, int nbSender, CMessage& msg) - { - nbSenders.push_back(nbSender); - ranks.push_back(rank); - messages.push_back(&msg); - } - - bool CEventClient::isEmpty(void) - { - return ranks.empty(); - } - - std::list CEventClient::getRanks(void) - { - return ranks; - } - - std::list CEventClient::getSizes(void) - { - std::list::iterator it; - std::list sizes; - - for (it = messages.begin(); it != messages.end(); ++it) sizes.push_back((*it)->size() + headerSize); - return sizes; - } - - void CEventClient::send(size_t timeLine, const std::list& sizes, std::list& buffers) - { - std::list::iterator itBuff = buffers.begin(); - std::list::const_iterator itSizes = sizes.begin(), itSenders = nbSenders.begin(); - std::list::iterator itMsg = messages.begin(); - - if (CXios::checkEventSync) info(100)<<"Send event "<& doutput); - CInstant(CArray& doutput, double missingValue); - //CInstant(const CInstant & instant); // Not implemented. - //CInstant(const CInstant * const instant); // Not implemented. - - /// Traitement /// - virtual void apply(const CArray& dinput, CArray& doutput); - virtual ETimeType timeType(void) { return instant ; } - - /// Destructeur /// - virtual ~CInstant(void); - - }; // class CInstant - - } // namespace func -} // namespace xios - -#endif //__XIOS_CInstant__ diff --git a/xios_2311_src/trunk/.svn/pristine/14/14b8508d692a0cff2749314b7de7481ae8172291.svn-base b/xios_2311_src/trunk/.svn/pristine/14/14b8508d692a0cff2749314b7de7481ae8172291.svn-base deleted file mode 100644 index 349ebca6cdfa1dad68380939374072df4cd48cc8..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/14/14b8508d692a0cff2749314b7de7481ae8172291.svn-base +++ /dev/null @@ -1,68 +0,0 @@ -/********************************************************************* - * Copyright 1993, UCAR/Unidata - * See netcdf/COPYRIGHT file for copying and redistribution conditions. - * $Header: /upc/share/CVS/netcdf-3/libncdap3/dapdump.h,v 1.9 2010/04/10 20:56:37 dmh Exp $ - *********************************************************************/ -#ifndef DUMP_H -#define DUMP_H - -typedef struct Dimschema { - int dimid; -/* int cloneid;*/ - size_t size; - char name[NC_MAX_NAME+1]; -} Dim; - -typedef struct Varschema { - int varid; -/* int cloneid;*/ - char name[NC_MAX_NAME+1]; - nc_type nctype; - int ndims; - int dimids[NC_MAX_VAR_DIMS]; - size_t nelems; /*# elements*/ - size_t alloc; /* malloc size*/ - int natts; - NCattribute* atts; -} Var; - -typedef struct NChdr { - int ncid; - int format; - int ndims; - int nvars; - int ngatts; - int unlimid; /* id of the (1) unlimited dimension*/ - Dim* dims; - Var* vars; - NCattribute* gatts; - NCbytes* content; -} NChdr; - -extern int dumpmetadata(int ncid, NChdr**); -extern void dumpdata1(nc_type nctype, size_t index, char* data); - -extern char* dumppath(struct CDFnode* node); -extern char* dumptree(CDFnode* root); -extern char* dumpvisible(CDFnode* root); -extern char* dumpnode(CDFnode* node); - -extern char* dumpalign(struct NCalignment*); - -extern char* dumpcachenode(NCcachenode* node); -extern char* dumpcache(NCcache* cache); - -extern int dumpmetadata(int ncid, NChdr** hdrp); -extern void dumpdata1(nc_type nctype, size_t index, char* data); -extern char* dumpprojections(NClist* projections); -extern char* dumpprojection(DCEprojection* proj); -extern char* dumpselections(NClist* selections); -extern char* dumpselection(DCEselection* sel); -extern char* dumpconstraint(DCEconstraint* con); -extern char* dumpsegments(NClist* segments); -extern char* dumpslice(DCEslice* slice); -extern char* dumpslices(DCEslice* slice, unsigned int rank); - - -#endif /*DUMP_H*/ - diff --git a/xios_2311_src/trunk/.svn/pristine/14/14e31f84720723592faeaa8d7e3d7cd1d6771606.svn-base b/xios_2311_src/trunk/.svn/pristine/14/14e31f84720723592faeaa8d7e3d7cd1d6771606.svn-base deleted file mode 100644 index ff22fdda5b00c167eeefb043b8a65d76fffacb51..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/14/14e31f84720723592faeaa8d7e3d7cd1d6771606.svn-base +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -source ./load_env -(cd HTML && ./copy_html_${xios_machine_name}) diff --git a/xios_2311_src/trunk/.svn/pristine/14/14e55f4466211b82387e8d071522e5c79a63af81.svn-base b/xios_2311_src/trunk/.svn/pristine/14/14e55f4466211b82387e8d071522e5c79a63af81.svn-base deleted file mode 100644 index 9ddd4eab9701e94799bd61a54acbab22097f7226..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/14/14e55f4466211b82387e8d071522e5c79a63af81.svn-base +++ /dev/null @@ -1,113 +0,0 @@ -#include "xios_spl.hpp" -#include "message.hpp" -#include "base_type.hpp" -#include "buffer_in.hpp" -#include "buffer_out.hpp" - -namespace xios -{ - - CMessage::CMessage(void) {} - - CMessage::CMessage(const CMessage& msg) - { - for(auto type : msg.typeList) push(*type) ; - } - - - CMessage& CMessage::push(const CBaseType& type) - { - typeList.push_back(type.clone()); - return *this ; - } - -// CMessage& CMessage::push(CBaseType& type) -// { -// typeList.push_back(&type); -// return *this ; -// } - - size_t CMessage::size(void) const - { - list::const_iterator it; - size_t retSize=0 ; - - for(it=typeList.begin();it!=typeList.end();it++) retSize+=(*it)->size() ; - return retSize ; - } - - bool CMessage::fromBuffer(CBufferIn& buffer) const - { - list::const_iterator it; - - if (buffer.remain()>=size()) - { - for(it=typeList.begin();it!=typeList.end();it++) (*it)->fromBuffer(buffer) ; - return true ; - } - else - { - return false ; - } - } - - - bool CMessage::toBuffer(CBufferOut& buffer) const - { - list::const_iterator it; - if (buffer.remain()>=size()) - { - for(it=typeList.begin();it!=typeList.end();it++) (*it)->toBuffer(buffer) ; - return true ; - } - else - { - return false ; - } - - } - - - void CMessage::clear() - { - list::iterator it; - for(it=typeList.begin();it!=typeList.end();it++) delete *it ; - typeList.clear() ; - } - - CMessage::~CMessage() - { - clear() ; - } - - - CBufferOut& operator<<(CBufferOut& buffer, CMessage& msg) - { - if (!msg.toBuffer(buffer)) ERROR("CBufferOut& operator<<(CBufferOut& buffer, CMessage& msg)", - << "Not enough free space in buffer to queue the message."); - return buffer ; - return buffer ; - } - - - CBufferIn& operator>>(CBufferIn& buffer, CMessage& msg) - { - if (!msg.fromBuffer(buffer)) ERROR("CBufferIn& operator>>(CBufferIn& buffer, CMessage& msg)", - << "Not enough data in buffer to unqueue the message."); - return buffer ; - return buffer ; - } - - CMessage& operator<<(CMessage& msg,const CBaseType& type) - { - msg.push(type) ; - return msg ; - } - -// CMessage& operator<<(CMessage& msg, const CBaseType& type) -// { -// msg.push(*type.clone()) ; -// return msg ; -// } - -} diff --git a/xios_2311_src/trunk/.svn/pristine/15/1525e466c9f6fa786e6966240c217fb4ca817101.svn-base b/xios_2311_src/trunk/.svn/pristine/15/1525e466c9f6fa786e6966240c217fb4ca817101.svn-base deleted file mode 100644 index c696e83a7e2e7589b4dd4133b688d6b8607e6195..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/15/1525e466c9f6fa786e6966240c217fb4ca817101.svn-base +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -export arch=X64_IRENE -export mode=prod - -bash ./run_test - - -export arch=X64_IRENE_GNU -export mode=prod - -bash ./run_test - - -# Must be run after main (X64_IRENE, prod) test to append in the same report -export arch=X64_IRENE -export mode=prod -export enable_mem_track="--memtrack full" - -bash ./run_test - - -#export arch=X64_IRENE -#export mode=debug - -#bash ./run_test - diff --git a/xios_2311_src/trunk/.svn/pristine/15/156faa9b35e034158676aaca387a584acf3e17c2.svn-base b/xios_2311_src/trunk/.svn/pristine/15/156faa9b35e034158676aaca387a584acf3e17c2.svn-base deleted file mode 100644 index 76b43ac25d30264037784a6cded6561df5ba19ac..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/15/156faa9b35e034158676aaca387a584acf3e17c2.svn-base +++ /dev/null @@ -1,26 +0,0 @@ -################################################################################ -################### Projet XIOS ################### -################################################################################ - -%CCOMPILER mpicc -trace -DITAC -I$ITAC_INCDIR -%FCOMPILER mpif90 -trace -%LINKER mpif90 -trace -nofor-main -L$ITAC_LIBDIR - -%BASE_CFLAGS -std=c++11 -diag-disable 1125 -diag-disable 279 -%PROD_CFLAGS -g -Ofast -xHost -D BOOST_DISABLE_ASSERTS -#%DEV_CFLAGS -g -traceback -%DEV_CFLAGS -g -%DEBUG_CFLAGS -DBZ_DEBUG -g -traceback -fno-inline - -%BASE_FFLAGS -D__NONE__ -%PROD_FFLAGS -O3 -g -traceback -#%DEV_FFLAGS -g -traceback -%DEV_FFLAGS -g -%DEBUG_FFLAGS -g -traceback - -%BASE_INC -D__NONE__ -%BASE_LD -lstdc++ - -%CPP mpicc -EP -%FPP cpp -P -%MAKE gmake diff --git a/xios_2311_src/trunk/.svn/pristine/15/1574cda771be50a04d1ac4748991399b01133f85.svn-base b/xios_2311_src/trunk/.svn/pristine/15/1574cda771be50a04d1ac4748991399b01133f85.svn-base deleted file mode 100644 index dc8a2b057f03c3840ab24167e04b2cce1c23bcc4..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/15/1574cda771be50a04d1ac4748991399b01133f85.svn-base +++ /dev/null @@ -1,176 +0,0 @@ -/*! \file - Functions for Enum Types - - Copyright 2011 University Corporation for Atmospheric - Research/Unidata. See \ref copyright file for more info. */ - -#include "ncdispatch.h" - -/** \name Enum Types - Functions to create and learn about enum types. */ -/*! \{ */ /* All these functions are part of this named group... */ - -/** \ingroup user_types -Create an enum type. Provide an ncid, a name, and a base integer type. - -After calling this function, fill out the type with repeated calls to -nc_insert_enum(). Call nc_insert_enum() once for each value you wish -to make part of the enumeration. - -\param ncid \ref ncid - -\param base_typeid The base integer type for this enum. Must be one -of: ::NC_BYTE, ::NC_UBYTE, ::NC_SHORT, ::NC_USHORT, ::NC_INT, -::NC_UINT, ::NC_INT64, ::NC_UINT64. - -\param name \ref object_name of new type. - -\param typeidp A pointer to an nc_type. The typeid of the new type -will be placed there. - -\returns ::NC_NOERR No error. -\returns ::NC_EBADID Bad \ref ncid. -\returns ::NC_EBADTYPE Bad type id. -\returns ::NC_ENOTNC4 Not an netCDF-4 file, or classic model enabled. -\returns ::NC_EHDFERR An error was reported by the HDF5 layer. -\returns ::NC_ENAMEINUSE That name is in use. -\returns ::NC_EMAXNAME Name exceeds max length NC_MAX_NAME. -\returns ::NC_EBADNAME Name contains illegal characters. -\returns ::NC_EPERM Attempt to write to a read-only file. -\returns ::NC_ENOTINDEFINE Not in define mode. - */ -int -nc_def_enum(int ncid, nc_type base_typeid, const char *name, nc_type *typeidp) -{ - NC* ncp; - int stat = NC_check_id(ncid,&ncp); - if(stat != NC_NOERR) return stat; - return ncp->dispatch->def_enum(ncid,base_typeid,name,typeidp); -} - -/** \ingroup user_types -Insert a named member into a enum type. - -\param ncid \ref ncid -\param xtype -\param name The identifier (\ref object_name) of the new member. -\param value The value that is to be associated with this member. - -\returns ::NC_NOERR No error. -\returns ::NC_EBADID Bad \ref ncid. -\returns ::NC_EBADTYPE Bad type id. -\returns ::NC_ENOTNC4 Not an netCDF-4 file, or classic model enabled. -\returns ::NC_EHDFERR An error was reported by the HDF5 layer. -\returns ::NC_ENAMEINUSE That name is in use. -\returns ::NC_EMAXNAME Name exceeds max length NC_MAX_NAME. -\returns ::NC_EBADNAME Name contains illegal characters. -\returns ::NC_EPERM Attempt to write to a read-only file. -\returns ::NC_ENOTINDEFINE Not in define mode. - */ -int -nc_insert_enum(int ncid, nc_type xtype, const char *name, - const void *value) -{ - NC *ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return ncp->dispatch->insert_enum(ncid, xtype, name, - value); -} - -/** \ingroup user_types -Learn about a user-define enumeration type. - -\param ncid \ref ncid - -\param xtype Typeid to inquire about. - -\param name \ref object_name of type will be copied here. \ref -ignored_if_null. - -\param base_nc_typep Typeid if the base type of the enum.\ref -ignored_if_null. - -\param base_sizep Pointer that will get the size in bytes of the base -type. \ref ignored_if_null. - -\param num_membersp Pointer that will get the number of members -defined for this enum type. \ref ignored_if_null. - -\returns ::NC_NOERR No error. -\returns ::NC_EBADID Bad \ref ncid. -\returns ::NC_EBADTYPE Bad type id. -\returns ::NC_ENOTNC4 Not an netCDF-4 file, or classic model enabled. -\returns ::NC_EHDFERR An error was reported by the HDF5 layer. - */ -int -nc_inq_enum(int ncid, nc_type xtype, char *name, nc_type *base_nc_typep, - size_t *base_sizep, size_t *num_membersp) -{ - int class = 0; - int stat = nc_inq_user_type(ncid, xtype, name, base_sizep, - base_nc_typep, num_membersp, &class); - if(stat != NC_NOERR) return stat; - if(class != NC_ENUM) stat = NC_EBADTYPE; - return stat; -} - -/** \ingroup user_types -Learn about a about a member of an enum type. - -\param ncid \ref ncid - -\param xtype Typeid of the enum type. - -\param idx Index to the member to inquire about. - -\param name The identifier (\ref object_name) of this member will be -copied here. \ref ignored_if_null. - -\param value The value of this member will be copied here. \ref -ignored_if_null. - -\returns ::NC_NOERR No error. -\returns ::NC_EBADID Bad \ref ncid. -\returns ::NC_EBADTYPE Bad type id. -\returns ::NC_ENOTNC4 Not an netCDF-4 file, or classic model enabled. -\returns ::NC_EHDFERR An error was reported by the HDF5 layer. - */ -int -nc_inq_enum_member(int ncid, nc_type xtype, int idx, char *name, - void *value) -{ - NC *ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return ncp->dispatch->inq_enum_member(ncid, xtype, idx, name, value); -} - -/** \ingroup user_types -Get the name which is associated with an enum member value. - -\param ncid \ref ncid - -\param xtype Typeid of the enum type. - -\param value Value of interest. - -\param identifier The identifier (\ref object_name) of this value will -be copied here. \ref ignored_if_null. - -\returns ::NC_NOERR No error. -\returns ::NC_EBADID Bad \ref ncid. -\returns ::NC_EBADTYPE Bad type id. -\returns ::NC_ENOTNC4 Not an netCDF-4 file, or classic model enabled. -\returns ::NC_EHDFERR An error was reported by the HDF5 layer. - */ -int -nc_inq_enum_ident(int ncid, nc_type xtype, long long value, - char *identifier) -{ - NC* ncp; - int stat = NC_check_id(ncid,&ncp); - if(stat != NC_NOERR) return stat; - return ncp->dispatch->inq_enum_ident(ncid,xtype,value,identifier); -} -/*! \} */ /* End of named group ...*/ diff --git a/xios_2311_src/trunk/.svn/pristine/15/15adfb87daa1cc2f16ec7e5d14bbf9e2c436d9dd.svn-base b/xios_2311_src/trunk/.svn/pristine/15/15adfb87daa1cc2f16ec7e5d14bbf9e2c436d9dd.svn-base deleted file mode 100644 index 18d68dfede57e87112257c827583e92cece33b9a..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/15/15adfb87daa1cc2f16ec7e5d14bbf9e2c436d9dd.svn-base +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef __ELEMENT_HPP__ -#define __ELEMENT_HPP__ - -#include "xios_spl.hpp" -#include "array_new.hpp" -#include "element_view.hpp" -#include "exception.hpp" -#include "context_client.hpp" -#include "context_server.hpp" - -namespace xios -{ - class CDistributedView ; - class CLocalView; - class CLocalConnector ; - - class CDistributedElement : public std::enable_shared_from_this - { - - protected: - std::map> globalIndex_ ; - std::map localSize_ ; - size_t globalSize_ ; - std::vector> views_= std::vector>(CElementView::numViewType_) ; - CDistributedElement(void) {} ; - - public: - CDistributedElement(int globalSize, const map>& globalIndex) ; - CDistributedElement(CEventServer& event) ; - void addFullView(void) ; - void sendToServer(CContextClient* client, CEventClient& event, const CMessage& messageHeader) ; - void recvFromClient(CEventServer& event) ; - size_t getGlobalSize(void) { return globalSize_;} - std::map>& getGlobalIndex(void) { return globalIndex_;} - - shared_ptr getView(CElementView::type type) - { - if (views_[(size_t)type]==nullptr) { ERROR("CDistributedElement::getView(CElementView::type type)",<<"View is not initialized");} - else return views_[(size_t)type] ; - } - - void addView(CElementView::type type, std::map>& indexView) ; - void addView(CElementView::type type, std::map>& maskView) ; - void sendToServer(CEventClient& event, const CMessage& messageHeader) ; - - friend class CDistributedView ; - } ; - - - class CLocalElement : public CDistributedElement - { - // keep local connector inside - std::map, shared_ptr> connectors_ ; - - public: - CLocalElement(int localRank, size_t globalSize, CArray& globalIndex) ; - CLocalElement(int localRank, CEventServer& event) ; - void recvFromClient(int localRank, CEventServer& event) ; - const CArray& getGlobalIndex(void) { return globalIndex_ ;} - void addView(CElementView::type type, CArray& indexView) ; - void addView(CElementView::type type, CArray& maskView) ; - void addFullView(void) ; - - shared_ptr getView(CElementView::type type) ; - /* { - if (views_[(size_t)type]==nullptr) { ERROR("CLocalElement::getView(CElementView::type type)",<<"View is not initialized");} - else return static_pointer_cast(views_[(size_t)type]) ; - } -*/ - shared_ptr getConnector(CElementView::type srcType, CElementView::type dstType) ; - - private : - int localRank_; - CArray& globalIndex_ ; - int& localSize_ ; - - friend class CLocalView ; - } ; - -} - -#endif - diff --git a/xios_2311_src/trunk/.svn/pristine/16/160c05e19b0a740ffdf07c82e85ca99225b5d71c.svn-base b/xios_2311_src/trunk/.svn/pristine/16/160c05e19b0a740ffdf07c82e85ca99225b5d71c.svn-base deleted file mode 100644 index ffce2950c3f80e32def2ffbc5f1f88ca14663983..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/16/160c05e19b0a740ffdf07c82e85ca99225b5d71c.svn-base +++ /dev/null @@ -1,224 +0,0 @@ -/* Copyright 2009, UCAR/Unidata and OPeNDAP, Inc. - See the COPYRIGHT file for more information. */ -#include -#include -#include - -#include "nclist.h" - -static ncelem ncDATANULL = (ncelem)0; -/*static int ncinitialized=0;*/ - -int nclistnull(ncelem e) {return e == ncDATANULL;} - -#ifndef TRUE -#define TRUE 1 -#endif -#ifndef FALSE -#define FALSE 0 -#endif - -#define DEFAULTALLOC 16 -#define ALLOCINCR 16 - -NClist* nclistnew(void) -{ - NClist* l; -/* - if(!ncinitialized) { - memset((void*)&ncDATANULL,0,sizeof(ncelem)); - ncinitialized = 1; - } -*/ - l = (NClist*)malloc(sizeof(NClist)); - if(l) { - l->alloc=0; - l->length=0; - l->content=NULL; - } - return l; -} - -int -nclistfree(NClist* l) -{ - if(l) { - l->alloc = 0; - if(l->content != NULL) {free(l->content); l->content = NULL;} - free(l); - } - return TRUE; -} - -int -nclistsetalloc(NClist* l, unsigned int sz) -{ - ncelem* newcontent; - if(l == NULL) return FALSE; - if(sz <= 0) {sz = (l->length?2*l->length:DEFAULTALLOC);} - if(l->alloc >= sz) {return TRUE;} - newcontent=(ncelem*)calloc(sz,sizeof(ncelem)); - if(l->alloc > 0 && l->length > 0 && l->content != NULL) { - memcpy((void*)newcontent,(void*)l->content,sizeof(ncelem)*l->length); - } - if(l->content != NULL) free(l->content); - l->content=newcontent; - l->alloc=sz; - return TRUE; -} - -int -nclistsetlength(NClist* l, unsigned int sz) -{ - if(l == NULL) return FALSE; - if(sz > l->alloc && !nclistsetalloc(l,sz)) return FALSE; - l->length = sz; - return TRUE; -} - -ncelem -nclistget(NClist* l, unsigned int index) -{ - if(l == NULL || l->length == 0) return ncDATANULL; - if(index >= l->length) return ncDATANULL; - return l->content[index]; -} - -int -nclistset(NClist* l, unsigned int index, ncelem elem) -{ - if(l == NULL) return FALSE; - if(index >= l->length) return FALSE; - l->content[index] = elem; - return TRUE; -} - -/* Insert at position i of l; will push up elements i..|seq|. */ -int -nclistinsert(NClist* l, unsigned int index, ncelem elem) -{ - int i; /* do not make unsigned */ - if(l == NULL) return FALSE; - if(index > l->length) return FALSE; - nclistsetalloc(l,0); - for(i=(int)l->length;i>index;i--) l->content[i] = l->content[i-1]; - l->content[index] = elem; - l->length++; - return TRUE; -} - -int -nclistpush(NClist* l, ncelem elem) -{ - if(l == NULL) return FALSE; - if(l->length >= l->alloc) nclistsetalloc(l,0); - l->content[l->length] = elem; - l->length++; - return TRUE; -} - -ncelem -nclistpop(NClist* l) -{ - if(l == NULL || l->length == 0) return ncDATANULL; - l->length--; - return l->content[l->length]; -} - -ncelem -nclisttop(NClist* l) -{ - if(l == NULL || l->length == 0) return ncDATANULL; - return l->content[l->length - 1]; -} - -ncelem -nclistremove(NClist* l, unsigned int i) -{ - unsigned int len; - ncelem elem; - if(l == NULL || (len=l->length) == 0) return ncDATANULL; - if(i >= len) return ncDATANULL; - elem = l->content[i]; - for(i+=1;icontent[i-1] = l->content[i]; - l->length--; - return elem; -} - -/* Duplicate and return the content (null terminate) */ -ncelem* -nclistdup(NClist* l) -{ - ncelem* result = (ncelem*)malloc(sizeof(ncelem)*(l->length+1)); - memcpy((void*)result,(void*)l->content,sizeof(ncelem)*l->length); - result[l->length] = (ncelem)0; - return result; -} - -int -nclistcontains(NClist* list, ncelem elem) -{ - unsigned int i; - for(i=0;ilength) == 0) return ncDATANULL; - for(i=0;icontent[i]; - if(elem == candidate) { - for(i+=1;icontent[i-1] = l->content[i]; - l->length--; - found = 1; - break; - } - } - return found; -} - - - - -/* Extends nclist to include a unique operator - which remove duplicate values; NULL values removed - return value is always 1. -*/ - -int -nclistunique(NClist* list) -{ - unsigned int i,j,k,len; - ncelem* content; - if(list == NULL || list->length == 0) return 1; - len = list->length; - content = list->content; - for(i=0;ilength = len; - return 1; -} - -NClist* -nclistclone(NClist* list) -{ - NClist* clone = nclistnew(); - *clone = *list; - clone->content = nclistdup(list); - return clone; -} diff --git a/xios_2311_src/trunk/.svn/pristine/16/1620d5f5a1131b647ea53f78fc38ca22a756c35b.svn-base b/xios_2311_src/trunk/.svn/pristine/16/1620d5f5a1131b647ea53f78fc38ca22a756c35b.svn-base deleted file mode 100644 index a5fd68c23a22f92bb8542455a683451124bbbdc0..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/16/1620d5f5a1131b647ea53f78fc38ca22a756c35b.svn-base +++ /dev/null @@ -1,661 +0,0 @@ -#include - -#include "onetcdf4.hpp" -#include "group_template.hpp" -#include "mpi.hpp" -#include "netcdf.hpp" -#include "netCdfInterface.hpp" -#include "netCdfException.hpp" -#include "timer.hpp" - -namespace xios -{ - /// ////////////////////// Définitions ////////////////////// /// - - CONetCDF4::CONetCDF4(const StdString& filename, bool append, bool useClassicFormat, - bool useCFConvention, - const MPI_Comm* comm, bool multifile, const StdString& timeCounterName) - : path() - , wmpi(false) - , useClassicFormat(useClassicFormat) - , useCFConvention(useCFConvention) - { - this->initialize(filename, append, useClassicFormat, useCFConvention, comm, multifile, timeCounterName); - } - - //--------------------------------------------------------------- - - CONetCDF4::~CONetCDF4(void) - { - } - - ///-------------------------------------------------------------- - - void CONetCDF4::initialize(const StdString& filename, bool append, bool useClassicFormat, bool useCFConvention, - const MPI_Comm* comm, bool multifile, const StdString& timeCounterName) - { - this->useClassicFormat = useClassicFormat; - this->useCFConvention = useCFConvention; - - int mode = useClassicFormat ? 0 : NC_NETCDF4; - - // Don't use parallel mode if there is only one process - if (comm) - { - int commSize = 0; - MPI_Comm_size(*comm, &commSize); - if (commSize <= 1) - comm = NULL; - } - wmpi = comm && !multifile; - - if (wmpi) - mode |= useClassicFormat ? NC_PNETCDF : NC_MPIIO; - - // If the file does not exist, we always create it - if (!append || !std::ifstream(filename.c_str())) - { - CTimer::get("Files : create").resume(); - if (wmpi) - CNetCdfInterface::createPar(filename, mode, *comm, MPI_INFO_NULL, this->ncidp); - else - CNetCdfInterface::create(filename, mode, this->ncidp); - CTimer::get("Files : create").suspend(); - - this->appendMode = false; - } - else - { - mode |= NC_WRITE; - CTimer::get("Files : open").resume(); - if (wmpi) - CNetCdfInterface::openPar(filename, mode, *comm, MPI_INFO_NULL, this->ncidp); - else - CNetCdfInterface::open(filename, mode, this->ncidp); - CTimer::get("Files : open").suspend(); - this->appendMode = true; - } - - // If the classic NetCDF format is used, we enable the "no-fill mode" globally. - // This is done per variable for the NetCDF4 format. - if (useClassicFormat) - CNetCdfInterface::setFill(this->ncidp, false); - - this->timeCounterName = timeCounterName; - } - - void CONetCDF4::close() - { - CTimer::get("Files : close").resume(); - CNetCdfInterface::close(this->ncidp); - CTimer::get("Files : close").suspend(); - } - - //--------------------------------------------------------------- - - void CONetCDF4::definition_start(void) - { - CNetCdfInterface::reDef(this->ncidp); - } - - //--------------------------------------------------------------- - - void CONetCDF4::definition_end(void) - { - CNetCdfInterface::endDef(this->ncidp); - } - - //--------------------------------------------------------------- - - int CONetCDF4::getCurrentGroup(void) - { - return this->getGroup(this->getCurrentPath()); - } - - //--------------------------------------------------------------- - - int CONetCDF4::getGroup(const CONetCDF4Path& path) - { - int retvalue = this->ncidp; - - CONetCDF4Path::const_iterator it = path.begin(), end = path.end(); - - for (; it != end; it++) - { - const StdString& groupid = *it; - CNetCdfInterface::inqNcId(retvalue, groupid, retvalue); - } - return retvalue; - } - - //--------------------------------------------------------------- - - int CONetCDF4::getVariable(const StdString& varname) - { - int varid = 0; - int grpid = this->getCurrentGroup(); - CNetCdfInterface::inqVarId(grpid, varname, varid); - return varid; - } - - //--------------------------------------------------------------- - - int CONetCDF4::getDimension(const StdString& dimname) - { - int dimid = 0; - int grpid = this->getCurrentGroup(); - CNetCdfInterface::inqDimId(grpid, dimname, dimid); - return dimid; - } - - //--------------------------------------------------------------- - - int CONetCDF4::getUnlimitedDimension(void) - { - int dimid = 0; - int grpid = this->getCurrentGroup(); - CNetCdfInterface::inqUnLimDim(grpid, dimid); - return dimid; - } - - StdString CONetCDF4::getUnlimitedDimensionName(void) - { - int grpid = this->getGroup(path); - int dimid = this->getUnlimitedDimension(); - - StdString dimname; - if (dimid != -1) - CNetCdfInterface::inqDimName(grpid, dimid, dimname); - return dimname; - } - - //--------------------------------------------------------------- - - std::vector CONetCDF4::getDimensions(const StdString& varname) - { - StdSize size = 0; - std::vector retvalue; - int grpid = this->getCurrentGroup(); - int varid = this->getVariable(varname); - int nbdim = 0, *dimid = NULL; - - CNetCdfInterface::inqVarNDims(grpid, varid, nbdim); - dimid = new int[nbdim](); - CNetCdfInterface::inqVarDimId(grpid, varid, dimid); - - for (int i = 0; i < nbdim; i++) - { - CNetCdfInterface::inqDimLen(grpid, dimid[i], size); - if (size == NC_UNLIMITED) - size = UNLIMITED_DIM; - retvalue.push_back(size); - } - delete [] dimid; - return retvalue; - } - - std::vector CONetCDF4::getDimensionsIdList(const std::string* _varname) - { - int nDimNull = 0; - int nbdim = 0, *dimid = NULL; - int grpid = this->getCurrentGroup(); - int varid = (_varname != NULL) ? this->getVariable(*_varname) : NC_GLOBAL; - std::vector retvalue; - - if (_varname != NULL) - { - CNetCdfInterface::inqVarNDims(grpid, varid, nbdim); - dimid = new int[nbdim](); - CNetCdfInterface::inqVarDimId(grpid, varid, dimid); - } - else - { - CNetCdfInterface::inqDimIds(grpid, nbdim, NULL, 1); - dimid = new int[nbdim](); - CNetCdfInterface::inqDimIds(grpid, nDimNull, dimid, 1); - } - - for (int i = 0; i < nbdim; i++) - { - std::string dimname; - CNetCdfInterface::inqDimName(grpid, dimid[i], dimname); - retvalue.push_back(dimname); - } - delete [] dimid; - - return retvalue; - } - - //--------------------------------------------------------------- - - void CONetCDF4::getTimeAxisBounds(CArray& timeAxisBounds, const StdString& name, bool collective) - { - int grpid = this->getCurrentGroup(); - int varid = this->getVariable(name); - - std::vector start(2), count(2); - start[0] = 0; - // Find out how many temporal records have been written already to the file we are opening - int ncUnlimitedDimId; - CNetCdfInterface::inqUnLimDim(this->ncidp, ncUnlimitedDimId); - CNetCdfInterface::inqDimLen(this->ncidp, ncUnlimitedDimId, count[0]); - start[1] = 0; - count[1] = 2; - - timeAxisBounds.resize(count[1], count[0]); - - if (this->wmpi && collective) - CNetCdfInterface::varParAccess(grpid, varid, NC_COLLECTIVE); - if (this->wmpi && !collective) - CNetCdfInterface::varParAccess(grpid, varid, NC_INDEPENDENT); - - CNetCdfInterface::getVaraType(grpid, varid, &start[0], &count[0], timeAxisBounds.dataFirst()); - } - - void CONetCDF4::getTimeAxisBounds(CArray& timeAxisBounds, const StdString& name, bool collective, size_t record) - { - int grpid = this->getCurrentGroup(); - int varid = this->getVariable(name); - - std::vector start(2), count(2); - start[0] = record; - count[0] = 1 ; - start[1] = 0; - count[1] = 2; - - timeAxisBounds.resize(2, 1); - - if (this->wmpi && collective) - CNetCdfInterface::varParAccess(grpid, varid, NC_COLLECTIVE); - if (this->wmpi && !collective) - CNetCdfInterface::varParAccess(grpid, varid, NC_INDEPENDENT); - - CNetCdfInterface::getVaraType(grpid, varid, &start[0], &count[0], timeAxisBounds.dataFirst()); - } - - - - const CONetCDF4::CONetCDF4Path& CONetCDF4::getCurrentPath(void) const - { return this->path; } - - void CONetCDF4::setCurrentPath(const CONetCDF4Path& path) - { this->path = path; } - - //--------------------------------------------------------------- - - int CONetCDF4::addGroup(const StdString& name) - { - int retvalue = 0; - int grpid = this->getCurrentGroup(); - CNetCdfInterface::defGrp(grpid, name, retvalue); - return retvalue; - } - - //--------------------------------------------------------------- - - int CONetCDF4::addDimension(const StdString& name, const StdSize size) - { - int retvalue = 0; - int grpid = this->getCurrentGroup(); - if (size != UNLIMITED_DIM) - CNetCdfInterface::defDim(grpid, name, size, retvalue); - else - CNetCdfInterface::defDim(grpid, name, NC_UNLIMITED, retvalue); - return retvalue; - } - - //--------------------------------------------------------------- - - int CONetCDF4::addVariable(const StdString& name, nc_type type, - const std::vector& dim, int compressionLevel) - { - int varid = 0; - std::vector dimids; - std::vector dimsizes; - int dimSize = dim.size(); - - StdSize size; - StdSize totalSize; - StdSize maxSize = 1024 * 1024 * 256; // == 2GB/8 if output double - - int grpid = this->getCurrentGroup(); - - std::vector::const_iterator it = dim.begin(), end = dim.end(); - - for (int idx = 0; it != end; it++, ++idx) - { - const StdString& dimid = *it; - dimids.push_back(this->getDimension(dimid)); - CNetCdfInterface::inqDimLen(grpid, this->getDimension(dimid), size); - if (size == NC_UNLIMITED) size = 1; - dimsizes.push_back(size); - } - - CNetCdfInterface::defVar(grpid, name, type, dimids.size(), &dimids[0], varid); - - // The classic NetCDF format does not support chunking nor fill parameters - if (!useClassicFormat) - { - // set chunksize : size of one record - // but must not be > 2GB (netcdf or HDF5 problem) - totalSize = 1; - for (vector::reverse_iterator it = dimsizes.rbegin(); it != dimsizes.rend(); ++it) - { - totalSize *= *it; - if (totalSize >= maxSize) *it = 1; - } - int storageType = (0 == dimSize) ? NC_CONTIGUOUS : NC_CHUNKED; - CNetCdfInterface::defVarChunking(grpid, varid, storageType, &dimsizes[0]); - CNetCdfInterface::defVarFill(grpid, varid, true, NULL); - } - - setCompressionLevel(name, compressionLevel) ; - - return varid; - } - - //--------------------------------------------------------------- - - void CONetCDF4::setCompressionLevel(const StdString& varname, int compressionLevel) - { - if (compressionLevel < 0 || compressionLevel > 9) - ERROR("void CONetCDF4::setCompressionLevel(const StdString& varname, int compressionLevel)", - "Invalid compression level for variable \"" << varname << "\", the value should range between 0 and 9."); - if (compressionLevel && wmpi) - ERROR("void CONetCDF4::setCompressionLevel(const StdString& varname, int compressionLevel)", - "Impossible to use compression for variable \"" << varname << "\" when using parallel mode."); - - int grpid = this->getCurrentGroup(); - int varid = this->getVariable(varname); - CNetCdfInterface::defVarDeflate(grpid, varid, compressionLevel); - } - - //--------------------------------------------------------------- - - template <> - void CONetCDF4::addAttribute(const StdString& name, const StdString& value, const StdString* varname) - { - int grpid = this->getCurrentGroup(); - int varid = (varname == NULL) ? NC_GLOBAL : this->getVariable(*varname); - CNetCdfInterface::putAttType(grpid, varid, name, value.size(), value.c_str()); - } - - //--------------------------------------------------------------- - - template <> - void CONetCDF4::addAttribute(const StdString& name, const double& value, const StdString* varname) - { - int grpid = this->getCurrentGroup(); - int varid = (varname == NULL) ? NC_GLOBAL : this->getVariable(*varname); - CNetCdfInterface::putAttType(grpid, varid, name, 1, &value); - } - - template <> - void CONetCDF4::addAttribute(const StdString& name, const CArray& value, const StdString* varname) - { - int grpid = this->getCurrentGroup(); - int varid = (varname == NULL) ? NC_GLOBAL : this->getVariable(*varname); - CNetCdfInterface::putAttType(grpid, varid, name, value.numElements(), value.dataFirst()); - } - //--------------------------------------------------------------- - - template <> - void CONetCDF4::addAttribute(const StdString& name, const float& value, const StdString* varname) - { - int grpid = this->getCurrentGroup(); - int varid = (varname == NULL) ? NC_GLOBAL : this->getVariable(*varname); - CNetCdfInterface::putAttType(grpid, varid, name, 1, &value); - } - - template <> - void CONetCDF4::addAttribute(const StdString& name, const CArray& value, const StdString* varname) - { - int grpid = this->getCurrentGroup(); - int varid = (varname == NULL) ? NC_GLOBAL : this->getVariable(*varname); - CNetCdfInterface::putAttType(grpid, varid, name, value.numElements(), value.dataFirst()); - } - - //--------------------------------------------------------------- - - template <> - void CONetCDF4::addAttribute(const StdString& name, const int& value, const StdString* varname) - { - int grpid = this->getCurrentGroup(); - int varid = (varname == NULL) ? NC_GLOBAL : this->getVariable(*varname); - CNetCdfInterface::putAttType(grpid, varid, name, 1, &value); - } - - template <> - void CONetCDF4::addAttribute(const StdString& name, const CArray& value, const StdString* varname) - { - int grpid = this->getCurrentGroup(); - int varid = (varname == NULL) ? NC_GLOBAL : this->getVariable(*varname); - CNetCdfInterface::putAttType(grpid, varid, name, value.numElements(), value.dataFirst()); - } - - template <> - void CONetCDF4::addAttribute(const StdString& name, const short int& value, const StdString* varname) - { - int grpid = this->getCurrentGroup(); - int varid = (varname == NULL) ? NC_GLOBAL : this->getVariable(*varname); - CNetCdfInterface::putAttType(grpid, varid, name, 1, &value); - } - - template <> - void CONetCDF4::addAttribute(const StdString& name, const CArray& value, const StdString* varname) - { - int grpid = this->getCurrentGroup(); - int varid = (varname == NULL) ? NC_GLOBAL : this->getVariable(*varname); - CNetCdfInterface::putAttType(grpid, varid, name, value.numElements(), value.dataFirst()); - } - - template <> - void CONetCDF4::addAttribute(const StdString& name, const long int& value, const StdString* varname) - { - int grpid = this->getCurrentGroup(); - int varid = (varname == NULL) ? NC_GLOBAL : this->getVariable(*varname); - CNetCdfInterface::putAttType(grpid, varid, name, 1, &value); - } - - template <> - void CONetCDF4::addAttribute(const StdString& name, const CArray& value, const StdString* varname) - { - int grpid = this->getCurrentGroup(); - int varid = (varname == NULL) ? NC_GLOBAL : this->getVariable(*varname); - CNetCdfInterface::putAttType(grpid, varid, name, value.numElements(), value.dataFirst()); - } - - //--------------------------------------------------------------- - - void CONetCDF4::getWriteDataInfos(const StdString& name, StdSize record, StdSize& array_size, - std::vector& sstart, - std::vector& scount, - const std::vector* start, - const std::vector* count) - { - std::vector sizes = this->getDimensions(name); - if (sizes.size()==0) - { - - if ((start != NULL) && (count != NULL) && start->size()==1 && count->size()==1) // pur scalar case - array_size*=(*count)[0] ; - else array_size=1 ; - } - else - { - std::vector iddims = this->getDimensionsIdList (&name); - std::vector::const_iterator - it = sizes.begin(), end = sizes.end(); - int i = 0; - - if (iddims.begin()->compare(timeCounterName) == 0) - { - sstart.push_back(record); - scount.push_back(1); - if ((start == NULL) && (count == NULL)) i++; - it++; - if (it==end) - { - if ((start != NULL) && (count != NULL) && start->size()==1 && count->size()==1) // pur scalar case - { - scount[0]=(*count)[0] ; - array_size *= (*count)[0]; - } - } - } - - for (;it != end; it++) - { - if ((start != NULL) && (count != NULL)) - { - sstart.push_back((*start)[i]); - scount.push_back((*count)[i]); - array_size *= (*count)[i]; - i++; - } - else - { - sstart.push_back(0); - scount.push_back(sizes[i]); - array_size *= sizes[i]; - i++; - } - } - - } - } - - - template <> - void CONetCDF4::writeData_(int grpid, int varid, - const std::vector& sstart, - const std::vector& scount, const double* data) - { - CNetCdfInterface::putVaraType(grpid, varid, &sstart[0], &scount[0], data); - } - - //--------------------------------------------------------------- - - template <> - void CONetCDF4::writeData_(int grpid, int varid, - const std::vector& sstart, - const std::vector& scount, char* data) - { - CNetCdfInterface::putVaraType(grpid, varid, &sstart[0], &scount[0], data); - } - - template <> - void CONetCDF4::writeData_(int grpid, int varid, - const std::vector& sstart, - const std::vector& scount, const int* data) - { - CNetCdfInterface::putVaraType(grpid, varid, &sstart[0], &scount[0], data); - } - //--------------------------------------------------------------- - - template <> - void CONetCDF4::writeData_(int grpid, int varid, - const std::vector& sstart, - const std::vector& scount, const size_t* data) - { - CNetCdfInterface::putVaraType(grpid, varid, &sstart[0], &scount[0], data); - } - //--------------------------------------------------------------- - - template <> - void CONetCDF4::writeData_(int grpid, int varid, - const std::vector& sstart, - const std::vector& scount, const float* data) - { - CNetCdfInterface::putVaraType(grpid, varid, &sstart[0], &scount[0], data); - } - - //--------------------------------------------------------------- - - void CONetCDF4::writeData(const CArray& data, const StdString& name) - { - int grpid = this->getCurrentGroup(); - int varid = this->getVariable(name); - - StdSize array_size = 1; - std::vector sstart, scount; - - this->getWriteDataInfos(name, 0, array_size, sstart, scount, NULL, NULL); - - this->writeData_(grpid, varid, sstart, scount, data.dataFirst()); - - } - - void CONetCDF4::writeTimeAxisData(const CArray& data, const StdString& name, - bool collective, StdSize record, bool isRoot) - { - int grpid = this->getCurrentGroup(); - int varid = this->getVariable(name); - - map::iterator it=timeAxis.find(varid); - if (it == timeAxis.end()) timeAxis[varid] = record; - else - { - if (it->second >= record) return; - else it->second =record; - } - - StdSize array_size = 1; - std::vector sstart, scount; - - if (this->wmpi && collective) - CNetCdfInterface::varParAccess(grpid, varid, NC_COLLECTIVE); - if (this->wmpi && !collective) - CNetCdfInterface::varParAccess(grpid, varid, NC_INDEPENDENT); - - this->getWriteDataInfos(name, record, array_size, sstart, scount, NULL, NULL); - this->writeData_(grpid, varid, sstart, scount, data.dataFirst()); - } - - void CONetCDF4::writeTimeAxisDataBounds(const CArray& data, const StdString& name, - bool collective, StdSize record, bool isRoot) - { - int grpid = this->getCurrentGroup(); - int varid = this->getVariable(name); - - map::iterator it=timeAxis.find(varid); - if (it == timeAxis.end()) timeAxis[varid] = record; - else - { - if (it->second >= record) return; - else it->second =record; - } - - StdSize array_size = 1; - std::vector sstart, scount; - - if (this->wmpi && collective) - CNetCdfInterface::varParAccess(grpid, varid, NC_COLLECTIVE); - if (this->wmpi && !collective) - CNetCdfInterface::varParAccess(grpid, varid, NC_INDEPENDENT); - - this->getWriteDataInfos(name, record, array_size, sstart, scount, NULL, NULL); - this->writeData_(grpid, varid, sstart, scount, data.dataFirst()); - } - - - //--------------------------------------------------------------- - - bool CONetCDF4::varExist(const StdString& varname) - { - int grpid = this->getCurrentGroup(); - return CNetCdfInterface::isVarExisted(grpid, varname); - } - - bool CONetCDF4::dimExist(const StdString& dimname) - { - int grpid = this->getCurrentGroup(); - return CNetCdfInterface::isDimExisted(grpid, dimname); - } - - void CONetCDF4::sync(void) - { - CNetCdfInterface::sync(this->ncidp); - } - ///-------------------------------------------------------------- - } // namespace xios diff --git a/xios_2311_src/trunk/.svn/pristine/16/162105392bd838a17acc34a1bb75e421f2a52112.svn-base b/xios_2311_src/trunk/.svn/pristine/16/162105392bd838a17acc34a1bb75e421f2a52112.svn-base deleted file mode 100644 index d90d4745b0d086207e7e08acd6f7a8d405571edc..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/16/162105392bd838a17acc34a1bb75e421f2a52112.svn-base +++ /dev/null @@ -1,444 +0,0 @@ -import netCDF4 as nc -import ctypes as ct -import numpy as np -import os -import sys -import math -from mpi4py import MPI - -import time - -remap = ct.cdll.LoadLibrary(os.path.realpath('libmapper.so')) - -def from_mpas(filename): - # construct vortex bounds from Mpas grid structure - f = nc.Dataset(filename) - # in this case it is must faster to first read the whole file into memory - # before converting the data structure - print "read" - stime = time.time() - lon_vert = np.array(f.variables["lonVertex"]) - lat_vert = np.array(f.variables["latVertex"]) - vert_cell = np.array(f.variables["verticesOnCell"]) - nvert_cell = np.array(f.variables["nEdgesOnCell"]) - ncell, nvert = vert_cell.shape - assert(max(nvert_cell) <= nvert) - lon = np.zeros(vert_cell.shape) - lat = np.zeros(vert_cell.shape) - etime = time.time() - print "finished read, now convert", etime-stime - scal = 180.0/math.pi - for c in range(ncell): - lat[c,:] = lat_vert[vert_cell[c,:]-1]*scal - lon[c,:] = lon_vert[vert_cell[c,:]-1]*scal - # signal "last vertex" by netCDF convetion - lon[c,nvert_cell[c]] = lon[c,0] - lat[c,nvert_cell[c]] = lat[c,0] - print "convert end", time.time() - etime - return lon, lat - -grid_types = { - "dynamico:mesh": { - "lon_name": "bounds_lon_i", - "lat_name": "bounds_lat_i", - "pole": [0,0,0] - }, - "dynamico:vort": { - "lon_name": "bounds_lon_v", - "lat_name": "bounds_lat_v", - "pole": [0,0,0] - }, - "dynamico:restart": { - "lon_name": "lon_i_vertices", - "lat_name": "lat_i_vertices", - "pole": [0,0,0] - }, - "test:polygon": { - "lon_name": "bounds_lon", - "lat_name": "bounds_lat", - "pole": [0,0,0] - }, - "test:latlon": { - "lon_name": "bounds_lon", - "lat_name": "bounds_lat", - "pole": [0,0,1] - }, - "mpas": { - "reader": from_mpas, - "pole": [0,0,0] - } -} - -interp_types = { - "FV1": 1, - "FV2": 2 -} - -usage = """ -Usage: python remap.py interp srctype srcfile dsttype dstfile mode outfile - - interp: type of interpolation - choices: - FV1: first order conservative Finite Volume - FV2: second order conservative Finite Volume - - srctype, dsttype: grid type of source and destination - choices: """ + " ".join(grid_types.keys()) + """ - - srcfile, dstfile: grid file names, should mostly be netCDF file - - mode: modus of operation - choices: - weights: computes weight and stores them in outfile - remap: computes the interpolated values on destination grid and stores them in outfile - - outfile: output filename - -""" - -# parse command line arguments -if not len(sys.argv) == 8: - print usage - sys.exit(2) - -interp = sys.argv[1] -try: - srctype = grid_types[sys.argv[2]] -except KeyError: - print "Error: srctype needs to be one of the following: " + " ".join(grid_types.keys()) + "." - exit(2) -srcfile = sys.argv[3] -try: - dsttype = grid_types[sys.argv[4]] -except KeyError: - print "Error: srctype needs to be one of the following: " + " ".join(grid_types.keys()) + "." - exit(2) -dstfile = sys.argv[5] -mode = sys.argv[6] -outfile = sys.argv[7] - -if not mode in ("weights", "remap"): - print "Error: mode must be of of the following: weights remap." - exit(2) - -remap.mpi_init() -rank = remap.mpi_rank() -size = remap.mpi_size() - -print rank, "/", size - -print "Reading grids from netCDF files." - -if "reader" in srctype: - src_lon, src_lat = srctype["reader"](srcfile) -else: - src = nc.Dataset(srcfile) - # the following two lines do not perform the actual read - # the file is read later when assigning to the ctypes array - # -> no unnecessary array copying in memory - src_lon = src.variables[srctype["lon_name"]] - src_lat = src.variables[srctype["lat_name"]] - -if "reader" in dsttype: - dst_lon, dst_lat = dsttype["reader"](dstfile) -else: - dst = nc.Dataset(dstfile) - dst_lon = dst.variables[dsttype["lon_name"]] - dst_lat = dst.variables[dsttype["lat_name"]] - -src_ncell, src_nvert = src_lon.shape -dst_ncell, dst_nvert = dst_lon.shape - -def compute_distribution(ncell): - "Returns the local number and starting position in global array." - if rank < ncell % size: - return ncell//size + 1, \ - (ncell//size + 1)*rank - else: - return ncell//size, \ - (ncell//size + 1)*(ncell%size) + (ncell//size)*(rank - ncell%size) - -src_ncell_loc, src_loc_start = compute_distribution(src_ncell) -dst_ncell_loc, dst_loc_start = compute_distribution(dst_ncell) - -print "src", src_ncell_loc, src_loc_start -print "dst", dst_ncell_loc, dst_loc_start - -c_src_lon = (ct.c_double * (src_ncell_loc*src_nvert))() -c_src_lat = (ct.c_double * (src_ncell_loc*src_nvert))() -c_dst_lon = (ct.c_double * (dst_ncell_loc*dst_nvert))() -c_dst_lat = (ct.c_double * (dst_ncell_loc*dst_nvert))() - -c_src_lon[:] = nc.numpy.reshape(src_lon[src_loc_start:src_loc_start+src_ncell_loc,:], (len(c_src_lon),1)) -c_src_lat[:] = nc.numpy.reshape(src_lat[src_loc_start:src_loc_start+src_ncell_loc,:], (len(c_src_lon),1)) -c_dst_lon[:] = nc.numpy.reshape(dst_lon[dst_loc_start:dst_loc_start+dst_ncell_loc,:], (len(c_dst_lon),1)) -c_dst_lat[:] = nc.numpy.reshape(dst_lat[dst_loc_start:dst_loc_start+dst_ncell_loc,:], (len(c_dst_lon),1)) - - -print "Calling remap library to compute weights." -srcpole = (ct.c_double * (3))() -dstpole = (ct.c_double * (3))() -srcpole[:] = srctype["pole"] -dstpole[:] = dsttype["pole"] - -c_src_ncell = ct.c_int(src_ncell_loc) -c_src_nvert = ct.c_int(src_nvert) -c_dst_ncell = ct.c_int(dst_ncell_loc) -c_dst_nvert = ct.c_int(dst_nvert) -order = ct.c_int(interp_types[interp]) - -c_nweight = ct.c_int() - -print "src:", src_ncell, src_nvert -print "dst:", dst_ncell, dst_nvert - -remap.remap_get_num_weights(c_src_lon, c_src_lat, c_src_nvert, c_src_ncell, srcpole, - c_dst_lon, c_dst_lat, c_dst_nvert, c_dst_ncell, dstpole, - order, ct.byref(c_nweight)) - -nwgt = c_nweight.value - -c_weights = (ct.c_double * nwgt)() -c_dst_idx = (ct.c_int * nwgt)() -c_src_idx = (ct.c_int * nwgt)() - -remap.remap_get_weights(c_weights, c_src_idx, c_dst_idx) - -wgt_glo = MPI.COMM_WORLD.gather(c_weights[:]) -src_idx_glo = MPI.COMM_WORLD.gather(c_src_idx[:]) -dst_idx_glo = MPI.COMM_WORLD.gather(c_dst_idx[:]) - - -if rank == 0 and mode == 'weights': - nwgt_glo = sum(len(wgt) for wgt in wgt_glo) - - print "Writing", nwgt_glo, "weights to netCDF-file '" + outfile + "'." - f = nc.Dataset(outfile,'w') - f.createDimension('n_src', src_ncell) - f.createDimension('n_dst', dst_ncell) - f.createDimension('n_weight', nwgt_glo) - - var = f.createVariable('src_idx', 'i', ('n_weight')) - var[:] = np.hstack(src_idx_glo) + 1 # make indices start from 1 - var = f.createVariable('dst_idx', 'i', ('n_weight')) - var[:] = np.hstack(dst_idx_glo) + 1 # make indices start from 1 - var = f.createVariable('weight', 'd', ('n_weight')) - var[:] = np.hstack(wgt_glo) - f.close() - -def test_fun(x, y, z): - return (1-x**2)*(1-y**2)*z - -def test_fun_ll(lat, lon): - #return np.cos(lat*math.pi/180)*np.cos(lon*math.pi/180) - return 2.0 + np.cos(lat*math.pi/180.)**2 * np.cos(2*lon*math.pi/180.); - -#UNUSED -#def sphe2cart(lat, lon): -# phi = math.pi/180*lon[:] -# theta = math.pi/2 - math.pi/180*lat[:] -# return np.sin(theta)*np.cos(phi), np.sin(theta)*np.sin(phi), np.cos(theta) - -if mode == 'remap': - c_centre_lon = (ct.c_double * src_ncell_loc)() - c_centre_lat = (ct.c_double * src_ncell_loc)() - c_areas = (ct.c_double * src_ncell_loc)() - remap.remap_get_barycentres_and_areas(c_src_lon, c_src_lat, c_src_nvert, c_src_ncell, srcpole, - c_centre_lon, c_centre_lat, c_areas) -# src_val_loc = test_fun_ll(np.array(c_centre_lat[:]), np.array(c_centre_lon[:])) -# src_val_loc = src.variables["ps"] -# src_val_glo = MPI.COMM_WORLD.gather(np.array(src_val_loc[:])) -# src_val_glo = src_val_loc - - c_centre_lon = (ct.c_double * dst_ncell_loc)() - c_centre_lat = (ct.c_double * dst_ncell_loc)() - c_areas = (ct.c_double * dst_ncell_loc)() - remap.remap_get_barycentres_and_areas(c_dst_lon, c_dst_lat, c_dst_nvert, c_dst_ncell, dstpole, - c_centre_lon, c_centre_lat, c_areas) -# dst_val_loc = test_fun_ll(np.array(c_centre_lat[:]), np.array(c_centre_lon[:])) - -# dst_val_glo = MPI.COMM_WORLD.gather(dst_val_loc) - dst_areas_glo = MPI.COMM_WORLD.gather(np.array(c_areas[:])) - dst_centre_lon_glo = MPI.COMM_WORLD.gather(np.array(c_centre_lon[:])) - dst_centre_lat_glo = MPI.COMM_WORLD.gather(np.array(c_centre_lat[:])) - - -if rank == 0 and mode == 'remap': - from scipy import sparse - A = sparse.csr_matrix(sparse.coo_matrix((np.hstack(wgt_glo),(np.hstack(dst_idx_glo),np.hstack(src_idx_glo))))) - -# src_val = np.hstack(src_val_glo) -# dst_ref = np.hstack(dst_val_glo) - dst_areas = np.hstack(dst_areas_glo) - dst_centre_lon = np.hstack(dst_centre_lon_glo) - dst_centre_lat = np.hstack(dst_centre_lat_glo) - -# print "source:", src_val.shape -# print "destin:", dst_ref.shape -# dst_val = A*src_val -# err = dst_val - dst_ref -# print "absolute maximum error, maximum value:", np.max(np.abs(err)), np.max(np.abs(dst_ref)) -# print "relative maximum error, normalized L2 error, average target cell size (edgelength of same-area square):" -# print np.max(np.abs(err))/np.max(np.abs(dst_ref)), np.linalg.norm(err)/np.linalg.norm(dst_ref), np.mean(np.sqrt(dst_areas)) - - lev=src.dimensions['lev'] - f = nc.Dataset(outfile,'w') - f.createDimension('nvert', dst_nvert) - f.createDimension('cell', dst_ncell) - f.createDimension('lev', len(lev)) - - var = f.createVariable('lat', 'd', ('cell')) - var.setncattr("long_name", "latitude") - var.setncattr("units", "degrees_north") - var.setncattr("bounds", "bounds_lat") - var[:] = dst_centre_lat - var = f.createVariable('lon', 'd', ('cell')) - var.setncattr("long_name", "longitude") - var.setncattr("units", "degrees_east") - var.setncattr("bounds", "bounds_lon") - var[:] = dst_centre_lon - - var = f.createVariable('bounds_lon', 'd', ('cell','nvert')) - var[:] = dst_lon - var = f.createVariable('bounds_lat', 'd', ('cell','nvert')) - var[:] = dst_lat - - var = f.createVariable('lev', 'd', ('lev')) - var[:] = src.variables['lev'] - var.setncattr('axis', 'Z') - var.setncattr('units', 'Pa') - var.setncattr('positive', 'down') - var[:] = src.variables['lev'] - - U = f.createVariable('U', 'd', ('lev','cell')) - U.setncattr("coordinates", "lev lon lat") - - V = f.createVariable('V', 'd', ('lev','cell')) - V.setncattr("coordinates", "lev lon lat") - - TEMP = f.createVariable('TEMP', 'd', ('lev','cell')) - TEMP.setncattr("coordinates", "lev lon lat") - - R = f.createVariable('R', 'd', ('lev','cell')) - R.setncattr("coordinates", "lev lon lat") - - Z = f.createVariable('Z', 'd', ('cell')) - Z.setncattr("coordinates", "lon lat") - - ST = f.createVariable('ST', 'd', ('cell')) - ST.setncattr("coordinates", "lon lat") - - CDSW = f.createVariable('CDSW', 'd', ('cell')) - CDSW.setncattr("coordinates", "lon lat") - - SP = f.createVariable('SP', 'd', ('cell')) - SP.setncattr("coordinates", "lon lat") - - - -#for U -if mode == 'remap': - src_val_loc = src.variables['U'] - -for l in range(0, len(lev)): - if mode == 'remap': - src_val_glo = MPI.COMM_WORLD.gather(np.array(src_val_loc[l,:])) - - if rank == 0 and mode == 'remap': - src_val = np.hstack(src_val_glo) - dst_val = A*src_val - U[l,:] = dst_val - -#for V -if mode == 'remap': - src_val_loc = src.variables['V'] - -for l in range(0, len(lev)): - if mode == 'remap': - src_val_glo = MPI.COMM_WORLD.gather(np.array(src_val_loc[l,:])) - - if rank == 0 and mode == 'remap': - src_val = np.hstack(src_val_glo) - dst_val = A*src_val - V[l,:] = dst_val - - -#for TEMP -if mode == 'remap': - src_val_loc = src.variables['TEMP'] - -for l in range(0, len(lev)): - if mode == 'remap': - src_val_glo = MPI.COMM_WORLD.gather(np.array(src_val_loc[l,:])) - - if rank == 0 and mode == 'remap': - src_val = np.hstack(src_val_glo) - dst_val = A*src_val - TEMP[l,:] = dst_val - -#for R -if mode == 'remap': - src_val_loc = src.variables['R'] - -for l in range(0, len(lev)): - if mode == 'remap': - src_val_glo = MPI.COMM_WORLD.gather(np.array(src_val_loc[l,:])) - - if rank == 0 and mode == 'remap': - src_val = np.hstack(src_val_glo) - dst_val = A*src_val - R[l,:] = dst_val - - -#for Z -if mode == 'remap': - src_val_loc = src.variables['Z'] - src_val_glo = MPI.COMM_WORLD.gather(np.array(src_val_loc[:])) - -if rank == 0 and mode == 'remap': - src_val = np.hstack(src_val_glo) - dst_val = A*src_val - Z[:] = dst_val - -#for ST -if mode == 'remap': - src_val_loc = src.variables['ST'] - src_val_glo = MPI.COMM_WORLD.gather(np.array(src_val_loc[:])) - -if rank == 0 and mode == 'remap': - src_val = np.hstack(src_val_glo) - dst_val = A*src_val - ST[:] = dst_val - - -#for CDSW -if mode == 'remap': - src_val_loc = src.variables['CDSW'] - src_val_glo = MPI.COMM_WORLD.gather(np.array(src_val_loc[:])) - -if rank == 0 and mode == 'remap': - src_val = np.hstack(src_val_glo) - dst_val = A*src_val - CDSW[:] = dst_val - -#for SP -if mode == 'remap': - src_val_loc = src.variables['SP'] - src_val_glo = MPI.COMM_WORLD.gather(np.array(src_val_loc[:])) - -if rank == 0 and mode == 'remap': - src_val = np.hstack(src_val_glo) - dst_val = A*src_val - SP[:] = dst_val - - - -if mode == 'remap': - f.close() - - -if not "reader" in srctype: - src.close() -if not "reader" in dsttype: - dst.close() - diff --git a/xios_2311_src/trunk/.svn/pristine/16/167b317826255a7fa8834c149666ec628aa79ed3.svn-base b/xios_2311_src/trunk/.svn/pristine/16/167b317826255a7fa8834c149666ec628aa79ed3.svn-base deleted file mode 100644 index 92607513410db081168240d51f9f5ae6cf63cba4..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/16/167b317826255a7fa8834c149666ec628aa79ed3.svn-base +++ /dev/null @@ -1,557 +0,0 @@ -#include "xios_spl.hpp" -#include "context_client.hpp" -#include "context_server.hpp" -#include "event_client.hpp" -#include "buffer_out.hpp" -#include "buffer_client.hpp" -#include "type.hpp" -#include "event_client.hpp" -#include "context.hpp" -#include "mpi.hpp" -#include "timer.hpp" -#include "cxios.hpp" -#include "server.hpp" -#include "services.hpp" -#include -#include -#include - -namespace xios -{ - /*! - \param [in] parent Pointer to context on client side - \param [in] intraComm_ communicator of group client - \param [in] interComm_ communicator of group server - \cxtSer [in] cxtSer Pointer to context of server side. (It is only used in case of attached mode). - */ - CContextClient::CContextClient(CContext* parent, MPI_Comm intraComm_, MPI_Comm interComm_, CContext* cxtSer) - : mapBufferSize_(), parentServer(cxtSer), maxBufferedEvents(4), associatedServer_(nullptr) - { - - context_ = parent; - intraComm = intraComm_; - interComm = interComm_; - MPI_Comm_rank(intraComm, &clientRank); - MPI_Comm_size(intraComm, &clientSize); - - int flag; - MPI_Comm_test_inter(interComm, &flag); - if (flag) isAttached_=false ; - else isAttached_=true ; - - pureOneSided=CXios::getin("pure_one_sided",false); // pure one sided communication (for test) - if (isAttachedModeEnabled()) pureOneSided=false ; // no one sided in attach mode - - - - if (flag) MPI_Comm_remote_size(interComm, &serverSize); - else MPI_Comm_size(interComm, &serverSize); - - computeLeader(clientRank, clientSize, serverSize, ranksServerLeader, ranksServerNotLeader); - - if (flag) MPI_Intercomm_merge(interComm_,false, &interCommMerged_) ; - - MPI_Comm_split(intraComm_,clientRank,clientRank, &commSelf_) ; // for windows - - auto time=chrono::system_clock::now().time_since_epoch().count() ; - std::default_random_engine rd(time); // not reproducible from a run to another - std::uniform_int_distribution dist; - hashId_=dist(rd) ; - MPI_Bcast(&hashId_,1,MPI_SIZE_T,0,intraComm) ; // Bcast to all server of the context - - timeLine = 1; - } - - void CContextClient::computeLeader(int clientRank, int clientSize, int serverSize, - std::list& rankRecvLeader, - std::list& rankRecvNotLeader) - { - if ((0 == clientSize) || (0 == serverSize)) return; - - if (clientSize < serverSize) - { - int serverByClient = serverSize / clientSize; - int remain = serverSize % clientSize; - int rankStart = serverByClient * clientRank; - - if (clientRank < remain) - { - serverByClient++; - rankStart += clientRank; - } - else - rankStart += remain; - - for (int i = 0; i < serverByClient; i++) - rankRecvLeader.push_back(rankStart + i); - - rankRecvNotLeader.resize(0); - } - else - { - int clientByServer = clientSize / serverSize; - int remain = clientSize % serverSize; - - if (clientRank < (clientByServer + 1) * remain) - { - if (clientRank % (clientByServer + 1) == 0) - rankRecvLeader.push_back(clientRank / (clientByServer + 1)); - else - rankRecvNotLeader.push_back(clientRank / (clientByServer + 1)); - } - else - { - int rank = clientRank - (clientByServer + 1) * remain; - if (rank % clientByServer == 0) - rankRecvLeader.push_back(remain + rank / clientByServer); - else - rankRecvNotLeader.push_back(remain + rank / clientByServer); - } - } - } - - /*! - In case of attached mode, the current context must be reset to context for client - \param [in] event Event sent to server - */ - void CContextClient::sendEvent(CEventClient& event) - { - list ranks = event.getRanks(); - -// ostringstream str ; -// for(auto& rank : ranks) str<getId()<<" for ranks : "< sizes = event.getSizes(); - - // We force the getBuffers call to be non-blocking on classical servers - list buffList; - getBuffers(timeLine, ranks, sizes, buffList) ; - - event.send(timeLine, sizes, buffList); - - //for (auto itRank = ranks.begin(); itRank != ranks.end(); itRank++) buffers[*itRank]->infoBuffer() ; - - unlockBuffers(ranks) ; - checkBuffers(ranks); - - } - - if (isAttachedModeEnabled()) // couldBuffer is always true in attached mode - { - while (checkBuffers(ranks)) context_->globalEventLoop() ; - - CXios::getDaemonsManager()->scheduleContext(hashId_) ; - while (CXios::getDaemonsManager()->isScheduledContext(hashId_)) context_->globalEventLoop() ; - } - - timeLine++; - } - - /*! - If client is also server (attached mode), after sending event, it should process right away - the incoming event. - \param [in] ranks list rank of server connected this client - */ - void CContextClient::waitEvent(list& ranks) - { - while (checkBuffers(ranks)) - { - context_->eventLoop() ; - } - - MPI_Request req ; - MPI_Status status ; - - MPI_Ibarrier(intraComm,&req) ; - int flag=false ; - - do - { - CXios::getDaemonsManager()->eventLoop() ; - MPI_Test(&req,&flag,&status) ; - } while (!flag) ; - - - } - - - void CContextClient::waitEvent_old(list& ranks) - { - parentServer->server->setPendingEvent(); - while (checkBuffers(ranks)) - { - parentServer->server->listen(); - parentServer->server->checkPendingRequest(); - } - - while (parentServer->server->hasPendingEvent()) - { - parentServer->server->eventLoop(); - } - } - - /*! - * Get buffers for each connection to the servers. This function blocks until there is enough room in the buffers unless - * it is explicitly requested to be non-blocking. - * - * - * \param [in] timeLine time line of the event which will be sent to servers - * \param [in] serverList list of rank of connected server - * \param [in] sizeList size of message corresponding to each connection - * \param [out] retBuffers list of buffers that can be used to store an event - * \param [in] nonBlocking whether this function should be non-blocking - * \return whether the already allocated buffers could be used - */ - bool CContextClient::getBuffers(const size_t timeLine, const list& serverList, const list& sizeList, list& retBuffers, - bool nonBlocking /*= false*/) - { - list::const_iterator itServer, itSize; - list bufferList; - map::const_iterator it; - list::iterator itBuffer; - bool areBuffersFree; - - for (itServer = serverList.begin(); itServer != serverList.end(); itServer++) - { - it = buffers.find(*itServer); - if (it == buffers.end()) - { - newBuffer(*itServer); - it = buffers.find(*itServer); - } - bufferList.push_back(it->second); - } - - double lastTimeBuffersNotFree=0. ; - double time ; - bool doUnlockBuffers ; - CTimer::get("Blocking time").resume(); - do - { - areBuffersFree = true; - doUnlockBuffers=false ; - time=MPI_Wtime() ; - if (time-lastTimeBuffersNotFree > latency_) - { - for (itBuffer = bufferList.begin(), itSize = sizeList.begin(); itBuffer != bufferList.end(); itBuffer++, itSize++) - { - areBuffersFree &= (*itBuffer)->isBufferFree(*itSize); - } - if (!areBuffersFree) - { - lastTimeBuffersNotFree = time ; - doUnlockBuffers=true ; - } - } - else areBuffersFree = false ; - - if (!areBuffersFree) - { - if (doUnlockBuffers) for (itBuffer = bufferList.begin(); itBuffer != bufferList.end(); itBuffer++) (*itBuffer)->unlockBuffer(); - checkBuffers(); - - context_->globalEventLoop() ; - } - - } while (!areBuffersFree && !nonBlocking); - CTimer::get("Blocking time").suspend(); - - if (areBuffersFree) - { - for (itBuffer = bufferList.begin(), itSize = sizeList.begin(); itBuffer != bufferList.end(); itBuffer++, itSize++) - retBuffers.push_back((*itBuffer)->getBuffer(timeLine, *itSize)); - } - return areBuffersFree; - } - - /*! - Make a new buffer for a certain connection to server with specific rank - \param [in] rank rank of connected server - */ - void CContextClient::newBuffer(int rank) - { - if (!mapBufferSize_.count(rank)) - { - error(0) << "WARNING: Unexpected request for buffer to communicate with server " << rank << std::endl; - mapBufferSize_[rank] = CXios::minBufferSize; - maxEventSizes[rank] = CXios::minBufferSize; - } - - CClientBuffer* buffer = buffers[rank] = new CClientBuffer(interComm, rank, mapBufferSize_[rank], maxEventSizes[rank]); - if (isGrowableBuffer_) buffer->setGrowableBuffer(1.2) ; - else buffer->fixBuffer() ; - // Notify the server - CBufferOut* bufOut = buffer->getBuffer(0, 4*sizeof(MPI_Aint)); - MPI_Aint sendBuff[4] ; - sendBuff[0]=hashId_; - sendBuff[1]=mapBufferSize_[rank]; - sendBuff[2]=buffers[rank]->getWinAddress(0); - sendBuff[3]=buffers[rank]->getWinAddress(1); - info(100)<<"CContextClient::newBuffer : rank "<getWinAddress(0)<<" winAdress[1] "<getWinAddress(1)<put(sendBuff, 4); - buffer->checkBuffer(true); - - // create windows dynamically for one-sided - if (!isAttachedModeEnabled()) - { - CTimer::get("create Windows").resume() ; - MPI_Comm interComm ; - MPI_Intercomm_create(commSelf_, 0, interCommMerged_, clientSize+rank, 0, &interComm) ; - MPI_Intercomm_merge(interComm, false, &winComm_[rank]) ; - CXios::getMpiGarbageCollector().registerCommunicator(winComm_[rank]) ; - MPI_Comm_free(&interComm) ; - windows_[rank].resize(2) ; - - MPI_Win_create_dynamic(MPI_INFO_NULL, winComm_[rank], &windows_[rank][0]); - CXios::getMpiGarbageCollector().registerWindow(windows_[rank][0]) ; - - MPI_Win_create_dynamic(MPI_INFO_NULL, winComm_[rank], &windows_[rank][1]); - CXios::getMpiGarbageCollector().registerWindow(windows_[rank][1]) ; - - CTimer::get("create Windows").suspend() ; - } - else - { - winComm_[rank] = MPI_COMM_NULL ; - windows_[rank].resize(2) ; - windows_[rank][0] = MPI_WIN_NULL ; - windows_[rank][1] = MPI_WIN_NULL ; - } - buffer->attachWindows(windows_[rank]) ; - if (!isAttachedModeEnabled()) MPI_Barrier(winComm_[rank]) ; - - } - - /*! - Verify state of buffers. Buffer is under pending state if there is no message on it - \return state of buffers, pending(true), ready(false) - */ - bool CContextClient::checkBuffers(void) - { - map::iterator itBuff; - bool pending = false; - for (itBuff = buffers.begin(); itBuff != buffers.end(); itBuff++) - pending |= itBuff->second->checkBuffer(!pureOneSided); - return pending; - } - - //! Release all buffers - void CContextClient::releaseBuffers() - { - map::iterator itBuff; - for (itBuff = buffers.begin(); itBuff != buffers.end(); itBuff++) - { - delete itBuff->second; - } - buffers.clear(); - -// don't know when release windows - - //if (!isAttachedModeEnabled()) - //{ - // for(auto& it : winComm_) - // { - // int rank = it.first ; - // MPI_Win_free(&windows_[rank][0]); - // MPI_Win_free(&windows_[rank][1]); - // MPI_Comm_free(&winComm_[rank]) ; - // } - //} - } - - - /*! - Lock the buffers for one sided communications - \param [in] ranks list rank of server to which client connects to - */ - void CContextClient::lockBuffers(list& ranks) - { - list::iterator it; - for (it = ranks.begin(); it != ranks.end(); it++) buffers[*it]->lockBuffer(); - } - - /*! - Unlock the buffers for one sided communications - \param [in] ranks list rank of server to which client connects to - */ - void CContextClient::unlockBuffers(list& ranks) - { - list::iterator it; - for (it = ranks.begin(); it != ranks.end(); it++) buffers[*it]->unlockBuffer(); - } - - /*! - Verify state of buffers corresponding to a connection - \param [in] ranks list rank of server to which client connects to - \return state of buffers, pending(true), ready(false) - */ - bool CContextClient::checkBuffers(list& ranks) - { - list::iterator it; - bool pending = false; - for (it = ranks.begin(); it != ranks.end(); it++) pending |= buffers[*it]->checkBuffer(!pureOneSided); - return pending; - } - - /*! - * Set the buffer size for each connection. Warning: This function is collective. - * - * \param [in] mapSize maps the rank of the connected servers to the size of the correspoinding buffer - * \param [in] maxEventSize maps the rank of the connected servers to the size of the biggest event - */ - void CContextClient::setBufferSize(const std::map& mapSize) - { - for(auto& it : mapSize) - buffers[it.first]->fixBufferSize(std::max(CXios::minBufferSize*1.0,std::min(it.second*CXios::bufferSizeFactor*1.01,CXios::maxBufferSize*1.0))); - } - - /*! - Get leading server in the group of connected server - \return ranks of leading servers - */ - const std::list& CContextClient::getRanksServerNotLeader(void) const - { - return ranksServerNotLeader; - } - - /*! - Check if client connects to leading server - \return connected(true), not connected (false) - */ - bool CContextClient::isServerNotLeader(void) const - { - return !ranksServerNotLeader.empty(); - } - - /*! - Get leading server in the group of connected server - \return ranks of leading servers - */ - const std::list& CContextClient::getRanksServerLeader(void) const - { - return ranksServerLeader; - } - - /*! - Check if client connects to leading server - \return connected(true), not connected (false) - */ - bool CContextClient::isServerLeader(void) const - { - return !ranksServerLeader.empty(); - } - - /*! - * Finalize context client and do some reports. Function is non-blocking. - */ - void CContextClient::finalize(void) - { - map::iterator itBuff; - std::list::iterator ItServerLeader; - - bool stop = false; - - int* nbServerConnectionLocal = new int[serverSize] ; - int* nbServerConnectionGlobal = new int[serverSize] ; - for(int i=0;ifirst]=1 ; - for (ItServerLeader = ranksServerLeader.begin(); ItServerLeader != ranksServerLeader.end(); ItServerLeader++) nbServerConnectionLocal[*ItServerLeader]=1 ; - - MPI_Allreduce(nbServerConnectionLocal, nbServerConnectionGlobal, serverSize, MPI_INT, MPI_SUM, intraComm); - - CEventClient event(CContext::GetType(), CContext::EVENT_ID_CONTEXT_FINALIZE); - CMessage msg; - - for (int i=0;i::const_iterator itbMap = mapBufferSize_.begin(), - iteMap = mapBufferSize_.end(), itMap; - - StdSize totalBuf = 0; - for (itMap = itbMap; itMap != iteMap; ++itMap) - { - report(10) << " Memory report : Context <" << context_->getId() << "> : client side : memory used for buffer of each connection to server" << endl - << " +) To server with rank " << itMap->first << " : " << itMap->second << " bytes " << endl; - totalBuf += itMap->second; - } - report(0) << " Memory report : Context <" << context_->getId() << "> : client side : total memory used for buffer " << totalBuf << " bytes" << endl; - - } - - - /*! - */ - bool CContextClient::havePendingRequests(void) - { - bool pending = false; - map::iterator itBuff; - for (itBuff = buffers.begin(); itBuff != buffers.end(); itBuff++) - pending |= itBuff->second->hasPendingRequest(); - return pending; - } - - bool CContextClient::havePendingRequests(list& ranks) - { - list::iterator it; - bool pending = false; - for (it = ranks.begin(); it != ranks.end(); it++) pending |= buffers[*it]->hasPendingRequest(); - return pending; - } - - bool CContextClient::isNotifiedFinalized(void) - { - if (isAttachedModeEnabled()) return true ; - - bool finalized = true; - map::iterator itBuff; - for (itBuff = buffers.begin(); itBuff != buffers.end(); itBuff++) - finalized &= itBuff->second->isNotifiedFinalized(); - return finalized; - } - -} diff --git a/xios_2311_src/trunk/.svn/pristine/16/168ba4eef40edf69e2e633457ebbe9236a98676f.svn-base b/xios_2311_src/trunk/.svn/pristine/16/168ba4eef40edf69e2e633457ebbe9236a98676f.svn-base deleted file mode 100644 index 06c9557ac6c8841c61b95d360fe19e14ffa92151..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/16/168ba4eef40edf69e2e633457ebbe9236a98676f.svn-base +++ /dev/null @@ -1,12 +0,0 @@ -module unload hdf5 -module unload zlib -module unload pnetcdf -module unload netcdf - -module load hdf5/1.8.9 -module load pnetcdf/1.3.0 -module load zlib/1.2.5 -module load netcdf_C/4.2.1.1 - -export NETCDF_INC_DIR="/opt/software/SGI/netcdf/C/4.2.1.1/include" -export NETCDF_LIB_DIR="/opt/software/SGI/netcdf/C/4.2.1.1/lib" diff --git a/xios_2311_src/trunk/.svn/pristine/16/16f07c6b373ae58030c90fc4d65f40158302d83f.svn-base b/xios_2311_src/trunk/.svn/pristine/16/16f07c6b373ae58030c90fc4d65f40158302d83f.svn-base deleted file mode 100644 index 50736daac4d60ca3784ddfe9752926c877709d16..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/16/16f07c6b373ae58030c90fc4d65f40158302d83f.svn-base +++ /dev/null @@ -1,40 +0,0 @@ -/* ************************************************************************** * - * Interface auto generated - do not modify * - * ************************************************************************** */ - -#include -#include "xios.hpp" -#include "attribute_template.hpp" -#include "object_template.hpp" -#include "group_template.hpp" -#include "icutil.hpp" -#include "icdate.hpp" -#include "timer.hpp" -#include "node_type.hpp" - -extern "C" -{ - typedef xios::CExtractAxisToScalar* extract_axis_to_scalar_Ptr; - - void cxios_set_extract_axis_to_scalar_position(extract_axis_to_scalar_Ptr extract_axis_to_scalar_hdl, int position) - { - CTimer::get("XIOS").resume(); - extract_axis_to_scalar_hdl->position.setValue(position); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_extract_axis_to_scalar_position(extract_axis_to_scalar_Ptr extract_axis_to_scalar_hdl, int* position) - { - CTimer::get("XIOS").resume(); - *position = extract_axis_to_scalar_hdl->position.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_extract_axis_to_scalar_position(extract_axis_to_scalar_Ptr extract_axis_to_scalar_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = extract_axis_to_scalar_hdl->position.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } -} diff --git a/xios_2311_src/trunk/.svn/pristine/17/17064f9f1ab05acae745f566dbdbdf82cba13cbe.svn-base b/xios_2311_src/trunk/.svn/pristine/17/17064f9f1ab05acae745f566dbdbdf82cba13cbe.svn-base deleted file mode 100644 index 7dc490d81e877dc7a4bf68321af7ce1db1227b2e..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/17/17064f9f1ab05acae745f566dbdbdf82cba13cbe.svn-base +++ /dev/null @@ -1,49 +0,0 @@ -/*! - \file axis_algorithm_reduce_domain.hpp - \author Ha NGUYEN - \since 23 June 2016 - \date 23 June 2016 - - \brief Algorithm for reduce an axis to a axis - */ -#ifndef __XIOS_AXIS_ALGORITHM_DUPLICATE_SCALAR_HPP__ -#define __XIOS_AXIS_ALGORITHM_DUPLICATE_SCALAR_HPP__ - -#include "algorithm_transformation_transfer.hpp" -#include "transformation.hpp" - -namespace xios { - -class CAxis; -class CScalar; -class CDuplicateScalarToAxis; - - -/*! - \class CAxisAlgorithmDuplicateScalar - Duplicate scalar into axis destination -*/ -class CAxisAlgorithmDuplicateScalar : public CAlgorithmTransformationTransfer -{ -public: - CAxisAlgorithmDuplicateScalar(bool isSource, CAxis* axisDestination, CScalar* scalarSource, CDuplicateScalarToAxis* algo); - - virtual ~CAxisAlgorithmDuplicateScalar(); - - static bool registerTrans(); - virtual StdString getAlgoName() {return "\\nduplicate_scalar";} - - static shared_ptr create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition); - static bool dummyRegistered_; -}; - -} -#endif // __XIOS_AXIS_ALGORITHM_DUPLICATE_SCALAR_HPP__ diff --git a/xios_2311_src/trunk/.svn/pristine/17/170aee81b93cdb83fde1926155080666bf0eb141.svn-base b/xios_2311_src/trunk/.svn/pristine/17/170aee81b93cdb83fde1926155080666bf0eb141.svn-base deleted file mode 100644 index 836859e12852e30f91f99638551f415b315587b5..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/17/170aee81b93cdb83fde1926155080666bf0eb141.svn-base +++ /dev/null @@ -1,29 +0,0 @@ -#include "xios_fortran_prefix.hpp" - -MODULE CALENDAR_INTERFACE - USE, INTRINSIC :: ISO_C_BINDING - - INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99 - - SUBROUTINE cxios_update_calendar(step) BIND(C) - IMPORT C_INT - INTEGER (kind = C_INT), VALUE :: step - END SUBROUTINE cxios_update_calendar - - SUBROUTINE cxios_get_current_date(current_date) BIND(C) - USE IDATE - TYPE(txios(date)) :: current_date - END SUBROUTINE cxios_get_current_date - - INTEGER(kind = C_INT) FUNCTION cxios_get_year_length_in_seconds(year) BIND(C) - USE ISO_C_BINDING - INTEGER(kind = C_INT), VALUE :: year - END FUNCTION cxios_get_year_length_in_seconds - - INTEGER(kind = C_INT) FUNCTION cxios_get_day_length_in_seconds() BIND(C) - USE ISO_C_BINDING - END FUNCTION cxios_get_day_length_in_seconds - - END INTERFACE - -END MODULE CALENDAR_INTERFACE diff --git a/xios_2311_src/trunk/.svn/pristine/17/174407dbae1a1f7ed52d1b5a537e4e78d006f667.svn-base b/xios_2311_src/trunk/.svn/pristine/17/174407dbae1a1f7ed52d1b5a537e4e78d006f667.svn-base deleted file mode 100644 index 9e7c941ef7be7202435449b51c3a77cb0ddd9d7f..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/17/174407dbae1a1f7ed52d1b5a537e4e78d006f667.svn-base +++ /dev/null @@ -1,397 +0,0 @@ -/* Copyright 2009, UCAR/Unidata and OPeNDAP, Inc. - See the COPYRIGHT file for more information. */ - -/* Parser actions for constraint expressions */ - -/* Since oc does not use the constraint parser, - they functions all just abort if called. -*/ - -#include "config.h" -#include -#include -#include -#include - -#include "netcdf.h" - -#include "nclist.h" -#include "ncbytes.h" -#include "dceconstraints.h" -#include "dceparselex.h" - -static Object collectlist(Object list0, Object decl); - -void -projections(DCEparsestate* state, Object list0) -{ - NClist* list = (NClist*)list0; - if(list != NULL) { - nclistfree(state->constraint->projections); - state->constraint->projections = list; - } -#ifdef DEBUG -fprintf(stderr," ce.projections: %s\n", - dcetostring((DCEnode*)state->constraint->projections)); -#endif -} - -void -selections(DCEparsestate* state, Object list0) -{ - NClist* list = (NClist*)list0; - if(list != NULL) { - nclistfree(state->constraint->selections); - state->constraint->selections = list; - } -#ifdef DEBUG -fprintf(stderr," ce.selections: %s\n", - dcetostring((DCEnode*)state->constraint->selections)); -#endif -} - - -Object -projectionlist(DCEparsestate* state, Object list0, Object decl) -{ - return collectlist(list0,decl); -} - -Object -projection(DCEparsestate* state, Object varorfcn) -{ - DCEprojection* p = (DCEprojection*)dcecreate(CES_PROJECT); - CEsort tag = *(CEsort*)varorfcn; - if(tag == CES_FCN) - p->fcn = varorfcn; - else - p->var = varorfcn; - p->discrim = tag; -#ifdef DEBUG -fprintf(stderr," ce.projection: %s\n", - dcetostring((DCEnode*)p)); -#endif - return p; -} - -Object -segmentlist(DCEparsestate* state, Object var0, Object decl) -{ - /* watch out: this is non-standard */ - NClist* list; - DCEvar* v = (DCEvar*)var0; - if(v==NULL) v = (DCEvar*)dcecreate(CES_VAR); - list = v->segments; - if(list == NULL) list = nclistnew(); - nclistpush(list,(ncelem)decl); - v->segments = list; - return v; -} - -Object -segment(DCEparsestate* state, Object name, Object slices0) -{ - int i; - DCEsegment* segment = (DCEsegment*)dcecreate(CES_SEGMENT); - NClist* slices = (NClist*)slices0; - segment->name = strdup((char*)name); - if(slices != NULL && nclistlength(slices) > 0) { - segment->rank = nclistlength(slices); - segment->slicesdefined = 1; /* but not declsizes */ - for(i=0;islices[i] = *slice; - free(slice); - } - nclistfree(slices); - } else - segment->slicesdefined = 0; -#ifdef DEBUG -fprintf(stderr," ce.segment: %s\n", - dumpsegment(segment)); -#endif - return segment; -} - - -Object -rangelist(DCEparsestate* state, Object list0, Object decl) -{ - return collectlist(list0,decl); -} - -Object -range(DCEparsestate* state, Object sfirst, Object sstride, Object slast) -{ - DCEslice* slice = (DCEslice*)dcecreate(CES_SLICE); - unsigned long first,stride,last; - - /* Note: that incoming arguments are strings; we must convert to size_t; - but we do know they are legal integers or NULL */ - sscanf((char*)sfirst,"%lu",&first); /* always defined */ - if(slast != NULL) - sscanf((char*)slast,"%lu",&last); - else - last = first; - if(sstride != NULL) - sscanf((char*)sstride,"%lu",&stride); - else - stride = 1; /* default */ - - if(stride == 0) - dceerror(state,"Illegal index for range stride"); - if(last < first) - dceerror(state,"Illegal index for range last index"); - slice->first = first; - slice->stride = stride; - slice->stop = last + 1; - slice->length = slice->stop - slice->first; - slice->count = slice->length / slice->stride; -#ifdef DEBUG -fprintf(stderr," ce.slice: %s\n", - dumpslice(slice)); -#endif - return slice; -} - -Object -range1(DCEparsestate* state, Object rangenumber) -{ - int range = -1; - sscanf((char*)rangenumber,"%u",&range); - if(range < 0) { - dceerror(state,"Illegal range index"); - } - return rangenumber; -} - -Object -clauselist(DCEparsestate* state, Object list0, Object decl) -{ - return collectlist(list0,decl); -} - -Object -sel_clause(DCEparsestate* state, int selcase, - Object lhs, Object relop0, Object values) -{ - DCEselection* sel = (DCEselection*)dcecreate(CES_SELECT); - sel->operator = (CEsort)relop0; - sel->lhs = (DCEvalue*)lhs; - if(selcase == 2) {/*singleton value*/ - sel->rhs = nclistnew(); - nclistpush(sel->rhs,(ncelem)values); - } else - sel->rhs = (NClist*)values; - return sel; -} - -Object -indexpath(DCEparsestate* state, Object list0, Object index) -{ - return collectlist(list0,index); -} - -Object -array_indices(DCEparsestate* state, Object list0, Object indexno) -{ - DCEslice* slice; - long long start = -1; - NClist* list = (NClist*)list0; - if(list == NULL) list = nclistnew(); - sscanf((char*)indexno,"%lld",&start); - if(start < 0) { - dceerror(state,"Illegal array index"); - start = 1; - } - slice = (DCEslice*)dcecreate(CES_SLICE); - slice->first = start; - slice->stride = 1; - slice->count = 1; - slice->length = 1; - slice->stop = start+1; - nclistpush(list,(ncelem)slice); - return list; -} - -Object -indexer(DCEparsestate* state, Object name, Object indices) -{ - int i; - NClist* list = (NClist*)indices; - DCEsegment* seg = (DCEsegment*)dcecreate(CES_SEGMENT); - seg->name = strdup((char*)name); - for(i=0;islices[i] = *slice; - free(slice); - } - nclistfree(indices); - return seg; -} - -Object -function(DCEparsestate* state, Object fcnname, Object args) -{ - DCEfcn* fcn = (DCEfcn*)dcecreate(CES_FCN); - fcn->name = nulldup((char*)fcnname); - fcn->args = args; - return fcn; -} - -Object -arg_list(DCEparsestate* state, Object list0, Object decl) -{ - return collectlist(list0,decl); -} - - -Object -value_list(DCEparsestate* state, Object list0, Object decl) -{ - return collectlist(list0,decl); -} - -Object -value(DCEparsestate* state, Object val) -{ - DCEvalue* ncvalue = (DCEvalue*)dcecreate(CES_VALUE); - CEsort tag = *(CEsort*)val; - switch (tag) { - case CES_VAR: ncvalue->var = (DCEvar*)val; break; - case CES_FCN: ncvalue->fcn = (DCEfcn*)val; break; - case CES_CONST: ncvalue->constant = (DCEconstant*)val; break; - default: abort(); break; - } - ncvalue->discrim = tag; - return ncvalue; -} - -Object -var(DCEparsestate* state, Object indexpath) -{ - DCEvar* v = (DCEvar*)dcecreate(CES_VAR); - v->segments = (NClist*)indexpath; - return v; -} - -Object -constant(DCEparsestate* state, Object val, int tag) -{ - DCEconstant* con = (DCEconstant*)dcecreate(CES_CONST); - char* text = (char*)val; - char* endpoint = NULL; - switch (tag) { - case SCAN_STRINGCONST: - con->discrim = CES_STR; - con->text = nulldup(text); - break; - case SCAN_NUMBERCONST: - con->intvalue = strtoll(text,&endpoint,10); - if(*text != '\0' && *endpoint == '\0') { - con->discrim = CES_INT; - } else { - con->floatvalue = strtod(text,&endpoint); - if(*text != '\0' && *endpoint == '\0') - con->discrim = CES_FLOAT; - else abort(); - } - break; - default: abort(); break; - } - return con; -} - -static Object -collectlist(Object list0, Object decl) -{ - NClist* list = (NClist*)list0; - if(list == NULL) list = nclistnew(); - nclistpush(list,(ncelem)decl); - return list; -} - -Object -makeselectiontag(CEsort tag) -{ - return (Object) tag; -} - -int -dceerror(DCEparsestate* state, char* msg) -{ - strcpy(state->errorbuf,msg); - state->errorcode=1; - return 0; -} - -static void -dce_parse_cleanup(DCEparsestate* state) -{ - dcelexcleanup(&state->lexstate); /* will free */ -} - -static DCEparsestate* -ce_parse_init(char* input, DCEconstraint* constraint) -{ - DCEparsestate* state = NULL; - if(input==NULL) { - dceerror(state,"ce_parse_init: no input buffer"); - } else { - state = (DCEparsestate*)calloc(1,sizeof(DCEparsestate)); - if(state==NULL) return (DCEparsestate*)NULL; - state->errorbuf[0] = '\0'; - state->errorcode = 0; - dcelexinit(input,&state->lexstate); - state->constraint = constraint; - } - return state; -} - -#ifdef PARSEDEBUG -extern int dcedebug; -#endif - -/* Wrapper for ceparse */ -int -dapceparse(char* input, DCEconstraint* constraint, char** errmsgp) -{ - DCEparsestate* state; - int errcode = 0; - -#ifdef PARSEDEBUG -dcedebug = 1; -#endif - - if(input != NULL) { -#ifdef DEBUG -fprintf(stderr,"dceeparse: input=%s\n",input); -#endif - state = ce_parse_init(input,constraint); - if(dceparse(state) == 0) { -#ifdef DEBUG -if(nclistlength(constraint->projections) > 0) -fprintf(stderr,"dceeparse: projections=%s\n", - dcetostring((DCEnode*)constraint->projections)); -#endif -#ifdef DEBUG -if(nclistlength(constraint->selections) > 0) -fprintf(stderr,"dceeparse: selections=%s\n", - dumpselections(constraint->selections)); -#endif - } else { - if(errmsgp) *errmsgp = nulldup(state->errorbuf); - } - errcode = state->errorcode; - dce_parse_cleanup(state); - } - return errcode; -} - -#ifdef PARSEDEBUG -Object -debugobject(Object o) -{ - return o; -} -#endif diff --git a/xios_2311_src/trunk/.svn/pristine/17/1764267699125da9cbf0021aceb89235105b91fb.svn-base b/xios_2311_src/trunk/.svn/pristine/17/1764267699125da9cbf0021aceb89235105b91fb.svn-base deleted file mode 100644 index 1930a959c2342778bef35601962bf93fc8797e90..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/17/1764267699125da9cbf0021aceb89235105b91fb.svn-base +++ /dev/null @@ -1,142 +0,0 @@ -#ifndef __XIOS_CObjectTemplate__ -#define __XIOS_CObjectTemplate__ - -/// XIOS headers /// -#include "xios_spl.hpp" -#include "attribute_map.hpp" -#include "node_enum.hpp" -#include "buffer_in.hpp" -#include "event_server.hpp" -#include "attribute.hpp" -#include "context_client.hpp" - -namespace xios -{ - /// ////////////////////// Déclarations ////////////////////// /// - template - class CObjectTemplate - : public CObject - , public virtual CAttributeMap - { - - /// Friend /// - friend class CObjectFactory; - - /// Typedef /// - typedef CAttributeMap SuperClassMap; - typedef CObject SuperClass; - typedef T DerivedType; - - enum EEventId - { - EVENT_ID_SEND_ATTRIBUTE=100 - } ; - - public : - - /// Autres /// - virtual StdString toString(void) const; - virtual void fromString(const StdString & str); - -// virtual void toBinary (StdOStream & os) const; -// virtual void fromBinary(StdIStream & is); - virtual string getName(void) const ; - virtual void parse(xml::CXMLNode & node); - - /// Accesseurs /// - ENodeType getType(void) const; - - /// Test /// - virtual bool hasChild(void) const; - - /// Traitements /// - virtual void solveDescInheritance(bool apply, const CAttributeMap * const parent = 0); - - /// Traitement statique /// - static void ClearAllAttributes(void); - std::map getMinimumBufferSizeForAttributes(CContextClient* client); - void sendAttributToServer(const string& id, CContextClient* client, const string& objectId=""); - void sendAttributToServer(CAttribute& attr, CContextClient* client, const string& objectId="") ; - void sendAllAttributesToServer(CContextClient* client, const string& objectId=""); - void sendAddItem(const string& id, int itemType, CContextClient* client, const string& objectId=""); - static void recvAttributFromClient(CEventServer& event) ; - static bool dispatchEvent(CEventServer& event) ; - - bool isEqual(const string& id, const vector& excludedAttrs); - bool isEqual(T* obj, const vector& excludedAttrs); - - /// Accesseur statique /// - static std::vector > & - GetAllVectobject(const StdString & contextId); - - /// Destructeur /// - virtual ~CObjectTemplate(void); - - static void cleanStaticDataStructure(void); - - static bool has(const string& id) ; - static bool has(const string& contextId, const string& id) ; - static T* get(const string& id) ; - static T* get(const T* ptr) ; - static T* get(const string& contextId, const string& id) ; - T* get(void) ; - std::shared_ptr getShared(void) ; - static std::shared_ptr getShared(const T* ptr) ; - - static T* create(const string& id=string("")) ; - static T* createAlias(const string& id, const string& alias) ; - void createAlias(const string& alias) ; - - static const vector getAll() ; - static const vector getAll(const string& contextId) ; - - void generateCInterface(ostream& oss) ; - void generateFortran2003Interface(ostream& oss) ; - void generateFortranInterface(ostream& oss) ; - - // manage inherited id which is herited by reference - void setInheritedId(T* obj) ; - bool hasInheritedId(void) { return hasInheritedId_ ;} - string getInheritedId(void) { return inheritedId_ ;} - - private: - std::string inheritedId_ ; - bool hasInheritedId_ = false; - - // manage the template id - public: - void setTemplateId(T* obj) ; // & object, bool withAttrList = true, bool withId = true); - CObjectTemplate(const CObjectTemplate * const object); // Not implemented. - - private : - - /// Propriétés statiques /// - static xios_map > > AllMapObj; - static xios_map > > AllVectObj; - - static xios_map< StdString, long int > GenId ; - - }; // class CObjectTemplate -} // namespace xios - -//#include "object_template_impl.hpp" - -#endif // __XIOS_CObjectTemplate__ diff --git a/xios_2311_src/trunk/.svn/pristine/17/17ae47a623bf30642f1d397b475544cf26ea28b1.svn-base b/xios_2311_src/trunk/.svn/pristine/17/17ae47a623bf30642f1d397b475544cf26ea28b1.svn-base deleted file mode 100644 index 7179b6a4c2d11c18ea59151f8b06f005505db4fe..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/17/17ae47a623bf30642f1d397b475544cf26ea28b1.svn-base +++ /dev/null @@ -1,187 +0,0 @@ -#ifndef __BUFFER_IMPL_HPP__ -#define __BUFFER_IMPL_HPP__ - -namespace xios -{ - -// template spectialisation : CBuffer::put - template <> bool CBuffer::put(const char& data) { return put_template(data) ; } - template <> bool CBuffer::put(const int& data) { return put_template(data) ; } - template <> bool CBuffer::put(const short& data) { return put_template(data) ; } - template <> bool CBuffer::put(const long& data) { return put_template(data) ; } - template <> bool CBuffer::put(const longlong& data) { return put_template(data) ; } - template <> bool CBuffer::put(const uint& data) { return put_template(data) ; } - template <> bool CBuffer::put(const ushort& data) { return put_template(data) ; } - template <> bool CBuffer::put(const ulong& data) { return put_template(data) ; } - template <> bool CBuffer::put(const ulonglong& data) { return put_template(data) ; } - template <> bool CBuffer::put(const float& data) { return put_template(data) ; } - template <> bool CBuffer::put(const double& data) { return put_template(data) ; } - template <> bool CBuffer::put(const long double& data) { return put_template(data) ;} - - template <> bool CBuffer::put(const char* data, size_t n) { return put_template(data,n) ; } - template <> bool CBuffer::put(const int* data, size_t n) { return put_template(data,n) ; } - template <> bool CBuffer::put(const short* data, size_t n) { return put_template(data,n) ; } - template <> bool CBuffer::put(const long* data, size_t n) { return put_template(data,n) ; } - template <> bool CBuffer::put(const longlong* data, size_t n) { return put_template(data,n) ; } - template <> bool CBuffer::put(const uint* data, size_t n) { return put_template(data,n) ; } - template <> bool CBuffer::put(const ushort* data, size_t n) { return put_template(data,n) ; } - template <> bool CBuffer::put(const ulong* data, size_t n) { return put_template(data,n) ; } - template <> bool CBuffer::put(const ulonglong* data, size_t n) { return put_template(data,n) ; } - template <> bool CBuffer::put(const float* data, size_t n) { return put_template(data,n) ; } - template <> bool CBuffer::put(const double* data, size_t n) { return put_template(data,n) ; } - template <> bool CBuffer::put(const long double* data, size_t n) { return put_template(data,n) ;} - - - template <> bool CBuffer::put_ptr(const char*& data, size_t n) { return put_ptr_template(data,n) ; } - template <> bool CBuffer::put_ptr(const int*& data, size_t n) { return put_ptr_template(data,n) ; } - template <> bool CBuffer::put_ptr(const short*& data, size_t n) { return put_ptr_template(data,n) ; } - template <> bool CBuffer::put_ptr(const long*& data, size_t n) { return put_ptr_template(data,n) ; } - template <> bool CBuffer::put_ptr(const longlong*& data, size_t n) { return put_ptr_template(data,n) ; } - template <> bool CBuffer::put_ptr(const uint*& data, size_t n) { return put_ptr_template(data,n) ; } - template <> bool CBuffer::put_ptr(const ushort*& data, size_t n) { return put_ptr_template(data,n) ; } - template <> bool CBuffer::put_ptr(const ulong*& data, size_t n) { return put_ptr_template(data,n) ; } - template <> bool CBuffer::put_ptr(const ulonglong*& data, size_t n) { return put_ptr_template(data,n) ; } - template <> bool CBuffer::put_ptr(const float*& data, size_t n) { return put_ptr_template(data,n) ; } - template <> bool CBuffer::put_ptr(const double*& data, size_t n) { return put_ptr_template(data,n) ; } - template <> bool CBuffer::put_ptr(const long double*& data, size_t n) { return put_ptr_template(data,n) ;} - - -// template spectialisation : CBuffer::get - template <> bool CBuffer::get(char& data) { return get_template(data) ; } - template <> bool CBuffer::get(int& data) { return get_template(data) ; } - template <> bool CBuffer::get(short& data) { return get_template(data) ; } - template <> bool CBuffer::get(long& data) { return get_template(data) ; } - template <> bool CBuffer::get(longlong& data) { return get_template(data) ; } - template <> bool CBuffer::get(uint& data) { return get_template(data) ; } - template <> bool CBuffer::get(ushort& data) { return get_template(data) ; } - template <> bool CBuffer::get(ulong& data) { return get_template(data) ; } - template <> bool CBuffer::get(ulonglong& data) { return get_template(data) ; } - template <> bool CBuffer::get(float& data) { return get_template(data) ; } - template <> bool CBuffer::get(double& data) { return get_template(data) ; } - template <> bool CBuffer::get(long double& data) { return get_template(data) ;} - - template <> bool CBuffer::get(char* data, size_t n) { return get_template(data,n) ; } - template <> bool CBuffer::get(int* data, size_t n) { return get_template(data,n) ; } - template <> bool CBuffer::get(short* data, size_t n) { return get_template(data,n) ; } - template <> bool CBuffer::get(long* data, size_t n) { return get_template(data,n) ; } - template <> bool CBuffer::get(longlong* data, size_t n) { return get_template(data,n) ; } - template <> bool CBuffer::get(uint* data, size_t n) { return get_template(data,n) ; } - template <> bool CBuffer::get(ushort* data, size_t n) { return get_template(data,n) ; } - template <> bool CBuffer::get(ulong* data, size_t n) { return get_template(data,n) ; } - template <> bool CBuffer::get(ulonglong* data, size_t n) { return get_template(data,n) ; } - template <> bool CBuffer::get(float* data, size_t n) { return get_template(data,n) ; } - template <> bool CBuffer::get(double* data, size_t n) { return get_template(data,n) ; } - template <> bool CBuffer::get(long double* data, size_t n) { return get_template(data,n) ;} - - template <> bool CBuffer::get_ptr(char*& data, size_t n) { return get_ptr_template(data,n) ; } - template <> bool CBuffer::get_ptr(int*& data, size_t n) { return get_ptr_template(data,n) ; } - template <> bool CBuffer::get_ptr(short*& data, size_t n) { return get_ptr_template(data,n) ; } - template <> bool CBuffer::get_ptr(long*& data, size_t n) { return get_ptr_template(data,n) ; } - template <> bool CBuffer::get_ptr(longlong*& data, size_t n) { return get_ptr_template(data,n) ; } - template <> bool CBuffer::get_ptr(uint*& data, size_t n) { return get_ptr_template(data,n) ; } - template <> bool CBuffer::get_ptr(ushort*& data, size_t n) { return get_ptr_template(data,n) ; } - template <> bool CBuffer::get_ptr(ulong*& data, size_t n) { return get_ptr_template(data,n) ; } - template <> bool CBuffer::get_ptr(ulonglong*& data, size_t n) { return get_ptr_template(data,n) ; } - template <> bool CBuffer::get_ptr(float*& data, size_t n) { return get_ptr_template(data,n) ; } - template <> bool CBuffer::get_ptr(double*& data, size_t n) { return get_ptr_template(data,n) ; } - template <> bool CBuffer::get_ptr(long double*& data, size_t n) { return get_ptr_template(data,n) ;} - - - template - bool CBuffer::put_template(const T& data) - { - return put_template(&data,1); - } - - template - bool CBuffer::put_template(const T* data, size_t n) - { - bool ret; - char* dataBuff ; - - size_t dataSize=sizeof(T)*n ; - - if (count+dataSize<=size) - { - dataBuff=(char*) data ; - for(size_t i=0;i - bool CBuffer::put_ptr_template(const T*& data, size_t n) - { - bool ret; - char* dataBuff ; - - size_t dataSize=sizeof(T)*n ; - - if (count+dataSize<=size) - { - data=(T*) write ; - write+=dataSize ; - count+=dataSize; - ret=true ; - } - else ret=false ; - - return ret ; - } - - - template - bool CBuffer::get_template(T& data) - { - return get_template(&data,1) ; - - } - - template - bool CBuffer::get_template(T* data, size_t n) - { - bool ret; - char* dataBuff ; - - size_t dataSize=sizeof(T)*n ; - - if (read+dataSize<=buffer+size) - { - dataBuff=(char*) data ; - for(size_t i=0;i - bool CBuffer::get_ptr_template(T*& data, size_t n) - { - bool ret; - char* dataBuff ; - - size_t dataSize=sizeof(T)*n ; - - if (read+dataSize<=buffer+size) - { - data=(T*) read ; - read+=dataSize ; - ret=true ; - } - else ret=false ; - - return ret ; - } - -} - - -#endif diff --git a/xios_2311_src/trunk/.svn/pristine/17/17c0a454e53fd1f4f956abac018abd5870a6ac75.svn-base b/xios_2311_src/trunk/.svn/pristine/17/17c0a454e53fd1f4f956abac018abd5870a6ac75.svn-base deleted file mode 100644 index 7265305bbb38af9711527f3281f30bd96fbe4430..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/17/17c0a454e53fd1f4f956abac018abd5870a6ac75.svn-base +++ /dev/null @@ -1,112 +0,0 @@ -! * ************************************************************************** * -! * Interface auto generated - do not modify * -! * ************************************************************************** * -#include "xios_fortran_prefix.hpp" - -MODULE iinverse_axis_attr - USE, INTRINSIC :: ISO_C_BINDING - USE iinverse_axis - USE inverse_axis_interface_attr - -CONTAINS - - SUBROUTINE xios(set_inverse_axis_attr) & - ( inverse_axis_id ) - - IMPLICIT NONE - TYPE(txios(inverse_axis)) :: inverse_axis_hdl - CHARACTER(LEN=*), INTENT(IN) ::inverse_axis_id - - CALL xios(get_inverse_axis_handle) & - (inverse_axis_id,inverse_axis_hdl) - CALL xios(set_inverse_axis_attr_hdl_) & - ( inverse_axis_hdl ) - - END SUBROUTINE xios(set_inverse_axis_attr) - - SUBROUTINE xios(set_inverse_axis_attr_hdl) & - ( inverse_axis_hdl ) - - IMPLICIT NONE - TYPE(txios(inverse_axis)) , INTENT(IN) :: inverse_axis_hdl - - CALL xios(set_inverse_axis_attr_hdl_) & - ( inverse_axis_hdl ) - - END SUBROUTINE xios(set_inverse_axis_attr_hdl) - - SUBROUTINE xios(set_inverse_axis_attr_hdl_) & - ( inverse_axis_hdl ) - - IMPLICIT NONE - TYPE(txios(inverse_axis)) , INTENT(IN) :: inverse_axis_hdl - - END SUBROUTINE xios(set_inverse_axis_attr_hdl_) - - SUBROUTINE xios(get_inverse_axis_attr) & - ( inverse_axis_id ) - - IMPLICIT NONE - TYPE(txios(inverse_axis)) :: inverse_axis_hdl - CHARACTER(LEN=*), INTENT(IN) ::inverse_axis_id - - CALL xios(get_inverse_axis_handle) & - (inverse_axis_id,inverse_axis_hdl) - CALL xios(get_inverse_axis_attr_hdl_) & - ( inverse_axis_hdl ) - - END SUBROUTINE xios(get_inverse_axis_attr) - - SUBROUTINE xios(get_inverse_axis_attr_hdl) & - ( inverse_axis_hdl ) - - IMPLICIT NONE - TYPE(txios(inverse_axis)) , INTENT(IN) :: inverse_axis_hdl - - CALL xios(get_inverse_axis_attr_hdl_) & - ( inverse_axis_hdl ) - - END SUBROUTINE xios(get_inverse_axis_attr_hdl) - - SUBROUTINE xios(get_inverse_axis_attr_hdl_) & - ( inverse_axis_hdl ) - - IMPLICIT NONE - TYPE(txios(inverse_axis)) , INTENT(IN) :: inverse_axis_hdl - - END SUBROUTINE xios(get_inverse_axis_attr_hdl_) - - SUBROUTINE xios(is_defined_inverse_axis_attr) & - ( inverse_axis_id ) - - IMPLICIT NONE - TYPE(txios(inverse_axis)) :: inverse_axis_hdl - CHARACTER(LEN=*), INTENT(IN) ::inverse_axis_id - - CALL xios(get_inverse_axis_handle) & - (inverse_axis_id,inverse_axis_hdl) - CALL xios(is_defined_inverse_axis_attr_hdl_) & - ( inverse_axis_hdl ) - - END SUBROUTINE xios(is_defined_inverse_axis_attr) - - SUBROUTINE xios(is_defined_inverse_axis_attr_hdl) & - ( inverse_axis_hdl ) - - IMPLICIT NONE - TYPE(txios(inverse_axis)) , INTENT(IN) :: inverse_axis_hdl - - CALL xios(is_defined_inverse_axis_attr_hdl_) & - ( inverse_axis_hdl ) - - END SUBROUTINE xios(is_defined_inverse_axis_attr_hdl) - - SUBROUTINE xios(is_defined_inverse_axis_attr_hdl_) & - ( inverse_axis_hdl ) - - IMPLICIT NONE - TYPE(txios(inverse_axis)) , INTENT(IN) :: inverse_axis_hdl - - END SUBROUTINE xios(is_defined_inverse_axis_attr_hdl_) - -END MODULE iinverse_axis_attr diff --git a/xios_2311_src/trunk/.svn/pristine/17/17e687f6f01d832f8c6f79502886622811a5a252.svn-base b/xios_2311_src/trunk/.svn/pristine/17/17e687f6f01d832f8c6f79502886622811a5a252.svn-base deleted file mode 100644 index d676a52606a976edf798be11a68c18fbc857a646..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/17/17e687f6f01d832f8c6f79502886622811a5a252.svn-base +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef __BASE_TYPE_HPP__ -#define __BASE_TYPE_HPP__ - -#include "xios_spl.hpp" -#include "buffer_in.hpp" -#include "buffer_out.hpp" - -namespace xios -{ - - class CBaseType - { - public: - - CBaseType(void) {} - virtual ~CBaseType() {} - virtual void fromString(const string& str) =0 ; - virtual string toString(void) const =0; - - virtual bool fromBuffer(CBufferIn& buffer) =0; - virtual bool toBuffer(CBufferOut& buffer) const =0; - virtual CBaseType* clone(void) const =0; - virtual size_t size(void) const =0; - virtual bool isEmpty(void) const =0; - virtual void reset(void) =0; - } ; - -} - -#endif diff --git a/xios_2311_src/trunk/.svn/pristine/17/17f34111aa9a21dd33c94f6af2c6726d87617dca.svn-base b/xios_2311_src/trunk/.svn/pristine/17/17f34111aa9a21dd33c94f6af2c6726d87617dca.svn-base deleted file mode 100644 index de2b96f80a9af9ada7927f544d7c3d9f8fed43f5..0000000000000000000000000000000000000000 Binary files a/xios_2311_src/trunk/.svn/pristine/17/17f34111aa9a21dd33c94f6af2c6726d87617dca.svn-base and /dev/null differ diff --git a/xios_2311_src/trunk/.svn/pristine/17/17f7d0f12b77deba982c3238aa58e84740e254b1.svn-base b/xios_2311_src/trunk/.svn/pristine/17/17f7d0f12b77deba982c3238aa58e84740e254b1.svn-base deleted file mode 100644 index 0dd183891a1a0f23d53b48092631d2efcc585a88..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/17/17f7d0f12b77deba982c3238aa58e84740e254b1.svn-base +++ /dev/null @@ -1,98 +0,0 @@ -#ifndef __XIOS_CStoreFilter__ -#define __XIOS_CStoreFilter__ - -#include "input_pin.hpp" -#include "graph_package.hpp" - -namespace xios -{ - class CContext; - class CGrid; - class CField ; - - /*! - * A terminal filter which stores all the packets it receives. - */ - class CClientToModelStoreFilter : public CInputPin - { - public: - /*! - * Constructs the filter with one input slot and an associated - * garbage collector for the specified grid and context. - * - * \param gc the garbage collector associated with this input pin - * \param context the context to which the data belongs - * \param grid the grid to which the data is attached - * \param detectMissingValues whether missing values should be detected - * \param missingValue the value to use to replace missing values - */ - CClientToModelStoreFilter(CGarbageCollector& gc, CField* field); - - /*! - * Accesses the filter storage and retuns the packet corresponding - * to the specified timestamp. If there is no packet available for - * the specified timestamp, the function waits until the data is - * received or a timeout occurs. - * - * \param timestamp the timestamp of the requested packet - * \return a pointer to a read-only packet - */ - CConstDataPacketPtr getPacket(Time timestamp); - - /*! - * Accesses the filter storage and retuns the data corresponding - * to the specified timestamp. If there is no data available for - * the specified timestamp, the function waits until the data is - * received or a timeout occurs. - * - * \param timestamp the timestamp of the requested data - * \param data the array where the data is to be copied - * \return the status code associated with the data - */ - template - CDataPacket::StatusCode getData(Time timestamp, CArray& data); - - /*! - * Tests if the filter must auto-trigger. - * - * \return true if the filter must auto-trigger - */ - bool virtual mustAutoTrigger() const; - - /*! - * Tests whether data is expected for the specified date. - * - * \param date the date associated to the data - */ - bool virtual isDataExpected(const CDate& date) const; - - /*! - * Removes all pending packets which are older than the specified timestamp. - * - * \param timestamp the timestamp used for invalidation - */ - void virtual invalidate(Time timestamp); - - CGraphPackage * graphPackage; - bool graphEnabled; - - protected: - /*! - * Stores the packet for later access. - * - * \param data a vector of packets corresponding to each slot - */ - void virtual onInputReady(std::vector data); - - private: - CGarbageCollector& gc_; //!< The garbage collector associated to the filter - CContext* context_; //!< The context to which the data belongs - CGrid* grid_; //!< The grid attached to the data the filter can accept - bool detectMissingValues_; //!< Whether missing values should be detected - double missingValue_; //!< The value to use to replace missing values - bool hasMissingValue_ ; - std::map packets_; // -#include -#include -#include - -#include "netcdf.h" - -#include "nclist.h" -#include "ncbytes.h" -#include "dceconstraints.h" -#include "dceparselex.h" - -/* Forward */ -static void dumptoken(DCElexstate* lexstate); -static int tohex(int c); -static void ceaddyytext(DCElexstate* lex, int c); - -/****************************************************/ -/* Define 1 and > 1st legal characters */ -static char* wordchars1 = - "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-+_/%\\"; -static char* wordcharsn = - "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-+_/%\\"; - -/* Number characters */ -static char* numchars1="+-0123456789"; -static char* numcharsn="Ee.+-0123456789"; - -/**************************************************/ - -int -dcelex(YYSTYPE* lvalp, DCEparsestate* state) -{ - DCElexstate* lexstate = state->lexstate; - int token; - int c; - int len; - char* p=lexstate->next; - token = 0; - ncbytesclear(lexstate->yytext); - ncbytesnull(lexstate->yytext); - p=lexstate->next; - while(token == 0 && (c=*p)) { - if(c <= ' ' || c >= '\177') {p++; continue;} - if(c == '"') { - int more = 1; - /* We have a SCAN_STRINGCONST */ - while(more && (c=*(++p))) { - switch (c) { - case '"': p++; more=0; break; - case '\\': - c=*(++p); - switch (c) { - case 'r': c = '\r'; break; - case 'n': c = '\n'; break; - case 'f': c = '\f'; break; - case 't': c = '\t'; break; - case 'x': { - int d1,d2; - c = '?'; - ++p; - d1 = tohex(*p++); - if(d1 < 0) { - dceerror(state,"Illegal \\xDD in SCAN_STRING"); - } else { - d2 = tohex(*p++); - if(d2 < 0) { - dceerror(state,"Illegal \\xDD in SCAN_STRING"); - } else { - c=(((unsigned int)d1)<<4) | (unsigned int)d2; - } - } - } break; - default: break; - } - break; - default: break; - } - ceaddyytext(lexstate,c); - } - token=SCAN_STRINGCONST; - } else if(strchr(numchars1,c) != NULL) { - /* we might have a SCAN_NUMBERCONST */ - int isnumber = 0; - char* yytext; - char* endpoint; - ceaddyytext(lexstate,c); - for(p++;(c=*p);p++) { - if(strchr(numcharsn,c) == NULL) break; - ceaddyytext(lexstate,c); - } - /* See if this is a number */ - ncbytesnull(lexstate->yytext); - yytext = ncbytescontents(lexstate->yytext); - (void)strtoll(yytext,&endpoint,10); - if(*yytext != '\0' && *endpoint == '\0') - isnumber = 1; - else { - (void)strtod(yytext,&endpoint); - if(*yytext != '\0' && *endpoint == '\0') - isnumber = 1; /* maybe */ - } - /* A number followed by an id char is assumed to just be - a funny id */ - if(isnumber && (*p == '\0' || strchr(wordcharsn,*p) == NULL)) { - token = SCAN_NUMBERCONST; - } else { - /* Now, if the funny word has a "." in it, - we have to back up to that dot */ - char* dotpoint = strchr(yytext,'.'); - if(dotpoint != NULL) { - p = dotpoint; - *dotpoint = '\0'; - } - token = SCAN_WORD; - } - } else if(strchr(wordchars1,c) != NULL) { - /* we have a SCAN_WORD */ - ceaddyytext(lexstate,c); - for(p++;(c=*p);p++) { - if(strchr(wordcharsn,c) == NULL) break; - ceaddyytext(lexstate,c); - } - token=SCAN_WORD; - } else { - /* we have a single char token */ - token = c; - ceaddyytext(lexstate,c); - p++; - } - } - lexstate->next = p; - len = ncbyteslength(lexstate->yytext); - if(len > MAX_TOKEN_LENGTH) len = MAX_TOKEN_LENGTH; - strncpy(lexstate->lasttokentext,ncbytescontents(lexstate->yytext),len); - lexstate->lasttokentext[len] = '\0'; - lexstate->lasttoken = token; - if(dcedebug) dumptoken(lexstate); - - /*Put return value onto Bison stack*/ - - if(ncbyteslength(lexstate->yytext) == 0) - *lvalp = NULL; - else { - *lvalp = ncbytesdup(lexstate->yytext); - nclistpush(lexstate->reclaim,(ncelem)*lvalp); - } - - return token; -} - -static void -ceaddyytext(DCElexstate* lex, int c) -{ - ncbytesappend(lex->yytext,(char)c); -} - -static int -tohex(int c) -{ - if(c >= 'a' && c <= 'f') return (c - 'a') + 0xa; - if(c >= 'A' && c <= 'F') return (c - 'A') + 0xa; - if(c >= '0' && c <= '9') return (c - '0'); - return -1; -} - -static void -dumptoken(DCElexstate* lexstate) -{ - switch (lexstate->lasttoken) { - case SCAN_STRINGCONST: - fprintf(stderr,"TOKEN = |\"%s\"|\n",lexstate->lasttokentext); - break; - case SCAN_WORD: - case SCAN_NUMBERCONST: - default: - fprintf(stderr,"TOKEN = |%s|\n",lexstate->lasttokentext); - break; - } -} - -void -dcelexinit(char* input, DCElexstate** lexstatep) -{ - DCElexstate* lexstate = (DCElexstate*)malloc(sizeof(DCElexstate)); - if(lexstatep) *lexstatep = lexstate; - if(lexstate == NULL) return; - memset((void*)lexstate,0,sizeof(DCElexstate)); - lexstate->input = strdup(input); - lexstate->next = lexstate->input; - lexstate->yytext = ncbytesnew(); - lexstate->reclaim = nclistnew(); -} - -void -dcelexcleanup(DCElexstate** lexstatep) -{ - DCElexstate* lexstate = *lexstatep; - if(lexstate == NULL) return; - if(lexstate->input != NULL) free(lexstate->input); - if(lexstate->reclaim != NULL) { - while(nclistlength(lexstate->reclaim) > 0) { - char* word = (char*)nclistpop(lexstate->reclaim); - if(word) free(word); - } - nclistfree(lexstate->reclaim); - } - ncbytesfree(lexstate->yytext); - free(lexstate); - *lexstatep = NULL; -} - diff --git a/xios_2311_src/trunk/.svn/pristine/18/1861e1c40d3a276aaa858eea95d4400b9a950aae.svn-base b/xios_2311_src/trunk/.svn/pristine/18/1861e1c40d3a276aaa858eea95d4400b9a950aae.svn-base deleted file mode 100644 index cc61a2668722022d868620d83c0d2666318bc1fb..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/18/1861e1c40d3a276aaa858eea95d4400b9a950aae.svn-base +++ /dev/null @@ -1,30 +0,0 @@ -#include "xios_fortran_prefix.hpp" - -MODULE IDUPLICATE_SCALAR_TO_AXIS - USE, INTRINSIC :: ISO_C_BINDING - USE DUPLICATE_SCALAR_TO_AXIS_INTERFACE - - TYPE txios(duplicate_scalar_to_axis) - INTEGER(kind = C_INTPTR_T) :: daddr - END TYPE txios(duplicate_scalar_to_axis) - - CONTAINS ! Fonctions disponibles pour les utilisateurs. - - SUBROUTINE xios(get_duplicate_scalar_to_axis_handle)(idt,ret) - IMPLICIT NONE - CHARACTER(len = *), INTENT(IN) :: idt - TYPE(txios(duplicate_scalar_to_axis)) , INTENT(OUT):: ret - CALL cxios_duplicate_scalar_to_axis_handle_create(ret%daddr, idt, len(idt)) - END SUBROUTINE xios(get_duplicate_scalar_to_axis_handle) - - LOGICAL FUNCTION xios(is_valid_duplicate_scalar_to_axis)(idt) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: idt - LOGICAL (kind = 1) :: val - - CALL cxios_duplicate_scalar_to_axis_valid_id(val, idt, len(idt)) - xios(is_valid_duplicate_scalar_to_axis) = val - - END FUNCTION xios(is_valid_duplicate_scalar_to_axis) - -END MODULE IDUPLICATE_SCALAR_TO_AXIS diff --git a/xios_2311_src/trunk/.svn/pristine/18/189f6d4ecef3a3fddfdc33b40ad3be45af28c89d.svn-base b/xios_2311_src/trunk/.svn/pristine/18/189f6d4ecef3a3fddfdc33b40ad3be45af28c89d.svn-base deleted file mode 100644 index b4dfb9c9e0ceddf5b5a59ccf9b09f338f1333ef7..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/18/189f6d4ecef3a3fddfdc33b40ad3be45af28c89d.svn-base +++ /dev/null @@ -1,7 +0,0 @@ -[ - { - "Domain": ["lmdz"], - "UseServer2": ["false"], - "NumberServers": [2, 4] - } -] diff --git a/xios_2311_src/trunk/.svn/pristine/18/18e4a2e074b3e95de931cddd5acb90dc2ef45214.svn-base b/xios_2311_src/trunk/.svn/pristine/18/18e4a2e074b3e95de931cddd5acb90dc2ef45214.svn-base deleted file mode 100644 index a206863833b45e2dc1a024413f7da5c168536ac8..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/18/18e4a2e074b3e95de931cddd5acb90dc2ef45214.svn-base +++ /dev/null @@ -1,22 +0,0 @@ -MODULE EXTRACT_AXIS_TO_SCALAR_INTERFACE - USE, INTRINSIC :: ISO_C_BINDING - - INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99 - - SUBROUTINE cxios_extract_axis_to_scalar_handle_create(ret, idt, idt_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_extract_axis_to_scalar_handle_create - - SUBROUTINE cxios_extract_axis_to_scalar_valid_id(ret, idt, idt_size) BIND(C) - USE ISO_C_BINDING - LOGICAL (kind = C_BOOL) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_extract_axis_to_scalar_valid_id - - END INTERFACE - -END MODULE EXTRACT_AXIS_TO_SCALAR_INTERFACE diff --git a/xios_2311_src/trunk/.svn/pristine/18/18fcf9d2963205daaeffa9654b4bd0df0c91e4a0.svn-base b/xios_2311_src/trunk/.svn/pristine/18/18fcf9d2963205daaeffa9654b4bd0df0c91e4a0.svn-base deleted file mode 100644 index a0d38d765b781af3b6e416d53151a30c83196e35..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/18/18fcf9d2963205daaeffa9654b4bd0df0c91e4a0.svn-base +++ /dev/null @@ -1,127 +0,0 @@ -#ifndef __XIOS_CInputPin__ -#define __XIOS_CInputPin__ - -#include -#include - -#include "garbage_collector.hpp" -#include "data_packet.hpp" - -namespace xios -{ - class COutputPin; - - /*! - * An input pin handles the data packets received by a filter. - */ - class CInputPin : public InvalidableObject - { - public: - /*! - * Constructs an input pin with the specified number of slots - * and an associated garbage collector. - * - * \param gc the garbage collector associated with this input pin - * \param slotsCount the number of slots - */ - CInputPin(CGarbageCollector& gc, size_t slotsCount); - - /*! - * Sets the trigger for a specific input slot. - * - * \param inputSlot the input slot number - * \param trigger the corresponding trigger - */ - void virtual setInputTrigger(size_t inputSlot, COutputPin* trigger); - - /*! - * Receives a data packet from an upstream filter on - * the specified input slot. - * The receiving filter takes ownership of the packet. - * - * \param inputSlot the input slot number - * \param packet the data packet to be received - */ - void setInput(size_t inputSlot, CDataPacketPtr packet); - - /*! - * Triggers the input of any buffered packet for the specified timestamp. - * - * \param timestamp the timestamp for which we are triggering the input - */ - void virtual trigger(Time timestamp); - - /*! - * Tests if the pin can be triggered. - * - * \return true if the pin can be triggered - */ - bool virtual canBeTriggered() const; - - /*! - * Tests if the pin must auto-trigger. - * - * \return true if the pin must auto-trigger - */ - bool virtual mustAutoTrigger() const = 0; - - /*! - * Tests whether data is expected for the specified date. - * - * \param date the date associated to the data - */ - bool virtual isDataExpected(const CDate& date) const = 0; - - /*! - * Removes all pending packets which are older than the specified timestamp. - * - * \param timestamp the timestamp used for invalidation - */ - void virtual invalidate(Time timestamp); - - protected: - /*! - * Function triggered when all slots have been filled for a specific timestamp. - * It should be implemented by the filter class to process the data. - * - * \param data a vector of packets corresponding to each slot - */ - void virtual onInputReady(std::vector data) = 0; - - private: - /*! - * Helper structure, groups a vector of packets corresponding to each slot - * with the number of slots currently filled - */ - struct InputBuffer - { - size_t slotsFilled; //!< Number of slots currently filled - std::vector packets; //< Vector of packets corresponding to each slot - - /*! - * Initialize an empty input buffer for the specified number of slots. - * - * \param slotsCount the number of slots - */ - InputBuffer(size_t slotsCount) - : slotsFilled(0) - , packets(slotsCount) - { /* Nothing to do */ }; - }; - - CGarbageCollector& gc; //!< The garbage collector associated to the input pin - - size_t slotsCount; //!< The number of slots - - //! Input buffer, store the packets until all slots are full for a timestep - std::map inputs; - - //! Store the triggers corresponding to the input slots - std::vector triggers; - - //! Whether some triggers have been set - bool hasTriggers; - }; // class CInputPin -} // namespace xios - -#endif //__XIOS_CInputPin__ diff --git a/xios_2311_src/trunk/.svn/pristine/19/19692e13d2b90b612f9ceba0a200601b7374a887.svn-base b/xios_2311_src/trunk/.svn/pristine/19/19692e13d2b90b612f9ceba0a200601b7374a887.svn-base deleted file mode 100644 index cce5e3452dfefe944caf9a2f5226f26bd442932b..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/19/19692e13d2b90b612f9ceba0a200601b7374a887.svn-base +++ /dev/null @@ -1,613 +0,0 @@ -#include "globalScopeData.hpp" -#include "xios_spl.hpp" -#include "cxios.hpp" -#include "client.hpp" -#include -#include "type.hpp" -#include "context.hpp" -#include "context_client.hpp" -#include "oasis_cinterface.hpp" -#include "mpi.hpp" -#include "timer.hpp" -#include "buffer_client.hpp" -#include "string_tools.hpp" -#include "ressources_manager.hpp" -#include "services_manager.hpp" -#include -#include -#include "workflow_graph.hpp" -#include "release_static_allocation.hpp" - -namespace xios -{ - - const double serverPublishDefaultTimeout=10; - - MPI_Comm CClient::intraComm ; - MPI_Comm CClient::interComm ; - MPI_Comm CClient::clientsComm_ ; - - std::list CClient::contextInterComms; - int CClient::serverLeader ; - bool CClient::is_MPI_Initialized ; - int CClient::rank_ = INVALID_RANK; - StdOFStream CClient::m_infoStream; - StdOFStream CClient::m_errorStream; - CPoolRessource* CClient::poolRessource_=nullptr ; - - MPI_Comm& CClient::getInterComm(void) { return (interComm); } - -///--------------------------------------------------------------- -/*! - * \fn void CClient::initialize(const string& codeId, MPI_Comm& localComm, MPI_Comm& returnComm) - * Function creates intraComm (CClient::intraComm) for client group with id=codeId and interComm (CClient::interComm) between client and server groups. - * \param [in] codeId identity of context. - * \param [in/out] localComm local communicator. - * \param [in/out] returnComm (intra)communicator of client group. - */ - - void CClient::initialize(const string& codeId, MPI_Comm& localComm, MPI_Comm& returnComm) - { - - MPI_Comm clientComm ; - // initialize MPI if not initialized - int initialized ; - MPI_Initialized(&initialized) ; - if (initialized) is_MPI_Initialized=true ; - else is_MPI_Initialized=false ; - - MPI_Comm globalComm=CXios::getGlobalComm() ; - - ///////////////////////////////////////// - ///////////// PART 1 //////////////////// - ///////////////////////////////////////// - - - // localComm isn't given - if (localComm == MPI_COMM_NULL) - { - - // don't use OASIS - if (!CXios::usingOasis) - { - - if (!is_MPI_Initialized) - { - MPI_Init(NULL, NULL); - } - CTimer::get("XIOS").resume() ; - CTimer::get("XIOS init/finalize",false).resume() ; - - // split the global communicator - // get hash from all model to attribute a unique color (int) and then split to get client communicator - // every mpi process of globalComm (MPI_COMM_WORLD) must participate - - int commRank, commSize ; - MPI_Comm_rank(globalComm,&commRank) ; - MPI_Comm_size(globalComm,&commSize) ; - - std::hash hashString ; - size_t hashClient=hashString(codeId) ; - - size_t* hashAll = new size_t[commSize] ; - MPI_Allgather(&hashClient,1,MPI_SIZE_T,hashAll,1,MPI_SIZE_T,globalComm) ; - - int color=0 ; - map listHash ; - for(int i=0 ; i<=commSize ; i++) - if (listHash.count(hashAll[i])==0) - { - listHash[hashAll[i]]=color ; - color=color+1 ; - } - color=listHash[hashClient] ; - delete[] hashAll ; - - MPI_Comm_split(globalComm, color, commRank, &clientComm) ; - } - else // using oasis to split communicator - { - if (!is_MPI_Initialized) oasis_init(codeId) ; - oasis_get_localcomm(clientComm) ; - } - } - else // localComm is given - { - MPI_Comm_dup(localComm,&clientComm) ; - } - - - ///////////////////////////////////////// - ///////////// PART 2 //////////////////// - ///////////////////////////////////////// - - - // Create the XIOS communicator for every process which is related - // to XIOS, as well on client side as on server side - - MPI_Comm xiosGlobalComm ; - string strIds=CXios::getin("clients_code_id","") ; - vector clientsCodeId=splitRegex(strIds,"\\s*,\\s*") ; - if (strIds.empty()) - { - // no code Ids given, suppose XIOS initialisation is global - int commRank, commGlobalRank, serverLeader, clientLeader,serverRemoteLeader,clientRemoteLeader ; - MPI_Comm splitComm,interComm ; - MPI_Comm_rank(globalComm,&commGlobalRank) ; - MPI_Comm_split(globalComm, 0, commGlobalRank, &splitComm) ; - int splitCommSize, globalCommSize ; - - MPI_Comm_size(splitComm,&splitCommSize) ; - MPI_Comm_size(globalComm,&globalCommSize) ; - if (splitCommSize==globalCommSize) // no server - { - MPI_Comm_dup(globalComm,&xiosGlobalComm) ; - CXios::setXiosComm(xiosGlobalComm) ; - } - else - { - MPI_Comm_rank(splitComm,&commRank) ; - if (commRank==0) clientLeader=commGlobalRank ; - else clientLeader=0 ; - serverLeader=0 ; - MPI_Allreduce(&clientLeader,&clientRemoteLeader,1,MPI_INT,MPI_SUM,globalComm) ; - MPI_Allreduce(&serverLeader,&serverRemoteLeader,1,MPI_INT,MPI_SUM,globalComm) ; - MPI_Intercomm_create(splitComm, 0, globalComm, serverRemoteLeader,1341,&interComm) ; - MPI_Intercomm_merge(interComm,true,&xiosGlobalComm) ; - CXios::setXiosComm(xiosGlobalComm) ; - } - } - else - { - - xiosGlobalCommByFileExchange(clientComm, codeId) ; - - } - - int commRank ; - MPI_Comm_rank(CXios::getXiosComm(), &commRank) ; - MPI_Comm_split(CXios::getXiosComm(),false,commRank, &clientsComm_) ; - - // is using server or not ? - int xiosCommSize, clientsCommSize ; - MPI_Comm_size(CXios::getXiosComm(), &xiosCommSize) ; - MPI_Comm_size(clientsComm_, &clientsCommSize) ; - if (xiosCommSize==clientsCommSize) CXios::setUsingServer() ; - else CXios::setNotUsingServer() ; - - ///////////////////////////////////////// - ///////////// PART 3 //////////////////// - ///////////////////////////////////////// - - CXios::launchDaemonsManager(false) ; - poolRessource_ = new CPoolRessource(clientComm, codeId) ; - - ///////////////////////////////////////// - ///////////// PART 4 //////////////////// - ///////////////////////////////////////// - - returnComm = clientComm ; - } - - - void CClient::xiosGlobalCommByFileExchange(MPI_Comm clientComm, const string& codeId) - { - - MPI_Comm globalComm=CXios::getGlobalComm() ; - MPI_Comm xiosGlobalComm ; - - string strIds=CXios::getin("clients_code_id","") ; - vector clientsCodeId=splitRegex(strIds,"\\s*,\\s*") ; - - int commRank, globalRank, clientRank, serverRank ; - MPI_Comm_rank(clientComm, &commRank) ; - MPI_Comm_rank(globalComm, &globalRank) ; - string clientFileName("__xios_publisher::"+codeId+"__to_remove__") ; - - int error ; - - if (commRank==0) // if root process publish name - { - std::ofstream ofs (clientFileName, std::ofstream::out); - ofs<("server_puplish_timeout",serverPublishDefaultTimeout) ; - double time ; - - do - { - CTimer::get("server_publish_timeout").resume() ; - ifs.clear() ; - ifs.open(fileName, std::ifstream::in) ; - CTimer::get("server_publish_timeout").suspend() ; - } while (ifs.fail() && CTimer::get("server_publish_timeout").getCumulatedTime()=timeout || ifs.fail()) - { - ifs.clear() ; - ifs.close() ; - ifs.clear() ; - error=true ; - } - else - { - ifs>>serverRank ; - ifs.close() ; - error=false ; - } - - } - - MPI_Bcast(&error,1,MPI_INT,0,clientComm) ; - - if (error==false) // you have a server - { - MPI_Comm intraComm ; - MPI_Comm_dup(clientComm,&intraComm) ; - MPI_Comm interComm ; - - int pos=0 ; - for(int i=0 ; codeId!=clientsCodeId[i]; i++) pos=pos+1 ; - - bool high=true ; - for(int i=pos ; i clientsRank(clientsCodeId.size()) ; - - if (commRank==0) - { - for(int i=0;i>clientsRank[i] ; - ifs.close() ; - } - } - - int client ; - MPI_Comm intraComm ; - MPI_Comm_dup(clientComm,&intraComm) ; - MPI_Comm interComm ; - - int pos=0 ; - for(int i=0 ; codeId!=clientsCodeId[i]; i++) pos=pos+1 ; - - bool high=true ; - for(int i=pos+1 ; icreateService(contextComm, id, 0, CServicesManager::CLIENT, 1) ; - getPoolRessource()->createService(contextComm, id+"_"+CXios::defaultServerId, 0, CServicesManager::IO_SERVER, 1) ; - - if (commRank==0) while (!CXios::getServicesManager()->hasService(getPoolRessource()->getId(), id, 0)) { CXios::getDaemonsManager()->eventLoop();} - - if (commRank==0) CXios::getContextsManager()->createServerContext(getPoolRessource()->getId(), id, 0, id) ; - int type=CServicesManager::CLIENT ; - string name = CXios::getContextsManager()->getServerContextName(getPoolRessource()->getId(), id, 0, type, id) ; - double time ; - double lastTime=0 ; - double latency=0 ; - bool out=false ; - while (!out) - { - time=MPI_Wtime() ; - if (time-lastTime > latency) - { - out=CXios::getContextsManager()->hasContext(name, contextComm); - lastTime=time ; - } - if (!out) CXios::getDaemonsManager()->eventLoop() ; - } - - } - - - -/*! - * \fn void CClient::callOasisEnddef(void) - * \brief Send the order to the servers to call "oasis_enddef". It must be done by each compound of models before calling oasis_enddef on client side - * Function is only called by client. - */ - void CClient::callOasisEnddef(void) - { - bool oasisEnddef=CXios::getin("call_oasis_enddef",true) ; - if (!oasisEnddef) ERROR("void CClient::callOasisEnddef(void)", <<"Function xios_oasis_enddef called but variable is set to false."< must be set to true"<finalize() ; - - CTimer::get("XIOS init/finalize",false).suspend() ; - CTimer::get("XIOS").suspend() ; - CXios::finalizeDaemonsManager() ; - finalizePoolRessource() ; - CContext::removeAllContexts() ; // free memory for related context - - CXios::getMpiGarbageCollector().release() ; // release unfree MPI ressources - if (!is_MPI_Initialized) - { - if (CXios::usingOasis) oasis_finalize(); - else MPI_Finalize() ; - } - - info(20) << "Client side context is finalized"<open(fileNameClient.str().c_str(), std::ios::out); - if (!fb->is_open()) - ERROR("void CClient::openStream(const StdString& fileName, const StdString& ext, std::filebuf* fb)", - << std::endl << "Can not open <" << fileNameClient.str() << "> file to write the client log(s)."); - } - - /*! - * \brief Open a file stream to write the info logs - * Open a file stream with a specific file name suffix+rank - * to write the info logs. - * \param fileName [in] protype file name - */ - void CClient::openInfoStream(const StdString& fileName) - { - std::filebuf* fb = m_infoStream.rdbuf(); - openStream(fileName, ".out", fb); - - info.write2File(fb); - report.write2File(fb); - } - - //! Write the info logs to standard output - void CClient::openInfoStream() - { - info.write2StdOut(); - report.write2StdOut(); - } - - //! Close the info logs file if it opens - void CClient::closeInfoStream() - { - if (m_infoStream.is_open()) m_infoStream.close(); - } - - /*! - * \brief Open a file stream to write the error log - * Open a file stream with a specific file name suffix+rank - * to write the error log. - * \param fileName [in] protype file name - */ - void CClient::openErrorStream(const StdString& fileName) - { - std::filebuf* fb = m_errorStream.rdbuf(); - openStream(fileName, ".err", fb); - - error.write2File(fb); - } - - //! Write the error log to standard error output - void CClient::openErrorStream() - { - error.write2StdErr(); - } - - //! Close the error log file if it opens - void CClient::closeErrorStream() - { - if (m_errorStream.is_open()) m_errorStream.close(); - } -} diff --git a/xios_2311_src/trunk/.svn/pristine/19/1983abd1ed88d6cb4d42e8193fc7cf9289f233a0.svn-base b/xios_2311_src/trunk/.svn/pristine/19/1983abd1ed88d6cb4d42e8193fc7cf9289f233a0.svn-base deleted file mode 100644 index 0d45b6e0c959971c26e8f656d35f51635d88c6e0..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/19/1983abd1ed88d6cb4d42e8193fc7cf9289f233a0.svn-base +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - performance - 1.0 - - - - false - 50 - true - - - - diff --git a/xios_2311_src/trunk/.svn/pristine/1a/1aa1b75bba9b4290f31454383b23ef17fc53ba6a.svn-base b/xios_2311_src/trunk/.svn/pristine/1a/1aa1b75bba9b4290f31454383b23ef17fc53ba6a.svn-base deleted file mode 100644 index 59beb4ff657202ed4867bf5c2aa0cbb340686f7d..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/1a/1aa1b75bba9b4290f31454383b23ef17fc53ba6a.svn-base +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef __XIOS_functor_type__ -#define __XIOS_functor_type__ - -#include "average.hpp" -#include "accumulate.hpp" -#include "instant.hpp" -#include "once.hpp" -#include "maximum.hpp" -#include "minimum.hpp" - -#endif //__XIOS_functor_type__ - diff --git a/xios_2311_src/trunk/.svn/pristine/1a/1abb89a700d92ecea8af73ba5344daeb74d7f7ad.svn-base b/xios_2311_src/trunk/.svn/pristine/1a/1abb89a700d92ecea8af73ba5344daeb74d7f7ad.svn-base deleted file mode 100644 index b99ed22bcbd9b5c08d1ce0dcbd8fd4f4033ae9fe..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/1a/1abb89a700d92ecea8af73ba5344daeb74d7f7ad.svn-base +++ /dev/null @@ -1,10 +0,0 @@ -module load subversion -module load cmake - -CHMOD() { setfacl -R -m u::rwx,u:rpsl565:rwx,u:rpsl954:rwx,u:rgzi016:rwx,g::r-x,o::r-x,m::rwx "$@" ;} -export -f CHMOD - -export xios_full_machine_name="Jean-Zay" -export xios_test_suite_repository=${WORK}/XIOS_TEST_SUITE_REPOSITORY -export xios_reference_dir=${WORK} -mkdir -p $xios_test_suite_repository ; CHMOD $xios_test_suite_repository diff --git a/xios_2311_src/trunk/.svn/pristine/1a/1ac98cea0e9698bee61755d32b59e1be50d4af3a.svn-base b/xios_2311_src/trunk/.svn/pristine/1a/1ac98cea0e9698bee61755d32b59e1be50d4af3a.svn-base deleted file mode 100644 index fbe473a3419f59da45c22aba56c2608a1fd9fca3..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/1a/1ac98cea0e9698bee61755d32b59e1be50d4af3a.svn-base +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef __XIOS_SERVER_TO_CLIENT_FILTER_HPP__ -#define __XIOS_SERVER_TO_CLIENT_FILTER_HPP__ - -#include "input_pin.hpp" -#include "graph_package.hpp" - -namespace xios -{ - class CField; - class CGrid ; - class CContextClient ; - - /*! - * A terminal filter which transmits the packets it receives to a field for writting in a file. - */ - class CServerToClientStoreFilter : public CInputPin - { - public: - /*! - * Constructs the filter (with one input slot) associated to the specified field - * and a garbage collector. - * - * \param gc the associated garbage collector - * \param field the associated field - */ - CServerToClientStoreFilter(CGarbageCollector& gc, CField* field, CContextClient* client); - - /*! - * Get the size of data transfered by call. Needed for context client buffer size evaluation - * - * \param size : map returning the size for each server rank - * \return the associated context client - */ - CContextClient* getTransferedDataSize(map& size) ; - - /*! - * Tests if the filter must auto-trigger. - * - * \return true if the filter must auto-trigger - */ - bool virtual mustAutoTrigger() const; - - /*! - * Tests whether data is expected for the specified date. - * - * \param date the date associated to the data - */ - bool virtual isDataExpected(const CDate& date) const; - CGraphPackage * graphPackage; - bool graphEnabled; - - protected: - /*! - * Callbacks a field to write a packet to a file. - * - * \param data a vector of packets corresponding to each slot - */ - void virtual onInputReady(std::vector data); - - private: - CField* field_; // packets; //(), CCalendarWrapperAttributes() - { /* Ne rien faire de plus */ } - - CCalendarWrapper::CCalendarWrapper(const StdString & id) - : CObjectTemplate(id), CCalendarWrapperAttributes() - { /* Ne rien faire de plus */ } - - CCalendarWrapper::~CCalendarWrapper(void) - {} - - //---------------------------------------------------------------- - - StdString CCalendarWrapper::GetName(void) { return StdString("calendar_wrapper"); } - StdString CCalendarWrapper::GetDefName(void) { return StdString("calendar"); } - ENodeType CCalendarWrapper::GetType(void) { return eCalendarWrapper; } - - //---------------------------------------------------------------- - - /*! - \brief Extract the calendar from its wrapper - \return the calendar - */ - std::shared_ptr CCalendarWrapper::getCalendar(bool checkValid /*= false*/) const - { - if (checkValid && !this->calendar) - ERROR("CCalendarWrapper::getCalendar(bool checkValid = true)", << "The calendar was accessed before being created!"); - return this->calendar; - } - - const CDate& CCalendarWrapper::getInitDate() const - { - return getCalendar(true)->getInitDate(); - } - - const CDate& CCalendarWrapper::getTimeOrigin() const - { - return getCalendar(true)->getTimeOrigin(); - } - - //---------------------------------------------------------------- - - void CCalendarWrapper::setInitDate(const CDate& initDate) - { - getCalendar(true)->setInitDate(initDate); - start_date = initDate.toString(); - } - - void CCalendarWrapper::setTimeOrigin(const CDate& timeOrigin) - { - getCalendar(true)->setTimeOrigin(timeOrigin); - time_origin = timeOrigin.toString(); - } - - //---------------------------------------------------------------- - - /*! - \brief Parse the calendar node - \param [in] node xmld node corresponding to the calendar definition - */ - void CCalendarWrapper::parse(xml::CXMLNode& node) - { - SuperClass::parse(node); - - // Try to create the calendar - createCalendar(); - } - - /*! - \brief Try to create the calendar from the parsed attributes - */ - void CCalendarWrapper::createCalendar(void) - { - // Create the calendar if possible - if (calendar) - { - ERROR("CCalendarWrapper::createCalendar(void)", - << "Error: the calendar can only be defined once!"); - } - else if (!type.isEmpty()) - { -#define DECLARE_CALENDAR(MType, eType) \ - if (type.getValue() == type_attr::eType) \ - calendar = std::shared_ptr(new C##MType##Calendar()); -#include "calendar_type.conf" -#undef DECLARE_CALENDAR - // Special case for the user defined calendar - if (type.getValue() == type_attr::user_defined) - { - if (day_length.isEmpty()) - ERROR("CCalendarWrapper::createCalendar(void)", - << "The day length must be configured when using an user defined calendar."); - if (month_lengths.isEmpty() == year_length.isEmpty()) - ERROR("CCalendarWrapper::createCalendar(void)", - << "Either the month lengths or the year length must be configured when using an user defined calendar."); - if (leap_year_drift.isEmpty() != leap_year_month.isEmpty()) - ERROR("CCalendarWrapper::createCalendar(void)", - << "Both leap_year_drift and leap_year_month attributes must be set if you wish to configure leap years."); - if (leap_year_drift.isEmpty() && !leap_year_drift_offset.isEmpty()) - ERROR("CCalendarWrapper::createCalendar(void)", - << "Both leap_year_drift and leap_year_month attributes are mandatory if you wish to use leap_year_drift_offset attribute."); - - std::shared_ptr userDefinedCalendar; - if (year_length.isEmpty()) - userDefinedCalendar.reset(new CUserDefinedCalendar(day_length.getValue(), month_lengths.getValue())); - else - userDefinedCalendar.reset(new CUserDefinedCalendar(day_length.getValue(), year_length.getValue())); - - if (!leap_year_month.isEmpty()) - userDefinedCalendar->configureLeapYear(leap_year_month.getValue(), - leap_year_drift.getValue(), - leap_year_drift_offset.isEmpty() ? 0.0 : leap_year_drift_offset.getValue()); - - calendar = userDefinedCalendar; - } - else - { -#define CHECK_EMPTY(attr) \ - if (!attr.isEmpty()) \ - ERROR("CCalendarWrapper::createCalendar(void)", \ - << "The attribute \"" #attr "\" can only be used with user defined calendar."); - CHECK_EMPTY(day_length) - CHECK_EMPTY(month_lengths) - CHECK_EMPTY(year_length) - CHECK_EMPTY(leap_year_month) - CHECK_EMPTY(leap_year_drift) - CHECK_EMPTY(leap_year_drift_offset) -#undef CHECK_EMPTY - } - - if (!calendar) - ERROR("CCalendarWrapper::createCalendar(void)", - << "[ type = " << type.getStringValue() << " ] " - << "The calendar is not properly handled!"); - - // Set the timestep is available - if (!timestep.isEmpty()) - calendar->setTimeStep(timestep.getValue()); - - // Parse and set the start date if available - if (!start_date.isEmpty()) - calendar->setInitDate(CDate::FromString(start_date.getValue(), *calendar)); - - // Parse and set the time origin if available - if (!time_origin.isEmpty()) - calendar->setTimeOrigin(CDate::FromString(time_origin.getValue(), *calendar)); - - // Notify the context about the calendar - CContext* context = CContext::getCurrent(); - if (!context) - ERROR("CCalendarWrapper::createCalendar(void)", << "Impossible to set the calendar: no current context available."); - context->setCalendar(calendar); - } - else if (!start_date.isEmpty() || !time_origin.isEmpty()) - { - ERROR("CCalendarWrapper::createCalendar(void)", - << "The calendar type must be set before defining the start date or the time origin!"); - } - } - - /*! - \brief Try to update the timestep of the calendar with the corresponding attribute - */ - void CCalendarWrapper::updateTimestep(void) - { - if (timestep.isEmpty()) - { - ERROR("CCalendarWrapper::updateTimestep(void)", - << "Error: the timestep needs to be defined!"); - } - else if (calendar) - calendar->setTimeStep(timestep.getValue()); - } -} \ No newline at end of file diff --git a/xios_2311_src/trunk/.svn/pristine/1c/1c968c9d0a1b301782e16d4b69a672042b16110c.svn-base b/xios_2311_src/trunk/.svn/pristine/1c/1c968c9d0a1b301782e16d4b69a672042b16110c.svn-base deleted file mode 100644 index f26bdea7cc93fa44b9caf42b61f85699720f2ed7..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/1c/1c968c9d0a1b301782e16d4b69a672042b16110c.svn-base +++ /dev/null @@ -1,607 +0,0 @@ -/********************************************************************* - * Copyright 1993, UCAR/Unidata - * See netcdf/COPYRIGHT file for copying and redistribution conditions. - * $Header: /upc/share/CVS/netcdf-3/libncdap3/dapdump.c,v 1.21 2010/05/26 21:43:31 dmh Exp $ - *********************************************************************/ -#include "config.h" -#ifdef USE_PARALLEL -#include "netcdf_par.h" -#endif -#include "ncdap3.h" -#include "dapdump.h" -#include "dceconstraints.h" - -#define CHECK(n) if((n) != NC_NOERR) {return (n);} else {} - -static void dumptreer(CDFnode* root, NCbytes* buf, int indent, int visible); - -int -dumpmetadata(int ncid, NChdr** hdrp) -{ - int stat,i,j,k; - NChdr* hdr = (NChdr*)calloc(1,sizeof(NChdr)); - MEMCHECK(hdr,NC_ENOMEM); - hdr->ncid = ncid; - hdr->content = ncbytesnew(); - if(hdrp) *hdrp = hdr; - - stat = nc_inq(hdr->ncid, - &hdr->ndims, - &hdr->nvars, - &hdr->ngatts, - &hdr->unlimid); - CHECK(stat); - if(ncdap3debug > 0) { - fprintf(stdout,"ncid=%d ngatts=%d ndims=%d nvars=%d unlimid=%d\n", - hdr->ncid,hdr->ngatts,hdr->ndims,hdr->nvars,hdr->unlimid); - } - hdr->gatts = (NCattribute*)calloc(1,hdr->ngatts*sizeof(NCattribute)); - MEMCHECK(hdr->gatts,NC_ENOMEM); - if(hdr->ngatts > 0) - fprintf(stdout,"global attributes:\n"); - for(i=0;ingatts;i++) { - NCattribute* att = &hdr->gatts[i]; - char attname[NC_MAX_NAME]; - nc_type nctype; - size_t typesize; - size_t nvalues; - - stat = nc_inq_attname(hdr->ncid,NC_GLOBAL,i,attname); - CHECK(stat); - att->name = nulldup(attname); - stat = nc_inq_att(hdr->ncid,NC_GLOBAL,att->name,&nctype,&nvalues); - CHECK(stat); - att->etype = nctypetodap(nctype); - typesize = nctypesizeof(att->etype); - fprintf(stdout,"\t[%d]: name=%s type=%s values(%lu)=", - i,att->name,nctypetostring(octypetonc(att->etype)), - (unsigned long)nvalues); - if(nctype == NC_CHAR) { - size_t len = typesize*nvalues; - char* values = (char*)malloc(len+1);/* for null terminate*/ - MEMCHECK(values,NC_ENOMEM); - stat = nc_get_att(hdr->ncid,NC_GLOBAL,att->name,values); - CHECK(stat); - values[len] = '\0'; - fprintf(stdout," '%s'",values); - } else { - size_t len = typesize*nvalues; - char* values = (char*)malloc(len); - MEMCHECK(values,NC_ENOMEM); - stat = nc_get_att(hdr->ncid,NC_GLOBAL,att->name,values); - CHECK(stat); - for(k=0;ketype),k,values); - } - } - fprintf(stdout,"\n"); - } - - hdr->dims = (Dim*)malloc(hdr->ndims*sizeof(Dim)); - MEMCHECK(hdr->dims,NC_ENOMEM); - for(i=0;indims;i++) { - hdr->dims[i].dimid = i; - stat = nc_inq_dim(hdr->ncid, - hdr->dims[i].dimid, - hdr->dims[i].name, - &hdr->dims[i].size); - CHECK(stat); - fprintf(stdout,"dim[%d]: name=%s size=%lu\n", - i,hdr->dims[i].name,(unsigned long)hdr->dims[i].size); - } - hdr->vars = (Var*)malloc(hdr->nvars*sizeof(Var)); - MEMCHECK(hdr->vars,NC_ENOMEM); - for(i=0;invars;i++) { - Var* var = &hdr->vars[i]; - nc_type nctype; - var->varid = i; - stat = nc_inq_var(hdr->ncid, - var->varid, - var->name, - &nctype, - &var->ndims, - var->dimids, - &var->natts); - CHECK(stat); - var->nctype = (nctype); - fprintf(stdout,"var[%d]: name=%s type=%s |dims|=%d", - i, - var->name, - nctypetostring(var->nctype), - var->ndims); - fprintf(stdout," dims={"); - for(j=0;jndims;j++) { - fprintf(stdout," %d",var->dimids[j]); - } - fprintf(stdout,"}\n"); - var->atts = (NCattribute*)malloc(var->natts*sizeof(NCattribute)); - MEMCHECK(var->atts,NC_ENOMEM); - for(j=0;jnatts;j++) { - NCattribute* att = &var->atts[j]; - char attname[NC_MAX_NAME]; - size_t typesize; - char* values; - nc_type nctype; - size_t nvalues; - stat = nc_inq_attname(hdr->ncid,var->varid,j,attname); - CHECK(stat); - att->name = nulldup(attname); - stat = nc_inq_att(hdr->ncid,var->varid,att->name,&nctype,&nvalues); - CHECK(stat); - att->etype = nctypetodap(nctype); - typesize = nctypesizeof(att->etype); - values = (char*)malloc(typesize*nvalues); - MEMCHECK(values,NC_ENOMEM); - stat = nc_get_att(hdr->ncid,var->varid,att->name,values); - CHECK(stat); - fprintf(stdout,"\tattr[%d]: name=%s type=%s values(%lu)=", - j,att->name,nctypetostring(octypetonc(att->etype)),(unsigned long)nvalues); - for(k=0;ketype),k,values); - } - fprintf(stdout,"\n"); - } - } - fflush(stdout); - return NC_NOERR; -} - -void -dumpdata1(nc_type nctype, size_t index, char* data) -{ - switch (nctype) { - case NC_CHAR: - fprintf(stdout,"'%c' %hhd",data[index],data[index]); - break; - case NC_BYTE: - fprintf(stdout,"%hdB",((signed char*)data)[index]); - break; - case NC_UBYTE: - fprintf(stdout,"%huB",((unsigned char*)data)[index]); - break; - case NC_SHORT: - fprintf(stdout,"%hdS",((short*)data)[index]); - break; - case NC_USHORT: - fprintf(stdout,"%hdUS",((unsigned short*)data)[index]); - break; - case NC_INT: - fprintf(stdout,"%d",((int*)data)[index]); - break; - case NC_UINT: - fprintf(stdout,"%uU",((unsigned int*)data)[index]); - break; - case NC_FLOAT: - fprintf(stdout,"%#gF",((float*)data)[index]); - break; - case NC_DOUBLE: - fprintf(stdout,"%#gD",((double*)data)[index]); - break; - case NC_STRING: - fprintf(stdout,"\"%s\"",((char**)data)[index]); - break; - default: - fprintf(stdout,"Unknown type: %i",nctype); - break; - } - fflush(stdout); -} - -/* Following should be kept consistent with - the makeXXXstring3 routines in constraints3.c -*/ - -/* Convert an NCprojection instance into a string - that can be used with the url -*/ -char* -dumpprojections(NClist* projections) -{ - char* tmp; - int v = dceverbose; - dceverbose = 1; - tmp = dcelisttostring(projections,","); - dceverbose = v; - return tmp; -} - -char* -dumpprojection(DCEprojection* proj) -{ - char* tmp; - int v = dceverbose; - dceverbose = 1; - tmp = dcetostring((DCEnode*)proj); - dceverbose = v; - return tmp; -} - -char* -dumpselections(NClist* selections) -{ - return dcelisttostring(selections,"&"); -} - -char* -dumpselection(DCEselection* sel) -{ - return dcetostring((DCEnode*)sel); -} - -char* -dumpconstraint(DCEconstraint* con) -{ - char* tmp; - int v = dceverbose; - dceverbose = 1; - tmp = dcetostring((DCEnode*)con); - dceverbose = v; - return tmp; -} - -char* -dumpsegments(NClist* segments) -{ - return dcelisttostring(segments,"."); -} - -char* -dumppath(CDFnode* leaf) -{ - NClist* path = nclistnew(); - NCbytes* buf = ncbytesnew(); - char* result; - int i; - - if(leaf == NULL) return nulldup(""); - collectnodepath3(leaf,path,!WITHDATASET); - for(i=0;i 0) ncbytescat(buf,"."); - ncbytescat(buf,node->ncbasename); - } - result = ncbytesdup(buf); - ncbytesfree(buf); - nclistfree(path); - return result; -} - -static void -dumpindent(int indent, NCbytes* buf) -{ - static char* indentstr = " "; - int i; - for(i=0;isubnodes);i++) { - CDFnode* node = (CDFnode*)nclistget(root->subnodes,i); - if(visible && !root->visible) continue; - if(root->nctype == NC_Grid) { - if(i==0) { - dumpindent(indent+1,buf); - ncbytescat(buf,"Array:\n"); - } else if(i==1) { - dumpindent(indent+1,buf); - ncbytescat(buf,"Maps:\n"); - } - dumptreer(node,buf,indent+2,visible); - } else { - dumptreer(node,buf,indent+1,visible); - } - } - dumpindent(indent,buf); - ncbytescat(buf,"} "); - ncbytescat(buf,root->ncbasename); -} - -static void -dumptreer(CDFnode* root, NCbytes* buf, int indent, int visible) -{ - int i; - char* primtype = NULL; - NClist* dimset = NULL; - - if(visible && !root->visible) return; - switch (root->nctype) { - case NC_Dataset: - dumptreer1(root,buf,indent,"Dataset",visible); - break; - case NC_Sequence: - dumptreer1(root,buf,indent,"Sequence",visible); - break; - case NC_Structure: - dumptreer1(root,buf,indent,"Structure",visible); - break; - case NC_Grid: - dumptreer1(root,buf,indent,"Grid",visible); - break; - case NC_Primitive: - switch (root->etype) { - case NC_BYTE: primtype = "byte"; break; - case NC_CHAR: primtype = "char"; break; - case NC_SHORT: primtype = "short"; break; - case NC_INT: primtype = "int"; break; - case NC_FLOAT: primtype = "float"; break; - case NC_DOUBLE: primtype = "double"; break; - case NC_UBYTE: primtype = "ubyte"; break; - case NC_USHORT: primtype = "ushort"; break; - case NC_UINT: primtype = "uint"; break; - case NC_INT64: primtype = "int64"; break; - case NC_UINT64: primtype = "uint64"; break; - case NC_STRING: primtype = "string"; break; - default: break; - } - dumpindent(indent,buf); - ncbytescat(buf,primtype); - ncbytescat(buf," "); - ncbytescat(buf,root->ncbasename); - break; - default: break; - } - - if(nclistlength(root->array.dimsetplus) > 0) dimset = root->array.dimsetplus; - else if(nclistlength(root->array.dimset0) > 0) dimset = root->array.dimset0; - if(dimset != NULL) { - for(i=0;incbasename != NULL) { - ncbytescat(buf,dim->ncbasename); - ncbytescat(buf,"="); - } - snprintf(tmp,sizeof(tmp),"%lu",(unsigned long)dim->dim.declsize); - ncbytescat(buf,tmp); - ncbytescat(buf,"]"); - } - } - ncbytescat(buf,";\n"); -} - -char* -dumptree(CDFnode* root) -{ - NCbytes* buf = ncbytesnew(); - char* result; - dumptreer(root,buf,0,0); - result = ncbytesdup(buf); - ncbytesfree(buf); - return result; -} - -char* -dumpvisible(CDFnode* root) -{ - NCbytes* buf = ncbytesnew(); - char* result; - dumptreer(root,buf,0,1); - result = ncbytesdup(buf); - ncbytesfree(buf); - return result; -} - -/* Provide detailed data on a CDFnode */ -char* -dumpnode(CDFnode* node) -{ - NCbytes* buf = ncbytesnew(); - char* result; - int i; - char* nctype = NULL; - char* primtype = NULL; - char tmp[1024]; - - switch (node->nctype) { - case NC_Dataset: nctype = "Dataset"; break; - case NC_Sequence: nctype = "Sequence"; break; - case NC_Structure: nctype = "Structure"; break; - case NC_Grid: nctype = "Grid"; break; - case NC_Primitive: - switch (node->etype) { - case NC_BYTE: primtype = "byte"; break; - case NC_CHAR: primtype = "char"; break; - case NC_SHORT: primtype = "short"; break; - case NC_INT: primtype = "int"; break; - case NC_FLOAT: primtype = "float"; break; - case NC_DOUBLE: primtype = "double"; break; - case NC_UBYTE: primtype = "ubyte"; break; - case NC_USHORT: primtype = "ushort"; break; - case NC_UINT: primtype = "uint"; break; - case NC_INT64: primtype = "int64"; break; - case NC_UINT64: primtype = "uint64"; break; - case NC_STRING: primtype = "string"; break; - default: break; - } - break; - default: break; - } - snprintf(tmp,sizeof(tmp),"%s %s {\n", - (nctype?nctype:primtype),node->ocname); - ncbytescat(buf,tmp); - snprintf(tmp,sizeof(tmp),"ocnode=%lx\n",(unsigned long)node->ocnode); - ncbytescat(buf,tmp); - snprintf(tmp,sizeof(tmp),"container=%s\n", - (node->container?node->container->ocname:"null")); - ncbytescat(buf,tmp); - snprintf(tmp,sizeof(tmp),"root=%s\n", - (node->root?node->root->ocname:"null")); - ncbytescat(buf,tmp); - snprintf(tmp,sizeof(tmp),"ncbasename=%s\n",node->ncbasename); - ncbytescat(buf,tmp); - snprintf(tmp,sizeof(tmp),"ncfullname=%s\n",node->ncfullname); - ncbytescat(buf,tmp); - snprintf(tmp,sizeof(tmp),"|subnodes|=%d\n",nclistlength(node->subnodes)); - ncbytescat(buf,tmp); - snprintf(tmp,sizeof(tmp),"externaltype=%d\n",node->externaltype); - ncbytescat(buf,tmp); - snprintf(tmp,sizeof(tmp),"ncid=%d\n",node->ncid); - ncbytescat(buf,tmp); - snprintf(tmp,sizeof(tmp),"maxstringlength=%ld\n",node->maxstringlength); - ncbytescat(buf,tmp); - snprintf(tmp,sizeof(tmp),"sequencelimit=%ld\n",node->sequencelimit); - ncbytescat(buf,tmp); - snprintf(tmp,sizeof(tmp),"usesequence=%d\n",node->usesequence); - ncbytescat(buf,tmp); - snprintf(tmp,sizeof(tmp),"elided=%d\n",node->elided); - ncbytescat(buf,tmp); - snprintf(tmp,sizeof(tmp),"visible=%d\n",node->visible); - ncbytescat(buf,tmp); - snprintf(tmp,sizeof(tmp),"attachment=%s\n", - (node->attachment?node->attachment->ocname:"null")); - ncbytescat(buf,tmp); - snprintf(tmp,sizeof(tmp),"rank=%u\n",nclistlength(node->array.dimset0)); - ncbytescat(buf,tmp); - for(i=0;iarray.dimset0);i++) { - CDFnode* dim = (CDFnode*)nclistget(node->array.dimset0,i); - snprintf(tmp,sizeof(tmp),"dims[%d]={\n",i); - ncbytescat(buf,tmp); - snprintf(tmp,sizeof(tmp)," ocname=%s\n",dim->ocname); - ncbytescat(buf,tmp); - snprintf(tmp,sizeof(tmp)," ncbasename=%s\n",dim->ncbasename); - ncbytescat(buf,tmp); - snprintf(tmp,sizeof(tmp)," dimflags=%u\n", - (unsigned int)dim->dim.dimflags); - ncbytescat(buf,tmp); - snprintf(tmp,sizeof(tmp)," declsize=%lu\n", - (unsigned long)dim->dim.declsize); - ncbytescat(buf,tmp); - snprintf(tmp,sizeof(tmp)," }\n"); - ncbytescat(buf,tmp); - } - - result = ncbytesdup(buf); - ncbytesfree(buf); - return result; -} - -char* -dumpalign(NCalignment* ncalign) -{ - char* result; - char tmp[1024]; - if(ncalign == NULL) - result = nulldup("NCalignment{size=-- alignment=-- offset=--}"); - else { - snprintf(tmp,sizeof(tmp),"NCalignment{size=%lu alignment=%lu offset=%lu}", - ncalign->size,ncalign->alignment,ncalign->offset); - result = nulldup(tmp); - } - return result; -} - -char* -dumpcachenode(NCcachenode* node) -{ - char* result = NULL; - char tmp[8192]; - int i; - NCbytes* buf; - - if(node == NULL) return strdup("cachenode{null}"); - buf = ncbytesnew(); - result = buildconstraintstring3(node->constraint); - snprintf(tmp,sizeof(tmp),"cachenode%s(%lx){size=%lu; constraint=%s; vars=", - node->prefetch?"*":"", - (unsigned long)node, - (unsigned long)node->xdrsize, - result); - ncbytescat(buf,tmp); - if(nclistlength(node->vars)==0) - ncbytescat(buf,"null"); - else for(i=0;ivars);i++) { - CDFnode* var = (CDFnode*)nclistget(node->vars,i); - if(i > 0) ncbytescat(buf,","); - ncbytescat(buf,makecdfpathstring3(var,".")); - } - ncbytescat(buf,"}"); - result = ncbytesdup(buf); - ncbytesfree(buf); - return result; -} - -char* -dumpcache(NCcache* cache) -{ - char* result = NULL; - char tmp[8192]; - int i; - NCbytes* buf; - - if(cache == NULL) return strdup("cache{null}"); - buf = ncbytesnew(); - snprintf(tmp,sizeof(tmp),"cache{limit=%lu; size=%lu;\n", - (unsigned long)cache->cachelimit, - (unsigned long)cache->cachesize); - ncbytescat(buf,tmp); - if(cache->prefetch) { - ncbytescat(buf,"\tprefetch="); - ncbytescat(buf,dumpcachenode(cache->prefetch)); - ncbytescat(buf,"\n"); - } - if(nclistlength(cache->nodes) > 0) { - for(i=0;inodes);i++) { - NCcachenode* node = (NCcachenode*)nclistget(cache->nodes,i); - ncbytescat(buf,"\t"); - ncbytescat(buf,dumpcachenode(node)); - ncbytescat(buf,"\n"); - } - } - ncbytescat(buf,"}"); - result = ncbytesdup(buf); - ncbytesfree(buf); - return result; -} - -/* This should be consistent with makeslicestring3 in constraints3.c */ -char* -dumpslice(DCEslice* slice) -{ - char buf[8192]; - char tmp[8192]; - size_t last = (slice->first+slice->length)-1; - buf[0] = '\0'; - if(last > slice->declsize && slice->declsize > 0) - last = slice->declsize - 1; - if(slice->count == 1) { - snprintf(tmp,sizeof(tmp),"[%lu]", - (unsigned long)slice->first); - } else if(slice->stride == 1) { - snprintf(tmp,sizeof(tmp),"[%lu:%lu]", - (unsigned long)slice->first, - (unsigned long)last); - } else { - snprintf(tmp,sizeof(tmp),"[%lu:%lu:%lu]", - (unsigned long)slice->first, - (unsigned long)slice->stride, - (unsigned long)last); - } - strcat(buf,tmp); - return strdup(tmp); -} - -char* -dumpslices(DCEslice* slice, unsigned int rank) -{ - int i; - NCbytes* buf; - char* result = NULL; - - buf = ncbytesnew(); - for(i=0;i -#include "xios.hpp" -#include "attribute_template.hpp" -#include "object_template.hpp" -#include "group_template.hpp" -#include "icutil.hpp" -#include "icdate.hpp" -#include "timer.hpp" -#include "node_type.hpp" - -extern "C" -{ - typedef xios::CExpandDomain* expand_domain_Ptr; - - void cxios_set_expand_domain_i_periodic(expand_domain_Ptr expand_domain_hdl, bool i_periodic) - { - CTimer::get("XIOS").resume(); - expand_domain_hdl->i_periodic.setValue(i_periodic); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_expand_domain_i_periodic(expand_domain_Ptr expand_domain_hdl, bool* i_periodic) - { - CTimer::get("XIOS").resume(); - *i_periodic = expand_domain_hdl->i_periodic.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_expand_domain_i_periodic(expand_domain_Ptr expand_domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = expand_domain_hdl->i_periodic.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_expand_domain_j_periodic(expand_domain_Ptr expand_domain_hdl, bool j_periodic) - { - CTimer::get("XIOS").resume(); - expand_domain_hdl->j_periodic.setValue(j_periodic); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_expand_domain_j_periodic(expand_domain_Ptr expand_domain_hdl, bool* j_periodic) - { - CTimer::get("XIOS").resume(); - *j_periodic = expand_domain_hdl->j_periodic.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_expand_domain_j_periodic(expand_domain_Ptr expand_domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = expand_domain_hdl->j_periodic.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_expand_domain_order(expand_domain_Ptr expand_domain_hdl, int order) - { - CTimer::get("XIOS").resume(); - expand_domain_hdl->order.setValue(order); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_expand_domain_order(expand_domain_Ptr expand_domain_hdl, int* order) - { - CTimer::get("XIOS").resume(); - *order = expand_domain_hdl->order.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_expand_domain_order(expand_domain_Ptr expand_domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = expand_domain_hdl->order.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_expand_domain_type(expand_domain_Ptr expand_domain_hdl, const char * type, int type_size) - { - std::string type_str; - if (!cstr2string(type, type_size, type_str)) return; - CTimer::get("XIOS").resume(); - expand_domain_hdl->type.fromString(type_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_expand_domain_type(expand_domain_Ptr expand_domain_hdl, char * type, int type_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(expand_domain_hdl->type.getInheritedStringValue(), type, type_size)) - ERROR("void cxios_get_expand_domain_type(expand_domain_Ptr expand_domain_hdl, char * type, int type_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_expand_domain_type(expand_domain_Ptr expand_domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = expand_domain_hdl->type.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } -} diff --git a/xios_2311_src/trunk/.svn/pristine/1d/1de3180d2a5f506b060c9830c54670a0a509c16f.svn-base b/xios_2311_src/trunk/.svn/pristine/1d/1de3180d2a5f506b060c9830c54670a0a509c16f.svn-base deleted file mode 100644 index 527515817b65e2538fc635a438ad7af5e35fe4de..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/1d/1de3180d2a5f506b060c9830c54670a0a509c16f.svn-base +++ /dev/null @@ -1,66 +0,0 @@ -/* ************************************************************************** * - * Interface auto generated - do not modify * - * ************************************************************************** */ - -#include -#include "xios.hpp" -#include "attribute_template.hpp" -#include "object_template.hpp" -#include "group_template.hpp" -#include "icutil.hpp" -#include "icdate.hpp" -#include "timer.hpp" -#include "node_type.hpp" - -extern "C" -{ - typedef xios::CReduceDomainToScalar* reduce_domain_to_scalar_Ptr; - - void cxios_set_reduce_domain_to_scalar_local(reduce_domain_to_scalar_Ptr reduce_domain_to_scalar_hdl, bool local) - { - CTimer::get("XIOS").resume(); - reduce_domain_to_scalar_hdl->local.setValue(local); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_reduce_domain_to_scalar_local(reduce_domain_to_scalar_Ptr reduce_domain_to_scalar_hdl, bool* local) - { - CTimer::get("XIOS").resume(); - *local = reduce_domain_to_scalar_hdl->local.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_reduce_domain_to_scalar_local(reduce_domain_to_scalar_Ptr reduce_domain_to_scalar_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = reduce_domain_to_scalar_hdl->local.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_reduce_domain_to_scalar_operation(reduce_domain_to_scalar_Ptr reduce_domain_to_scalar_hdl, const char * operation, int operation_size) - { - std::string operation_str; - if (!cstr2string(operation, operation_size, operation_str)) return; - CTimer::get("XIOS").resume(); - reduce_domain_to_scalar_hdl->operation.fromString(operation_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_reduce_domain_to_scalar_operation(reduce_domain_to_scalar_Ptr reduce_domain_to_scalar_hdl, char * operation, int operation_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(reduce_domain_to_scalar_hdl->operation.getInheritedStringValue(), operation, operation_size)) - ERROR("void cxios_get_reduce_domain_to_scalar_operation(reduce_domain_to_scalar_Ptr reduce_domain_to_scalar_hdl, char * operation, int operation_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_reduce_domain_to_scalar_operation(reduce_domain_to_scalar_Ptr reduce_domain_to_scalar_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = reduce_domain_to_scalar_hdl->operation.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } -} diff --git a/xios_2311_src/trunk/.svn/pristine/1e/1e579f694be239156ed224769276f5f9944c3547.svn-base b/xios_2311_src/trunk/.svn/pristine/1e/1e579f694be239156ed224769276f5f9944c3547.svn-base deleted file mode 100644 index 739346c01db1f67b6ea14b1ceb4fdb74f8d3f252..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/1e/1e579f694be239156ed224769276f5f9944c3547.svn-base +++ /dev/null @@ -1,47 +0,0 @@ -/*! - \file average.hpp - \author Ha NGUYEN - \since 8 Sep 2016 - \date 8 Sep 2016 - - \brief Average reduction - */ -#ifndef __XIOS_REDUCTION_AVERAGE_ALGORITHM_HPP__ -#define __XIOS_REDUCTION_AVERAGE_ALGORITHM_HPP__ - -#include "reduction.hpp" - -namespace xios { - -/*! - \class CAverageReductionAlgorithm - Interface for all reduction alogrithms. -*/ -class CAverageReductionAlgorithm : public CReductionAlgorithm -{ -public: - CAverageReductionAlgorithm(); - - virtual void apply(const std::vector >& localIndex, - const double* dataInput, - CArray& dataOut, - std::vector& flagInitial, - bool ignoreMissingValue, bool firstPass); - - virtual void updateData(CArray& dataOut); - - virtual ~CAverageReductionAlgorithm() {} - -protected: - CArray weights_; - bool resetWeight_; - -public: - static bool registerTrans(); - -protected: - static CReductionAlgorithm* create(); -}; - -} -#endif // __XIOS_REDUCTION_AVERAGE_ALGORITHM_HPP__ diff --git a/xios_2311_src/trunk/.svn/pristine/1e/1edd09149a34cb20cbd970c55f041189a01c86c4.svn-base b/xios_2311_src/trunk/.svn/pristine/1e/1edd09149a34cb20cbd970c55f041189a01c86c4.svn-base deleted file mode 100644 index ef049c8a687a43272f3d8c4b6c8f2aa9a5dd7601..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/1e/1edd09149a34cb20cbd970c55f041189a01c86c4.svn-base +++ /dev/null @@ -1,24 +0,0 @@ -################################################################################ -################### Projet XIOS ################### -################################################################################ - -%CCOMPILER mpCC_r -%FCOMPILER mpxlf2003_r -%LINKER mpCC_r - -%BASE_CFLAGS -qmkshrobj -qrtti -%PROD_CFLAGS -O3 -DBOOST_DISABLE_ASSERTS -%DEV_CFLAGS -g -%DEBUG_CFLAGS -g -O0 -qfullpath - -%BASE_FFLAGS -qmkshrobj -%PROD_FFLAGS -O3 -%DEV_FFLAGS -g -%DEBUG_FFLAGS -g -O0 -qfullpath - -%BASE_INC -D__NONE__ -%BASE_LD -lxlf90 - -%CPP cpp -%FPP cpp -P -%MAKE gmake diff --git a/xios_2311_src/trunk/.svn/pristine/1f/1f1b12da0b1635c2ad2e86ff0e3dcbd7ec180cac.svn-base b/xios_2311_src/trunk/.svn/pristine/1f/1f1b12da0b1635c2ad2e86ff0e3dcbd7ec180cac.svn-base deleted file mode 100644 index 90aa6b0ebb5adcd9b10431830570bf2df916db3a..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/1f/1f1b12da0b1635c2ad2e86ff0e3dcbd7ec180cac.svn-base +++ /dev/null @@ -1,100 +0,0 @@ -#ifndef __BUFFER_OUT_IMPL_HPP__ -#define __BUFFER_OUT_IMPL_HPP__ - -namespace xios -{ - -// template spectialisation : CBufferIn::put - template <> bool CBufferOut::put(const char& data) { return put_template(data) ; } - template <> bool CBufferOut::put(const bool& data) { return put_template(data) ; } - template <> bool CBufferOut::put(const int& data) { return put_template(data) ; } - template <> bool CBufferOut::put(const short& data) { return put_template(data) ; } - template <> bool CBufferOut::put(const long& data) { return put_template(data) ; } - template <> bool CBufferOut::put(const longlong& data) { return put_template(data) ; } - template <> bool CBufferOut::put(const uint& data) { return put_template(data) ; } - template <> bool CBufferOut::put(const ushort& data) { return put_template(data) ; } - template <> bool CBufferOut::put(const ulong& data) { return put_template(data) ; } - template <> bool CBufferOut::put(const ulonglong& data) { return put_template(data) ; } - template <> bool CBufferOut::put(const float& data) { return put_template(data) ; } - template <> bool CBufferOut::put(const double& data) { return put_template(data) ; } - template <> bool CBufferOut::put(const long double& data) { return put_template(data) ;} - - template <> bool CBufferOut::put(const char* data, size_t n) { return put_template(data,n) ; } - template <> bool CBufferOut::put(const bool* data, size_t n) { return put_template(data,n) ; } - template <> bool CBufferOut::put(const int* data, size_t n) { return put_template(data,n) ; } - template <> bool CBufferOut::put(const short* data, size_t n) { return put_template(data,n) ; } - template <> bool CBufferOut::put(const long* data, size_t n) { return put_template(data,n) ; } - template <> bool CBufferOut::put(const longlong* data, size_t n) { return put_template(data,n) ; } - template <> bool CBufferOut::put(const uint* data, size_t n) { return put_template(data,n) ; } - template <> bool CBufferOut::put(const ushort* data, size_t n) { return put_template(data,n) ; } - template <> bool CBufferOut::put(const ulong* data, size_t n) { return put_template(data,n) ; } - template <> bool CBufferOut::put(const ulonglong* data, size_t n) { return put_template(data,n) ; } - template <> bool CBufferOut::put(const float* data, size_t n) { return put_template(data,n) ; } - template <> bool CBufferOut::put(const double* data, size_t n) { return put_template(data,n) ; } - template <> bool CBufferOut::put(const long double* data, size_t n) { return put_template(data,n) ;} - - - template <> bool CBufferOut::advance(size_t n) { return advance_template(n) ; } - template <> bool CBufferOut::advance(size_t n) { return advance_template(n) ; } - template <> bool CBufferOut::advance(size_t n) { return advance_template(n) ; } - template <> bool CBufferOut::advance(size_t n) { return advance_template(n) ; } - template <> bool CBufferOut::advance(size_t n) { return advance_template(n) ; } - template <> bool CBufferOut::advance(size_t n) { return advance_template(n) ; } - template <> bool CBufferOut::advance(size_t n) { return advance_template(n) ; } - template <> bool CBufferOut::advance(size_t n) { return advance_template(n) ; } - template <> bool CBufferOut::advance(size_t n) { return advance_template(n) ; } - template <> bool CBufferOut::advance(size_t n) { return advance_template(n) ; } - template <> bool CBufferOut::advance(size_t n) { return advance_template(n) ; } - template <> bool CBufferOut::advance(size_t n) { return advance_template(n) ; } - template <> bool CBufferOut::advance(size_t n) { return advance_template(n) ;} - - template - bool CBufferOut::put_template(const T& data) - { - return put_template(&data,1); - } - - template - bool CBufferOut::put_template(const T* data, size_t n) - { - bool ret; - char* dataBuff ; - - size_t dataSize=sizeof(T)*n ; - - if (count_+dataSize<=size_) - { - dataBuff=(char*) data ; - for(size_t i=0;i - bool CBufferOut::advance_template(size_t n) - { - bool ret; - char* dataBuff ; - - size_t dataSize=sizeof(T)*n ; - - if (count_+dataSize<=size_) - { - current+=dataSize ; - count_+=dataSize; - ret=true ; - } - else ret=false ; - - return ret ; - } - -} - - -#endif diff --git a/xios_2311_src/trunk/.svn/pristine/1f/1f8585c58f8663eea10b1b022efc28e4b62e6560.svn-base b/xios_2311_src/trunk/.svn/pristine/1f/1f8585c58f8663eea10b1b022efc28e4b62e6560.svn-base deleted file mode 100644 index fc522ecd64f0d47b08210b4c0ff1962f1896a24b..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/1f/1f8585c58f8663eea10b1b022efc28e4b62e6560.svn-base +++ /dev/null @@ -1,15 +0,0 @@ -NETCDF_INCDIR="-I $NETCDF_INC_DIR" -NETCDF_LIBDIR="-L $NETCDF_LIB_DIR" -NETCDF_LIB="-lnetcdff -lnetcdf" - -MPI_INCDIR="" -MPI_LIBDIR="" -MPI_LIB="" - -HDF5_INCDIR="-I $HDF5_INC_DIR" -HDF5_LIBDIR="-L $HDF5_LIB_DIR" -HDF5_LIB="-lhdf5_hl -lhdf5 -lhdf5 -lz -lcurl" - -OASIS_INCDIR="-I$PWD/../../oasis3-mct/BLD/build/lib/psmile.MPI1" -OASIS_LIBDIR="-L$PWD/../../oasis3-mct/BLD/lib" -OASIS_LIB="-lpsmile.MPI1 -lscrip -lmct -lmpeu" diff --git a/xios_2311_src/trunk/.svn/pristine/1f/1f8f88a7d290d0c5fb81a61dcb6179164ba3ee93.svn-base b/xios_2311_src/trunk/.svn/pristine/1f/1f8f88a7d290d0c5fb81a61dcb6179164ba3ee93.svn-base deleted file mode 100644 index 0f214048045ca4bb269781b18a4b7d103ad86b9f..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/1f/1f8f88a7d290d0c5fb81a61dcb6179164ba3ee93.svn-base +++ /dev/null @@ -1,40 +0,0 @@ -#include "group_template_impl.hpp" -#include "node_type.hpp" - -namespace xios -{ -# define macro(T) \ - template class CGroupTemplate ; - - macro(Context) - macro(Field) - macro(File) - macro(CouplerIn) - macro(CouplerOut) - macro(Domain) - macro(Grid) - macro(Axis) - macro(Variable) - macro(InverseAxis) - macro(ZoomAxis) - macro(InterpolateAxis) - macro(ExtractAxis) - macro(ZoomDomain) - macro(InterpolateDomain) - macro(GenerateRectilinearDomain) - macro(Scalar) - macro(ReduceAxisToScalar) - macro(ReduceDomainToAxis) - macro(ReduceAxisToAxis) - macro(ExtractDomainToAxis) - macro(ComputeConnectivityDomain) - macro(ExpandDomain) - macro(ExtractAxisToScalar) - macro(ReduceDomainToScalar) - macro(TemporalSplitting) - macro(DuplicateScalarToAxis) - macro(ReduceScalarToScalar) - macro(ReorderDomain) - macro(ExtractDomain) - -} diff --git a/xios_2311_src/trunk/.svn/pristine/1f/1f94d295dfed7373ce0dceda8883f51714600cd6.svn-base b/xios_2311_src/trunk/.svn/pristine/1f/1f94d295dfed7373ce0dceda8883f51714600cd6.svn-base deleted file mode 100644 index c5b8fc6f60230948c6538d537bb674f4e6a0cde3..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/1f/1f94d295dfed7373ce0dceda8883f51714600cd6.svn-base +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef __XIOS_ATTRIBUTE_ARRAY__ -#define __XIOS_ATTRIBUTE_ARRAY__ - -/// XIOS headers /// -#include "xios_spl.hpp" -#include "exception.hpp" -#include "attribute.hpp" -#include "buffer_in.hpp" -#include "buffer_out.hpp" -#include "array_new.hpp" - -namespace xios -{ - /// ////////////////////// Déclarations ////////////////////// /// - /*! - \class CAttributeArray - This class implements the attribute representing array of value - */ - template - class CAttributeArray : public CAttribute, public CArray - { - public : - using CArray::operator = ; - - /// Constructeurs /// - explicit CAttributeArray(const StdString & id); - CAttributeArray(const StdString & id, xios_map & umap); - CAttributeArray(const StdString & id, const CArray& value); - CAttributeArray(const StdString & id, const CArray& value, - xios_map & umap); - - /// Accesseur /// - CArray getValue(void) const; - - /// Mutateurs /// - void setValue(const CArray& value); - void set(const CAttribute& attr) ; - void set(const CAttributeArray& attr) ; - void reset(void) ; - void setInheritedValue(const CAttributeArray& attr ); - void setInheritedValue(const CAttribute& attr ); - CArray getInheritedValue(void) const ; - bool hasInheritedValue(void) const; - - bool isEqual(const CAttribute& attr); - - /// Destructeur /// - virtual ~CAttributeArray(void) { } - - - /// Autre /// - virtual string toString(void) const { return _toString();} - virtual void fromString(const StdString & str) { if (str==resetInheritanceStr) { reset(); _canInherite=false ;} else _fromString(str);} - virtual bool toBuffer (CBufferOut& buffer) const { return _toBuffer(buffer);} - virtual bool fromBuffer(CBufferIn& buffer) { return _fromBuffer(buffer); } - virtual string dump(void) const { return _dump();} - virtual string dumpGraph(void) const { return _dumpGraph();} - - virtual void generateCInterface(ostream& oss,const string& className) ; - virtual void generateFortran2003Interface(ostream& oss,const string& className) ; - virtual void generateFortranInterfaceDeclaration_(ostream& oss,const string& className) ; - virtual void generateFortranInterfaceBody_(ostream& oss,const string& className) ; - virtual void generateFortranInterfaceDeclaration(ostream& oss,const string& className) ; - virtual void generateFortranInterfaceGetDeclaration_(ostream& oss,const string& className) ; - virtual void generateFortranInterfaceGetBody_(ostream& oss,const string& className) ; - virtual void generateFortranInterfaceGetDeclaration(ostream& oss,const string& className) ; - - private : - bool isEqual_(const CAttributeArray& attr); - CArray inheritedValue ; - StdString _toString(void) const; - StdString _dump(void) const; - StdString _dumpGraph(void) const; - void _fromString(const StdString & str); - bool _toBuffer (CBufferOut& buffer) const; - bool _fromBuffer(CBufferIn& buffer) ; - }; // class CAttributeEnum - - -} // namespace xios - -#endif // __XIOS_ATTRIBUTE_ARRAY__ diff --git a/xios_2311_src/trunk/.svn/pristine/1f/1fe732e85dd99684aeb129d5b6a127e7e41b5d29.svn-base b/xios_2311_src/trunk/.svn/pristine/1f/1fe732e85dd99684aeb129d5b6a127e7e41b5d29.svn-base deleted file mode 100644 index fcc8df26b07f09b1d12fc9c8e8b161423ae45bdf..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/1f/1fe732e85dd99684aeb129d5b6a127e7e41b5d29.svn-base +++ /dev/null @@ -1,506 +0,0 @@ - -CeCILL FREE SOFTWARE LICENSE AGREEMENT - - - Notice - -This Agreement is a Free Software license agreement that is the result -of discussions between its authors in order to ensure compliance with -the two main principles guiding its drafting: - - * firstly, compliance with the principles governing the distribution - of Free Software: access to source code, broad rights granted to - users, - * secondly, the election of a governing law, French law, with which - it is conformant, both as regards the law of torts and - intellectual property law, and the protection that it offers to - both authors and holders of the economic rights over software. - -The authors of the CeCILL (for Ce[a] C[nrs] I[nria] L[ogiciel] L[ibre]) -license are: - -Commissariat à l'Energie Atomique - CEA, a public scientific, technical -and industrial research establishment, having its principal place of -business at 25 rue Leblanc, immeuble Le Ponant D, 75015 Paris, France. - -Centre National de la Recherche Scientifique - CNRS, a public scientific -and technological establishment, having its principal place of business -at 3 rue Michel-Ange, 75794 Paris cedex 16, France. - -Institut National de Recherche en Informatique et en Automatique - -INRIA, a public scientific and technological establishment, having its -principal place of business at Domaine de Voluceau, Rocquencourt, BP -105, 78153 Le Chesnay cedex, France. - - - Preamble - -The purpose of this Free Software license agreement is to grant users -the right to modify and redistribute the software governed by this -license within the framework of an open source distribution model. - -The exercising of these rights is conditional upon certain obligations -for users so as to preserve this status for all subsequent redistributions. - -In consideration of access to the source code and the rights to copy, -modify and redistribute granted by the license, users are provided only -with a limited warranty and the software's author, the holder of the -economic rights, and the successive licensors only have limited liability. - -In this respect, the risks associated with loading, using, modifying -and/or developing or reproducing the software by the user are brought to -the user's attention, given its Free Software status, which may make it -complicated to use, with the result that its use is reserved for -developers and experienced professionals having in-depth computer -knowledge. Users are therefore encouraged to load and test the -suitability of the software as regards their requirements in conditions -enabling the security of their systems and/or data to be ensured and, -more generally, to use and operate it in the same conditions of -security. This Agreement may be freely reproduced and published, -provided it is not altered, and that no provisions are either added or -removed herefrom. - -This Agreement may apply to any or all software for which the holder of -the economic rights decides to submit the use thereof to its provisions. - - - Article 1 - DEFINITIONS - -For the purpose of this Agreement, when the following expressions -commence with a capital letter, they shall have the following meaning: - -Agreement: means this license agreement, and its possible subsequent -versions and annexes. - -Software: means the software in its Object Code and/or Source Code form -and, where applicable, its documentation, "as is" when the Licensee -accepts the Agreement. - -Initial Software: means the Software in its Source Code and possibly its -Object Code form and, where applicable, its documentation, "as is" when -it is first distributed under the terms and conditions of the Agreement. - -Modified Software: means the Software modified by at least one -Contribution. - -Source Code: means all the Software's instructions and program lines to -which access is required so as to modify the Software. - -Object Code: means the binary files originating from the compilation of -the Source Code. - -Holder: means the holder(s) of the economic rights over the Initial -Software. - -Licensee: means the Software user(s) having accepted the Agreement. - -Contributor: means a Licensee having made at least one Contribution. - -Licensor: means the Holder, or any other individual or legal entity, who -distributes the Software under the Agreement. - -Contribution: means any or all modifications, corrections, translations, -adaptations and/or new functions integrated into the Software by any or -all Contributors, as well as any or all Internal Modules. - -Module: means a set of sources files including their documentation that -enables supplementary functions or services in addition to those offered -by the Software. - -External Module: means any or all Modules, not derived from the -Software, so that this Module and the Software run in separate address -spaces, with one calling the other when they are run. - -Internal Module: means any or all Module, connected to the Software so -that they both execute in the same address space. - -GNU GPL: means the GNU General Public License version 2 or any -subsequent version, as published by the Free Software Foundation Inc. - -Parties: mean both the Licensee and the Licensor. - -These expressions may be used both in singular and plural form. - - - Article 2 - PURPOSE - -The purpose of the Agreement is the grant by the Licensor to the -Licensee of a non-exclusive, transferable and worldwide license for the -Software as set forth in Article 5 hereinafter for the whole term of the -protection granted by the rights over said Software. - - - Article 3 - ACCEPTANCE - -3.1 The Licensee shall be deemed as having accepted the terms and -conditions of this Agreement upon the occurrence of the first of the -following events: - - * (i) loading the Software by any or all means, notably, by - downloading from a remote server, or by loading from a physical - medium; - * (ii) the first time the Licensee exercises any of the rights - granted hereunder. - -3.2 One copy of the Agreement, containing a notice relating to the -characteristics of the Software, to the limited warranty, and to the -fact that its use is restricted to experienced users has been provided -to the Licensee prior to its acceptance as set forth in Article 3.1 -hereinabove, and the Licensee hereby acknowledges that it has read and -understood it. - - - Article 4 - EFFECTIVE DATE AND TERM - - - 4.1 EFFECTIVE DATE - -The Agreement shall become effective on the date when it is accepted by -the Licensee as set forth in Article 3.1. - - - 4.2 TERM - -The Agreement shall remain in force for the entire legal term of -protection of the economic rights over the Software. - - - Article 5 - SCOPE OF RIGHTS GRANTED - -The Licensor hereby grants to the Licensee, who accepts, the following -rights over the Software for any or all use, and for the term of the -Agreement, on the basis of the terms and conditions set forth hereinafter. - -Besides, if the Licensor owns or comes to own one or more patents -protecting all or part of the functions of the Software or of its -components, the Licensor undertakes not to enforce the rights granted by -these patents against successive Licensees using, exploiting or -modifying the Software. If these patents are transferred, the Licensor -undertakes to have the transferees subscribe to the obligations set -forth in this paragraph. - - - 5.1 RIGHT OF USE - -The Licensee is authorized to use the Software, without any limitation -as to its fields of application, with it being hereinafter specified -that this comprises: - - 1. permanent or temporary reproduction of all or part of the Software - by any or all means and in any or all form. - - 2. loading, displaying, running, or storing the Software on any or - all medium. - - 3. entitlement to observe, study or test its operation so as to - determine the ideas and principles behind any or all constituent - elements of said Software. This shall apply when the Licensee - carries out any or all loading, displaying, running, transmission - or storage operation as regards the Software, that it is entitled - to carry out hereunder. - - - 5.2 ENTITLEMENT TO MAKE CONTRIBUTIONS - -The right to make Contributions includes the right to translate, adapt, -arrange, or make any or all modifications to the Software, and the right -to reproduce the resulting software. - -The Licensee is authorized to make any or all Contributions to the -Software provided that it includes an explicit notice that it is the -author of said Contribution and indicates the date of the creation thereof. - - - 5.3 RIGHT OF DISTRIBUTION - -In particular, the right of distribution includes the right to publish, -transmit and communicate the Software to the general public on any or -all medium, and by any or all means, and the right to market, either in -consideration of a fee, or free of charge, one or more copies of the -Software by any means. - -The Licensee is further authorized to distribute copies of the modified -or unmodified Software to third parties according to the terms and -conditions set forth hereinafter. - - - 5.3.1 DISTRIBUTION OF SOFTWARE WITHOUT MODIFICATION - -The Licensee is authorized to distribute true copies of the Software in -Source Code or Object Code form, provided that said distribution -complies with all the provisions of the Agreement and is accompanied by: - - 1. a copy of the Agreement, - - 2. a notice relating to the limitation of both the Licensor's - warranty and liability as set forth in Articles 8 and 9, - -and that, in the event that only the Object Code of the Software is -redistributed, the Licensee allows future Licensees unhindered access to -the full Source Code of the Software by indicating how to access it, it -being understood that the additional cost of acquiring the Source Code -shall not exceed the cost of transferring the data. - - - 5.3.2 DISTRIBUTION OF MODIFIED SOFTWARE - -When the Licensee makes a Contribution to the Software, the terms and -conditions for the distribution of the resulting Modified Software -become subject to all the provisions of this Agreement. - -The Licensee is authorized to distribute the Modified Software, in -source code or object code form, provided that said distribution -complies with all the provisions of the Agreement and is accompanied by: - - 1. a copy of the Agreement, - - 2. a notice relating to the limitation of both the Licensor's - warranty and liability as set forth in Articles 8 and 9, - -and that, in the event that only the object code of the Modified -Software is redistributed, the Licensee allows future Licensees -unhindered access to the full source code of the Modified Software by -indicating how to access it, it being understood that the additional -cost of acquiring the source code shall not exceed the cost of -transferring the data. - - - 5.3.3 DISTRIBUTION OF EXTERNAL MODULES - -When the Licensee has developed an External Module, the terms and -conditions of this Agreement do not apply to said External Module, that -may be distributed under a separate license agreement. - - - 5.3.4 COMPATIBILITY WITH THE GNU GPL - -The Licensee can include a code that is subject to the provisions of one -of the versions of the GNU GPL in the Modified or unmodified Software, -and distribute that entire code under the terms of the same version of -the GNU GPL. - -The Licensee can include the Modified or unmodified Software in a code -that is subject to the provisions of one of the versions of the GNU GPL, -and distribute that entire code under the terms of the same version of -the GNU GPL. - - - Article 6 - INTELLECTUAL PROPERTY - - - 6.1 OVER THE INITIAL SOFTWARE - -The Holder owns the economic rights over the Initial Software. Any or -all use of the Initial Software is subject to compliance with the terms -and conditions under which the Holder has elected to distribute its work -and no one shall be entitled to modify the terms and conditions for the -distribution of said Initial Software. - -The Holder undertakes that the Initial Software will remain ruled at -least by this Agreement, for the duration set forth in Article 4.2. - - - 6.2 OVER THE CONTRIBUTIONS - -The Licensee who develops a Contribution is the owner of the -intellectual property rights over this Contribution as defined by -applicable law. - - - 6.3 OVER THE EXTERNAL MODULES - -The Licensee who develops an External Module is the owner of the -intellectual property rights over this External Module as defined by -applicable law and is free to choose the type of agreement that shall -govern its distribution. - - - 6.4 JOINT PROVISIONS - -The Licensee expressly undertakes: - - 1. not to remove, or modify, in any manner, the intellectual property - notices attached to the Software; - - 2. to reproduce said notices, in an identical manner, in the copies - of the Software modified or not. - -The Licensee undertakes not to directly or indirectly infringe the -intellectual property rights of the Holder and/or Contributors on the -Software and to take, where applicable, vis-à-vis its staff, any and all -measures required to ensure respect of said intellectual property rights -of the Holder and/or Contributors. - - - Article 7 - RELATED SERVICES - -7.1 Under no circumstances shall the Agreement oblige the Licensor to -provide technical assistance or maintenance services for the Software. - -However, the Licensor is entitled to offer this type of services. The -terms and conditions of such technical assistance, and/or such -maintenance, shall be set forth in a separate instrument. Only the -Licensor offering said maintenance and/or technical assistance services -shall incur liability therefor. - -7.2 Similarly, any Licensor is entitled to offer to its licensees, under -its sole responsibility, a warranty, that shall only be binding upon -itself, for the redistribution of the Software and/or the Modified -Software, under terms and conditions that it is free to decide. Said -warranty, and the financial terms and conditions of its application, -shall be subject of a separate instrument executed between the Licensor -and the Licensee. - - - Article 8 - LIABILITY - -8.1 Subject to the provisions of Article 8.2, the Licensee shall be -entitled to claim compensation for any direct loss it may have suffered -from the Software as a result of a fault on the part of the relevant -Licensor, subject to providing evidence thereof. - -8.2 The Licensor's liability is limited to the commitments made under -this Agreement and shall not be incurred as a result of in particular: -(i) loss due the Licensee's total or partial failure to fulfill its -obligations, (ii) direct or consequential loss that is suffered by the -Licensee due to the use or performance of the Software, and (iii) more -generally, any consequential loss. In particular the Parties expressly -agree that any or all pecuniary or business loss (i.e. loss of data, -loss of profits, operating loss, loss of customers or orders, -opportunity cost, any disturbance to business activities) or any or all -legal proceedings instituted against the Licensee by a third party, -shall constitute consequential loss and shall not provide entitlement to -any or all compensation from the Licensor. - - - Article 9 - WARRANTY - -9.1 The Licensee acknowledges that the scientific and technical -state-of-the-art when the Software was distributed did not enable all -possible uses to be tested and verified, nor for the presence of -possible defects to be detected. In this respect, the Licensee's -attention has been drawn to the risks associated with loading, using, -modifying and/or developing and reproducing the Software which are -reserved for experienced users. - -The Licensee shall be responsible for verifying, by any or all means, -the suitability of the product for its requirements, its good working -order, and for ensuring that it shall not cause damage to either persons -or properties. - -9.2 The Licensor hereby represents, in good faith, that it is entitled -to grant all the rights over the Software (including in particular the -rights set forth in Article 5). - -9.3 The Licensee acknowledges that the Software is supplied "as is" by -the Licensor without any other express or tacit warranty, other than -that provided for in Article 9.2 and, in particular, without any warranty -as to its commercial value, its secured, safe, innovative or relevant -nature. - -Specifically, the Licensor does not warrant that the Software is free -from any error, that it will operate without interruption, that it will -be compatible with the Licensee's own equipment and software -configuration, nor that it will meet the Licensee's requirements. - -9.4 The Licensor does not either expressly or tacitly warrant that the -Software does not infringe any third party intellectual property right -relating to a patent, software or any other property right. Therefore, -the Licensor disclaims any and all liability towards the Licensee -arising out of any or all proceedings for infringement that may be -instituted in respect of the use, modification and redistribution of the -Software. Nevertheless, should such proceedings be instituted against -the Licensee, the Licensor shall provide it with technical and legal -assistance for its defense. Such technical and legal assistance shall be -decided on a case-by-case basis between the relevant Licensor and the -Licensee pursuant to a memorandum of understanding. The Licensor -disclaims any and all liability as regards the Licensee's use of the -name of the Software. No warranty is given as regards the existence of -prior rights over the name of the Software or as regards the existence -of a trademark. - - - Article 10 - TERMINATION - -10.1 In the event of a breach by the Licensee of its obligations -hereunder, the Licensor may automatically terminate this Agreement -thirty (30) days after notice has been sent to the Licensee and has -remained ineffective. - -10.2 A Licensee whose Agreement is terminated shall no longer be -authorized to use, modify or distribute the Software. However, any -licenses that it may have granted prior to termination of the Agreement -shall remain valid subject to their having been granted in compliance -with the terms and conditions hereof. - - - Article 11 - MISCELLANEOUS - - - 11.1 EXCUSABLE EVENTS - -Neither Party shall be liable for any or all delay, or failure to -perform the Agreement, that may be attributable to an event of force -majeure, an act of God or an outside cause, such as defective -functioning or interruptions of the electricity or telecommunications -networks, network paralysis following a virus attack, intervention by -government authorities, natural disasters, water damage, earthquakes, -fire, explosions, strikes and labor unrest, war, etc. - -11.2 Any failure by either Party, on one or more occasions, to invoke -one or more of the provisions hereof, shall under no circumstances be -interpreted as being a waiver by the interested Party of its right to -invoke said provision(s) subsequently. - -11.3 The Agreement cancels and replaces any or all previous agreements, -whether written or oral, between the Parties and having the same -purpose, and constitutes the entirety of the agreement between said -Parties concerning said purpose. No supplement or modification to the -terms and conditions hereof shall be effective as between the Parties -unless it is made in writing and signed by their duly authorized -representatives. - -11.4 In the event that one or more of the provisions hereof were to -conflict with a current or future applicable act or legislative text, -said act or legislative text shall prevail, and the Parties shall make -the necessary amendments so as to comply with said act or legislative -text. All other provisions shall remain effective. Similarly, invalidity -of a provision of the Agreement, for any reason whatsoever, shall not -cause the Agreement as a whole to be invalid. - - - 11.5 LANGUAGE - -The Agreement is drafted in both French and English and both versions -are deemed authentic. - - - Article 12 - NEW VERSIONS OF THE AGREEMENT - -12.1 Any person is authorized to duplicate and distribute copies of this -Agreement. - -12.2 So as to ensure coherence, the wording of this Agreement is -protected and may only be modified by the authors of the License, who -reserve the right to periodically publish updates or new versions of the -Agreement, each with a separate number. These subsequent versions may -address new issues encountered by Free Software. - -12.3 Any Software distributed under a given version of the Agreement may -only be subsequently distributed under the same version of the Agreement -or a subsequent version, subject to the provisions of Article 5.3.4. - - - Article 13 - GOVERNING LAW AND JURISDICTION - -13.1 The Agreement is governed by French law. The Parties agree to -endeavor to seek an amicable solution to any disagreements or disputes -that may arise during the performance of the Agreement. - -13.2 Failing an amicable solution within two (2) months as from their -occurrence, and unless emergency proceedings are necessary, the -disagreements or disputes shall be referred to the Paris Courts having -jurisdiction, by the more diligent Party. - - -Version 2.0 dated 2006-09-05. diff --git a/xios_2311_src/trunk/.svn/pristine/20/201e7d522adcb3f2ed985a2fd639a5cd17c9162d.svn-base b/xios_2311_src/trunk/.svn/pristine/20/201e7d522adcb3f2ed985a2fd639a5cd17c9162d.svn-base deleted file mode 100644 index 121c33e1c517475b180984be7515071e51a936cc..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/20/201e7d522adcb3f2ed985a2fd639a5cd17c9162d.svn-base +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - field_A_srf + 273.15 - - - field_A_srf + field_C_srf - - - - - - surf_att - 10 - 6.8 - 100.201 - - - - field_A_srf_K - @field_A_srf_K - - - - - @field_A_srf_max - file_6h - - - - - surf_att - 10 - 6.8 - 100.201 - - - - - - @field_A_srf_max - file_1d - - - - - - - - - - - - - - diff --git a/xios_2311_src/trunk/.svn/pristine/20/2098f2566e2d6ea26a8d6405ac03549db1e150f6.svn-base b/xios_2311_src/trunk/.svn/pristine/20/2098f2566e2d6ea26a8d6405ac03549db1e150f6.svn-base deleted file mode 100644 index fc0c88427047fa2af20f9c8602d97f2aa665b4dc..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/20/2098f2566e2d6ea26a8d6405ac03549db1e150f6.svn-base +++ /dev/null @@ -1,23 +0,0 @@ -MODULE AXISGROUP_INTERFACE - USE, INTRINSIC :: ISO_C_BINDING - - INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99 - - - SUBROUTINE cxios_axisgroup_handle_create(ret, idt, idt_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_axisgroup_handle_create - - SUBROUTINE cxios_axisgroup_valid_id(ret, idt, idt_size) BIND(C) - USE ISO_C_BINDING - LOGICAL (kind = C_BOOL) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_axisgroup_valid_id - - END INTERFACE - -END MODULE AXISGROUP_INTERFACE diff --git a/xios_2311_src/trunk/.svn/pristine/20/209c9508d3c4f9644073ddc8c49e11170d84fa2d.svn-base b/xios_2311_src/trunk/.svn/pristine/20/209c9508d3c4f9644073ddc8c49e11170d84fa2d.svn-base deleted file mode 100644 index 8520b84a51256114b1d280612023b37803293a73..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/20/209c9508d3c4f9644073ddc8c49e11170d84fa2d.svn-base +++ /dev/null @@ -1,22 +0,0 @@ -MODULE GENERATE_RECTILINEAR_DOMAIN_INTERFACE - USE, INTRINSIC :: ISO_C_BINDING - - INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99 - - SUBROUTINE cxios_generate_rectilinear_domain_handle_create(ret, idt, idt_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_generate_rectilinear_domain_handle_create - - SUBROUTINE cxios_generate_rectilinear_domain_valid_id(ret, idt, idt_size) BIND(C) - USE ISO_C_BINDING - LOGICAL (kind = C_BOOL) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_generate_rectilinear_domain_valid_id - - END INTERFACE - -END MODULE GENERATE_RECTILINEAR_DOMAIN_INTERFACE diff --git a/xios_2311_src/trunk/.svn/pristine/20/20dc7ec3877460067789a56e7a60d25d3a1bd899.svn-base b/xios_2311_src/trunk/.svn/pristine/20/20dc7ec3877460067789a56e7a60d25d3a1bd899.svn-base deleted file mode 100644 index 4636a740da2998a243f5d61e58b716b61f329b54..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/20/20dc7ec3877460067789a56e7a60d25d3a1bd899.svn-base +++ /dev/null @@ -1,22 +0,0 @@ -MODULE GRIDGROUP_INTERFACE - USE, INTRINSIC :: ISO_C_BINDING - - INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99 - - SUBROUTINE cxios_gridgroup_handle_create(ret, idt, idt_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_gridgroup_handle_create - - SUBROUTINE cxios_gridgroup_valid_id(ret, idt, idt_size) BIND(C) - USE ISO_C_BINDING - LOGICAL (kind = C_BOOL) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_gridgroup_valid_id - - END INTERFACE - -END MODULE GRIDGROUP_INTERFACE diff --git a/xios_2311_src/trunk/.svn/pristine/20/20f18760ff4cccf41c2a0ff32a0f62b79e888ebb.svn-base b/xios_2311_src/trunk/.svn/pristine/20/20f18760ff4cccf41c2a0ff32a0f62b79e888ebb.svn-base deleted file mode 100644 index 4f068d9919fd490cfa2a8b90d8c2519551905ba9..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/20/20f18760ff4cccf41c2a0ff32a0f62b79e888ebb.svn-base +++ /dev/null @@ -1,1203 +0,0 @@ -#include "axis.hpp" - -#include "attribute_template.hpp" -#include "object_template.hpp" -#include "group_template.hpp" -#include "message.hpp" -#include "type.hpp" -#include "context.hpp" -#include "context_client.hpp" -#include "context_server.hpp" -#include "xios_spl.hpp" -#include "server_distribution_description.hpp" -#include "client_server_mapping_distributed.hpp" -#include "distribution_client.hpp" - -#include -#include - -namespace xios { - - /// ////////////////////// Definitions ////////////////////// /// - - CAxis::CAxis(void) - : CObjectTemplate() - , CAxisAttributes(), isChecked(false), relFiles() - , hasBounds(false), isCompressible_(false) - , transformationMap_(), hasValue(false), hasLabel(false) - , clients() - { - } - - CAxis::CAxis(const StdString & id) - : CObjectTemplate(id) - , CAxisAttributes(), isChecked(false), relFiles() - , hasBounds(false), isCompressible_(false) - , transformationMap_(), hasValue(false), hasLabel(false) - , clients() - { - } - - CAxis::~CAxis(void) - { /* Ne rien faire de plus */ } - - std::map CAxis::transformationMapList_ = std::map(); - bool CAxis::dummyTransformationMapList_ = CAxis::initializeTransformationMap(CAxis::transformationMapList_); - bool CAxis::initializeTransformationMap(std::map& m) - TRY - { - m["zoom_axis"] = TRANS_ZOOM_AXIS; - m["interpolate_axis"] = TRANS_INTERPOLATE_AXIS; - m["extract_axis"] = TRANS_EXTRACT_AXIS; - m["inverse_axis"] = TRANS_INVERSE_AXIS; - m["reduce_domain"] = TRANS_REDUCE_DOMAIN_TO_AXIS; - m["reduce_axis"] = TRANS_REDUCE_AXIS_TO_AXIS; - m["extract_domain"] = TRANS_EXTRACT_DOMAIN_TO_AXIS; - m["temporal_splitting"] = TRANS_TEMPORAL_SPLITTING; - m["duplicate_scalar"] = TRANS_DUPLICATE_SCALAR_TO_AXIS; - return true; - } - CATCH - - void CAxis::releaseStaticAllocation(void) - { - transformationMapList_.clear() ; - CTransformation::unregisterAllTransformations() ; - CGridTransformationFactory::unregisterAllTransformations() ; - } - - ///--------------------------------------------------------------- - - const std::set & CAxis::getRelFiles(void) const - TRY - { - return (this->relFiles); - } - CATCH - - bool CAxis::IsWritten(const StdString & filename) const - TRY - { - return (this->relFiles.find(filename) != this->relFiles.end()); - } - CATCH - - bool CAxis::isWrittenCompressed(const StdString& filename) const - TRY - { - return (this->relFilesCompressed.find(filename) != this->relFilesCompressed.end()); - } - CATCH - - bool CAxis::isDistributed(void) const - TRY - { - bool distributed = (!this->begin.isEmpty() && !this->n.isEmpty() && (this->begin + this->n < this->n_glo)) || - (!this->n.isEmpty() && (this->n != this->n_glo)); - // A condition to make sure that if there is only one client, axis - // should be considered to be distributed. This should be a temporary solution - distributed |= (1 == CContext::getCurrent()->intraCommSize_); - return distributed; - } - CATCH - - /*! - * Compute if the axis can be ouput in a compressed way. - * In this case the workflow view on server side must be the same - * than the full view for all context rank. The result is stored on - * internal isCompressible_ attribute. - */ - void CAxis::computeIsCompressible(void) - TRY - { - // mesh is compressible contains some masked or indexed value, ie if full view is different of workflow view. - // But now assume that the size of the 2 view must be equal for everybody. True on server side - int isSameView = getLocalView(CElementView::FULL)->getSize() == getLocalView(CElementView::WORKFLOW)->getSize(); - MPI_Allreduce(MPI_IN_PLACE, &isSameView, 1, MPI_INT, MPI_LAND, CContext::getCurrent()->getIntraComm()) ; - if (isSameView) isCompressible_ = false ; - else isCompressible_ = true ; - isCompressibleComputed_=true ; - } - CATCH - - void CAxis::addRelFile(const StdString & filename) - TRY - { - this->relFiles.insert(filename); - } - CATCH_DUMP_ATTR - - void CAxis::addRelFileCompressed(const StdString& filename) - TRY - { - this->relFilesCompressed.insert(filename); - } - CATCH_DUMP_ATTR - - //---------------------------------------------------------------- - - /*! - * Compute the minimum buffer size required to send the attributes to the server(s). - * - * \return A map associating the server rank with its minimum buffer size. - */ - std::map CAxis::getAttributesBufferSize(CContextClient* client, const std::vector& globalDim, int orderPositionInGrid, - CServerDistributionDescription::ServerDistributionType distType) - TRY - { - - std::map attributesSizes = getMinimumBufferSizeForAttributes(client); - -// bool isNonDistributed = (n_glo == n); - bool isDistributed = (orderPositionInGrid == CServerDistributionDescription::defaultDistributedDimension(globalDim.size(), distType)) - || (index.numElements() != n_glo); - - if (client->isServerLeader()) - { - // size estimation for sendServerAttribut - size_t size = 6 * sizeof(size_t); - // size estimation for sendNonDistributedValue - if (!isDistributed) - { -// size = std::max(size, CArray::size(n_glo) + (isCompressible_ ? CArray::size(n_glo) : 0)); - size += CArray::size(n_glo); - size += CArray::size(n_glo); - size += CArray::size(n_glo); - size += CArray::size(n_glo); - if (hasBounds) - size += CArray::size(2*n_glo); - if (hasLabel) - size += CArray::size(n_glo); - } - size += CEventClient::headerSize + getId().size() + sizeof(size_t); - - const std::list& ranks = client->getRanksServerLeader(); - for (std::list::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) - { - if (size > attributesSizes[*itRank]) - attributesSizes[*itRank] = size; - } - const std::list& ranksNonLeaders = client->getRanksServerNotLeader(); - for (std::list::const_iterator itRank = ranksNonLeaders.begin(), itRankEnd = ranksNonLeaders.end(); itRank != itRankEnd; ++itRank) - { - if (size > attributesSizes[*itRank]) - attributesSizes[*itRank] = size; - } - - } - - if (isDistributed) - { - // size estimation for sendDistributedValue - std::unordered_map >::const_iterator it, ite = indSrv_[client->serverSize].end(); - for (it = indSrv_[client->serverSize].begin(); it != ite; ++it) - { - size_t size = 6 * sizeof(size_t); - size += CArray::size(it->second.size()); - size += CArray::size(it->second.size()); - size += CArray::size(it->second.size()); - size += CArray::size(it->second.size()); - if (hasBounds) - size += CArray::size(2 * it->second.size()); - if (hasLabel) - size += CArray::size(it->second.size()); - - size += CEventClient::headerSize + getId().size() + sizeof(size_t); - if (size > attributesSizes[it->first]) - attributesSizes[it->first] = size; - } - } - return attributesSizes; - } - CATCH_DUMP_ATTR - - //---------------------------------------------------------------- - - StdString CAxis::GetName(void) { return (StdString("axis")); } - StdString CAxis::GetDefName(void){ return (CAxis::GetName()); } - ENodeType CAxis::GetType(void) { return (eAxis); } - - //---------------------------------------------------------------- - - CAxis* CAxis::createAxis() - TRY - { - CAxis* axis = CAxisGroup::get("axis_definition")->createChild(); - return axis; - } - CATCH - - CAxis* CAxis::get(const string& id, bool noError) - { - const regex r("::"); - smatch m; - if (regex_search(id, m, r)) - { - if (m.size()!=1) ERROR("CAxis* CAxis::get(string& id)", <<" id = "< bad format id, separator :: append more than one time"); - string fieldId=m.prefix() ; - if (fieldId.empty()) ERROR("CAxis* CAxis::get(string& id)", <<" id = "< bad format id, field name is empty"); - string suffix=m.suffix() ; - if (!CField::has(fieldId)) - if (noError) return nullptr ; - else ERROR("CAxis* CAxis::get(string& id, bool noError)", <<" id = "< field Id : < "< doesn't exist"); - CField* field=CField::get(fieldId) ; - return field->getAssociatedAxis(suffix, noError) ; - } - { - if (noError) if(!CObjectFactory::HasObject(id)) return nullptr ; - return CObjectFactory::GetObject(id).get(); - } - } - - bool CAxis::has(const string& id) - { - if (CAxis::get(id,true)==nullptr) return false ; - else return true ; - } - - CField* CAxis::getFieldFromId(const string& id) - { - const regex r("::"); - smatch m; - if (regex_search(id, m, r)) - { - if (m.size()!=1) ERROR("CField* CAxis::getFieldFromId(const string& id)", <<" id = "< bad format id, separator :: append more than one time"); - string fieldId=m.prefix() ; - if (fieldId.empty()) ERROR("CField* CAxis::getFieldFromId(const string& id)", <<" id = "< bad format id, field name is empty"); - string suffix=m.suffix() ; - CField* field=CField::get(fieldId) ; - return field ; - } - else return nullptr; - } - - /*! - Check common attributes of an axis. - This check should be done in the very beginning of work flow - */ - - void CAxis::checkAttributes(void) - { - if (checkAttributes_done_) return ; - checkGeometricAttributes(true) ; - initializeLocalElement() ; - addFullView() ; - addWorkflowView() ; - addModelView() ; - - checkAttributes_done_ = true ; - } - - void CAxis::resetGeometricAttributes(void) - { - n_glo.reset(); - index.reset(); - n.reset(); - begin.reset(); - mask.reset(); - data_index.reset(); - data_n.reset(); - data_begin.reset(); - value.reset(); - bounds.reset(); - label.reset() ; - } - - void CAxis::setGeometricAttributes(const CAxis& axisSrc) - { - resetGeometricAttributes() ; - n_glo=axisSrc.n_glo; - if (!axisSrc.index.isEmpty()) - { - index.resize(axisSrc.index.shape()) ; - index=axisSrc.index; - } - - n=axisSrc.n; - begin=axisSrc.begin; - if (!axisSrc.mask.isEmpty()) - { - mask.resize(axisSrc.mask.shape()) ; - mask=axisSrc.mask; - } - if (!axisSrc.data_index.isEmpty()) - { - data_index.resize(axisSrc.data_index.shape()) ; - data_index=axisSrc.data_index; - } - data_n=axisSrc.data_n; - data_begin=axisSrc.data_begin; - if (!axisSrc.value.isEmpty()) - { - value.resize(axisSrc.value.shape()) ; - value=axisSrc.value; - } - - if (!axisSrc.bounds.isEmpty()) - { - bounds.resize(axisSrc.bounds.shape()) ; - bounds=axisSrc.bounds; - } - if (!axisSrc.label.isEmpty()) - { - label.resize(axisSrc.label.shape()) ; - label=axisSrc.label; - } - - } - - bool CAxis::checkGeometricAttributes(bool generateError) - TRY - { - CContext* context=CContext::getCurrent(); - - if (this->n_glo.isEmpty()) - if (generateError) ERROR("CAxis::checkAttributes(void)", - << "[ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] " - << "The axis is wrongly defined, attribute 'n_glo' must be specified") - else return false ; - StdSize size = this->n_glo.getValue(); - - if (!this->index.isEmpty()) - { - if (n.isEmpty()) n = index.numElements(); - - // It's not so correct but if begin is not the first value of index - // then data on the local axis has user-defined distribution. In this case, begin has no meaning. - if (begin.isEmpty()) begin = index(0); - } - else - { - if (!this->begin.isEmpty()) - { - if (begin < 0 || begin > size - 1) - if (generateError) ERROR("CAxis::checkAttributes(void)", - << "[ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] " - << "The axis is wrongly defined, attribute 'begin' (" - << begin.getValue() << ") must be non-negative and smaller than size-1 (" << size - 1 << ").") - else return false ; - } - else this->begin.setValue(0); - - if (!this->n.isEmpty()) - { - if (n < 0 || n > size) - if (generateError) ERROR("CAxis::checkAttributes(void)", - << "[ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] " - << "The axis is wrongly defined, attribute 'n' (" << n.getValue() << ") must be non-negative and smaller than size (" - << size << ").") - else return false ; - } - else this->n.setValue(size); - - { - index.resize(n); - for (int i = 0; i < n; ++i) index(i) = i+begin; - } - } - - if (!this->value.isEmpty()) - { - StdSize true_size = value.numElements(); - if (this->n.getValue() != true_size) - if (generateError) ERROR("CAxis::checkAttributes(void)", - << "[ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] " - << "The axis is wrongly defined, attribute 'value' has a different size (" << true_size - << ") than the one defined by the \'size\' attribute (" << n.getValue() << ").") - else return false ; - this->hasValue = true; - } - - if (!this->checkBounds(generateError)) return false; - if (!this->checkMask(generateError)) return false; - if (!this->checkData(generateError)) return false; - if (!this->checkLabel(generateError)) return false; - - return true ; - } - CATCH_DUMP_ATTR - - - /*! - Check the validity of data, fill in values if any, and apply mask. - */ - bool CAxis::checkData(bool generateError) - TRY - { - if (data_begin.isEmpty()) data_begin.setValue(0); - - if (data_n.isEmpty()) - { - data_n.setValue(n); - } - else if (data_n.getValue() < 0) - { - if (generateError) ERROR("CAxis::checkData(void)", - << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " - << "The data size should be strictly positive ('data_n' = " << data_n.getValue() << ").") - else return false ; - } - - if (data_index.isEmpty()) - { - data_index.resize(data_n); - for (int i = 0; i < data_n; ++i) - { - if ((i+data_begin) >= 0 && (i+data_begin& globalDim, int orderPositionInGrid, const string& fieldId, int posInGrid) - { - if (sendAxisToCouplerOut_done_.count(client)!=0) return ; - else sendAxisToCouplerOut_done_.insert(client) ; - - string axisId="_axis["+std::to_string(posInGrid)+"]_of_"+fieldId ; - - } - - string CAxis::getCouplingAlias(const string& fieldId, int posInGrid) - { - return "_axis["+std::to_string(posInGrid)+"]_of_"+fieldId ; - } - - void CAxis::makeAliasForCoupling(const string& fieldId, int posInGrid) - { - const string axisId = getCouplingAlias(fieldId,posInGrid) ; - this->createAlias(axisId) ; - } - - - /*! - Compare two axis objects. - They are equal if only if they have identical attributes as well as their values. - Moreover, they must have the same transformations. - \param [in] axis Compared axis - \return result of the comparison - */ - bool CAxis::isEqual(CAxis* obj) - TRY - { - vector excludedAttr; - excludedAttr.push_back("axis_ref"); - - bool objEqual = SuperClass::isEqual(obj, excludedAttr); - if (!objEqual) return objEqual; - - TransMapTypes thisTrans = this->getAllTransformations(); - TransMapTypes objTrans = obj->getAllTransformations(); - - TransMapTypes::const_iterator it, itb, ite; - std::vector thisTransType, objTransType; - for (it = thisTrans.begin(); it != thisTrans.end(); ++it) - thisTransType.push_back(it->first); - for (it = objTrans.begin(); it != objTrans.end(); ++it) - objTransType.push_back(it->first); - - if (thisTransType.size() != objTransType.size()) return false; - for (int idx = 0; idx < thisTransType.size(); ++idx) - objEqual &= (thisTransType[idx] == objTransType[idx]); - - return objEqual; - } - CATCH_DUMP_ATTR - - /* - Add transformation into axis. This function only servers for Fortran interface - \param [in] transType transformation type - \param [in] id identifier of the transformation object - */ - CTransformation* CAxis::addTransformation(ETranformationType transType, const StdString& id) - TRY - { - transformationMap_.push_back(std::make_pair(transType, CTransformation::createTransformation(transType,id))); - return transformationMap_.back().second; - } - CATCH_DUMP_ATTR - - /* - Check whether an axis has (spatial) transformation - */ - bool CAxis::hasTransformation() - TRY - { - return (!transformationMap_.empty()); - } - CATCH_DUMP_ATTR - - /* - Set transformation - \param [in] axisTrans transformation to set - */ - void CAxis::setTransformations(const TransMapTypes& axisTrans) - TRY - { - transformationMap_ = axisTrans; - } - CATCH_DUMP_ATTR - - /* - Return all transformation held by the axis - \return transformation the axis has - */ - CAxis::TransMapTypes CAxis::getAllTransformations(void) - TRY - { - return transformationMap_; - } - CATCH_DUMP_ATTR - - /* - Duplicate transformation of another axis - \param [in] src axis whose transformations are copied - */ - void CAxis::duplicateTransformation(CAxis* src) - TRY - { - if (src->hasTransformation()) - { - this->setTransformations(src->getAllTransformations()); - } - } - CATCH_DUMP_ATTR - - /*! - * Go through the hierarchy to find the axis from which the transformations must be inherited - */ - void CAxis::solveInheritanceTransformation_old() - TRY - { - if (hasTransformation() || !hasDirectAxisReference()) - return; - - CAxis* axis = this; - std::vector refAxis; - while (!axis->hasTransformation() && axis->hasDirectAxisReference()) - { - refAxis.push_back(axis); - axis = axis->getDirectAxisReference(); - } - - if (axis->hasTransformation()) - for (size_t i = 0; i < refAxis.size(); ++i) - refAxis[i]->setTransformations(axis->getAllTransformations()); - } - CATCH_DUMP_ATTR - - void CAxis::solveInheritanceTransformation() - TRY - { - if (solveInheritanceTransformation_done_) return; - else solveInheritanceTransformation_done_=true ; - - CAxis* axis = this; - std::list refAxis; - bool out=false ; - vector excludedAttr; - excludedAttr.push_back("axis_ref"); - - refAxis.push_front(axis) ; - while (axis->hasDirectAxisReference() && !out) - { - CAxis* lastAxis=axis ; - axis = axis->getDirectAxisReference(); - axis->solveRefInheritance() ; - if (!axis->SuperClass::isEqual(lastAxis,excludedAttr)) out=true ; - refAxis.push_front(axis) ; - } - - CTransformationPaths::TPath path ; - auto& pathList = std::get<2>(path) ; - std::get<0>(path) = EElement::AXIS ; - std::get<1>(path) = refAxis.front()->getId() ; - for (auto& axis : refAxis) - { - CAxis::TransMapTypes transformations = axis->getAllTransformations(); - for(auto& transformation : transformations) pathList.push_back({transformation.second->getTransformationType(), - transformation.second->getId()}) ; - } - transformationPaths_.addPath(path) ; - - } - CATCH_DUMP_ATTR - - bool CAxis::activateFieldWorkflow(CGarbageCollector& gc) - TRY - { - if (!axis_ref.isEmpty()) - { - CField* field=getFieldFromId(axis_ref) ; - if (field!=nullptr) - { - bool ret = field->buildWorkflowGraph(gc) ; - if (!ret) return false ; // cannot build workflow graph at this state - } - else - { - CAxis* axis = get(axis_ref) ; - bool ret = axis->activateFieldWorkflow(gc) ; - if (!ret) return false ; // cannot build workflow graph at this state - axis_ref=axis->getId() ; // replace domain_ref by solved reference - } - } - activateFieldWorkflow_done_=true ; - return true ; - } - CATCH_DUMP_ATTR - - - void CAxis::setContextClient(CContextClient* contextClient) - TRY - { - if (clientsSet.find(contextClient)==clientsSet.end()) - { - clients.push_back(contextClient) ; - clientsSet.insert(contextClient); - } - } - CATCH_DUMP_ATTR - - void CAxis::parse(xml::CXMLNode & node) - TRY - { - SuperClass::parse(node); - - if (node.goToChildElement()) - { - StdString nodeElementName; - do - { - StdString nodeId(""); - if (node.getAttributes().end() != node.getAttributes().find("id")) - { nodeId = node.getAttributes()["id"]; } - - nodeElementName = node.getElementName(); - std::map::const_iterator ite = transformationMapList_.end(), it; - it = transformationMapList_.find(nodeElementName); - if (ite != it) - { - transformationMap_.push_back(std::make_pair(it->second, CTransformation::createTransformation(it->second, - nodeId, - &node))); - } - else - { - ERROR("void CAxis::parse(xml::CXMLNode & node)", - << "The transformation " << nodeElementName << " has not been supported yet."); - } - } while (node.goToNextElement()) ; - node.goToParentElement(); - } - } - CATCH_DUMP_ATTR - - - ////////////////////////////////////////////////////////////////////////////////////// - // this part is related to distribution, element definition, views and connectors // - ////////////////////////////////////////////////////////////////////////////////////// - - void CAxis::initializeLocalElement(void) - { - // after checkAttribute index of size n - int rank = CContext::getCurrent()->getIntraCommRank() ; - - CArray ind(n) ; - for (int i=0;i(rank, n_glo, ind) ; - } - - void CAxis::addFullView(void) - { - CArray index(n) ; - for(int i=0; i addView(CElementView::FULL, index) ; - } - - void CAxis::addWorkflowView(void) - { - // mask + data are included into data_index - int nk=data_index.numElements() ; - int nMask=0 ; - for(int k=0;k=0 && data_index(k) index(nMask) ; - nMask=0 ; - for(int k=0;k=0 && data_index(k) addView(CElementView::WORKFLOW, index) ; - } - - void CAxis::addModelView(void) - { - // information for model view is stored in data_index - localElement_->addView(CElementView::MODEL, data_index) ; - } - - void CAxis::computeModelToWorkflowConnector(void) - { - shared_ptr srcView=getLocalView(CElementView::MODEL) ; - shared_ptr dstView=getLocalView(CElementView::WORKFLOW) ; - modelToWorkflowConnector_ = make_shared(srcView, dstView); - modelToWorkflowConnector_->computeConnector() ; - } - - - void CAxis::computeRemoteElement(CContextClient* client, EDistributionType type) - { - CContext* context = CContext::getCurrent(); - map> globalIndex ; - - if (type==EDistributionType::BANDS) // Bands distribution to send to file server - { - int nbServer = client->serverSize; - int nbClient = client->clientSize ; - int rankClient = client->clientRank ; - int size = nbServer / nbClient ; - int start ; - if (nbServer%nbClient > rankClient) - { - start = (size+1) * rankClient ; - size++ ; - } - else start = size*rankClient + nbServer%nbClient ; - - for(int i=0; i rank) - { - indStart = (indSize+1) * rank ; - indSize++ ; - } - else indStart = indSize*rank + n_glo%nbServer ; - - auto& globalInd = globalIndex[rank] ; - globalInd.resize(indSize) ; - for(size_t n = 0 ; nserverSize; - size_t nglo=n_glo ; - CArray indGlo(nglo) ; - for(size_t i=0;igetRanksServerLeader()) globalIndex[rankServer].reference(indGlo.copy()); - } - remoteElement_[client] = make_shared(n_glo, globalIndex) ; - remoteElement_[client]->addFullView() ; - } - - void CAxis::distributeToServer(CContextClient* client, std::map>& globalIndexOut, std::map>& globalIndexIn, - shared_ptr &scattererConnector, const string& axisId) - { - string serverAxisId = axisId.empty() ? this->getId() : axisId ; - CContext* context = CContext::getCurrent(); - - this->sendAllAttributesToServer(client, serverAxisId) ; - - auto scatteredElement = make_shared(n_glo,globalIndexOut) ; - scatteredElement->addFullView() ; - scattererConnector = make_shared(localElement_->getView(CElementView::FULL), scatteredElement->getView(CElementView::FULL), - context->getIntraComm(), client->getRemoteSize()) ; - scattererConnector->computeConnector() ; - - // phase 0 - // send remote element to construct the full view on server, ie without hole - CEventClient event0(getType(), EVENT_ID_AXIS_DISTRIBUTION); - CMessage message0 ; - message0<sendToServer(client,event0,message0) ; - - // phase 1 - // send the full view of element to construct the connector which connect distributed data coming from client to the full local view - CEventClient event1(getType(), EVENT_ID_AXIS_DISTRIBUTION); - CMessage message1 ; - message1<getView(CElementView::FULL)->getGlobalSize() ; - scattererConnector->transfer(localElement_->getView(CElementView::FULL)->getGlobalIndex(),client,event1,message1) ; - - sendDistributedAttributes(client, scattererConnector, axisId) ; - - // phase 2 send the mask : data index + mask2D - { - CArray maskIn(localElement_->getView(CElementView::WORKFLOW)->getSize()); - CArray maskOut ; - auto workflowToFull = make_shared(localElement_->getView(CElementView::WORKFLOW), localElement_->getView(CElementView::FULL)) ; - workflowToFull->computeConnector() ; - maskIn=true ; - workflowToFull->transfer(maskIn,maskOut,false) ; - - // prepare grid scatterer connector to send data from client to server - map> workflowGlobalIndex ; - map> maskOut2 ; - scattererConnector->transfer(maskOut, maskOut2) ; - scatteredElement->addView(CElementView::WORKFLOW, maskOut2) ; - scatteredElement->getView(CElementView::WORKFLOW)->getGlobalIndexView(workflowGlobalIndex) ; - // create new workflow view for scattered element - auto clientToServerElement = make_shared(scatteredElement->getGlobalSize(), workflowGlobalIndex) ; - clientToServerElement->addFullView() ; - CEventClient event2(getType(), EVENT_ID_AXIS_DISTRIBUTION); - CMessage message2 ; - message2<sendToServer(client, event2, message2) ; - clientToServerConnector_[client] = make_shared(localElement_->getView(CElementView::WORKFLOW), clientToServerElement->getView(CElementView::FULL), - context->getIntraComm(), client->getRemoteSize()) ; - clientToServerConnector_[client]->computeConnector() ; - } - - //////////// - // phase 3 : compute connector to receive from server - //////////// - { - auto scatteredElement = make_shared(n_glo, globalIndexIn) ; - scatteredElement->addFullView() ; - auto scattererConnector = make_shared(localElement_->getView(CElementView::FULL), scatteredElement->getView(CElementView::FULL), - context->getIntraComm(), client->getRemoteSize()) ; - scattererConnector->computeConnector() ; - CArray maskIn(localElement_->getView(CElementView::WORKFLOW)->getSize()); - CArray maskOut ; - auto workflowToFull = make_shared(localElement_->getView(CElementView::WORKFLOW), localElement_->getView(CElementView::FULL)) ; - workflowToFull->computeConnector() ; - maskIn=true ; - workflowToFull->transfer(maskIn,maskOut,false) ; - - map> workflowGlobalIndex ; - map> maskOut2 ; - scattererConnector->transfer(maskOut, maskOut2, false) ; - scatteredElement->addView(CElementView::WORKFLOW, maskOut2) ; - scatteredElement->getView(CElementView::WORKFLOW)->getGlobalIndexView(workflowGlobalIndex) ; - auto clientToServerElement = make_shared(scatteredElement->getGlobalSize(), workflowGlobalIndex) ; - clientToServerElement->addFullView() ; - CEventClient event3(getType(), EVENT_ID_AXIS_DISTRIBUTION); - CMessage message3 ; - message3<sendToServer(client, event3, message3) ; - - clientFromServerConnector_[client] = make_shared(clientToServerElement->getView(CElementView::FULL), localElement_->getView(CElementView::WORKFLOW)); - clientFromServerConnector_[client]->computeConnector() ; - } - -// clientFromServerConnector_[client] = make_shared(clientToServerElement->getView(CElementView::FULL), localElement_->getView(CElementView::WORKFLOW)); -// clientFromServerConnector_[client]->computeConnector() ; - - - } - - void CAxis::recvAxisDistribution(CEventServer& event) - TRY - { - string axisId; - int phasis ; - for (auto& subEvent : event.subEvents) (*subEvent.buffer) >> axisId >> phasis ; - get(axisId)->receivedAxisDistribution(event, phasis); - } - CATCH - - - void CAxis::receivedAxisDistribution(CEventServer& event, int phasis) - TRY - { - CContext* context = CContext::getCurrent(); - if (phasis==0) // receive the remote element to construct the full view - { - localElement_ = make_shared(context->getIntraCommRank(),event) ; - localElement_->addFullView() ; - // construct the local dimension and indexes - auto& globalIndex=localElement_->getGlobalIndex() ; - int nk=globalIndex.numElements() ; - int minK=n_glo,maxK=-1 ; - int nGlo=n_glo ; - int indGlo ; - for(int k=0;kmaxK) maxK=indGlo ; - } - if (maxK>=minK) { begin=minK ; n=maxK-minK+1 ; } - else {begin=0; n=0 ;} - - } - else if (phasis==1) // receive the sent view from client to construct the full distributed full view on server - { - CContext* context = CContext::getCurrent(); - shared_ptr elementFrom = make_shared(event) ; - elementFrom->addFullView() ; - gathererConnector_ = make_shared(elementFrom->getView(CElementView::FULL), localElement_->getView(CElementView::FULL)) ; - gathererConnector_->computeConnector() ; - } - else if (phasis==2) - { -// delete gathererConnector_ ; - elementFrom_ = make_shared(event) ; - elementFrom_->addFullView() ; -// gathererConnector_ = make_shared(elementFrom_->getView(CElementView::FULL), localElement_->getView(CElementView::FULL)) ; -// gathererConnector_ -> computeConnector() ; - } - else if (phasis==3) - { - elementTo_ = make_shared(event) ; - elementTo_->addFullView() ; - } - } - CATCH - - void CAxis::setServerMask(CArray& serverMask, CContextClient* client) - TRY - { - CContext* context = CContext::getCurrent(); - localElement_->addView(CElementView::WORKFLOW, serverMask) ; - mask.reference(serverMask.copy()) ; - - serverFromClientConnector_ = make_shared(elementFrom_->getView(CElementView::FULL), localElement_->getView(CElementView::WORKFLOW)) ; - serverFromClientConnector_->computeConnector() ; - - serverToClientConnector_ = make_shared(localElement_->getView(CElementView::WORKFLOW), elementTo_->getView(CElementView::FULL), - context->getIntraComm(), client->getRemoteSize()) ; - serverToClientConnector_->computeConnector() ; - } - CATCH_DUMP_ATTR - - void CAxis::sendDistributedAttributes(CContextClient* client, shared_ptr scattererConnector, const string& axisId) - { - string serverAxisId = axisId.empty() ? this->getId() : axisId ; - CContext* context = CContext::getCurrent(); - - if (hasValue) - { - { // send level value - CEventClient event(getType(), EVENT_ID_SEND_DISTRIBUTED_ATTRIBUTE); - CMessage message ; - message<transfer(value, client, event,message) ; - } - } - - if (hasBounds) - { - { // send bounds level value - CEventClient event(getType(), EVENT_ID_SEND_DISTRIBUTED_ATTRIBUTE); - CMessage message ; - message<transfer(2, bounds, client, event,message) ; - } - } - - if (hasLabel) - { - { // send label - // need to transform array of string (no fixed size for string) into array of array of char - // to use connector to transfer - // the strings must have fixed size which the maximum lenght over the string label. - int maxSize=0 ; - for(int i=0; igetIntraComm()) ; - maxSize=maxSize+1 ; - CArray charArray(maxSize,label.numElements()) ; - for(int j=0; jtransfer(maxSize, charArray, client, event,message) ; - } - } - } - - void CAxis::recvDistributedAttributes(CEventServer& event) - TRY - { - string axisId; - string type ; - for (auto& subEvent : event.subEvents) (*subEvent.buffer) >> axisId >> type ; - get(axisId)->recvDistributedAttributes(event, type); - } - CATCH - - void CAxis::recvDistributedAttributes(CEventServer& event, const string& type) - TRY - { - if (type=="value") - { - gathererConnector_->transfer(event, value, 0.); - } - else if (type=="bounds") - { - CArray value ; - gathererConnector_->transfer(event, 2, value, 0.); - bounds.resize(2,n) ; - if (bounds.numElements() > 0 ) bounds=CArray(value.dataFirst(),shape(2,n),neverDeleteData) ; - } - else if (type=="label") - { - int maxSize ; - for (auto& subEvent : event.subEvents) (*subEvent.buffer) >> maxSize ; - CArray value ; - gathererConnector_->transfer(event, maxSize, value, '\0'); - CArray charArray(maxSize,n) ; - label.resize(n) ; - if (n>0) - { - charArray=CArray(value.dataFirst(),shape(maxSize,n),neverDeleteData) ; - for(int j=0;j - -#include "xios.hpp" - -#include "object_template.hpp" -#include "group_template.hpp" -#include "attribute_template.hpp" - -#include "icutil.hpp" -#include "timer.hpp" -#include "interpolate_domain.hpp" -#include "interpolate_axis.hpp" - -extern "C" -{ -// /////////////////////////////// Définitions ////////////////////////////// // - - // ----------------------- Redéfinition de types ---------------------------- - - typedef xios::CInterpolateDomain * XInterpolateDomainPtr; - typedef xios::CInterpolateAxis * XInterpolateAxisPtr; - - // ------------------------ Création des handle ----------------------------- - void cxios_interpolate_domain_handle_create(XInterpolateDomainPtr * _ret, const char * _id, int _id_len) - TRY - { - std::string id; - if (!cstr2string(_id, _id_len, id)) return; - CTimer::get("XIOS").resume() ; - *_ret = xios::CInterpolateDomain::get(id); - CTimer::get("XIOS").suspend() ; - } - CATCH_DUMP_STACK - - // -------------------- Vérification des identifiants ----------------------- - void cxios_interpolate_domain_valid_id(bool * _ret, const char * _id, int _id_len) - TRY - { - std::string id; - if (!cstr2string(_id, _id_len, id)) return; - - CTimer::get("XIOS").resume() ; - *_ret = xios::CInterpolateDomain::has(id); - CTimer::get("XIOS").suspend() ; - } - CATCH_DUMP_STACK - - // ------------------------ Création des handle ----------------------------- - void cxios_interpolate_axis_handle_create(XInterpolateAxisPtr * _ret, const char * _id, int _id_len) - TRY - { - std::string id; - if (!cstr2string(_id, _id_len, id)) return; - CTimer::get("XIOS").resume() ; - *_ret = xios::CInterpolateAxis::get(id); - CTimer::get("XIOS").suspend() ; - } - CATCH_DUMP_STACK - - // -------------------- Vérification des identifiants ----------------------- - void cxios_interpolate_axis_valid_id(bool * _ret, const char * _id, int _id_len) - TRY - { - std::string id; - if (!cstr2string(_id, _id_len, id)) return; - - CTimer::get("XIOS").resume() ; - *_ret = xios::CInterpolateAxis::has(id); - CTimer::get("XIOS").suspend() ; - } - CATCH_DUMP_STACK -} // extern "C" diff --git a/xios_2311_src/trunk/.svn/pristine/22/22d7fde6189993558ad3b606509d53db901754aa.svn-base b/xios_2311_src/trunk/.svn/pristine/22/22d7fde6189993558ad3b606509d53db901754aa.svn-base deleted file mode 100644 index 43e5ba72a86c4cc19fd6991acca96b839e92a9b9..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/22/22d7fde6189993558ad3b606509d53db901754aa.svn-base +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef __EVENT_CLIENT_HPP__ -#define __EVENT_CLIENT_HPP__ - -#include "xios_spl.hpp" -#include "buffer_out.hpp" -#include "message.hpp" - -namespace xios -{ - class CEventClient - { - public: - static const size_t headerSize; - - CEventClient(int classId, int typeId); - - void push(int rank, int nbSender, CMessage& msg); - void send(size_t timeLine, const std::list& sizes, std::list&); - - bool isEmpty(void); - std::list getRanks(void); - std::list getSizes(void); - int getClassId(void) { return classId; } - int getTypeId(void) { return typeId; } - - private: - int classId; - int typeId; - std::list ranks; - std::list nbSenders; - std::list messages; - }; -} - -#endif diff --git a/xios_2311_src/trunk/.svn/pristine/23/23098078cd76bfd5eaadef9d4a8c1d52894483fa.svn-base b/xios_2311_src/trunk/.svn/pristine/23/23098078cd76bfd5eaadef9d4a8c1d52894483fa.svn-base deleted file mode 100644 index 1d370c15050f45ccbd9c55054ca9669ed547b48f..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/23/23098078cd76bfd5eaadef9d4a8c1d52894483fa.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -NETCDF_INCDIR="-I /opt/netcdf42/ifort/include" -NETCDF_LIBDIR="-L/opt/netcdf42/ifort/lib" -NETCDF_LIB="-lnetcdf" -MPI_INCDIR="" -MPI_LIBDIR="" -MPI_LIB="" -HDF5_INCDIR="" -HDF5_LIBDIR="" -HDF5_LIB="" diff --git a/xios_2311_src/trunk/.svn/pristine/24/2420099093b325526a569ca62d99c36c54de26dc.svn-base b/xios_2311_src/trunk/.svn/pristine/24/2420099093b325526a569ca62d99c36c54de26dc.svn-base deleted file mode 100644 index ce1e550f0ef0ef2ac691bf9bac43518ae3e3d5a8..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/24/2420099093b325526a569ca62d99c36c54de26dc.svn-base +++ /dev/null @@ -1,15 +0,0 @@ -module purge -module load intel/19.0.2.187 -module load gnu -module load mpi/openmpi/2.0.4 -module load flavor/hdf5/parallel -module load hdf5/1.8.20 -module load netcdf-c/4.6.0 -module load netcdf-fortran/4.4.4 -module load feature/bridge/heterogenous_mpmd -module load scorep/4.1 -module load vampir -export SCOREP_ENABLE_TRACING=true -export SCOREP_ENABLE_PROFILING=false - - diff --git a/xios_2311_src/trunk/.svn/pristine/24/244403db8e0640a26f20672d172a138004f9e7c8.svn-base b/xios_2311_src/trunk/.svn/pristine/24/244403db8e0640a26f20672d172a138004f9e7c8.svn-base deleted file mode 100644 index c2b414d13327f89d4aec4cbff267007318e43215..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/24/244403db8e0640a26f20672d172a138004f9e7c8.svn-base +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef __XIOS_MPI_TOOLS_HPP__ -#define __XIOS_MPI_TOOLS_HPP__ - -#include - -namespace xios -{ - - int MPI_Bcast_string(std::string& str, int root, MPI_Comm comm) ; - - template - MPI_Datatype MPI_GetType(void) ; - - template<> - MPI_Datatype MPI_GetType(void); - - template<> - MPI_Datatype MPI_GetType(void); - - template<> - MPI_Datatype MPI_GetType(void); - - template<> - MPI_Datatype MPI_GetType(void); - - template<> - MPI_Datatype MPI_GetType(void); - - template<> - MPI_Datatype MPI_GetType(void); - - template<> - MPI_Datatype MPI_GetType(void); - - -} -#endif diff --git a/xios_2311_src/trunk/.svn/pristine/24/245017ab32983b08beab3cbd70756ffa9ebf29bc.svn-base b/xios_2311_src/trunk/.svn/pristine/24/245017ab32983b08beab3cbd70756ffa9ebf29bc.svn-base deleted file mode 100644 index d695225f240a54a8b015ac65896fe0ec1d2b0a2f..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/24/245017ab32983b08beab3cbd70756ffa9ebf29bc.svn-base +++ /dev/null @@ -1,52 +0,0 @@ -/* ************************************************************************** * - * Copyright © IPSL/LSCE, xios, Avril 2010 - Octobre 2011 * - * ************************************************************************** */ - -#include - -#include - -#include "xios.hpp" - -#include "object_template.hpp" -#include "group_template.hpp" -#include "attribute_template.hpp" - -#include "icutil.hpp" -#include "timer.hpp" -#include "reduce_domain_to_axis.hpp" - -extern "C" -{ -// /////////////////////////////// Définitions ////////////////////////////// // - - // ----------------------- Redéfinition de types ---------------------------- - - typedef xios::CReduceDomainToAxis * XReduceDomainToAxisPtr; - - // ------------------------ Création des handle ----------------------------- - void cxios_reduce_domain_to_axis_handle_create(XReduceDomainToAxisPtr * _ret, const char * _id, int _id_len) - TRY - { - std::string id; - if (!cstr2string(_id, _id_len, id)) return; - CTimer::get("XIOS").resume() ; - *_ret = xios::CReduceDomainToAxis::get(id); - CTimer::get("XIOS").suspend() ; - } - CATCH_DUMP_STACK - - // -------------------- Vérification des identifiants ----------------------- - void cxios_reduce_domain_to_axis_valid_id(bool * _ret, const char * _id, int _id_len) - TRY - { - std::string id; - if (!cstr2string(_id, _id_len, id)) return; - - CTimer::get("XIOS").resume() ; - *_ret = xios::CReduceDomainToAxis::has(id); - CTimer::get("XIOS").suspend() ; - } - CATCH_DUMP_STACK - -} // extern "C" diff --git a/xios_2311_src/trunk/.svn/pristine/24/245d5540cc1122ac27776c9e7b0b91e8e871aa6a.svn-base b/xios_2311_src/trunk/.svn/pristine/24/245d5540cc1122ac27776c9e7b0b91e8e871aa6a.svn-base deleted file mode 100644 index 152020c9b6a72e3064046591fc61615852a3405f..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/24/245d5540cc1122ac27776c9e7b0b91e8e871aa6a.svn-base +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef __XIOS_TRANSFORMATION_ENUM__ -#define __XIOS_TRANSFORMATION_ENUM__ - -namespace xios -{ - /// ////////////////////// Définitions ////////////////////// /// - typedef enum transformation_type - { - TRANS_ZOOM_AXIS = 0, - TRANS_INVERSE_AXIS = 1, - TRANS_INTERPOLATE_AXIS = 2, - TRANS_ZOOM_DOMAIN = 3, - TRANS_INTERPOLATE_DOMAIN = 4, - TRANS_GENERATE_RECTILINEAR_DOMAIN = 5, - TRANS_REDUCE_AXIS_TO_SCALAR = 6, - TRANS_REDUCE_DOMAIN_TO_AXIS = 7, - TRANS_EXTRACT_DOMAIN_TO_AXIS = 8, - TRANS_COMPUTE_CONNECTIVITY_DOMAIN = 9, - TRANS_EXPAND_DOMAIN = 10, - TRANS_EXTRACT_AXIS_TO_SCALAR = 11, - TRANS_REDUCE_DOMAIN_TO_SCALAR = 12, - TRANS_TEMPORAL_SPLITTING = 13, - TRANS_REDUCE_AXIS_TO_AXIS = 14, - TRANS_DUPLICATE_SCALAR_TO_AXIS = 15, - TRANS_REDUCE_SCALAR_TO_SCALAR = 16, - TRANS_REORDER_DOMAIN = 17, - TRANS_EXTRACT_DOMAIN = 18, - TRANS_EXTRACT_AXIS = 19 - } ETranformationType; - -} // namespace xios - -#endif // __XIOS_TRANSFORMATION_ENUM__ diff --git a/xios_2311_src/trunk/.svn/pristine/24/2477620ceedf7a611209fa5fcd63657bb5542985.svn-base b/xios_2311_src/trunk/.svn/pristine/24/2477620ceedf7a611209fa5fcd63657bb5542985.svn-base deleted file mode 100644 index a7f5dce55f44acd1972e151e0c2adee69099fcce..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/24/2477620ceedf7a611209fa5fcd63657bb5542985.svn-base +++ /dev/null @@ -1,264 +0,0 @@ -#include "event_scheduler.hpp" -#include "xios_spl.hpp" -#include "mpi.hpp" -#include "tracer.hpp" - -namespace xios -{ - - - CEventScheduler::CEventScheduler(const MPI_Comm& comm) - { - MPI_Comm_dup(comm, &communicator) ; - MPI_Comm_size(communicator,&mpiSize) ; - MPI_Comm_rank(communicator,&mpiRank); - - - int maxChild=1 ; - - int m ; - do - { - m=1 ; - maxChild=maxChild+1 ; - for(int i=0;i(maxLevel+1) ; - child=vector >(maxLevel+1,vector(maxChild)) ; - nbChild=vector (maxLevel+1) ; - - level=0 ; - begin=0 ; - end=mpiSize-1 ; - nb=end-begin+1 ; - - do - { - n=0 ; - pos=begin ; - nbChild[level]=0 ; - parent[level+1]=begin ; - for(int i=0;i=pos && mpiRank1) ; - - - } - - CEventScheduler::~CEventScheduler() - { - while (!pendingSentParentRequest.empty() || !pendingRecvParentRequest.empty() || !pendingRecvChildRequest.empty() || !pendingSentChildRequest.empty()) - { - checkEvent() ; - } - } - - void CEventScheduler::registerEvent(const size_t timeLine, const size_t contextHashId) - { - registerEvent(timeLine, contextHashId, level) ; - checkEvent() ; - } - - void CEventScheduler::registerEvent(const size_t timeLine, const size_t contextHashId, const size_t lev) - { - - traceOff() ; - SPendingRequest* sentRequest=new SPendingRequest ; - sentRequest->buffer[0]=timeLine ; - sentRequest->buffer[1]=contextHashId ; - sentRequest->buffer[2]=lev-1 ; - - pendingSentParentRequest.push(sentRequest) ; - MPI_Isend(sentRequest->buffer,3, MPI_UNSIGNED_LONG, parent[lev], 0, communicator, &sentRequest->request) ; - traceOn() ; - } - - bool CEventScheduler::queryEvent(const size_t timeLine, const size_t contextHashId) - { - checkEvent() ; - if (! eventStack.empty() && eventStack.front().first==timeLine && eventStack.front().second==contextHashId) - { - //eventStack.pop() ; - return true ; - } - else return false ; - } - - void CEventScheduler::checkEvent(void) - { - traceOff() ; - checkChildRequest() ; - checkParentRequest() ; - traceOn() ; - - } - - void CEventScheduler::checkParentRequest(void) - { - int completed ; - MPI_Status status ; - int received ; - SPendingRequest* recvRequest ; - completed=true ; - - // check sent request to parent - while (! pendingSentParentRequest.empty() && completed) - { - MPI_Test( & pendingSentParentRequest.front()->request, &completed, &status) ; - if (completed) - { - delete pendingSentParentRequest.front() ; - pendingSentParentRequest.pop() ; - } - } - - // probe if a message is coming from parent - received=true ; - while(received) - { - MPI_Iprobe(MPI_ANY_SOURCE,1,communicator,&received, &status) ; - if (received) - { - recvRequest=new SPendingRequest ; - MPI_Irecv(recvRequest->buffer, 3, MPI_UNSIGNED_LONG, MPI_ANY_SOURCE, 1, communicator, &(recvRequest->request)) ; - pendingRecvParentRequest.push(recvRequest) ; - } - } - - // check sent request from parent - completed=true ; - while (! pendingRecvParentRequest.empty() && completed) - { - recvRequest=pendingRecvParentRequest.front() ; - MPI_Test( &(recvRequest->request), &completed, &status) ; - if (completed) - { - size_t timeLine=recvRequest->buffer[0] ; - size_t hashId=recvRequest->buffer[1] ; - size_t lev=recvRequest->buffer[2] ; - delete recvRequest ; - pendingRecvParentRequest.pop() ; - - if (lev==level) eventStack.push(pair(timeLine,hashId)) ; - else bcastEvent(timeLine, hashId, lev) ; - } - } - - } - - void CEventScheduler::checkChildRequest(void) - { -// function call only by parent mpi process - - MPI_Status status ; - int received ; - received=true ; - SPendingRequest* recvRequest ; - - // check for posted requests and make the corresponding receive - while(received) - { - MPI_Iprobe(MPI_ANY_SOURCE,0,communicator,&received, &status) ; - if (received) - { - recvRequest=new SPendingRequest ; - MPI_Irecv(recvRequest->buffer, 3, MPI_UNSIGNED_LONG, MPI_ANY_SOURCE, 0, communicator, &recvRequest->request) ; - pendingRecvChildRequest.push_back(recvRequest) ; - } - } - - // check if receive request is achieved - - for(list::iterator it=pendingRecvChildRequest.begin(); it!=pendingRecvChildRequest.end() ; ) - { - MPI_Test(&((*it)->request),&received,&status) ; - if (received) - { - size_t timeLine=(*it)->buffer[0] ; - size_t hashId=(*it)->buffer[1] ; - size_t lev=(*it)->buffer[2] ; - - SEvent event={timeLine,hashId,lev} ; - delete *it ; // free mem - it=pendingRecvChildRequest.erase(it) ; // get out of the list - - map< SEvent,int>::iterator itEvent=recvEvent.find(event) ; - if (itEvent==recvEvent.end()) - { - itEvent=(recvEvent.insert(pair< SEvent ,int > (event,1))).first ; - - } - else (itEvent->second)++ ; - if (itEvent->second==nbChild[lev]) - { - if (lev==0) - { - bcastEvent(timeLine,hashId,lev) ; - recvEvent.erase(itEvent) ; - } - else - { - registerEvent( timeLine,hashId,lev) ; - recvEvent.erase(itEvent) ; - } - } - } - else ++it ; - } - - // check if bcast request is achieved - - for(list::iterator it=pendingSentChildRequest.begin(); it!=pendingSentChildRequest.end() ; ) - { - MPI_Test(&(*it)->request,&received,&status) ; - if (received) - { - delete *it ; // free memory - it = pendingSentChildRequest.erase(it) ; // get out of the list - - } - else ++it ; - - } - } - - void CEventScheduler::bcastEvent(const size_t timeLine, const size_t contextHashId, const size_t lev) - { - SPendingRequest* sentRequest ; - - - for(int i=0; ibuffer[0]=timeLine ; - sentRequest->buffer[1]=contextHashId ; - sentRequest->buffer[2]=lev+1 ; - MPI_Isend(sentRequest->buffer,3, MPI_UNSIGNED_LONG, child[lev][i], 1, communicator, & sentRequest->request) ; - pendingSentChildRequest.push_back(sentRequest) ; - } - } - - -} diff --git a/xios_2311_src/trunk/.svn/pristine/24/248190e9c393a7c343b8ec2bb0cd46750cd39f62.svn-base b/xios_2311_src/trunk/.svn/pristine/24/248190e9c393a7c343b8ec2bb0cd46750cd39f62.svn-base deleted file mode 100644 index 1c9afff2927e6289e8fcdb9b18fcfb846ace89f6..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/24/248190e9c393a7c343b8ec2bb0cd46750cd39f62.svn-base +++ /dev/null @@ -1,79 +0,0 @@ -/*! - \file sum.cpp - \author Ha NGUYEN - \since 27 June 2016 - \date 9 Jan 2017 - - \brief sum reduction - */ -#include "sum_reduction.hpp" -#include "utils.hpp" - -namespace xios { - -CSumReductionAlgorithm::CSumReductionAlgorithm() - : CReductionAlgorithm() -{ -} - -CReductionAlgorithm* CSumReductionAlgorithm::create() -{ - return (new CSumReductionAlgorithm()); -} - -bool CSumReductionAlgorithm::registerTrans() -{ - return registerOperation(TRANS_REDUCE_SUM, CSumReductionAlgorithm::create); -} - -void CSumReductionAlgorithm::apply(const std::vector >& localIndex, - const double* dataInput, - CArray& dataOut, - std::vector& flagInitial, - bool ignoreMissingValue, bool firstPass) -{ - if (ignoreMissingValue) - { - int nbLocalIndex = localIndex.size(); - int currentlocalIndex = 0; - - if (firstPass) dataOut=std::numeric_limits::quiet_NaN(); - - for (int idx = 0; idx < nbLocalIndex; ++idx) - { - currentlocalIndex = localIndex[idx].first; - if (!NumTraits::isNan(*(dataInput + idx))) - { - if (flagInitial[currentlocalIndex]) - { - dataOut(currentlocalIndex) = *(dataInput + idx); - flagInitial[currentlocalIndex] = false; - } - else - { - dataOut(currentlocalIndex) += *(dataInput + idx); - } - } - } - } - else - { - int nbLocalIndex = localIndex.size(); - int currentlocalIndex = 0; - for (int idx = 0; idx < nbLocalIndex; ++idx) - { - currentlocalIndex = localIndex[idx].first; - if (flagInitial[currentlocalIndex]) - { - dataOut(currentlocalIndex) = *(dataInput + idx); - flagInitial[currentlocalIndex] = false; - } - else - { - dataOut(currentlocalIndex) += *(dataInput + idx); - } - } - } -} - -} diff --git a/xios_2311_src/trunk/.svn/pristine/24/24bd96a09955ceedc0e67030ed223de8f4000b73.svn-base b/xios_2311_src/trunk/.svn/pristine/24/24bd96a09955ceedc0e67030ed223de8f4000b73.svn-base deleted file mode 100644 index 7bcb56d5199f09fd32d9a6a45047cd63dd8bc92a..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/24/24bd96a09955ceedc0e67030ed223de8f4000b73.svn-base +++ /dev/null @@ -1,435 +0,0 @@ -! * ************************************************************************** * -! * Interface auto generated - do not modify * -! * ************************************************************************** * -#include "xios_fortran_prefix.hpp" - -MODULE icalendar_wrapper_attr - USE, INTRINSIC :: ISO_C_BINDING - USE icalendar_wrapper - USE calendar_wrapper_interface_attr - -CONTAINS - - SUBROUTINE xios(set_calendar_wrapper_attr) & - ( calendar_wrapper_id, comment, day_length, leap_year_drift, leap_year_drift_offset, leap_year_month & - , month_lengths, start_date, time_origin, timestep, type, year_length ) - - IMPLICIT NONE - TYPE(txios(calendar_wrapper)) :: calendar_wrapper_hdl - CHARACTER(LEN=*), INTENT(IN) ::calendar_wrapper_id - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: comment - INTEGER , OPTIONAL, INTENT(IN) :: day_length - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: leap_year_drift - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: leap_year_drift_offset - INTEGER , OPTIONAL, INTENT(IN) :: leap_year_month - INTEGER , OPTIONAL, INTENT(IN) :: month_lengths(:) - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: start_date - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: time_origin - TYPE(txios(duration)) , OPTIONAL, INTENT(IN) :: timestep - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type - INTEGER , OPTIONAL, INTENT(IN) :: year_length - - CALL xios(get_calendar_wrapper_handle) & - (calendar_wrapper_id,calendar_wrapper_hdl) - CALL xios(set_calendar_wrapper_attr_hdl_) & - ( calendar_wrapper_hdl, comment, day_length, leap_year_drift, leap_year_drift_offset, leap_year_month & - , month_lengths, start_date, time_origin, timestep, type, year_length ) - - END SUBROUTINE xios(set_calendar_wrapper_attr) - - SUBROUTINE xios(set_calendar_wrapper_attr_hdl) & - ( calendar_wrapper_hdl, comment, day_length, leap_year_drift, leap_year_drift_offset, leap_year_month & - , month_lengths, start_date, time_origin, timestep, type, year_length ) - - IMPLICIT NONE - TYPE(txios(calendar_wrapper)) , INTENT(IN) :: calendar_wrapper_hdl - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: comment - INTEGER , OPTIONAL, INTENT(IN) :: day_length - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: leap_year_drift - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: leap_year_drift_offset - INTEGER , OPTIONAL, INTENT(IN) :: leap_year_month - INTEGER , OPTIONAL, INTENT(IN) :: month_lengths(:) - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: start_date - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: time_origin - TYPE(txios(duration)) , OPTIONAL, INTENT(IN) :: timestep - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type - INTEGER , OPTIONAL, INTENT(IN) :: year_length - - CALL xios(set_calendar_wrapper_attr_hdl_) & - ( calendar_wrapper_hdl, comment, day_length, leap_year_drift, leap_year_drift_offset, leap_year_month & - , month_lengths, start_date, time_origin, timestep, type, year_length ) - - END SUBROUTINE xios(set_calendar_wrapper_attr_hdl) - - SUBROUTINE xios(set_calendar_wrapper_attr_hdl_) & - ( calendar_wrapper_hdl, comment_, day_length_, leap_year_drift_, leap_year_drift_offset_, leap_year_month_ & - , month_lengths_, start_date_, time_origin_, timestep_, type_, year_length_ ) - - IMPLICIT NONE - TYPE(txios(calendar_wrapper)) , INTENT(IN) :: calendar_wrapper_hdl - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: comment_ - INTEGER , OPTIONAL, INTENT(IN) :: day_length_ - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: leap_year_drift_ - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: leap_year_drift_offset_ - INTEGER , OPTIONAL, INTENT(IN) :: leap_year_month_ - INTEGER , OPTIONAL, INTENT(IN) :: month_lengths_(:) - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: start_date_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: time_origin_ - TYPE(txios(duration)) , OPTIONAL, INTENT(IN) :: timestep_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type_ - INTEGER , OPTIONAL, INTENT(IN) :: year_length_ - - IF (PRESENT(comment_)) THEN - CALL cxios_set_calendar_wrapper_comment & - (calendar_wrapper_hdl%daddr, comment_, len(comment_)) - ENDIF - - IF (PRESENT(day_length_)) THEN - CALL cxios_set_calendar_wrapper_day_length & - (calendar_wrapper_hdl%daddr, day_length_) - ENDIF - - IF (PRESENT(leap_year_drift_)) THEN - CALL cxios_set_calendar_wrapper_leap_year_drift & - (calendar_wrapper_hdl%daddr, leap_year_drift_) - ENDIF - - IF (PRESENT(leap_year_drift_offset_)) THEN - CALL cxios_set_calendar_wrapper_leap_year_drift_offset & - (calendar_wrapper_hdl%daddr, leap_year_drift_offset_) - ENDIF - - IF (PRESENT(leap_year_month_)) THEN - CALL cxios_set_calendar_wrapper_leap_year_month & - (calendar_wrapper_hdl%daddr, leap_year_month_) - ENDIF - - IF (PRESENT(month_lengths_)) THEN - CALL cxios_set_calendar_wrapper_month_lengths & - (calendar_wrapper_hdl%daddr, month_lengths_, SHAPE(month_lengths_)) - ENDIF - - IF (PRESENT(start_date_)) THEN - CALL cxios_set_calendar_wrapper_start_date & - (calendar_wrapper_hdl%daddr, start_date_, len(start_date_)) - ENDIF - - IF (PRESENT(time_origin_)) THEN - CALL cxios_set_calendar_wrapper_time_origin & - (calendar_wrapper_hdl%daddr, time_origin_, len(time_origin_)) - ENDIF - - IF (PRESENT(timestep_)) THEN - CALL cxios_set_calendar_wrapper_timestep & - (calendar_wrapper_hdl%daddr, timestep_) - ENDIF - - IF (PRESENT(type_)) THEN - CALL cxios_set_calendar_wrapper_type & - (calendar_wrapper_hdl%daddr, type_, len(type_)) - ENDIF - - IF (PRESENT(year_length_)) THEN - CALL cxios_set_calendar_wrapper_year_length & - (calendar_wrapper_hdl%daddr, year_length_) - ENDIF - - END SUBROUTINE xios(set_calendar_wrapper_attr_hdl_) - - SUBROUTINE xios(get_calendar_wrapper_attr) & - ( calendar_wrapper_id, comment, day_length, leap_year_drift, leap_year_drift_offset, leap_year_month & - , month_lengths, start_date, time_origin, timestep, type, year_length ) - - IMPLICIT NONE - TYPE(txios(calendar_wrapper)) :: calendar_wrapper_hdl - CHARACTER(LEN=*), INTENT(IN) ::calendar_wrapper_id - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: comment - INTEGER , OPTIONAL, INTENT(OUT) :: day_length - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: leap_year_drift - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: leap_year_drift_offset - INTEGER , OPTIONAL, INTENT(OUT) :: leap_year_month - INTEGER , OPTIONAL, INTENT(OUT) :: month_lengths(:) - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: start_date - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: time_origin - TYPE(txios(duration)) , OPTIONAL, INTENT(OUT) :: timestep - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type - INTEGER , OPTIONAL, INTENT(OUT) :: year_length - - CALL xios(get_calendar_wrapper_handle) & - (calendar_wrapper_id,calendar_wrapper_hdl) - CALL xios(get_calendar_wrapper_attr_hdl_) & - ( calendar_wrapper_hdl, comment, day_length, leap_year_drift, leap_year_drift_offset, leap_year_month & - , month_lengths, start_date, time_origin, timestep, type, year_length ) - - END SUBROUTINE xios(get_calendar_wrapper_attr) - - SUBROUTINE xios(get_calendar_wrapper_attr_hdl) & - ( calendar_wrapper_hdl, comment, day_length, leap_year_drift, leap_year_drift_offset, leap_year_month & - , month_lengths, start_date, time_origin, timestep, type, year_length ) - - IMPLICIT NONE - TYPE(txios(calendar_wrapper)) , INTENT(IN) :: calendar_wrapper_hdl - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: comment - INTEGER , OPTIONAL, INTENT(OUT) :: day_length - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: leap_year_drift - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: leap_year_drift_offset - INTEGER , OPTIONAL, INTENT(OUT) :: leap_year_month - INTEGER , OPTIONAL, INTENT(OUT) :: month_lengths(:) - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: start_date - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: time_origin - TYPE(txios(duration)) , OPTIONAL, INTENT(OUT) :: timestep - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type - INTEGER , OPTIONAL, INTENT(OUT) :: year_length - - CALL xios(get_calendar_wrapper_attr_hdl_) & - ( calendar_wrapper_hdl, comment, day_length, leap_year_drift, leap_year_drift_offset, leap_year_month & - , month_lengths, start_date, time_origin, timestep, type, year_length ) - - END SUBROUTINE xios(get_calendar_wrapper_attr_hdl) - - SUBROUTINE xios(get_calendar_wrapper_attr_hdl_) & - ( calendar_wrapper_hdl, comment_, day_length_, leap_year_drift_, leap_year_drift_offset_, leap_year_month_ & - , month_lengths_, start_date_, time_origin_, timestep_, type_, year_length_ ) - - IMPLICIT NONE - TYPE(txios(calendar_wrapper)) , INTENT(IN) :: calendar_wrapper_hdl - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: comment_ - INTEGER , OPTIONAL, INTENT(OUT) :: day_length_ - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: leap_year_drift_ - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: leap_year_drift_offset_ - INTEGER , OPTIONAL, INTENT(OUT) :: leap_year_month_ - INTEGER , OPTIONAL, INTENT(OUT) :: month_lengths_(:) - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: start_date_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: time_origin_ - TYPE(txios(duration)) , OPTIONAL, INTENT(OUT) :: timestep_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type_ - INTEGER , OPTIONAL, INTENT(OUT) :: year_length_ - - IF (PRESENT(comment_)) THEN - CALL cxios_get_calendar_wrapper_comment & - (calendar_wrapper_hdl%daddr, comment_, len(comment_)) - ENDIF - - IF (PRESENT(day_length_)) THEN - CALL cxios_get_calendar_wrapper_day_length & - (calendar_wrapper_hdl%daddr, day_length_) - ENDIF - - IF (PRESENT(leap_year_drift_)) THEN - CALL cxios_get_calendar_wrapper_leap_year_drift & - (calendar_wrapper_hdl%daddr, leap_year_drift_) - ENDIF - - IF (PRESENT(leap_year_drift_offset_)) THEN - CALL cxios_get_calendar_wrapper_leap_year_drift_offset & - (calendar_wrapper_hdl%daddr, leap_year_drift_offset_) - ENDIF - - IF (PRESENT(leap_year_month_)) THEN - CALL cxios_get_calendar_wrapper_leap_year_month & - (calendar_wrapper_hdl%daddr, leap_year_month_) - ENDIF - - IF (PRESENT(month_lengths_)) THEN - CALL cxios_get_calendar_wrapper_month_lengths & - (calendar_wrapper_hdl%daddr, month_lengths_, SHAPE(month_lengths_)) - ENDIF - - IF (PRESENT(start_date_)) THEN - CALL cxios_get_calendar_wrapper_start_date & - (calendar_wrapper_hdl%daddr, start_date_, len(start_date_)) - ENDIF - - IF (PRESENT(time_origin_)) THEN - CALL cxios_get_calendar_wrapper_time_origin & - (calendar_wrapper_hdl%daddr, time_origin_, len(time_origin_)) - ENDIF - - IF (PRESENT(timestep_)) THEN - CALL cxios_get_calendar_wrapper_timestep & - (calendar_wrapper_hdl%daddr, timestep_) - ENDIF - - IF (PRESENT(type_)) THEN - CALL cxios_get_calendar_wrapper_type & - (calendar_wrapper_hdl%daddr, type_, len(type_)) - ENDIF - - IF (PRESENT(year_length_)) THEN - CALL cxios_get_calendar_wrapper_year_length & - (calendar_wrapper_hdl%daddr, year_length_) - ENDIF - - END SUBROUTINE xios(get_calendar_wrapper_attr_hdl_) - - SUBROUTINE xios(is_defined_calendar_wrapper_attr) & - ( calendar_wrapper_id, comment, day_length, leap_year_drift, leap_year_drift_offset, leap_year_month & - , month_lengths, start_date, time_origin, timestep, type, year_length ) - - IMPLICIT NONE - TYPE(txios(calendar_wrapper)) :: calendar_wrapper_hdl - CHARACTER(LEN=*), INTENT(IN) ::calendar_wrapper_id - LOGICAL, OPTIONAL, INTENT(OUT) :: comment - LOGICAL(KIND=C_BOOL) :: comment_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: day_length - LOGICAL(KIND=C_BOOL) :: day_length_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: leap_year_drift - LOGICAL(KIND=C_BOOL) :: leap_year_drift_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: leap_year_drift_offset - LOGICAL(KIND=C_BOOL) :: leap_year_drift_offset_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: leap_year_month - LOGICAL(KIND=C_BOOL) :: leap_year_month_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: month_lengths - LOGICAL(KIND=C_BOOL) :: month_lengths_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: start_date - LOGICAL(KIND=C_BOOL) :: start_date_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: time_origin - LOGICAL(KIND=C_BOOL) :: time_origin_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: timestep - LOGICAL(KIND=C_BOOL) :: timestep_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: type - LOGICAL(KIND=C_BOOL) :: type_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: year_length - LOGICAL(KIND=C_BOOL) :: year_length_tmp - - CALL xios(get_calendar_wrapper_handle) & - (calendar_wrapper_id,calendar_wrapper_hdl) - CALL xios(is_defined_calendar_wrapper_attr_hdl_) & - ( calendar_wrapper_hdl, comment, day_length, leap_year_drift, leap_year_drift_offset, leap_year_month & - , month_lengths, start_date, time_origin, timestep, type, year_length ) - - END SUBROUTINE xios(is_defined_calendar_wrapper_attr) - - SUBROUTINE xios(is_defined_calendar_wrapper_attr_hdl) & - ( calendar_wrapper_hdl, comment, day_length, leap_year_drift, leap_year_drift_offset, leap_year_month & - , month_lengths, start_date, time_origin, timestep, type, year_length ) - - IMPLICIT NONE - TYPE(txios(calendar_wrapper)) , INTENT(IN) :: calendar_wrapper_hdl - LOGICAL, OPTIONAL, INTENT(OUT) :: comment - LOGICAL(KIND=C_BOOL) :: comment_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: day_length - LOGICAL(KIND=C_BOOL) :: day_length_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: leap_year_drift - LOGICAL(KIND=C_BOOL) :: leap_year_drift_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: leap_year_drift_offset - LOGICAL(KIND=C_BOOL) :: leap_year_drift_offset_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: leap_year_month - LOGICAL(KIND=C_BOOL) :: leap_year_month_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: month_lengths - LOGICAL(KIND=C_BOOL) :: month_lengths_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: start_date - LOGICAL(KIND=C_BOOL) :: start_date_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: time_origin - LOGICAL(KIND=C_BOOL) :: time_origin_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: timestep - LOGICAL(KIND=C_BOOL) :: timestep_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: type - LOGICAL(KIND=C_BOOL) :: type_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: year_length - LOGICAL(KIND=C_BOOL) :: year_length_tmp - - CALL xios(is_defined_calendar_wrapper_attr_hdl_) & - ( calendar_wrapper_hdl, comment, day_length, leap_year_drift, leap_year_drift_offset, leap_year_month & - , month_lengths, start_date, time_origin, timestep, type, year_length ) - - END SUBROUTINE xios(is_defined_calendar_wrapper_attr_hdl) - - SUBROUTINE xios(is_defined_calendar_wrapper_attr_hdl_) & - ( calendar_wrapper_hdl, comment_, day_length_, leap_year_drift_, leap_year_drift_offset_, leap_year_month_ & - , month_lengths_, start_date_, time_origin_, timestep_, type_, year_length_ ) - - IMPLICIT NONE - TYPE(txios(calendar_wrapper)) , INTENT(IN) :: calendar_wrapper_hdl - LOGICAL, OPTIONAL, INTENT(OUT) :: comment_ - LOGICAL(KIND=C_BOOL) :: comment__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: day_length_ - LOGICAL(KIND=C_BOOL) :: day_length__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: leap_year_drift_ - LOGICAL(KIND=C_BOOL) :: leap_year_drift__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: leap_year_drift_offset_ - LOGICAL(KIND=C_BOOL) :: leap_year_drift_offset__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: leap_year_month_ - LOGICAL(KIND=C_BOOL) :: leap_year_month__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: month_lengths_ - LOGICAL(KIND=C_BOOL) :: month_lengths__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: start_date_ - LOGICAL(KIND=C_BOOL) :: start_date__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: time_origin_ - LOGICAL(KIND=C_BOOL) :: time_origin__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: timestep_ - LOGICAL(KIND=C_BOOL) :: timestep__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: type_ - LOGICAL(KIND=C_BOOL) :: type__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: year_length_ - LOGICAL(KIND=C_BOOL) :: year_length__tmp - - IF (PRESENT(comment_)) THEN - comment__tmp = cxios_is_defined_calendar_wrapper_comment & - (calendar_wrapper_hdl%daddr) - comment_ = comment__tmp - ENDIF - - IF (PRESENT(day_length_)) THEN - day_length__tmp = cxios_is_defined_calendar_wrapper_day_length & - (calendar_wrapper_hdl%daddr) - day_length_ = day_length__tmp - ENDIF - - IF (PRESENT(leap_year_drift_)) THEN - leap_year_drift__tmp = cxios_is_defined_calendar_wrapper_leap_year_drift & - (calendar_wrapper_hdl%daddr) - leap_year_drift_ = leap_year_drift__tmp - ENDIF - - IF (PRESENT(leap_year_drift_offset_)) THEN - leap_year_drift_offset__tmp = cxios_is_defined_calendar_wrapper_leap_year_drift_offset & - (calendar_wrapper_hdl%daddr) - leap_year_drift_offset_ = leap_year_drift_offset__tmp - ENDIF - - IF (PRESENT(leap_year_month_)) THEN - leap_year_month__tmp = cxios_is_defined_calendar_wrapper_leap_year_month & - (calendar_wrapper_hdl%daddr) - leap_year_month_ = leap_year_month__tmp - ENDIF - - IF (PRESENT(month_lengths_)) THEN - month_lengths__tmp = cxios_is_defined_calendar_wrapper_month_lengths & - (calendar_wrapper_hdl%daddr) - month_lengths_ = month_lengths__tmp - ENDIF - - IF (PRESENT(start_date_)) THEN - start_date__tmp = cxios_is_defined_calendar_wrapper_start_date & - (calendar_wrapper_hdl%daddr) - start_date_ = start_date__tmp - ENDIF - - IF (PRESENT(time_origin_)) THEN - time_origin__tmp = cxios_is_defined_calendar_wrapper_time_origin & - (calendar_wrapper_hdl%daddr) - time_origin_ = time_origin__tmp - ENDIF - - IF (PRESENT(timestep_)) THEN - timestep__tmp = cxios_is_defined_calendar_wrapper_timestep & - (calendar_wrapper_hdl%daddr) - timestep_ = timestep__tmp - ENDIF - - IF (PRESENT(type_)) THEN - type__tmp = cxios_is_defined_calendar_wrapper_type & - (calendar_wrapper_hdl%daddr) - type_ = type__tmp - ENDIF - - IF (PRESENT(year_length_)) THEN - year_length__tmp = cxios_is_defined_calendar_wrapper_year_length & - (calendar_wrapper_hdl%daddr) - year_length_ = year_length__tmp - ENDIF - - END SUBROUTINE xios(is_defined_calendar_wrapper_attr_hdl_) - -END MODULE icalendar_wrapper_attr diff --git a/xios_2311_src/trunk/.svn/pristine/24/24d85b707624ad9f56be8b877d5a783a4f9bb037.svn-base b/xios_2311_src/trunk/.svn/pristine/24/24d85b707624ad9f56be8b877d5a783a4f9bb037.svn-base deleted file mode 100644 index f0c0290f767cf7c2007a57973568047a5bf3f61d..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/24/24d85b707624ad9f56be8b877d5a783a4f9bb037.svn-base +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef __EVENT_SERVER_HPP__ -#define __EVENT_SERVER_HPP__ - -#include "xios_spl.hpp" -#include "buffer_in.hpp" -#include "buffer_server.hpp" - -namespace xios -{ - class CContextServer ; - - class CEventServer - { - public: - - int classId ; - int type ; - int nbSender ; - - CEventServer(CContextServer* contextServer) : contextServer_(contextServer) {} - - void push(int rank,CServerBuffer* serverBuffer ,char* startBuffer,int size) ; - CContextServer* getContextServer(void) { return contextServer_ ;} - - struct SSubEvent - { - int rank ; - CServerBuffer* serverBuffer ; - CBufferIn* buffer ; - int size ; - } ; - - list subEvents ; - - bool isFull(void) ; - ~CEventServer() ; - private : - - CContextServer* contextServer_ ; - } ; - -} - -#endif diff --git a/xios_2311_src/trunk/.svn/pristine/24/24deaaa0fa00b02dbf5e5097a308cc3f91c86b8e.svn-base b/xios_2311_src/trunk/.svn/pristine/24/24deaaa0fa00b02dbf5e5097a308cc3f91c86b8e.svn-base deleted file mode 100644 index a48c8341c9e2d1ee5ebad041b4f78373acd6b269..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/24/24deaaa0fa00b02dbf5e5097a308cc3f91c86b8e.svn-base +++ /dev/null @@ -1,506 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/xios_2311_src/trunk/.svn/pristine/24/24eadca61f3e185840152878eced04f17e24fc17.svn-base b/xios_2311_src/trunk/.svn/pristine/24/24eadca61f3e185840152878eced04f17e24fc17.svn-base deleted file mode 100644 index 0fe35c7c171ec290dd651ec84229e448ae032dfa..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/24/24eadca61f3e185840152878eced04f17e24fc17.svn-base +++ /dev/null @@ -1,15 +0,0 @@ -# Environment to compile XIOS on Athena -# -# Prerequisite softwares installed with -# -module load INTEL/intel_xe_2013 -module load HDF5/hdf5-1.8.11_parallel -module load NETCDF/netcdf-4.3_parallel -module load NETCDF/parallel-netcdf-1.3.1 - -#export NETCDF_DIR=${NETCDF} -#export PNETCDF_DIR=${PNETCDF} -export NETCDF_DIR=/users/home/opt/netcdf/netcdf-4.3_parallel -export PNETCDF_DIR=/users/home/opt/netcdf/parallel-netcdf-1.3.1 -export HDF5_DIR=/users/home/opt/hdf5/hdf5-1.8.11_parallel - diff --git a/xios_2311_src/trunk/.svn/pristine/25/253dcb4fbd3d262871418a40b6161cf91db9e70a.svn-base b/xios_2311_src/trunk/.svn/pristine/25/253dcb4fbd3d262871418a40b6161cf91db9e70a.svn-base deleted file mode 100644 index 0f6607ea5d62599a4e66e37d767eb59c9c08e49a..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/25/253dcb4fbd3d262871418a40b6161cf91db9e70a.svn-base +++ /dev/null @@ -1,27 +0,0 @@ -#include "buffer.hpp" -#include "buffer_impl.hpp" - -namespace xios -{ -# define macro(T) \ - template bool CBuffer::put_template(const T& data) ; \ - template bool CBuffer::put_template(const T* data, size_t n) ; \ - template bool CBuffer::put_ptr_template(const T*& data, size_t n) ; \ - template bool CBuffer::get_template(T& data) ; \ - template bool CBuffer::get_template(T* data, size_t n) ; \ - template bool CBuffer::get_ptr_template(T*& data, size_t n) ; - - - macro(char) - macro(int) - macro(short) - macro(long) - macro(longlong) - macro(uint) - macro(ushort) - macro(ulong) - macro(ulonglong) - macro(float) - macro(double) - macro(long double) -} diff --git a/xios_2311_src/trunk/.svn/pristine/25/2554149082de1a9c56d4abb21fbc8237f820faac.svn-base b/xios_2311_src/trunk/.svn/pristine/25/2554149082de1a9c56d4abb21fbc8237f820faac.svn-base deleted file mode 100644 index 7c72e90919c7e9813e4f5af4fabbc0e88c4a456e..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/25/2554149082de1a9c56d4abb21fbc8237f820faac.svn-base +++ /dev/null @@ -1,1048 +0,0 @@ -#LyX 2.1 created this file. For more info see http://www.lyx.org/ -\lyxformat 474 -\begin_document -\begin_header -\textclass book -\use_default_options true -\master ../../XIOS_user_guide.lyx -\maintain_unincluded_children false -\language english -\language_package default -\inputencoding auto -\fontencoding global -\font_roman default -\font_sans default -\font_typewriter default -\font_math auto -\font_default_family default -\use_non_tex_fonts false -\font_sc false -\font_osf false -\font_sf_scale 100 -\font_tt_scale 100 -\graphics default -\default_output_format default -\output_sync 0 -\bibtex_command default -\index_command default -\float_placement !tph -\paperfontsize default -\spacing single -\use_hyperref false -\papersize a4paper -\use_geometry false -\use_package amsmath 1 -\use_package amssymb 1 -\use_package cancel 1 -\use_package esint 1 -\use_package mathdots 1 -\use_package mathtools 1 -\use_package mhchem 1 -\use_package stackrel 1 -\use_package stmaryrd 1 -\use_package undertilde 1 -\cite_engine basic -\cite_engine_type default -\biblio_style plain -\use_bibtopic false -\use_indices false -\paperorientation portrait -\suppress_date false -\justification true -\use_refstyle 1 -\index Index -\shortcut idx -\color #008000 -\end_index -\secnumdepth 3 -\tocdepth 3 -\paragraph_separation indent -\paragraph_indentation default -\quotes_language english -\papercolumns 1 -\papersides 1 -\paperpagestyle default -\tracking_changes false -\output_changes false -\html_math_output 0 -\html_css_as_file 0 -\html_be_strict false -\end_header - -\begin_body - -\begin_layout Chapter -Domain -\end_layout - -\begin_layout Standard -Domain is a two dimensional coordinates, which can be considered to be composed - of two axis: y-axis and x-axis. - However, different from two axis composed mechanically, a domain contains - more typical information which play an important role in specific cases. - Very often, in meteorological applications, domain represents a surface - with latitude and longitude. -\end_layout - -\begin_layout Section -Working with configuration file -\end_layout - -\begin_layout Subsection -Basic configuration -\end_layout - -\begin_layout Standard -Similar to Grid as well as other components in XIOS, a domain is defined - inside its definition part with the tag -\series bold -\color black -domain_definition -\series default -\color inherit -. - -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -The first one is to specify explicitly identification of a domain with an - id. - One repetition, id of any component in XIOS are -\shape italic -\color black -unique -\shape default -\color inherit - among this kind of components. - It is not allowed to have two domains with a same id, but it is permitted - a domain and a grid, for example, to share a same one. -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -In this way, with id, the domain can be processed, e.x modified its attributes, - with Fortran interface; besides, it is only possible to reference to a - domain whose id is explicitly defined. -\end_layout - -\begin_layout Standard -Very often, after a domain is defined, it may be referenced many times. - To make a reference to a domain, we use domain_ref -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -A domain defined by domain_ref will inherit all attributes of the referenced - one, except its id attribute. - If there is no id specified, an implicit one is assigned to this new domain. - The domain with implicit id can only be used inside the scope where it - is defined, it can not be referenced, nor be processed. - It is rare to define a domain without id inside domain_definition. - However, the domain_ref is utilized widely outside the scope of domain_definiti -on. -\end_layout - -\begin_layout Standard -Because a domain is a sub component of grid, it is possible to define a - new domain inside a grid with the tag -\series bold -\color black -domain. - -\series default -\color inherit -Moreover it is the only region where we can define a new domain outside - domain_definition. -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -The xml lines above can be translated as: the grid_A composed of a domain_A - that is defined somewhere else before. - More precisely, the grid grid_A is constituted of a -\begin_inset Quotes eld -\end_inset - -unknown id -\begin_inset Quotes erd -\end_inset - - domain which has inherited all attributes (and their values) from domain - A (name, long name, i_index, j_index, ... - etc). -\end_layout - -\begin_layout Standard -With this approach, we only define a domain once but reuse it as many time - as we like in different configurations. -\end_layout - -\begin_layout Subsection -Advanced configuration -\end_layout - -\begin_layout Standard -One of a new concept which differenciates XIOS 2.0 from its precedent is - transformation. - In a simple case, zoom feature is now considered to be a transformation. - It can be more complicated for other geometric transformation such as inversion - or interpolation. - All transformation are taken place on grid level. - It means that it is neccessary to define a grid source and a grid destination - as well as a transformation or list of transformation which we'd like to - have. - In order to transform a grid to one another, we need to specify a transformatio -n on its sub-component: domain or axis. -\end_layout - -\begin_layout Standard -Because transformation on a domain is different from one on an axis, we - differenciate two categories of transformation: transformation_domain and - transformation_axis. -\end_layout - -\begin_layout Standard -Till now, XIOS supports the following transformation on domain: -\end_layout - -\begin_layout Itemize -zoom_domain: Like zoom functionality in XIOS 1.0, the destination grid is - the zoomed region of the source grid. -\end_layout - -\begin_layout Itemize -interpolation_domain: Implement interpolation from a domain to one another, - for now XIOS can only do interpolation by reading calculated weight values - from a file or calculate the weights on the fly. -\end_layout - -\begin_layout Itemize -generate_rectilinear_domain: auto generating, distributing a rectilinear - domain then filling all mandatory attributes. -\end_layout - -\begin_layout Standard -It is not difficult to define a transformation: Include type of transformation - inside domain definition, as the following -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -The concrete example above tells many things: a domain named domain_A_zoom - is transformed from domain name domain_A with a zoom activity. - The domain_A_zoom is the zoomed region of domain_A. - The detailed attributes of zoom_domain can be found in reference document, - but simply it contains the begining and size of zoomed region. -\end_layout - -\begin_layout Standard -One remark is the transformed domain SHOULD have an id, in this case, it's - domain_A_zoom. - As mentioned before, a no-id domain or any no-id component of XIOS can - only be used inside its definition scope. - It exists but is useless. - So care about that. -\end_layout - -\begin_layout Standard -To make use of transformation, the grid must contain domains which reference - to transformed ones. - -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -On defining this way, we tell XIOS to establish a connection between two - grids by a transformation (zoom) with: grid source - grid_A, grid destination - - grid_A_zoom. -\end_layout - -\begin_layout Standard -As mentioned in Grid Chapter, in order to use transformed grid, just reference - to it in field_definition -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Although xml is helpful to define several configurations, it is not convenient - to customize attributes of domain. - So it's the turn of Fortran interface. -\end_layout - -\begin_layout Section -Working with FORTRAN code -\end_layout - -\begin_layout Standard -One of the important concepts to grasp in mind in using FORTRAN interface - is the data distribution. - With a distributed-memory XIOS, data are broken into disjoint blocks, one - per client process. - In the next sections, local describes everything related to a client process, - whereas global means global data. - The followings describe the essential parts of domain. - Details of its attributes and operations can be found in XIOS reference - guide -\end_layout - -\begin_layout Subsection -Domain type -\end_layout - -\begin_layout Standard -Domain is a two dimensional coordinates, which can be considered to be composed - of two axis: y-axis and x-axis. - However, different from two axis composed mechanically, a domain contains - more typical information which play an important role in specific cases. - Very often, in meteorological applications, domain represents a surface - with latitude and longitude. - Because these properties change from one domain type to another, it is - recommended to use domain in case of representing a surface. -\end_layout - -\begin_layout Standard -In XIOS, a domain can be represented by one of three different types of - coordinate system which also differentiate the way to represent latitude - and longitude correspondingly. - -\end_layout - -\begin_layout Itemize -rectilinear: a simple 2-dimensional Cartesian coordinates with two perpendicular - axes. - Latitude represents the y-axe while longitude represents the x-axe. -\end_layout - -\begin_layout Itemize -curvilinear: a 2-dimensional coordinates allows the generality of two axes - not perpendicular to each other. - Latitude and longitude have the size equivalent to size of local domain. - -\end_layout - -\begin_layout Itemize -unstructured: not any of two above, the latitutude and longitude, as curvilinear -, are reprensented with the help of boundaries. - -\end_layout - -\begin_layout Standard -Different from XIOS 1.0, in this new version, users must explicitly specify - the type of domain which they would like to use -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - -CALL xios_set_domain_attr("domain_A",type='rectilinear') -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Althoug there are different domain types, they share the similar patterns - to settle local data on a client process: There are some essential attributes - to define. - The next sections describe their meanings and how to specify correctly - data for a local domain. -\end_layout - -\begin_layout Subsection -Local domain index -\end_layout - -\begin_layout Standard -It is not uncommon that a global domain is broken into several pieces, each - of which is distributed to one process. - Following we consider a simple case: a domain of rectilinear type with - global size 9 x 9 and its data is distributed evenly among 9 client processes, - each of which has 3x3. -\end_layout - -\begin_layout Standard -\begin_inset Float figure -placement !tbph -wide false -sideways false -status open - -\begin_layout Plain Layout -\begin_inset Graphics - filename ../images/Distributed_Domain.pdf - lyxscale 50 - scale 60 - -\end_inset - - -\end_layout - -\begin_layout Plain Layout -\begin_inset Caption Standard - -\begin_layout Plain Layout -Global domain data -\end_layout - -\end_inset - - -\begin_inset CommandInset label -LatexCommand label -name "globalDomain" - -\end_inset - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -The region of local domain can be described by one of the following way. -\end_layout - -\begin_layout Standard -Specify the the beginning and size of local domain with: -\end_layout - -\begin_layout Itemize -ni_glo, nj_glo: global size of x-axis and y-axis correspondingly. - -\end_layout - -\begin_layout Itemize -ibegin, jbegin: global position on x-axis and y-axis where a local domain - begin -\end_layout - -\begin_layout Itemize -ni, nj: local size of domain of each process on x-axis and y-axis -\end_layout - -\begin_layout Standard -Or tell XIOS exactly the global position of each point in the local domain, - from left to right, top to bottom with: -\end_layout - -\begin_layout Itemize -i_index, j_index: array of global position of every point in the local domain. - It is very useful when local domains do not align with each other. -\end_layout - -\begin_layout Standard -For example, with the first method, the local domain in the middle (the - blue one) can be specified with: -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - -CALL xios_set_domain_attr("domain_A",ni_glo=9, nj_glo=9, ibegin=3, ni=3, - jbegin=3, nj=3) -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -The second method demands only two arrays: -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - -CALL xios_set_domain_attr("domain_A",ni_glo=9, nj_glo=9, i_index=iIndex, - j_index=jIndex) -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -and -\end_layout - -\begin_layout Itemize -iIndex={3,4,5,3,4,5,3,4,5}, jIndex = {3,3,3,4,4,4,5,5,5} -\end_layout - -\begin_layout Subsection -Local domain data -\end_layout - -\begin_layout Standard -Similar to define local index, local data can be done in two ways. -\end_layout - -\begin_layout Standard -Specify the begining and size of data on the local domain: -\end_layout - -\begin_layout Itemize -data_ibegin, data_jbegin: the local position of data on x-axis and y-axis - where data begins -\end_layout - -\begin_layout Itemize -data_ni, data_nj: size of data on each axis -\end_layout - -\begin_layout Standard -Or specify data with its position in the local domain, from left to right, - top to bottom with -\end_layout - -\begin_layout Itemize -data_i_index, data_j_index: array of local position of data in the local - domain. -\end_layout - -\begin_layout Standard -Beside the attributes above, one of the essential attributes to define is - dimensional size of data - data_dim. - Although domain has two dimensions, data are not required to be 2-dimensional. - In particular, for case of data_dim == 1, XIOS uses an -\shape italic -1-dimensional block distribution -\shape default - of data, distributed along the first dimension, the x-axis. -\end_layout - -\begin_layout Standard -With the first way to define data on a local domain, we can use: -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - -CALL xios_set_domain_attr("domain_A",data_dim=2, data_ibegin=-1, data_ni=ni+2, - data_jbegin=-1, data_nj=nj+2) -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -In order to be processed correctly, data must be specified with the begining - and size of its block . - For two-dimensional data, it can be done with data_ibegin, data_ni for - the first dimension and data_jbegin, data_nj for the second dimension. - In case of one-dimensional data, it is only necessary to determine data_ibegin - and data_ni. - Although the valid data must be inside a local domain, it is not neccessary - for data to have same size as local domain. - In fact, data can have larger size than domain on each dimension, this - is often the case of -\begin_inset Quotes eld -\end_inset - -ghost cell -\begin_inset Quotes erd -\end_inset - -. - The attributes data_ibegin and data_jbegin specify the offset of data from - local domain. - For local domain_A, the negative value indicates that data is larger than - local domain, the valid part of data needs extracted from the real data. - A positive value indicates data is smaller than local domain. - The default value of data_ibegin/data_jbegin is 0, which implies that data - fit into local domain properly. - -\end_layout - -\begin_layout Standard -\begin_inset Float figure -placement !tbph -wide false -sideways false -status open - -\begin_layout Plain Layout -\begin_inset Graphics - filename ../images/Domain.pdf - lyxscale 50 - scale 60 - -\end_inset - - -\end_layout - -\begin_layout Plain Layout -\begin_inset Caption Standard - -\begin_layout Plain Layout -Local domain with data -\end_layout - -\end_inset - - -\begin_inset CommandInset label -LatexCommand label -name "localDomain" - -\end_inset - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -On Figure -\begin_inset CommandInset ref -LatexCommand ref -reference "localDomain" - -\end_inset - -, local domain occupies the center of the global domain, where real data - fill up a larger region. - Only data inside the local domain, represented by blue cells, are valid. - -\end_layout - -\begin_layout Standard -With the secon way, data can be represented with: -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - -CALL xios_set_domain_attr("domain_A",data_dim=2, data_i_index=dataI, data_j_inde -x=dataJ) -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -with -\end_layout - -\begin_layout Itemize -dataJ = {-1,-1,-1,-1,-1,0,0,0,0,0,1,1,1,1,1,2,2,2,3,3,3,3,3} -\end_layout - -\begin_layout Itemize -dataI = {-1,0,1,2,3,-1,0,1,2,3,-1,0,1,2,3,-1,0,1,2,3,-1,0,1,2,3} -\end_layout - -\begin_layout Standard -As mentioned, data on a domain are two-dimensional but in some cases, there - is a need to write data continously, there comes one-dimensional data. - With the precedent example, we can define one dimensional data with: -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - -CALL xios_set_domain_attr("domain_A",data_dim=1, data_i_index=dataI) -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -and -\end_layout - -\begin_layout Itemize -dataI = {-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18} -\end_layout - -\begin_layout Standard -Above are the mandatory attributes to define local domain. - There are some auxilliary attributes which make data meaningful, especially - for meteorological one. - The next section disscuses these attributes. -\end_layout - -\begin_layout Subsection -Longitude and latitude -\end_layout - -\begin_layout Standard -Different from the previous version, in XIOS 2.0, lonngitude and latitude - are optional. - Moreover, to be coherent to the data_dim concept, there are more ways to - input longitude and latitude values. -\end_layout - -\begin_layout Standard -Like data, longitude and latitude values can be one or two dimension. - The first ones are represented with lonvalue_1d, latvalue_1d; the second - ones are specified with lonvalue_2d and latvalue_2d. -\end_layout - -\begin_layout Standard -With the same domain_A, we can set longitude and latitude values by calling: -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - -CALL xios_set_domain_attr("domain_A",lonvalue_1d=lon1D, latvalue_1d=lat1D) -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -with -\end_layout - -\begin_layout Itemize -lon1D = {30, 40, 50, 30, 40, 50, 30, 40, 50} -\end_layout - -\begin_layout Itemize -lat1D = {30, 30, 30, 40, 40, 40, 50, 50, 50} -\end_layout - -\begin_layout Standard -Or by using two-dimension longitude and latitude -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - -CALL xios_set_domain_attr("domain_A",lonvalue_2d=lon2D, latvalue_1d=lat2D) -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -with -\end_layout - -\begin_layout Itemize -lon2D = { -\begin_inset Formula $\begin{array}{ccc} -30 & 40 & 50\\ -30 & 40 & 50\\ -30 & 40 & 50 -\end{array}$ -\end_inset - -} -\end_layout - -\begin_layout Itemize -lat1D = { -\begin_inset Formula $\begin{array}{ccc} -30 & 30 & 30\\ -40 & 40 & 40\\ -50 & 50 & 50 -\end{array}$ -\end_inset - -} -\end_layout - -\begin_layout Standard -For unstructured mesh, a cell can have different number of vertices than - rectinlinear, in this case, longitude and latitude value of the vertex - of cell are specified with bounds_lon_1d and bounds_lat_1d. -\end_layout - -\begin_layout Standard -For curvilinear mesh, bounds_lon_2d and bounds_lat_2d provide a convenient - way to define longitude and latitude value for the vertex of the cell. - However, it is possible to use bounds_lon_1d and bounds_lat_1d to describe - these values. -\end_layout - -\begin_layout Standard -One thing to remind, only *_1d or *_2d attributes are used, if *_1d and - *_2d of a same attribute are provides, there will be runtime error. -\end_layout - -\begin_layout Standard -All attributes of domain can be found in Reference Guide. -\end_layout - -\end_body -\end_document diff --git a/xios_2311_src/trunk/.svn/pristine/25/25aee44cd2d987907b282d393d49bd18d1fb08e0.svn-base b/xios_2311_src/trunk/.svn/pristine/25/25aee44cd2d987907b282d393d49bd18d1fb08e0.svn-base deleted file mode 100644 index fd850a66a973cb73e69d73b425325ba633dd5583..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/25/25aee44cd2d987907b282d393d49bd18d1fb08e0.svn-base +++ /dev/null @@ -1,47 +0,0 @@ -#include "gatherer_connector.hpp" - -namespace xios -{ - void CGathererConnector::computeConnector(void) - { - dstSize_=dstView_->getSize() ; - auto& srcGlobalIndex = srcView_->getGlobalIndex() ; - auto& srcIndex = srcView_->getIndex() ; - for(auto& rankIndex : srcIndex) srcSize_[rankIndex.first] = rankIndex.second.numElements(); - auto& dstGlobalIndex = dstView_->getGlobalIndex() ; - auto& dstIndex = dstView_->getIndex() ; - dstSize_=dstIndex.numElements() ; - - unordered_map mapGlobalLocalIndex ; - int globalIndexSize=dstGlobalIndex.size() ; - //for(auto& ind : dstIndex) mapGlobalLocalIndex[dstGlobalIndex(ind)] = ind ; - for(int i=0; i=0 && dstIndex(i)=0 && index(ind)second) ; - mask.push_back(true) ; - } - else mask.push_back(false) ; - } - else mask.push_back(false) ; - } - } - } - - -} \ No newline at end of file diff --git a/xios_2311_src/trunk/.svn/pristine/25/25f2999faaeb21db80b4f6eab5ec67d89b3b9f28.svn-base b/xios_2311_src/trunk/.svn/pristine/25/25f2999faaeb21db80b4f6eab5ec67d89b3b9f28.svn-base deleted file mode 100644 index 87f925aebca33f7e5fc5e8ed60b755b6d157bb76..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/25/25f2999faaeb21db80b4f6eab5ec67d89b3b9f28.svn-base +++ /dev/null @@ -1,116 +0,0 @@ -import glob -import sys -import subprocess -import os -import copy - -def OSinfo(runthis): - red = lambda text: '\033[0;31m' + text + '\033[0m' - osstdout = subprocess.Popen(runthis, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=True) - theInfo = osstdout.communicate()[0].strip() - if osstdout.returncode!=0: - print(red(runthis+" FAILED")) - print >> sys.stderr, osstdout.returncode - sys.exit() - # else: - # print(runthis+" OK") - -def Sort(sub_li): - l = len(sub_li) - for i in range(0, l): - for j in range(0, l-i-1): - if (sub_li[j][0] < sub_li[j+1][0]): - tempo = sub_li[j] - sub_li[j]= sub_li[j+1] - sub_li[j+1]= tempo - if (sub_li[j][0] == sub_li[j+1][0]): - if (sub_li[j][3] < sub_li[j+1][3]): - tempo = sub_li[j] - sub_li[j]= sub_li[j+1] - sub_li[j+1]= tempo - if (sub_li[j][3] == sub_li[j+1][3]): - if (sub_li[j][2] < sub_li[j+1][2]): - tempo = sub_li[j] - sub_li[j]= sub_li[j+1] - sub_li[j+1]= tempo - return sub_li - -def subgenerate(maindir, machine_name): - - compile_list = glob.glob(maindir+"/build_"+machine_name+"/build_*.txt") - print(maindir) - print(compile_list) - if len(compile_list) == 0 : - return - machine = machine_name - revision_list=[] - machine_list=[] - arch_list=[] - mode_list=[] - - bg_color = ["#84c5ff", "#96cdff", "#a1d3ff", "#b3dafd", "#c2e1fd"] - - - myBuild=["", "", "", "", ""] #revision, machine, arch, mode, status - myBuildList=[] - - for compile_log in compile_list: - revision = compile_log[6:10] - myBuild[4] = "❌" - f=open(compile_log, "r") - for line in f: - if line.startswith("revision"): - myText = line.replace("revision ", "").replace("\n", "") - if not myText in revision_list: - revision_list.append(myText) - myBuild[0] = myText - - - elif line.startswith("machine"): - myText = line.replace("machine ", "").replace("\n", "") - if not myText in machine_list: - machine_list.append(myText) - myBuild[1] = myText - - elif line.startswith("arch"): - myText = line.replace("arch ", "").replace("\n", "") - if not myText in arch_list: - arch_list.append(myText) - myBuild[2] = myText - - elif line.startswith("mode"): - myText = line.replace("mode ", "").replace("\n", "") - if not myText in mode_list: - mode_list.append(myText) - myBuild[3] = myText - - elif line[0].isdigit(): - myTexts = line.replace("\n", "") - if myTexts == "0" : - myBuild[4] = "✅" - myBuildList.append([myBuild[0], myBuild[1], myBuild[2], myBuild[3], myBuild[4]]) - f.close() - - print(Sort(myBuildList)) # first by revision number, then by mode, then by arch. all in descendant order - print(len(myBuildList)) - - revision_list = sorted(revision_list, reverse = True) - print(arch_list) # row - print(mode_list) # col - print(machine_list) # col - print(revision_list) # col - - - f=open("compile_"+machine+"_info.js", "w") - f.write("var "+machine+"_compile_info_list = "+repr(myBuildList)+"\n\n") - f.write("var "+machine+"_revision_list = "+repr(revision_list)+"\n\n") - f.close() - - -def main() : - repository_name=os.getenv('xios_test_suite_repository') - machine_name=os.getenv('xios_machine_name') - subgenerate(repository_name+'/BUILD',machine_name) - -if __name__== "__main__": - main() diff --git a/xios_2311_src/trunk/.svn/pristine/26/2616a0b78edeedb227772eedda155aedafbfbe2e.svn-base b/xios_2311_src/trunk/.svn/pristine/26/2616a0b78edeedb227772eedda155aedafbfbe2e.svn-base deleted file mode 100644 index df0d1b54d6a0142a17b8003480527255ff18cf45..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/26/2616a0b78edeedb227772eedda155aedafbfbe2e.svn-base +++ /dev/null @@ -1,89 +0,0 @@ -! * ************************************************************************** * -! * Interface auto generated - do not modify * -! * ************************************************************************** * -#include "../fortran/xios_fortran_prefix.hpp" - -MODULE reorder_domain_interface_attr - USE, INTRINSIC :: ISO_C_BINDING - - INTERFACE - ! Do not call directly / interface FORTRAN 2003 <-> C99 - - SUBROUTINE cxios_set_reorder_domain_invert_lat(reorder_domain_hdl, invert_lat) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: reorder_domain_hdl - LOGICAL (KIND=C_BOOL) , VALUE :: invert_lat - END SUBROUTINE cxios_set_reorder_domain_invert_lat - - SUBROUTINE cxios_get_reorder_domain_invert_lat(reorder_domain_hdl, invert_lat) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: reorder_domain_hdl - LOGICAL (KIND=C_BOOL) :: invert_lat - END SUBROUTINE cxios_get_reorder_domain_invert_lat - - FUNCTION cxios_is_defined_reorder_domain_invert_lat(reorder_domain_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_reorder_domain_invert_lat - INTEGER (kind = C_INTPTR_T), VALUE :: reorder_domain_hdl - END FUNCTION cxios_is_defined_reorder_domain_invert_lat - - - SUBROUTINE cxios_set_reorder_domain_max_lon(reorder_domain_hdl, max_lon) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: reorder_domain_hdl - REAL (KIND=C_DOUBLE) , VALUE :: max_lon - END SUBROUTINE cxios_set_reorder_domain_max_lon - - SUBROUTINE cxios_get_reorder_domain_max_lon(reorder_domain_hdl, max_lon) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: reorder_domain_hdl - REAL (KIND=C_DOUBLE) :: max_lon - END SUBROUTINE cxios_get_reorder_domain_max_lon - - FUNCTION cxios_is_defined_reorder_domain_max_lon(reorder_domain_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_reorder_domain_max_lon - INTEGER (kind = C_INTPTR_T), VALUE :: reorder_domain_hdl - END FUNCTION cxios_is_defined_reorder_domain_max_lon - - - SUBROUTINE cxios_set_reorder_domain_min_lon(reorder_domain_hdl, min_lon) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: reorder_domain_hdl - REAL (KIND=C_DOUBLE) , VALUE :: min_lon - END SUBROUTINE cxios_set_reorder_domain_min_lon - - SUBROUTINE cxios_get_reorder_domain_min_lon(reorder_domain_hdl, min_lon) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: reorder_domain_hdl - REAL (KIND=C_DOUBLE) :: min_lon - END SUBROUTINE cxios_get_reorder_domain_min_lon - - FUNCTION cxios_is_defined_reorder_domain_min_lon(reorder_domain_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_reorder_domain_min_lon - INTEGER (kind = C_INTPTR_T), VALUE :: reorder_domain_hdl - END FUNCTION cxios_is_defined_reorder_domain_min_lon - - - SUBROUTINE cxios_set_reorder_domain_shift_lon_fraction(reorder_domain_hdl, shift_lon_fraction) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: reorder_domain_hdl - REAL (KIND=C_DOUBLE) , VALUE :: shift_lon_fraction - END SUBROUTINE cxios_set_reorder_domain_shift_lon_fraction - - SUBROUTINE cxios_get_reorder_domain_shift_lon_fraction(reorder_domain_hdl, shift_lon_fraction) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: reorder_domain_hdl - REAL (KIND=C_DOUBLE) :: shift_lon_fraction - END SUBROUTINE cxios_get_reorder_domain_shift_lon_fraction - - FUNCTION cxios_is_defined_reorder_domain_shift_lon_fraction(reorder_domain_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_reorder_domain_shift_lon_fraction - INTEGER (kind = C_INTPTR_T), VALUE :: reorder_domain_hdl - END FUNCTION cxios_is_defined_reorder_domain_shift_lon_fraction - - END INTERFACE - -END MODULE reorder_domain_interface_attr diff --git a/xios_2311_src/trunk/.svn/pristine/26/2629b1a534aac11cda28ac96224a7ce92a752620.svn-base b/xios_2311_src/trunk/.svn/pristine/26/2629b1a534aac11cda28ac96224a7ce92a752620.svn-base deleted file mode 100644 index 1d0d99492c50d0536b1790b4893fa46f8aec013f..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/26/2629b1a534aac11cda28ac96224a7ce92a752620.svn-base +++ /dev/null @@ -1,218 +0,0 @@ -/********************************************************************* - * Copyright 1993, UCAR/Unidata - * See netcdf/COPYRIGHT file for copying and redistribution conditions. - * $Header: /upc/share/CVS/netcdf-3/libncdap3/ncd3dispatch.c,v 1.7 2010/05/27 21:34:09 dmh Exp $ - *********************************************************************/ - -#include "config.h" -#include -#include - -#include "nc.h" -#include "ncdap3.h" -#include "ncdispatch.h" -#include "ncd3dispatch.h" - -static int -NCD3_create(const char *path, int cmode, - size_t initialsz, int basepe, size_t *chunksizehintp, - int use_parallel, void* mpidata, - NC_Dispatch*,NC** ncp); - -static int NCD3_redef(int ncid); -static int NCD3__enddef(int ncid, size_t h_minfree, size_t v_align, size_t v_minfree, size_t r_align); -static int NCD3_sync(int ncid); -static int NCD3_abort(int ncid); - -static int NCD3_put_vara(int ncid, int varid, - const size_t *start, const size_t *edges0, - const void *value0, - nc_type memtype); - -static int NCD3_get_vara(int ncid, int varid, - const size_t *start, const size_t *edges, - void *value, - nc_type memtype); - -static int NCD3_put_vars(int ncid, int varid, - const size_t *start, const size_t *edges, const ptrdiff_t* stride, - const void *value0, nc_type memtype); - -static int NCD3_get_vars(int ncid, int varid, - const size_t *start, const size_t *edges, const ptrdiff_t* stride, - void *value, nc_type memtype); - -NC_Dispatch NCD3_dispatch_base = { - -NC_DISPATCH_NC3 | NC_DISPATCH_NCD, - -/* Note: we are using the standard substrate struct NC creator */ -NULL, - -NCD3_create, -NCD3_open, - -NCD3_redef, -NCD3__enddef, -NCD3_sync, -NCD3_abort, -NCD3_close, -NULL, /*set_fill*/ -NULL, /*inq_base_pe*/ -NULL, /*set_base_pe*/ -NULL, /*inq_format*/ - -NULL, /*inq*/ -NULL, /*inq_type*/ - -NULL, /*def_dim*/ -NULL, /*inq_dimid*/ -NULL, /*inq_dim*/ -NULL, /*inq_unlimdim*/ -NULL, /*rename_dim*/ - -NULL, /*inq_att*/ -NULL, /*inq_attid*/ -NULL, /*inq_attname*/ -NULL, /*rename_att*/ -NULL, /*del_att*/ -NULL, /*get_att*/ -NULL, /*put_att*/ - -NULL, /*def_var*/ -NULL, /*inq_varid*/ -NULL, /*rename_var*/ -NCD3_get_vara, -NCD3_put_vara, -NCD3_get_vars, -NCD3_put_vars, -NCDEFAULT_get_varm, -NCDEFAULT_put_varm, - -NULL, /*inq_var_all*/ - -#ifdef USE_NETCDF4 -NULL, /*show_metadata*/ -NULL, /*inq_unlimdims*/ -NULL, /*var_par_access*/ -NULL, /*inq_ncid*/ -NULL, /*inq_grps*/ -NULL, /*inq_grpname*/ -NULL, /*inq_grpname_full*/ -NULL, /*inq_grp_parent*/ -NULL, /*inq_grp_full_ncid*/ -NULL, /*inq_varids*/ -NULL, /*inq_dimids*/ -NULL, /*inq_typeids*/ -NULL, /*inq_type_equal*/ -NULL, /*def_grp*/ -NULL, /*inq_user_type*/ -NULL, /*inq_typeid*/ - -NULL, /*def_compound*/ -NULL, /*insert_compound*/ -NULL, /*insert_array_compound*/ -NULL, /*inq_compound_field*/ -NULL, /*inq_compound_fieldindex*/ -NULL, /*def_vlen*/ -NULL, /*put_vlen_element*/ -NULL, /*get_vlen_element*/ -NULL, /*def_enum*/ -NULL, /*insert_enum*/ -NULL, /*inq_enum_member*/ -NULL, /*inq_enum_ident*/ -NULL, /*def_opaque*/ -NULL, /*def_var_deflate*/ -NULL, /*def_var_fletcher32*/ -NULL, /*def_var_chunking*/ -NULL, /*def_var_fill*/ -NULL, /*def_var_endian*/ -NULL, /*set_var_chunk_cache*/ -NULL, /*get_var_chunk_cache*/ - -#endif /*USE_NETCDF4*/ - -}; - -NC_Dispatch* NCD3_dispatch_table = NULL; /* moved here from ddispatch.c */ - -NC_Dispatch NCD3_dispatcher; /* overlay result */ - -int -NCD3_initialize(void) -{ - /* Create our dispatch table as the merge of NCD3 table and NCSUBSTRATE */ - /* watch the order because we want NCD3 to overwrite NCSUBSTRATE */ - NC_dispatch_overlay(&NCD3_dispatch_base, NCSUBSTRATE_dispatch_table, &NCD3_dispatcher); - NCD3_dispatch_table = &NCD3_dispatcher; - return NC_NOERR; -} - -static int -NCD3_redef(int ncid) -{ - return (NC_EPERM); -} - -static int -NCD3__enddef(int ncid, size_t h_minfree, size_t v_align, size_t v_minfree, size_t r_align) -{ - return (NC_EPERM); -} - -static int -NCD3_sync(int ncid) -{ - return (NC_EINVAL); -} - -static int -NCD3_abort(int ncid) -{ - return NCD3_close(ncid); -} - -static int -NCD3_create(const char *path, int cmode, - size_t initialsz, int basepe, size_t *chunksizehintp, - int use_parallel, void* mpidata, - NC_Dispatch* dispatch, NC** ncp) -{ - return NC_EPERM; -} - -static int -NCD3_put_vara(int ncid, int varid, - const size_t *start, const size_t *edges, - const void *value, - nc_type memtype) -{ - return NC_EPERM; -} - -static int -NCD3_get_vara(int ncid, int varid, - const size_t *start, const size_t *edges, - void *value, - nc_type memtype) -{ - int stat = nc3d_getvarx(ncid, varid, start, edges, nc_ptrdiffvector1, value,memtype); - return stat; -} - -static int -NCD3_put_vars(int ncid, int varid, - const size_t *start, const size_t *edges, const ptrdiff_t* stride, - const void *value0, nc_type memtype) -{ - return NC_EPERM; -} - -static int -NCD3_get_vars(int ncid, int varid, - const size_t *start, const size_t *edges, const ptrdiff_t* stride, - void *value, nc_type memtype) -{ - int stat = nc3d_getvarx(ncid, varid, start, edges, stride, value, memtype); - return stat; -} diff --git a/xios_2311_src/trunk/.svn/pristine/26/26428ad363f61bac843ea5b684ec2dc18a3cb6df.svn-base b/xios_2311_src/trunk/.svn/pristine/26/26428ad363f61bac843ea5b684ec2dc18a3cb6df.svn-base deleted file mode 100644 index 3a3f4ad04aea912289acfe31abde7be1b2b11e65..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/26/26428ad363f61bac843ea5b684ec2dc18a3cb6df.svn-base +++ /dev/null @@ -1,130 +0,0 @@ -#ifndef __ONETCDF4_IMPL_HPP__ -#define __ONETCDF4_IMPL_HPP__ - -#include "onetcdf4.hpp" -#include "netCdfInterface.hpp" -#include "timer.hpp" - -namespace xios -{ - template - void CONetCDF4::writeData(const CArray& data, const StdString & name, - bool collective, StdSize record, - const std::vector * start, - const std::vector * count) - { - int grpid = this->getCurrentGroup(); - int varid = this->getVariable(name); - StdSize array_size = 1; - std::vector sstart, scount; - - if (this->wmpi && collective) CNetCdfInterface::varParAccess(grpid, varid, NC_COLLECTIVE); - if (this->wmpi && !collective) CNetCdfInterface::varParAccess(grpid, varid, NC_INDEPENDENT); - - CTimer::get("Files : get data infos").resume(); - this->getWriteDataInfos(name, record, array_size, sstart, scount, start, count); - CTimer::get("Files : get data infos").suspend(); - - if (data.numElements() != array_size) - { - ERROR("CONetCDF4::writeData(...)", - << "[ input array size = " << data.numElements() - << ", intern array size = " << array_size - << " ] Invalid input data !" ); - } - - if (this->wmpi && sstart.size()==0) CNetCdfInterface::varParAccess(grpid, varid, NC_INDEPENDENT); // pure scalar case - if (data.numElements()==0 && sstart.size()==0) {}// pure scalar case if nothing to write, write nothing (independent access) - else this->writeData_(grpid, varid, sstart, scount, data.dataFirst()); - } - - template <> - void CONetCDF4::writeData(const CArray& data, const StdString & name, - bool collective, StdSize record, - const std::vector * start, - const std::vector * count) - { - int grpid = this->getCurrentGroup(); - int varid = this->getVariable(name); - StdSize array_size = 1; - std::vector sstart, scount; - - if (this->wmpi && collective) - CNetCdfInterface::varParAccess(grpid, varid, NC_COLLECTIVE); - if (this->wmpi && !collective) - CNetCdfInterface::varParAccess(grpid, varid, NC_INDEPENDENT); - - CTimer::get("CONetCDF4::writeData getWriteDataInfos").resume(); - this->getWriteDataInfos(name, record, array_size, sstart, scount, start, count); - CTimer::get("CONetCDF4::writeData getWriteDataInfos").suspend(); - - int dimArrayLen; - for (int i=0; i::const_iterator it, itb=data.begin(), ite=data.end() ; - for(it=itb;it!=ite;++it, offset+=stringArrayLen) - { - it->copy(PtrArrayStr+offset,it->size()) ; - PtrArrayStr[offset+it->size()]='\0' ; - } -*/ - for(int i=0;iwriteData_(grpid, varid, sstart, scount, PtrArrayStr); - CTimer::get("CONetCDF4::writeData writeData_").suspend(); - - delete [] PtrArrayStr; - } - -//---------------------------------------------------------------- - - template - void CONetCDF4::setDefaultValue(const StdString & varname, const T * value) - { - int grpid = this->getCurrentGroup(); - int varid = this->getVariable(varname); - - if (value != NULL) - { - // nc_def_var_fill will automatically set the _FillValue attribute when - // using the NetCDF 4 format but we need to do it manually otherwise - if (useClassicFormat) - this->addAttribute(StdString("_FillValue"), *value, &varname); - else - CNetCdfInterface::defVarFill(grpid, varid, 0, (void*)value); - this->addAttribute(StdString("missing_value"), *value, &varname); - } - else if (!useClassicFormat) - { - // The "no-fill mode" is set globally for the classic NetCDF format - CNetCdfInterface::defVarFill(grpid, varid, 1, NULL); - } - } - - ///--------------------------------------------------------------- - -} - - - -#endif diff --git a/xios_2311_src/trunk/.svn/pristine/26/265493f656a2a21e1b076276c20a4d615f715d11.svn-base b/xios_2311_src/trunk/.svn/pristine/26/265493f656a2a21e1b076276c20a4d615f715d11.svn-base deleted file mode 100644 index 3129c3428d8c2cd76006673272008634c30d0898..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/26/265493f656a2a21e1b076276c20a4d615f715d11.svn-base +++ /dev/null @@ -1,152 +0,0 @@ -PROGRAM test_basic_2D - USE xios - USE mod_wait - IMPLICIT NONE - INCLUDE "mpif.h" - - TYPE(xios_duration) :: dtime - TYPE(xios_context) :: ctx_hdl - INTEGER,PARAMETER :: ni_glo=100 - INTEGER,PARAMETER :: nj_glo=100 - - INTEGER :: i,j,n,ts - INTEGER :: ibegin,jbegin,ni,nj,nbi,nbj,iend,jend - INTEGER :: ierr, rank, size - INTEGER :: comm - - DOUBLE PRECISION,DIMENSION(ni_glo,nj_glo) :: lon_glo,lat_glo - DOUBLE PRECISION :: field_glo(ni_glo,nj_glo) - DOUBLE PRECISION,ALLOCATABLE :: lon(:,:),lat(:,:),field_domain(:,:), field_axis(:,:) - - ! Initialize MPI - CALL MPI_INIT(ierr) - - CALL init_wait - - ! Initialize XIOS - CALL xios_initialize('client', return_comm=comm) - - CALL MPI_COMM_SIZE(comm, size, ierr) - CALL MPI_COMM_RANK(comm, rank, ierr) - - ! Initialize all global values - DO j=1,nj_glo - DO i=1,ni_glo - lon_glo(i,j)=(i-1)+(j-1)*ni_glo - lat_glo(i,j)=1000+(i-1)+(j-1)*ni_glo - field_glo(i,j)=(i-1)+(j-1)*ni_glo - ENDDO - ENDDO - ni=ni_glo ; ibegin=0 - - nbi = 1 - ! Specify how we distributed domain - DO i=1,int(sqrt(real(size)))+1 - IF (0 == MOD(size,i)) nbi = i - ENDDO - nbj = size/nbi - - jbegin=0; - LOOP1: DO j=1,nbj - nj=nj_glo/nbj - if (nj bool CBufferIn::get(char& data) { return get_template(data) ; } - template <> bool CBufferIn::get(bool& data) { return get_template(data) ; } - template <> bool CBufferIn::get(int& data) { return get_template(data) ; } - template <> bool CBufferIn::get(short& data) { return get_template(data) ; } - template <> bool CBufferIn::get(long& data) { return get_template(data) ; } - template <> bool CBufferIn::get(longlong& data) { return get_template(data) ; } - template <> bool CBufferIn::get(uint& data) { return get_template(data) ; } - template <> bool CBufferIn::get(ushort& data) { return get_template(data) ; } - template <> bool CBufferIn::get(ulong& data) { return get_template(data) ; } - template <> bool CBufferIn::get(ulonglong& data) { return get_template(data) ; } - template <> bool CBufferIn::get(float& data) { return get_template(data) ; } - template <> bool CBufferIn::get(double& data) { return get_template(data) ; } - template <> bool CBufferIn::get(long double& data) { return get_template(data) ;} - - template <> bool CBufferIn::get(char* data, size_t n) { return get_template(data,n) ; } - template <> bool CBufferIn::get(bool* data, size_t n) { return get_template(data,n) ; } - template <> bool CBufferIn::get(int* data, size_t n) { return get_template(data,n) ; } - template <> bool CBufferIn::get(short* data, size_t n) { return get_template(data,n) ; } - template <> bool CBufferIn::get(long* data, size_t n) { return get_template(data,n) ; } - template <> bool CBufferIn::get(longlong* data, size_t n) { return get_template(data,n) ; } - template <> bool CBufferIn::get(uint* data, size_t n) { return get_template(data,n) ; } - template <> bool CBufferIn::get(ushort* data, size_t n) { return get_template(data,n) ; } - template <> bool CBufferIn::get(ulong* data, size_t n) { return get_template(data,n) ; } - template <> bool CBufferIn::get(ulonglong* data, size_t n) { return get_template(data,n) ; } - template <> bool CBufferIn::get(float* data, size_t n) { return get_template(data,n) ; } - template <> bool CBufferIn::get(double* data, size_t n) { return get_template(data,n) ; } - template <> bool CBufferIn::get(long double* data, size_t n) { return get_template(data,n) ;} - - template <> bool CBufferIn::advance(size_t n) { return advance_template(n) ; } - template <> bool CBufferIn::advance(size_t n) { return advance_template(n) ; } - template <> bool CBufferIn::advance(size_t n) { return advance_template(n) ; } - template <> bool CBufferIn::advance(size_t n) { return advance_template(n) ; } - template <> bool CBufferIn::advance(size_t n) { return advance_template(n) ; } - template <> bool CBufferIn::advance(size_t n) { return advance_template(n) ; } - template <> bool CBufferIn::advance(size_t n) { return advance_template(n) ; } - template <> bool CBufferIn::advance(size_t n) { return advance_template(n) ; } - template <> bool CBufferIn::advance(size_t n) { return advance_template(n) ; } - template <> bool CBufferIn::advance(size_t n) { return advance_template(n) ; } - template <> bool CBufferIn::advance(size_t n) { return advance_template(n) ; } - template <> bool CBufferIn::advance(size_t n) { return advance_template(n) ; } - template <> bool CBufferIn::advance(size_t n) { return advance_template(n) ;} - - template - bool CBufferIn::get_template(T& data) - { - return get_template(&data,1) ; - } - - template - bool CBufferIn::get_template(T* data, size_t n) - { - bool ret; - char* dataBuff ; - - size_t dataSize=sizeof(T)*n ; - - if (count_+dataSize<=size_) - { - dataBuff=(char*) data ; - for(size_t i=0;i - bool CBufferIn::advance_template(size_t n) - { - bool ret; - char* dataBuff ; - - size_t dataSize=sizeof(T)*n ; - - if (count_+dataSize<=size_) - { - current+=dataSize ; - count_+=dataSize ; - ret=true ; - } - else ret=false ; - - return ret ; - } - -} - - -#endif diff --git a/xios_2311_src/trunk/.svn/pristine/26/2691a37647052d754af0606f36ae2e892bffb245.svn-base b/xios_2311_src/trunk/.svn/pristine/26/2691a37647052d754af0606f36ae2e892bffb245.svn-base deleted file mode 100644 index 70186467c5ed6aca96b6b641b783ca6bf0d37e16..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/26/2691a37647052d754af0606f36ae2e892bffb245.svn-base +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef __GRID_ELEMENTS_HPP__ -#define __GRID_ELEMENTS_HPP__ - -#include "xios_spl.hpp" -#include "array_new.hpp" -#include "element.hpp" - -namespace xios -{ - class CGridLocalView ; - class CGridLocalConnector ; - - class CGridLocalElements : public std::enable_shared_from_this - { - private: - std::vector> elements_ ; - std::vector> views_= std::vector>(CElementView::numViewType_) ; - std::map, shared_ptr> connectors_ ; - vector localMask_ ; - - public: - CGridLocalElements(vector > elements) : elements_(elements) {} - CGridLocalElements(vector> elements, vector& localMask) : elements_(elements), localMask_(localMask) {} - - bool hasLocalMask() { return !localMask_.empty() ;} - vector& getLocalMask(void) { return localMask_ ;} - - std::vector>& getElements(void) { return elements_ ; } - shared_ptr getView(CElementView::type type) ; - shared_ptr getConnector(CElementView::type srcType, CElementView::type dstType, bool withMask=false) ; - } ; -} - -#endif \ No newline at end of file diff --git a/xios_2311_src/trunk/.svn/pristine/26/269270c8b470a1bfef6102c77aef38a298d22798.svn-base b/xios_2311_src/trunk/.svn/pristine/26/269270c8b470a1bfef6102c77aef38a298d22798.svn-base deleted file mode 100644 index c877559a2cc7f4e51f3c51d691b8b62173dfa6dc..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/26/269270c8b470a1bfef6102c77aef38a298d22798.svn-base +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef __XIOS_IFilterEngine__ -#define __XIOS_IFilterEngine__ - -#include "data_packet.hpp" - -namespace xios -{ - /*! - * An engine filter processes the data handled by a filter. - */ - class IFilterEngine - { - public: - /*! - * Processes the data and returns a new packet if needed. - * Temporal filter engines will not return a new packet - * for every call being that they accumulate data. - * The filter engine is not allowed to modify the data - * in place. - * - * \param data a vector of packets corresponding to each slot - * \return a new data packet or null if the engine is accumulating data - */ - CDataPacketPtr virtual apply(std::vector data) = 0; - }; // class IFilterEngine -} // namespace xios - -#endif //__XIOS_IFilterEngine__ diff --git a/xios_2311_src/trunk/.svn/pristine/26/26e3b6eef92a9057083ebe69448319cc55e9ede0.svn-base b/xios_2311_src/trunk/.svn/pristine/26/26e3b6eef92a9057083ebe69448319cc55e9ede0.svn-base deleted file mode 100644 index c9dc4b9ceff2013d521ebd8f23b7f3f56844cd0c..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/26/26e3b6eef92a9057083ebe69448319cc55e9ede0.svn-base +++ /dev/null @@ -1,49 +0,0 @@ -#include "allleap.hpp" - -namespace xios -{ - /// ////////////////////// Définitions ////////////////////// /// - - CAllLeapCalendar::CAllLeapCalendar(const CDate& startDate) - : CCalendar("AllLeap", startDate) - { - // This will check that the dates are conform with the calendar. - // We cannot call this from the parent constructor because we - // want the methods of this class to be used - initializeDate(); - } - - CAllLeapCalendar::CAllLeapCalendar(const CDate& startDate, const CDate& timeOrigin) - : CCalendar("AllLeap", startDate, timeOrigin) - { - // This will check that the dates are conform with the calendar. - // We cannot call this from the parent constructor because we - // want the methods of this class to be used - initializeDate(); - } - - CAllLeapCalendar::CAllLeapCalendar(int yr, int mth, int d, - int hr, int min, int sec) - : CCalendar("AllLeap") - { initializeDate(yr, mth, d, hr, min, sec) ; } - - CAllLeapCalendar::~CAllLeapCalendar(void) - { /* Ne rien faire de plus */ } - - ///-------------------------------------------------------------- - - int CAllLeapCalendar::getYearTotalLength(const CDate & date) const - { return (366 * 86400); } - - int CAllLeapCalendar::getMonthLength(const CDate & date) const - { - if (date.getMonth() == 2) return (29); - return (CCalendar::getMonthLength(date)); - } - - StdString CAllLeapCalendar::getType(void) const - { return (StdString("all_leap")); } - - ///-------------------------------------------------------------- -} // namespace xios - diff --git a/xios_2311_src/trunk/.svn/pristine/26/26ef59c0f65b005c1f2c2383cebc8c2e807f0405.svn-base b/xios_2311_src/trunk/.svn/pristine/26/26ef59c0f65b005c1f2c2383cebc8c2e807f0405.svn-base deleted file mode 100644 index 66cbb8731c67440283289d6fd4f9567b7bf75b55..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/26/26ef59c0f65b005c1f2c2383cebc8c2e807f0405.svn-base +++ /dev/null @@ -1,11 +0,0 @@ -#include "window_manager.hpp" -#include "mpi.hpp" - - - -namespace xios -{ - - -} - diff --git a/xios_2311_src/trunk/.svn/pristine/27/2710693d5cbf42b3274b9301f49ca39c422f2f10.svn-base b/xios_2311_src/trunk/.svn/pristine/27/2710693d5cbf42b3274b9301f49ca39c422f2f10.svn-base deleted file mode 100644 index 8bed597fc41f7a4011ae56cf1984d06666961f06..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/27/2710693d5cbf42b3274b9301f49ca39c422f2f10.svn-base +++ /dev/null @@ -1,41 +0,0 @@ -/*! - \file max.hpp - \author Ha NGUYEN - \since 27 June 2016 - \date 27 June 2016 - - \brief Max reduction - */ -#ifndef __XIOS_REDUCTION_MAX_ALGORITHM_HPP__ -#define __XIOS_REDUCTION_MAX_ALGORITHM_HPP__ - -#include "reduction.hpp" - -namespace xios { - -/*! - \class CMaxReductionAlgorithm - Interface for all reduction alogrithms. -*/ -class CMaxReductionAlgorithm : public CReductionAlgorithm -{ -public: - CMaxReductionAlgorithm(); - - virtual void apply(const std::vector >& localIndex, - const double* dataInput, - CArray& dataOut, - std::vector& flagInitial, - bool ignoreMissingValue, bool firstPass); - - virtual ~CMaxReductionAlgorithm() {} - -public: - static bool registerTrans(); - -protected: - static CReductionAlgorithm* create(); -}; - -} -#endif // __XIOS_REDUCTION_MAX_ALGORITHM_HPP__ diff --git a/xios_2311_src/trunk/.svn/pristine/27/27bb2c5aaf26422b49b194765da998941827e100.svn-base b/xios_2311_src/trunk/.svn/pristine/27/27bb2c5aaf26422b49b194765da998941827e100.svn-base deleted file mode 100644 index 712684c33feac68e23ccd1f62748e877c542278d..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/27/27bb2c5aaf26422b49b194765da998941827e100.svn-base +++ /dev/null @@ -1,58 +0,0 @@ -#ifndef __XIOS_MODEL_TO_CLIENT_SOURCE_FILTER_HPP__ -#define __XIOS_MODEL_TO_CLIENT_SOURCE_FILTER_HPP__ - -#include - -#include "output_pin.hpp" - -namespace xios -{ - class CGrid; - - /*! - * A source filter is the entry point of the data in the graph of filters. - */ - class CModelToClientSourceFilter : public COutputPin - { - public: - /*! - * Constructs a source filter accepting data attached to the specified grid. - * - * \param gc the garbage collector associated with this filter - * \param grid the grid to which the data is attached - * \param hasMissingValue whether data has missing value - * \param defaultValue missing value to detect - */ - CModelToClientSourceFilter(CGarbageCollector& gc, CGrid* grid, bool hasMissingValue = false, double defaultValue = 0.0); - - /*! - * Transforms the data received from the model into a packet and send it - * in the filter graph. The array containing the data can safely be reused - * immediately after this method returns. - * - * \param date the date associated to the data - * \param data an array containing the data - */ - template - void streamData(CDate date, const CArray& data); - - void buildWorkflowGraph(CDataPacketPtr packet); - - - /*! - * Transforms the data received from the server into a packet and send it - * in the filter graph. The array containing the data can safely be reused - * immediately after this method returns. - * - * \param date the date associated to the data - * \param data an array containing the data - */ - - private: - CGrid* grid_; //!< The grid attached to the data the filter can accept - const bool hasMissingValue_; - const double defaultValue_; - }; // class CSourceFilter -} // namespace xios - -#endif // __XIOS_MODEL_TO_CLIENT_SOURCE_FILTER_HPP__ diff --git a/xios_2311_src/trunk/.svn/pristine/28/282461a8a9e2d1642cc97ade11392beac35b6d39.svn-base b/xios_2311_src/trunk/.svn/pristine/28/282461a8a9e2d1642cc97ade11392beac35b6d39.svn-base deleted file mode 100644 index 1d2b1a991b7c445a586de4b5ba1ad0f30918394a..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/28/282461a8a9e2d1642cc97ade11392beac35b6d39.svn-base +++ /dev/null @@ -1,397 +0,0 @@ -/* ************************************************************************** * - * Interface auto generated - do not modify * - * ************************************************************************** */ - -#include -#include "xios.hpp" -#include "attribute_template.hpp" -#include "object_template.hpp" -#include "group_template.hpp" -#include "icutil.hpp" -#include "icdate.hpp" -#include "timer.hpp" -#include "node_type.hpp" - -extern "C" -{ - typedef xios::CScalarGroup* scalargroup_Ptr; - - void cxios_set_scalargroup_axis_type(scalargroup_Ptr scalargroup_hdl, const char * axis_type, int axis_type_size) - { - std::string axis_type_str; - if (!cstr2string(axis_type, axis_type_size, axis_type_str)) return; - CTimer::get("XIOS").resume(); - scalargroup_hdl->axis_type.fromString(axis_type_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_scalargroup_axis_type(scalargroup_Ptr scalargroup_hdl, char * axis_type, int axis_type_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(scalargroup_hdl->axis_type.getInheritedStringValue(), axis_type, axis_type_size)) - ERROR("void cxios_get_scalargroup_axis_type(scalargroup_Ptr scalargroup_hdl, char * axis_type, int axis_type_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_scalargroup_axis_type(scalargroup_Ptr scalargroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = scalargroup_hdl->axis_type.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_scalargroup_bounds(scalargroup_Ptr scalargroup_hdl, double* bounds, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(bounds, shape(extent[0]), neverDeleteData); - scalargroup_hdl->bounds.reference(tmp.copy()); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_scalargroup_bounds(scalargroup_Ptr scalargroup_hdl, double* bounds, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(bounds, shape(extent[0]), neverDeleteData); - tmp=scalargroup_hdl->bounds.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_scalargroup_bounds(scalargroup_Ptr scalargroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = scalargroup_hdl->bounds.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_scalargroup_bounds_name(scalargroup_Ptr scalargroup_hdl, const char * bounds_name, int bounds_name_size) - { - std::string bounds_name_str; - if (!cstr2string(bounds_name, bounds_name_size, bounds_name_str)) return; - CTimer::get("XIOS").resume(); - scalargroup_hdl->bounds_name.setValue(bounds_name_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_scalargroup_bounds_name(scalargroup_Ptr scalargroup_hdl, char * bounds_name, int bounds_name_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(scalargroup_hdl->bounds_name.getInheritedValue(), bounds_name, bounds_name_size)) - ERROR("void cxios_get_scalargroup_bounds_name(scalargroup_Ptr scalargroup_hdl, char * bounds_name, int bounds_name_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_scalargroup_bounds_name(scalargroup_Ptr scalargroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = scalargroup_hdl->bounds_name.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_scalargroup_comment(scalargroup_Ptr scalargroup_hdl, const char * comment, int comment_size) - { - std::string comment_str; - if (!cstr2string(comment, comment_size, comment_str)) return; - CTimer::get("XIOS").resume(); - scalargroup_hdl->comment.setValue(comment_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_scalargroup_comment(scalargroup_Ptr scalargroup_hdl, char * comment, int comment_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(scalargroup_hdl->comment.getInheritedValue(), comment, comment_size)) - ERROR("void cxios_get_scalargroup_comment(scalargroup_Ptr scalargroup_hdl, char * comment, int comment_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_scalargroup_comment(scalargroup_Ptr scalargroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = scalargroup_hdl->comment.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_scalargroup_group_ref(scalargroup_Ptr scalargroup_hdl, const char * group_ref, int group_ref_size) - { - std::string group_ref_str; - if (!cstr2string(group_ref, group_ref_size, group_ref_str)) return; - CTimer::get("XIOS").resume(); - scalargroup_hdl->group_ref.setValue(group_ref_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_scalargroup_group_ref(scalargroup_Ptr scalargroup_hdl, char * group_ref, int group_ref_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(scalargroup_hdl->group_ref.getInheritedValue(), group_ref, group_ref_size)) - ERROR("void cxios_get_scalargroup_group_ref(scalargroup_Ptr scalargroup_hdl, char * group_ref, int group_ref_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_scalargroup_group_ref(scalargroup_Ptr scalargroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = scalargroup_hdl->group_ref.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_scalargroup_label(scalargroup_Ptr scalargroup_hdl, const char * label, int label_size) - { - std::string label_str; - if (!cstr2string(label, label_size, label_str)) return; - CTimer::get("XIOS").resume(); - scalargroup_hdl->label.setValue(label_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_scalargroup_label(scalargroup_Ptr scalargroup_hdl, char * label, int label_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(scalargroup_hdl->label.getInheritedValue(), label, label_size)) - ERROR("void cxios_get_scalargroup_label(scalargroup_Ptr scalargroup_hdl, char * label, int label_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_scalargroup_label(scalargroup_Ptr scalargroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = scalargroup_hdl->label.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_scalargroup_long_name(scalargroup_Ptr scalargroup_hdl, const char * long_name, int long_name_size) - { - std::string long_name_str; - if (!cstr2string(long_name, long_name_size, long_name_str)) return; - CTimer::get("XIOS").resume(); - scalargroup_hdl->long_name.setValue(long_name_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_scalargroup_long_name(scalargroup_Ptr scalargroup_hdl, char * long_name, int long_name_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(scalargroup_hdl->long_name.getInheritedValue(), long_name, long_name_size)) - ERROR("void cxios_get_scalargroup_long_name(scalargroup_Ptr scalargroup_hdl, char * long_name, int long_name_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_scalargroup_long_name(scalargroup_Ptr scalargroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = scalargroup_hdl->long_name.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_scalargroup_mask(scalargroup_Ptr scalargroup_hdl, bool mask) - { - CTimer::get("XIOS").resume(); - scalargroup_hdl->mask.setValue(mask); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_scalargroup_mask(scalargroup_Ptr scalargroup_hdl, bool* mask) - { - CTimer::get("XIOS").resume(); - *mask = scalargroup_hdl->mask.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_scalargroup_mask(scalargroup_Ptr scalargroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = scalargroup_hdl->mask.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_scalargroup_name(scalargroup_Ptr scalargroup_hdl, const char * name, int name_size) - { - std::string name_str; - if (!cstr2string(name, name_size, name_str)) return; - CTimer::get("XIOS").resume(); - scalargroup_hdl->name.setValue(name_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_scalargroup_name(scalargroup_Ptr scalargroup_hdl, char * name, int name_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(scalargroup_hdl->name.getInheritedValue(), name, name_size)) - ERROR("void cxios_get_scalargroup_name(scalargroup_Ptr scalargroup_hdl, char * name, int name_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_scalargroup_name(scalargroup_Ptr scalargroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = scalargroup_hdl->name.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_scalargroup_positive(scalargroup_Ptr scalargroup_hdl, const char * positive, int positive_size) - { - std::string positive_str; - if (!cstr2string(positive, positive_size, positive_str)) return; - CTimer::get("XIOS").resume(); - scalargroup_hdl->positive.fromString(positive_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_scalargroup_positive(scalargroup_Ptr scalargroup_hdl, char * positive, int positive_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(scalargroup_hdl->positive.getInheritedStringValue(), positive, positive_size)) - ERROR("void cxios_get_scalargroup_positive(scalargroup_Ptr scalargroup_hdl, char * positive, int positive_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_scalargroup_positive(scalargroup_Ptr scalargroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = scalargroup_hdl->positive.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_scalargroup_prec(scalargroup_Ptr scalargroup_hdl, int prec) - { - CTimer::get("XIOS").resume(); - scalargroup_hdl->prec.setValue(prec); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_scalargroup_prec(scalargroup_Ptr scalargroup_hdl, int* prec) - { - CTimer::get("XIOS").resume(); - *prec = scalargroup_hdl->prec.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_scalargroup_prec(scalargroup_Ptr scalargroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = scalargroup_hdl->prec.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_scalargroup_scalar_ref(scalargroup_Ptr scalargroup_hdl, const char * scalar_ref, int scalar_ref_size) - { - std::string scalar_ref_str; - if (!cstr2string(scalar_ref, scalar_ref_size, scalar_ref_str)) return; - CTimer::get("XIOS").resume(); - scalargroup_hdl->scalar_ref.setValue(scalar_ref_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_scalargroup_scalar_ref(scalargroup_Ptr scalargroup_hdl, char * scalar_ref, int scalar_ref_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(scalargroup_hdl->scalar_ref.getInheritedValue(), scalar_ref, scalar_ref_size)) - ERROR("void cxios_get_scalargroup_scalar_ref(scalargroup_Ptr scalargroup_hdl, char * scalar_ref, int scalar_ref_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_scalargroup_scalar_ref(scalargroup_Ptr scalargroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = scalargroup_hdl->scalar_ref.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_scalargroup_standard_name(scalargroup_Ptr scalargroup_hdl, const char * standard_name, int standard_name_size) - { - std::string standard_name_str; - if (!cstr2string(standard_name, standard_name_size, standard_name_str)) return; - CTimer::get("XIOS").resume(); - scalargroup_hdl->standard_name.setValue(standard_name_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_scalargroup_standard_name(scalargroup_Ptr scalargroup_hdl, char * standard_name, int standard_name_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(scalargroup_hdl->standard_name.getInheritedValue(), standard_name, standard_name_size)) - ERROR("void cxios_get_scalargroup_standard_name(scalargroup_Ptr scalargroup_hdl, char * standard_name, int standard_name_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_scalargroup_standard_name(scalargroup_Ptr scalargroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = scalargroup_hdl->standard_name.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_scalargroup_unit(scalargroup_Ptr scalargroup_hdl, const char * unit, int unit_size) - { - std::string unit_str; - if (!cstr2string(unit, unit_size, unit_str)) return; - CTimer::get("XIOS").resume(); - scalargroup_hdl->unit.setValue(unit_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_scalargroup_unit(scalargroup_Ptr scalargroup_hdl, char * unit, int unit_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(scalargroup_hdl->unit.getInheritedValue(), unit, unit_size)) - ERROR("void cxios_get_scalargroup_unit(scalargroup_Ptr scalargroup_hdl, char * unit, int unit_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_scalargroup_unit(scalargroup_Ptr scalargroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = scalargroup_hdl->unit.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_scalargroup_value(scalargroup_Ptr scalargroup_hdl, double value) - { - CTimer::get("XIOS").resume(); - scalargroup_hdl->value.setValue(value); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_scalargroup_value(scalargroup_Ptr scalargroup_hdl, double* value) - { - CTimer::get("XIOS").resume(); - *value = scalargroup_hdl->value.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_scalargroup_value(scalargroup_Ptr scalargroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = scalargroup_hdl->value.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } -} diff --git a/xios_2311_src/trunk/.svn/pristine/28/2859e3444c2181a65e7a4b4dc2acc2fc9b4ce7cc.svn-base b/xios_2311_src/trunk/.svn/pristine/28/2859e3444c2181a65e7a4b4dc2acc2fc9b4ce7cc.svn-base deleted file mode 100644 index f958c57fb1a91e0c6cc408b446489852b149b481..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/28/2859e3444c2181a65e7a4b4dc2acc2fc9b4ce7cc.svn-base +++ /dev/null @@ -1,88 +0,0 @@ -/*! - \file server_distribution_description.hpp - \author Ha NGUYEN - \since 04 Jan 2015 - \date 11 Jan 2016 - - \brief Description of index distribution on server(s). - */ - -#ifndef __XIOS_SERVER_DISTRIBUTION_DESCRIPTION_HPP -#define __XIOS_SERVER_DISTRIBUTION_DESCRIPTION_HPP - -#include "xios_spl.hpp" -#include "array_new.hpp" -#include - -namespace xios -{ -/*! - \class CServerDistributionDescription - This class contains information that describe distribution of servers. -*/ -class CServerDistributionDescription -{ - public: - enum ServerDistributionType - { - BAND_DISTRIBUTION, PLAN_DISTRIBUTION, ROOT_DISTRIBUTION - }; - - /** Default constructor */ - CServerDistributionDescription(const std::vector& globalDimensionSize, - int nServer, - ServerDistributionType serType=BAND_DISTRIBUTION); - - /** Default destructor */ - virtual ~CServerDistributionDescription(); - - void computeServerDistribution(bool doComputeGlobalIndex = false, int positionDimensionDistributed = 1); - std::vector computeServerGlobalIndexInRange(const std::pair& indexBeginEnd, int positionDimensionDistributed = 1); - std::vector computeServerGlobalByElement(std::vector > >& indexServerOnElement, - int rank, - int clientSize, - const CArray& axisDomainOrder, - int positionDimensionDistributed = 1); - - std::vector > getServerIndexBegin() const; - std::vector > getServerDimensionSizes() const; - const std::vector >& getGlobalIndex() const; - const std::unordered_map& getGlobalIndexRange() const; - int getDimensionDistributed(); - - static int defaultDistributedDimension(int gridDimension, - ServerDistributionType serType=BAND_DISTRIBUTION); - - protected: - int computeBandDistribution(int nServer, int positionDimensionDistributed = 1); - int computeRootDistribution(int nServer, int positionDimensionDistributed = 1); - void computePlanDistribution(int nServer); - void computeRangeProcIndex(int clientRank, - int clientSize, - int rangeProcSize, - int& rangeBegin, - int& rangeSize); - - private: - std::vector > indexBegin_; //!< Begin index of each dimension - std::vector > dimensionSizes_; //!< Size of each dimension - std::vector nGlobal_; //!< Global size of each dimension - - //!< General case, index describes distribution of each server (rarely use) - std::vector > vecGlobalIndex_; - - //!< In case we need only global index of one server with specific rank - std::unordered_map globalIndex_; - - //!< Type of distribution on server side - ServerDistributionType serverType_; - - //!< Number of server - int nServer_; - - //!< Position of dimension distributed on server side (by default, the second dimension) - int positionDimensionDistributed_; -}; - -} // namespace xios -#endif // __XIOS_SERVER_DISTRIBUTION_DESCRIPTION_HPP diff --git a/xios_2311_src/trunk/.svn/pristine/28/2861b94f49a279082f0ba5a02ffc6d1dabf75476.svn-base b/xios_2311_src/trunk/.svn/pristine/28/2861b94f49a279082f0ba5a02ffc6d1dabf75476.svn-base deleted file mode 100644 index 4b1f742f5c234ff866fb2f5bf774bd81dc3e721a..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/28/2861b94f49a279082f0ba5a02ffc6d1dabf75476.svn-base +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef __XIOS_CFunctor__ -#define __XIOS_CFunctor__ - -/// XIOS headers /// -#include "xios_spl.hpp" -#include "exception.hpp" -#include "array_new.hpp" - -namespace xios -{ - namespace func - { - /// ////////////////////// Déclarations ////////////////////// /// - class CFunctor : public CObject - { - /// Définition de type /// - typedef CObject SuperClass; - public : - enum ETimeType { once, instant, centered } ; - - /// Accesseurs /// - CArray getDataOutput(void) const; - /// Opérateur /// - CArray operator ()(const CArray& dinput); - virtual ETimeType timeType(void) = 0 ; - - /// Destructeur /// - virtual ~CFunctor(void); - - //Traitement /// - virtual void final(void); - - protected : - - /// Traitement /// - virtual void apply(const CArray& dinput, CArray& doutput) = 0; - - /// Autres /// - virtual StdString toString(void) const; - virtual void fromString(const StdString & str); - - /// Constructeurs /// - CFunctor(void); // Not implemented. - CFunctor(const StdString & id, CArray& doutput); - CFunctor(const StdString & id, CArray& doutput, double missingValue); - CFunctor(const CFunctor & functor); // Not implemented. - CFunctor(const CFunctor * const functor); // Not implemented. - protected : - /// Propriétés privées /// - CArray& doutput; - /// Propriétés protégées /// - int nbcall; - bool hasMissingValue ; - double missingValue ; - CArray nbcalls ; - }; // class CFunctor - } // namespace func -} // namespace xios - -//#include "functor_type.hpp" - -#endif // __XIOS_CFunctor__ diff --git a/xios_2311_src/trunk/.svn/pristine/28/28696442b43602f718726ee22eb50cdd82f8ddbd.svn-base b/xios_2311_src/trunk/.svn/pristine/28/28696442b43602f718726ee22eb50cdd82f8ddbd.svn-base deleted file mode 100644 index 636878ddb0e39039f0ec9f52d287907d128aed1d..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/28/28696442b43602f718726ee22eb50cdd82f8ddbd.svn-base +++ /dev/null @@ -1,15 +0,0 @@ -NETCDF_INCDIR="-I/smplocal/pub/NetCDF/4.1.3/mpi/include" -NETCDF_LIBDIR="-L/smplocal/pub/NetCDF/4.1.3/mpi/lib" -NETCDF_LIB="-lnetcdff -lnetcdf" - -MPI_INCDIR="" -MPI_LIBDIR="" -MPI_LIB="" - -HDF5_INCDIR="-I/smplocal/pub/HDF5/1.8.9/par/include" -HDF5_LIBDIR="-L/smplocal/pub/HDF5/1.8.9/par/lib" -HDF5_LIB="-lhdf5_hl -lhdf5 -lhdf5 -lz" - -OASIS_INCDIR="-I$PWD/../../oasis3-mct/BLD/build/lib/psmile.MPI1" -OASIS_LIBDIR="-L$PWD/../../oasis3-mct/BLD/lib" -OASIS_LIB="-lpsmile.MPI1 -lscrip -lmct -lmpeu" diff --git a/xios_2311_src/trunk/.svn/pristine/28/287f4ca01dc9b564d7556a8f7b0eaad6bf799d3f.svn-base b/xios_2311_src/trunk/.svn/pristine/28/287f4ca01dc9b564d7556a8f7b0eaad6bf799d3f.svn-base deleted file mode 100644 index 26ec954f126570590259749d7b430cadbc143508..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/28/287f4ca01dc9b564d7556a8f7b0eaad6bf799d3f.svn-base +++ /dev/null @@ -1,15 +0,0 @@ -NETCDF_INCDIR="-I $NETCDF_INC_DIR" -NETCDF_LIBDIR="" -NETCDF_LIB="-lnetcdf -lpnetcdf" - -MPI_INCDIR="" -MPI_LIBDIR="" -MPI_LIB="" - -HDF5_INCDIR="" -HDF5_LIBDIR="" -HDF5_LIB="-lhdf5_hl -lhdf5 -lhdf5 -lz" - -OASIS_INCDIR="-I$PWD/../../oasis3-mct/BLD/build/lib/psmile.MPI1" -OASIS_LIBDIR="-L$PWD/../../oasis3-mct/BLD/lib" -OASIS_LIB="-lpsmile.MPI1 -lscrip -lmct -lmpeu" diff --git a/xios_2311_src/trunk/.svn/pristine/28/2883cf1649e1310e5c448f43243cf31622144a75.svn-base b/xios_2311_src/trunk/.svn/pristine/28/2883cf1649e1310e5c448f43243cf31622144a75.svn-base deleted file mode 100644 index 88150a6ddfb0b414cea56c15c4f5b0ded183299e..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/28/2883cf1649e1310e5c448f43243cf31622144a75.svn-base +++ /dev/null @@ -1,43 +0,0 @@ -/*! - \file extract.cpp - \author Ha NGUYEN - \since 27 June 2016 - \date 27 June 2016 - - \brief extract reduction - */ -#include "extract.hpp" - -namespace xios { - -CExtractReductionAlgorithm::CExtractReductionAlgorithm() - : CReductionAlgorithm() -{ -} - -CReductionAlgorithm* CExtractReductionAlgorithm::create() -{ - return (new CExtractReductionAlgorithm()); -} - -bool CExtractReductionAlgorithm::registerTrans() -{ - return registerOperation(TRANS_REDUCE_EXTRACT, CExtractReductionAlgorithm::create); -} - -void CExtractReductionAlgorithm::apply(const std::vector >& localIndex, - const double* dataInput, - CArray& dataOut, - std::vector& flagInitial, - bool ignoreMissingValue, bool firstPass) -{ - int nbLocalIndex = localIndex.size(); - int currentlocalIndex = 0; - for (int idx = 0; idx < nbLocalIndex; ++idx) - { - currentlocalIndex = localIndex[idx].first; - dataOut(currentlocalIndex) = *(dataInput + idx); - } -} - -} diff --git a/xios_2311_src/trunk/.svn/pristine/28/28de57cf935e5b2b868b13e7ad9d10e5ab0408eb.svn-base b/xios_2311_src/trunk/.svn/pristine/28/28de57cf935e5b2b868b13e7ad9d10e5ab0408eb.svn-base deleted file mode 100644 index 1613fca5b606496691e6b5b6520afdf1772866de..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/28/28de57cf935e5b2b868b13e7ad9d10e5ab0408eb.svn-base +++ /dev/null @@ -1,512 +0,0 @@ - -CONTRAT DE LICENCE DE LOGICIEL LIBRE CeCILL - - - Avertissement - -Ce contrat est une licence de logiciel libre issue d'une concertation -entre ses auteurs afin que le respect de deux grands principes préside à -sa rédaction: - - * d'une part, le respect des principes de diffusion des logiciels - libres: accès au code source, droits étendus conférés aux - utilisateurs, - * d'autre part, la désignation d'un droit applicable, le droit - français, auquel elle est conforme, tant au regard du droit de la - responsabilité civile que du droit de la propriété intellectuelle - et de la protection qu'il offre aux auteurs et titulaires des - droits patrimoniaux sur un logiciel. - -Les auteurs de la licence CeCILL (pour Ce[a] C[nrs] I[nria] L[ogiciel] -L[ibre]) sont: - -Commissariat à l'Energie Atomique - CEA, établissement public de -recherche à caractère scientifique, technique et industriel, dont le -siège est situé 25 rue Leblanc, immeuble Le Ponant D, 75015 Paris. - -Centre National de la Recherche Scientifique - CNRS, établissement -public à caractère scientifique et technologique, dont le siège est -situé 3 rue Michel-Ange, 75794 Paris cedex 16. - -Institut National de Recherche en Informatique et en Automatique - -INRIA, établissement public à caractère scientifique et technologique, -dont le siège est situé Domaine de Voluceau, Rocquencourt, BP 105, 78153 -Le Chesnay cedex. - - - Préambule - -Ce contrat est une licence de logiciel libre dont l'objectif est de -conférer aux utilisateurs la liberté de modification et de -redistribution du logiciel régi par cette licence dans le cadre d'un -modèle de diffusion en logiciel libre. - -L'exercice de ces libertés est assorti de certains devoirs à la charge -des utilisateurs afin de préserver ce statut au cours des -redistributions ultérieures. - -L'accessibilité au code source et les droits de copie, de modification -et de redistribution qui en découlent ont pour contrepartie de n'offrir -aux utilisateurs qu'une garantie limitée et de ne faire peser sur -l'auteur du logiciel, le titulaire des droits patrimoniaux et les -concédants successifs qu'une responsabilité restreinte. - -A cet égard l'attention de l'utilisateur est attirée sur les risques -associés au chargement, à l'utilisation, à la modification et/ou au -développement et à la reproduction du logiciel par l'utilisateur étant -donné sa spécificité de logiciel libre, qui peut le rendre complexe à -manipuler et qui le réserve donc à des développeurs ou des -professionnels avertis possédant des connaissances informatiques -approfondies. Les utilisateurs sont donc invités à charger et tester -l'adéquation du logiciel à leurs besoins dans des conditions permettant -d'assurer la sécurité de leurs systèmes et/ou de leurs données et, plus -généralement, à l'utiliser et l'exploiter dans les mêmes conditions de -sécurité. Ce contrat peut être reproduit et diffusé librement, sous -réserve de le conserver en l'état, sans ajout ni suppression de clauses. - -Ce contrat est susceptible de s'appliquer à tout logiciel dont le -titulaire des droits patrimoniaux décide de soumettre l'exploitation aux -dispositions qu'il contient. - - - Article 1 - DEFINITIONS - -Dans ce contrat, les termes suivants, lorsqu'ils seront écrits avec une -lettre capitale, auront la signification suivante: - -Contrat: désigne le présent contrat de licence, ses éventuelles versions -postérieures et annexes. - -Logiciel: désigne le logiciel sous sa forme de Code Objet et/ou de Code -Source et le cas échéant sa documentation, dans leur état au moment de -l'acceptation du Contrat par le Licencié. - -Logiciel Initial: désigne le Logiciel sous sa forme de Code Source et -éventuellement de Code Objet et le cas échéant sa documentation, dans -leur état au moment de leur première diffusion sous les termes du Contrat. - -Logiciel Modifié: désigne le Logiciel modifié par au moins une -Contribution. - -Code Source: désigne l'ensemble des instructions et des lignes de -programme du Logiciel et auquel l'accès est nécessaire en vue de -modifier le Logiciel. - -Code Objet: désigne les fichiers binaires issus de la compilation du -Code Source. - -Titulaire: désigne le ou les détenteurs des droits patrimoniaux d'auteur -sur le Logiciel Initial. - -Licencié: désigne le ou les utilisateurs du Logiciel ayant accepté le -Contrat. - -Contributeur: désigne le Licencié auteur d'au moins une Contribution. - -Concédant: désigne le Titulaire ou toute personne physique ou morale -distribuant le Logiciel sous le Contrat. - -Contribution: désigne l'ensemble des modifications, corrections, -traductions, adaptations et/ou nouvelles fonctionnalités intégrées dans -le Logiciel par tout Contributeur, ainsi que tout Module Interne. - -Module: désigne un ensemble de fichiers sources y compris leur -documentation qui permet de réaliser des fonctionnalités ou services -supplémentaires à ceux fournis par le Logiciel. - -Module Externe: désigne tout Module, non dérivé du Logiciel, tel que ce -Module et le Logiciel s'exécutent dans des espaces d'adressage -différents, l'un appelant l'autre au moment de leur exécution. - -Module Interne: désigne tout Module lié au Logiciel de telle sorte -qu'ils s'exécutent dans le même espace d'adressage. - -GNU GPL: désigne la GNU General Public License dans sa version 2 ou -toute version ultérieure, telle que publiée par Free Software Foundation -Inc. - -Parties: désigne collectivement le Licencié et le Concédant. - -Ces termes s'entendent au singulier comme au pluriel. - - - Article 2 - OBJET - -Le Contrat a pour objet la concession par le Concédant au Licencié d'une -licence non exclusive, cessible et mondiale du Logiciel telle que -définie ci-après à l'article 5 pour toute la durée de protection des droits -portant sur ce Logiciel. - - - Article 3 - ACCEPTATION - -3.1 L'acceptation par le Licencié des termes du Contrat est réputée -acquise du fait du premier des faits suivants: - - * (i) le chargement du Logiciel par tout moyen notamment par - téléchargement à partir d'un serveur distant ou par chargement à - partir d'un support physique; - * (ii) le premier exercice par le Licencié de l'un quelconque des - droits concédés par le Contrat. - -3.2 Un exemplaire du Contrat, contenant notamment un avertissement -relatif aux spécificités du Logiciel, à la restriction de garantie et à -la limitation à un usage par des utilisateurs expérimentés a été mis à -disposition du Licencié préalablement à son acceptation telle que -définie à l'article 3.1 ci dessus et le Licencié reconnaît en avoir pris -connaissance. - - - Article 4 - ENTREE EN VIGUEUR ET DUREE - - - 4.1 ENTREE EN VIGUEUR - -Le Contrat entre en vigueur à la date de son acceptation par le Licencié -telle que définie en 3.1. - - - 4.2 DUREE - -Le Contrat produira ses effets pendant toute la durée légale de -protection des droits patrimoniaux portant sur le Logiciel. - - - Article 5 - ETENDUE DES DROITS CONCEDES - -Le Concédant concède au Licencié, qui accepte, les droits suivants sur -le Logiciel pour toutes destinations et pour la durée du Contrat dans -les conditions ci-après détaillées. - -Par ailleurs, si le Concédant détient ou venait à détenir un ou -plusieurs brevets d'invention protégeant tout ou partie des -fonctionnalités du Logiciel ou de ses composants, il s'engage à ne pas -opposer les éventuels droits conférés par ces brevets aux Licenciés -successifs qui utiliseraient, exploiteraient ou modifieraient le -Logiciel. En cas de cession de ces brevets, le Concédant s'engage à -faire reprendre les obligations du présent alinéa aux cessionnaires. - - - 5.1 DROIT D'UTILISATION - -Le Licencié est autorisé à utiliser le Logiciel, sans restriction quant -aux domaines d'application, étant ci-après précisé que cela comporte: - - 1. la reproduction permanente ou provisoire du Logiciel en tout ou - partie par tout moyen et sous toute forme. - - 2. le chargement, l'affichage, l'exécution, ou le stockage du - Logiciel sur tout support. - - 3. la possibilité d'en observer, d'en étudier, ou d'en tester le - fonctionnement afin de déterminer les idées et principes qui sont - à la base de n'importe quel élément de ce Logiciel; et ceci, - lorsque le Licencié effectue toute opération de chargement, - d'affichage, d'exécution, de transmission ou de stockage du - Logiciel qu'il est en droit d'effectuer en vertu du Contrat. - - - 5.2 DROIT D'APPORTER DES CONTRIBUTIONS - -Le droit d'apporter des Contributions comporte le droit de traduire, -d'adapter, d'arranger ou d'apporter toute autre modification au Logiciel -et le droit de reproduire le logiciel en résultant. - -Le Licencié est autorisé à apporter toute Contribution au Logiciel sous -réserve de mentionner, de façon explicite, son nom en tant qu'auteur de -cette Contribution et la date de création de celle-ci. - - - 5.3 DROIT DE DISTRIBUTION - -Le droit de distribution comporte notamment le droit de diffuser, de -transmettre et de communiquer le Logiciel au public sur tout support et -par tout moyen ainsi que le droit de mettre sur le marché à titre -onéreux ou gratuit, un ou des exemplaires du Logiciel par tout procédé. - -Le Licencié est autorisé à distribuer des copies du Logiciel, modifié ou -non, à des tiers dans les conditions ci-après détaillées. - - - 5.3.1 DISTRIBUTION DU LOGICIEL SANS MODIFICATION - -Le Licencié est autorisé à distribuer des copies conformes du Logiciel, -sous forme de Code Source ou de Code Objet, à condition que cette -distribution respecte les dispositions du Contrat dans leur totalité et -soit accompagnée: - - 1. d'un exemplaire du Contrat, - - 2. d'un avertissement relatif à la restriction de garantie et de - responsabilité du Concédant telle que prévue aux articles 8 - et 9, - -et que, dans le cas où seul le Code Objet du Logiciel est redistribué, -le Licencié permette aux futurs Licenciés d'accéder facilement au Code -Source complet du Logiciel en indiquant les modalités d'accès, étant -entendu que le coût additionnel d'acquisition du Code Source ne devra -pas excéder le simple coût de transfert des données. - - - 5.3.2 DISTRIBUTION DU LOGICIEL MODIFIE - -Lorsque le Licencié apporte une Contribution au Logiciel, les conditions -de distribution du Logiciel Modifié en résultant sont alors soumises à -l'intégralité des dispositions du Contrat. - -Le Licencié est autorisé à distribuer le Logiciel Modifié, sous forme de -code source ou de code objet, à condition que cette distribution -respecte les dispositions du Contrat dans leur totalité et soit -accompagnée: - - 1. d'un exemplaire du Contrat, - - 2. d'un avertissement relatif à la restriction de garantie et de - responsabilité du Concédant telle que prévue aux articles 8 - et 9, - -et que, dans le cas où seul le code objet du Logiciel Modifié est -redistribué, le Licencié permette aux futurs Licenciés d'accéder -facilement au code source complet du Logiciel Modifié en indiquant les -modalités d'accès, étant entendu que le coût additionnel d'acquisition -du code source ne devra pas excéder le simple coût de transfert des données. - - - 5.3.3 DISTRIBUTION DES MODULES EXTERNES - -Lorsque le Licencié a développé un Module Externe les conditions du -Contrat ne s'appliquent pas à ce Module Externe, qui peut être distribué -sous un contrat de licence différent. - - - 5.3.4 COMPATIBILITE AVEC LA LICENCE GNU GPL - -Le Licencié peut inclure un code soumis aux dispositions d'une des -versions de la licence GNU GPL dans le Logiciel modifié ou non et -distribuer l'ensemble sous les conditions de la même version de la -licence GNU GPL. - -Le Licencié peut inclure le Logiciel modifié ou non dans un code soumis -aux dispositions d'une des versions de la licence GNU GPL et distribuer -l'ensemble sous les conditions de la même version de la licence GNU GPL. - - - Article 6 - PROPRIETE INTELLECTUELLE - - - 6.1 SUR LE LOGICIEL INITIAL - -Le Titulaire est détenteur des droits patrimoniaux sur le Logiciel -Initial. Toute utilisation du Logiciel Initial est soumise au respect -des conditions dans lesquelles le Titulaire a choisi de diffuser son -oeuvre et nul autre n'a la faculté de modifier les conditions de -diffusion de ce Logiciel Initial. - -Le Titulaire s'engage à ce que le Logiciel Initial reste au moins régi -par le Contrat et ce, pour la durée visée à l'article 4.2. - - - 6.2 SUR LES CONTRIBUTIONS - -Le Licencié qui a développé une Contribution est titulaire sur celle-ci -des droits de propriété intellectuelle dans les conditions définies par -la législation applicable. - - - 6.3 SUR LES MODULES EXTERNES - -Le Licencié qui a développé un Module Externe est titulaire sur celui-ci -des droits de propriété intellectuelle dans les conditions définies par -la législation applicable et reste libre du choix du contrat régissant -sa diffusion. - - - 6.4 DISPOSITIONS COMMUNES - -Le Licencié s'engage expressément: - - 1. à ne pas supprimer ou modifier de quelque manière que ce soit les - mentions de propriété intellectuelle apposées sur le Logiciel; - - 2. à reproduire à l'identique lesdites mentions de propriété - intellectuelle sur les copies du Logiciel modifié ou non. - -Le Licencié s'engage à ne pas porter atteinte, directement ou -indirectement, aux droits de propriété intellectuelle du Titulaire et/ou -des Contributeurs sur le Logiciel et à prendre, le cas échéant, à -l'égard de son personnel toutes les mesures nécessaires pour assurer le -respect des dits droits de propriété intellectuelle du Titulaire et/ou -des Contributeurs. - - - Article 7 - SERVICES ASSOCIES - -7.1 Le Contrat n'oblige en aucun cas le Concédant à la réalisation de -prestations d'assistance technique ou de maintenance du Logiciel. - -Cependant le Concédant reste libre de proposer ce type de services. Les -termes et conditions d'une telle assistance technique et/ou d'une telle -maintenance seront alors déterminés dans un acte séparé. Ces actes de -maintenance et/ou assistance technique n'engageront que la seule -responsabilité du Concédant qui les propose. - -7.2 De même, tout Concédant est libre de proposer, sous sa seule -responsabilité, à ses licenciés une garantie, qui n'engagera que lui, -lors de la redistribution du Logiciel et/ou du Logiciel Modifié et ce, -dans les conditions qu'il souhaite. Cette garantie et les modalités -financières de son application feront l'objet d'un acte séparé entre le -Concédant et le Licencié. - - - Article 8 - RESPONSABILITE - -8.1 Sous réserve des dispositions de l'article 8.2, le Licencié a la -faculté, sous réserve de prouver la faute du Concédant concerné, de -solliciter la réparation du préjudice direct qu'il subirait du fait du -Logiciel et dont il apportera la preuve. - -8.2 La responsabilité du Concédant est limitée aux engagements pris en -application du Contrat et ne saurait être engagée en raison notamment: -(i) des dommages dus à l'inexécution, totale ou partielle, de ses -obligations par le Licencié, (ii) des dommages directs ou indirects -découlant de l'utilisation ou des performances du Logiciel subis par le -Licencié et (iii) plus généralement d'un quelconque dommage indirect. En -particulier, les Parties conviennent expressément que tout préjudice -financier ou commercial (par exemple perte de données, perte de -bénéfices, perte d'exploitation, perte de clientèle ou de commandes, -manque à gagner, trouble commercial quelconque) ou toute action dirigée -contre le Licencié par un tiers, constitue un dommage indirect et -n'ouvre pas droit à réparation par le Concédant. - - - Article 9 - GARANTIE - -9.1 Le Licencié reconnaît que l'état actuel des connaissances -scientifiques et techniques au moment de la mise en circulation du -Logiciel ne permet pas d'en tester et d'en vérifier toutes les -utilisations ni de détecter l'existence d'éventuels défauts. L'attention -du Licencié a été attirée sur ce point sur les risques associés au -chargement, à l'utilisation, la modification et/ou au développement et à -la reproduction du Logiciel qui sont réservés à des utilisateurs avertis. - -Il relève de la responsabilité du Licencié de contrôler, par tous -moyens, l'adéquation du produit à ses besoins, son bon fonctionnement et -de s'assurer qu'il ne causera pas de dommages aux personnes et aux biens. - -9.2 Le Concédant déclare de bonne foi être en droit de concéder -l'ensemble des droits attachés au Logiciel (comprenant notamment les -droits visés à l'article 5). - -9.3 Le Licencié reconnaît que le Logiciel est fourni "en l'état" par le -Concédant sans autre garantie, expresse ou tacite, que celle prévue à -l'article 9.2 et notamment sans aucune garantie sur sa valeur commerciale, -son caractère sécurisé, innovant ou pertinent. - -En particulier, le Concédant ne garantit pas que le Logiciel est exempt -d'erreur, qu'il fonctionnera sans interruption, qu'il sera compatible -avec l'équipement du Licencié et sa configuration logicielle ni qu'il -remplira les besoins du Licencié. - -9.4 Le Concédant ne garantit pas, de manière expresse ou tacite, que le -Logiciel ne porte pas atteinte à un quelconque droit de propriété -intellectuelle d'un tiers portant sur un brevet, un logiciel ou sur tout -autre droit de propriété. Ainsi, le Concédant exclut toute garantie au -profit du Licencié contre les actions en contrefaçon qui pourraient être -diligentées au titre de l'utilisation, de la modification, et de la -redistribution du Logiciel. Néanmoins, si de telles actions sont -exercées contre le Licencié, le Concédant lui apportera son aide -technique et juridique pour sa défense. Cette aide technique et -juridique est déterminée au cas par cas entre le Concédant concerné et -le Licencié dans le cadre d'un protocole d'accord. Le Concédant dégage -toute responsabilité quant à l'utilisation de la dénomination du -Logiciel par le Licencié. Aucune garantie n'est apportée quant à -l'existence de droits antérieurs sur le nom du Logiciel et sur -l'existence d'une marque. - - - Article 10 - RESILIATION - -10.1 En cas de manquement par le Licencié aux obligations mises à sa -charge par le Contrat, le Concédant pourra résilier de plein droit le -Contrat trente (30) jours après notification adressée au Licencié et -restée sans effet. - -10.2 Le Licencié dont le Contrat est résilié n'est plus autorisé à -utiliser, modifier ou distribuer le Logiciel. Cependant, toutes les -licences qu'il aura concédées antérieurement à la résiliation du Contrat -resteront valides sous réserve qu'elles aient été effectuées en -conformité avec le Contrat. - - - Article 11 - DISPOSITIONS DIVERSES - - - 11.1 CAUSE EXTERIEURE - -Aucune des Parties ne sera responsable d'un retard ou d'une défaillance -d'exécution du Contrat qui serait dû à un cas de force majeure, un cas -fortuit ou une cause extérieure, telle que, notamment, le mauvais -fonctionnement ou les interruptions du réseau électrique ou de -télécommunication, la paralysie du réseau liée à une attaque -informatique, l'intervention des autorités gouvernementales, les -catastrophes naturelles, les dégâts des eaux, les tremblements de terre, -le feu, les explosions, les grèves et les conflits sociaux, l'état de -guerre... - -11.2 Le fait, par l'une ou l'autre des Parties, d'omettre en une ou -plusieurs occasions de se prévaloir d'une ou plusieurs dispositions du -Contrat, ne pourra en aucun cas impliquer renonciation par la Partie -intéressée à s'en prévaloir ultérieurement. - -11.3 Le Contrat annule et remplace toute convention antérieure, écrite -ou orale, entre les Parties sur le même objet et constitue l'accord -entier entre les Parties sur cet objet. Aucune addition ou modification -aux termes du Contrat n'aura d'effet à l'égard des Parties à moins -d'être faite par écrit et signée par leurs représentants dûment habilités. - -11.4 Dans l'hypothèse où une ou plusieurs des dispositions du Contrat -s'avèrerait contraire à une loi ou à un texte applicable, existants ou -futurs, cette loi ou ce texte prévaudrait, et les Parties feraient les -amendements nécessaires pour se conformer à cette loi ou à ce texte. -Toutes les autres dispositions resteront en vigueur. De même, la -nullité, pour quelque raison que ce soit, d'une des dispositions du -Contrat ne saurait entraîner la nullité de l'ensemble du Contrat. - - - 11.5 LANGUE - -Le Contrat est rédigé en langue française et en langue anglaise, ces -deux versions faisant également foi. - - - Article 12 - NOUVELLES VERSIONS DU CONTRAT - -12.1 Toute personne est autorisée à copier et distribuer des copies de -ce Contrat. - -12.2 Afin d'en préserver la cohérence, le texte du Contrat est protégé -et ne peut être modifié que par les auteurs de la licence, lesquels se -réservent le droit de publier périodiquement des mises à jour ou de -nouvelles versions du Contrat, qui posséderont chacune un numéro -distinct. Ces versions ultérieures seront susceptibles de prendre en -compte de nouvelles problématiques rencontrées par les logiciels libres. - -12.3 Tout Logiciel diffusé sous une version donnée du Contrat ne pourra -faire l'objet d'une diffusion ultérieure que sous la même version du -Contrat ou une version postérieure, sous réserve des dispositions de -l'article 5.3.4. - - - Article 13 - LOI APPLICABLE ET COMPETENCE TERRITORIALE - -13.1 Le Contrat est régi par la loi française. Les Parties conviennent -de tenter de régler à l'amiable les différends ou litiges qui -viendraient à se produire par suite ou à l'occasion du Contrat. - -13.2 A défaut d'accord amiable dans un délai de deux (2) mois à compter -de leur survenance et sauf situation relevant d'une procédure d'urgence, -les différends ou litiges seront portés par la Partie la plus diligente -devant les Tribunaux compétents de Paris. - - -Version 2.0 du 2006-09-05. diff --git a/xios_2311_src/trunk/.svn/pristine/29/296b1c337c296247e45e684bf9a29b49aae1a054.svn-base b/xios_2311_src/trunk/.svn/pristine/29/296b1c337c296247e45e684bf9a29b49aae1a054.svn-base deleted file mode 100644 index 4f1caa106e857f6fea75d0c44c691e336498ef33..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/29/296b1c337c296247e45e684bf9a29b49aae1a054.svn-base +++ /dev/null @@ -1,99 +0,0 @@ -#ifndef __GRID_SCATTERER_CONNECTOR_HPP__ -#define __GRID_SCATTERER_CONNECTOR_HPP__ - -#include "xios_spl.hpp" -#include "array_new.hpp" -#include "distributed_view.hpp" -#include "mpi.hpp" -#include "local_view.hpp" -#include "distributed_view.hpp" -#include "context_client.hpp" -#include "scatterer_connector.hpp" - - -namespace xios -{ - - class CGridScattererConnector - { - private: - vector> elementsConnector_ ; - map nbSenders_ ; - vector ranks_ ; - map dstSize_ ; - - - public: - CGridScattererConnector(vector> elementsConnector) : elementsConnector_(elementsConnector) - { - nbSenders_ = elementsConnector[0]->getNbSenders() ; - for(auto& rank : nbSenders_) - { - ranks_.push_back(rank.first) ; - dstSize_[rank.first] = 1 ; - } - - // init dstSize_ - for(auto& connector : elementsConnector_) - { - auto& sizes = connector->getDstSize() ; - for(auto& rankSize : sizes) dstSize_[rankSize.first] = dstSize_[rankSize.first] * rankSize.second ; - } - } - - const map& getTransferedDataSize(void) {return dstSize_;} - - template - void transfer(const CArray& input, map>& output) - { - int n = elementsConnector_.size()-1 ; - shared_ptr* connector = elementsConnector_.data() + n ; - for(int rank : ranks_) - { - auto& out = output[rank] ; - out.resize(dstSize_[rank]) ; - elementsConnector_[n]->transfer(rank, connector, n, input.dataFirst(), out.dataFirst()) ; - } - } - - template - void transfer(const CArray& input, CContextClient* client, CEventClient& event, const CMessage& messageHeader) - { - map> output ; - transfer(input, output) ; - sendToServer(output, client, event, messageHeader) ; - } - - template - void sendToServer(const map>& dataOut, CContextClient* client, CEventClient& event, const CMessage& messageHeader) - { - list messages; - for(auto& ranksData : dataOut) - { - int rank = ranksData.first ; - auto& data = ranksData.second ; - - messages.push_back(CMessage(messageHeader)); - messages.back().push(data) ; - event.push(rank, nbSenders_[rank], messages.back()); - } - client->sendEvent(event) ; - } - - void transfer(CContextClient* client, CEventClient& event, const CMessage& messageHeader) - { - list messages; - for(auto& it : nbSenders_) - { - int rank = it.first ; - auto& nbSender = it.second ; - - messages.push_back(CMessage(messageHeader)); - event.push(rank, nbSenders_[rank], messages.back()); - } - client->sendEvent(event) ; - } - }; -} - -#endif \ No newline at end of file diff --git a/xios_2311_src/trunk/.svn/pristine/29/298163d12ff94298a348b0e795a93d910bb7639b.svn-base b/xios_2311_src/trunk/.svn/pristine/29/298163d12ff94298a348b0e795a93d910bb7639b.svn-base deleted file mode 100644 index 8ef98721735c68c0fa26bd27b5ed220206bf201f..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/29/298163d12ff94298a348b0e795a93d910bb7639b.svn-base +++ /dev/null @@ -1,737 +0,0 @@ -/********************************************************************* - * Copyright 2010, UCAR/Unidata - * See netcdf/COPYRIGHT file for copying and redistribution conditions. - * $Header$ - *********************************************************************/ - -#include "config.h" - -#include -#include -#include - -#include "oc.h" -#include "ocuri.h" - -#define OCURIDEBUG - -#define LBRACKET '[' -#define RBRACKET ']' - -#ifndef FIX -#define FIX(s) ((s)==NULL?"":(s)) -#endif - -#ifndef NILLEN -#define NILLEN(s) ((s)==NULL?0:strlen(s)) -#endif - -#ifdef HAVE_STRDUP -# ifndef nulldup -# define nulldup(s) ((s)==NULL?NULL:strdup(s)) -# endif -#endif - -#ifndef HAVE_STRDUP -static char* nulldup(char* s) -{ - char* dup = NULL; - if(s != NULL) { - dup = (char*)malloc(strlen(s)+1); - if(dup != NULL) - strcpy(dup,s); - } - return dup; -} -#endif - -#ifdef OCIGNORE -/* Not all systems have strndup, so provide one*/ -static char* -ocstrndup(const char* s, size_t len) -{ - char* dup; - if(s == NULL) return NULL; - dup = (char*)ocmalloc(len+1); - MEMCHECK(dup,NULL); - memcpy((void*)dup,s,len); - dup[len] = '\0'; - return dup; -} -#endif - -/* Do not trust strncmp */ -static int -ocuristrncmp(const char* s1, const char* s2, size_t len) -{ - const char *p,*q; - if(s1 == s2) return 0; - if(s1 == NULL) return -1; - if(s2 == NULL) return +1; - for(p=s1,q=s2;len > 0;p++,q++,len--) { - if(*p != *q) - return (*p - *q); - if(*p == 0) return 0; /* *p == *q == 0 */ - } - /* 1st len chars are same */ - return 0; -} - -static char* legalprotocols[] = { -"file:", -"http:", -"https:", -"ftp:", -NULL /* NULL terminate*/ -}; - -/* Allowable character sets for encode */ -static char* fileallow = -"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!#$&'()*+,-./:;=?@_~"; - -static char* queryallow = -"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!#$&'()*+,-./:;=?@_~"; - -static void ocparamfree(char** params); -static int ocfind(char** params, const char* key); - -/* Do a simple uri parse: return 0 if fail, 1 otherwise*/ -int -ocuriparse(const char* uri0, OCURI** ocurip) -{ - OCURI* ocuri = NULL; - char* uri; - char** pp; - char* p; - char* p1; - int c; - - /* accumulate parse points*/ - char* protocol = NULL; - char* params = NULL; - char* host = NULL; - char* port = NULL; - char* constraint = NULL; - char* user = NULL; - char* pwd = NULL; - char* file = NULL; - - if(uri0 == NULL) - return OC_EBADURL; - - ocuri = (OCURI*)calloc(1,sizeof(OCURI)); - if(ocuri == NULL) return 0; - - /* make local copy of uri */ - uri = nulldup(uri0); - - /* remove all whitespace*/ - p = uri; - p1 = uri; - while((c=*p1++)) {if(c != ' ' && c != '\t') *p++ = c;} - - p = uri; - - /* break up the uri string into pieces*/ - - /* 1. leading bracketed parameters */ - if(*p == LBRACKET) { - params = p+1; - /* find end of the clientparams*/ - for(;*p;p++) {if(p[0] == RBRACKET && p[1] != LBRACKET) break;} - if(*p == 0) goto fail; /* malformed client params*/ - *p = '\0'; /* leave off the trailing rbracket for now */ - p++; /* move past the params*/ - } - - /* verify that the uri starts with an acceptable protocol*/ - for(pp=legalprotocols;*pp;pp++) { - if(ocuristrncmp(p,*pp,strlen(*pp))==0) break; - } - if(*pp == NULL) goto fail; /* illegal protocol*/ - /* save the protocol */ - protocol = *pp; - - /* 4. skip protocol */ - p += strlen(protocol); - - /* 5. skip // */ - if(*p != '/' && *(p+1) != '/') - goto fail; - p += 2; - - /* 6. Mark the end of the host section */ - file = strchr(p,'/'); - if(file) { - *file++ = '\0'; /* warning: we just overwrote the leading / */ - } else - goto fail; - - /* 7. extract any user:pwd */ - p1 = strchr(p,'@'); - if(p1) {/* Assume we have user:pwd@ */ - *p1 = '\0'; - user = p; - pwd = strchr(p,':'); - if(!pwd) goto fail; /* malformed */ - *pwd++ = '\0'; - p = pwd+strlen(pwd)+1; - } - - /* 8. extract host and port */ - host = p; - port = strchr(p,':'); - if(port) { - *port++ = '\0'; - } - - /* 9. Look for '?' */ - constraint = strchr(file,'?'); - if(constraint) { - *constraint++ = '\0'; - } - - /* assemble the component pieces*/ - if(uri0 && strlen(uri0) > 0) - ocuri->uri = nulldup(uri0); - if(protocol && strlen(protocol) > 0) { - ocuri->protocol = nulldup(protocol); - /* remove trailing ':' */ - ocuri->protocol[strlen(protocol)-1] = '\0'; - } - if(user && strlen(user) > 0) - ocuri->user = nulldup(user); - if(pwd && strlen(pwd) > 0) - ocuri->password = nulldup(pwd); - if(host && strlen(host) > 0) - ocuri->host = nulldup(host); - if(port && strlen(port) > 0) - ocuri->port = nulldup(port); - if(file && strlen(file) > 0) { - /* Add back the leading / */ - ocuri->file = malloc(strlen(file)+2); - strcpy(ocuri->file,"/"); - strcat(ocuri->file,file); - } - if(constraint && strlen(constraint) > 0) - ocuri->constraint = nulldup(constraint); - ocurisetconstraints(ocuri,constraint); - if(params != NULL && strlen(params) > 0) { - ocuri->params = (char*)malloc(1+2+strlen(params)); - strcpy(ocuri->params,"["); - strcat(ocuri->params,params); - strcat(ocuri->params,"]"); - } - -#ifdef OCXDEBUG - { - fprintf(stderr,"ocuri:"); - fprintf(stderr," params=|%s|",FIX(ocuri->params)); - fprintf(stderr," protocol=|%s|",FIX(ocuri->protocol)); - fprintf(stderr," host=|%s|",FIX(ocuri->host)); - fprintf(stderr," port=|%s|",FIX(ocuri->port)); - fprintf(stderr," file=|%s|",FIX(ocuri->file)); - fprintf(stderr," constraint=|%s|",FIX(ocuri->constraint)); - fprintf(stderr,"\n"); - } -#endif - free(uri); - if(ocurip != NULL) *ocurip = ocuri; - return 1; - -fail: - if(ocuri) ocurifree(ocuri); - if(uri != NULL) free(uri); - return 0; -} - -void -ocurifree(OCURI* ocuri) -{ - if(ocuri == NULL) return; - if(ocuri->uri != NULL) {free(ocuri->uri);} - if(ocuri->protocol != NULL) {free(ocuri->protocol);} - if(ocuri->user != NULL) {free(ocuri->user);} - if(ocuri->password != NULL) {free(ocuri->password);} - if(ocuri->host != NULL) {free(ocuri->host);} - if(ocuri->port != NULL) {free(ocuri->port);} - if(ocuri->file != NULL) {free(ocuri->file);} - if(ocuri->constraint != NULL) {free(ocuri->constraint);} - if(ocuri->projection != NULL) {free(ocuri->projection);} - if(ocuri->selection != NULL) {free(ocuri->selection);} - if(ocuri->params != NULL) {free(ocuri->params);} - if(ocuri->paramlist != NULL) ocparamfree(ocuri->paramlist); - free(ocuri); -} - -/* Replace the constraints */ -void -ocurisetconstraints(OCURI* duri,const char* constraints) -{ - char* proj = NULL; - char* select = NULL; - const char* p; - - if(duri->constraint == NULL) free(duri->constraint); - if(duri->projection != NULL) free(duri->projection); - if(duri->selection != NULL) free(duri->selection); - duri->constraint = NULL; - duri->projection = NULL; - duri->selection = NULL; - - if(constraints == NULL || strlen(constraints)==0) return; - - duri->constraint = nulldup(constraints); - if(*duri->constraint == '?') - strcpy(duri->constraint,duri->constraint+1); - - p = duri->constraint; - proj = (char*) p; - select = strchr(proj,'&'); - if(select != NULL) { - size_t plen = (select - proj); - if(plen == 0) { - proj = NULL; - } else { - proj = (char*)malloc(plen+1); - memcpy((void*)proj,p,plen); - proj[plen] = '\0'; - } - select = nulldup(select); - } else { - proj = nulldup(proj); - select = NULL; - } - duri->projection = proj; - duri->selection = select; -} - - -/* Construct a complete OC URI without the client params - and optionally with the constraints; - caller frees returned string. - Optionally encode the pieces. -*/ - -char* -ocuribuild(OCURI* duri, const char* prefix, const char* suffix, int flags) -{ - size_t len = 0; - char* newuri; - char* tmpfile; - char* tmpsuffix; - char* tmpquery; - - int withparams = ((flags&OCURIPARAMS) - && duri->params != NULL); - int withuserpwd = ((flags&OCURIUSERPWD) - && duri->user != NULL && duri->password != NULL); - int withconstraints = ((flags&OCURICONSTRAINTS) - && duri->constraint != NULL); -#ifdef NEWESCAPE - int encode = (flags&OCURIENCODE); -#else - int encode = 0; -#endif - - if(prefix != NULL) len += NILLEN(prefix); - if(withparams) { - len += NILLEN("[]"); - len += NILLEN(duri->params); - } - len += (NILLEN(duri->protocol)+NILLEN("://")); - if(withuserpwd) { - len += (NILLEN(duri->user)+NILLEN(duri->password)+NILLEN(":@")); - } - len += (NILLEN(duri->host)); - if(duri->port != NULL) { - len += (NILLEN(":")+NILLEN(duri->port)); - } - - tmpfile = duri->file; - if(encode) - tmpfile = ocuriencode(tmpfile,fileallow); - len += (NILLEN(tmpfile)); - - if(suffix != NULL) { - tmpsuffix = (char*)suffix; - if(encode) - tmpsuffix = ocuriencode(tmpsuffix,fileallow); - len += (NILLEN(tmpsuffix)); - } - - if(withconstraints) { - tmpquery = duri->constraint; - if(encode) - tmpquery = ocuriencode(tmpquery,queryallow); - len += (NILLEN("?")+NILLEN(tmpquery)); - } - - len += 1; /* null terminator */ - - newuri = (char*)malloc(len); - if(newuri == NULL) return NULL; - - newuri[0] = '\0'; - if(prefix != NULL) strcat(newuri,prefix); - if(withparams) { - strcat(newuri,"["); - strcat(newuri,duri->params); - strcat(newuri,"]"); - } - if(duri->protocol != NULL) - strcat(newuri,duri->protocol); - strcat(newuri,"://"); - if(withuserpwd) { - strcat(newuri,duri->user); - strcat(newuri,":"); - strcat(newuri,duri->password); - strcat(newuri,"@"); - } - if(duri->host != NULL) { /* may be null if using file: protocol */ - strcat(newuri,duri->host); - } - if(duri->port != NULL) { - strcat(newuri,":"); - strcat(newuri,duri->port); - } - - strcat(newuri,tmpfile); - if(suffix != NULL) strcat(newuri,tmpsuffix); - if(withconstraints) { - strcat(newuri,"?"); - strcat(newuri,tmpquery); - } - return newuri; -} - -/**************************************************/ -/* Parameter support */ - -/* -Client parameters are assumed to be -one or more instances of bracketed pairs: -e.g "[...][...]...". -The bracket content in turn is assumed to be a -comma separated list of = pairs. -e.g. x=y,z=,a=b. -If the same parameter is specifed more than once, -then the first occurrence is used; this is so that -is possible to forcibly override user specified -parameters by prefixing. -IMPORTANT: client parameter string is assumed to -have blanks compress out. -Returns 1 if parse suceeded, 0 otherwise; -*/ - -int -ocuridecodeparams(OCURI* ocuri) -{ - char* cp; - char* cq; - int c; - int i; - int nparams; - char* params0; - char* params; - char* params1; - char** plist; - - if(ocuri == NULL) return 0; - if(ocuri->params == NULL) return 1; - - params0 = ocuri->params; - - /* Pass 1 to replace beginning '[' and ending ']' */ - if(params0[0] == '[') - params = nulldup(params0+1); - else - params = nulldup(params0); - - if(params[strlen(params)-1] == ']') - params[strlen(params)-1] = '\0'; - - /* Pass 2 to replace "][" pairs with ','*/ - params1 = nulldup(params); - cp=params; cq = params1; - while((c=*cp++)) { - if(c == RBRACKET && *cp == LBRACKET) {cp++; c = ',';} - *cq++ = c; - } - *cq = '\0'; - free(params); - params = params1; - - /* Pass 3 to break string into pieces and count # of pairs */ - nparams=0; - for(cp=params;(c=*cp);cp++) { - if(c == ',') {*cp = '\0'; nparams++;} - } - nparams++; /* for last one */ - - /* plist is an env style list */ - plist = (char**)calloc(1,sizeof(char*)*(2*nparams+1)); /* +1 for null termination */ - - /* Pass 4 to break up each pass into a (name,value) pair*/ - /* and insert into the param list */ - /* parameters of the form name name= are converted to name=""*/ - cp = params; - for(i=0;iparamlist != NULL) - ocparamfree(ocuri->paramlist); - ocuri->paramlist = plist; - return 1; -} - -const char* -ocurilookup(OCURI* uri, const char* key) -{ - int i; - if(uri == NULL || key == NULL || uri->params == NULL) return NULL; - if(uri->paramlist == NULL) { - i = ocuridecodeparams(uri); - if(!i) return 0; - } - i = ocfind(uri->paramlist,key); - if(i >= 0) - return uri->paramlist[(2*i)+1]; - return NULL; -} - -int -ocurisetparams(OCURI* uri, const char* newparams) -{ - if(uri == NULL) return 0; - if(uri->paramlist != NULL) ocparamfree(uri->paramlist); - uri->paramlist = NULL; - if(uri->params != NULL) free(uri->params); - uri->params = nulldup(newparams); - return 1; -} - -/* Internal version of lookup; returns the paired index of the key */ -static int -ocfind(char** params, const char* key) -{ - int i; - char** p; - for(i=0,p=params;*p;p+=2,i++) { - if(strcmp(key,*p)==0) return i; - } - return -1; -} - -static void -ocparamfree(char** params) -{ - char** p; - if(params == NULL) return; - for(p=params;*p;p+=2) { - free(*p); - if(p[1] != NULL) free(p[1]); - } - free(params); -} - -#ifdef OCIGNORE -/* -Delete the entry. -return value = 1 => found and deleted; - 0 => param not found -*/ -int -ocparamdelete(char** params, const char* key) -{ - int i; - char** p; - char** q; - if(params == NULL || key == NULL) return 0; - i = ocfind(params,key); - if(i < 0) return 0; - p = params+(2*i); - for(q=p+2;*q;) { - *p++ = *q++; - } - *p = NULL; - return 1; -} - -static int -oclength(char** params) -{ - int i = 0; - if(params != NULL) { - while(*params) {params+=2; i++;} - } - return i; -} - -/* -Insert new client param (name,value); -return value = 1 => not already defined - 0 => param already defined (no change) -*/ -char** -ocparaminsert(char** params, const char* key, const char* value) -{ - int i; - char** newp; - size_t len; - if(params == NULL || key == NULL) return 0; - i = ocfind(params,key); - if(i >= 0) return 0; - /* not found, append */ - i = oclength(params); - len = sizeof(char*)*((2*i)+1); - newp = realloc(params,len+2*sizeof(char*)); - memcpy(newp,params,len); - newp[2*i] = nulldup(key); - newp[2*i+1] = (value==NULL?NULL:nulldup(value)); - return newp; -} - -/* -Replace new client param (name,value); -return value = 1 => replacement performed - 0 => key not found (no change) -*/ -int -ocparamreplace(char** params, const char* key, const char* value) -{ - int i; - if(params == NULL || key == NULL) return 0; - i = ocfind(params,key); - if(i < 0) return 0; - if(params[2*i+1] != NULL) free(params[2*i+1]); - params[2*i+1] = nulldup(value); - return 1; -} -#endif - - -/* Provide % encoders and decoders */ - - -static char* hexchars = "0123456789abcdefABCDEF"; - -static void -toHex(unsigned int b, char hex[2]) -{ - hex[0] = hexchars[(b >> 4) & 0xff]; - hex[1] = hexchars[(b) & 0xff]; -} - - -static unsigned int -fromHex(int c) -{ - if(c >= '0' && c <= '9') return (c - '0'); - if(c >= 'a' && c <= 'f') return (10 + (c - 'a')); - if(c >= 'A' && c <= 'F') return (10 + (c - 'A')); - return -1; -} - - -/* Return a string representing encoding of input; caller must free; - watch out: will encode whole string, so watch what you give it. - Allowable argument specifies characters that do not need escaping. - */ - -char* -ocuriencode(char* s, char* allowable) -{ - size_t slen; - char* encoded; - char* inptr; - char* outptr; - - if(s == NULL) return NULL; - - slen = strlen(s); - encoded = (char*)malloc((3*slen) + 1); /* max possible size */ - - for(inptr=s,outptr=encoded;*inptr;) { - int c = *inptr++; - if(c == ' ') { - *outptr++ = '+'; - } else { - /* search allowable */ - int c2; - char* a = allowable; - while((c2=*a++)) { - if(c == c2) break; - } - if(c2) {*outptr++ = c;} - else { - char hex[2]; - toHex(c,hex); - *outptr++ = '%'; - *outptr++ = hex[0]; - *outptr++ = hex[1]; - } - } - } - *outptr = '\0'; - return encoded; -} - -/* Return a string representing decoding of input; caller must free;*/ -char* -ocuridecode(char* s) -{ - return ocuridecodeonly(s,NULL); -} - -/* Return a string representing decoding of input only for specified - characters; caller must free -*/ -char* -ocuridecodeonly(char* s, char* only) -{ - size_t slen; - char* decoded; - char* outptr; - char* inptr; - unsigned int c; - - if (s == NULL) return NULL; - if(only == NULL) only = ""; - - slen = strlen(s); - decoded = (char*)malloc(slen+1); /* Should be max we need */ - - outptr = decoded; - inptr = s; - while((c = *inptr++)) { - if(c == '+' && strchr(only,'+') != NULL) - *outptr++ = ' '; - else if(c == '%') { - /* try to pull two hex more characters */ - if(inptr[0] != '\0' && inptr[1] != '\0' - && strchr(hexchars,inptr[0]) != NULL - && strchr(hexchars,inptr[1]) != NULL) { - /* test conversion */ - int xc = (fromHex(inptr[0]) << 4) | (fromHex(inptr[1])); - if(strchr(only,xc) != NULL) { - inptr += 2; /* decode it */ - c = xc; - } - } - } - *outptr++ = c; - } - *outptr = '\0'; - return decoded; -} - diff --git a/xios_2311_src/trunk/.svn/pristine/29/29ea7e508de6d508527e89fde103b0c7d875f604.svn-base b/xios_2311_src/trunk/.svn/pristine/29/29ea7e508de6d508527e89fde103b0c7d875f604.svn-base deleted file mode 100644 index 54674fafd59ef627b8579ff9cc528952789dbe4e..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/29/29ea7e508de6d508527e89fde103b0c7d875f604.svn-base +++ /dev/null @@ -1,610 +0,0 @@ -/*! - \file distribution_client.cpp - \author Ha NGUYEN - \since 13 Jan 2015 - \date 09 Mars 2015 - - \brief Index distribution on client side. - */ -#include "distribution_client.hpp" - -namespace xios { - -CDistributionClient::CDistributionClient(int rank, CGrid* grid) - : CDistribution(rank, 0) - , axisDomainOrder_() - , nLocal_(), nGlob_(), nBeginLocal_(), nBeginGlobal_() - , dataNIndex_(), dataDims_(), dataBegin_(), dataIndex_() - , gridMask_(), indexMap_() - , isDataDistributed_(true), axisNum_(0), domainNum_(0) - , localDataIndex_(), localMaskIndex_() - , globalLocalDataSendToServerMap_() - , infoIndex_(), isComputed_(false) - , elementLocalIndex_(), elementGlobalIndex_(), elementIndexData_() - , elementNLocal_(), elementNGlobal_() -{ - readDistributionInfo(grid); - createGlobalIndex(); -} - -CDistributionClient::~CDistributionClient() -{ /* Nothing to do */ } - -void CDistributionClient::partialClear() -{ - GlobalLocalMap void1 ; - GlobalLocalMap void2 ; - std::vector void3 ; - std::vector void4 ; - - globalLocalDataSendToServerMap_.swap(void1) ; - globalDataIndex_.swap(void2) ; - localDataIndex_.swap(void3); - localMaskIndex_.swap(void4) ; -} - -/*! - Read information of a grid to generate distribution. - Every grid is composed of several axis or/and domain(s). Their information are processed -stored and used to calculate index distribution between client and server - \param [in] grid Grid to read -*/ -void CDistributionClient::readDistributionInfo(CGrid* grid) -{ - std::vector domList = grid->getDomains(); - std::vector axisList = grid->getAxis(); - std::vector scalarList = grid->getScalars(); - CArray axisDomainOrder = grid->axis_domain_order; - - readDistributionInfo(domList, axisList, scalarList, axisDomainOrder); - - // Then check mask of grid - int gridDim = domList.size() * 2 + axisList.size(); - switch (gridDim) { - case 0: - gridMask_.resize(1); - gridMask_(0) = true; - break; - case 1: - if (!grid->mask_1d.isEmpty()) readGridMaskInfo(grid->mask_1d); - break; - case 2: - if (!grid->mask_2d.isEmpty()) readGridMaskInfo(grid->mask_2d); - break; - case 3: - if (!grid->mask_3d.isEmpty()) readGridMaskInfo(grid->mask_3d); - break; - case 4: - if (!grid->mask_4d.isEmpty()) readGridMaskInfo(grid->mask_4d); - break; - case 5: - if (!grid->mask_5d.isEmpty()) readGridMaskInfo(grid->mask_5d); - break; - case 6: - if (!grid->mask_6d.isEmpty()) readGridMaskInfo(grid->mask_6d); - break; - case 7: - if (!grid->mask_7d.isEmpty()) readGridMaskInfo(grid->mask_7d); - break; - default: - break; - } -} - -/*! - Read information from domain(s) and axis to generate distribution. - All information related to domain, e.g ibegin, jbegin, ni, nj, ni_glo, nj_glo -as well as related to axis, e.g dataNIndex, dataIndex will be stored to compute -the distribution between clients and servers. Till now, every data structure of domain has been kept -like before, e.g: data_n_index to make sure a compability, however, it should be changed? - \param [in] domList List of domains of grid - \param [in] axisList List of axis of grid - \param [in] scalarList List of scalar of grid - \param [in] axisDomainOrder order of axis and domain inside a grid. 2 if domain, 1 if axis and zero if scalar -// \param [in] gridMask Mask of grid, for now, keep it 3 dimension, but it needs changing -*/ -void CDistributionClient::readDistributionInfo(const std::vector& domList, - const std::vector& axisList, - const std::vector& scalarList, - const CArray& axisDomainOrder) -{ - domainNum_ = domList.size(); - axisNum_ = axisList.size(); - numElement_ = axisDomainOrder.numElements(); // Number of element, e.x: Axis, Domain - - axisDomainOrder_.resize(numElement_); - axisDomainOrder_ = axisDomainOrder; - - // Because domain and axis can be in any order (axis1, domain1, axis2, axis3, ) - // their position should be specified. In axisDomainOrder, domain == true, axis == false - int idx = 0; - indexMap_.resize(numElement_); - this->dims_ = numElement_; - for (int i = 0; i < numElement_; ++i) - { - indexMap_[i] = idx; - if (2 == axisDomainOrder(i)) - { - ++(this->dims_); - idx += 2; - } - else ++idx; - } - - // Size of each dimension (local and global) - nLocal_.resize(this->dims_); - nGlob_.resize(this->dims_); - nBeginLocal_.resize(this->dims_,0); - nBeginGlobal_.resize(this->dims_,0); - - // Data_n_index of domain or axis (For now, axis uses its size as data_n_index - dataNIndex_.resize(numElement_); - dataDims_.resize(numElement_); - dataBegin_.resize(this->dims_); - - // Data_*_index of each dimension - dataIndex_.resize(this->dims_); - infoIndex_.resize(this->dims_); - - // A trick to determine position of each domain in domainList - int domIndex = 0, axisIndex = 0, scalarIndex = 0; - idx = 0; - - elementLocalIndex_.resize(numElement_); - elementGlobalIndex_.resize(numElement_); - elementIndexData_.resize(numElement_); - elementNLocal_.resize(numElement_); - elementNGlobal_.resize(numElement_); - elementNLocal_[0] = 1; - elementNGlobal_[0] = 1; - size_t localSize = 1, globalSize = 1; - - isDataDistributed_ = false; - // Update all the vectors above - for (idx = 0; idx < numElement_; ++idx) - { - int eleDim = axisDomainOrder(idx); - elementNLocal_[idx] = localSize; - elementNGlobal_[idx] = globalSize; - - // If this is a domain - if (2 == eleDim) - { - // On the j axis - nLocal_.at(indexMap_[idx]+1) = domList[domIndex]->nj.getValue(); - nGlob_.at(indexMap_[idx]+1) = domList[domIndex]->nj_glo.getValue(); - nBeginLocal_.at(indexMap_[idx]+1) = 0; - nBeginGlobal_.at(indexMap_[idx]+1) = domList[domIndex]->jbegin; - - dataBegin_.at(indexMap_[idx]+1) = domList[domIndex]->data_jbegin.getValue(); - dataIndex_.at(indexMap_[idx]+1).reference(domList[domIndex]->data_j_index); - infoIndex_.at(indexMap_[idx]+1).reference(domList[domIndex]->j_index); - - // On the i axis - nLocal_.at(indexMap_[idx]) = domList[domIndex]->ni.getValue(); - nGlob_.at(indexMap_[idx]) = domList[domIndex]->ni_glo.getValue(); - nBeginLocal_.at(indexMap_[idx]) = 0; - nBeginGlobal_.at(indexMap_[idx]) = domList[domIndex]->ibegin; - - dataBegin_.at(indexMap_[idx]) = domList[domIndex]->data_ibegin.getValue(); - dataIndex_.at(indexMap_[idx]).reference(domList[domIndex]->data_i_index); - infoIndex_.at(indexMap_[idx]).reference(domList[domIndex]->i_index); - - dataNIndex_.at(idx) = domList[domIndex]->data_i_index.numElements(); - dataDims_.at(idx) = domList[domIndex]->data_dim.getValue(); - - isDataDistributed_ |= domList[domIndex]->isDistributed(); - - localSize *= nLocal_.at(indexMap_[idx]+1)* nLocal_.at(indexMap_[idx]); - globalSize *= nGlob_.at(indexMap_[idx]+1)* nGlob_.at(indexMap_[idx]); - ++domIndex; - } - else if (1 == eleDim)// So it's an axis - { - nLocal_.at(indexMap_[idx]) = axisList[axisIndex]->n.getValue(); - nGlob_.at(indexMap_[idx]) = axisList[axisIndex]->n_glo.getValue(); - nBeginLocal_.at(indexMap_[idx]) = 0; - nBeginGlobal_.at(indexMap_[idx]) = axisList[axisIndex]->begin.getValue(); - - dataBegin_.at(indexMap_[idx]) = axisList[axisIndex]->data_begin.getValue(); - dataIndex_.at(indexMap_[idx]).reference(axisList[axisIndex]->data_index); - infoIndex_.at(indexMap_[idx]).reference(axisList[axisIndex]->index); - dataNIndex_.at(idx) = axisList[axisIndex]->data_index.numElements(); - dataDims_.at(idx) = 1; - - isDataDistributed_ |= axisList[axisIndex]->isDistributed(); - - localSize *= nLocal_.at(indexMap_[idx]); - globalSize *= nGlob_.at(indexMap_[idx]); - - ++axisIndex; - } - else // scalar - { - nLocal_.at(indexMap_[idx]) = 1; - nGlob_.at(indexMap_[idx]) = 1; - nBeginLocal_.at(indexMap_[idx]) = 0; - nBeginGlobal_.at(indexMap_[idx]) = 1; - - dataBegin_.at(indexMap_[idx]) = 0; - dataIndex_.at(indexMap_[idx]).resize(1); dataIndex_.at(indexMap_[idx])(0) = 0; - infoIndex_.at(indexMap_[idx]).resize(1); infoIndex_.at(indexMap_[idx])(0) = 0; - dataNIndex_.at(idx) = 1; - dataDims_.at(idx) = 1; - - isDataDistributed_ |= false; - - localSize *= nLocal_.at(indexMap_[idx]); - globalSize *= nGlob_.at(indexMap_[idx]); - - ++scalarIndex; - } - } -} - -/*! - Create local index of domain(s). - A domain can have data index which even contains the "ghost" points. Very often, these -data surround the true data. In order to send correct data to server, -a client need to know index of the true data. -*/ -void CDistributionClient::createLocalDomainDataIndex() -{ - int idxDomain = 0; - for (int i = 0; i < axisDomainOrder_.numElements(); ++i) - { - if (2 == axisDomainOrder_(i)) - { - elementIndexData_[i].resize(dataNIndex_[i]); - elementIndexData_[i] = false; - int iIdx, jIdx = 0, count = 0, localIndex; - for (int j = 0; j < dataNIndex_[i]; ++j) - { - iIdx = getDomainIndex((dataIndex_[indexMap_[i]])(j), (dataIndex_[indexMap_[i]+1])(j), - dataBegin_[indexMap_[i]], dataBegin_[indexMap_[i]+1], - dataDims_[i], nLocal_[indexMap_[i]], jIdx); - - if ((iIdx >= nBeginLocal_[indexMap_[i]]) && (iIdx < nLocal_[indexMap_[i]]) && - (jIdx >= nBeginLocal_[indexMap_[i]+1]) && (jIdx < nLocal_[indexMap_[i]+1])) - { - ++count; - elementIndexData_[i](j) = true; - } - } - - elementLocalIndex_[i].resize(count); - elementGlobalIndex_[i].resize(count); - count = 0; - CArray& tmpIndexElementData = elementIndexData_[i]; - CArray& tmpLocalElementIndex = elementLocalIndex_[i]; - CArray& tmpGlobalElementIndex = elementGlobalIndex_[i]; - for (int j = 0; j < dataNIndex_[i]; ++j) - { - if (tmpIndexElementData(j)) - { - iIdx = getDomainIndex((dataIndex_[indexMap_[i]])(j), (dataIndex_[indexMap_[i]+1])(j), - dataBegin_[indexMap_[i]], dataBegin_[indexMap_[i]+1], - dataDims_[i], nLocal_[indexMap_[i]], jIdx); - localIndex = tmpLocalElementIndex(count) = iIdx + jIdx * nLocal_[indexMap_[i]]; - tmpGlobalElementIndex(count) = (infoIndex_[indexMap_[i]])(localIndex) + ((infoIndex_[indexMap_[i]+1])(localIndex))*nGlob_[indexMap_[i]]; - ++count; - } - } - ++idxDomain; - } - } -} - -/*! - Create local index of axis. -*/ -void CDistributionClient::createLocalAxisDataIndex() -{ - int idxAxis = 0; - for (int i = 0; i < axisDomainOrder_.numElements(); ++i) - { - if (1 == axisDomainOrder_(i)) - { - elementIndexData_[i].resize(dataNIndex_[i]); - elementIndexData_[i] = false; - int iIdx = 0, count = 0; - for (int j = 0; j < dataNIndex_[i]; ++j) - { - iIdx = getAxisIndex((dataIndex_[indexMap_[i]])(j), dataBegin_[indexMap_[i]], nLocal_[indexMap_[i]]); - if ((iIdx >= nBeginLocal_[indexMap_[i]]) && - (iIdx < nLocal_[indexMap_[i]]) )//&& (axisMasks_[idxAxis](iIdx))) - { - ++count; - elementIndexData_[i](j) = true; - } - } - - elementLocalIndex_[i].resize(count); - elementGlobalIndex_[i].resize(count); - count = 0; - CArray& tmpIndexElementData = elementIndexData_[i]; - CArray& tmpLocalElementIndex = elementLocalIndex_[i]; - CArray& tmpGlobalElementIndex = elementGlobalIndex_[i]; - for (int j = 0; j < dataNIndex_[i]; ++j) - { - if (tmpIndexElementData(j)) - { - iIdx = tmpLocalElementIndex(count) = getAxisIndex((dataIndex_[indexMap_[i]])(j), dataBegin_[indexMap_[i]], nLocal_[indexMap_[i]]); - tmpGlobalElementIndex(count) = (infoIndex_[indexMap_[i]])(iIdx); - ++count; - } - } - ++idxAxis; - } - } -} - -/*! - Create local index of scalar. -*/ -void CDistributionClient::createLocalScalarDataIndex() -{ - int idxAxis = 0; - for (int i = 0; i < axisDomainOrder_.numElements(); ++i) - { - if (0 == axisDomainOrder_(i)) - { - elementIndexData_[i].resize(dataNIndex_[i]); - elementIndexData_[i] = true; - int count = 1; - - elementLocalIndex_[i].resize(count); - elementLocalIndex_[i] = 0; - elementGlobalIndex_[i].resize(count); - elementGlobalIndex_[i] = 0; - } - } -} - -/*! - Create global index on client - In order to do the mapping between client-server, each client creates its own -global index of sending data. This global index is then used to calculate to which server -the client needs to send it data as well as which part of data belongs to the server. -So as to make clients and server coherent in order of index, global index is calculated by -take into account of C-convention, the rightmost dimension varies faster. -*/ -void CDistributionClient::createGlobalIndexSendToServer() -{ - if (isComputed_) return; - isComputed_ = true; - createLocalDomainDataIndex(); - createLocalAxisDataIndex(); - createLocalScalarDataIndex(); - - int idxDomain = 0, idxAxis = 0; - std::vector eachElementSize(numElement_); - - // Precompute size of the loop - for (int i = 0; i < numElement_; ++i) - { - eachElementSize[i] = elementLocalIndex_[i].numElements(); - } - - // Compute size of the global index on client - std::vector idxLoop(numElement_,0); - std::vector currentIndex(numElement_,0); - std::vector currentGlobalIndex(numElement_,0); - int innerLoopSize = eachElementSize[0]; - size_t idx = 0, indexLocalDataOnClientCount = 0; - size_t ssize = 1; - - for (int i = 0; i < numElement_; ++i) ssize *= eachElementSize[i]; - localDataSize_=ssize ; - - localDataIndex_.resize(ssize); - if (!gridMask_.isEmpty()) localMaskIndex_.resize(ssize); - localMaskedDataIndex_.resize(ssize); - globalDataIndex_.rehash(std::ceil(ssize/globalDataIndex_.max_load_factor())); - globalLocalDataSendToServerMap_.rehash(std::ceil(ssize/globalLocalDataSendToServerMap_.max_load_factor())); - - - // We need to loop with data index - idxLoop.assign(numElement_,0); - idx = indexLocalDataOnClientCount = 0; - ssize = 1; for (int i = 0; i < numElement_; ++i) ssize *= dataNIndex_[i]; - innerLoopSize = dataNIndex_[0]; - int countLocalData = 0; - std::vector correctIndexOfElement(numElement_,0); - bool isOuterIndexCorrect = true; - while (idx < ssize) - { - for (int i = 0; i < numElement_-1; ++i) - { - if (idxLoop[i] == dataNIndex_[i]) - { - idxLoop[i] = 0; - correctIndexOfElement[i] = 0; - ++idxLoop[i+1]; - if (isOuterIndexCorrect) ++correctIndexOfElement[i+1]; - } - } - - // Depending the inner-most element axis or domain, - // The outer loop index begins correspondingly at one (1) or zero (0) - bool isIndexElementDataCorrect = true; - for (int i = 1; i < numElement_; ++i) - { - if (elementIndexData_[i](idxLoop[i])) - { - currentIndex[i] = elementLocalIndex_[i](correctIndexOfElement[i]); - currentGlobalIndex[i] = elementGlobalIndex_[i](correctIndexOfElement[i]); - isIndexElementDataCorrect &= true; - } - else isIndexElementDataCorrect = false; - } - - isOuterIndexCorrect = isIndexElementDataCorrect; - - if (isOuterIndexCorrect) - { - // Inner most index - int correctIndexInnerElement = 0; - for (int i = 0; i < innerLoopSize; ++i) - { - bool isCurrentIndexDataCorrect = isOuterIndexCorrect; - if (elementIndexData_[0](i)) - { - currentIndex[0] = elementLocalIndex_[0](correctIndexInnerElement); - currentGlobalIndex[0] = elementGlobalIndex_[0](correctIndexInnerElement); - isCurrentIndexDataCorrect &= true; - ++correctIndexInnerElement; - } - else isCurrentIndexDataCorrect = false; - - if (isCurrentIndexDataCorrect) - { - bool maskTmp = true; - bool maskGridTmp = true; - size_t globalIndex = 0; - for (int k = 0; k < numElement_; ++k) - { - globalIndex += (currentGlobalIndex[k])*elementNGlobal_[k]; - } - globalDataIndex_[globalIndex] = indexLocalDataOnClientCount; - localDataIndex_[indexLocalDataOnClientCount] = countLocalData; - globalLocalDataSendToServerMap_[globalIndex] = indexLocalDataOnClientCount; - localMaskedDataIndex_[indexLocalDataOnClientCount] = indexLocalDataOnClientCount; - - // Grid mask: unmasked values will be replaces by NaN and then all values will be sent - if (!gridMask_.isEmpty()) - { - int gridMaskIndex = 0; - for (int k = 0; k < this->numElement_; ++k) - { - gridMaskIndex += (currentIndex[k])*elementNLocal_[k]; - } - maskGridTmp = gridMask_(gridMaskIndex); - if (maskGridTmp) - localMaskIndex_[indexLocalDataOnClientCount] = true; - else - localMaskIndex_[indexLocalDataOnClientCount] = false; - } - - ++indexLocalDataOnClientCount; - - } - ++countLocalData; - correctIndexOfElement[0] = correctIndexInnerElement;; - } - } - else countLocalData+=innerLoopSize ; - - idxLoop[0] += innerLoopSize; - idx += innerLoopSize; - } -} - -void CDistributionClient::createGlobalIndex() -{ -} - -/*! - Retrieve index i and index j of a domain from its data index - Data contains not only true data, which are sent to servers, but also ghost data, which -very often play a role of border of each local data, so does data index. Because data of a domain -can be one dimension, or two dimensions, there is a need to convert data index to domain index - \param [in] dataIIndex index of i data - \param [in] dataJIndex index of j data - \param [in] dataIBegin index begin of i data - \param [in] dataJBegin index begin of j data - \param [in] dataDim dimension of data (1 or 2) - \param [in] ni local size ni of domain - \param [out] j j index of domain - \return i index of domain -*/ -int CDistributionClient::getDomainIndex(const int& dataIIndex, const int& dataJIndex, - const int& dataIBegin, const int& dataJBegin, - const int& dataDim, const int& ni, int& j) -{ - int i; - int tempI = dataIIndex + dataIBegin, - tempJ = (dataJIndex + dataJBegin); - if (ni == 0) - { - i = -1; - j = -1; - return i; - } - if ((tempI < 0) || (tempJ < 0)) - { - i = -1; - j = -1; - return i; - } - else - { - i = (dataDim == 1) ? (tempI) % ni : (tempI) ; - j = (dataDim == 1) ? (tempI) / ni : (tempJ) ; - } - return i; -} - -/*! - Retrieve index of an axis from its data index - \param [in] dataIndex index of data - \param [in] dataBegin index begin of data - \param [in] ni local size of axis - \return index of domain -*/ -int CDistributionClient::getAxisIndex(const int& dataIndex, const int& dataBegin, const int& ni) -{ - if (ni == 0) - { - return -1; - } - int tempI = dataIndex; - if ((tempI < 0) || (tempI > ni)) - return -1; - else - return tempI; -} - -/*! - Return global local data mapping of client -*/ -CDistributionClient::GlobalLocalDataMap& CDistributionClient::getGlobalLocalDataSendToServer() -{ - if (!isComputed_) createGlobalIndexSendToServer(); - return globalLocalDataSendToServerMap_; -} - -CDistributionClient::GlobalLocalDataMap& CDistributionClient::getGlobalDataIndexOnClient() -{ - if (!isComputed_) createGlobalIndexSendToServer(); - return globalDataIndex_; -} - -/*! - Return local data index of client -*/ -const std::vector& CDistributionClient::getLocalDataIndexOnClient() -{ - if (!isComputed_) createGlobalIndexSendToServer(); - return localDataIndex_; -} - -/*! - Return local mask index of client -*/ -const std::vector& CDistributionClient::getLocalMaskIndexOnClient() -{ - if (!isComputed_) createGlobalIndexSendToServer(); - return localMaskIndex_; -} - -/*! - Return local mask index of client -*/ -const std::vector& CDistributionClient::getLocalMaskedDataIndexOnClient() -{ - if (!isComputed_) createGlobalIndexSendToServer(); - return localMaskedDataIndex_; -} - -} // namespace xios diff --git a/xios_2311_src/trunk/.svn/pristine/2a/2a12eab88aa7d12c0f8e75e077d6ee19439e5200.svn-base b/xios_2311_src/trunk/.svn/pristine/2a/2a12eab88aa7d12c0f8e75e077d6ee19439e5200.svn-base deleted file mode 100644 index fcc739745d21fab87b1656a473deb76b49d3ce27..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/2a/2a12eab88aa7d12c0f8e75e077d6ee19439e5200.svn-base +++ /dev/null @@ -1,389 +0,0 @@ -#include "filter_expr_node.hpp" -#include "unary_arithmetic_filter.hpp" -#include "binary_arithmetic_filter.hpp" -#include "ternary_arithmetic_filter.hpp" -#include "field.hpp" - -namespace xios -{ - CFilterFieldExprNode::CFilterFieldExprNode(const std::string& fieldId) - : fieldId(fieldId) - { /* Nothing to do */ } - - - std::shared_ptr CFilterFieldExprNode::reduce(CGarbageCollector& gc, CField& thisField) const - { - std::shared_ptr outputPin; - - if (fieldId == "this") outputPin = thisField.getSelfReference(gc); - else - { - string id ; - - if (fieldId == "this_ref") - { - if (thisField.field_ref.isEmpty()) - { - ERROR("shared_ptr CFilterFieldExprNode::reduce(CGarbageCollector& gc, CField& thisField) const", - << "field_ref attribute is empty."); - } - else id = thisField.field_ref ; - } - else id= fieldId ; - - if (CField::has(id)) - { - CField* field = CField::get(id); - if (field == &thisField) - ERROR("shared_ptr CFilterFieldExprNode::reduce(CGarbageCollector& gc, CField& thisField) const", - << "The field " << id << " has an invalid reference to itself. " - << "Use the keyword \"this\" if you want to reference the input data sent to this field."); - - bool ret=field->buildWorkflowGraph(gc); - if(!field->build_workflow_graph.isEmpty()) thisField.build_workflow_graph.set(field->build_workflow_graph); - if (ret) outputPin = field->getInstantDataFilter(); // if dependency is complete build the graph other return nullptr - - } - else ERROR("boost::shared_ptr CFilterFieldExprNode::reduce(CGarbageCollector& gc, CField& thisField) const", - << "The field " << id << " does not exist."); - } - return outputPin; - } - - - CFilterTemporalFieldExprNode::CFilterTemporalFieldExprNode(const std::string& fieldId) - : fieldId(fieldId) - { /* Nothing to do */ } - - - std::shared_ptr CFilterTemporalFieldExprNode::reduce(CGarbageCollector& gc, CField& thisField) const - { - std::shared_ptr outputPin; - - if (fieldId == "this") - outputPin = thisField.getSelfTemporalDataFilter(gc, thisField.freq_op.isEmpty() ? TimeStep : thisField.freq_op); - else - { - string id ; - - if (fieldId == "this_ref") - { - if (thisField.field_ref.isEmpty()) - { - ERROR("shared_ptr CFilterFieldExprNode::reduce(CGarbageCollector& gc, CField& thisField) const", - << "field_ref attribute is empty."); - } - else id = thisField.field_ref ; - } - else id = fieldId ; - - if (CField::has(id)) - { - CField* field = CField::get(id); - if (field == &thisField) - ERROR("shared_ptr CFilterTemporalFieldExprNode::reduce(CGarbageCollector& gc, CField& thisField) const", - << "The field " << fieldId << " has an invalid reference to itself. " - << "Use the keyword \"this\" if you want to reference the input data sent to this field."); - - bool ret=field->buildWorkflowGraph(gc); - if (ret) outputPin = field->getTemporalDataFilter(gc, thisField.freq_op.isEmpty() ? TimeStep : thisField.freq_op); - } - else - ERROR("shared_ptr CFilterTemporalFieldExprNode::reduce(CGarbageCollector& gc, CField& thisField) const", - << "The field " << fieldId << " does not exist."); - } - return outputPin; - } - - - CFilterUnaryOpExprNode::CFilterUnaryOpExprNode(const std::string& opId, IFilterExprNode* child) - : opId(opId) - , child(child) - { - if (!child) - ERROR("CFilterUnaryOpExprNode::CFilterUnaryOpExprNode(const std::string& opId, IFilterExprNode* child)", - "Impossible to create the new expression node, an invalid child node was provided."); - } - - std::shared_ptr CFilterUnaryOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const - { - std::shared_ptr filter(new CUnaryArithmeticFilter(gc, opId)); - auto ret=child->reduce(gc, thisField) ; - if (ret) ret->connectOutput(filter, 0); - else filter.reset() ; - - const bool buildGraph_ = !(thisField.build_workflow_graph.isEmpty()) && thisField.build_workflow_graph == true ; - if(buildGraph_) - { - filter->graphPackage = new CGraphPackage; - filter->graphEnabled = true; - filter->graphPackage->inFields.push_back(&thisField); - } - - return filter; - } - - CFilterScalarFieldOpExprNode::CFilterScalarFieldOpExprNode(IScalarExprNode* child1, const std::string& opId, IFilterExprNode* child2) - : child1(child1) - , opId(opId) - , child2(child2) - { - if (!child1 || !child2) - ERROR("CFilterScalarFieldOpExprNode::CFilterScalarFieldOpExprNode(IScalarExprNode* child1, const std::string& opId, IFilterExprNode* child2)", - "Impossible to create the new expression node, an invalid child node was provided."); - } - - std::shared_ptr CFilterScalarFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const - { - std::shared_ptr filter(new CScalarFieldArithmeticFilter(gc, opId, child1->reduce())); - - auto ret=child2->reduce(gc, thisField) ; - if (ret) ret->connectOutput(filter, 0); - else filter.reset() ; - - const bool buildGraph_ = !(thisField.build_workflow_graph.isEmpty()) && thisField.build_workflow_graph == true ; - if(buildGraph_) - { - filter->graphPackage = new CGraphPackage; - filter->graphEnabled = true; - filter->graphPackage->inFields.push_back(&thisField); - } - - return filter; - } - - CFilterFieldScalarOpExprNode::CFilterFieldScalarOpExprNode(IFilterExprNode* child1, const std::string& opId, IScalarExprNode* child2) - : child1(child1) - , opId(opId) - , child2(child2) - { - if (!child1 || !child2) - ERROR("CFilterFieldScalarOpExprNode::CFilterFieldScalarOpExprNode(IFilterExprNode* child1, const std::string& opId, IScalarExprNode* child2)", - "Impossible to create the new expression node, an invalid child node was provided."); - } - - std::shared_ptr CFilterFieldScalarOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const - { - std::shared_ptr filter(new CFieldScalarArithmeticFilter(gc, opId, child2->reduce())); - auto ret=child1->reduce(gc, thisField) ; - if (ret) ret->connectOutput(filter, 0); - else filter.reset() ; - - const bool buildGraph_ = !(thisField.build_workflow_graph.isEmpty()) && thisField.build_workflow_graph == true ; - if(buildGraph_) - { - filter->graphPackage = new CGraphPackage; - filter->graphEnabled = true; - filter->graphPackage->inFields.push_back(&thisField); - } - return filter; - } - - CFilterFieldFieldOpExprNode::CFilterFieldFieldOpExprNode(IFilterExprNode* child1, const std::string& opId, IFilterExprNode* child2) - : child1(child1) - , opId(opId) - , child2(child2) - { - if (!child1 || !child2) - ERROR("CFilterFieldFieldOpExprNode::CFilterFieldFieldOpExprNode(IFilterExprNode* child1, const std::string& opId, IFilterExprNode* child2)", - "Impossible to create the new expression node, an invalid child node was provided."); - } - - std::shared_ptr CFilterFieldFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const - { - std::shared_ptr filter(new CFieldFieldArithmeticFilter(gc, opId)); - auto ret1 = child1->reduce(gc, thisField); - auto ret2 = child2->reduce(gc, thisField); - if (ret1 && ret2) - { - ret1->connectOutput(filter, 0) ; - ret2->connectOutput(filter, 1) ; - } - else filter.reset() ; - - const bool buildGraph_ = !(thisField.build_workflow_graph.isEmpty()) && thisField.build_workflow_graph == true ; - if(buildGraph_) - { - filter->graphPackage = new CGraphPackage; - filter->graphEnabled = true; - filter->graphPackage->inFields.push_back(&thisField); - } - - return filter; - } - - - - - CFilterScalarScalarFieldOpExprNode::CFilterScalarScalarFieldOpExprNode(IScalarExprNode* child1, const std::string& opId, IScalarExprNode* child2, IFilterExprNode* child3) - : child1(child1) - , opId(opId) - , child2(child2) - , child3(child3) - { - if (!child1 || !child2 || !child3) - ERROR(" CFilterScalarScalarFieldOpExprNode::CFilterScalarScalarFieldOpExprNode(IScalarExprNode* child1, const std::string& opId, IScalarExprNode* child2, IFilterExprNode* child3)", - "Impossible to create the new expression node, an invalid child node was provided."); - } - - std::shared_ptr CFilterScalarScalarFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const - { - std::shared_ptr filter(new CScalarScalarFieldArithmeticFilter(gc, opId, child1->reduce(),child2->reduce())); - auto ret=child3->reduce(gc, thisField) ; - if (ret) ret->connectOutput(filter, 0); - else filter.reset() ; - return filter; - } - - - CFilterScalarFieldScalarOpExprNode::CFilterScalarFieldScalarOpExprNode(IScalarExprNode* child1, const std::string& opId, IFilterExprNode* child2, IScalarExprNode* child3) - : child1(child1) - , opId(opId) - , child2(child2) - , child3(child3) - { - if (!child1 || !child2 || !child3) - ERROR(" CFilterScalarFieldScalarOpExprNode::CFilterScalarFieldScalarOpExprNode(IScalarExprNode* child1, const std::string& opId, IFilterExprNode* child2, IScalarExprNode* child3)", - "Impossible to create the new expression node, an invalid child node was provided."); - } - - std::shared_ptr CFilterScalarFieldScalarOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const - { - std::shared_ptr filter(new CScalarFieldScalarArithmeticFilter(gc, opId, child1->reduce(),child3->reduce())); - auto ret=child2->reduce(gc, thisField); - if (ret) ret->connectOutput(filter, 0); - else filter.reset() ; - return filter; - } - - - CFilterScalarFieldFieldOpExprNode::CFilterScalarFieldFieldOpExprNode(IScalarExprNode* child1, const std::string& opId, IFilterExprNode* child2, IFilterExprNode* child3) - : child1(child1) - , opId(opId) - , child2(child2) - , child3(child3) - { - if (!child1 || !child2 || !child3) - ERROR(" CFilterScalarFieldFieldOpExprNode::CFilterScalarFieldFieldOpExprNode(IScalarExprNode* child1, const std::string& opId, IFilterExprNode* child2, IFilterExprNode* child3)", - "Impossible to create the new expression node, an invalid child node was provided."); - } - - std::shared_ptr CFilterScalarFieldFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const - { - std::shared_ptr filter(new CScalarFieldFieldArithmeticFilter(gc, opId, child1->reduce())); - auto ret1=child2->reduce(gc, thisField); - auto ret2=child3->reduce(gc, thisField); - if (ret1 && ret2) - { - ret1->connectOutput(filter, 0); - ret2->connectOutput(filter, 1); - } - else filter.reset() ; - return filter; - } - - - - CFilterFieldScalarScalarOpExprNode::CFilterFieldScalarScalarOpExprNode(IFilterExprNode* child1, const std::string& opId, IScalarExprNode* child2, IScalarExprNode* child3) - : child1(child1) - , opId(opId) - , child2(child2) - , child3(child3) - { - if (!child1 || !child2 || !child3) - ERROR(" CFilterFieldScalarScalarOpExprNode::CFilterFieldScalarScalarOpExprNode(IFilterExprNode* child1, const std::string& opId, IScalarExprNode* child2, IScalarExprNode* child3)", - "Impossible to create the new expression node, an invalid child node was provided."); - } - - std::shared_ptr CFilterFieldScalarScalarOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const - { - std::shared_ptr filter(new CFieldScalarScalarArithmeticFilter(gc, opId, child2->reduce(),child3->reduce())); - auto ret = child1->reduce(gc, thisField) ; - if (ret) ret->connectOutput(filter, 0); - else filter.reset() ; - return filter; - } - - - - CFilterFieldScalarFieldOpExprNode::CFilterFieldScalarFieldOpExprNode(IFilterExprNode* child1, const std::string& opId, IScalarExprNode* child2, IFilterExprNode* child3) - : child1(child1) - , opId(opId) - , child2(child2) - , child3(child3) - { - if (!child1 || !child2 || !child3) - ERROR(" CFilterFieldScalarFieldOpExprNode::CFilterFieldScalarFieldOpExprNode(IFilterExprNode* child1, const std::string& opId, IScalarExprNode* child2, IFilterExprNode* child3)", - "Impossible to create the new expression node, an invalid child node was provided."); - } - - std::shared_ptr CFilterFieldScalarFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const - { - std::shared_ptr filter(new CFieldScalarFieldArithmeticFilter(gc, opId, child2->reduce())); - auto ret1 = child1->reduce(gc, thisField); - auto ret2 = child3->reduce(gc, thisField); - if (ret1 && ret2) - { - ret1 -> connectOutput(filter, 0); - ret2 -> connectOutput(filter, 1); - } - else filter.reset() ; - return filter; - } - - - - CFilterFieldFieldScalarOpExprNode::CFilterFieldFieldScalarOpExprNode(IFilterExprNode* child1, const std::string& opId, IFilterExprNode* child2, IScalarExprNode* child3) - : child1(child1) - , opId(opId) - , child2(child2) - , child3(child3) - { - if (!child1 || !child2 || !child3) - ERROR(" CFilterFieldFieldScalarOpExprNode::CFilterFieldFieldScalarOpExprNode(IFilterExprNode* child1, const std::string& opId, IFilterExprNode* child2, IScalarExprNode* child3)", - "Impossible to create the new expression node, an invalid child node was provided."); - } - - std::shared_ptr CFilterFieldFieldScalarOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const - { - std::shared_ptr filter(new CFieldFieldScalarArithmeticFilter(gc, opId, child3->reduce())); - auto ret1 = child1->reduce(gc, thisField); - auto ret2 = child2->reduce(gc, thisField); - if (ret1 && ret2) - { - ret1->connectOutput(filter, 0); - ret2->connectOutput(filter, 1); - } - else filter.reset() ; - return filter; - } - - - CFilterFieldFieldFieldOpExprNode::CFilterFieldFieldFieldOpExprNode(IFilterExprNode* child1, const std::string& opId, IFilterExprNode* child2, IFilterExprNode* child3) - : child1(child1) - , opId(opId) - , child2(child2) - , child3(child3) - { - if (!child1 || !child2 || !child3) - ERROR(" CFilterFieldFieldFieldOpExprNode::CFilterFieldFieldFieldOpExprNode(IFilterExprNode* child1, const std::string& opId, IFilterExprNode* child2, IFilterExprNode* child3)", - "Impossible to create the new expression node, an invalid child node was provided."); - } - - std::shared_ptr CFilterFieldFieldFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const - { - std::shared_ptr filter(new CFieldFieldFieldArithmeticFilter(gc, opId)); - auto ret1=child1->reduce(gc, thisField); - auto ret2=child2->reduce(gc, thisField); - auto ret3=child3->reduce(gc, thisField); - if (ret1 && ret2 && ret3) - { - ret1->connectOutput(filter, 0); - ret2->connectOutput(filter, 1); - ret3->connectOutput(filter, 2); - } - else filter.reset() ; - return filter; - } - -} diff --git a/xios_2311_src/trunk/.svn/pristine/2a/2a29a0ef68377d8bdf7bdea3d47f457e5c0f5e3f.svn-base b/xios_2311_src/trunk/.svn/pristine/2a/2a29a0ef68377d8bdf7bdea3d47f457e5c0f5e3f.svn-base deleted file mode 100644 index 1854c17350d0781c256028b0047378ae1a6c44cd..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/2a/2a29a0ef68377d8bdf7bdea3d47f457e5c0f5e3f.svn-base +++ /dev/null @@ -1,20 +0,0 @@ -#include "field_impl.hpp" - -namespace xios -{ - template void CField::setData<1>(const CArray& _data); - template void CField::setData<2>(const CArray& _data); - template void CField::setData<3>(const CArray& _data); - template void CField::setData<4>(const CArray& _data); - template void CField::setData<5>(const CArray& _data); - template void CField::setData<6>(const CArray& _data); - template void CField::setData<7>(const CArray& _data); - - template void CField::getData<1>(CArray& _data) const; - template void CField::getData<2>(CArray& _data) const; - template void CField::getData<3>(CArray& _data) const; - template void CField::getData<4>(CArray& _data) const; - template void CField::getData<5>(CArray& _data) const; - template void CField::getData<6>(CArray& _data) const; - template void CField::getData<7>(CArray& _data) const; -} diff --git a/xios_2311_src/trunk/.svn/pristine/2a/2a64e63c035eb79a97802bf0912ca3fea5de579c.svn-base b/xios_2311_src/trunk/.svn/pristine/2a/2a64e63c035eb79a97802bf0912ca3fea5de579c.svn-base deleted file mode 100644 index 9f49535b183ac0ee0a0d68c72b8ce489c450ed66..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/2a/2a64e63c035eb79a97802bf0912ca3fea5de579c.svn-base +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef __XIOS_CMaximum__ -#define __XIOS_CMaximum__ - -/// XIOS headers /// -#include "functor.hpp" -#include "array_new.hpp" - -namespace xios -{ - namespace func - { - /// ////////////////////// Déclarations ////////////////////// /// - class CMaximum : public CFunctor - { - /// Définition de type /// - typedef CFunctor SuperClass; - - public : - - /// Constructeurs /// - //CMaximum(void); // Not implemented. - //CMaximum(const CFunData & data); - CMaximum(CArray& doutput); - CMaximum(CArray& doutput, double missingValue); - //CMaximum(const CMaximum & Maximum); // Not implemented. - //CMaximum(const CMaximum * const Maximum); // Not implemented. - - /// Traitement /// - virtual void apply(const CArray& dinput, CArray& doutput); - virtual ETimeType timeType(void) { return centered ; } - - /// Destructeur /// - virtual ~CMaximum(void); - - }; // class CMaximum - - } // namespace func -} // namespace xios - -#endif //__XIOS_CMaximum__ diff --git a/xios_2311_src/trunk/.svn/pristine/2a/2a73a97fa126529663a87e2e01f3477a285b0d67.svn-base b/xios_2311_src/trunk/.svn/pristine/2a/2a73a97fa126529663a87e2e01f3477a285b0d67.svn-base deleted file mode 100644 index c9c9ca2542f31d17d7990a09b7c659edcbfa8abc..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/2a/2a73a97fa126529663a87e2e01f3477a285b0d67.svn-base +++ /dev/null @@ -1,128 +0,0 @@ -/* Copyright 2009, UCAR/Unidata and OPeNDAP, Inc. - See the COPYRIGHT file for more information. */ - -#include "config.h" -#include "ocinternal.h" -#include "ocdebug.h" - -#define LBRACKET '[' -#define RBRACKET ']' - - - -/* -Client parameters are assumed to be -one or more instances of bracketed pairs: -e.g "[...][...]...". -The bracket content in turn is assumed to be a -comma separated list of = pairs. -e.g. x=y,z=,a=b. -If the same parameter is specifed more than once, -then the first occurrence is used; this is so that -is possible to forcibly override user specified -parameters by prefixing. -IMPORTANT: client parameter string is assumed to -have blanks compress out. -*/ - -int -ocparamdecode(OCstate* state) -{ - int i; - i = ocuridecodeparams(state->uri); - return i?OC_NOERR:OC_EBADURL; -} - - -const char* -ocparamlookup(OCstate* state, const char* key) -{ - if(state == NULL || key == NULL || state->uri == NULL) return NULL; - return ocurilookup(state->uri,key); -} - -int -ocparamset(OCstate* state, const char* params) -{ - int i; - i = ocurisetparams(state->uri,params); - return i?OC_NOERR:OC_EBADURL; -} - -#ifdef OCIGNORE -void -ocparamfree(OClist* params) -{ - int i; - if(params == NULL) return; - for(i=0;i found and deleted; - 0 => param not found -*/ -int -ocparamdelete(OClist* params, const char* clientparam) -{ - int i,found = 0; - if(params == NULL || clientparam == NULL) return 0; - for(i=0;i not already defined - 0 => param already defined (no change) -*/ -int -ocparaminsert(OClist* params, const char* clientparam, const char* value) -{ - int i; - if(params == NULL || clientparam == NULL) return 0; - for(i=0;i replacement performed - 0 => insertion performed -*/ -int -ocparamreplace(OClist* params, const char* clientparam, const char* value) -{ - int i; - if(params == NULL || clientparam == NULL) return 0; - for(i=0;i C99 - - SUBROUTINE cxios_set_reduce_domain_to_scalar_local(reduce_domain_to_scalar_hdl, local) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: reduce_domain_to_scalar_hdl - LOGICAL (KIND=C_BOOL) , VALUE :: local - END SUBROUTINE cxios_set_reduce_domain_to_scalar_local - - SUBROUTINE cxios_get_reduce_domain_to_scalar_local(reduce_domain_to_scalar_hdl, local) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: reduce_domain_to_scalar_hdl - LOGICAL (KIND=C_BOOL) :: local - END SUBROUTINE cxios_get_reduce_domain_to_scalar_local - - FUNCTION cxios_is_defined_reduce_domain_to_scalar_local(reduce_domain_to_scalar_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_reduce_domain_to_scalar_local - INTEGER (kind = C_INTPTR_T), VALUE :: reduce_domain_to_scalar_hdl - END FUNCTION cxios_is_defined_reduce_domain_to_scalar_local - - - SUBROUTINE cxios_set_reduce_domain_to_scalar_operation(reduce_domain_to_scalar_hdl, operation, operation_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: reduce_domain_to_scalar_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: operation - INTEGER (kind = C_INT) , VALUE :: operation_size - END SUBROUTINE cxios_set_reduce_domain_to_scalar_operation - - SUBROUTINE cxios_get_reduce_domain_to_scalar_operation(reduce_domain_to_scalar_hdl, operation, operation_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: reduce_domain_to_scalar_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: operation - INTEGER (kind = C_INT) , VALUE :: operation_size - END SUBROUTINE cxios_get_reduce_domain_to_scalar_operation - - FUNCTION cxios_is_defined_reduce_domain_to_scalar_operation(reduce_domain_to_scalar_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_reduce_domain_to_scalar_operation - INTEGER (kind = C_INTPTR_T), VALUE :: reduce_domain_to_scalar_hdl - END FUNCTION cxios_is_defined_reduce_domain_to_scalar_operation - - END INTERFACE - -END MODULE reduce_domain_to_scalar_interface_attr diff --git a/xios_2311_src/trunk/.svn/pristine/2a/2a80cd82218f38e590c1a49b358cd88670798314.svn-base b/xios_2311_src/trunk/.svn/pristine/2a/2a80cd82218f38e590c1a49b358cd88670798314.svn-base deleted file mode 100644 index d00502a337866d6048d0092fdb99f1cbe8ad9d94..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/2a/2a80cd82218f38e590c1a49b358cd88670798314.svn-base +++ /dev/null @@ -1,72 +0,0 @@ -#ifndef __SERVER_CONTEXT_HPP__ -#define __SERVER_CONTEXT_HPP__ -#include "xios_spl.hpp" -#include "window_manager.hpp" -#include "mpi.hpp" - -namespace xios -{ - class CContext ; - class CService ; - - class CServerContext - { - const int NOTIFY_NOTHING=0 ; - const int NOTIFY_CREATE_INTERCOMM=1 ; - - public: - CServerContext(CService* parentService, MPI_Comm contextComm, const std::string& poolId, const std::string& serviceId, - const int& partitionId, const std::string& contextId) ; - ~CServerContext() ; - static void releaseStaticAllocation(void) { overlapedComm_.clear() ;} - - bool createIntercomm(const string& poolId, const string& serviceId, const int& partitionId, const string& contextId, - const MPI_Comm& intraComm, MPI_Comm& interCommClient, MPI_Comm& interCommServer, bool wait=true) ; - void createIntercomm(int remoteLeader, const string& sourceContext) ; - - void sendNotification(int rank); - void checkNotifications(void) ; - - bool eventLoop(bool serviceOnly=false) ; - void notificationsDumpOut(CBufferOut& buffer) ; - void notificationsDumpIn(CBufferIn& buffer) ; - void finalizeSignal(void) ; - void freeComm(void) ; - bool isAttachedMode(void) { return isAttachedMode_ ;} - CService* getParentService(void) {return parentService_ ; } - - private: - void createIntercomm(void) ; - - static std::map > overlapedComm_ ; - - MPI_Comm contextComm_ ; - MPI_Comm xiosComm_ ; - - CContext* context_ ; - CService* parentService_ ; - std::string name_ ; - - vector clientsInterComm_ ; - - - const size_t maxBufferSize_=1024*1024 ; - CWindowManager* winNotify_ ; - int notifyInType_, notifyOutType_ ; - tuple notifyInCreateIntercomm_, notifyOutCreateIntercomm_ ; - - const int localLeader_=0 ; - int globalLeader_ ; - bool finalizeSignal_ ; - bool hasNotification_ ; - bool isAttachedMode_ ; - - const double eventLoopLatency_=0; - double lastEventLoop_=0. ; - - friend class CWindowManager ; - } ; - -} - -#endif diff --git a/xios_2311_src/trunk/.svn/pristine/2a/2ab3116516bd604168063fb94703431b8064ff4f.svn-base b/xios_2311_src/trunk/.svn/pristine/2a/2ab3116516bd604168063fb94703431b8064ff4f.svn-base deleted file mode 100644 index 911bef3c980eb7abcea2e36f5718788122964973..0000000000000000000000000000000000000000 Binary files a/xios_2311_src/trunk/.svn/pristine/2a/2ab3116516bd604168063fb94703431b8064ff4f.svn-base and /dev/null differ diff --git a/xios_2311_src/trunk/.svn/pristine/2a/2aea34d07166b9703b62b0a46538d23af19cc928.svn-base b/xios_2311_src/trunk/.svn/pristine/2a/2aea34d07166b9703b62b0a46538d23af19cc928.svn-base deleted file mode 100644 index 6b0b1cbe7f920cf01f584ca4e57ca18f9aedd168..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/2a/2aea34d07166b9703b62b0a46538d23af19cc928.svn-base +++ /dev/null @@ -1,207 +0,0 @@ -PROGRAM test_regular - - USE xios - IMPLICIT NONE - INCLUDE "mpif.h" - - INTEGER, PARAMETER :: ntime=1 - - CHARACTER(len=*),PARAMETER :: id="client" - TYPE(xios_duration) :: dtime - TYPE(xios_context) :: ctx_hdl - TYPE(xios_field) :: field_hdl - TYPE(xios_fieldgroup) :: fieldgroup_hdl - TYPE(xios_file) :: file_hdl - LOGICAL :: ok - CHARACTER(len=256) :: crname - INTEGER :: ts - INTEGER :: comm - INTEGER :: ierr - INTEGER :: sizeComm, rank ! SIZE is a fortran function - - INTEGER :: nlon = 100 - INTEGER :: nlat = 100 - INTEGER :: ncell - INTEGER :: ilat, ilon, ind - DOUBLE PRECISION :: lon1, lon2, lat1, lat2 - INTEGER :: ni, ibegin - - DOUBLE PRECISION,ALLOCATABLE :: lon_glo(:) - DOUBLE PRECISION,ALLOCATABLE :: lat_glo(:) - DOUBLE PRECISION,ALLOCATABLE :: bounds_lon_glo(:,:) - DOUBLE PRECISION,ALLOCATABLE :: bounds_lat_glo(:,:) - DOUBLE PRECISION,ALLOCATABLE :: field_temp_glo(:,:) - DOUBLE PRECISION,ALLOCATABLE :: lon(:) - DOUBLE PRECISION,ALLOCATABLE :: lat(:) - DOUBLE PRECISION,ALLOCATABLE :: bounds_lon(:,:) - DOUBLE PRECISION,ALLOCATABLE :: bounds_lat(:,:) - DOUBLE PRECISION,ALLOCATABLE :: field_temp(:,:) - DOUBLE PRECISION,ALLOCATABLE :: field_temp1(:,:) - DOUBLE PRECISION,ALLOCATABLE :: field_temp2(:,:) - -!!! MPI Initialization - CALL MPI_INIT(ierr) - -!!! XIOS Initialization (get the local communicator) - CALL xios_initialize(id,return_comm=comm) - -!########################################################################### -! Contexte ATM -!########################################################################### - -!!! Initialisation des coordonnées globales et locales pour la grille régulière - -! Regions around the poles are not included into the grid -! The whole grid is rectangular (nvertex=4) - - ncell = nlon * (nlat-1) - ALLOCATE(lon_glo(ncell)) - ALLOCATE(lat_glo(ncell)) - ALLOCATE(bounds_lon_glo(4,ncell)) - ALLOCATE(bounds_lat_glo(4,ncell)) - ALLOCATE(field_temp_glo(ncell,ntime)) - - - ind = 0 - DO ilat = 1, nlat-1 - DO ilon = 1, nlon - - ind=ind+1 - - lon1 = 360./DBLE(nlon) * DBLE(ilon-1) - lon2 = lon1 + 360./DBLE(nlon) - - lat1 = (90. + 90./DBLE(nlat)) - 180./DBLE(nlat)*DBLE(ilat) - lat2 = lat1 - 180./DBLE(nlat) - - lon_glo(ind) = (lon1+lon2)*0.5 - lat_glo(ind) = (lat1+lat2)*0.5 - - bounds_lon_glo(1,ind) = lon1 - bounds_lon_glo(2,ind) = lon2 - bounds_lon_glo(3,ind) = lon2 - bounds_lon_glo(4,ind) = lon1 - - bounds_lat_glo(1,ind) = lat1 - bounds_lat_glo(2,ind) = lat1 - bounds_lat_glo(3,ind) = lat2 - bounds_lat_glo(4,ind) = lat2 - - field_temp_glo(ind,1) = DBLE(ind) - - ENDDO - ENDDO - -! Initialization of local variables - - CALL MPI_COMM_RANK(comm,rank,ierr) - CALL MPI_COMM_SIZE(comm,size,ierr) - - IF (MOD(ncell, size) == 0) THEN - ni = ncell/size - ibegin = rank*ni - ELSE - IF (rank < MOD(ncell, size)) THEN - ni = ncell/size + 1 - ibegin = rank*(ncell/size + 1) - ELSE - ni = ncell/size - IF (rank == MOD(ncell, size)) THEN - ibegin = rank*(ncell/size + 1) - ELSE - ibegin = MOD(ncell,size)*(ncell/size + 1) + (rank-MOD(ncell,size))*ncell/size - END IF - END IF - END IF - - ALLOCATE(lon(ni)) - ALLOCATE(lat(ni)) - ALLOCATE(bounds_lon(4,ni)) - ALLOCATE(bounds_lat(4,ni)) - ALLOCATE(field_temp(ni,ntime)) - ALLOCATE(field_temp1(ni,ntime)) - ALLOCATE(field_temp2(ni,ntime)) - lon = lon_glo(ibegin:1+ibegin+ni) - lat = lat_glo(ibegin:1+ibegin+ni) - bounds_lon(:,:) = bounds_lon_glo(:,ibegin:1+ibegin+ni) - bounds_lat(:,:) = bounds_lat_glo(:,ibegin:1+ibegin+ni) - - field_temp(:,:) = rank - field_temp1(:,:) = rank - field_temp2(:,:) = rank + 10 - - -!!! Context ATMOSPHERE - - CALL xios_context_initialize("atmosphere",comm) - CALL xios_get_handle("atmosphere",ctx_hdl) - CALL xios_set_current_context(ctx_hdl) - - CALL xios_define_calendar(type="Gregorian", & - start_date=xios_date(2000, 01, 01, 00, 00, 00), & - time_origin=xios_date(1999, 01, 01, 15, 00, 00)) - - CALL xios_set_domain_attr("face1", ni_glo=ncell, ibegin=ibegin, ni=ni, type='unstructured') - CALL xios_set_domain_attr("face1", lonvalue_1d=lon, latvalue_1d=lat) - CALL xios_set_domain_attr("face1", bounds_lon_1d=bounds_lon, bounds_lat_1d=bounds_lat) - - CALL xios_set_domain_attr("face2", ni_glo=ncell, ibegin=ibegin, ni=ni, type='unstructured') - CALL xios_set_domain_attr("face2", lonvalue_1d=lon, latvalue_1d=lat) - CALL xios_set_domain_attr("face2", bounds_lon_1d=bounds_lon, bounds_lat_1d=bounds_lat) - -!!! Definition du timestep - - dtime%second=3600 - CALL xios_set_timestep(timestep=dtime) - -!!! Fin de la definition du contexte - - CALL xios_close_context_definition() - - -!#################################################################################### -!!! Boucle temporelle -!#################################################################################### - - DO ts=1,1 - -!!! Mise a jour du pas de temps - CALL xios_update_calendar(ts) - -!!! On donne la valeur du champ atm - CALL xios_send_field("temp1",field_temp1(:,1)) - CALL xios_send_field("temp2",field_temp2(:,1)) - - ENDDO - -!#################################################################################### -!!! Finalisation -!#################################################################################### - -!!! Fin des contextes - - CALL xios_context_finalize() - - DEALLOCATE(lon_glo, lat_glo) - DEALLOCATE(bounds_lon_glo, bounds_lat_glo) - DEALLOCATE(field_temp_glo) - DEALLOCATE(lon, lat) - DEALLOCATE(bounds_lon, bounds_lat) - DEALLOCATE(field_temp) - DEALLOCATE(field_temp1, field_temp2) - -!!! Fin de XIOS - - CALL MPI_COMM_FREE(comm, ierr) - - CALL xios_finalize() - - CALL MPI_FINALIZE(ierr) - - END PROGRAM test_regular - - - - - - diff --git a/xios_2311_src/trunk/.svn/pristine/2b/2b737d758c82e48cdf2883829c41a96bf3197853.svn-base b/xios_2311_src/trunk/.svn/pristine/2b/2b737d758c82e48cdf2883829c41a96bf3197853.svn-base deleted file mode 100644 index a7800a006db86589efeb78e1650735fb093acf29..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/2b/2b737d758c82e48cdf2883829c41a96bf3197853.svn-base +++ /dev/null @@ -1,328 +0,0 @@ -#include "calendar.hpp" -#include "duration.hpp" -#include "date.hpp" -#include "calendar_util.hpp" - -namespace xios -{ - /// ////////////////////// Définitions ////////////////////// /// - CCalendar::CCalendar(void) - : CObject() - , step(0) - , initDate(*this) - , timeOrigin(*this) - , currentDate(*this) - {} - - CCalendar::CCalendar(const StdString& id) - : CObject(id) - , step(0) - , initDate(*this) - , timeOrigin(*this) - , currentDate(*this) - {} - - CCalendar::CCalendar(const StdString& id, - int yr, int mth, int d, - int hr /*= 0*/, int min /*= 0*/, int sec /*= 0*/) - : CObject(id) - , step(0) - , initDate(*this) - , timeOrigin(*this) - , currentDate(*this) - { - initializeDate(yr, mth, d, hr, min, sec); - } - - CCalendar::CCalendar(const StdString& id, const CDate& startDate) - : CObject(id) - , step(0) - , initDate(startDate) - , timeOrigin(startDate) - , currentDate(startDate) - { - // Initialize the dates only in the derivated classes - // since we want to use the overloaded virtual functions - } - - CCalendar::CCalendar(const StdString& id, const CDate& startDate, const CDate& timeOrigin) - : CObject(id) - , step(0) - , initDate(startDate) - , timeOrigin(timeOrigin) - , currentDate(startDate) - { - // Initialize the dates only in the derivated classes - // since we want to use the overloaded virtual functions - } - - void CCalendar::initializeDate() - { - if (!initDate.setRelCalendar(*this)) - ERROR("CCalendar::initializeDate()", - "initDate: Bad format or date not conform to the calendar"); - if (!timeOrigin.setRelCalendar(*this)) - ERROR("CCalendar::initializeDate()", - "timeOrigin: Bad format or date not conform to the calendar"); - if (!currentDate.setRelCalendar(*this)) - ERROR("CCalendar::initializeDate()", - "currentDate: Bad format or date not conform to the calendar"); - } - - void CCalendar::initializeDate(int yr, int mth, int d, - int hr /*= 0*/, int min /*= 0*/, int sec /*= 0*/) - { - initDate = CDate(*this, yr, mth, d, hr, min, sec); - timeOrigin = initDate; - currentDate = initDate; - } - - void CCalendar::initializeDate(const StdString& dateStr) - { - initDate = CDate::FromString(dateStr, *this); - timeOrigin = initDate; - currentDate = initDate; - } - - void CCalendar::initializeDate(const StdString& dateStr, const StdString& timeOriginStr) - { - initDate = CDate::FromString(dateStr, *this); - timeOrigin = CDate::FromString(timeOriginStr, *this); - currentDate = initDate; - } - - CCalendar::~CCalendar(void) - { /* Ne rien faire de plus */ } - - ///--------------------------------------------------------------- - - StdString CCalendar::toString(void) const - { - StdOStringStream oss; - oss << "[type: " << this->getId() - << ", start: " << this->initDate - << ", current: " << this->currentDate << "]"; - return (oss.str()); - } - - void CCalendar::fromString(const StdString& str) - { ERROR("CCalendar::fromString(str)", - << "[ str = " << str << "] Not implemented yet !"); } - - //----------------------------------------------------------------- - - void CCalendar::setTimeStep(const CDuration& timestep) - { - if (timestep.timestep) - ERROR("CCalendar::setTimeStep(const CDuration& timestep)", - << "Circular definition of the timestep: the timestep cannot refer to itself."); - this->timestep = timestep; - } - - int CCalendar::getStep(void) const - { - return step; - } - - const CDate& CCalendar::update(int step) - { - info(20) << "update step : " << step << " timestep " << this->timestep << std::endl; - this->step = step; - return (this->currentDate = this->getInitDate() + step * this->timestep); - } - - //----------------------------------------------------------------- - - void CCalendar::setInitDate(const CDate& initDate) - { - if (&initDate.getRelCalendar() != this) - ERROR("CCalendar::setInitDate(const CDate& initDate)", - << "The init date cannot be attached to another calendar."); - this->initDate = initDate; - } - - void CCalendar::setTimeOrigin(const CDate& timeOrigin) - { - if (&timeOrigin.getRelCalendar() != this) - ERROR("CCalendar::setInitDate(const CDate& timeOrigin)", - << "The time origin cannot be attached to another calendar."); - this->timeOrigin = timeOrigin; - } - - //----------------------------------------------------------------- - - const CDuration& CCalendar::getTimeStep(void) const { return this->timestep; } - const CDate& CCalendar::getInitDate(void) const { return this->initDate; } - const CDate& CCalendar::getTimeOrigin(void) const { return this->timeOrigin; } - const CDate& CCalendar::getCurrentDate(void) const { return this->currentDate; } - - //----------------------------------------------------------------- - - int CCalendar::getMonthLength(const CDate& date) const - { // Retourne la durée du mois en jour. - static const int NoLeapMonthLength[] = - { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; - return NoLeapMonthLength[date.getMonth() - 1]; - } - - StdString CCalendar::getType(void) const { return StdString(this->getId()); } - - int CCalendar::getYearTotalLength(const CDate& date) const { return (365 * 86400); } - - int CCalendar::getYearLength (void) const { return 12; } - int CCalendar::getDayLength (void) const { return 24; } - int CCalendar::getHourLength (void) const { return 60; } - int CCalendar::getMinuteLength(void) const { return 60; } - int CCalendar::getDayLengthInSeconds(void) const { return getDayLength() * getHourLength() * getMinuteLength(); } - - bool CCalendar::hasLeapYear() const { return false; } - - StdString CCalendar::getMonthName(int monthId) const - { - static const StdString MonthNames[] = - { "january", "february", "march", "april" , "may", "june", - "july", "august", "september", "october", "november", "december" }; - return MonthNames[monthId - 1]; - } - - const StdString CCalendar::getMonthShortName(int monthId) const - { StdString value = this->getMonthName(monthId); value.resize(3); return value; } - - CDuration& CCalendar::resolve(CDuration& dur, bool noNegativeTime /*= false*/) const - { - const int hourLengthInSeconds = getHourLength() * getMinuteLength(); - - // Simplify the days, hours, minutes and seconds. - // First convert them to seconds - Time t = Time(modf(dur.day, &dur.day) * getDayLengthInSeconds() - + (dur.hour * getHourLength() + dur.minute) * getMinuteLength() + dur.second); - // Then convert back to days - dur.day += int(t / getDayLengthInSeconds()); - t %= getDayLengthInSeconds(); - - // Do we allow hour, minute, second to be negative? - if (noNegativeTime) - { - // If we don't, we remove some days until the time is positive - while (t < 0) - { - t += getDayLengthInSeconds(); - dur.day -= 1.0; - } - } - - // hours - dur.hour = int(t / hourLengthInSeconds); - t %= hourLengthInSeconds; - // minutes - dur.minute = int(t / getMinuteLength()); - // secondes - dur.second = int(t % getMinuteLength()); - - // Nothing to do for the months yet since this depends on an actual date - - // Simplify the years - dur.month += modf(dur.year, &dur.year) * getYearLength(); - dur.year += int(dur.month) / getYearLength(); dur.month = int(dur.month) % getYearLength(); - - return dur; - } - - /*! Parse a date using a generic parser. */ - void CCalendar::parseDateDefault(StdIStream& in, CDate& date) - { - char sep = '-'; // Le caractère c est utilisé pour "recueillir" les séparateurs "/" et ":". - char c; - - // Default initialize the date - int year = 00, month = 01, day = 01; - int hour = 00, minute = 00, second = 00; - - in >> year >> c; - if (c == sep) - { - in >> month >> c; - if (c == sep) - { - in >> day; - c = in.get(); - sep = ' '; - if (c == sep) - { - in >> hour >> c; - sep = ':'; - if (c == sep) - { - in >> minute >> c; - if (c == sep) - { - in >> second; - in >> c; - } - } - } - } - } - - date.setDate(year, month, day, hour, minute, second); - - // Delay the verification until we get a calendar we can compare the date to - if (date.hasRelCalendar() && !date.checkDate()) - ERROR("void parseDateDefault(StdIStream& in, CDate& date)", - << "Bad date format or not conform to calendar"); - - if (c == '+') // We will be adding a duration to the date - { - CDuration dur; - in >> dur; - date = date + dur; - } - else if (!in.eof()) - ERROR("void parseDateDefault(StdIStream& in, CDate& date)", - << "Invalid date format: unexpected trailing character(s)"); - } - - /*! Parse a date using the calendar's parser. */ - void CCalendar::parseDate(StdIStream& in, CDate& date) const - { - parseDateDefault(in, date); - } - - /*! Test if a date is valid with regard to the current calendar. */ - bool CCalendar::checkDate(CDate& date) const - { - bool isValid = true; - - // Vérification de la valeur du mois. - if (date.getMonth() < 1) - { isValid = false; date.setMonth(1); } - else if (date.getMonth() > getYearLength()) - { isValid = false; date.setMonth(getYearLength()); } - - // Vérification de la valeur du jour. - if (date.getDay() < 1) - { isValid = false; date.setDay(1); } - else if (date.getDay() > getMonthLength(*this)) - { isValid = false; date.setDay(getMonthLength(*this)); } - - // Vérification de la valeur de l'heure. - if (date.getHour() < 0) - { isValid = false; date.setHour(0); } - else if (date.getHour() >= getDayLength()) - { isValid = false; date.setHour(getDayLength() - 1); } - - // Vérification de la valeur des minutes. - if (date.getMinute() < 0) - { isValid = false; date.setMinute(0); } - else if (date.getMinute() >= getHourLength()) - { isValid = false; date.setMinute(getHourLength() - 1); } - - // Vérification de la valeur des secondes. - if (date.getSecond() < 0) - { isValid = false; date.setSecond(0); } - else if (date.getSecond() >= getMinuteLength()) - { isValid = false; date.setSecond(getMinuteLength() - 1); } - - return isValid; - } -} // namespace xios diff --git a/xios_2311_src/trunk/.svn/pristine/2b/2b73d9a4d095d5225e6737dd7f91bc6f8a525bca.svn-base b/xios_2311_src/trunk/.svn/pristine/2b/2b73d9a4d095d5225e6737dd7f91bc6f8a525bca.svn-base deleted file mode 100644 index ff58d44539b3bd5893e5e78f2a00ea0c1f01c824..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/2b/2b73d9a4d095d5225e6737dd7f91bc6f8a525bca.svn-base +++ /dev/null @@ -1,87 +0,0 @@ -#include "grid_transform_connector.hpp" -#include "element.hpp" -#include "scatterer_connector.hpp" -#include "gatherer_connector.hpp" -#include "grid_remote_connector.hpp" - - -namespace xios -{ - void CGridTransformConnector::computeConnector(bool eliminateRedundant) - { - int commSize ; - int commRank ; - MPI_Comm_size(localComm_, &commSize) ; - MPI_Comm_rank(localComm_, &commRank) ; - int nElements = srcViews_.size() ; - - auto remoteConnector = make_shared(srcViews_, remoteViews_, localComm_, commSize) ; - remoteConnector->computeConnector(eliminateRedundant) ; - - vector> sendElements(nElements) ; - scattererConnector_.resize(nElements) ; - gathererConnector_.resize(nElements) ; - - for(int i=0;i(srcViews_[i]->getGlobalSize(), remoteConnector->getDistributedGlobalIndex(i)) ; - sendElements[i]->addFullView() ; - scattererConnector_[i] = make_shared(srcViews_[i], sendElements[i]->getView(CElementView::FULL), localComm_, commSize) ; - scattererConnector_[i]->computeConnector() ; - std::map>& sendIndex = sendElements[i]->getGlobalIndex() ; - - // how much sender ? - vector nbSenders(commSize) ; - int nbSender ; - for(auto& it : sendIndex) nbSenders[it.first]=1 ; - vector recvCounts(commSize,1) ; - MPI_Reduce_scatter(nbSenders.data(), &nbSender, recvCounts.data(), MPI_INT, MPI_SUM, localComm_) ; - - // transfer global index - // send Index - vector sendReq ; - for(auto& it : sendIndex) - { - MPI_Request req ; - MPI_Isend(it.second.dataFirst(), it.second.numElements(), MPI_SIZE_T, it.first,0, localComm_, &req) ; - sendReq.push_back(req) ; - } - - // receive index - map> recvIndex ; - - for(int j=0; j recvBuff(size) ; - MPI_Recv(recvBuff.data(), size, MPI_SIZE_T, status.MPI_SOURCE,0, localComm_,&status) ; - if (size!=0) { - CArray arrayTmp(recvBuff.data(), shape(recvBuff.size()), duplicateData) ; - recvIndex[status.MPI_SOURCE].reference(arrayTmp) ; - } - else { - CArray arrayTmp(0) ; - recvIndex[status.MPI_SOURCE].reference(arrayTmp) ; - } - if (recvRankSize_.count(status.MPI_SOURCE)==0) recvRankSize_[status.MPI_SOURCE] = size ; - else recvRankSize_[status.MPI_SOURCE] *= size ; - } - vector sendStatus(sendReq.size()) ; - MPI_Waitall(sendReq.size(),sendReq.data(),sendStatus.data()) ; - - // create gatherer connector - - auto recvElement = make_shared(remoteViews_[i]->getGlobalSize(), recvIndex) ; - recvElement->addFullView() ; - gathererConnector_[i] = make_shared(recvElement->getView(CElementView::FULL), remoteViews_[i]) ; - gathererConnector_[i]->computeConnector() ; - } - - gridScattererConnector_ = make_shared(scattererConnector_) ; - gridGathererConnector_ = make_shared(gathererConnector_) ; - } - -} diff --git a/xios_2311_src/trunk/.svn/pristine/2b/2b9cb93c7735ea6822f1c1962ddb3062dc5e4d1b.svn-base b/xios_2311_src/trunk/.svn/pristine/2b/2b9cb93c7735ea6822f1c1962ddb3062dc5e4d1b.svn-base deleted file mode 100644 index 963ad09000990918ce8c828693fc1d0d24b21dc0..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/2b/2b9cb93c7735ea6822f1c1962ddb3062dc5e4d1b.svn-base +++ /dev/null @@ -1,111 +0,0 @@ -#include "tracer.hpp" - -#if defined(VTRACE) - -#include - -#elif defined(SCOREP) - -#include - -#elif defined(ITAC) - -#include - -#endif - -#include -#include -#include - -namespace xios -{ - using namespace std ; - - std::map regionId ; - int count=0 ; - bool traceIsOn=true ; - int stackOnOffdeep=0 ; - - void traceOn(void) - { - stackOnOffdeep-- ; - if (stackOnOffdeep!=0) return ; - traceIsOn=true; - -#if defined(VTRACE) - VT_ON() ; -#elif defined(SCOREP) - SCOREP_RECORDING_ON() ; -#elif defined(ITAC) - VT_traceon() ; -#endif - } - - void traceOff(void) - { - stackOnOffdeep++ ; - if (stackOnOffdeep!=1) return ; - traceIsOn=false; -#if defined(VTRACE) - VT_OFF() ; -#elif defined(SCOREP) - SCOREP_RECORDING_OFF() -#elif defined(ITAC) - VT_traceoff() ; -#endif - } - - void traceBegin(const string& name) - { -#if defined(VTRACE) - - if (traceIsOn) VT_USER_START(name.c_str()) ; -#elif defined(SCOREP) - SCOREP_USER_REGION_BY_NAME_BEGIN(name.c_str(),SCOREP_USER_REGION_TYPE_COMMON) - -#elif defined(ITAC) - int classhandle ; - auto it = regionId.find(name); - if (it==regionId.end()) - { - classhandle=count ; - count++ ; - VT_symdef (classhandle, name.c_str(), "XIOS") ; - regionId[name]=classhandle; - } - else classhandle = it->second ; - VT_begin(classhandle) ; - cout<<"VT_begin "<second ; - VT_end(classhandle) ; - cout<<"VT_end "< CAxisAlgorithmExtract::create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) -TRY -{ - std::vector axisListDestP = gridDst->getAxis(); - std::vector axisListSrcP = gridSrc->getAxis(); - - CExtractAxis* extractAxis = dynamic_cast (transformation); - int axisDstIndex = elementPositionInGridDst2AxisPosition[elementPositionInGrid]; - int axisSrcIndex = elementPositionInGridSrc2AxisPosition[elementPositionInGrid]; - - return make_shared(isSource, axisListDestP[axisDstIndex], axisListSrcP[axisSrcIndex], extractAxis); -} -CATCH - -bool CAxisAlgorithmExtract::dummyRegistered_ = CAxisAlgorithmExtract::registerTrans(); -bool CAxisAlgorithmExtract::registerTrans() -TRY -{ - return CGridTransformationFactory::registerTransformation(TRANS_EXTRACT_AXIS, create); -} -CATCH - -CAxisAlgorithmExtract::CAxisAlgorithmExtract(bool isSource, CAxis* axisDestination, CAxis* axisSource, CExtractAxis* extractAxis) -: CAlgorithmTransformationTransfer(isSource), axisDest_(axisDestination), axisSrc_(axisSource) -TRY -{ - axisDestination->axis_type.reset(); - axisDestination->n_glo.reset(); - axisDestination->index.reset(); - axisDestination->n.reset(); - axisDestination->begin.reset(); - - axisDestination->mask.reset(); - axisDestination->data_index.reset(); - axisDestination->data_n.reset(); - axisDestination->data_begin.reset(); - - axisDestination->value.reset(); - axisDestination->label.reset(); - axisDestination->bounds.reset(); - - extractAxis->checkValid(axisSource); - extractBegin_ = extractAxis->begin.getValue(); - extractN_ = extractAxis->n.getValue(); - extractEnd_ = extractBegin_ + extractN_ - 1; - - if (extractN_ > axisSource->n_glo.getValue()) - { - ERROR("CAxisAlgorithmExtract::CAxisAlgorithmExtract(CAxis* axisDestination, CAxis* axisSource, CExtractAxis* extractAxis)", - << "Extract size is greater than global size of source axis" - << "Global size of source axis " <getId() << " is " << axisSource->n_glo.getValue() << std::endl - << "Extract size is " << extractN_ ); - } - - int idxSrc, nDest = 0, beginDestLoc, beginDestGlo = 0 ; - int indGloDest, indGloSrc, iSrc; - for (int i = 0; i < axisSrc_->n.getValue(); i++) - { - idxSrc = axisSrc_->index(i); - if ((idxSrc >= extractBegin_) && (idxSrc <= extractEnd_)) - { - if (nDest == 0) beginDestLoc = i; - ++nDest; - } - } - - axisDest_->n_glo.setValue(extractN_); - axisDest_->index.resize(nDest); - if (nDest==0) - { - axisDest_->n.setValue( 0 ); - axisDest_->begin.setValue( 0 ); - } - - if (axisSrc_->hasValue) axisDest_->value.resize(nDest); - if (axisSrc_->hasLabel) axisDest_->label.resize(nDest); - if (axisSrc_->hasBounds) axisDest_->bounds.resize(2,nDest); - - auto& transMap = this->transformationMapping_; - - // Set attributes required to define domainDestination->localElement_ and associated views, full and workflow) - CArray sourceGlobalIdx = axisSource->getLocalElement()->getGlobalIndex(); - int indexSize = sourceGlobalIdx.numElements(); - - CArray sourceWorkflowIdx = axisSource->getLocalView(CElementView::WORKFLOW)->getIndex(); - int srcWorkflowSize = sourceWorkflowIdx.numElements(); - axisDest_->data_index.resize(nDest); - axisDest_->data_index = -1; - - int idxMin = INT_MAX; - for (int countSrc = 0; countSrc < indexSize ; ++countSrc) - { - if ( sourceGlobalIdx(countSrc) < idxMin ) - idxMin = sourceGlobalIdx(countSrc); - } - - int countDest(0); // increment of the position in destination domain - for (int countSrc = 0; countSrc < indexSize ; ++countSrc) - { - int idxSrc = sourceGlobalIdx(countSrc); - if ( (idxSrc >= extractBegin_) && (idxSrc <= extractEnd_) ) - { - axisDest_->index(countDest) = idxSrc-extractBegin_; - - // ------------------ define transformation only if in the WF ------------------ - int iIdxSrc2 = (countSrc+idxMin)%axisSource->n_glo; - int convert_locally_global_idx = (iIdxSrc2-idxMin) ; - bool concerned_by_WF(false); - for ( int i = 0 ; idata_index( countDest ) = countDest; - } - // ----------------------------------------------------------------------------- - - if (axisSrc_->hasValue) - { - axisDest_->value(countDest) = axisSrc_->value(countSrc); - } - if (axisSrc_->hasLabel) - { - axisDest_->label(countDest) = axisSrc_->label(countSrc); - } - if (axisSrc_->hasBounds) - { - axisDest_->bounds(0,countDest) = axisSrc_->bounds(0,countSrc); - axisDest_->bounds(1,countDest) = axisSrc_->bounds(1,countSrc); - } - - // if point i has been identified as extracted, increment position in destination domain for the next point - countDest++; - } - } - - axisDestination->checkAttributes() ; - - this->computeAlgorithm(axisSource->getLocalView(CElementView::WORKFLOW), axisDestination->getLocalView(CElementView::WORKFLOW)) ; -} -CATCH - - - -} diff --git a/xios_2311_src/trunk/.svn/pristine/2d/2d06cce0a7e09fd853eca5f6be8f3a498c32bf3b.svn-base b/xios_2311_src/trunk/.svn/pristine/2d/2d06cce0a7e09fd853eca5f6be8f3a498c32bf3b.svn-base deleted file mode 100644 index f461b930c6814fa40c3b63c43812d3a10fc935ff..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/2d/2d06cce0a7e09fd853eca5f6be8f3a498c32bf3b.svn-base +++ /dev/null @@ -1,11 +0,0 @@ -module purge -module load flavor/buildcompiler/intel/20 -module load mpi/openmpi/4.0.2 - -module load flavor/hdf5/parallel -module load netcdf-fortran/4.4.4 -module load hdf5/1.8.20 -module load gnu/7.3.0 - -module load totalview -module load perl/5.30.2 diff --git a/xios_2311_src/trunk/.svn/pristine/2d/2d141f94aa20a37ff74203a40b8d323ebaa8f507.svn-base b/xios_2311_src/trunk/.svn/pristine/2d/2d141f94aa20a37ff74203a40b8d323ebaa8f507.svn-base deleted file mode 100644 index 61dc04a9fe970644cadc92e5a436f4d0fb611663..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/2d/2d141f94aa20a37ff74203a40b8d323ebaa8f507.svn-base +++ /dev/null @@ -1,503 +0,0 @@ -#include "context_server.hpp" -#include "buffer_in.hpp" -#include "type.hpp" -#include "context.hpp" -#include "object_template.hpp" -#include "group_template.hpp" -#include "attribute_template.hpp" -#include "domain.hpp" -#include "field.hpp" -#include "file.hpp" -#include "grid.hpp" -#include "mpi.hpp" -#include "tracer.hpp" -#include "timer.hpp" -#include "cxios.hpp" -#include "event_scheduler.hpp" -#include "server.hpp" -#include "servers_ressource.hpp" -#include "pool_ressource.hpp" -#include "services.hpp" -#include "contexts_manager.hpp" -#include "timeline_events.hpp" - -#include -#include -#include - - -namespace xios -{ - using namespace std ; - - CContextServer::CContextServer(CContext* parent,MPI_Comm intraComm_,MPI_Comm interComm_) - : eventScheduler_(nullptr), isProcessingEvent_(false), associatedClient_(nullptr) - { - context=parent; - intraComm=intraComm_; - MPI_Comm_size(intraComm,&intraCommSize); - MPI_Comm_rank(intraComm,&intraCommRank); - - interComm=interComm_; - int flag; - MPI_Comm_test_inter(interComm,&flag); - - if (flag) attachedMode=false ; - else attachedMode=true ; - - if (flag) MPI_Comm_remote_size(interComm,&clientSize_); - else MPI_Comm_size(interComm,&clientSize_); - - - SRegisterContextInfo contextInfo ; - CXios::getContextsManager()->getContextInfo(context->getId(), contextInfo, intraComm) ; - - // if (contextInfo.serviceType != CServicesManager::CLIENT) // we must have an event scheduler => to be retrieve from the associated services - // { - //if (!isAttachedModeEnabled()) eventScheduler_=CXios::getPoolRessource()->getService(contextInfo.serviceId,contextInfo.partitionId)->getEventScheduler() ; - eventScheduler_=CXios::getPoolRessource()->getService(contextInfo.serviceId,contextInfo.partitionId)->getEventScheduler() ; - MPI_Comm_dup(intraComm, &processEventBarrier_) ; - // } - - - currentTimeLine=1; - scheduled=false; - finished=false; - - // generate unique hash for server - auto time=chrono::system_clock::now().time_since_epoch().count() ; - std::default_random_engine rd(time); // not reproducible from a run to another - std::uniform_int_distribution dist; - hashId=dist(rd) ; - MPI_Bcast(&hashId,1,MPI_SIZE_T,0,intraComm) ; // Bcast to all server of the context - - - if (!isAttachedModeEnabled()) MPI_Intercomm_merge(interComm_,true,&interCommMerged_) ; - MPI_Comm_split(intraComm_, intraCommRank, intraCommRank, &commSelf_) ; // for windows - - itLastTimeLine=lastTimeLine.begin() ; - - pureOneSided=CXios::getin("pure_one_sided",false); // pure one sided communication (for test) - if (isAttachedModeEnabled()) pureOneSided=false ; // no one sided in attach mode - - } - -//! Attached mode is used ? -//! \return true if attached mode is used, false otherwise - bool CContextServer::isAttachedModeEnabled() const - { - return attachedMode ; - } - - void CContextServer::setPendingEvent(void) - { - pendingEvent=true; - } - - bool CContextServer::hasPendingEvent(void) - { - return pendingEvent; - } - - bool CContextServer::hasFinished(void) - { - return finished; - } - - bool CContextServer::eventLoop(bool enableEventsProcessing /*= true*/) - { - CTimer::get("listen request").resume(); - listen(); - CTimer::get("listen request").suspend(); - CTimer::get("check pending request").resume(); - checkPendingRequest(); - checkPendingProbe() ; - CTimer::get("check pending request").suspend(); - CTimer::get("check event process").resume(); - if (enableEventsProcessing) processEvents(); - CTimer::get("check event process").suspend(); - return finished; - } - - void CContextServer::listen(void) - { - int rank; - int flag; - int count; - char * addr; - MPI_Status status; - MPI_Message message ; - map::iterator it; - bool okLoop; - - traceOff(); - MPI_Improbe(MPI_ANY_SOURCE, 20,interComm,&flag,&message, &status); - traceOn(); - if (flag==true) listenPendingRequest(message, status) ; - } - - bool CContextServer::listenPendingRequest( MPI_Message &message, MPI_Status& status) - { - int count; - char * addr; - map::iterator it; - int rank=status.MPI_SOURCE ; - - it=buffers.find(rank); - if (it==buffers.end()) // Receive the buffer size and allocate the buffer - { - MPI_Aint recvBuff[4] ; - MPI_Mrecv(recvBuff, 4, MPI_AINT, &message, &status); - remoteHashId_ = recvBuff[0] ; - StdSize buffSize = recvBuff[1]; - vector winAdress(2) ; - winAdress[0]=recvBuff[2] ; winAdress[1]=recvBuff[3] ; - mapBufferSize_.insert(std::make_pair(rank, buffSize)); - - // create windows dynamically for one-sided - if (!isAttachedModeEnabled()) - { - CTimer::get("create Windows").resume() ; - MPI_Comm interComm ; - MPI_Intercomm_create(commSelf_, 0, interCommMerged_, rank, 0 , &interComm) ; - MPI_Intercomm_merge(interComm, true, &winComm_[rank]) ; - CXios::getMpiGarbageCollector().registerCommunicator(winComm_[rank]) ; - MPI_Comm_free(&interComm) ; - windows_[rank].resize(2) ; - MPI_Win_create_dynamic(MPI_INFO_NULL, winComm_[rank], &windows_[rank][0]); - CXios::getMpiGarbageCollector().registerWindow(windows_[rank][0]) ; - MPI_Win_create_dynamic(MPI_INFO_NULL, winComm_[rank], &windows_[rank][1]); - CXios::getMpiGarbageCollector().registerWindow(windows_[rank][1]) ; - CTimer::get("create Windows").suspend() ; - MPI_Barrier(winComm_[rank]) ; - } - else - { - winComm_[rank] = MPI_COMM_NULL ; - windows_[rank].resize(2) ; - windows_[rank][0] = MPI_WIN_NULL ; - windows_[rank][1] = MPI_WIN_NULL ; - } - - it=(buffers.insert(pair(rank,new CServerBuffer(windows_[rank], winAdress, 0, buffSize)))).first; - lastTimeLine[rank]=0 ; - itLastTimeLine=lastTimeLine.begin() ; - - return true; - } - else - { - std::pair mypair(message,status) ; - pendingProbe[rank].push_back(mypair) ; - return false; - } - } - - void CContextServer::checkPendingProbe(void) - { - - list recvProbe ; - list::iterator itRecv ; - map > >::iterator itProbe; - - for(itProbe=pendingProbe.begin();itProbe!=pendingProbe.end();itProbe++) - { - int rank=itProbe->first ; - if (pendingRequest.count(rank)==0) - { - MPI_Message& message = itProbe->second.front().first ; - MPI_Status& status = itProbe->second.front().second ; - int count ; - MPI_Get_count(&status,MPI_CHAR,&count); - map::iterator it = buffers.find(rank); - if ( (it->second->isBufferFree(count) && !it->second->isResizing()) // accept new request if buffer is free - || (it->second->isResizing() && it->second->isBufferEmpty()) ) // or if resizing wait for buffer is empty - { - char * addr; - addr=(char*)it->second->getBuffer(count); - MPI_Imrecv(addr,count,MPI_CHAR, &message, &pendingRequest[rank]); - bufferRequest[rank]=addr; - recvProbe.push_back(rank) ; - itProbe->second.pop_front() ; - } - } - } - - for(itRecv=recvProbe.begin(); itRecv!=recvProbe.end(); itRecv++) if (pendingProbe[*itRecv].empty()) pendingProbe.erase(*itRecv) ; - } - - - void CContextServer::checkPendingRequest(void) - { - map::iterator it; - list recvRequest; - list::iterator itRecv; - int rank; - int flag; - int count; - MPI_Status status; - - if (!pendingRequest.empty()) CTimer::get("receiving requests").resume(); - else CTimer::get("receiving requests").suspend(); - - for(it=pendingRequest.begin();it!=pendingRequest.end();it++) - { - rank=it->first; - traceOff(); - MPI_Test(& it->second, &flag, &status); - traceOn(); - if (flag==true) - { - buffers[rank]->updateCurrentWindows() ; - recvRequest.push_back(rank); - MPI_Get_count(&status,MPI_CHAR,&count); - processRequest(rank,bufferRequest[rank],count); - } - } - - for(itRecv=recvRequest.begin();itRecv!=recvRequest.end();itRecv++) - { - pendingRequest.erase(*itRecv); - bufferRequest.erase(*itRecv); - } - } - - void CContextServer::getBufferFromClient(size_t timeLine) - { - CTimer::get("CContextServer::getBufferFromClient").resume() ; - if (!isAttachedModeEnabled()) // one sided desactivated in attached mode - { - int rank ; - char *buffer ; - size_t count ; - - if (itLastTimeLine==lastTimeLine.end()) itLastTimeLine=lastTimeLine.begin() ; - for(;itLastTimeLine!=lastTimeLine.end();++itLastTimeLine) - { - rank=itLastTimeLine->first ; - if (itLastTimeLine->second < timeLine && pendingRequest.count(rank)==0 && buffers[rank]->isBufferEmpty()) - { - if (buffers[rank]->getBufferFromClient(timeLine, buffer, count)) processRequest(rank, buffer, count); - if (count >= 0) ++itLastTimeLine ; - break ; - } - } - } - CTimer::get("CContextServer::getBufferFromClient").suspend() ; - } - - - void CContextServer::processRequest(int rank, char* buff,int count) - { - - CBufferIn buffer(buff,count); - char* startBuffer,endBuffer; - int size, offset; - size_t timeLine=0; - map::iterator it; - - - CTimer::get("Process request").resume(); - while(count>0) - { - char* startBuffer=(char*)buffer.ptr(); - CBufferIn newBuffer(startBuffer,buffer.remain()); - newBuffer>>size>>timeLine; - - if (timeLine==timelineEventNotifyChangeBufferSize) - { - buffers[rank]->notifyBufferResizing() ; - buffers[rank]->updateCurrentWindows() ; - buffers[rank]->popBuffer(count) ; - info(100)<<"Context id "<getId()<<" : Receive NotifyChangeBufferSize from client rank "<isBufferEmpty()<<" remaining count : "<getUsed()< winAdress(2) ; - newBuffer>>newSize>>winAdress[0]>>winAdress[1] ; - buffers[rank]->freeBuffer(count) ; - delete buffers[rank] ; - buffers[rank] = new CServerBuffer(windows_[rank], winAdress, 0, newSize) ; - info(100)<<"Context id "<getId()<<" : Receive ChangeBufferSize from client rank "<getId()<<" : Receive standard event from client rank "<(timeLine,new CEventServer(this))).first; - it->second->push(rank,buffers[rank],startBuffer,size); - if (timeLine>0) lastTimeLine[rank]=timeLine ; - } - buffer.advance(size); - count=buffer.remain(); - } - - CTimer::get("Process request").suspend(); - } - - void CContextServer::processEvents(void) - { - map::iterator it; - CEventServer* event; - -// if (context->isProcessingEvent()) return ; - if (isProcessingEvent_) return ; - if (isAttachedModeEnabled()) - if (!CXios::getDaemonsManager()->isScheduledContext(remoteHashId_)) return ; - - it=events.find(currentTimeLine); - if (it!=events.end()) - { - event=it->second; - - if (event->isFull()) - { - if (!scheduled && !isAttachedModeEnabled()) // Skip event scheduling for attached mode and reception on client side - { - eventScheduler_->registerEvent(currentTimeLine,hashId); - scheduled=true; - } - else if (isAttachedModeEnabled() || eventScheduler_->queryEvent(currentTimeLine,hashId) ) - { - - if (!eventScheduled_) - { - MPI_Ibarrier(processEventBarrier_,&processEventRequest_) ; - eventScheduled_=true ; - return ; - } - else - { - MPI_Status status ; - int flag ; - MPI_Test(&processEventRequest_, &flag, &status) ; - if (!flag) return ; - eventScheduled_=false ; - } - - if (!isAttachedModeEnabled()) eventScheduler_->popEvent() ; - //MPI_Barrier(intraComm) ; - // When using attached mode, synchronise the processes to avoid that differents event be scheduled by differents processes - // The best way to properly solve this problem will be to use the event scheduler also in attached mode - // for now just set up a MPI barrier -//ym to be check later -// if (!eventScheduler_ && CXios::isServer) MPI_Barrier(intraComm) ; - -// context->setProcessingEvent() ; - isProcessingEvent_=true ; - CTimer::get("Process events").resume(); - info(100)<<"Context id "<getId()<<" : Process Event "<classId<<" of type "<type<unsetProcessingEvent() ; - pendingEvent=false; - delete event; - events.erase(it); - currentTimeLine++; - scheduled = false; - if (isAttachedModeEnabled()) CXios::getDaemonsManager()->unscheduleContext() ; - } - } - else if (pendingRequest.empty()) getBufferFromClient(currentTimeLine) ; - } - else if (pendingRequest.empty()) getBufferFromClient(currentTimeLine) ; // if pure one sided check buffer even if no event recorded at current time line - } - - CContextServer::~CContextServer() - { - map::iterator it; - for(it=buffers.begin();it!=buffers.end();++it) delete it->second; - buffers.clear() ; - } - - void CContextServer::releaseBuffers() - { - //for(auto it=buffers.begin();it!=buffers.end();++it) delete it->second ; - //buffers.clear() ; - freeWindows() ; - } - - void CContextServer::freeWindows() - { - //if (!isAttachedModeEnabled()) - //{ - // for(auto& it : winComm_) - // { - // int rank = it.first ; - // MPI_Win_free(&windows_[rank][0]); - // MPI_Win_free(&windows_[rank][1]); - // MPI_Comm_free(&winComm_[rank]) ; - // } - //} - } - - void CContextServer::notifyClientsFinalize(void) - { - for(auto it=buffers.begin();it!=buffers.end();++it) - { - it->second->notifyClientFinalize() ; - } - } - - void CContextServer::dispatchEvent(CEventServer& event) - { - string contextName; - string buff; - int MsgSize; - int rank; - list::iterator it; - StdString ctxId = context->getId(); - CContext::setCurrent(ctxId); - StdSize totalBuf = 0; - - if (event.classId==CContext::GetType() && event.type==CContext::EVENT_ID_CONTEXT_FINALIZE) - { - finished=true; - info(20)<<" CContextServer: Receive context <"<getId()<<"> finalize."<finalize(); - - std::map::const_iterator itbMap = mapBufferSize_.begin(), - iteMap = mapBufferSize_.end(), itMap; - for (itMap = itbMap; itMap != iteMap; ++itMap) - { - rank = itMap->first; - report(10)<< " Memory report : Context <"< : server side : memory used for buffer of each connection to client" << endl - << " +) With client of rank " << rank << " : " << itMap->second << " bytes " << endl; - totalBuf += itMap->second; - } - report(0)<< " Memory report : Context <"< : server side : total memory used for buffer "<& data, const CDate& lastWrite, const CDate& currentWrite, int nstep); - virtual void writeFile_ (CFile* file); - virtual void closeFile_ (void); - virtual void syncFile_ (void); - virtual void writeTimeAxis_ (CField* field, - const std::shared_ptr cal); - - protected : - void writeUnstructuredDomain (CDomain* domain); - void writeUnstructuredDomainUgrid (CDomain* domain); - void writeLocalAttributes(int ibegin, int ni, int jbegin, int nj, StdString domid); - void writeLocalAttributes_IOIPSL(const StdString& dimXid, const StdString& dimYid, - int ibegin, int ni, int jbegin, int nj, int ni_glo, int nj_glo, int rank, int size); - void writeTimeAxisAttributes(const StdString & axis_name, - const StdString & calendar, - const StdString & units, - const StdString & time_origin, - const StdString & time_bounds = StdString("bounds"), - const StdString & standard_name = StdString("time"), - const StdString & long_name = StdString("Time axis")); - - void writeFileAttributes(const StdString & name, - const StdString & description, - const StdString & conventions, - const StdString & production, - const StdString & timeStamp); - - void writeMaskAttributes(const StdString & mask_name, - int data_dim, - int data_ni = 0, - int data_nj = 0, - int data_ibegin = 0, - int data_jbegin = 0); - - void writeAxisAttributes(const StdString & axis_name, - const StdString & axis, - const StdString & standard_name, - const StdString & long_name, - const StdString & units, - const StdString & nav_model); - - StdSize getRecordFromTime(Time time, double factorUnit); - - private : - - /// Traitement /// - StdString getTimeStamp(void) const; - - bool isWrittenDomain(const std::string& domainName) const; - bool isWrittenCompressedDomain(const std::string& domainName) const; - bool isWrittenAxis(const std::string& axisName) const; - bool isWrittenCompressedAxis(const std::string& axisName) const; - bool isWrittenScalar(const std::string& scalarName) const; - - void setWrittenDomain(const std::string& domainName); - void setWrittenCompressedDomain(const std::string& domainName); - void setWrittenAxis(const std::string& axisName); - void setWrittenCompressedAxis(const std::string& axisName); - void setWrittenScalar(const std::string& scalarName); - - /// Propriétés privées /// - MPI_Comm comm_file; - const StdString filename; - std::map timeToRecordCache; - - std::set writtenDomains, writtenCompressedDomains; - std::set writtenAxis, writtenCompressedAxis; - std::set writtenScalar; - - enum { none, centered, instant, record} timeCounterType ; - bool hasTimeInstant ; - bool hasTimeCentered ; - }; // class CNc4DataOutput - -} // namespace xios - -#endif //__XIOS_NC4_DATA_OUTPUT__ diff --git a/xios_2311_src/trunk/.svn/pristine/2e/2e4684a1ff3b3dc7309a6826580512ea895a86d9.svn-base b/xios_2311_src/trunk/.svn/pristine/2e/2e4684a1ff3b3dc7309a6826580512ea895a86d9.svn-base deleted file mode 100644 index dead23c3b9f7ccf5f40603355b85816706cac2b6..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/2e/2e4684a1ff3b3dc7309a6826580512ea895a86d9.svn-base +++ /dev/null @@ -1,8 +0,0 @@ -#all - -atm_output_domain_transformation_reorder.nc -atm_output_domain_transformation_extract.nc -atm_output_domain_transformation_zoom.nc -atm_output_domain_transformation_interpolate.nc -atm_output_domain_transformation_expand.nc - diff --git a/xios_2311_src/trunk/.svn/pristine/2e/2e744b949ac35b0650aaa803970a5bbd123e86ac.svn-base b/xios_2311_src/trunk/.svn/pristine/2e/2e744b949ac35b0650aaa803970a5bbd123e86ac.svn-base deleted file mode 100644 index 4967f1a97e08a5fa366da6c6776809f83cd498f7..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/2e/2e744b949ac35b0650aaa803970a5bbd123e86ac.svn-base +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -source ./load_env_local -mkdir -p RUN_TEST_SUITE -cp -r TEST_SUITE/* RUN_TEST_SUITE -(cd RUN_TEST_SUITE && ./run_test_${xios_machine_name}_local) diff --git a/xios_2311_src/trunk/.svn/pristine/2e/2ec76e17968c37499e2e8d7660ed3734f3396a4e.svn-base b/xios_2311_src/trunk/.svn/pristine/2e/2ec76e17968c37499e2e8d7660ed3734f3396a4e.svn-base deleted file mode 100644 index 941a85ce28138f78d1dbfbffcc3d575fdf1c5bf1..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/2e/2ec76e17968c37499e2e8d7660ed3734f3396a4e.svn-base +++ /dev/null @@ -1,52 +0,0 @@ -/*! - \file axis_algorithm_reduce_axis.hpp - \author Ha NGUYEN - \since 23 June 2016 - \date 23 June 2016 - - \brief Algorithm for reduce an axis to a axis - */ -#ifndef __XIOS_AXIS_ALGORITHM_REDUCE_AXIS_HPP__ -#define __XIOS_AXIS_ALGORITHM_REDUCE_AXIS_HPP__ - -#include "algorithm_transformation_reduce.hpp" -#include "transformation.hpp" - -namespace xios { - -class CAxis; -class CReduceAxisToAxis; -class CReductionAlgorithm; - -/*! - \class CAxisAlgorithmReduceAxis - Reduce a axis to an axis -*/ -class CAxisAlgorithmReduceAxis : public CAlgorithmTransformationReduce -{ -public: - CAxisAlgorithmReduceAxis(bool isSource, CAxis* axisDestination, CAxis* axisSource, CReduceAxisToAxis* algo); - - - virtual ~CAxisAlgorithmReduceAxis(); - - static bool registerTrans(); - virtual StdString getAlgoName() {return "\\nreduce_axis_to_axis";} - -public: - static shared_ptr create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition); - - virtual shared_ptr createGridAlgorithm(CGrid* gridSrc, CGrid* gridDst, int pos); - static bool dummyRegistered_; -}; - -} -#endif // __XIOS_AXIS_ALGORITHM_REDUCE_AXIS_HPP__ diff --git a/xios_2311_src/trunk/.svn/pristine/2f/2f0d536c5e13a53ee411054e67a9f384da3499d2.svn-base b/xios_2311_src/trunk/.svn/pristine/2f/2f0d536c5e13a53ee411054e67a9f384da3499d2.svn-base deleted file mode 100644 index 0c6f9dc0c8ab9b8d0e837c88c64d33ca457a73a3..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/2f/2f0d536c5e13a53ee411054e67a9f384da3499d2.svn-base +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright 2009, UCAR/Unidata and OPeNDAP, Inc. - See the COPYRIGHT file for more information. */ - -#ifndef OCCONTENT_H -#define OCCONTENT_H - -/*! Specifies the OCcontent*/ -typedef struct OCcontent { - unsigned int magic; - OCmode mode; - struct OCstate* state; - struct OCnode* node; - struct OCtree* tree; - int packed; /* track OC_Char and OC_Byte specially*/ - struct OCCACHE { - int valid; - ocindex_t index; /* index corresponding to offset */ - ocindex_t maxindex; /* max allowable index, if known0 => max unknown */ - ocoffset_t offset; /* location of this content in the xdr data */ - } cache; /* track last xdr position and index of this content */ - struct OCcontent* next; -} OCcontent; - -extern OCcontent* ocnewcontent(OCstate* state); -extern void ocfreecontent(OCstate* state, OCcontent* content); -extern OCmode ocgetmode(OCcontent* content); - -extern int ocdataith(struct OCstate*, OCcontent*, size_t, OCcontent*); -extern int ocdatacount(struct OCstate*, OCcontent*, size_t*); - -extern int ocrootdata(struct OCstate*, struct OCnode*, struct OCcontent*); -extern int ocgetcontent(struct OCstate*, struct OCcontent*, void* memory, - size_t memsize, size_t start, size_t count); - -#endif /*OCCONTENT_H*/ diff --git a/xios_2311_src/trunk/.svn/pristine/2f/2f1611ba6dbc9f265c5365f117ce9e19bfb8beda.svn-base b/xios_2311_src/trunk/.svn/pristine/2f/2f1611ba6dbc9f265c5365f117ce9e19bfb8beda.svn-base deleted file mode 100644 index 7ff5e4194ab0ea89f291d88eee4be728ce93b38b..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/2f/2f1611ba6dbc9f265c5365f117ce9e19bfb8beda.svn-base +++ /dev/null @@ -1,24 +0,0 @@ -################################################################################ -################### Projet XIOS ################### -################################################################################ - -%CCOMPILER mpixlc_r -%FCOMPILER mpixlf90_r -%LINKER mpixlf90_r - -%BASE_CFLAGS -%PROD_CFLAGS -O3 -qarch=qp -qtune=qp -%DEV_CFLAGS -%DEBUG_CFLAGS - -%BASE_FFLAGS -D__NONE__ -%PROD_FFLAGS -O3 -qarch=qp -qtune=qp -%DEV_FFLAGS -%DEBUG_FFLAGS - -%BASE_INC -D__NONE__ -%BASE_LD -L/opt/ibmcmp/vacpp/bg/12.1/bglib64 -libmc++ - -%CPP mpixlc -EP -%FPP cpp -P -%MAKE make diff --git a/xios_2311_src/trunk/.svn/pristine/2f/2f78a1b010f161a682e04ae398d97cba7607324f.svn-base b/xios_2311_src/trunk/.svn/pristine/2f/2f78a1b010f161a682e04ae398d97cba7607324f.svn-base deleted file mode 100644 index c996cb030721efa6f0073dad2ab1f13f408cd24c..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/2f/2f78a1b010f161a682e04ae398d97cba7607324f.svn-base +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef __LOCAL_VIEW_HPP__ -#define __LOCAL_VIEW_HPP__ - -#include "xios_spl.hpp" -#include "array_new.hpp" -#include "distributed_view.hpp" -#include "context_client.hpp" - -namespace xios -{ - - class CLocalElement ; - class CRemoteConnector ; - - class CLocalView : public CDistributedView - { - public: - CLocalView(shared_ptr parent, CElementView::type type, const CArray& indexView) ; - CLocalView(shared_ptr parent, CElementView::type type, const CArray& maskView) ; - - const CArray& getIndex(void) { return index_ ;} - const CArray& getGlobalIndex(void) { return globalIndex_ ;} - - void getGlobalIndexView(CArray& globalIndexView) - { - globalIndexView.resize(size_) ; - int pos=0 ; - for(int i=0 ; i=0 && index_(i)& globalIndex, size_t sliceIndex, size_t* sliceSize, shared_ptr* localView, int pos) - { - if (pos==0) - { - for(int i=0;i=0 && index_(i)=0 && index_(i)getGlobalIndex(globalIndex, sliceIndex + globalIndex_(index_(i))*sliceSize[pos], sliceSize, localView, pos-1) ; - } - } - - - int getLocalSize(void) {return localSize_ ;} - int getSize(void) {return size_;} - void sendRemoteElement(shared_ptr connector, CContextClient* client, CEventClient& event, const CMessage& messageHeader) ; - - CArray& globalIndex_ ; - CArray& index_ ; - int& size_ ; /** The number of index composing the view, ie the size of the corresponding data, ie the size of index_ */ - int& localRank_ ; - int& localSize_ ; /** The local size of the element, ie the size of globalIndex_ */ - } ; - -} - -#endif \ No newline at end of file diff --git a/xios_2311_src/trunk/.svn/pristine/2f/2fda88cefa36ad2ba600d94fa02125de7402e02b.svn-base b/xios_2311_src/trunk/.svn/pristine/2f/2fda88cefa36ad2ba600d94fa02125de7402e02b.svn-base deleted file mode 100644 index 774e2f5cb7c534ffaf269b92fcc39ad526b2775b..0000000000000000000000000000000000000000 Binary files a/xios_2311_src/trunk/.svn/pristine/2f/2fda88cefa36ad2ba600d94fa02125de7402e02b.svn-base and /dev/null differ diff --git a/xios_2311_src/trunk/.svn/pristine/30/306d8edb1729564105c9e29f0bf6627ae5df372c.svn-base b/xios_2311_src/trunk/.svn/pristine/30/306d8edb1729564105c9e29f0bf6627ae5df372c.svn-base deleted file mode 100644 index 721f34026ad6da4f6d8a5d422f09f45e229cdab8..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/30/306d8edb1729564105c9e29f0bf6627ae5df372c.svn-base +++ /dev/null @@ -1,379 +0,0 @@ -#ifndef __REDUCE_TRANSFORM_CONNECTOR_HPP__ -#define __REDUCE_TRANSFORM_CONNECTOR_HPP__ - -#include "xios_spl.hpp" -#include "array_new.hpp" -#include "local_view.hpp" -#include "reduction_types.hpp" -#include - - - -namespace xios -{ - - class CReduceTransformConnector - { - - private: - shared_ptr srcView_; - shared_ptr dstView_; - - vector connector_; // sizeof sum(nWeights_) - vector nSrc_ ; // sizeof dstSize_ - int srcSize_ ; - int dstSize_ ; - bool detectMissingValue_ ; - EReduction type_ ; - - typedef void (CReduceTransformConnector::* transferPtr)(int, int, const CArray& , CArray&) ; - transferPtr transfer_ ; - - void computeConnector(unordered_map>& indexMap) ; - - public: - - CReduceTransformConnector(shared_ptr srcView, shared_ptr dstView, EReduction op, unordered_map>& indexMap, - bool detectMissingValue=true) ; - - void transfer(const CArray& dataIn, CArray& dataOut) - { - transfer(1,1,dataIn, dataOut) ; - } - void transfer(int sizeT, const CArray& dataIn, CArray& dataOut) - { - transfer(1,sizeT, dataIn, dataOut) ; - } - - void transfer(int repeat, int sizeT, const CArray& dataIn, CArray& dataOut) - { - (this->*transfer_)(repeat, sizeT, dataIn, dataOut) ; - } - - private : - - void transferSum(int repeat, int sizeT, const CArray& dataIn, CArray& dataOut) - { - double defaultValue = std::numeric_limits::quiet_NaN(); - - int dstSlice = dstSize_*sizeT ; - int srcSlice = srcSize_*sizeT ; - dataOut.resize(repeat* dstSlice) ; - dataOut=0 ; - - const double* input = dataIn.dataFirst() ; - double* output = dataOut.dataFirst() ; - - if (detectMissingValue_) - { - vector touched(repeat* dstSlice, false) ; - int posr=0 ; - for(int r=0;r& dataIn, CArray& dataOut) - { - double defaultValue = std::numeric_limits::quiet_NaN(); - - int dstSlice = dstSize_*sizeT ; - int srcSlice = srcSize_*sizeT ; - dataOut.resize(repeat* dstSlice) ; - dataOut=0 ; - - const double* input = dataIn.dataFirst() ; - double* output = dataOut.dataFirst() ; - - if (detectMissingValue_) - { - vector touched(repeat* dstSlice, false) ; - int posr=0 ; - for(int r=0;r& dataIn, CArray& dataOut) - { - double defaultValue = std::numeric_limits::quiet_NaN(); - - int dstSlice = dstSize_*sizeT ; - int srcSlice = srcSize_*sizeT ; - dataOut.resize(repeat* dstSlice) ; - dataOut=0 ; - - const double* input = dataIn.dataFirst() ; - double* output = dataOut.dataFirst() ; - - if (detectMissingValue_) - { - vector touched(repeat* dstSlice, false) ; - int posr=0 ; - for(int r=0;r& dataIn, CArray& dataOut) - { - double defaultValue = std::numeric_limits::quiet_NaN(); - - int dstSlice = dstSize_*sizeT ; - int srcSlice = srcSize_*sizeT ; - dataOut.resize(repeat* dstSlice) ; - dataOut=0 ; - - const double* input = dataIn.dataFirst() ; - double* output = dataOut.dataFirst() ; - - if (detectMissingValue_) - { - vector touched(repeat* dstSlice, 0) ; - int posr=0 ; - for(int r=0;r - -namespace sphereRemap { - -CMPICascade::CMPICascade(int nodes_per_level, MPI_Comm comm) -{ - int remaining_levels; - MPI_Comm intraComm; - int l = 0; // current level - do { - level.push_back(comm); - remaining_levels = ilog(nodes_per_level /*base*/, level[l].size /*arg*/) + 1; - level[l].group_size = iroot(remaining_levels, level[l].size); // group_size^remaining_levels <= size - level[l].p_grp_size = level[l].size/level[l].group_size; - - MPI_Comm_split(comm, level[l].colour(), level[l].key(), &intraComm); - MPI_Comm_split(comm, level[l].p_colour(), level[l].p_key(), &(level[l].pg_comm)); - comm = intraComm; - l++; - } while (--remaining_levels); - num_levels = l; -} - -} diff --git a/xios_2311_src/trunk/.svn/pristine/31/3134bdc5f2507be97169b29c8fd04b6abe25dabb.svn-base b/xios_2311_src/trunk/.svn/pristine/31/3134bdc5f2507be97169b29c8fd04b6abe25dabb.svn-base deleted file mode 100644 index 6e3ce42cef627df6fc7ef31bf58fa85221c0081b..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/31/3134bdc5f2507be97169b29c8fd04b6abe25dabb.svn-base +++ /dev/null @@ -1,54 +0,0 @@ -/*! - \file generic_algorithm_transformation.hpp - \author Ha NGUYEN - \since 14 May 2015 - \date 21 Mars 2016 - - \brief Interface for all transformation algorithms. - */ -#include "generic_algorithm_transformation.hpp" -#include "context.hpp" -#include "context_client.hpp" -#include "client_client_dht_template.hpp" -#include "utils.hpp" -#include "timer.hpp" -#include "mpi.hpp" -#include "transform_connector.hpp" -#include "weight_transform_connector.hpp" -#include "grid_algorithm_generic.hpp" -#include "transform_filter.hpp" - -namespace xios -{ - -CGenericAlgorithmTransformation::CGenericAlgorithmTransformation(bool isSource) - : isSource_(isSource) -{ -} - - - -/////////////////////////////////////////////////////////////// -////////// new algorithm for new method ///////// -/////////////////////////////////////////////////////////////// - -shared_ptr CGenericAlgorithmTransformation::createGridAlgorithm(CGrid* gridSrc, CGrid* gridDst, int pos) -{ - auto algo = make_shared(gridSrc, gridDst, pos, shared_from_this()) ; - algo->computeAlgorithm() ; - return algo ; -} - - - -CTransformFilter* CGenericAlgorithmTransformation::createTransformFilter(CGarbageCollector& gc, shared_ptr algo, bool detectMissingValues, double defaultValue) -{ - return new CTransformFilter(gc, 1, algo, detectMissingValues, defaultValue) ; -} - -vector CGenericAlgorithmTransformation::getAuxFieldId(void) -{ - return vector() ; -} - -} diff --git a/xios_2311_src/trunk/.svn/pristine/31/31367eebc2f66243d77b29d8cf5bbf7b2d466f1e.svn-base b/xios_2311_src/trunk/.svn/pristine/31/31367eebc2f66243d77b29d8cf5bbf7b2d466f1e.svn-base deleted file mode 100644 index 64d39d660871f196e5a057b7561c2de915c1af67..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/31/31367eebc2f66243d77b29d8cf5bbf7b2d466f1e.svn-base +++ /dev/null @@ -1,657 +0,0 @@ -! * ************************************************************************** * -! * Interface auto generated - do not modify * -! * ************************************************************************** * -#include "../fortran/xios_fortran_prefix.hpp" - -MODULE field_interface_attr - USE, INTRINSIC :: ISO_C_BINDING - - INTERFACE - ! Do not call directly / interface FORTRAN 2003 <-> C99 - - SUBROUTINE cxios_set_field_add_offset(field_hdl, add_offset) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (KIND=C_DOUBLE) , VALUE :: add_offset - END SUBROUTINE cxios_set_field_add_offset - - SUBROUTINE cxios_get_field_add_offset(field_hdl, add_offset) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (KIND=C_DOUBLE) :: add_offset - END SUBROUTINE cxios_get_field_add_offset - - FUNCTION cxios_is_defined_field_add_offset(field_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_field_add_offset - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - END FUNCTION cxios_is_defined_field_add_offset - - - SUBROUTINE cxios_set_field_axis_ref(field_hdl, axis_ref, axis_ref_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: axis_ref - INTEGER (kind = C_INT) , VALUE :: axis_ref_size - END SUBROUTINE cxios_set_field_axis_ref - - SUBROUTINE cxios_get_field_axis_ref(field_hdl, axis_ref, axis_ref_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: axis_ref - INTEGER (kind = C_INT) , VALUE :: axis_ref_size - END SUBROUTINE cxios_get_field_axis_ref - - FUNCTION cxios_is_defined_field_axis_ref(field_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_field_axis_ref - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - END FUNCTION cxios_is_defined_field_axis_ref - - - SUBROUTINE cxios_set_field_cell_methods(field_hdl, cell_methods, cell_methods_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: cell_methods - INTEGER (kind = C_INT) , VALUE :: cell_methods_size - END SUBROUTINE cxios_set_field_cell_methods - - SUBROUTINE cxios_get_field_cell_methods(field_hdl, cell_methods, cell_methods_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: cell_methods - INTEGER (kind = C_INT) , VALUE :: cell_methods_size - END SUBROUTINE cxios_get_field_cell_methods - - FUNCTION cxios_is_defined_field_cell_methods(field_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_field_cell_methods - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - END FUNCTION cxios_is_defined_field_cell_methods - - - SUBROUTINE cxios_set_field_cell_methods_mode(field_hdl, cell_methods_mode, cell_methods_mode_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: cell_methods_mode - INTEGER (kind = C_INT) , VALUE :: cell_methods_mode_size - END SUBROUTINE cxios_set_field_cell_methods_mode - - SUBROUTINE cxios_get_field_cell_methods_mode(field_hdl, cell_methods_mode, cell_methods_mode_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: cell_methods_mode - INTEGER (kind = C_INT) , VALUE :: cell_methods_mode_size - END SUBROUTINE cxios_get_field_cell_methods_mode - - FUNCTION cxios_is_defined_field_cell_methods_mode(field_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_field_cell_methods_mode - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - END FUNCTION cxios_is_defined_field_cell_methods_mode - - - SUBROUTINE cxios_set_field_check_if_active(field_hdl, check_if_active) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - LOGICAL (KIND=C_BOOL) , VALUE :: check_if_active - END SUBROUTINE cxios_set_field_check_if_active - - SUBROUTINE cxios_get_field_check_if_active(field_hdl, check_if_active) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - LOGICAL (KIND=C_BOOL) :: check_if_active - END SUBROUTINE cxios_get_field_check_if_active - - FUNCTION cxios_is_defined_field_check_if_active(field_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_field_check_if_active - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - END FUNCTION cxios_is_defined_field_check_if_active - - - SUBROUTINE cxios_set_field_comment(field_hdl, comment, comment_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: comment - INTEGER (kind = C_INT) , VALUE :: comment_size - END SUBROUTINE cxios_set_field_comment - - SUBROUTINE cxios_get_field_comment(field_hdl, comment, comment_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: comment - INTEGER (kind = C_INT) , VALUE :: comment_size - END SUBROUTINE cxios_get_field_comment - - FUNCTION cxios_is_defined_field_comment(field_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_field_comment - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - END FUNCTION cxios_is_defined_field_comment - - - SUBROUTINE cxios_set_field_compression_level(field_hdl, compression_level) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - INTEGER (KIND=C_INT) , VALUE :: compression_level - END SUBROUTINE cxios_set_field_compression_level - - SUBROUTINE cxios_get_field_compression_level(field_hdl, compression_level) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - INTEGER (KIND=C_INT) :: compression_level - END SUBROUTINE cxios_get_field_compression_level - - FUNCTION cxios_is_defined_field_compression_level(field_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_field_compression_level - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - END FUNCTION cxios_is_defined_field_compression_level - - - SUBROUTINE cxios_set_field_default_value(field_hdl, default_value) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (KIND=C_DOUBLE) , VALUE :: default_value - END SUBROUTINE cxios_set_field_default_value - - SUBROUTINE cxios_get_field_default_value(field_hdl, default_value) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (KIND=C_DOUBLE) :: default_value - END SUBROUTINE cxios_get_field_default_value - - FUNCTION cxios_is_defined_field_default_value(field_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_field_default_value - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - END FUNCTION cxios_is_defined_field_default_value - - - SUBROUTINE cxios_set_field_detect_missing_value(field_hdl, detect_missing_value) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - LOGICAL (KIND=C_BOOL) , VALUE :: detect_missing_value - END SUBROUTINE cxios_set_field_detect_missing_value - - SUBROUTINE cxios_get_field_detect_missing_value(field_hdl, detect_missing_value) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - LOGICAL (KIND=C_BOOL) :: detect_missing_value - END SUBROUTINE cxios_get_field_detect_missing_value - - FUNCTION cxios_is_defined_field_detect_missing_value(field_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_field_detect_missing_value - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - END FUNCTION cxios_is_defined_field_detect_missing_value - - - SUBROUTINE cxios_set_field_domain_ref(field_hdl, domain_ref, domain_ref_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: domain_ref - INTEGER (kind = C_INT) , VALUE :: domain_ref_size - END SUBROUTINE cxios_set_field_domain_ref - - SUBROUTINE cxios_get_field_domain_ref(field_hdl, domain_ref, domain_ref_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: domain_ref - INTEGER (kind = C_INT) , VALUE :: domain_ref_size - END SUBROUTINE cxios_get_field_domain_ref - - FUNCTION cxios_is_defined_field_domain_ref(field_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_field_domain_ref - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - END FUNCTION cxios_is_defined_field_domain_ref - - - SUBROUTINE cxios_set_field_enabled(field_hdl, enabled) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - LOGICAL (KIND=C_BOOL) , VALUE :: enabled - END SUBROUTINE cxios_set_field_enabled - - SUBROUTINE cxios_get_field_enabled(field_hdl, enabled) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - LOGICAL (KIND=C_BOOL) :: enabled - END SUBROUTINE cxios_get_field_enabled - - FUNCTION cxios_is_defined_field_enabled(field_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_field_enabled - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - END FUNCTION cxios_is_defined_field_enabled - - - SUBROUTINE cxios_set_field_expr(field_hdl, expr, expr_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: expr - INTEGER (kind = C_INT) , VALUE :: expr_size - END SUBROUTINE cxios_set_field_expr - - SUBROUTINE cxios_get_field_expr(field_hdl, expr, expr_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: expr - INTEGER (kind = C_INT) , VALUE :: expr_size - END SUBROUTINE cxios_get_field_expr - - FUNCTION cxios_is_defined_field_expr(field_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_field_expr - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - END FUNCTION cxios_is_defined_field_expr - - - SUBROUTINE cxios_set_field_field_ref(field_hdl, field_ref, field_ref_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: field_ref - INTEGER (kind = C_INT) , VALUE :: field_ref_size - END SUBROUTINE cxios_set_field_field_ref - - SUBROUTINE cxios_get_field_field_ref(field_hdl, field_ref, field_ref_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: field_ref - INTEGER (kind = C_INT) , VALUE :: field_ref_size - END SUBROUTINE cxios_get_field_field_ref - - FUNCTION cxios_is_defined_field_field_ref(field_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_field_field_ref - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - END FUNCTION cxios_is_defined_field_field_ref - - - SUBROUTINE cxios_set_field_freq_offset(field_hdl, freq_offset) BIND(C) - USE ISO_C_BINDING - USE IDURATION - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - TYPE(txios(duration)), VALUE :: freq_offset - END SUBROUTINE cxios_set_field_freq_offset - - SUBROUTINE cxios_get_field_freq_offset(field_hdl, freq_offset) BIND(C) - USE ISO_C_BINDING - USE IDURATION - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - TYPE(txios(duration)) :: freq_offset - END SUBROUTINE cxios_get_field_freq_offset - - FUNCTION cxios_is_defined_field_freq_offset(field_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_field_freq_offset - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - END FUNCTION cxios_is_defined_field_freq_offset - - - SUBROUTINE cxios_set_field_freq_op(field_hdl, freq_op) BIND(C) - USE ISO_C_BINDING - USE IDURATION - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - TYPE(txios(duration)), VALUE :: freq_op - END SUBROUTINE cxios_set_field_freq_op - - SUBROUTINE cxios_get_field_freq_op(field_hdl, freq_op) BIND(C) - USE ISO_C_BINDING - USE IDURATION - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - TYPE(txios(duration)) :: freq_op - END SUBROUTINE cxios_get_field_freq_op - - FUNCTION cxios_is_defined_field_freq_op(field_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_field_freq_op - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - END FUNCTION cxios_is_defined_field_freq_op - - - SUBROUTINE cxios_set_field_grid_path(field_hdl, grid_path, grid_path_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: grid_path - INTEGER (kind = C_INT) , VALUE :: grid_path_size - END SUBROUTINE cxios_set_field_grid_path - - SUBROUTINE cxios_get_field_grid_path(field_hdl, grid_path, grid_path_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: grid_path - INTEGER (kind = C_INT) , VALUE :: grid_path_size - END SUBROUTINE cxios_get_field_grid_path - - FUNCTION cxios_is_defined_field_grid_path(field_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_field_grid_path - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - END FUNCTION cxios_is_defined_field_grid_path - - - SUBROUTINE cxios_set_field_grid_ref(field_hdl, grid_ref, grid_ref_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: grid_ref - INTEGER (kind = C_INT) , VALUE :: grid_ref_size - END SUBROUTINE cxios_set_field_grid_ref - - SUBROUTINE cxios_get_field_grid_ref(field_hdl, grid_ref, grid_ref_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: grid_ref - INTEGER (kind = C_INT) , VALUE :: grid_ref_size - END SUBROUTINE cxios_get_field_grid_ref - - FUNCTION cxios_is_defined_field_grid_ref(field_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_field_grid_ref - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - END FUNCTION cxios_is_defined_field_grid_ref - - - SUBROUTINE cxios_set_field_indexed_output(field_hdl, indexed_output) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - LOGICAL (KIND=C_BOOL) , VALUE :: indexed_output - END SUBROUTINE cxios_set_field_indexed_output - - SUBROUTINE cxios_get_field_indexed_output(field_hdl, indexed_output) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - LOGICAL (KIND=C_BOOL) :: indexed_output - END SUBROUTINE cxios_get_field_indexed_output - - FUNCTION cxios_is_defined_field_indexed_output(field_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_field_indexed_output - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - END FUNCTION cxios_is_defined_field_indexed_output - - - SUBROUTINE cxios_set_field_level(field_hdl, level) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - INTEGER (KIND=C_INT) , VALUE :: level - END SUBROUTINE cxios_set_field_level - - SUBROUTINE cxios_get_field_level(field_hdl, level) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - INTEGER (KIND=C_INT) :: level - END SUBROUTINE cxios_get_field_level - - FUNCTION cxios_is_defined_field_level(field_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_field_level - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - END FUNCTION cxios_is_defined_field_level - - - SUBROUTINE cxios_set_field_long_name(field_hdl, long_name, long_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: long_name - INTEGER (kind = C_INT) , VALUE :: long_name_size - END SUBROUTINE cxios_set_field_long_name - - SUBROUTINE cxios_get_field_long_name(field_hdl, long_name, long_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: long_name - INTEGER (kind = C_INT) , VALUE :: long_name_size - END SUBROUTINE cxios_get_field_long_name - - FUNCTION cxios_is_defined_field_long_name(field_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_field_long_name - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - END FUNCTION cxios_is_defined_field_long_name - - - SUBROUTINE cxios_set_field_name(field_hdl, name, name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: name - INTEGER (kind = C_INT) , VALUE :: name_size - END SUBROUTINE cxios_set_field_name - - SUBROUTINE cxios_get_field_name(field_hdl, name, name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: name - INTEGER (kind = C_INT) , VALUE :: name_size - END SUBROUTINE cxios_get_field_name - - FUNCTION cxios_is_defined_field_name(field_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_field_name - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - END FUNCTION cxios_is_defined_field_name - - - SUBROUTINE cxios_set_field_operation(field_hdl, operation, operation_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: operation - INTEGER (kind = C_INT) , VALUE :: operation_size - END SUBROUTINE cxios_set_field_operation - - SUBROUTINE cxios_get_field_operation(field_hdl, operation, operation_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: operation - INTEGER (kind = C_INT) , VALUE :: operation_size - END SUBROUTINE cxios_get_field_operation - - FUNCTION cxios_is_defined_field_operation(field_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_field_operation - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - END FUNCTION cxios_is_defined_field_operation - - - SUBROUTINE cxios_set_field_prec(field_hdl, prec) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - INTEGER (KIND=C_INT) , VALUE :: prec - END SUBROUTINE cxios_set_field_prec - - SUBROUTINE cxios_get_field_prec(field_hdl, prec) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - INTEGER (KIND=C_INT) :: prec - END SUBROUTINE cxios_get_field_prec - - FUNCTION cxios_is_defined_field_prec(field_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_field_prec - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - END FUNCTION cxios_is_defined_field_prec - - - SUBROUTINE cxios_set_field_read_access(field_hdl, read_access) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - LOGICAL (KIND=C_BOOL) , VALUE :: read_access - END SUBROUTINE cxios_set_field_read_access - - SUBROUTINE cxios_get_field_read_access(field_hdl, read_access) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - LOGICAL (KIND=C_BOOL) :: read_access - END SUBROUTINE cxios_get_field_read_access - - FUNCTION cxios_is_defined_field_read_access(field_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_field_read_access - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - END FUNCTION cxios_is_defined_field_read_access - - - SUBROUTINE cxios_set_field_scalar_ref(field_hdl, scalar_ref, scalar_ref_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: scalar_ref - INTEGER (kind = C_INT) , VALUE :: scalar_ref_size - END SUBROUTINE cxios_set_field_scalar_ref - - SUBROUTINE cxios_get_field_scalar_ref(field_hdl, scalar_ref, scalar_ref_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: scalar_ref - INTEGER (kind = C_INT) , VALUE :: scalar_ref_size - END SUBROUTINE cxios_get_field_scalar_ref - - FUNCTION cxios_is_defined_field_scalar_ref(field_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_field_scalar_ref - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - END FUNCTION cxios_is_defined_field_scalar_ref - - - SUBROUTINE cxios_set_field_scale_factor(field_hdl, scale_factor) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (KIND=C_DOUBLE) , VALUE :: scale_factor - END SUBROUTINE cxios_set_field_scale_factor - - SUBROUTINE cxios_get_field_scale_factor(field_hdl, scale_factor) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (KIND=C_DOUBLE) :: scale_factor - END SUBROUTINE cxios_get_field_scale_factor - - FUNCTION cxios_is_defined_field_scale_factor(field_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_field_scale_factor - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - END FUNCTION cxios_is_defined_field_scale_factor - - - SUBROUTINE cxios_set_field_standard_name(field_hdl, standard_name, standard_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: standard_name - INTEGER (kind = C_INT) , VALUE :: standard_name_size - END SUBROUTINE cxios_set_field_standard_name - - SUBROUTINE cxios_get_field_standard_name(field_hdl, standard_name, standard_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: standard_name - INTEGER (kind = C_INT) , VALUE :: standard_name_size - END SUBROUTINE cxios_get_field_standard_name - - FUNCTION cxios_is_defined_field_standard_name(field_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_field_standard_name - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - END FUNCTION cxios_is_defined_field_standard_name - - - SUBROUTINE cxios_set_field_ts_enabled(field_hdl, ts_enabled) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - LOGICAL (KIND=C_BOOL) , VALUE :: ts_enabled - END SUBROUTINE cxios_set_field_ts_enabled - - SUBROUTINE cxios_get_field_ts_enabled(field_hdl, ts_enabled) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - LOGICAL (KIND=C_BOOL) :: ts_enabled - END SUBROUTINE cxios_get_field_ts_enabled - - FUNCTION cxios_is_defined_field_ts_enabled(field_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_field_ts_enabled - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - END FUNCTION cxios_is_defined_field_ts_enabled - - - SUBROUTINE cxios_set_field_ts_split_freq(field_hdl, ts_split_freq) BIND(C) - USE ISO_C_BINDING - USE IDURATION - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - TYPE(txios(duration)), VALUE :: ts_split_freq - END SUBROUTINE cxios_set_field_ts_split_freq - - SUBROUTINE cxios_get_field_ts_split_freq(field_hdl, ts_split_freq) BIND(C) - USE ISO_C_BINDING - USE IDURATION - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - TYPE(txios(duration)) :: ts_split_freq - END SUBROUTINE cxios_get_field_ts_split_freq - - FUNCTION cxios_is_defined_field_ts_split_freq(field_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_field_ts_split_freq - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - END FUNCTION cxios_is_defined_field_ts_split_freq - - - SUBROUTINE cxios_set_field_unit(field_hdl, unit, unit_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: unit - INTEGER (kind = C_INT) , VALUE :: unit_size - END SUBROUTINE cxios_set_field_unit - - SUBROUTINE cxios_get_field_unit(field_hdl, unit, unit_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: unit - INTEGER (kind = C_INT) , VALUE :: unit_size - END SUBROUTINE cxios_get_field_unit - - FUNCTION cxios_is_defined_field_unit(field_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_field_unit - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - END FUNCTION cxios_is_defined_field_unit - - - SUBROUTINE cxios_set_field_valid_max(field_hdl, valid_max) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (KIND=C_DOUBLE) , VALUE :: valid_max - END SUBROUTINE cxios_set_field_valid_max - - SUBROUTINE cxios_get_field_valid_max(field_hdl, valid_max) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (KIND=C_DOUBLE) :: valid_max - END SUBROUTINE cxios_get_field_valid_max - - FUNCTION cxios_is_defined_field_valid_max(field_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_field_valid_max - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - END FUNCTION cxios_is_defined_field_valid_max - - - SUBROUTINE cxios_set_field_valid_min(field_hdl, valid_min) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (KIND=C_DOUBLE) , VALUE :: valid_min - END SUBROUTINE cxios_set_field_valid_min - - SUBROUTINE cxios_get_field_valid_min(field_hdl, valid_min) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (KIND=C_DOUBLE) :: valid_min - END SUBROUTINE cxios_get_field_valid_min - - FUNCTION cxios_is_defined_field_valid_min(field_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_field_valid_min - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - END FUNCTION cxios_is_defined_field_valid_min - - END INTERFACE - -END MODULE field_interface_attr diff --git a/xios_2311_src/trunk/.svn/pristine/31/319a6009f08d66796cb358c1c9d48f578f61dbe9.svn-base b/xios_2311_src/trunk/.svn/pristine/31/319a6009f08d66796cb358c1c9d48f578f61dbe9.svn-base deleted file mode 100644 index 89af1b686bacc17ee3f434271e53eb218cf2caeb..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/31/319a6009f08d66796cb358c1c9d48f578f61dbe9.svn-base +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef __GRID_MASK_CONNECTOR_HPP__ -#define __GRID_MASK_CONNECTOR_HPP__ - -#include "xios_spl.hpp" -#include "array_new.hpp" -#include "local_view.hpp" -#include "distributed_view.hpp" - -namespace xios -{ - - class CGridMaskConnector - { - - public: - - CGridMaskConnector(vector>& views) : views_(views) {} - void computeConnector(CArray& mask) ; - - CArray& getElementMask(int pos) { return elementsMask_[pos] ;} - vector>& getElementsMask(void) ; - - private: - vector> views_ ; - vector> elementsMask_ ; - - vector size_ ; - vector index_ ; - int nViews_ ; - - private: - - void recursiveInternal(int level, bool*& mask) - { - if (level==0) - { - for(int i=0; i < size_[level] ; i++) - { - for(int j=0 ; jdispatch->get_att(ncid, varid, name, value, xtype); -} -/*! \} */ - -/*! -\ingroup attributes -Get an attribute. - -This function gets an attribute from the netCDF file. The nc_get_att() -function works with any type of data, including user defined types. - -\note The netCDF library reads all attributes into memory when the -file is opened with nc_open(). Getting an attribute copies the value -from the in-memory store, and does not incure any file I/O penalties. - -\param ncid NetCDF or group ID, from a previous call to nc_open(), -nc_create(), nc_def_grp(), or associated inquiry functions such as -nc_inq_ncid(). - -\param varid Variable ID of the attribute's variable, or ::NC_GLOBAL -for a global attribute. - -\param name Attribute \ref object_name. - -\param value Pointer to location for returned attribute value(s). All -elements of the vector of attribute values are returned, so you must -allocate enough space to hold them. If you don't know how much -space to reserve, call nc_inq_attlen() first to find out the length of -the attribute. - -

Example

- -Here is an example using nc_get_att_double() to determine the values -of a variable attribute named valid_range for a netCDF variable named -rh and using nc_get_att_text() to read a global attribute named title -in an existing netCDF dataset named foo.nc. - -In this example, it is assumed that we don't know how many values will -be returned, but that we do know the types of the attributes. Hence, -to allocate enough space to store them, we must first inquire about -the length of the attributes. - -\code - #include - ... - int status; - int ncid; - int rh_id; - int vr_len, t_len; - double *vr_val; - char *title; - extern char *malloc() - - ... - status = nc_open("foo.nc", NC_NOWRITE, &ncid); - if (status != NC_NOERR) handle_error(status); - ... - status = nc_inq_varid (ncid, "rh", &rh_id); - if (status != NC_NOERR) handle_error(status); - ... - status = nc_inq_attlen (ncid, rh_id, "valid_range", &vr_len); - if (status != NC_NOERR) handle_error(status); - status = nc_inq_attlen (ncid, NC_GLOBAL, "title", &t_len); - if (status != NC_NOERR) handle_error(status); - - vr_val = (double *) malloc(vr_len * sizeof(double)); - title = (char *) malloc(t_len + 1); - - status = nc_get_att_double(ncid, rh_id, "valid_range", vr_val); - if (status != NC_NOERR) handle_error(status); - status = nc_get_att_text(ncid, NC_GLOBAL, "title", title); - if (status != NC_NOERR) handle_error(status); - title[t_len] = '\0'; - ... -\endcode -*/ -/*! \{ */ -int -nc_get_att_text(int ncid, int varid, const char *name, char *value) -{ - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_CHAR); -} - -int -nc_get_att_schar(int ncid, int varid, const char *name, signed char *value) -{ - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_BYTE); -} - -int -nc_get_att_uchar(int ncid, int varid, const char *name, unsigned char *value) -{ - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_UBYTE); -} - -int -nc_get_att_short(int ncid, int varid, const char *name, short *value) -{ - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_SHORT); -} - -int -nc_get_att_int(int ncid, int varid, const char *name, int *value) -{ - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_INT); -} - -int -nc_get_att_long(int ncid, int varid, const char *name, long *value) -{ - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return ncp->dispatch->get_att(ncid, varid, name, (void *)value, longtype); -} - -int -nc_get_att_float(int ncid, int varid, const char *name, float *value) -{ - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_FLOAT); -} - -int -nc_get_att_double(int ncid, int varid, const char *name, double *value) -{ - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_DOUBLE); -} - -int -nc_get_att_ubyte(int ncid, int varid, const char *name, unsigned char *value) -{ - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_UBYTE); -} - -int -nc_get_att_ushort(int ncid, int varid, const char *name, unsigned short *value) -{ - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_USHORT); -} - -int -nc_get_att_uint(int ncid, int varid, const char *name, unsigned int *value) -{ - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_UINT); -} - -int -nc_get_att_longlong(int ncid, int varid, const char *name, long long *value) -{ - NC* ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_INT64); -} - -int -nc_get_att_ulonglong(int ncid, int varid, const char *name, unsigned long long *value) -{ - NC *ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_UINT64); -} - -int -nc_get_att_string(int ncid, int varid, const char *name, char **value) -{ - NC *ncp; - int stat = NC_check_id(ncid, &ncp); - if(stat != NC_NOERR) return stat; - return ncp->dispatch->get_att(ncid,varid,name,(void*)value, NC_STRING); -} -/*! \} */ diff --git a/xios_2311_src/trunk/.svn/pristine/32/327817f785f9075e8ad4b7a2f19213d42ed991f6.svn-base b/xios_2311_src/trunk/.svn/pristine/32/327817f785f9075e8ad4b7a2f19213d42ed991f6.svn-base deleted file mode 100644 index 1a75a802be58c594ec063815ea882cf0b64211d0..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/32/327817f785f9075e8ad4b7a2f19213d42ed991f6.svn-base +++ /dev/null @@ -1,79 +0,0 @@ -#ifndef __TREE_HPP__ -#define __TREE_HPP__ -//#include -#include -#include -#include "elt.hpp" -#include "node.hpp" - -namespace sphereRemap { - -using namespace std; -extern const int MAX_LEVEL_SIZE ; - -class CBasicTree -{ -public: - - NodePtr root; /* The main tree is stored as Nodes which can be reached through traversal starting here */ - NodePtr ref; // FIXME this reference, set by a node is odd, try to remove - int ri; /** this is set to one by a node in case of reinsertion */ - vector levelSize; /** e.g. levelSize[0] == leafs.size() */ - vector leafs; /** leafs are stored in vector for easy access and rest of the tree nodes as separate allocations, only reachable through tree traversal */ - - CBasicTree() : ri(0), levelSize(MAX_LEVEL_SIZE), root(NULL), isAssignedLevel(false), okSplit(true), isActiveOkSplit(false) {} - ~CBasicTree(); - void build(vector& nodes); - void slim(int nbIts = 1); - virtual void insertNodes(vector& node) = 0; - - void routeNodes(vector& route, vector& nodes, int assignLevel); - void routeIntersections(vector >& route, vector& nodes); - - void push_back(NodePtr node); - void push_front(NodePtr node); - void increaseLevelSize(int level); - void decreaseLevelSize(int level); - void newRoot(int level); - void insertNode(NodePtr node); - void output(ostream& flux, int level) ; - - int keepNodes; - bool isAssignedLevel ; - int assignLevel; - bool isActiveOkSplit ; - bool canSplit(void) - { - if (isActiveOkSplit && levelSize[assignLevel] >= keepNodes ) okSplit=false ; - return okSplit ; - } - - -private: - deque pool; - - bool okSplit ; - -protected: - void emptyPool(); - CBasicTree(int keepNodes_, int assignLevel_) : ri(0), levelSize(MAX_LEVEL_SIZE), root(NULL), keepNodes(keepNodes_), assignLevel(assignLevel_), isAssignedLevel(true), okSplit(true), isActiveOkSplit(false) {} -}; - -class CTree : public CBasicTree -{ -public: - void insertNodes(vector& nodes); -}; - -class CSampleTree : public CBasicTree -{ - -public: - CSampleTree(int keepNodes_, int assignLevel_) : CBasicTree(keepNodes_,assignLevel_) {} - void slimAssignedLevel() ; - void removeExtraNode(void) ; - void insertNodes(vector& nodes); -}; - -} -#endif diff --git a/xios_2311_src/trunk/.svn/pristine/32/328a47ed4db67fa50ee815187edace141739514e.svn-base b/xios_2311_src/trunk/.svn/pristine/32/328a47ed4db67fa50ee815187edace141739514e.svn-base deleted file mode 100644 index fb45029d534a241a3b497fe2eb5a46d82c05b75f..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/32/328a47ed4db67fa50ee815187edace141739514e.svn-base +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef __XIOS_TEMPORAL_TRANSFORM_FILTER_HPP__ -#define __XIOS_TEMPORAL_TRANSFORM_FILTER_HPP__ - -#include "transform_filter.hpp" - -namespace xios -{ - - /*! - * A generic filter with multiple input slots wrapping any type of spatial transformations. - */ - class CTemporalTransformFilter : public CTransformFilter - { - public: - - CTemporalTransformFilter(CGarbageCollector& gc, int slots, shared_ptr algo, int nrecords, bool detectMissingValues, double defaultValue) ; - - protected: - /*! - Overriding this function to process transformations with auxillary inputs - */ - CDataPacketPtr virtual apply(std::vector data) ; - void buildWorkflowGraph(std::vector data); - bool graphCycleCompleted; -// void apply(const CArray& dataSrc, CArray& dataDest); - - /*! - Overriding this function to process transformations with auxillary inputs - */ -// void virtual onInputReady(std::vector data); - //! Current record in the filter - int record_=0 ; - //! Maximum number of records - int nrecords_; - //! Temporary storage for output flux - vector> tmpData_; - }; // class CTransformFilter - - -} // namespace xios - -#endif //__XIOS_TEMPORAL_TRANSFORM_FILTER_HPP__ \ No newline at end of file diff --git a/xios_2311_src/trunk/.svn/pristine/32/32ef6c8372f5e38213d4e00b2691b8c5c5ff62e2.svn-base b/xios_2311_src/trunk/.svn/pristine/32/32ef6c8372f5e38213d4e00b2691b8c5c5ff62e2.svn-base deleted file mode 100644 index c504605f20bdf52a18fd2720fee8b5a872f40a85..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/32/32ef6c8372f5e38213d4e00b2691b8c5c5ff62e2.svn-base +++ /dev/null @@ -1,26 +0,0 @@ -################################################################################ -################### Projet XIOS ################### -################################################################################ - -%CCOMPILER mpiicc -%FCOMPILER mpiifort -%LINKER mpiifort -nofor-main - -%BASE_CFLAGS -diag-disable 1125 -diag-disable 279 -%PROD_CFLAGS -O3 -D BOOST_DISABLE_ASSERTS -%DEV_CFLAGS -g -traceback -%DEBUG_CFLAGS -DBZ_DEBUG -g -traceback -fno-inline - -%BASE_FFLAGS -D__NONE__ -%PROD_FFLAGS -O3 -%DEV_FFLAGS -g -O2 -traceback -%DEBUG_FFLAGS -g -traceback - -%BASE_INC -D__NONE__ -%BASE_LD -lstdc++ -lz -lcurl -Wl -lgpfs - -%CPP mpiicc -EP -%FPP cpp -P -%MAKE gmake - - diff --git a/xios_2311_src/trunk/.svn/pristine/32/32fec2e3302db57a8c541d536a6f7c3ea6f0d8cd.svn-base b/xios_2311_src/trunk/.svn/pristine/32/32fec2e3302db57a8c541d536a6f7c3ea6f0d8cd.svn-base deleted file mode 100644 index b23765639867dd5e6cabff32edce0810a210408e..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/32/32fec2e3302db57a8c541d536a6f7c3ea6f0d8cd.svn-base +++ /dev/null @@ -1,74 +0,0 @@ -#ifndef __GRID_TRANSFORM_CONNECTOR_HPP__ -#define __GRID_TRANSFORM_CONNECTOR_HPP__ - -#include "xios_spl.hpp" -#include "array_new.hpp" -#include "distributed_view.hpp" -#include "local_view.hpp" -#include "grid_scatterer_connector.hpp" -#include "grid_gatherer_connector.hpp" -#include "reduction_types.hpp" -#include "mpi.hpp" - -namespace xios -{ - - - class CGridTransformConnector - { - - public: - CGridTransformConnector(vector> srcViews, vector> remoteViews, MPI_Comm localComm) - : srcViews_(srcViews), remoteViews_(remoteViews), localComm_(localComm) - { } - - void computeConnector(bool eliminateRedundant=true) ; - protected: - MPI_Comm localComm_ ; - vector> srcViews_ ; - vector> remoteViews_ ; - map recvRankSize_ ; - - vector> scattererConnector_ ; - vector> gathererConnector_ ; - shared_ptr gridScattererConnector_ ; - shared_ptr gridGathererConnector_ ; - - public: - template - void transfer(const CArray& dataIn, CArray& dataOut, EReduction op = EReduction::none) - { - map> tmpArrayIn ; - gridScattererConnector_->transfer(dataIn, tmpArrayIn) ; - vector requests ; - MPI_Request request ; - for(auto it : tmpArrayIn) - { - auto& array = it.second ; - MPI_Issend(array.dataFirst(), array.numElements(), MPI_GetType(), it.first, 0, localComm_, &request) ; - requests.push_back(request) ; - } - - map> tmpArrayOut ; - for(auto it : recvRankSize_) - { - auto& array = tmpArrayOut[it.first] ; - array.resize(it.second) ; - MPI_Irecv(array.dataFirst(), array.numElements(), MPI_GetType(), it.first, 0, localComm_, &request) ; - requests.push_back(request) ; - } - - vector status(requests.size()) ; - MPI_Waitall(requests.size(), requests.data(),status.data()) ; - - const double nanValue = std::numeric_limits::quiet_NaN(); - - if (op == EReduction::none) gridGathererConnector_->transfer(tmpArrayOut, dataOut, nanValue) ; - else gridGathererConnector_->transfer(tmpArrayOut, dataOut, op) ; - } - - }; - -} - -#endif \ No newline at end of file diff --git a/xios_2311_src/trunk/.svn/pristine/33/331d2477e67484610186e47852800ff6476d6761.svn-base b/xios_2311_src/trunk/.svn/pristine/33/331d2477e67484610186e47852800ff6476d6761.svn-base deleted file mode 100644 index 93b25832291267f31845ffb00cd9847c3ccaa597..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/33/331d2477e67484610186e47852800ff6476d6761.svn-base +++ /dev/null @@ -1,116 +0,0 @@ -/* ************************************************************************** * - * Interface auto generated - do not modify * - * ************************************************************************** */ - -#include -#include "xios.hpp" -#include "attribute_template.hpp" -#include "object_template.hpp" -#include "group_template.hpp" -#include "icutil.hpp" -#include "icdate.hpp" -#include "timer.hpp" -#include "node_type.hpp" - -extern "C" -{ - typedef xios::CComputeConnectivityDomain* compute_connectivity_domain_Ptr; - - void cxios_set_compute_connectivity_domain_local_neighbor(compute_connectivity_domain_Ptr compute_connectivity_domain_hdl, int* local_neighbor, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(local_neighbor, shape(extent[0], extent[1]), neverDeleteData); - compute_connectivity_domain_hdl->local_neighbor.reference(tmp.copy()); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_compute_connectivity_domain_local_neighbor(compute_connectivity_domain_Ptr compute_connectivity_domain_hdl, int* local_neighbor, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(local_neighbor, shape(extent[0], extent[1]), neverDeleteData); - tmp=compute_connectivity_domain_hdl->local_neighbor.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_compute_connectivity_domain_local_neighbor(compute_connectivity_domain_Ptr compute_connectivity_domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = compute_connectivity_domain_hdl->local_neighbor.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_compute_connectivity_domain_n_neighbor(compute_connectivity_domain_Ptr compute_connectivity_domain_hdl, int* n_neighbor, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(n_neighbor, shape(extent[0]), neverDeleteData); - compute_connectivity_domain_hdl->n_neighbor.reference(tmp.copy()); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_compute_connectivity_domain_n_neighbor(compute_connectivity_domain_Ptr compute_connectivity_domain_hdl, int* n_neighbor, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(n_neighbor, shape(extent[0]), neverDeleteData); - tmp=compute_connectivity_domain_hdl->n_neighbor.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_compute_connectivity_domain_n_neighbor(compute_connectivity_domain_Ptr compute_connectivity_domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = compute_connectivity_domain_hdl->n_neighbor.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_compute_connectivity_domain_n_neighbor_max(compute_connectivity_domain_Ptr compute_connectivity_domain_hdl, int n_neighbor_max) - { - CTimer::get("XIOS").resume(); - compute_connectivity_domain_hdl->n_neighbor_max.setValue(n_neighbor_max); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_compute_connectivity_domain_n_neighbor_max(compute_connectivity_domain_Ptr compute_connectivity_domain_hdl, int* n_neighbor_max) - { - CTimer::get("XIOS").resume(); - *n_neighbor_max = compute_connectivity_domain_hdl->n_neighbor_max.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_compute_connectivity_domain_n_neighbor_max(compute_connectivity_domain_Ptr compute_connectivity_domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = compute_connectivity_domain_hdl->n_neighbor_max.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_compute_connectivity_domain_type(compute_connectivity_domain_Ptr compute_connectivity_domain_hdl, const char * type, int type_size) - { - std::string type_str; - if (!cstr2string(type, type_size, type_str)) return; - CTimer::get("XIOS").resume(); - compute_connectivity_domain_hdl->type.fromString(type_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_compute_connectivity_domain_type(compute_connectivity_domain_Ptr compute_connectivity_domain_hdl, char * type, int type_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(compute_connectivity_domain_hdl->type.getInheritedStringValue(), type, type_size)) - ERROR("void cxios_get_compute_connectivity_domain_type(compute_connectivity_domain_Ptr compute_connectivity_domain_hdl, char * type, int type_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_compute_connectivity_domain_type(compute_connectivity_domain_Ptr compute_connectivity_domain_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = compute_connectivity_domain_hdl->type.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } -} diff --git a/xios_2311_src/trunk/.svn/pristine/33/3333ea5adc6be00a4ba4ae5389319e3ae284066f.svn-base b/xios_2311_src/trunk/.svn/pristine/33/3333ea5adc6be00a4ba4ae5389319e3ae284066f.svn-base deleted file mode 100644 index 9b6328a5b208d7a5d711c0f4f26b0168723fcc63..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/33/3333ea5adc6be00a4ba4ae5389319e3ae284066f.svn-base +++ /dev/null @@ -1,715 +0,0 @@ -#LyX 2.1 created this file. For more info see http://www.lyx.org/ -\lyxformat 474 -\begin_document -\begin_header -\textclass book -\use_default_options true -\master ../../XIOS_user_guide.lyx -\maintain_unincluded_children false -\language english -\language_package default -\inputencoding auto -\fontencoding global -\font_roman default -\font_sans default -\font_typewriter default -\font_math auto -\font_default_family default -\use_non_tex_fonts false -\font_sc false -\font_osf false -\font_sf_scale 100 -\font_tt_scale 100 -\graphics default -\default_output_format default -\output_sync 0 -\bibtex_command default -\index_command default -\float_placement !tph -\paperfontsize default -\spacing single -\use_hyperref false -\papersize a4paper -\use_geometry false -\use_package amsmath 1 -\use_package amssymb 1 -\use_package cancel 1 -\use_package esint 1 -\use_package mathdots 1 -\use_package mathtools 1 -\use_package mhchem 1 -\use_package stackrel 1 -\use_package stmaryrd 1 -\use_package undertilde 1 -\cite_engine basic -\cite_engine_type default -\biblio_style plain -\use_bibtopic false -\use_indices false -\paperorientation portrait -\suppress_date false -\justification true -\use_refstyle 1 -\index Index -\shortcut idx -\color #008000 -\end_index -\secnumdepth 3 -\tocdepth 3 -\paragraph_separation indent -\paragraph_indentation default -\quotes_language english -\papercolumns 1 -\papersides 1 -\paperpagestyle default -\tracking_changes false -\output_changes false -\html_math_output 0 -\html_css_as_file 0 -\html_be_strict false -\end_header - -\begin_body - -\begin_layout Chapter -Axis -\end_layout - -\begin_layout Standard -Like Domain, Axis is a sub-component of Grid but is one dimension. - In meteorological applications, axis represents a vertical line with different - levels. -\end_layout - -\begin_layout Section -Working with configuration file -\end_layout - -\begin_layout Standard -The way to define an axis with configuration file is similar to define a - domain. -\end_layout - -\begin_layout Subsection -Basic configuration -\end_layout - -\begin_layout Standard -Similar to domain, an axis is defined inside its definition part with the - tag -\series bold -\color black -axis_definition -\series default -\color inherit -. - -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -The first one is to specify explicitly identification of an axis with an - id. - -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -In this way, with id, the axis can be processed, e.x modified its attributes, - with Fortran interface; besides, it is only possible to reference to a - axis whose id is explicitly defined. -\end_layout - -\begin_layout Standard -To make a reference to an axis, we use axis_ref -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -An axis defined by axis_ref will inherit all attributes of the referenced - one, except its id attribute. - If there is no id specified, an implicit one is assigned to this new axis. - The axis with implicit id can only be used inside the scope where it is - defined, it can not be referenced, nor be processed. - It is rare to define an axis without id inside axis_definition. - -\end_layout - -\begin_layout Standard -To define a new axis inside a grid, we use the tag -\series bold -\color black -axis. -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -The xml lines above can be translated as: the grid_A composed of an axis_A - that is defined somewhere else before. - More precisely, the grid grid_A is constituted of a -\begin_inset Quotes eld -\end_inset - -unknown id -\begin_inset Quotes erd -\end_inset - - axis which has inherited all attributes (and their values) from axis A - (name, long name, i_index, j_index, ... - etc). -\end_layout - -\begin_layout Subsection -Advanced configuration -\end_layout - -\begin_layout Standard -Like domain, there are several transformation which can be defined with - configuration file. - All transformations on an axis have form *_axis. - -\end_layout - -\begin_layout Standard -Till now, XIOS supports the following transformation on axis: -\end_layout - -\begin_layout Itemize -zoom_axis: Like zoom functionality in XIOS 1.0, the destination grid is the - zoomed region of the source grid. -\end_layout - -\begin_layout Itemize -interpolation_axis: Implement interpolation from an axis to one another. - For now, only polynominal interpolation is available. -\end_layout - -\begin_layout Itemize -inverse_axis: Inverse an axis -\end_layout - -\begin_layout Standard -It is not difficult to define a transformation: Include type of transformation - inside axis definition, as the following -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -The concrete example is translated as: the axis named axis_A_zoom is transformed - from axis name axis_A with a zoom activity. - The detailed attributes of zoom_axis can be found in reference document, - but simply it contains the begining and size of zoomed region. -\end_layout - -\begin_layout Standard -One remark is the transformed axis SHOULD have an id, in this case, it's - axis_A_zoom. - As mentioned before, a no-id axis or any no-id component of XIOS can only - be used inside its definition scope. -\end_layout - -\begin_layout Standard -To make use of transformation, the grid must contain axis which references - to transformed ones. - -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -On defining this way, we tell XIOS to establish a connection between two - grids by a transformation (zoom) with: grid source - grid_A, grid destination - - grid_A_zoom. -\end_layout - -\begin_layout Standard -As mentioned in Grid Chapter, in order to use transformed grid, just reference - to it in field_definition -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -Although xml is helpful to define several configurations, it can not be - used to customize attributes of axis. - So it's the turn of Fortran interface. -\end_layout - -\begin_layout Section -Working with FORTRAN code -\end_layout - -\begin_layout Standard -Although axis is not as complexe as domain, there are some mandatory attributes - to define. - Different from precedent version, XIOS 2.0 supports distribution of data - on a axis. - The followings describe the essential parts of axis. - Details of its attributes and operations can be found in XIOS reference - guide. -\end_layout - -\begin_layout Subsection -Local axis index -\end_layout - -\begin_layout Standard -Axis is often used with domain, which is broken into several distributed - pieces, to make a 3 dimension grid. - However, there are cases in which data on axis are distributed among processes. - Following we consider a simple case: a axis with global size 9 and its - data are distributed evenly among 3 client processes, each of which has - size 3. -\end_layout - -\begin_layout Standard -\begin_inset Float figure -placement !tbph -wide false -sideways false -status open - -\begin_layout Plain Layout -\begin_inset Graphics - filename ../images/Distributed_Axis.pdf - lyxscale 50 - scale 60 - -\end_inset - - -\end_layout - -\begin_layout Plain Layout -\begin_inset Caption Standard - -\begin_layout Plain Layout -Global axis data -\end_layout - -\end_inset - - -\begin_inset CommandInset label -LatexCommand label -name "globalAxis" - -\end_inset - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -The local axis can be described by the following way. -\end_layout - -\begin_layout Standard -Specify the the beginning and size of local axis with: -\end_layout - -\begin_layout Itemize -n_glo: global size of axis. - -\end_layout - -\begin_layout Itemize -begin: global position where a local axis begin -\end_layout - -\begin_layout Itemize -n: local size of axis on each process -\end_layout - -\begin_layout Standard -For example, the local axis in the middle (the yellow one) can be specified - with: -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - -CALL xios_set_axis_attr("axis_A",n_glo=9, begin=3, n=3) -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Subsection -Local axis data -\end_layout - -\begin_layout Standard -Simpler than local domain data, data on axis is always on-dimension. - Like local domain data, local axis data represent the data offset from - local axis, and it can be defined in two ways. -\end_layout - -\begin_layout Standard -Specify the begining and size of data on the local axis: -\end_layout - -\begin_layout Itemize -data_begin: the local position of data on axis where data begins -\end_layout - -\begin_layout Itemize -data_n: size of data on each local axis -\end_layout - -\begin_layout Standard -Or specify data with its position in the local axis: -\end_layout - -\begin_layout Itemize -data_index: array of local position of data in the local axis. -\end_layout - -\begin_layout Standard -Although the valid data must be inside a local axis, it is not neccessary - for data to have same size. - In fact, data can have larger size than local axis. -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - -CALL xios_set_axis_attr("axis_A", data_begin=-1, data_n=n+2) -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -For local axis_A, the negative value of data_begin indicates that data is - larger than local axis, the valid part of data needs extracted from the - real data. - If data_begin has a positive value, that means data size is smaller than - local axis. - The default value of data_begin is 0, which implies that local data fit - into local axis properly. - -\end_layout - -\begin_layout Standard -Loal data can be defined with: -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - -CALL xios_set_axis_attr("axis_A",data_index=data) -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -with -\end_layout - -\begin_layout Itemize -data = {-1,0,1,2,3} -\end_layout - -\begin_layout Subsection -Value -\end_layout - -\begin_layout Standard -Value of axis plays a same role as longitude and latitude of domain. - As local data, it can be distributed among processes. -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - -CALL xios_set_axis_attr("axis_A", value=valueAxis) -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -with -\end_layout - -\begin_layout Itemize -valueAxis = {30, 40, 50} -\end_layout - -\begin_layout Standard -Because there is a need of direction of an axis, then comes the attribute - positive -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - -CALL xios_set_axis_attr("axis_A", positive='up') -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -All attributes of axis can be found in Reference Guide. -\end_layout - -\begin_layout Standard - -\end_layout - -\end_body -\end_document diff --git a/xios_2311_src/trunk/.svn/pristine/33/3335d3cafa9177a9ed6c7ec65f21beab01bd67e9.svn-base b/xios_2311_src/trunk/.svn/pristine/33/3335d3cafa9177a9ed6c7ec65f21beab01bd67e9.svn-base deleted file mode 100644 index 23496bfec6c85a201906bfba58070942cb13e588..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/33/3335d3cafa9177a9ed6c7ec65f21beab01bd67e9.svn-base +++ /dev/null @@ -1,522 +0,0 @@ -#include -#include "node.hpp" -#include "timerRemap.hpp" -#include "circle.hpp" -#include "meshutil.hpp" -#include "polyg.hpp" -#include "gridRemap.hpp" -#include "intersect.hpp" -#include "errhandle.hpp" -#include "mpi_routing.hpp" -#include "misc.hpp" - -#include "parallel_tree.hpp" - -namespace sphereRemap { - -static const int assignLevel = 2; - -// only the circle is packed, rest of node will be initialized on unpacking -static void packNode(NodePtr node, char *buffer, int& index) -{ - if (buffer == NULL) // compute size only - index += 4 * sizeof(double); - else - { - *(Coord *)(&buffer[index]) = node->centre; - index += sizeof(Coord); - - *(double *)(&buffer[index]) = node->radius; - index += sizeof(double); - } -} - -static void unpackNode(NodePtr node, char *buffer, int& index) -{ - Coord centre; - double r; - - centre = *(Coord *)(&buffer[index]); - index += sizeof(Coord); - - r = *(double *)(&buffer[index]); - index += sizeof(double); - - node->centre = centre; - node->radius = r; -} - - -static void packElement(Elt *ptElement, char *buffer, int& index) -{ - if (buffer == NULL) index += packedPolygonSize(*ptElement); - else packPolygon(*ptElement, buffer, index); -} - -static void unpackElement(Elt *ptElement, char *buffer, int& index) -{ - unpackPolygon(*ptElement, buffer, index); -} - -static void packVector(const vector& vec, char *buf, int& pos) -{ - if (buf == NULL) - pos += sizeof(int) + vec.size()*sizeof(int); - else - { - *((int *) &(buf[pos])) = vec.size(); - pos += sizeof(int); - for (int i = 0; i < vec.size(); i++) - { - *((int *) &(buf[pos])) = vec[i]; - pos += sizeof(int); - } - } -} - -static void unpackVector(vector& vec, const char *buf, int& pos) -{ - vec.resize(*((int *) &(buf[pos]))); - pos += sizeof(int); - for (int i = 0; i < vec.size(); i++) - { - vec[i] = *((int *) &(buf[pos])); - pos += sizeof(int); - } -} - -static void assignRoute(CSampleTree& tree, const CCascadeLevel& cl) // newroot <- root -{ - vector routeRank(cl.group_size); - for (int i = 0; i < cl.group_size; i++) - routeRank[i] = i; //(cl.group_size + cl.polour() - i) % cl.group_size; - std::vector::iterator rank = routeRank.begin(); - tree.root->assignRoute(rank, assignLevel); -} - -static void transferRoutedNodes(CMPIRouting& MPIRoute, /*const*/ vector& nodeSend, const vector& route, vector& nodeRecv) -{ - /* `route` knows what goes where */ - MPIRoute.init(route); - int nRecv = MPIRoute.getTotalSourceElement(); - nodeRecv.resize(nRecv); - MPIRoute.transferToTarget(&nodeSend[0], &nodeRecv[0], packNode, unpackNode); -} - -static void transferRoutedIntersections(CMPIRouting& MPIRoute, const vector& nodeSend, const vector >& route, vector& nodeRecv) -{ - // `route` knows what goes where - MPIRoute.init(route); - int nRecv = MPIRoute.getTotalSourceElement(); - nodeRecv.resize(nRecv); - MPIRoute.transferToTarget((NodePtr*) &nodeSend[0], &nodeRecv[0], packNode, unpackNode); -//cout << MPIRoute.mpiRank << " ROUTE " << nRecv << ": " << nodeSend.size() << " " << nodeRecv.size() << " "; -} - -//CParallelTree::CParallelTree(MPI_Comm comm) : communicator(comm), cascade(MIN_NODE_SZ*MIN_NODE_SZ, comm) -CParallelTree::CParallelTree(MPI_Comm comm) : communicator(comm), cascade(MAX_NODE_SZ*MAX_NODE_SZ*2, comm) -{ - treeCascade.reserve(cascade.num_levels); - for (int lev = 0; lev < cascade.num_levels; lev++) - treeCascade.push_back(CSampleTree(cascade.level[lev].group_size, assignLevel)); -} - -void CParallelTree::buildSampleTreeCascade(vector& sampleNodes /*route field will be modified*/, int level) -{ - buildSampleTree(treeCascade[level], sampleNodes, cascade.level[level]); - assignRoute(treeCascade[level] /*out*/, cascade.level[level] /*in*/); - - if (level+1 < cascade.num_levels) - { - vector route(sampleNodes.size()); - treeCascade[level].routeNodes(route, sampleNodes, assignLevel); - - vector routedNodes; - CMPIRouting mpiRoute(cascade.level[level].pg_comm); - transferRoutedNodes(mpiRoute, sampleNodes, route, routedNodes); - buildSampleTreeCascade(routedNodes, level+1); - } -} - -void buildSampleTree(CSampleTree& tree, const vector& node, const CCascadeLevel& comm) -/* - In the beginning all the sample elements are distributed - -> communicate to make available at each rank - so that each rank can build the same sample tree -*/ -{ - int n = node.size(); // number of samples intially on this rank (local) - - int blocSize = comm.group_size * ipow(MAX_NODE_SZ, assignLevel); - - int nrecv; // global number of samples THIS WILL BE THE NUMBER OF LEAFS IN THE SAMPLE TREE - MPI_Allreduce(&n, &nrecv, 1, MPI_INT, MPI_SUM, comm.comm); // => size of sample tree does not depend on keepNodes! - double ratio = blocSize / (1.0 * nrecv); - int nsend = ratio * n + 1; // nsend = n_local_samples / n_global_samples * blocksize + 1 = blocksize/comm.size - if (nsend > n) nsend = n; - - int *counts = new int[comm.size]; - MPI_Allgather(&nsend, 1, MPI_INT, counts, 1, MPI_INT, comm.comm); - - nrecv = 0; - int *displs = new int[comm.size]; - for (int i = 0; i < comm.size; i++) - { - displs[i] = 4 * nrecv; - nrecv += counts[i]; - counts[i] = 4 * counts[i]; - } - - /* pack circles around sample elements */ - double *sendBuffer = new double[nsend*4]; - int index = 0; - vector randomArray(n); - randomizeArray(randomArray); - for (int i = 0; i < nsend; i++) - { - const Node& no = *node[randomArray[i]]; - *((Coord *) (sendBuffer + index)) = no.centre; - index += sizeof(Coord)/sizeof(*sendBuffer); - sendBuffer[index++] = no.radius; - } - - /* each process needs the sample elements from all processes */ - double *recvBuffer = new double[nrecv*4]; - MPI_Allgatherv(sendBuffer, 4 * nsend, MPI_DOUBLE, recvBuffer, counts, displs, MPI_DOUBLE, comm.comm); - delete[] sendBuffer; - delete[] counts; - delete[] displs; - - /* unpack */ -/* - randomArray.resize(nrecv); - randomizeArray(randomArray); - tree.leafs.resize(nrecv); - index = 0; - - - for (int i = 0; i < nrecv; i++) - { - Coord x = *(Coord *)(&recvBuffer[index]); - index += sizeof(Coord)/sizeof(*recvBuffer); - double radius = recvBuffer[index++]; - tree.leafs[randomArray[i]].centre = x; - tree.leafs[randomArray[i]].radius = radius; - - } -*/ - - randomArray.resize(blocSize); - randomizeArray(randomArray); - tree.leafs.resize(blocSize); - for(auto& it : tree.leafs) it=make_shared() ; - - index = 0; - - size_t s=(sizeof(Coord)/sizeof(*recvBuffer)+1)*nrecv ; - - for (int i = 0; i < blocSize; i++) - { - Coord x = *(Coord *)(&recvBuffer[index%s]); - index += sizeof(Coord)/sizeof(*recvBuffer); - double radius = recvBuffer[index%s]; - index++ ; - tree.leafs[randomArray[i]]->centre = x; - tree.leafs[randomArray[i]]->radius = radius; - - } - - - delete [] recvBuffer; - - CTimer::get("buildSampleTree(local)").resume(); - tree.build(tree.leafs); -// cout << "SampleTree build : assign Level " << assignLevel << " nb Nodes : " << tree.levelSize[assignLevel] << endl; - CTimer::get("buildSampleTree(local)").suspend(); - CTimer::get("buildSampleTree(local)").print(); - /* End gracefully if sample tree could not be constructed with desired number of nodes on assignLevel */ - int allok, ok = (tree.levelSize[assignLevel] == comm.group_size); - if (!ok) - { - cerr << comm.rank << ": PROBLEM: (node assign)" << tree.levelSize[assignLevel] << " != " << comm.group_size << " (keepNodes)" - << " node size : "<incluCheck() == 0); -} - - -void CParallelTree::buildLocalTree(const vector& node, const vector& route) -{ - CMPIRouting MPIRoute(communicator); - MPI_Barrier(communicator); - CTimer::get("buildLocalTree(initRoute)").resume(); - MPIRoute.init(route); - CTimer::get("buildLocalTree(initRoute)").suspend(); - CTimer::get("buildLocalTree(initRoute)").print(); - - nbLocalElements = MPIRoute.getTotalSourceElement(); - localElements = new Elt[nbLocalElements]; - - vector ptElement(node.size()); - for (int i = 0; i < node.size(); i++) - ptElement[i] = (Elt *) (node[i]->data); - - vector ptLocalElement(nbLocalElements); - for (int i = 0; i < nbLocalElements; i++) - ptLocalElement[i] = &localElements[i]; - - CTimer::get("buildLocalTree(transfer)").resume(); - MPIRoute.transferToTarget(&ptElement[0], &ptLocalElement[0], packElement, unpackElement); - CTimer::get("buildLocalTree(transfer)").suspend(); - CTimer::get("buildLocalTree(transfer)").print(); - - CTimer::get("buildLocalTree(local)").resume(); - - int mpiRank; - MPI_Comm_rank(communicator, &mpiRank); - localTree.leafs.reserve(nbLocalElements); - for (int i = 0; i < nbLocalElements; i++) - { - Elt& elt = localElements[i]; - elt.id.ind = i; - elt.id.rank = mpiRank; - localTree.leafs.push_back(make_shared(elt.x, cptRadius(elt), &localElements[i])); - } - localTree.build(localTree.leafs); - - cptAllEltsGeom(localElements, nbLocalElements, srcGrid.pole); - CTimer::get("buildLocalTree(local)").suspend(); - CTimer::get("buildLocalTree(local)").print(); -} - -void CParallelTree::build(vector& node, vector& node2) -{ - - int assignLevel = 2; - int nbSampleNodes = 2*ipow(MAX_NODE_SZ + 1, assignLevel); - - - long int nb1, nb2, nb, nbTot ; - nb1=node.size() ; nb2=node2.size() ; - nb=nb1+nb2 ; - MPI_Allreduce(&nb, &nbTot, 1, MPI_LONG, MPI_SUM, communicator) ; - int commSize ; - MPI_Comm_size(communicator,&commSize) ; - - // make multiple of two - nbSampleNodes /= 2; - nbSampleNodes *= 2; -// assert( nbTot > nbSampleNodes*commSize) ; - - int nbSampleNodes1 = nbSampleNodes * (nb1*commSize)/(1.*nbTot) ; - int nbSampleNodes2 = nbSampleNodes * (nb2*commSize)/(1.*nbTot) ; - - -// assert(node.size() > nbSampleNodes); -// assert(node2.size() > nbSampleNodes); -// assert(node.size() + node2.size() > nbSampleNodes); - vector sampleNodes; sampleNodes.reserve(nbSampleNodes1+nbSampleNodes2); - - vector randomArray1(node.size()); - randomizeArray(randomArray1); - vector randomArray2(node2.size()); - randomizeArray(randomArray2); - -/* - int s1,s2 ; - - if (node.size()< nbSampleNodes/2) - { - s1 = node.size() ; - s2 = nbSampleNodes-s1 ; - } - else if (node2.size()< nbSampleNodes/2) - { - s2 = node.size() ; - s1 = nbSampleNodes-s2 ; - } - else - { - s1=nbSampleNodes/2 ; - s2=nbSampleNodes/2 ; - } -*/ - for (int i = 0; i (node[randomArray1[i%nb1]]->centre, node[randomArray1[i%nb1]]->radius, nullptr)); - for (int i = 0; i (node2[randomArray2[i%nb2]]->centre, node2[randomArray2[i%nb2]]->radius, nullptr)); - -/* - for (int i = 0; i < nbSampleNodes/2; i++) - { - sampleNodes.push_back(Node(node[randomArray1[i]].centre, node[randomArray1[i]].radius, NULL)); - sampleNodes.push_back(Node(node2[randomArray2[i]].centre, node2[randomArray2[i]].radius, NULL)); - } -*/ - CTimer::get("buildParallelSampleTree").resume(); - //sampleTree.buildParallelSampleTree(sampleNodes, cascade); - buildSampleTreeCascade(sampleNodes); - CTimer::get("buildParallelSampleTree").suspend(); - CTimer::get("buildParallelSampleTree").print(); - - //route source mesh - CTimer::get("parallelRouteNode").resume(); - vector route(node.size()); - routeNodes(route /*out*/, node); - CTimer::get("parallelRouteNode").suspend(); - CTimer::get("parallelRouteNode").print(); - - CTimer::get("buildLocalTree").resume(); - buildLocalTree(node, route); - CTimer::get("buildLocalTree").suspend(); - CTimer::get("buildLocalTree").print(); - - CTimer::get("buildRouteTree").resume(); - /* update circles of tree cascade so it can be used for routing */ - updateCirclesForRouting(localTree.root->centre, localTree.root->radius); - CTimer::get("buildRouteTree").suspend(); - CTimer::get("buildRouteTree").print(); -} - -void CParallelTree::routeNodes(vector& route, vector& nodes /*route field used*/, int level) -{ - treeCascade[level].routeNodes(route /*assign*/, nodes, assignLevel); - - if (level+1 < cascade.num_levels) - { - vector routedNodes; - CMPIRouting MPIRoute(cascade.level[level].pg_comm); - transferRoutedNodes(MPIRoute, nodes, route /*use*/, routedNodes); - vector globalRank(routedNodes.size()); - routeNodes(globalRank, routedNodes, level + 1); - MPIRoute.transferFromSource(&route[0] /*override*/, &globalRank[0]); - } - else - { - CMPIRouting MPIRoute(cascade.level[level].comm); // or use pg_comm, on last cascade level identical - MPIRoute.init(route); - int nbRecvNode = MPIRoute.getTotalSourceElement(); - vector globalRank(nbRecvNode); - for (int i = 0; i < globalRank.size(); i++) - globalRank[i] = cascade.level[0].rank; - MPIRoute.transferFromSource(&route[0] /*override*/, &globalRank[0]); - } -} - -/* assume `to` to be empty vector at entry */ -void linearize(const vector >& from, vector& to) -{ - int cnt = 0; - for (int i = 0; i < from.size(); ++i) - cnt += from[i].size(); - to.resize(cnt); - vector::iterator dest = to.begin(); - for (int i = 0; i < from.size(); ++i) - dest = copy(from[i].begin(), from[i].end(), dest); -} - -/* at entry `to` must already have it's final shape and only values are overriden */ -void delinearize(const vector& from, vector >& to) -{ - vector::const_iterator end, src = from.begin(); - for (int i = 0; i < to.size(); ++i, src=end) - copy(src, end = src + to[i].size(), to[i].begin()); -} - -void CParallelTree::routeIntersections(vector >& routes, vector& nodes, int level) -{ - treeCascade[level].routeIntersections(routes /*assign*/, nodes); - - if (level+1 < cascade.num_levels) - { - vector routedNodes; - CMPIRouting MPIRoute(cascade.level[level].pg_comm); - - vector flattenedRoutes1; - linearize(routes, flattenedRoutes1); - vector double_nodes(flattenedRoutes1.size()); - int j = 0; - for (int i = 0; i < routes.size(); ++i) - for (int k = 0; k < routes[i].size(); ++k, ++j) - { - double_nodes[j] = make_shared() ; - *double_nodes[j] = *nodes[i]; - } - transferRoutedNodes(MPIRoute, double_nodes, flattenedRoutes1 /*use*/, routedNodes); - vector > globalRanks(routedNodes.size()); - routeIntersections(globalRanks /*out*/, routedNodes /*in*/, level + 1); - vector > flattenedRoutes(flattenedRoutes1.size()); - // transferFromSource expects sizes (nbSendNode=flattenedRoutes, nbRecvNode=routedNodes.size()) - MPIRoute.transferFromSource(&flattenedRoutes[0], &globalRanks[0], packVector, unpackVector); - for (int i = 0, j = 0; i < routes.size(); ++i) - { - int old_size = routes[i].size(); - routes[i].resize(0); - for (int k = 0; k < old_size; ++k, ++j) - for (int l = 0; l < flattenedRoutes[j].size(); ++l) - routes[i].push_back(flattenedRoutes[j][l]); - } - assert(j == flattenedRoutes1.size()); - - } - else - { - CMPIRouting MPIRoute(cascade.level[level].comm); - MPIRoute.init(routes); - int nbRecvNode = MPIRoute.getTotalSourceElement(); - vector globalRanks(nbRecvNode, cascade.level[0].rank); - vector flattened_routes; - linearize(routes, flattened_routes); - MPIRoute.transferFromSource(&flattened_routes[0], &globalRanks[0]); - delinearize(flattened_routes, routes); - } - if (level!=level) - { - for (int i = 0; i < routes.size(); ++i) - for (int k = 0; k < routes[i].size(); ++k) - if (routes[i][k] == cascade.level[0].rank) routes[i].erase(routes[i].begin() + (k--)); - } -} - -void CParallelTree::updateCirclesForRouting(Coord rootCentre, double rootRadius, int level) -{ - if (level + 1 < cascade.num_levels) // children in the cascade have to update first - { - updateCirclesForRouting(rootCentre, rootRadius, level + 1); - rootCentre = treeCascade[level+1].root->centre; - rootRadius = treeCascade[level+1].root->radius; - } - - // gather circles on this level of the cascade - int pg_size; - MPI_Comm_size(cascade.level[level].pg_comm, &pg_size); - vector allRootCentres(pg_size); - vector allRootRadia(pg_size); - MPI_Allgather(&rootCentre, 3, MPI_DOUBLE, &allRootCentres[0], 3, MPI_DOUBLE, cascade.level[level].pg_comm); - MPI_Allgather(&rootRadius, 1, MPI_DOUBLE, &allRootRadia[0], 1, MPI_DOUBLE, cascade.level[level].pg_comm); - - // now allRootsRadia and allRootCentres must be inserted into second levels of us and propagated to root - treeCascade[level].root->assignCircleAndPropagateUp(&allRootCentres[0], &allRootRadia[0], assignLevel); -} - -CParallelTree::~CParallelTree() -{ - delete [] localElements; -} - -} diff --git a/xios_2311_src/trunk/.svn/pristine/33/33ab6b25e3ce53e6c8d90ac551a2a0b13cf334af.svn-base b/xios_2311_src/trunk/.svn/pristine/33/33ab6b25e3ce53e6c8d90ac551a2a0b13cf334af.svn-base deleted file mode 100644 index bc26a7cb2ee664fe9446daef8f8462b2620a2565..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/33/33ab6b25e3ce53e6c8d90ac551a2a0b13cf334af.svn-base +++ /dev/null @@ -1,129 +0,0 @@ -#ifndef __XIOS_HPP__ -#define __XIOS_HPP__ - -#include "xios_spl.hpp" -#include "mpi.hpp" -#include "registry.hpp" -#include "ressources_manager.hpp" -#include "services_manager.hpp" -#include "contexts_manager.hpp" -#include "daemons_manager.hpp" -#include "coupler_manager.hpp" -#include "registry_manager.hpp" -#include "mpi_garbage_collector.hpp" - -namespace xios -{ - /*! - \class CXios - */ - class CXios - { - public: - static void initialize(void) ; - static void initClientSide(const string & codeId, MPI_Comm& localComm, MPI_Comm& returnComm) ; - static void initServerSide(void) ; - static void clientFinalize(void) ; - static void parseFile(const string& filename) ; - - template - static T getin(const string& id,const T& defaultValue) ; - - template - static T getin(const string& id) ; - - public: - static string rootFile ; //!< Configuration filename - static string xiosCodeId ; //!< Identity for XIOS - static string clientFile; //!< Filename template for client - static string serverFile; //!< Filename template for server - static string serverPrmFile; //!< Filename template for primary server in case of two server levels - static string serverSndFile; //!< Filename template for secondary server in case of two server levels - - static bool xiosStack; //!< Exception handling - static bool systemStack; //!< Exception handling - - static bool isClient ; //!< Check if xios is client - static bool isServer ; //!< Check if xios is server - - static MPI_Comm globalComm ; //!< Global communicator - static MPI_Comm xiosComm ; //!< Global communicator - - static bool printLogs2Files; //!< Printing out logs into files - static bool usingOasis ; //!< Using Oasis - static bool usingServer ; //!< Using server (server mode) - static bool usingServer2 ; //!< Using secondary server (server mode). IMPORTANT: Use this variable ONLY in CServer::initialize(). - static int ratioServer2 ; //!< Percentage of server processors dedicated to secondary server - static int nbPoolsServer2 ; //!< Number of pools created on the secondary server - static double bufferSizeFactor; //!< Factor used to tune the buffer size - static const double defaultBufferSizeFactor; //!< Default factor value - static StdSize minBufferSize; //!< Minimum buffer size - static StdSize maxBufferSize; //!< Maximum buffer size - static bool isOptPerformance; //!< Check if buffer size is for performance (as large as possible) - static CRegistry* globalRegistry ; //!< global registry which is wrote by the root process of the servers - static double recvFieldTimeout; //!< Time to wait for data before issuing an error when receiving a field - static bool checkEventSync; //!< For debuuging, check if event are coherent and synchrone on client side - - static const string defaultPoolId ; - static const string defaultServerId ; - static const string defaultGathererId ; - - - static CRegistryManager* registryManager_ ; - static CRessourcesManager* ressourcesManager_ ; - static CCouplerManager* couplerManager_ ; - static CServicesManager* servicesManager_ ; - static CContextsManager* contextsManager_ ; - static CDaemonsManager* daemonsManager_ ; - static CMpiGarbageCollector MpiGarbageCollector_ ; - public: - static CMpiGarbageCollector& getMpiGarbageCollector(void) { return MpiGarbageCollector_ ; } - public: - //! Setting xios to use server mode - static void setUsingServer(); - - //! Setting xios NOT to use server mode - static void setNotUsingServer(); - - //! is using server mode - static bool isUsingServer() {return usingServer;} - - //! Initialize server (if any) - static void initServer(); - - static void launchServicesManager( bool isXiosServer) ; - static void launchContextsManager(bool isXiosServer) ; - static void launchDaemonsManager(bool isXiosServer) ; - static void launchRessourcesManager(bool isXiosServer) ; - static void launchCouplerManager(bool isXiosServer) ; - static void launchRegistryManager(bool isXiosServer) ; - - static void finalizeServicesManager() ; - static void finalizeContextsManager() ; - static void finalizeDaemonsManager() ; - static void finalizeRessourcesManager() ; - static void finalizeCouplerManager() ; - static void finalizeRegistryManager() ; - - static CRegistryManager* getRegistryManager(void) { return registryManager_ ;} - static CRessourcesManager* getRessourcesManager(void) { return ressourcesManager_ ;} - static CCouplerManager* getCouplerManager(void) { return couplerManager_ ;} - static CServicesManager* getServicesManager(void) { return servicesManager_ ;} - static CContextsManager* getContextsManager(void) { return contextsManager_ ;} - static CDaemonsManager* getDaemonsManager(void) { return daemonsManager_ ;} - static CPoolRessource* getPoolRessource(void) ; - - static MPI_Comm getGlobalComm(void) { return globalComm ;} - static MPI_Comm getXiosComm(void) { return xiosComm ;} - static void setXiosComm(MPI_Comm comm) { xiosComm=comm ;} - static CRegistry* getGlobalRegistry(void) { return globalRegistry ;} - static void setGlobalRegistry(CRegistry* registry) { globalRegistry=registry ;} - - private: - //! Parse only Xios part of configuration file - static void parseXiosConfig(); - } ; -} - -//#include "cxios_impl.hpp" -#endif // __XIOS_HPP__ diff --git a/xios_2311_src/trunk/.svn/pristine/33/33eafddc50378f5b65640fc47e720c1e2b47ce83.svn-base b/xios_2311_src/trunk/.svn/pristine/33/33eafddc50378f5b65640fc47e720c1e2b47ce83.svn-base deleted file mode 100644 index 49302a622a79d894f3ed82ab52e02394b9d7c2a0..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/33/33eafddc50378f5b65640fc47e720c1e2b47ce83.svn-base +++ /dev/null @@ -1,937 +0,0 @@ -/* ************************************************************************** * - * Interface auto generated - do not modify * - * ************************************************************************** */ - -#include -#include "xios.hpp" -#include "attribute_template.hpp" -#include "object_template.hpp" -#include "group_template.hpp" -#include "icutil.hpp" -#include "icdate.hpp" -#include "timer.hpp" -#include "node_type.hpp" - -extern "C" -{ - typedef xios::CFile* file_Ptr; - - void cxios_set_file_append(file_Ptr file_hdl, bool append) - { - CTimer::get("XIOS").resume(); - file_hdl->append.setValue(append); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_file_append(file_Ptr file_hdl, bool* append) - { - CTimer::get("XIOS").resume(); - *append = file_hdl->append.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_file_append(file_Ptr file_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = file_hdl->append.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_file_comment(file_Ptr file_hdl, const char * comment, int comment_size) - { - std::string comment_str; - if (!cstr2string(comment, comment_size, comment_str)) return; - CTimer::get("XIOS").resume(); - file_hdl->comment.setValue(comment_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_file_comment(file_Ptr file_hdl, char * comment, int comment_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(file_hdl->comment.getInheritedValue(), comment, comment_size)) - ERROR("void cxios_get_file_comment(file_Ptr file_hdl, char * comment, int comment_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_file_comment(file_Ptr file_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = file_hdl->comment.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_file_compression_level(file_Ptr file_hdl, int compression_level) - { - CTimer::get("XIOS").resume(); - file_hdl->compression_level.setValue(compression_level); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_file_compression_level(file_Ptr file_hdl, int* compression_level) - { - CTimer::get("XIOS").resume(); - *compression_level = file_hdl->compression_level.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_file_compression_level(file_Ptr file_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = file_hdl->compression_level.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_file_convention(file_Ptr file_hdl, const char * convention, int convention_size) - { - std::string convention_str; - if (!cstr2string(convention, convention_size, convention_str)) return; - CTimer::get("XIOS").resume(); - file_hdl->convention.fromString(convention_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_file_convention(file_Ptr file_hdl, char * convention, int convention_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(file_hdl->convention.getInheritedStringValue(), convention, convention_size)) - ERROR("void cxios_get_file_convention(file_Ptr file_hdl, char * convention, int convention_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_file_convention(file_Ptr file_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = file_hdl->convention.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_file_convention_str(file_Ptr file_hdl, const char * convention_str, int convention_str_size) - { - std::string convention_str_str; - if (!cstr2string(convention_str, convention_str_size, convention_str_str)) return; - CTimer::get("XIOS").resume(); - file_hdl->convention_str.setValue(convention_str_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_file_convention_str(file_Ptr file_hdl, char * convention_str, int convention_str_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(file_hdl->convention_str.getInheritedValue(), convention_str, convention_str_size)) - ERROR("void cxios_get_file_convention_str(file_Ptr file_hdl, char * convention_str, int convention_str_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_file_convention_str(file_Ptr file_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = file_hdl->convention_str.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_file_cyclic(file_Ptr file_hdl, bool cyclic) - { - CTimer::get("XIOS").resume(); - file_hdl->cyclic.setValue(cyclic); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_file_cyclic(file_Ptr file_hdl, bool* cyclic) - { - CTimer::get("XIOS").resume(); - *cyclic = file_hdl->cyclic.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_file_cyclic(file_Ptr file_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = file_hdl->cyclic.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_file_description(file_Ptr file_hdl, const char * description, int description_size) - { - std::string description_str; - if (!cstr2string(description, description_size, description_str)) return; - CTimer::get("XIOS").resume(); - file_hdl->description.setValue(description_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_file_description(file_Ptr file_hdl, char * description, int description_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(file_hdl->description.getInheritedValue(), description, description_size)) - ERROR("void cxios_get_file_description(file_Ptr file_hdl, char * description, int description_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_file_description(file_Ptr file_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = file_hdl->description.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_file_enabled(file_Ptr file_hdl, bool enabled) - { - CTimer::get("XIOS").resume(); - file_hdl->enabled.setValue(enabled); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_file_enabled(file_Ptr file_hdl, bool* enabled) - { - CTimer::get("XIOS").resume(); - *enabled = file_hdl->enabled.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_file_enabled(file_Ptr file_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = file_hdl->enabled.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_file_format(file_Ptr file_hdl, const char * format, int format_size) - { - std::string format_str; - if (!cstr2string(format, format_size, format_str)) return; - CTimer::get("XIOS").resume(); - file_hdl->format.fromString(format_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_file_format(file_Ptr file_hdl, char * format, int format_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(file_hdl->format.getInheritedStringValue(), format, format_size)) - ERROR("void cxios_get_file_format(file_Ptr file_hdl, char * format, int format_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_file_format(file_Ptr file_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = file_hdl->format.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_file_min_digits(file_Ptr file_hdl, int min_digits) - { - CTimer::get("XIOS").resume(); - file_hdl->min_digits.setValue(min_digits); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_file_min_digits(file_Ptr file_hdl, int* min_digits) - { - CTimer::get("XIOS").resume(); - *min_digits = file_hdl->min_digits.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_file_min_digits(file_Ptr file_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = file_hdl->min_digits.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_file_mode(file_Ptr file_hdl, const char * mode, int mode_size) - { - std::string mode_str; - if (!cstr2string(mode, mode_size, mode_str)) return; - CTimer::get("XIOS").resume(); - file_hdl->mode.fromString(mode_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_file_mode(file_Ptr file_hdl, char * mode, int mode_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(file_hdl->mode.getInheritedStringValue(), mode, mode_size)) - ERROR("void cxios_get_file_mode(file_Ptr file_hdl, char * mode, int mode_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_file_mode(file_Ptr file_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = file_hdl->mode.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_file_name(file_Ptr file_hdl, const char * name, int name_size) - { - std::string name_str; - if (!cstr2string(name, name_size, name_str)) return; - CTimer::get("XIOS").resume(); - file_hdl->name.setValue(name_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_file_name(file_Ptr file_hdl, char * name, int name_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(file_hdl->name.getInheritedValue(), name, name_size)) - ERROR("void cxios_get_file_name(file_Ptr file_hdl, char * name, int name_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_file_name(file_Ptr file_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = file_hdl->name.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_file_name_suffix(file_Ptr file_hdl, const char * name_suffix, int name_suffix_size) - { - std::string name_suffix_str; - if (!cstr2string(name_suffix, name_suffix_size, name_suffix_str)) return; - CTimer::get("XIOS").resume(); - file_hdl->name_suffix.setValue(name_suffix_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_file_name_suffix(file_Ptr file_hdl, char * name_suffix, int name_suffix_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(file_hdl->name_suffix.getInheritedValue(), name_suffix, name_suffix_size)) - ERROR("void cxios_get_file_name_suffix(file_Ptr file_hdl, char * name_suffix, int name_suffix_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_file_name_suffix(file_Ptr file_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = file_hdl->name_suffix.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_file_output_freq(file_Ptr file_hdl, cxios_duration output_freq_c) - { - CTimer::get("XIOS").resume(); - file_hdl->output_freq.allocate(); - CDuration& output_freq = file_hdl->output_freq.get(); - output_freq.year = output_freq_c.year; - output_freq.month = output_freq_c.month; - output_freq.day = output_freq_c.day; - output_freq.hour = output_freq_c.hour; - output_freq.minute = output_freq_c.minute; - output_freq.second = output_freq_c.second; - output_freq.timestep = output_freq_c.timestep; - CTimer::get("XIOS").suspend(); - } - - void cxios_get_file_output_freq(file_Ptr file_hdl, cxios_duration* output_freq_c) - { - CTimer::get("XIOS").resume(); - CDuration output_freq = file_hdl->output_freq.getInheritedValue(); - output_freq_c->year = output_freq.year; - output_freq_c->month = output_freq.month; - output_freq_c->day = output_freq.day; - output_freq_c->hour = output_freq.hour; - output_freq_c->minute = output_freq.minute; - output_freq_c->second = output_freq.second; - output_freq_c->timestep = output_freq.timestep; - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_file_output_freq(file_Ptr file_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = file_hdl->output_freq.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_file_output_level(file_Ptr file_hdl, int output_level) - { - CTimer::get("XIOS").resume(); - file_hdl->output_level.setValue(output_level); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_file_output_level(file_Ptr file_hdl, int* output_level) - { - CTimer::get("XIOS").resume(); - *output_level = file_hdl->output_level.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_file_output_level(file_Ptr file_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = file_hdl->output_level.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_file_par_access(file_Ptr file_hdl, const char * par_access, int par_access_size) - { - std::string par_access_str; - if (!cstr2string(par_access, par_access_size, par_access_str)) return; - CTimer::get("XIOS").resume(); - file_hdl->par_access.fromString(par_access_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_file_par_access(file_Ptr file_hdl, char * par_access, int par_access_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(file_hdl->par_access.getInheritedStringValue(), par_access, par_access_size)) - ERROR("void cxios_get_file_par_access(file_Ptr file_hdl, char * par_access, int par_access_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_file_par_access(file_Ptr file_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = file_hdl->par_access.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_file_read_metadata_par(file_Ptr file_hdl, bool read_metadata_par) - { - CTimer::get("XIOS").resume(); - file_hdl->read_metadata_par.setValue(read_metadata_par); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_file_read_metadata_par(file_Ptr file_hdl, bool* read_metadata_par) - { - CTimer::get("XIOS").resume(); - *read_metadata_par = file_hdl->read_metadata_par.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_file_read_metadata_par(file_Ptr file_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = file_hdl->read_metadata_par.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_file_record_offset(file_Ptr file_hdl, int record_offset) - { - CTimer::get("XIOS").resume(); - file_hdl->record_offset.setValue(record_offset); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_file_record_offset(file_Ptr file_hdl, int* record_offset) - { - CTimer::get("XIOS").resume(); - *record_offset = file_hdl->record_offset.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_file_record_offset(file_Ptr file_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = file_hdl->record_offset.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_file_split_end_offset(file_Ptr file_hdl, cxios_duration split_end_offset_c) - { - CTimer::get("XIOS").resume(); - file_hdl->split_end_offset.allocate(); - CDuration& split_end_offset = file_hdl->split_end_offset.get(); - split_end_offset.year = split_end_offset_c.year; - split_end_offset.month = split_end_offset_c.month; - split_end_offset.day = split_end_offset_c.day; - split_end_offset.hour = split_end_offset_c.hour; - split_end_offset.minute = split_end_offset_c.minute; - split_end_offset.second = split_end_offset_c.second; - split_end_offset.timestep = split_end_offset_c.timestep; - CTimer::get("XIOS").suspend(); - } - - void cxios_get_file_split_end_offset(file_Ptr file_hdl, cxios_duration* split_end_offset_c) - { - CTimer::get("XIOS").resume(); - CDuration split_end_offset = file_hdl->split_end_offset.getInheritedValue(); - split_end_offset_c->year = split_end_offset.year; - split_end_offset_c->month = split_end_offset.month; - split_end_offset_c->day = split_end_offset.day; - split_end_offset_c->hour = split_end_offset.hour; - split_end_offset_c->minute = split_end_offset.minute; - split_end_offset_c->second = split_end_offset.second; - split_end_offset_c->timestep = split_end_offset.timestep; - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_file_split_end_offset(file_Ptr file_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = file_hdl->split_end_offset.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_file_split_freq(file_Ptr file_hdl, cxios_duration split_freq_c) - { - CTimer::get("XIOS").resume(); - file_hdl->split_freq.allocate(); - CDuration& split_freq = file_hdl->split_freq.get(); - split_freq.year = split_freq_c.year; - split_freq.month = split_freq_c.month; - split_freq.day = split_freq_c.day; - split_freq.hour = split_freq_c.hour; - split_freq.minute = split_freq_c.minute; - split_freq.second = split_freq_c.second; - split_freq.timestep = split_freq_c.timestep; - CTimer::get("XIOS").suspend(); - } - - void cxios_get_file_split_freq(file_Ptr file_hdl, cxios_duration* split_freq_c) - { - CTimer::get("XIOS").resume(); - CDuration split_freq = file_hdl->split_freq.getInheritedValue(); - split_freq_c->year = split_freq.year; - split_freq_c->month = split_freq.month; - split_freq_c->day = split_freq.day; - split_freq_c->hour = split_freq.hour; - split_freq_c->minute = split_freq.minute; - split_freq_c->second = split_freq.second; - split_freq_c->timestep = split_freq.timestep; - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_file_split_freq(file_Ptr file_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = file_hdl->split_freq.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_file_split_freq_format(file_Ptr file_hdl, const char * split_freq_format, int split_freq_format_size) - { - std::string split_freq_format_str; - if (!cstr2string(split_freq_format, split_freq_format_size, split_freq_format_str)) return; - CTimer::get("XIOS").resume(); - file_hdl->split_freq_format.setValue(split_freq_format_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_file_split_freq_format(file_Ptr file_hdl, char * split_freq_format, int split_freq_format_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(file_hdl->split_freq_format.getInheritedValue(), split_freq_format, split_freq_format_size)) - ERROR("void cxios_get_file_split_freq_format(file_Ptr file_hdl, char * split_freq_format, int split_freq_format_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_file_split_freq_format(file_Ptr file_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = file_hdl->split_freq_format.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_file_split_last_date(file_Ptr file_hdl, const char * split_last_date, int split_last_date_size) - { - std::string split_last_date_str; - if (!cstr2string(split_last_date, split_last_date_size, split_last_date_str)) return; - CTimer::get("XIOS").resume(); - file_hdl->split_last_date.setValue(split_last_date_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_file_split_last_date(file_Ptr file_hdl, char * split_last_date, int split_last_date_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(file_hdl->split_last_date.getInheritedValue(), split_last_date, split_last_date_size)) - ERROR("void cxios_get_file_split_last_date(file_Ptr file_hdl, char * split_last_date, int split_last_date_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_file_split_last_date(file_Ptr file_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = file_hdl->split_last_date.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_file_split_start_offset(file_Ptr file_hdl, cxios_duration split_start_offset_c) - { - CTimer::get("XIOS").resume(); - file_hdl->split_start_offset.allocate(); - CDuration& split_start_offset = file_hdl->split_start_offset.get(); - split_start_offset.year = split_start_offset_c.year; - split_start_offset.month = split_start_offset_c.month; - split_start_offset.day = split_start_offset_c.day; - split_start_offset.hour = split_start_offset_c.hour; - split_start_offset.minute = split_start_offset_c.minute; - split_start_offset.second = split_start_offset_c.second; - split_start_offset.timestep = split_start_offset_c.timestep; - CTimer::get("XIOS").suspend(); - } - - void cxios_get_file_split_start_offset(file_Ptr file_hdl, cxios_duration* split_start_offset_c) - { - CTimer::get("XIOS").resume(); - CDuration split_start_offset = file_hdl->split_start_offset.getInheritedValue(); - split_start_offset_c->year = split_start_offset.year; - split_start_offset_c->month = split_start_offset.month; - split_start_offset_c->day = split_start_offset.day; - split_start_offset_c->hour = split_start_offset.hour; - split_start_offset_c->minute = split_start_offset.minute; - split_start_offset_c->second = split_start_offset.second; - split_start_offset_c->timestep = split_start_offset.timestep; - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_file_split_start_offset(file_Ptr file_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = file_hdl->split_start_offset.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_file_sync_freq(file_Ptr file_hdl, cxios_duration sync_freq_c) - { - CTimer::get("XIOS").resume(); - file_hdl->sync_freq.allocate(); - CDuration& sync_freq = file_hdl->sync_freq.get(); - sync_freq.year = sync_freq_c.year; - sync_freq.month = sync_freq_c.month; - sync_freq.day = sync_freq_c.day; - sync_freq.hour = sync_freq_c.hour; - sync_freq.minute = sync_freq_c.minute; - sync_freq.second = sync_freq_c.second; - sync_freq.timestep = sync_freq_c.timestep; - CTimer::get("XIOS").suspend(); - } - - void cxios_get_file_sync_freq(file_Ptr file_hdl, cxios_duration* sync_freq_c) - { - CTimer::get("XIOS").resume(); - CDuration sync_freq = file_hdl->sync_freq.getInheritedValue(); - sync_freq_c->year = sync_freq.year; - sync_freq_c->month = sync_freq.month; - sync_freq_c->day = sync_freq.day; - sync_freq_c->hour = sync_freq.hour; - sync_freq_c->minute = sync_freq.minute; - sync_freq_c->second = sync_freq.second; - sync_freq_c->timestep = sync_freq.timestep; - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_file_sync_freq(file_Ptr file_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = file_hdl->sync_freq.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_file_time_counter(file_Ptr file_hdl, const char * time_counter, int time_counter_size) - { - std::string time_counter_str; - if (!cstr2string(time_counter, time_counter_size, time_counter_str)) return; - CTimer::get("XIOS").resume(); - file_hdl->time_counter.fromString(time_counter_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_file_time_counter(file_Ptr file_hdl, char * time_counter, int time_counter_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(file_hdl->time_counter.getInheritedStringValue(), time_counter, time_counter_size)) - ERROR("void cxios_get_file_time_counter(file_Ptr file_hdl, char * time_counter, int time_counter_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_file_time_counter(file_Ptr file_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = file_hdl->time_counter.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_file_time_counter_name(file_Ptr file_hdl, const char * time_counter_name, int time_counter_name_size) - { - std::string time_counter_name_str; - if (!cstr2string(time_counter_name, time_counter_name_size, time_counter_name_str)) return; - CTimer::get("XIOS").resume(); - file_hdl->time_counter_name.setValue(time_counter_name_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_file_time_counter_name(file_Ptr file_hdl, char * time_counter_name, int time_counter_name_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(file_hdl->time_counter_name.getInheritedValue(), time_counter_name, time_counter_name_size)) - ERROR("void cxios_get_file_time_counter_name(file_Ptr file_hdl, char * time_counter_name, int time_counter_name_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_file_time_counter_name(file_Ptr file_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = file_hdl->time_counter_name.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_file_time_stamp_format(file_Ptr file_hdl, const char * time_stamp_format, int time_stamp_format_size) - { - std::string time_stamp_format_str; - if (!cstr2string(time_stamp_format, time_stamp_format_size, time_stamp_format_str)) return; - CTimer::get("XIOS").resume(); - file_hdl->time_stamp_format.setValue(time_stamp_format_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_file_time_stamp_format(file_Ptr file_hdl, char * time_stamp_format, int time_stamp_format_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(file_hdl->time_stamp_format.getInheritedValue(), time_stamp_format, time_stamp_format_size)) - ERROR("void cxios_get_file_time_stamp_format(file_Ptr file_hdl, char * time_stamp_format, int time_stamp_format_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_file_time_stamp_format(file_Ptr file_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = file_hdl->time_stamp_format.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_file_time_stamp_name(file_Ptr file_hdl, const char * time_stamp_name, int time_stamp_name_size) - { - std::string time_stamp_name_str; - if (!cstr2string(time_stamp_name, time_stamp_name_size, time_stamp_name_str)) return; - CTimer::get("XIOS").resume(); - file_hdl->time_stamp_name.setValue(time_stamp_name_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_file_time_stamp_name(file_Ptr file_hdl, char * time_stamp_name, int time_stamp_name_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(file_hdl->time_stamp_name.getInheritedValue(), time_stamp_name, time_stamp_name_size)) - ERROR("void cxios_get_file_time_stamp_name(file_Ptr file_hdl, char * time_stamp_name, int time_stamp_name_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_file_time_stamp_name(file_Ptr file_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = file_hdl->time_stamp_name.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_file_time_units(file_Ptr file_hdl, const char * time_units, int time_units_size) - { - std::string time_units_str; - if (!cstr2string(time_units, time_units_size, time_units_str)) return; - CTimer::get("XIOS").resume(); - file_hdl->time_units.fromString(time_units_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_file_time_units(file_Ptr file_hdl, char * time_units, int time_units_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(file_hdl->time_units.getInheritedStringValue(), time_units, time_units_size)) - ERROR("void cxios_get_file_time_units(file_Ptr file_hdl, char * time_units, int time_units_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_file_time_units(file_Ptr file_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = file_hdl->time_units.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_file_timeseries(file_Ptr file_hdl, const char * timeseries, int timeseries_size) - { - std::string timeseries_str; - if (!cstr2string(timeseries, timeseries_size, timeseries_str)) return; - CTimer::get("XIOS").resume(); - file_hdl->timeseries.fromString(timeseries_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_file_timeseries(file_Ptr file_hdl, char * timeseries, int timeseries_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(file_hdl->timeseries.getInheritedStringValue(), timeseries, timeseries_size)) - ERROR("void cxios_get_file_timeseries(file_Ptr file_hdl, char * timeseries, int timeseries_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_file_timeseries(file_Ptr file_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = file_hdl->timeseries.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_file_ts_prefix(file_Ptr file_hdl, const char * ts_prefix, int ts_prefix_size) - { - std::string ts_prefix_str; - if (!cstr2string(ts_prefix, ts_prefix_size, ts_prefix_str)) return; - CTimer::get("XIOS").resume(); - file_hdl->ts_prefix.setValue(ts_prefix_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_file_ts_prefix(file_Ptr file_hdl, char * ts_prefix, int ts_prefix_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(file_hdl->ts_prefix.getInheritedValue(), ts_prefix, ts_prefix_size)) - ERROR("void cxios_get_file_ts_prefix(file_Ptr file_hdl, char * ts_prefix, int ts_prefix_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_file_ts_prefix(file_Ptr file_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = file_hdl->ts_prefix.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_file_type(file_Ptr file_hdl, const char * type, int type_size) - { - std::string type_str; - if (!cstr2string(type, type_size, type_str)) return; - CTimer::get("XIOS").resume(); - file_hdl->type.fromString(type_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_file_type(file_Ptr file_hdl, char * type, int type_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(file_hdl->type.getInheritedStringValue(), type, type_size)) - ERROR("void cxios_get_file_type(file_Ptr file_hdl, char * type, int type_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_file_type(file_Ptr file_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = file_hdl->type.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_file_uuid_format(file_Ptr file_hdl, const char * uuid_format, int uuid_format_size) - { - std::string uuid_format_str; - if (!cstr2string(uuid_format, uuid_format_size, uuid_format_str)) return; - CTimer::get("XIOS").resume(); - file_hdl->uuid_format.setValue(uuid_format_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_file_uuid_format(file_Ptr file_hdl, char * uuid_format, int uuid_format_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(file_hdl->uuid_format.getInheritedValue(), uuid_format, uuid_format_size)) - ERROR("void cxios_get_file_uuid_format(file_Ptr file_hdl, char * uuid_format, int uuid_format_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_file_uuid_format(file_Ptr file_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = file_hdl->uuid_format.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_file_uuid_name(file_Ptr file_hdl, const char * uuid_name, int uuid_name_size) - { - std::string uuid_name_str; - if (!cstr2string(uuid_name, uuid_name_size, uuid_name_str)) return; - CTimer::get("XIOS").resume(); - file_hdl->uuid_name.setValue(uuid_name_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_file_uuid_name(file_Ptr file_hdl, char * uuid_name, int uuid_name_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(file_hdl->uuid_name.getInheritedValue(), uuid_name, uuid_name_size)) - ERROR("void cxios_get_file_uuid_name(file_Ptr file_hdl, char * uuid_name, int uuid_name_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_file_uuid_name(file_Ptr file_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = file_hdl->uuid_name.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } -} diff --git a/xios_2311_src/trunk/.svn/pristine/33/33f18990605292c453d50babdefbdc99e5b17a01.svn-base b/xios_2311_src/trunk/.svn/pristine/33/33f18990605292c453d50babdefbdc99e5b17a01.svn-base deleted file mode 100644 index b17ff4387dfa7fab8a350747764fa7720ba25cdd..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/33/33f18990605292c453d50babdefbdc99e5b17a01.svn-base +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include -#include - -namespace xios -{ - - std::string getUuidStr(void) - { - boost::uuids::random_generator gen; - boost::uuids::uuid u = gen(); - return boost::uuids::to_string(u) ; - } - - std::string getUuidStr(const std::string& format) - { - size_t pos ; - std::string retStr(format) ; - std::string uuid(getUuidStr()) ; - std::string id("%uuid%"); - pos=retStr.find(id) ; - while(pos!=std::string::npos) - { - retStr.replace(pos,id.size(),uuid) ; - pos=retStr.find(id) ; - } - return retStr; - } -} - diff --git a/xios_2311_src/trunk/.svn/pristine/34/340a3bf5ccac44089ba89acb2b8de7eee02c9309.svn-base b/xios_2311_src/trunk/.svn/pristine/34/340a3bf5ccac44089ba89acb2b8de7eee02c9309.svn-base deleted file mode 100644 index 2ade98e5b54b7c897a2fb35f6d5ab3b5e7c3a881..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/34/340a3bf5ccac44089ba89acb2b8de7eee02c9309.svn-base +++ /dev/null @@ -1,49 +0,0 @@ -/* ************************************************************************** * - * Copyright © IPSL/LSCE, xios, Avril 2010 - Octobre 2011 * - * ************************************************************************** */ - -#include - -#include "xios.hpp" - -#include "object_template.hpp" -#include "group_template.hpp" -#include "attribute_template.hpp" - -#include "icutil.hpp" -#include "timer.hpp" -#include "compute_connectivity_domain.hpp" - -extern "C" -{ -// /////////////////////////////// Définitions ////////////////////////////// // - - // ----------------------- Redéfinition de types ---------------------------- - - typedef xios::CComputeConnectivityDomain * XComConDomainPtr; - - // ------------------------ Création des handle ----------------------------- - void cxios_compute_connectivity_domain_handle_create(XComConDomainPtr * _ret, const char * _id, int _id_len) - TRY - { - std::string id; - if (!cstr2string(_id, _id_len, id)) return; - CTimer::get("XIOS").resume() ; - *_ret = xios::CComputeConnectivityDomain::get(id); - CTimer::get("XIOS").suspend() ; - } - CATCH_DUMP_STACK - - // -------------------- Vérification des identifiants ----------------------- - void cxios_compute_connectivity_domain_valid_id(bool * _ret, const char * _id, int _id_len) - TRY - { - std::string id; - if (!cstr2string(_id, _id_len, id)) return; - - CTimer::get("XIOS").resume() ; - *_ret = xios::CComputeConnectivityDomain::has(id); - CTimer::get("XIOS").suspend() ; - } - CATCH_DUMP_STACK -} // extern "C" diff --git a/xios_2311_src/trunk/.svn/pristine/34/344ca666274e1f77bf9896598fad3fba7787e7a8.svn-base b/xios_2311_src/trunk/.svn/pristine/34/344ca666274e1f77bf9896598fad3fba7787e7a8.svn-base deleted file mode 100644 index 0fdc48fbe0050cc2ed367a7c28b30bd63fce81d3..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/34/344ca666274e1f77bf9896598fad3fba7787e7a8.svn-base +++ /dev/null @@ -1,79 +0,0 @@ -#include "reduce_domain_to_axis.hpp" -#include "axis_algorithm_reduce_domain.hpp" -#include "type.hpp" -#include "axis.hpp" -#include "domain.hpp" - -namespace xios { - - /// ////////////////////// Définitions ////////////////////// /// - - CReduceDomainToAxis::CReduceDomainToAxis(void) - : CObjectTemplate(), CReduceDomainToAxisAttributes(), CTransformation() - { /* Ne rien faire de plus */ } - - CReduceDomainToAxis::CReduceDomainToAxis(const StdString & id) - : CObjectTemplate(id), CReduceDomainToAxisAttributes(), CTransformation() - { /* Ne rien faire de plus */ } - - CReduceDomainToAxis::~CReduceDomainToAxis(void) - {} - - CTransformation* CReduceDomainToAxis::create(const StdString& id, xml::CXMLNode* node) - { - CReduceDomainToAxis* reduceDomain = CReduceDomainToAxisGroup::get("reduce_domain_to_axis_definition")->createChild(id); - if (node) reduceDomain->parse(*node); - return static_cast*>(reduceDomain); - } - - bool CReduceDomainToAxis::registerTrans() - { - return registerTransformation(TRANS_REDUCE_DOMAIN_TO_AXIS, {create, getTransformation}); - } - - bool CReduceDomainToAxis::_dummyRegistered = CReduceDomainToAxis::registerTrans(); - - //---------------------------------------------------------------- - - StdString CReduceDomainToAxis::GetName(void) { return StdString("reduce_domain_to_axis"); } - StdString CReduceDomainToAxis::GetDefName(void) { return StdString("reduce_domain_to_axis"); } - ENodeType CReduceDomainToAxis::GetType(void) { return eReduceDomainToAxis; } - - void CReduceDomainToAxis::checkValid(CAxis* axisDst, CDomain* domainSrc) - { - if (CDomain::type_attr::unstructured == domainSrc->type) - ERROR("CReduceDomainToAxis::checkValid(CAxis* axisDst, CDomain* domainSrc)", - << "Domain reduction is only supported for rectilinear or curvillinear grid." - << "Domain source " <getId() << std::endl - << "Axis destination " << axisDst->getId()); - - if (this->operation.isEmpty()) - ERROR("CReduceDomainToAxis::checkValid(CAxis* axisDst, CDomain* domainSrc)", - << "An operation must be defined." - << "Domain source " <getId() << std::endl - << "Axis destination " << axisDst->getId()); - - if (this->direction.isEmpty()) - ERROR("CReduceDomainToAxis::checkValid(CAxis* axisDst, CDomain* domainSrc)", - << "A direction to apply the operation must be defined. It should be: 'iDir' or 'jDir'" - << "Domain source " <getId() << std::endl - << "Axis destination " << axisDst->getId()); - if (this->local.isEmpty()) local=false ; - - } - - shared_ptr CReduceDomainToAxis::createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) - { - return CAxisAlgorithmReduceDomain::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, - elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, - elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition) ; - } -} diff --git a/xios_2311_src/trunk/.svn/pristine/34/34695ea1d8a308a31f6d5c179ad06c4a83aa816d.svn-base b/xios_2311_src/trunk/.svn/pristine/34/34695ea1d8a308a31f6d5c179ad06c4a83aa816d.svn-base deleted file mode 100644 index f0541daacac42a7c7d483ec42790d49d8f22d299..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/34/34695ea1d8a308a31f6d5c179ad06c4a83aa816d.svn-base +++ /dev/null @@ -1,86 +0,0 @@ -/********************************************************************* - * Copyright 1993, UCAR/Unidata - * See netcdf/COPYRIGHT file for copying and redistribution conditions. - * $Header: /upc/share/CVS/netcdf-3/libncdap3/daputil.h,v 1.25 2010/05/05 22:15:16 dmh Exp $ - *********************************************************************/ -#ifndef DAPUTIL_H -#define DAPUTIL_H 1 - -/* Define a set of flags to control path construction */ -#define PATHNC 1 /*Use ->ncname*/ -#define PATHELIDE 2 /*Leave out elided nodes*/ - -/* mnemonic */ -#define WITHDATASET 1 -#define WITHOUTDATASET 0 - -/* sigh!, Forwards */ -struct CDFnode; -struct NCTMODEL; -struct NCDAPCOMMON; - -extern nc_type nctypeconvert(struct NCDAPCOMMON*, nc_type); -extern nc_type octypetonc(OCtype); -extern OCtype nctypetodap(nc_type); -extern size_t nctypesizeof(nc_type); -extern char* nctypetostring(nc_type); -extern char* maketmppath(char* path, char* prefix); - -extern void collectnodepath3(struct CDFnode*, NClist* path, int dataset); -extern void collectocpath(OCconnection conn, OCobject node, NClist* path); - -extern char* makecdfpathstring3(struct CDFnode*,const char*); -extern void clonenodenamepath3(struct CDFnode*, NClist*, int); -extern char* makepathstring3(NClist* path, const char* separator, int flags); - -extern char* makeocpathstring3(OCconnection, OCobject, const char*); - -extern char* cdflegalname3(char* dapname); - -/* Given a param string; return its value or null if not found*/ -extern const char* paramvalue34(struct NCDAPCOMMON* drno, const char* param); -/* Given a param string; check for a given substring */ -extern int paramcheck34(struct NCDAPCOMMON* drno, const char* param, const char* substring); - -extern int nclistconcat(NClist* l1, NClist* l2); -extern int nclistminus(NClist* l1, NClist* l2); -extern int nclistdeleteall(NClist* l1, ncelem); - -extern char* getvaraprint(void* gv); - -extern int dapinsequence(struct CDFnode* node); -extern int daptopgrid(struct CDFnode* node); -extern int daptopseq(struct CDFnode* node); -extern int daptoplevel(struct CDFnode* node); -extern int dapgridmap(struct CDFnode* node); -extern int dapgridarray(struct CDFnode* node); -extern int dapgridelement(struct CDFnode* node); - -extern unsigned int modeldecode(int, const char*, const struct NCTMODEL*, unsigned int); -extern unsigned long getlimitnumber(const char* limit); - -extern void dapexpandescapes(char *termstring); - -/* Only used by libncdap4 */ -extern int alignbuffer3(NCbytes*, int alignment); -extern size_t dimproduct3(NClist* dimensions); - -#if defined(DLL_NETCDF) -# if defined(DLL_EXPORT) -# define NCC_EXTRA __declspec(dllexport) -#else -# define NCC_EXTRA __declspec(dllimport) -# endif -NCC_EXTRA extern int nc__testurl(const char* path, char** basename); -#else -extern int nc__testurl(const char* parth, char** basename); -#endif - - -/* Provide a wrapper for oc_fetch so we can log what it does */ -extern OCerror dap_fetch(struct NCDAPCOMMON*,OCconnection,const char*,OCdxd,OCobject*); - -extern int dap_badname(char* name); -extern char* dap_repairname(char* name); - -#endif /*DAPUTIL_H*/ diff --git a/xios_2311_src/trunk/.svn/pristine/34/34e3d0f08bb6d5e0ff37c2ea4e7319d1b343a480.svn-base b/xios_2311_src/trunk/.svn/pristine/34/34e3d0f08bb6d5e0ff37c2ea4e7319d1b343a480.svn-base deleted file mode 100644 index 8aa8c31d54d9d5ac24ba7f34d45bb3bd8b701975..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/34/34e3d0f08bb6d5e0ff37c2ea4e7319d1b343a480.svn-base +++ /dev/null @@ -1,225 +0,0 @@ -#ifndef __XIOS_CFile__ -#define __XIOS_CFile__ - -/// XIOS headers /// -#include "xios_spl.hpp" -#include "field.hpp" -#include "data_output.hpp" -#include "data_input.hpp" -#include "declare_group.hpp" -#include "date.hpp" -#include "attribute_enum.hpp" -#include "attribute_enum_impl.hpp" -#include "context_client.hpp" -#include "mpi.hpp" - -namespace xios { - - /// ////////////////////// Déclarations ////////////////////// /// - - class CFileGroup; - class CFileAttributes; - class CFile; - - class CGarbageCollector; - - ///-------------------------------------------------------------- - - // Declare/Define CFileAttribute - BEGIN_DECLARE_ATTRIBUTE_MAP(CFile) -# include "file_attribute.conf" - END_DECLARE_ATTRIBUTE_MAP(CFile) - - ///-------------------------------------------------------------- - - /*! - \class CFile - This class corresponds to file component of the xml. - The class contains all the nessceary information to write data into a netcdf file: The most important thing - is the field(s) which will be written into file. Besides, there are some options to write - data into file, e.g: writting into only one file or multiple file; splitting a running into several files. - Moreover, there are some other attributes of netcdf file which are also stored in this class - */ - class CFile - : public CObjectTemplate - , public CFileAttributes - { - /// typedef /// - typedef CObjectTemplate SuperClass; - typedef CFileAttributes SuperClassAttribute; - - public : - enum EEventId - { - EVENT_ID_ADD_FIELD, EVENT_ID_ADD_FIELD_GROUP, EVENT_ID_ADD_VARIABLE, - EVENT_ID_ADD_VARIABLE_GROUP, EVENT_ID_CREATE_ENABLED_FIELDS - }; - - typedef CFileAttributes RelAttributes; - typedef CFileGroup RelGroup; - - /// Constructeurs /// - CFile(void); - explicit CFile(const StdString& id); - CFile(const CFile& file); // Not implemented yet. - CFile(const CFile* const file); // Not implemented yet. - - /// Destructeur /// - virtual ~CFile(void); - - public: - /// Accesseurs /// - const StdString getFileOutputName(void) const; - std::shared_ptr getDataOutput(void) const; - std::shared_ptr getDataInput(void) const; - CFieldGroup* getVirtualFieldGroup(void) const; - CVariableGroup* getVirtualVariableGroup(void) const; - std::vector getAllFields(void) const; - std::vector getAllVariables(void) const; - - std::vector getEnabledFields(int default_outputlevel = 5, - int default_level = 1, - bool default_enabled = true); - - StdString dumpClassAttributes(void); - - public : - // Some functions to verify state of file - bool isSyncTime(void); - bool checkSplit(void); - bool checkSync(void); - void checkWriteFile(void); - void checkReadFile(void); - void initWrite(void); - void initRead(void); - bool isEmptyZone(); - - /// Mutateurs /// - // Set some root definitions in a file - void setVirtualFieldGroup(CFieldGroup* newVFieldGroup); - void setVirtualVariableGroup(CVariableGroup* newVVariableGroup); - - void createHeader(void); - void openInReadMode(void); - void close(void); - void readAttributesOfEnabledFieldsInReadMode(); - void readFieldAttributesMetaData(CField* field) ; - void readFieldAttributesValues(CField* field) ; - // Some processing on file - void solveFieldRefInheritance(bool apply); - void processEnabledFile(void); - - void postProcessFilterGraph(); - void prefetchEnabledReadModeFields(); - void doPreTimestepOperationsForEnabledReadModeFields(); - void doPostTimestepOperationsForEnabledReadModeFields(); - - void checkGridOfEnabledFields(); - void sendGridOfEnabledFields(); - void sendGridComponentOfEnabledFields(); - - void sortEnabledFieldsForUgrid(); - - // Add component into file - CField* addField(const string& id = ""); - CFieldGroup* addFieldGroup(const string& id = ""); - CVariable* addVariable(const string& id = ""); - CVariableGroup* addVariableGroup(const string& id = ""); - void setContextClient(CContextClient* newContextClient); - CContextClient* getContextClient(); - - void setReadContextClient(CContextClient* newContextClient); - CContextClient* getReadContextClient(); - - // Send info to server - void sendEnabledFields(CContextClient* client); - void sendAddField(const string& id, CContextClient* client); - void sendAddFieldGroup(const string& id, CContextClient* client); - void sendAddVariable(const string& id, CContextClient* client); - void sendAddVariableGroup(const string& id, CContextClient* client); - void sendAddAllVariables(CContextClient* client); - public: - void sendFileToFileServer(CContextClient* client) ; - private: - std::set sendFileToFileServer_done_ ; - - public: - // Receive info from client - static void recvAddField(CEventServer& event); - void recvAddField(CBufferIn& buffer); - static void recvAddFieldGroup(CEventServer& event); - void recvAddFieldGroup(CBufferIn& buffer); - static void recvAddVariable(CEventServer& event); - void recvAddVariable(CBufferIn& buffer); - static void recvAddVariableGroup(CEventServer& event); - void recvAddVariableGroup(CBufferIn& buffer); - - // Dispatch event - static bool dispatchEvent(CEventServer& event); - - public: - /// Accesseurs statiques /// - static StdString GetName(void); - static StdString GetDefName(void); - - static ENodeType GetType(void); - public: - /// Traitements /// - virtual void solveDescInheritance(bool apply, const CAttributeMap* const parent = 0); - - /// Autres /// - virtual void parse(xml::CXMLNode& node); - virtual StdString toString(void) const; - public: - - CDate lastSync; - CDate lastSplit; - - const CDate& getLastSplit(void) { return lastSplit ; } - - int nbAxis, nbDomains; - bool isOpen; - MPI_Comm fileComm; - - private: - void createSubComFile(); - bool checkRead; - bool allZoneEmpty; - - private : - /// Propriétés privées /// - CContextClient* client; - CContextClient* read_client; // Context client for reading (channel between server 1 and client) - CFieldGroup* vFieldGroup; - CVariableGroup* vVariableGroup; - std::shared_ptr data_out; - std::shared_ptr data_in; - std::vector enabledFields; - - private: - bool isClientSide_ ; // the file is on client side or on server side ? - public: - bool isClientSide(void) { return isClientSide_ ;} - bool isServerSide(void) { return !isClientSide_ ;} - void setClientSide(void) { isClientSide_=true ;} - void setServerSide(void) { isClientSide_=false ;} - - private: - - - public: - // virtual void toBinary (StdOStream& os) const; - // virtual void fromBinary(StdIStream& is); - - }; // class CFile - - ///-------------------------------------------------------------- - - // Declare/Define CFileGroup and CFileDefinition - DECLARE_GROUP(CFile); - - ///-------------------------------------------------------------- - -} // namespace xios - -#endif // __XIOS_CFile__ diff --git a/xios_2311_src/trunk/.svn/pristine/35/355718a0adb3d502f99637a562a7009fa32ac9b4.svn-base b/xios_2311_src/trunk/.svn/pristine/35/355718a0adb3d502f99637a562a7009fa32ac9b4.svn-base deleted file mode 100644 index 6a9631591842659057e90b44576d0be98df82b8d..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/35/355718a0adb3d502f99637a562a7009fa32ac9b4.svn-base +++ /dev/null @@ -1,27 +0,0 @@ -#include "elt.hpp" - -namespace sphereRemap { - - -Coord barycentre(const Coord *x, int n); - -void orient(int n, Coord *vertex, Coord *edge, double *d, const Coord &g); - -void normals(Coord *x, int n, Coord *a); - -double alun(double b, double d); - -double airbar(int N, const Coord *x, const Coord *c, double *d, const Coord &pole, Coord &gg); - -double polygonarea(Coord *x, int n); -Coord exact_barycentre(const Coord *x, int n) ; - -int packedPolygonSize(const Elt& e); -void packPolygon(const Elt& e, char *buffer, int& pos); -void unpackPolygon(Elt& e, const char *buffer, int& pos); -void packIntersection(const Elt& e, char *buffer, int& pos); -void unpackIntersection(Elt *e, const char *buffer); -int packIntersectionSize(const Elt& e); -double triarea( const Coord& A, const Coord& B, const Coord& C) ; - -} diff --git a/xios_2311_src/trunk/.svn/pristine/35/35597f19461ade3cc91f51b41d9124eadfb94314.svn-base b/xios_2311_src/trunk/.svn/pristine/35/35597f19461ade3cc91f51b41d9124eadfb94314.svn-base deleted file mode 100644 index a94192b789d1197a21843cfcfb797fbb3a383d99..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/35/35597f19461ade3cc91f51b41d9124eadfb94314.svn-base +++ /dev/null @@ -1,76 +0,0 @@ -! * ************************************************************************** * -! * Interface auto generated - do not modify * -! * ************************************************************************** * -#include "../fortran/xios_fortran_prefix.hpp" - -MODULE variable_interface_attr - USE, INTRINSIC :: ISO_C_BINDING - - INTERFACE - ! Do not call directly / interface FORTRAN 2003 <-> C99 - - SUBROUTINE cxios_set_variable_name(variable_hdl, name, name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: variable_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: name - INTEGER (kind = C_INT) , VALUE :: name_size - END SUBROUTINE cxios_set_variable_name - - SUBROUTINE cxios_get_variable_name(variable_hdl, name, name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: variable_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: name - INTEGER (kind = C_INT) , VALUE :: name_size - END SUBROUTINE cxios_get_variable_name - - FUNCTION cxios_is_defined_variable_name(variable_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_variable_name - INTEGER (kind = C_INTPTR_T), VALUE :: variable_hdl - END FUNCTION cxios_is_defined_variable_name - - - SUBROUTINE cxios_set_variable_ts_target(variable_hdl, ts_target, ts_target_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: variable_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: ts_target - INTEGER (kind = C_INT) , VALUE :: ts_target_size - END SUBROUTINE cxios_set_variable_ts_target - - SUBROUTINE cxios_get_variable_ts_target(variable_hdl, ts_target, ts_target_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: variable_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: ts_target - INTEGER (kind = C_INT) , VALUE :: ts_target_size - END SUBROUTINE cxios_get_variable_ts_target - - FUNCTION cxios_is_defined_variable_ts_target(variable_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_variable_ts_target - INTEGER (kind = C_INTPTR_T), VALUE :: variable_hdl - END FUNCTION cxios_is_defined_variable_ts_target - - - SUBROUTINE cxios_set_variable_type(variable_hdl, type, type_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: variable_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: type - INTEGER (kind = C_INT) , VALUE :: type_size - END SUBROUTINE cxios_set_variable_type - - SUBROUTINE cxios_get_variable_type(variable_hdl, type, type_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: variable_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: type - INTEGER (kind = C_INT) , VALUE :: type_size - END SUBROUTINE cxios_get_variable_type - - FUNCTION cxios_is_defined_variable_type(variable_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_variable_type - INTEGER (kind = C_INTPTR_T), VALUE :: variable_hdl - END FUNCTION cxios_is_defined_variable_type - - END INTERFACE - -END MODULE variable_interface_attr diff --git a/xios_2311_src/trunk/.svn/pristine/35/357b299b22f5beb72c06e27a3f135fdfd2260888.svn-base b/xios_2311_src/trunk/.svn/pristine/35/357b299b22f5beb72c06e27a3f135fdfd2260888.svn-base deleted file mode 100644 index 30a5e0d95dc88deab736d64e5ef99cb1aa64ba57..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/35/357b299b22f5beb72c06e27a3f135fdfd2260888.svn-base +++ /dev/null @@ -1,139 +0,0 @@ -#include "client_to_model_store_filter.hpp" -#include "context.hpp" -#include "grid.hpp" -#include "timer.hpp" -#include "tracer.hpp" -#include "workflow_graph.hpp" - -namespace xios -{ - CClientToModelStoreFilter::CClientToModelStoreFilter(CGarbageCollector& gc, CField* field) - : CInputPin(gc, 1) - , gc_(gc), graphEnabled(false) - { - context_ = CContext::getCurrent() ; - grid_ = field->getGrid() ; - - detectMissingValues_ = (!field->detect_missing_value.isEmpty() && !field->default_value.isEmpty() && field->detect_missing_value == true); - hasMissingValue_ = !field->default_value.isEmpty() ; - if (hasMissingValue_) missingValue_ = field->default_value ; - detectMissingValues_ = (!field->detect_missing_value.isEmpty() && hasMissingValue_); - } - - CConstDataPacketPtr CClientToModelStoreFilter::getPacket(Time timestamp) - { - CTimer timer("CStoreFilter::getPacket"); -// timer.resume(); - info(0)<<"ENTERING CStoreFilter::getPacket"<::const_iterator it = packets_.find(timestamp); - if (it != packets_.end()) packet = it->second; - else context_->eventLoop(); // if the packet is not available yet, check if it can be received - - timer.suspend(); - } while (!packet && timer.getCumulatedTime() < timeout); -// timer.resume(); - traceOn() ; -// timer.suspend(); - - if (!packet) - { - std::map::const_iterator it ; - info(0)<<"Impossible to get the packet with timestamp = " << timestamp<first<<" "; - info(0)<timestamp, packet)); - // The packet is always destroyed by the garbage collector - // so we register but never unregister - gc_.registerObject(this, packet->timestamp); - - } - - bool CClientToModelStoreFilter::mustAutoTrigger() const - { - return false; - } - - bool CClientToModelStoreFilter::isDataExpected(const CDate& date) const - { - return true; - } - - void CClientToModelStoreFilter::invalidate(Time timestamp) - { - CInputPin::invalidate(timestamp); - packets_.erase(packets_.begin(), packets_.lower_bound(timestamp)); - } -} // namespace xios diff --git a/xios_2311_src/trunk/.svn/pristine/35/35af6523b65ac0ab3a20bea54626bc23adb3e173.svn-base b/xios_2311_src/trunk/.svn/pristine/35/35af6523b65ac0ab3a20bea54626bc23adb3e173.svn-base deleted file mode 100644 index 9ae3c9fdf638dccb6b2ad8b71717ce95037e2abd..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/35/35af6523b65ac0ab3a20bea54626bc23adb3e173.svn-base +++ /dev/null @@ -1,22 +0,0 @@ -DECLARE_ATTRIBUTE(StdString, name) -DECLARE_ATTRIBUTE(StdString, standard_name) -DECLARE_ATTRIBUTE(StdString, long_name) - -DECLARE_ATTRIBUTE(StdString, comment) - -DECLARE_ATTRIBUTE(StdString, unit) - -/* LOCAL and GLOBAL*/ -DECLARE_ATTRIBUTE(bool, mask, false) -DECLARE_ATTRIBUTE(double, value, false) -DECLARE_ATTRIBUTE(int, n, false) -DECLARE_ATTRIBUTE(StdString, bounds_name) -DECLARE_ARRAY(double, 1 , bounds) - - -DECLARE_ATTRIBUTE(StdString, scalar_ref, false) -DECLARE_ATTRIBUTE(int, prec) - -DECLARE_ENUM4(axis_type, X, Y, Z, T) -DECLARE_ENUM2(positive, up, down) -DECLARE_ATTRIBUTE(StdString, label) diff --git a/xios_2311_src/trunk/.svn/pristine/35/35e8fe9f96f450693bea2f235851a0ecc772dc9b.svn-base b/xios_2311_src/trunk/.svn/pristine/35/35e8fe9f96f450693bea2f235851a0ecc772dc9b.svn-base deleted file mode 100644 index 87996fcb718fc32280bc10cfd844e64d51b43b05..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/35/35e8fe9f96f450693bea2f235851a0ecc772dc9b.svn-base +++ /dev/null @@ -1,268 +0,0 @@ -#include "services.hpp" -#include "services_manager.hpp" -#include "mpi.hpp" -#include "cxios.hpp" -#include "server_context.hpp" -#include "event_scheduler.hpp" -#include "timer.hpp" - -namespace xios -{ - CService::CService(MPI_Comm serviceComm, const std::string& poolId, const std::string& serviceId, const int& partitionId, - int type, int nbPartitions) : finalizeSignal_(false), eventScheduler_(nullptr), poolId_(poolId), serviceId_(serviceId), - partitionId_(partitionId), type_(type), nbPartitions_(nbPartitions), hasNotification_(false) - - - { - info(40)<<"CService::CService : new service created ; serviceId : "<lockWindow(localRank,0) ; - winNotify_->updateToWindow(localRank, this, &CService::createContextDumpOut) ; - winNotify_->unlockWindow(localRank,0) ; - MPI_Barrier(serviceComm_) ; - if (localRank==localLeader_) - { - globalLeader_=globalRank ; - MPI_Comm_rank(serviceComm_,&commSize) ; - CXios::getServicesManager()->registerService(poolId, serviceId, partitionId, type, commSize, nbPartitions, globalLeader_) ; - } - eventScheduler_ = new CEventScheduler(serviceComm_) ; - - ostringstream oss; - oss<lockWindow(rank,0) ; - winNotify_->updateFromWindow(rank, this, &CService::createContextDumpIn) ; - notifications_.push_back(std::make_tuple(poolId, serviceId, partitionId, contextId)) ; - winNotify_->updateToWindow(rank, this, &CService::createContextDumpOut) ; - winNotify_->unlockWindow(rank,0) ; - } - - - void CService::createContextDumpOut(CBufferOut& buffer) - { - buffer.realloc(maxBufferSize_) ; - - buffer << (int) (notifications_.size()); - - for(auto it=notifications_.begin();it!=notifications_.end(); ++it) - buffer << std::get<0>(*it) << std::get<1>(*it) << std::get<2>(*it) << std::get<3>(*it) ; - } - - - void CService::createContextDumpIn(CBufferIn& buffer) - { - std::string poolId ; - std::string serviceId ; - int partitionId ; - std::string contextId ; - - notifications_.clear() ; - int nbNotifications ; - buffer>>nbNotifications ; - for(int i=0;i>poolId>>serviceId>>partitionId>>contextId ; - notifications_.push_back(std::make_tuple(poolId, serviceId, partitionId, contextId)) ; - } - } - - bool CService::eventLoop(bool serviceOnly) - { - //checkCreateContextNotification() ; - CTimer::get("CService::eventLoop").resume(); - int flag ; - MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &flag, MPI_STATUS_IGNORE); - -// double time=MPI_Wtime() ; -// if (time-lastEventLoop_ > eventLoopLatency_) -// { - checkNotifications() ; -// lastEventLoop_=time ; -// } - - - eventScheduler_->checkEvent() ; - for(auto it=contexts_.begin();it!=contexts_.end();++it) - { - if (it->second->eventLoop(serviceOnly)) - { - delete it->second ; - contexts_.erase(it) ; - // destroy server_context -> to do later - break ; - } ; - } - CTimer::get("CService::eventLoop").suspend(); - if (contexts_.empty() && finalizeSignal_) return true ; - else return false ; - } - - void CService::sendNotification(int rank) - { - winNotify_->lockWindowExclusive(rank) ; - winNotify_->pushToLockedWindow(rank, this, &CService::notificationsDumpOut) ; - winNotify_->unlockWindow(rank) ; - } - - - void CService::notificationsDumpOut(CBufferOut& buffer) - { - - buffer.realloc(maxBufferSize_) ; - - if (notifyOutType_==NOTIFY_CREATE_CONTEXT) - { - auto& arg=notifyOutCreateContext_ ; - buffer << notifyOutType_ << std::get<0>(arg)<(arg) << std::get<2>(arg)<(arg) ; - } - } - - void CService::notificationsDumpIn(CBufferIn& buffer) - { - if (buffer.bufferSize() == 0) notifyInType_= NOTIFY_NOTHING ; - else - { - buffer>>notifyInType_; - if (notifyInType_==NOTIFY_CREATE_CONTEXT) - { - auto& arg=notifyInCreateContext_ ; - buffer >> std::get<0>(arg)>> std::get<1>(arg) >> std::get<2>(arg)>> std::get<3>(arg); - } - } - } - - - - - void CService::checkNotifications(void) - { - if (!hasNotification_) - { - double time=MPI_Wtime() ; - if (time-lastEventLoop_ > eventLoopLatency_) - { - int commRank ; - MPI_Comm_rank(serviceComm_, &commRank) ; - winNotify_->lockWindowExclusive(commRank) ; - winNotify_->popFromLockedWindow(commRank, this, &CService::notificationsDumpIn) ; - winNotify_->unlockWindow(commRank) ; - - if (notifyInType_!= NOTIFY_NOTHING) - { - hasNotification_=true ; - std::hash hashString ; - size_t hashId = hashString(name_) ; - size_t currentTimeLine=0 ; - info(40)<<"CService::checkNotifications(void) : receive notification => event scheduler"<registerEvent(currentTimeLine,hashId); - } - lastEventLoop_=time ; - } - } - - if (hasNotification_) - { - std::hash hashString ; - size_t hashId = hashString(name_) ; - size_t currentTimeLine=0 ; - info(40)<<"CService::checkNotifications(void) : receive notification => event scheduler : eventIsReceived ?"<queryEvent(currentTimeLine,hashId)) - { - eventScheduler_->popEvent() ; - info(40)<<"CService::checkNotifications(void) : receive notification => event scheduler : RECEIVED"<lockWindow(commRank,0) ; - winNotify_->updateFromWindow(commRank, this, &CService::createContextDumpIn) ; - - if (!notifications_.empty()) - { - auto info = notifications_.front() ; - createNewContext(get<0>(info), get<1>(info), get<2>(info), get<3>(info)) ; - notifications_.pop_front() ; - winNotify_->updateToWindow(commRank, this, &CService::createContextDumpOut) ; - } - winNotify_->unlockWindow(commRank,0) ; - } - - void CService::createContext(void) - { - info(40)<<"CService::createContext(void) : receive createContext notification"<(arg) ; - string serviceId = get<1>(arg) ; - int partitionId = get<2>(arg) ; - string contextId = get<3>(arg) ; - contexts_[contextId] = new CServerContext(this, serviceComm_, poolId, serviceId, partitionId, contextId) ; - } - - //to remove, not used anymore - void CService::createNewContext(const std::string& poolId, const std::string& serviceId, const int& partitionId, const std::string& contextId) - { - contexts_[contextId] = new CServerContext(this, serviceComm_, poolId, serviceId, partitionId, contextId) ; - } - - void CService::finalizeSignal(void) - { - finalizeSignal_=true ; - for(auto it=contexts_.begin();it!=contexts_.end();++it) it->second->finalizeSignal() ; - } - - CEventScheduler* CService::getEventScheduler(void) - { - return eventScheduler_ ; - } -} diff --git a/xios_2311_src/trunk/.svn/pristine/36/361eacde4bf8660004e11aa31682a37429582f93.svn-base b/xios_2311_src/trunk/.svn/pristine/36/361eacde4bf8660004e11aa31682a37429582f93.svn-base deleted file mode 100644 index 67db821eae153143367aa7f08391129e279292d9..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/36/361eacde4bf8660004e11aa31682a37429582f93.svn-base +++ /dev/null @@ -1,25 +0,0 @@ -#include "grid_elements.hpp" -#include "grid_local_view.hpp" -#include "grid_local_connector.hpp" - -namespace xios -{ - - shared_ptr CGridLocalElements::getView(CElementView::type type) - { - if (views_[type]==nullptr) views_[type] = make_shared(shared_from_this(), type) ; - return views_[type] ; - } - - shared_ptr CGridLocalElements::getConnector(CElementView::type srcType, CElementView::type dstType, bool withMask) - { - auto newPair = pair(srcType,dstType); - auto it = connectors_.find(newPair) ; - if (it==connectors_.end()) - { - auto insertPair=pair, shared_ptr>(newPair, make_shared(shared_from_this(), srcType, dstType, withMask)) ; - it=connectors_.insert(insertPair).first ; - } - return it->second ; - } -} \ No newline at end of file diff --git a/xios_2311_src/trunk/.svn/pristine/36/366ffb221d84a9820b73e256809b21cd183a8c4d.svn-base b/xios_2311_src/trunk/.svn/pristine/36/366ffb221d84a9820b73e256809b21cd183a8c4d.svn-base deleted file mode 100644 index 3e205aa2e7324517c3ca166713bf45ac6e9071ae..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/36/366ffb221d84a9820b73e256809b21cd183a8c4d.svn-base +++ /dev/null @@ -1,94 +0,0 @@ -#include "extract_axis.hpp" -#include "axis_algorithm_extract.hpp" -#include "type.hpp" - -namespace xios { - - /// ////////////////////// Définitions ////////////////////// /// - - CExtractAxis::CExtractAxis(void) - : CObjectTemplate(), CExtractAxisAttributes(), CTransformation() - { /* Ne rien faire de plus */ } - - CExtractAxis::CExtractAxis(const StdString & id) - : CObjectTemplate(id), CExtractAxisAttributes(), CTransformation() - { /* Ne rien faire de plus */ } - - CExtractAxis::~CExtractAxis(void) - {} - - CTransformation* CExtractAxis::create(const StdString& id, xml::CXMLNode* node) - { - CExtractAxis* extractAxis = CExtractAxisGroup::get("extract_axis_definition")->createChild(id); - if (node) extractAxis->parse(*node); - return static_cast*>(extractAxis); - } - - bool CExtractAxis::registerTrans() - { - return registerTransformation(TRANS_EXTRACT_AXIS, {create, getTransformation}); - } - - bool CExtractAxis::_dummyRegistered = CExtractAxis::registerTrans(); - - //---------------------------------------------------------------- - - StdString CExtractAxis::GetName(void) { return StdString("extract_axis"); } - StdString CExtractAxis::GetDefName(void) { return StdString("extract_axis"); } - ENodeType CExtractAxis::GetType(void) { return eExtractAxis; } - - void CExtractAxis::checkValid(CAxis* axisDest) - { - int axisIBegin, axisNi, axisGlobalSize; - int begin, end, n; - - axisIBegin = axisDest->begin.getValue(); - axisNi = axisDest->n.getValue(); - axisGlobalSize = axisDest->n_glo.getValue(); - - bool extractByIndex = !this->index.isEmpty() && (0 != this->index.numElements()); - - if (extractByIndex) - { - begin = min(this->index); - end = max(this->index); - n = end - begin + 1; - } - else - { - begin = (this->begin.isEmpty()) ? 0 : this->begin.getValue(); - n = (this->n.isEmpty()) ? axisGlobalSize : this->n.getValue(); - end = begin+n-1; - } - - if (begin < 0 || begin > axisGlobalSize - 1 || end < 0 || end > axisGlobalSize - 1 - || n < 1 || n > axisGlobalSize || begin > end) - ERROR("CExtractAxis::checkValid(CAxis* axisDest)", - << "One or more attributes among 'begin' (" << begin << "), 'end' (" << end << "), 'n' (" << n << ") " - << "of axis transformation [ id = '" << axisDest->getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] are not well specified"); - - if (extractByIndex && (!this->begin.isEmpty() || !this->n.isEmpty())) - ERROR("CExtractAxis::checkValid(CAxis* axisDest)", - << "Only one type of extract is accepted. Define extract by index with global_extract_index or define extract with begin and n. " - << "Axis transformation [ id = '" << axisDest->getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] are not well specified"); - - this->begin.setValue(begin); - this->n.setValue(n); - - } - - shared_ptr CExtractAxis::createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) - { - return CAxisAlgorithmExtract::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, - elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, - elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition); - } -} diff --git a/xios_2311_src/trunk/.svn/pristine/36/36967a710fa46532863b7697b4d398bb46fcd7a6.svn-base b/xios_2311_src/trunk/.svn/pristine/36/36967a710fa46532863b7697b4d398bb46fcd7a6.svn-base deleted file mode 100644 index 68704590cfaa6601da09cca44213161dc4086024..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/36/36967a710fa46532863b7697b4d398bb46fcd7a6.svn-base +++ /dev/null @@ -1,30 +0,0 @@ -#include "xios_fortran_prefix.hpp" - -MODULE IINTERPOLATE_DOMAIN - USE, INTRINSIC :: ISO_C_BINDING - USE INTERPOLATE_DOMAIN_INTERFACE - - TYPE txios(interpolate_domain) - INTEGER(kind = C_INTPTR_T) :: daddr - END TYPE txios(interpolate_domain) - - CONTAINS ! Fonctions disponibles pour les utilisateurs. - - SUBROUTINE xios(get_interpolate_domain_handle)(idt,ret) - IMPLICIT NONE - CHARACTER(len = *), INTENT(IN) :: idt - TYPE(txios(interpolate_domain)) , INTENT(OUT):: ret - CALL cxios_interpolate_domain_handle_create(ret%daddr, idt, len(idt)) - END SUBROUTINE xios(get_interpolate_domain_handle) - - LOGICAL FUNCTION xios(is_valid_interpolate_domain)(idt) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: idt - LOGICAL (kind = 1) :: val - - CALL cxios_interpolate_domain_valid_id(val, idt, len(idt)) - xios(is_valid_interpolate_domain) = val - - END FUNCTION xios(is_valid_interpolate_domain) - -END MODULE IINTERPOLATE_DOMAIN diff --git a/xios_2311_src/trunk/.svn/pristine/36/369bd30f995279333b469156564381829215f4e7.svn-base b/xios_2311_src/trunk/.svn/pristine/36/369bd30f995279333b469156564381829215f4e7.svn-base deleted file mode 100644 index 0b34c5853cae8951901b50fbc69085ff43c89137..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/36/369bd30f995279333b469156564381829215f4e7.svn-base +++ /dev/null @@ -1,542 +0,0 @@ -#ifndef __XIOS_TYPE_SPECIALISATION_HPP__ -#define __XIOS_TYPE_SPECIALISATION_HPP__ - -#include "xios_spl.hpp" -#include "exception.hpp" -#include "buffer_in.hpp" -#include "buffer_out.hpp" -#include "type.hpp" -#include -#include -#include "date.hpp" - -namespace xios -{ - -// template specialization for bool - - template <> void CType::_fromString(const string& str) - { - string tmpStr=boost::to_lower_copy(boost::trim_copy(str)) ; - if (tmpStr=="true" || tmpStr==".true." || tmpStr=="yes" || tmpStr=="y") set(true) ; - else if (tmpStr=="false" || tmpStr==".false." || tmpStr=="no" || tmpStr=="n") set(false) ; - else ERROR("template <> CType::fromString(const string& str)",<< tmpStr << " cannot be converted in a boolean value") ; - } - - template <> string CType::_toString(void) const - { - if (get()) return string("true") ; - else return string("false") ; - } - - template <> void CType_ref::_fromString(const string& str) const - { - string tmpStr=boost::to_lower_copy(boost::trim_copy(str)) ; - if (tmpStr=="true" || tmpStr==".true." || tmpStr=="yes" || tmpStr=="y") set(true) ; - else if (tmpStr=="false" || tmpStr==".false." || tmpStr=="no" || tmpStr=="n") set(false) ; - else ERROR("template <> CType::fromString(const string& str)",<< tmpStr << " cannot be converted in a boolean value") ; - } - - template <> void CType_ref::_fromString(const string& str) - { - string tmpStr=boost::to_lower_copy(boost::trim_copy(str)) ; - if (tmpStr=="true" || tmpStr==".true." || tmpStr=="yes" || tmpStr=="y") set(true) ; - else if (tmpStr=="false" || tmpStr==".false." || tmpStr=="no" || tmpStr=="n") set(false) ; - else ERROR("template <> CType::fromString(const string& str)",<< tmpStr << " cannot be converted in a boolean value") ; - } - - template <> string CType_ref::_toString(void) const - { - if (get()) return string("true") ; - else return string("false") ; - } - -// template specialization for string - - template <> - size_t CType::_size() const - { - size_t typeSize=0 ; - typeSize+=sizeof(size_t) ; - typeSize+=ptrValue->size() ; - return typeSize ; - } - - template <> - size_t CType_ref::_size() const - { - size_t typeSize=0 ; - typeSize+=sizeof(size_t) ; - typeSize+=ptrValue->size() ; - return typeSize ; - } - - template <> - void CType::_fromString(const string& str) - { - allocate() ; - *ptrValue=str ; - } - - template <> - void CType_ref::_fromString(const string& str) - { - checkEmpty() ; - *ptrValue=str ; - } - - template <> - void CType_ref::_fromString(const string& str) const - { - checkEmpty() ; - *ptrValue=str ; - } - - template <> - bool CType::_toBuffer(CBufferOut& buffer) const - { - if (buffer.remain()size()) ; - if (ret) ret&=buffer.put(ptrValue->data(),ptrValue->size()) ; - return ret ; - } - } - - template <> - bool CType_ref::_toBuffer(CBufferOut& buffer) const - { - if (buffer.remain()size()) ; - if (ret) ret&=buffer.put(ptrValue->data(),ptrValue->size()) ; - return ret ; - } - } - - - - template <> - bool CType::_fromBuffer(CBufferIn& buffer) - { - allocate() ; - bool ret=true ; - size_t typeSize ; - if (ret) ret&=buffer.get(typeSize) ; - - char* str; - str= (char*) buffer.ptr() ; - if (ret) buffer.advance(typeSize) ; - if (ret) *ptrValue=string(str,typeSize) ; - - return ret ; - } - - template <> - bool CType_ref::_fromBuffer(CBufferIn& buffer) const - { - bool ret=true ; - size_t typeSize ; - if (ret) ret&=buffer.get(typeSize) ; - - char* str; - str= (char*) buffer.ptr() ; - if (ret) buffer.advance(typeSize) ; - if (ret) *ptrValue=string(str,typeSize) ; - - return ret ; - } - - template <> - bool CType_ref::_fromBuffer(CBufferIn& buffer) - { - bool ret=true ; - size_t typeSize ; - if (ret) ret&=buffer.get(typeSize) ; - - char* str; - str= (char*) buffer.ptr() ; - if (ret) buffer.advance(typeSize) ; - if (ret) *ptrValue=string(str,typeSize) ; - - return ret ; - } - -// template specializations for CDate - - template <> - size_t CType::_size() const - { - return 6 * sizeof(int); - } - - template <> - size_t CType_ref::_size() const - { - return 6 * sizeof(int); - } - - template <> - bool CType::_toBuffer(CBufferOut& buffer) const - { - if (buffer.remain() < size()) return false; - else - { - bool ret = true; - if (ret) ret &= buffer.put(ptrValue->getYear()); - if (ret) ret &= buffer.put(ptrValue->getMonth()); - if (ret) ret &= buffer.put(ptrValue->getDay()); - if (ret) ret &= buffer.put(ptrValue->getHour()); - if (ret) ret &= buffer.put(ptrValue->getMinute()); - if (ret) ret &= buffer.put(ptrValue->getSecond()); - return ret; - } - } - - template <> - bool CType_ref::_toBuffer(CBufferOut& buffer) const - { - if (buffer.remain() < size()) return false; - else - { - bool ret = true; - if (ret) ret &= buffer.put(ptrValue->getYear()); - if (ret) ret &= buffer.put(ptrValue->getMonth()); - if (ret) ret &= buffer.put(ptrValue->getDay()); - if (ret) ret &= buffer.put(ptrValue->getHour()); - if (ret) ret &= buffer.put(ptrValue->getMinute()); - if (ret) ret &= buffer.put(ptrValue->getSecond()); - return ret; - } - } - - template <> - bool CType::_fromBuffer(CBufferIn& buffer) - { - allocate(); - bool ret = true; - - int year, month, day, hour, min, sec; - if (ret) ret &= buffer.get(year); - if (ret) ret &= buffer.get(month); - if (ret) ret &= buffer.get(day); - if (ret) ret &= buffer.get(hour); - if (ret) ret &= buffer.get(min); - if (ret) ret &= buffer.get(sec); - if (ret) - { - ptrValue->setYear(year); - ptrValue->setMonth(month); - ptrValue->setDay(day); - ptrValue->setHour(hour); - ptrValue->setMinute(min); - ptrValue->setSecond(sec); - } - - return ret; - } - - template <> - bool CType_ref::_fromBuffer(CBufferIn& buffer) const - { - bool ret = true; - - int year, month, day, hour, min, sec; - if (ret) ret &= buffer.get(year); - if (ret) ret &= buffer.get(month); - if (ret) ret &= buffer.get(day); - if (ret) ret &= buffer.get(hour); - if (ret) ret &= buffer.get(min); - if (ret) ret &= buffer.get(sec); - if (ret) - { - ptrValue->setYear(year); - ptrValue->setMonth(month); - ptrValue->setDay(day); - ptrValue->setHour(hour); - ptrValue->setMinute(min); - ptrValue->setSecond(sec); - } - - return ret; - } - - template <> - bool CType_ref::_fromBuffer(CBufferIn& buffer) - { - bool ret = true; - - int year, month, day, hour, min, sec; - if (ret) ret &= buffer.get(year); - if (ret) ret &= buffer.get(month); - if (ret) ret &= buffer.get(day); - if (ret) ret &= buffer.get(hour); - if (ret) ret &= buffer.get(min); - if (ret) ret &= buffer.get(sec); - if (ret) - { - ptrValue->setYear(year); - ptrValue->setMonth(month); - ptrValue->setDay(day); - ptrValue->setHour(hour); - ptrValue->setMinute(min); - ptrValue->setSecond(sec); - } - - return ret; - } - -// template specializations for CDuration - - template <> - size_t CType::_size() const - { - return 7 * sizeof(double); - } - - template <> - size_t CType_ref::_size() const - { - return 7 * sizeof(double); - } - - template <> - bool CType::_toBuffer(CBufferOut& buffer) const - { - if (buffer.remain() < size()) return false; - else - { - bool ret = true; - if (ret) ret &= buffer.put(ptrValue->year); - if (ret) ret &= buffer.put(ptrValue->month); - if (ret) ret &= buffer.put(ptrValue->day); - if (ret) ret &= buffer.put(ptrValue->hour); - if (ret) ret &= buffer.put(ptrValue->minute); - if (ret) ret &= buffer.put(ptrValue->second); - if (ret) ret &= buffer.put(ptrValue->timestep); - return ret; - } - } - - template <> - bool CType_ref::_toBuffer(CBufferOut& buffer) const - { - if (buffer.remain() < size()) return false; - else - { - bool ret = true; - if (ret) ret &= buffer.put(ptrValue->year); - if (ret) ret &= buffer.put(ptrValue->month); - if (ret) ret &= buffer.put(ptrValue->day); - if (ret) ret &= buffer.put(ptrValue->hour); - if (ret) ret &= buffer.put(ptrValue->minute); - if (ret) ret &= buffer.put(ptrValue->second); - if (ret) ret &= buffer.put(ptrValue->timestep); - return ret; - } - } - - template <> - bool CType::_fromBuffer(CBufferIn& buffer) - { - allocate(); - bool ret = true; - - if (ret) ret &= buffer.get(ptrValue->year); - if (ret) ret &= buffer.get(ptrValue->month); - if (ret) ret &= buffer.get(ptrValue->day); - if (ret) ret &= buffer.get(ptrValue->hour); - if (ret) ret &= buffer.get(ptrValue->minute); - if (ret) ret &= buffer.get(ptrValue->second); - if (ret) ret &= buffer.get(ptrValue->timestep); - - return ret; - } - - template <> - bool CType_ref::_fromBuffer(CBufferIn& buffer) const - { - bool ret = true; - - if (ret) ret &= buffer.get(ptrValue->year); - if (ret) ret &= buffer.get(ptrValue->month); - if (ret) ret &= buffer.get(ptrValue->day); - if (ret) ret &= buffer.get(ptrValue->hour); - if (ret) ret &= buffer.get(ptrValue->minute); - if (ret) ret &= buffer.get(ptrValue->second); - if (ret) ret &= buffer.get(ptrValue->timestep); - - return ret; - } - - template <> - bool CType_ref::_fromBuffer(CBufferIn& buffer) - { - bool ret = true; - - if (ret) ret &= buffer.get(ptrValue->year); - if (ret) ret &= buffer.get(ptrValue->month); - if (ret) ret &= buffer.get(ptrValue->day); - if (ret) ret &= buffer.get(ptrValue->hour); - if (ret) ret &= buffer.get(ptrValue->minute); - if (ret) ret &= buffer.get(ptrValue->second); - if (ret) ret &= buffer.get(ptrValue->timestep); - - return ret; - } - - // template specialisation for CArray -/* - template<> - size_t CType< ARRAY(int, 1)>::size() const - { - return (*(this->ptrValue))->getSize() ; - } - - template <> - bool CType::toBuffer(CBufferOut& buffer) const - { - return (*(this->ptrValue))->toBuffer(buffer) ; - } - - template <> - bool CType::fromBuffer(CBufferIn& buffer) const - { - return (*(this->ptrValue))->fromBuffer(buffer) ; - } - - template <> - void CType::fromString(const string& str) const - { - // to implement - } - - template <> - string CType::toString(void) const - { - // to implement - return string("") ; - - } -*/ - - -/* -template -boost::detail::multi_array::extent_gen getExtentNull(void) { return getExtentNull()[0];} - -template<> -boost::detail::multi_array::extent_gen<1> getExtentNull<1>(void) { return extents[0]; } -*/ -/* -#define CTYPE_ARRAY(ValueType,NumsDims) \ - \ - template <> \ - void CType::allocate(void) \ - { \ - if (empty) ptrValue=new shared_ptr >(new CArray()) ;\ - empty=false ; \ - } \ - \ - template<> \ - size_t CType< ARRAY(ValueType,NumsDims)>::_size() const \ - { \ - return (*(this->ptrValue))->getSize() ; \ - } \ - \ - template<> \ - size_t CType_ref< ARRAY(ValueType,NumsDims)>::_size() const \ - { \ - return (*(this->ptrValue))->getSize() ; \ - } \ - \ - template <> \ - bool CType::_toBuffer(CBufferOut& buffer) const \ - { \ - return (*(this->ptrValue))->toBuffer(buffer) ; \ - } \ - \ - template <> \ - bool CType_ref::_toBuffer(CBufferOut& buffer) const \ - { \ - return (*(this->ptrValue))->toBuffer(buffer) ; \ - } \ - \ - template <> \ - bool CType::_fromBuffer(CBufferIn& buffer) \ - { \ - allocate(); \ - return (*(ptrValue))->fromBuffer(buffer) ; \ - } \ - \ - template <> \ - bool CType_ref::_fromBuffer(CBufferIn& buffer) const \ - { \ - checkEmpty() ; \ - return (*(this->ptrValue))->fromBuffer(buffer) ; \ - } \ - \ - template <> \ - bool CType_ref::_fromBuffer(CBufferIn& buffer) \ - { \ - shared_ptr > tmp(new CArray() ) ; \ - *(this->ptrValue)=tmp ;\ - return (*(this->ptrValue))->fromBuffer(buffer) ; \ - } \ - \ - \ - template <> \ - void CType::_fromString(const string& str) \ - { \ - \ - } \ - \ - template <> \ - void CType_ref::_fromString(const string& str) const \ - { \ - \ - } \ - template <> \ - void CType_ref::_fromString(const string& str) \ - { \ - \ - } \ - \ - template <> \ - string CType::_toString(void) const \ - { \ - \ - return string("") ; \ - } \ - \ - template <> \ - string CType_ref::_toString(void) const \ - { \ - \ - return string("") ; \ - } -//CTYPE_ARRAY(double,1) - -//CTYPE_ARRAY(double,2) - - -CTYPE_ARRAY(int,1) -CTYPE_ARRAY(int,2) -CTYPE_ARRAY(int,3) -CTYPE_ARRAY(bool,1) -CTYPE_ARRAY(bool,2) -CTYPE_ARRAY(bool,3) -CTYPE_ARRAY(double,1) -CTYPE_ARRAY(double,2) -CTYPE_ARRAY(double,3) -CTYPE_ARRAY(float,1) -CTYPE_ARRAY(float,2) -CTYPE_ARRAY(float,3) -*/ -} - -#endif diff --git a/xios_2311_src/trunk/.svn/pristine/36/36c3e98393ba13b0bf57de140ce99f495ca81ccc.svn-base b/xios_2311_src/trunk/.svn/pristine/36/36c3e98393ba13b0bf57de140ce99f495ca81ccc.svn-base deleted file mode 100644 index 46a4d61928799b0af4677b1a72e8522b403ca15c..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/36/36c3e98393ba13b0bf57de140ce99f495ca81ccc.svn-base +++ /dev/null @@ -1,237 +0,0 @@ -var compile_dict={"-1": "❌", "1": "✅"} -function generateCompileTable() -{ - var machine_list=[]; - var machine_revision_list=[]; - var machine_full_name_list=[]; - var machine_info_list=[]; - - if(typeof jeanzay_revision_list != 'undefined') - { - machine_list.push("jeanzay"); - machine_revision_list.push("jeanzay_revision_list") - machine_full_name_list.push("Jean-Zay") - machine_info_list.push("jeanzay_compile_info_list") - } - - if (typeof irene_revision_list != 'undefined') - { - machine_list.push("irene"); - machine_revision_list.push("irene_revision_list") - machine_full_name_list.push("Irene") - machine_info_list.push("irene_compile_info_list") - } - - if (typeof other_revision_list != 'undefined') - { - machine_list.push("other"); - machine_revision_list.push("other_revision_list") - machine_full_name_list.push("Other") - machine_info_list.push("other_compile_info_list") - } - - var revision_list=[] - - for (var i=0; i1) { - sel.removeChild(sel.lastChild); - } - - for(var i=0; i -36c36 -< ---- -> -45c45 -< ---- -> -52,53c52,53 -< div = src_ni_glo/size -< remain = MOD( src_ni_glo, size ) ---- -> div = src_ni_glo/size -> remain = MOD( src_ni_glo, size ) -60c60 -< ENDIF ---- -> ENDIF -91,92c91,92 -< CALL xios_set_domain_attr("src_domain",data_dim=1, data_ni=src_ni, data_i_index=src_data_i_index, data_n_index=src_ni) -< CALL xios_set_domain_attr("src_domain",lonvalue=src_lon,latvalue=src_lat, bounds_lon=src_boundslon, bounds_lat=src_boundslat, nvertex=src_nvertex) ---- -> CALL xios_set_domain_attr("src_domain",data_dim=1, data_ni=src_ni, data_i_index=src_data_i_index, data_n_index=src_ni, nvertex=src_nvertex) -> CALL xios_set_domain_attr("src_domain",lonvalue=src_lon,latvalue=src_lat, bounds_lon=src_boundslon, bounds_lat=src_boundslat) diff --git a/xios_2311_src/trunk/.svn/pristine/37/3779b77aef28bc43047067c702bc58ccbcabe6d8.svn-base b/xios_2311_src/trunk/.svn/pristine/37/3779b77aef28bc43047067c702bc58ccbcabe6d8.svn-base deleted file mode 100644 index 7afdaeb6a0430bcb62713d59be46d9a9144450a4..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/37/3779b77aef28bc43047067c702bc58ccbcabe6d8.svn-base +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef __XIOS_ATTRIBUTE_ENUM__ -#define __XIOS_ATTRIBUTE_ENUM__ - -/// XIOS headers /// -#include "xios_spl.hpp" -#include "exception.hpp" -#include "attribute.hpp" -#include "buffer_in.hpp" -#include "buffer_out.hpp" -#include "type.hpp" -#include "enum.hpp" - - -namespace xios -{ - /// ////////////////////// Declarations ////////////////////// /// - /*! - \class CAttributeEnum - This class implements the attribute representing enumeration - */ - template - class CAttributeEnum : public CAttribute, public CEnum - { - typedef typename T::t_enum T_enum ; - public : - - /// Constructeurs /// - explicit CAttributeEnum(const StdString & id); - CAttributeEnum(const StdString & id, - xios_map & umap); - CAttributeEnum(const StdString & id, const T_enum & value); - CAttributeEnum(const StdString & id, const T_enum & value, - xios_map & umap); - - /// Accesseur /// - T_enum getValue(void) const; - string getStringValue(void) const; - - - /// Mutateurs /// - void setValue(const T_enum & value); - - void set(const CAttribute& attr) ; - void set(const CAttributeEnum& attr) ; - void reset(void); - - void setInheritedValue(const CAttributeEnum& attr ); - void setInheritedValue(const CAttribute& attr ); - T_enum getInheritedValue(void) const; - string getInheritedStringValue(void) const; - bool hasInheritedValue(void) const; - - bool isEqual(const CAttribute& attr ); - - /// Destructeur /// - virtual ~CAttributeEnum(void) { } - - /// Operateur /// - CAttributeEnum& operator=(const T_enum & value); - - /// Autre /// - virtual StdString toString(void) const { return _toString();} - virtual void fromString(const StdString & str) { if (str==resetInheritanceStr) { reset(); _canInherite=false ;} else _fromString(str);} - virtual StdString dump(void) const { return _toString();} - virtual StdString dumpGraph(void) const { return _dumpGraph();} - - virtual bool toBuffer (CBufferOut& buffer) const { return _toBuffer(buffer);} - virtual bool fromBuffer(CBufferIn& buffer) { return _fromBuffer(buffer); } - - virtual void generateCInterface(ostream& oss,const string& className) ; - virtual void generateFortran2003Interface(ostream& oss,const string& className) ; - virtual void generateFortranInterfaceDeclaration_(ostream& oss,const string& className) ; - virtual void generateFortranInterfaceBody_(ostream& oss,const string& className) ; - virtual void generateFortranInterfaceDeclaration(ostream& oss,const string& className) ; - virtual void generateFortranInterfaceGetDeclaration_(ostream& oss,const string& className) ; - virtual void generateFortranInterfaceGetBody_(ostream& oss,const string& className) ; - virtual void generateFortranInterfaceGetDeclaration(ostream& oss,const string& className) ; - - private : - bool isEqual_(const CAttributeEnum& attr ); - StdString _toString(void) const; - void _fromString(const StdString & str); - bool _toBuffer (CBufferOut& buffer) const; - bool _fromBuffer(CBufferIn& buffer) ; - CEnum inheritedValue ; - StdString _dumpGraph(void) const; - }; // class CAttributeEnum - -} // namespace xios - -#endif // __XIOS_ATTRIBUTE_ENUM__ diff --git a/xios_2311_src/trunk/.svn/pristine/37/37a0ec0c00e5215970fa0aa45b082be12db51da9.svn-base b/xios_2311_src/trunk/.svn/pristine/37/37a0ec0c00e5215970fa0aa45b082be12db51da9.svn-base deleted file mode 100644 index fa1fb76ddb6a6d63923fc85542399d23612a54d0..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/37/37a0ec0c00e5215970fa0aa45b082be12db51da9.svn-base +++ /dev/null @@ -1,115 +0,0 @@ -/*! - \file dht_auto_indexing.cpp - \author Ha NGUYEN - \since 6 Jul 2016 - \date 6 Jul 2016 - - \brief Auto assign global index across processes. - */ -#include "dht_auto_indexing.hpp" - -namespace xios -{ - - CDHTAutoIndexing::~CDHTAutoIndexing() - { - } - - /*! - \param [in] - \param [in] - */ - - CDHTAutoIndexing::CDHTAutoIndexing(const CArray& hashValue, - const MPI_Comm& clientIntraComm) - : CClientClientDHTTemplate(clientIntraComm) - { - - nbIndexOnProc_ = hashValue.size(); - size_t nbIndexAccum; - MPI_Scan(&nbIndexOnProc_, &nbIndexAccum, 1, MPI_UNSIGNED_LONG, MPI_SUM, clientIntraComm); - - // Broadcasting the total number of indexes - int rank, size; - MPI_Comm_rank(clientIntraComm, &rank); - MPI_Comm_size(clientIntraComm, &size); - if (rank == (size-1)) nbIndexesGlobal_ = nbIndexAccum; - MPI_Bcast(&nbIndexesGlobal_, 1, MPI_UNSIGNED_LONG, size-1, clientIntraComm); - - CArray::const_iterator itbIdx = hashValue.begin(), itIdx, - iteIdx = hashValue.end(); - - size_t idx = 0; - beginIndexOnProc_ = nbIndexAccum - nbIndexOnProc_; - globalIndex_.resize(nbIndexOnProc_); - for (itIdx = itbIdx; itIdx != iteIdx; ++itIdx) - { - globalIndex_[idx] = beginIndexOnProc_ + idx; - ++idx ; - } - } - - /*! - * \fn void CDHTAutoIndexing::CDHTAutoIndexing(Index2VectorInfoTypeMap& hashInitMap, const MPI_Comm& clientIntraComm) - * Assigns a global index to unique input indexes. - * The returned map has unique indexes as a key and global indexes as a mapped value. - * \param [in] hashInitMap map> is a map of unique indexes. - * \param [in] clientIntraComm - */ - CDHTAutoIndexing::CDHTAutoIndexing(Index2VectorInfoTypeMap& hashInitMap, - const MPI_Comm& clientIntraComm) - : CClientClientDHTTemplate(clientIntraComm) - { - - nbIndexOnProc_ = hashInitMap.size(); - size_t nbIndexAccum; - MPI_Scan(&nbIndexOnProc_, &nbIndexAccum, 1, MPI_UNSIGNED_LONG, MPI_SUM, clientIntraComm); - - int rank, size; - MPI_Comm_rank(clientIntraComm, &rank); - MPI_Comm_size(clientIntraComm, &size); - if (rank == (size-1)) nbIndexesGlobal_ = nbIndexAccum; - MPI_Bcast(&nbIndexesGlobal_, 1, MPI_UNSIGNED_LONG, size-1, clientIntraComm); - - Index2VectorInfoTypeMap::iterator itbIdx = hashInitMap.begin(), itIdx, - iteIdx = hashInitMap.end(); - size_t idx = 0; - beginIndexOnProc_ = nbIndexAccum - nbIndexOnProc_; - globalIndex_.resize(nbIndexOnProc_); - for (itIdx = itbIdx; itIdx != iteIdx; ++itIdx) - { -// (itIdx->second)[0] = beginIndexOnProc_ + idx; - (itIdx->second)[1] = beginIndexOnProc_ + idx; - globalIndex_[idx] = beginIndexOnProc_ + idx; - ++idx ; - } - } - - /*! - * \fn size_t CDHTAutoIndexing::getNbIndexesGlobal() const - * Returns the total number of global indexes. - */ - size_t CDHTAutoIndexing::getNbIndexesGlobal() const - { - return nbIndexesGlobal_; - } - - /*! - * \fn size_t CDHTAutoIndexing::getIndexStart() const - * Returns the starting global index for a proc. - */ - size_t CDHTAutoIndexing::getIndexStart() const - { - return beginIndexOnProc_; - } - - /*! - * \fn size_t CDHTAutoIndexing::getIndexCount() const - * Returns the number of global indexes on a proc. - */ - size_t CDHTAutoIndexing::getIndexCount() const - { - return nbIndexOnProc_; - } - -} diff --git a/xios_2311_src/trunk/.svn/pristine/37/37b437e871bb158cc7ec215074b904e04070de14.svn-base b/xios_2311_src/trunk/.svn/pristine/37/37b437e871bb158cc7ec215074b904e04070de14.svn-base deleted file mode 100644 index 31b982cd66bf4a37ad28f5f461b27c7302d6e8f9..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/37/37b437e871bb158cc7ec215074b904e04070de14.svn-base +++ /dev/null @@ -1,319 +0,0 @@ - -#include "xios_spl.hpp" -#include "cxios.hpp" -#include "client.hpp" -#include "server.hpp" -#include "xml_parser.hpp" -#include -#include "mpi.hpp" -#include "memory.hpp" -#include -#include "memtrack.hpp" -#include "registry.hpp" -#include "ressources_manager.hpp" -#include "services_manager.hpp" -#include "servers_ressource.hpp" -#include "mem_checker.hpp" - -namespace xios -{ - string CXios::rootFile="./iodef.xml" ; - string CXios::xiosCodeId="xios.x" ; - string CXios::clientFile="./xios_client"; - string CXios::serverFile="./xios_server"; - string CXios::serverPrmFile="./xios_server1"; - string CXios::serverSndFile="./xios_server2"; - const string CXios::defaultPoolId="default_pool_id" ; - const string CXios::defaultServerId="default_server_id" ; - const string CXios::defaultGathererId="default_gatherer_id" ; - - bool CXios::xiosStack = true; - bool CXios::systemStack = false; - - bool CXios::isClient ; - bool CXios::isServer ; - - MPI_Comm CXios::globalComm ; - MPI_Comm CXios::xiosComm ; - - bool CXios::usingOasis ; - bool CXios::usingServer = false; - bool CXios::usingServer2 = false; - int CXios::ratioServer2 = 50; - int CXios::nbPoolsServer2 = 1; - double CXios::bufferSizeFactor = 1.0; - const double CXios::defaultBufferSizeFactor = 1.0; - StdSize CXios::minBufferSize = 64 * sizeof(double); - StdSize CXios::maxBufferSize = std::numeric_limits::max() ; - bool CXios::printLogs2Files; - bool CXios::isOptPerformance = true; - CRegistry* CXios::globalRegistry = 0; - double CXios::recvFieldTimeout = 300.0; - bool CXios::checkEventSync=false ; - - CDaemonsManager* CXios::daemonsManager_=nullptr ; - CRessourcesManager* CXios::ressourcesManager_=nullptr ; - CServicesManager* CXios::servicesManager_=nullptr ; - CContextsManager* CXios::contextsManager_=nullptr ; - CCouplerManager* CXios::couplerManager_=nullptr ; - CRegistryManager* CXios::registryManager_=nullptr ; - - CMpiGarbageCollector CXios::MpiGarbageCollector_ ; - - //! Parse configuration file and create some objects from it - void CXios::initialize() - { - set_new_handler(noMemory); - parseFile(rootFile); - parseXiosConfig(); - } - - /*! - \brief Parse xios part of configuration file (.iodef.xml) - Both client and server need information returned from this function - */ - void CXios::parseXiosConfig() - { - usingOasis=getin("using_oasis",false) ; - usingServer=getin("using_server",false) ; - usingServer2=getin("using_server2",false) ; - ratioServer2=getin("ratio_server2",50); - nbPoolsServer2=getin("number_pools_server2",0); - info.setLevel(getin("info_level",0)) ; - report.setLevel(getin("info_level",50)); - printLogs2Files=getin("print_file",false); - - xiosStack=getin("xios_stack",true) ; - systemStack=getin("system_stack",false) ; - if (xiosStack && systemStack) - { - xiosStack = false; - } - - StdString bufMemory("memory"); - StdString bufPerformance("performance"); - StdString bufOpt = getin("optimal_buffer_size", bufPerformance); - std::transform(bufOpt.begin(), bufOpt.end(), bufOpt.begin(), ::tolower); - if (0 == bufOpt.compare(bufMemory)) isOptPerformance = false; - else if (0 != bufOpt.compare(bufPerformance)) - { - ERROR("CXios::parseXiosConfig()", << "optimal_buffer_size must be memory or performance "<< endl ); - } - - bufferSizeFactor = getin("buffer_size_factor", defaultBufferSizeFactor); - minBufferSize = getin("min_buffer_size", 1024 * sizeof(double)); - maxBufferSize = getin("max_buffer_size", std::numeric_limits::max()); - recvFieldTimeout = getin("recv_field_timeout", recvFieldTimeout); - if (recvFieldTimeout < 0.0) - ERROR("CXios::parseXiosConfig()", "recv_field_timeout cannot be negative."); - - checkEventSync = getin("check_event_sync", checkEventSync); - - globalComm=MPI_COMM_WORLD ; - } - - /*! - Initialize client - \param [in] codeId identity of context - \param [in] localComm local communicator - \param [in/out] returnComm communicator corresponding to group of client with same codeId - */ - void CXios::initClientSide(const string& codeId, MPI_Comm& localComm, MPI_Comm& returnComm) - TRY - { - initialize() ; - - isClient = true; - - //CClient::initialize(codeId,localComm,returnComm) ; - CClient::initialize(codeId,localComm,returnComm) ; - - // If there are no server processes then we are in attached mode - // and the clients are also servers - isServer = !usingServer; - - if (printLogs2Files) - { - CClient::openInfoStream(clientFile); - CClient::openErrorStream(clientFile); - } - else - { - CClient::openInfoStream(); - CClient::openErrorStream(); - } - } - CATCH - - void CXios::clientFinalize(void) - { - CClient::finalize() ; - -#ifdef XIOS_MEMTRACK - -#ifdef XIOS_MEMTRACK_LIGHT - report(10) << " Memory report : current memory used by XIOS : "<< MemTrack::getCurrentMemorySize()*1.0/(1024*1024)<<" Mbyte" << endl ; - report(10) << " Memory report : maximum memory used by XIOS : "<< MemTrack::getMaxMemorySize()*1.0/(1024*1024)<<" Mbyte" << endl ; -#endif - -#ifdef XIOS_MEMTRACK_FULL - report(0) << " Memory report : current memory used by XIOS : "<< MemTrack::getCurrentMemorySize()*1.0/(1024*1024)<<" Mbyte" << endl ; - report(0) << " Memory report : maximum memory used by XIOS : "<< MemTrack::getMaxMemorySize()*1.0/(1024*1024)<<" Mbyte" << endl ; - - ofstream memReport ; - std::filebuf* fb = memReport.rdbuf(); - CClient::openStream(clientFile, ".mem", fb); - - MemTrack::TrackListMemoryUsage() ; - size_t memtrack_blocks=0 ; - memtrack_blocks=xios::CXios::getin("memtrack_blocks",memtrack_blocks) ; - size_t memtrack_size=0 ; - memtrack_size=xios::CXios::getin("memtrack_size",memtrack_size) ; - MemTrack::TrackDumpBlocks(memReport, memtrack_blocks,memtrack_size); - memReport.close(); -#endif - - CClient::closeInfoStream(); - -#endif - } - - //! Init server by parsing only xios part of config file - void CXios::initServer() - { - set_new_handler(noMemory); - std::set parseList; - parseList.insert("xios"); - xml::CXMLParser::ParseFile(rootFile, parseList); - parseXiosConfig(); - } - - //! Initialize server then put it into listening state - void CXios::initServerSide(void) - { - CMemChecker::get("xios").resume() ; - initServer(); - isClient = false; - isServer = true; - - // Initialize all aspects MPI - CServer::initialize(); - CServer::finalize(); - -#ifdef XIOS_MEMTRACK - -#ifdef XIOS_MEMTRACK_LIGHT - report(10) << " Memory report : current memory used by XIOS : "<< MemTrack::getCurrentMemorySize()*1.0/(1024*1024)<<" Mbyte" << endl ; - report(10) << " Memory report : maximum memory used by XIOS : "<< MemTrack::getMaxMemorySize()*1.0/(1024*1024)<<" Mbyte" << endl ; -#endif - -#ifdef XIOS_MEMTRACK_FULL - report(0) << " Memory report : current memory used by XIOS : "<< MemTrack::getCurrentMemorySize()*1.0/(1024*1024)<<" Mbyte" << endl ; - report(0) << " Memory report : maximum memory used by XIOS : "<< MemTrack::getMaxMemorySize()*1.0/(1024*1024)<<" Mbyte" << endl ; - ofstream memReport ; - std::filebuf* fb = memReport.rdbuf(); - CClient::openStream(serverFile, ".mem", fb); - - MemTrack::TrackListMemoryUsage() ; - size_t memtrack_blocks=0 ; - memtrack_blocks=xios::CXios::getin("memtrack_blocks",memtrack_blocks) ; - size_t memtrack_size=0 ; - memtrack_size=xios::CXios::getin("memtrack_size",memtrack_size) ; - MemTrack::TrackDumpBlocks(memReport,memtrack_blocks,memtrack_size); - memReport.close() ; -#endif -#endif - CMemChecker::get("xios").suspend() ; - report(0)<getPoolRessource() ; - - MISSING_RETURN( "CPoolRessource* CXios::getPoolRessource()" ); - return nullptr; - } -} - diff --git a/xios_2311_src/trunk/.svn/pristine/37/37ee878e46f3e2e753b956b755a5de648bbd4a9a.svn-base b/xios_2311_src/trunk/.svn/pristine/37/37ee878e46f3e2e753b956b755a5de648bbd4a9a.svn-base deleted file mode 100644 index c1e083d15679ff644c202984f1ad7dcd4ca39565..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/37/37ee878e46f3e2e753b956b755a5de648bbd4a9a.svn-base +++ /dev/null @@ -1,24 +0,0 @@ -################################################################################ -################### Projet XIOS ################### -################################################################################ - -%CCOMPILER mpicc -%FCOMPILER mpif90 -%LINKER mpif90 - -%BASE_CFLAGS -std=c++11 -w -%PROD_CFLAGS -O3 -D BOOST_DISABLE_ASSERTS -%DEV_CFLAGS -g -O2 -%DEBUG_CFLAGS -g - -%BASE_FFLAGS -D__NONE__ -ffree-line-length-none -%PROD_FFLAGS -O3 -%DEV_FFLAGS -g -O2 -%DEBUG_FFLAGS -g - -%BASE_INC -D__NONE__ -%BASE_LD -lstdc++ - -%CPP cpp -%FPP cpp -P -%MAKE gmake diff --git a/xios_2311_src/trunk/.svn/pristine/38/382c9bfe33db8371d8a35514b525de0abf086c37.svn-base b/xios_2311_src/trunk/.svn/pristine/38/382c9bfe33db8371d8a35514b525de0abf086c37.svn-base deleted file mode 100644 index 29a03030890cbec51954e327f27a6191b966f825..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/38/382c9bfe33db8371d8a35514b525de0abf086c37.svn-base +++ /dev/null @@ -1,56 +0,0 @@ -/********************************************************************* - * Copyright 1993, UCAR/Unidata - * See netcdf/COPYRIGHT file for copying and redistribution conditions. - * $Header: /upc/share/CVS/netcdf-3/libncdap3/dapalign.h,v 1.3 2009/09/23 22:26:00 dmh Exp $ - *********************************************************************/ -#ifndef ALIGN_H -#define ALIGN_H 1 - -typedef struct NCtypealignment { - char* typename; - int alignment; -} NCtypealignment; - -/* Define indices for every primitive C type */ -/* NAT => NOT-A-TYPE*/ -#define NCCTYPENAT 0 -#define NCCTYPECHAR 1 -#define NCCTYPEUCHAR 2 -#define NCCTYPESHORT 3 -#define NCCTYPEUSHORT 4 -#define NCCTYPEINT 5 -#define NCCTYPEUINT 6 -#define NCCTYPELONG 7 -#define NCCTYPEULONG 8 -#define NCCTYPELONGLONG 9 -#define NCCTYPEULONGLONG 10 -#define NCCTYPEFLOAT 11 -#define NCCTYPEDOUBLE 12 -#define NCCTYPEPTR 13 -#define NCCTYPENCVLEN 14 - -/* Capture in struct and in a vector*/ -typedef struct NCtypealignset { - NCtypealignment charalign; /* char*/ - NCtypealignment ucharalign; /* unsigned char*/ - NCtypealignment shortalign; /* short*/ - NCtypealignment ushortalign; /* unsigned short*/ - NCtypealignment intalign; /* int*/ - NCtypealignment uintalign; /* unsigned int*/ - NCtypealignment longalign; /* long*/ - NCtypealignment ulongalign; /* unsigned long*/ - NCtypealignment longlongalign; /* long long*/ - NCtypealignment ulonglongalign; /* unsigned long long*/ - NCtypealignment floatalign; /* float*/ - NCtypealignment doublealign; /* double*/ - NCtypealignment ptralign; /* void**/ - NCtypealignment ncvlenalign; /* nc_vlen_t*/ -} NCtypealignset; - -typedef NCtypealignment NCtypealignvec; - -extern void compute_nccalignments(void); -extern unsigned int ncctypealignment(int nctype); -extern int nccpadding(unsigned long offset, int alignment); - -#endif /*ALIGN_H*/ diff --git a/xios_2311_src/trunk/.svn/pristine/38/3844dc8a30968145bfe70ae7a03e2dff88aa7af4.svn-base b/xios_2311_src/trunk/.svn/pristine/38/3844dc8a30968145bfe70ae7a03e2dff88aa7af4.svn-base deleted file mode 100644 index f82b0b6fa0f1de5be7efa926e3a701fda083e370..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/38/3844dc8a30968145bfe70ae7a03e2dff88aa7af4.svn-base +++ /dev/null @@ -1,22 +0,0 @@ -#include "object_factory_decl_macro.hpp" - -namespace xios -{ - macro(CInterpolateDomainGroup) - macro(CGenerateRectilinearDomainGroup) - macro(CScalarGroup) - macro(CReduceAxisToScalarGroup) - macro(CReduceDomainToAxisGroup) - macro(CReduceAxisToAxisGroup) - macro(CExtractDomainToAxisGroup) - macro(CComputeConnectivityDomainGroup) - macro(CExpandDomainGroup) - macro(CExtractAxisToScalarGroup) - macro(CReduceDomainToScalarGroup) - macro(CTemporalSplittingGroup) - macro(CDuplicateScalarToAxisGroup) - macro(CReduceScalarToScalarGroup) - macro(CReorderDomainGroup) - macro(CExtractDomainGroup) -} - diff --git a/xios_2311_src/trunk/.svn/pristine/38/385a37092553e0762d862ff984a03037146fa2b5.svn-base b/xios_2311_src/trunk/.svn/pristine/38/385a37092553e0762d862ff984a03037146fa2b5.svn-base deleted file mode 100644 index df64528f6322a99556f7866753c9a74d39836248..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/38/385a37092553e0762d862ff984a03037146fa2b5.svn-base +++ /dev/null @@ -1,6 +0,0 @@ -module unload netcdf -module unload hdf5 -module unload boost -module load netcdf/4.3.3.1_hdf5_parallel -module load boost -module load blitz diff --git a/xios_2311_src/trunk/.svn/pristine/38/3872d293defc4f6e1ae57a942644af81a2f69ba6.svn-base b/xios_2311_src/trunk/.svn/pristine/38/3872d293defc4f6e1ae57a942644af81a2f69ba6.svn-base deleted file mode 100644 index 08990d6de0b6909a7e23159b30a896dc3382822c..0000000000000000000000000000000000000000 Binary files a/xios_2311_src/trunk/.svn/pristine/38/3872d293defc4f6e1ae57a942644af81a2f69ba6.svn-base and /dev/null differ diff --git a/xios_2311_src/trunk/.svn/pristine/38/38bebde4f1d00081f04f11444876a62bda3f1526.svn-base b/xios_2311_src/trunk/.svn/pristine/38/38bebde4f1d00081f04f11444876a62bda3f1526.svn-base deleted file mode 100644 index 51652dfded0d78b453dbfdea588b48c0426ec389..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/38/38bebde4f1d00081f04f11444876a62bda3f1526.svn-base +++ /dev/null @@ -1,40 +0,0 @@ -/********************************************************************* - * Copyright 1993, UCAR/Unidata - * See netcdf/COPYRIGHT file for copying and redistribution conditions. - * $Header: /upc/share/CVS/netcdf-3/libncdap3/getvara.h,v 1.11 2010/05/27 21:34:08 dmh Exp $ - *********************************************************************/ -#ifndef GETVARA_H -#define GETVARA_H - -/* -Define the overall maximum cache size -and the per-retrieval maximum size -*/ - -/* Use slightly misspelled names to avoid conflicts */ -#define KILBYTE 0x400 -#define MEGBYTE 0x100000 -#define GIGBYTE 0x40000000 - -/* The cache limit is in terms of bytes */ -#define DFALTCACHELIMIT (100*MEGBYTE) -/* The fetch limit is in terms of bytes */ -#define DFALTFETCHLIMIT (100*KILBYTE) - -/* WARNING: The small limit is in terms of the # of vector elements */ -#define DFALTSMALLLIMIT (1*KILBYTE) - -/* Max number of cache nodes */ -#define DFALTCACHECOUNT (100) - -typedef struct Getvara { - void* memory; /* where result is put*/ - struct NCcachenode* cache; - struct DCEprojection* varaprojection; - /* associated variable*/ - OCtype dsttype; - CDFnode* target; - int wholevariable; -} Getvara; - -#endif /*GETVARA_H*/ diff --git a/xios_2311_src/trunk/.svn/pristine/38/38bf24c9c7f599cbc8f1093d0bcece0c2aea1eee.svn-base b/xios_2311_src/trunk/.svn/pristine/38/38bf24c9c7f599cbc8f1093d0bcece0c2aea1eee.svn-base deleted file mode 100644 index 5458f14bd54115a2560e6cb3428763ca2dab35f0..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/38/38bf24c9c7f599cbc8f1093d0bcece0c2aea1eee.svn-base +++ /dev/null @@ -1,44 +0,0 @@ -/* ************************************************************************** * - * Copyright © IPSL/LSCE, xios, Avril 2010 - Octobre 2011 * - * ************************************************************************** */ - - -#ifndef __ICUTIL_HPP__ -#define __ICUTIL_HPP__ - -#include -#include - -// ///////////////////////// Définitions/Déclarations /////////////////////// // - -inline bool cstr2string(const char* cstr, int cstr_size, std::string& str) -{ - if (cstr_size != -1) - { - std::string valtemp; - std::size_t d, f = 0; - - valtemp.append(cstr, cstr_size); - d = valtemp.find_first_not_of(' '); - f = valtemp.find_last_not_of (' '); - str = valtemp.substr(d, f - d + 1); - - return true; - } - else - return false; -} - -inline bool string_copy(const std::string& str, char* cstr, int cstr_size) -{ - if (str.size() > cstr_size) - return false; - else - { - std::fill(cstr, cstr + cstr_size, ' '); - str.copy(cstr, cstr_size); - return true; - } -} - -#endif // __ICUTIL_HPP__ diff --git a/xios_2311_src/trunk/.svn/pristine/38/38ef48a78bad89a7f717e689e2b715c1a097bb5f.svn-base b/xios_2311_src/trunk/.svn/pristine/38/38ef48a78bad89a7f717e689e2b715c1a097bb5f.svn-base deleted file mode 100644 index f1b5294a63c9a3577910d1804492aefe402ff2d6..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/38/38ef48a78bad89a7f717e689e2b715c1a097bb5f.svn-base +++ /dev/null @@ -1,22 +0,0 @@ -MODULE EXTRACT_DOMAIN_TO_AXIS_INTERFACE - USE, INTRINSIC :: ISO_C_BINDING - - INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99 - - SUBROUTINE cxios_extract_domain_to_axis_handle_create(ret, idt, idt_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_extract_domain_to_axis_handle_create - - SUBROUTINE cxios_extract_domain_to_axis_valid_id(ret, idt, idt_size) BIND(C) - USE ISO_C_BINDING - LOGICAL (kind = C_BOOL) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_extract_domain_to_axis_valid_id - - END INTERFACE - -END MODULE EXTRACT_DOMAIN_TO_AXIS_INTERFACE diff --git a/xios_2311_src/trunk/.svn/pristine/39/393415323b149f6a03d6cb92861d161303933d01.svn-base b/xios_2311_src/trunk/.svn/pristine/39/393415323b149f6a03d6cb92861d161303933d01.svn-base deleted file mode 100644 index f3d1c68dd338dc773d88a4a28697065e25d12a47..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/39/393415323b149f6a03d6cb92861d161303933d01.svn-base +++ /dev/null @@ -1,482 +0,0 @@ -/* Copyright 2009, UCAR/Unidata and OPeNDAP, Inc. - See the COPYRIGHT file for more information. -*/ - -#include "config.h" -#include - -#ifdef NETINET_IN_H -#include -#endif - -#include "ocinternal.h" -#include "ocdata.h" -#include "ocdebug.h" - -#define MAXLEVEL 1 - -/*Forward*/ -static void dumpocnode1(OCnode* node, int depth); -static void dumpdimensions(OCnode* node); -static void dumpattvalue(OCtype nctype, char** aset, int index); - -static char* sindent = NULL; - -static char* -dent(int n) -{ - if(sindent == NULL) { - sindent = (char*)ocmalloc(102); - MEMCHECK(sindent,NULL); - memset((void*)sindent,(int)' ',(size_t)101); - sindent[101] = '\0'; - } - if(n > 100) n = 100; - return sindent+(100-n); -} - -/* support [dd] leader*/ -static char* -dent2(int n) {return dent(n+4);} - -void -ocdumpnode(OCnode* node) -{ - if(node != NULL) { - dumpocnode1(node,0); - } else { - fprintf(stdout,"\n"); - } - fflush(stdout); -} - -static void -dumpskip(OCnode* node) -{ - char tmpc[64]; - char tmpi[64]; - char tmpt[64]; - char tmpo[64]; - if(node->skip.count == OCINDETERMINATE) - strcpy(tmpc,"?"); - else - snprintf(tmpc,sizeof(tmpc),"%lu",(unsigned long)node->skip.count); - if(node->skip.instancesize == OCINDETERMINATE) - strcpy(tmpi,"?"); - else - snprintf(tmpi,sizeof(tmpi),"%lu",(unsigned long)node->skip.instancesize); - if(node->skip.totalsize == OCINDETERMINATE) - strcpy(tmpt,"?"); - else - snprintf(tmpt,sizeof(tmpt),"%lu",(unsigned long)node->skip.totalsize); - if(node->skip.offset == OCINDETERMINATE) - strcpy(tmpo,"?"); - else - snprintf(tmpo,sizeof(tmpo),"%lu",(unsigned long)node->skip.offset); - - fprintf(stdout," [(%s*%s)/%s@%s]",tmpi,tmpc,tmpt,tmpo); -} - -static void -dumpocnode1(OCnode* node, int depth) -{ - unsigned int n; - switch (node->octype) { - case OC_Primitive: { - fprintf(stdout,"[%2d]%s ",depth,dent(depth)); - if(node->name == NULL) OCPANIC("prim without name"); - fprintf(stdout,"%s %s",octypetostring(node->etype),node->name); - dumpdimensions(node); -#ifdef OCIGNORE - if(node->cache.cacheable) fprintf(stdout," [cached]"); -#endif - dumpskip(node); - fprintf(stdout," &%lx",(unsigned long)node); - fprintf(stdout,"\n"); - } break; - - case OC_Dataset: { - fprintf(stdout,"[%2d]%s ",depth,dent(depth)); - fprintf(stdout,"dataset %s\n", - (node->name?node->name:"")); - for(n=0;nsubnodes);n++) { - dumpocnode1((OCnode*)oclistget(node->subnodes,n),depth+1); - } - } break; - - case OC_Structure: { - fprintf(stdout,"[%2d]%s ",depth,dent(depth)); - fprintf(stdout,"struct %s", - (node->name?node->name:"")); - dumpdimensions(node); - dumpskip(node); - fprintf(stdout," &%lx",(unsigned long)node); - fprintf(stdout,"\n"); - for(n=0;nsubnodes);n++) { - dumpocnode1((OCnode*)oclistget(node->subnodes,n),depth+1); - } - } break; - - case OC_Sequence: { - fprintf(stdout,"[%2d]%s ",depth,dent(depth)); - fprintf(stdout,"sequence %s", - (node->name?node->name:"")); - dumpdimensions(node); - dumpskip(node); - fprintf(stdout," &%lx",(unsigned long)node); - fprintf(stdout,"\n"); - for(n=0;nsubnodes);n++) { - dumpocnode1((OCnode*)oclistget(node->subnodes,n),depth+1); - } - } break; - - case OC_Grid: { - unsigned int i; - fprintf(stdout,"[%2d]%s ",depth,dent(depth)); - fprintf(stdout,"grid %s", - (node->name?node->name:"")); - dumpdimensions(node); - dumpskip(node); - fprintf(stdout," &%lx",(unsigned long)node); - fprintf(stdout,"\n"); - fprintf(stdout,"%sarray:\n",dent2(depth+1)); - dumpocnode1((OCnode*)oclistget(node->subnodes,0),depth+2); - fprintf(stdout,"%smaps:\n",dent2(depth+1)); - for(i=1;isubnodes);i++) { - dumpocnode1((OCnode*)oclistget(node->subnodes,i),depth+2); - } - } break; - - case OC_Attribute: { - fprintf(stdout,"[%2d]%s ",depth,dent(depth)); - if(node->name == NULL) OCPANIC("Attribute without name"); - fprintf(stdout,"%s %s",octypetostring(node->etype),node->name); - for(n=0;natt.values);n++) { - char* value = (char*)oclistget(node->att.values,n); - if(n > 0) fprintf(stdout,","); - fprintf(stdout," %s",value); - } - fprintf(stdout," &%lx",(unsigned long)node); - fprintf(stdout,"\n"); - } break; - - case OC_Attributeset: { - fprintf(stdout,"[%2d]%s ",depth,dent(depth)); - fprintf(stdout,"%s:\n",node->name?node->name:"Attributes"); - for(n=0;nsubnodes);n++) { - dumpocnode1((OCnode*)oclistget(node->subnodes,n),depth+1); - } - } break; - - default: - OCPANIC1("encountered unexpected node type: %x",node->octype); - } - - if(node->attributes != NULL) { - unsigned int i; - for(i=0;iattributes);i++) { - OCattribute* att = (OCattribute*)oclistget(node->attributes,i); - fprintf(stdout,"%s[%s=",dent2(depth+2),att->name); - if(att->nvalues == 0) - OCPANIC("Attribute.nvalues == 0"); - if(att->nvalues == 1) { - dumpattvalue(att->etype,att->values,0); - } else { - unsigned int j; - fprintf(stdout,"{"); - for(j=0;jnvalues;j++) { - if(j>0) fprintf(stdout,", "); - dumpattvalue(att->etype,att->values,j); - } - fprintf(stdout,"}"); - } - fprintf(stdout,"]\n"); - } - } -} - -static void -dumpdimensions(OCnode* node) -{ - unsigned int i; - for(i=0;iarray.rank;i++) { - OCnode* dim = (OCnode*)oclistget(node->array.dimensions,i); - fprintf(stdout,"[%s=%lu]", - (dim->name?dim->name:"?"), - (unsigned long)dim->dim.declsize); - } -} - -static void -dumpattvalue(OCtype nctype, char** strings, int index) -{ - if(nctype == OC_String || nctype == OC_URL) { - fprintf(stdout,"\"%s\"",strings[index]); - } else { - fprintf(stdout,"%s",strings[index]); - } -} - -void -ocdumpslice(OCslice* slice) -{ - fprintf(stdout,"["); - fprintf(stdout,"%lu",(unsigned long)slice->first); - if(slice->stride > 1) fprintf(stdout,":%lu",(unsigned long)slice->stride); - fprintf(stdout,":%lu",(unsigned long)(slice->first+slice->count)-1); - fprintf(stdout,"]"); -} - -void -ocdumpclause(OCprojectionclause* ref) -{ - unsigned int i; - OClist* path = oclistnew(); - occollectpathtonode(ref->node,path); - for(i=0;itree != NULL) continue; /* leave off the root node*/ - fprintf(stdout,"%s%s",(i>0?PATHSEPARATOR:""),node->name); - sliceset = (OClist*)oclistget(ref->indexsets,i); - if(sliceset != NULL) { - unsigned int j; - for(j=0;j 0) strcat(line," "); -} - -static void -dumpfield(int index, char* n8, int isxdr) -{ - char line[1024]; - char tmp[32]; - - union { - unsigned int uv; - int sv; - char cv[4]; - float fv; - } form; - union { - char cv[8]; - unsigned long long ll; - double d; - } dform; - - line[0] = '\0'; - - /* offset */ - sprintf(tmp,"%6d",index); - addfield(tmp,line,5); - - memcpy(form.cv,n8,4); - - /* straight hex*/ - sprintf(tmp,"%08x",form.uv); - addfield(tmp,line,8); - - if(isxdr) {swapinline32(&form.uv);} - - /* unsigned integer */ - sprintf(tmp,"%12u",form.uv); - addfield(tmp,line,12); - - /* signed integer */ - sprintf(tmp,"%12d",form.sv); - addfield(tmp,line,12); - - /* float */ - sprintf(tmp,"%#g",form.fv); - addfield(tmp,line,12); - - /* char[4] */ - { - /* use raw form (i.e. n8)*/ - int i; - tmp[0] = '\0'; - for(i=0;i<4;i++) { - char stmp[64]; - unsigned int c = (n8[i] & 0xff); - if(c < ' ' || c > 126) - sprintf(stmp,"\\%02x",c); - else - sprintf(stmp,"%c",c); - strcat(tmp,stmp); - } - } - - addfield(tmp,line,16); - - /* double */ - memcpy(dform.cv,n8,2*XDRUNIT); - if(isxdr) xxdrntohdouble(dform.cv,&dform.d); - sprintf(tmp,"%#g",dform.d); - addfield(tmp,line,12); - - fprintf(stdout,"%s\n",line); -} - -static void -typedmemorydump(char* memory, size_t len, int fromxdr) -{ - unsigned int i,count,rem; - char line[1024]; - char* pmem; - char mem[8]; - - assert(memory[len] == 0); - - /* build the header*/ - line[0] = '\0'; - addfield("offset",line,6); - addfield("hex",line,8); - addfield("uint",line,12); - addfield("int",line,12); - addfield("float",line,12); - addfield("char[4]",line,16); - addfield("double",line,12); - strcat(line,"\n"); - fprintf(stdout,"%s",line); - - count = (len / sizeof(int)); - rem = (len % sizeof(int)); - - for(pmem=memory,i=0;i 0) { - memset(mem,0,8); - memcpy(mem,pmem,4); - dumpfield(i*sizeof(unsigned int),mem,fromxdr); - } - fflush(stdout); -} - -static void -simplememorydump(char* memory, size_t len, int fromxdr) -{ - unsigned int i,count,rem; - int* imemory; - char tmp[32]; - char line[1024]; - - assert(memory[len] == 0); - - /* build the header*/ - line[0] = '\0'; - addfield("offset",line,6); - addfield("XDR (hex)",line,9); - addfield("!XDR (hex)",line,10); - fprintf(stdout,"%s\n",line); - - count = (len / sizeof(int)); - rem = (len % sizeof(int)); - if(rem != 0) - fprintf(stderr,"ocdump: |mem|%%4 != 0\n"); - imemory = (int*)memory; - - for(i=0;i MAXLEVEL) level = MAXLEVEL; - switch (level) { - case 1: /* Do a multi-type dump */ - typedmemorydump(memory,len,xdrencoded); - break; - case 0: /* Dump a simple linear list of the contents of the memory as 32-bit hex and decimal */ - default: - simplememorydump(memory,len,xdrencoded); - break; - } -} - -static int -ocreadfile(FILE* file, int datastart, char** memp, size_t* lenp) -{ - char* mem; - size_t len; - size_t pos; - size_t red; - struct stat stats; - - pos = ftell(file); - fseek(file,0,SEEK_SET); - fseek(file,datastart,SEEK_SET); - - fstat(fileno(file),&stats); - len = stats.st_size; - len -= datastart; - - mem = (char*)calloc(len+1,1); - if(mem == NULL) return 0; - - /* Read only the data part */ - red = fread(mem,1,len,file); - if(red < len) { - fprintf(stderr,"ocreadfile: short file\n"); - return 0; - } - fseek(file,pos,SEEK_SET); /* leave it as we found it*/ - if(memp) *memp = mem; - if(lenp) *lenp = len; - return 1; -} - -void -ocdd(OCstate* state, OCnode* root, int xdrencoded, int level) -{ - char* mem; - size_t len; - if(root->tree->data.file != NULL) { - if(!ocreadfile(root->tree->data.file,root->tree->data.bod,&mem,&len)) { - fprintf(stderr,"ocdd could not read data file\n"); - return; - } - ocdumpmemory(mem,len,xdrencoded,level); - free(mem); - } else { - mem = root->tree->data.memory; - mem += root->tree->data.bod; - len = root->tree->data.datasize; - len -= root->tree->data.bod; - ocdumpmemory(mem,len,xdrencoded,level); - } -} - diff --git a/xios_2311_src/trunk/.svn/pristine/39/3938784b97f9192191e2b474afbaf12894513226.svn-base b/xios_2311_src/trunk/.svn/pristine/39/3938784b97f9192191e2b474afbaf12894513226.svn-base deleted file mode 100644 index 7ef1ed81f6a45b3dc7d72781c82f4a0c15c1cd2a..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/39/3938784b97f9192191e2b474afbaf12894513226.svn-base +++ /dev/null @@ -1,23 +0,0 @@ -#include "generate_interface_impl.hpp" - -namespace xios -{ - -#define macro(T) \ - template void CInterface::AttributeCInterface(ostream& oss,const string& className,const string& name) ; \ - template void CInterface::AttributeFortran2003Interface(ostream& oss,const string& className,const string& name) ; \ - template void CInterface::AttributeFortranInterfaceDeclaration(ostream& oss,const string& className,const string& name) ; \ - template void CInterface::AttributeFortranInterfaceGetDeclaration(ostream& oss,const string& className,const string& name) ; \ - template void CInterface::AttributeFortranInterfaceBody(ostream& oss,const string& className,const string& name) ; \ - template void CInterface::AttributeFortranInterfaceGetBody(ostream& oss,const string& className,const string& name) ; \ - template string CInterface::getStrFortranType(void) ; \ - template string CInterface::getStrFortranKind(void) ; \ - template string CInterface::getStrFortranKindC(void) ; \ - template bool CInterface::matchingTypeCFortran(void) ; - - macro(bool) - macro(int) - macro(double) - macro(CDate) - macro(CDuration) -} diff --git a/xios_2311_src/trunk/.svn/pristine/39/395d252a4440366d6f08698f9f22a1fb06fe9981.svn-base b/xios_2311_src/trunk/.svn/pristine/39/395d252a4440366d6f08698f9f22a1fb06fe9981.svn-base deleted file mode 100644 index bf693017e2761938f3967e9bb0f7e07ab13d3721..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/39/395d252a4440366d6f08698f9f22a1fb06fe9981.svn-base +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef __REGISTRY_MANAGER_HPP__ -#define __REGISTRY_MANAGER_HPP__ - -#include "xios_spl.hpp" -#include "registry.hpp" -#include "mpi.hpp" - -namespace xios -{ - class CRegistryManager - { - - public: - - CRegistryManager(bool isXiosServer) ; - ~CRegistryManager() { finalize() ;} - const CRegistry& getRegistryIn(void) {return *registryIn_ ;} - const CRegistry& getRegistryOut(void) {return *registryOut_ ;} - - void merge(const CRegistry& inRegistry) { registryOut_->mergeRegistry(inRegistry) ;} - - private: - void finalize(void) ; - - const std::string registryInFileName {"registry.bin"} ; - const std::string registryOutFileName {"registry.bin"} ; - MPI_Comm xiosComm_ ; - int managerGlobalLeader_ ; - bool isManagerGlobalLeader_ ; - CRegistry* registryIn_ ; - CRegistry* registryOut_ ; - } ; -} - -#endif \ No newline at end of file diff --git a/xios_2311_src/trunk/.svn/pristine/39/397dedd691ceb2a17e6d4c221d1a4e5f4f08c55c.svn-base b/xios_2311_src/trunk/.svn/pristine/39/397dedd691ceb2a17e6d4c221d1a4e5f4f08c55c.svn-base deleted file mode 100644 index 1bc07b8d3e2c96a0e536372ee6024f2347541c7b..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/39/397dedd691ceb2a17e6d4c221d1a4e5f4f08c55c.svn-base +++ /dev/null @@ -1,90 +0,0 @@ -#ifndef __XIOS_CAttributeMap__ -#define __XIOS_CAttributeMap__ - -/// XIOS headers /// -#include "xios_spl.hpp" -#include "attribute.hpp" -#include "attribute_template.hpp" -#include "exception.hpp" -#include "xml_node.hpp" - -namespace xios -{ - /// ////////////////////// Déclarations ////////////////////// /// - /*! - \class CAttributeMap - This class represents the set of attributes which an object can have. - Each attribute in the set is represented by an unique id. - */ - - class CAttributeMap - : public xios_map - { - typedef xios_map SuperClassMap; - - public : - - /// Tests /// - bool hasAttribute(const StdString & key) const; - - /// Accesseurs /// - CAttribute * operator[](const StdString & key); - - /// Mutateurs /// - void setAttribute(const StdString & key, CAttribute * const attr); - - void setAttributes(const xml::THashAttributes & attributes); - void setAttributes(const CAttributeMap * const _parent, bool apply=true); - void duplicateAttributes(const CAttributeMap* const _parent); - void clearAllAttributes(void); - StdString dumpXiosAttributes(void) const; - StdString recordXiosAttributes(void) const; - - void clearAttribute(const StdString& key); - bool isEqual(const CAttributeMap& another, const vector& excludedAttrs); - - /// Destructeur /// - virtual ~CAttributeMap(void); - - /// Flux /// - // Debug only // - // friend StdOStream & operator << (StdOStream & os, const CAttributeMap & attributmap); - - /// Autre /// - virtual StdString toString(void) const; - virtual void fromString(const StdString & str); - -// virtual void toBinary (StdOStream & os) const; -// virtual void fromBinary(StdIStream & is); - virtual void generateCInterface(ostream& oss, const string& className) ; - virtual void generateFortran2003Interface(ostream& oss, const string& className) ; - virtual void generateFortranInterface_hdl_(ostream& oss, const string& className) ; - virtual void generateFortranInterface_hdl(ostream& oss, const string& className) ; - virtual void generateFortranInterface_id(ostream& oss, const string& className) ; - virtual void generateFortranInterfaceGet_hdl_(ostream& oss, const string& className) ; - virtual void generateFortranInterfaceGet_hdl(ostream& oss, const string& className) ; - virtual void generateFortranInterfaceGet_id(ostream& oss, const string& className) ; - virtual void generateFortranInterfaceIsDefined_hdl_(ostream& oss, const string& className) ; - virtual void generateFortranInterfaceIsDefined_hdl(ostream& oss, const string& className) ; - virtual void generateFortranInterfaceIsDefined_id(ostream& oss, const string& className) ; - - protected : - - /// Constructeurs /// - CAttributeMap(void); - CAttributeMap(const xios_map & umap); // Never implemented. - CAttributeMap(const xios_map * const umap); // Not implemented. - - /// Propriété statique /// - static CAttributeMap * Current; - - }; // class CAttributeMap - - inline bool CAttributeMap::hasAttribute(const StdString& key) const - { - return (this->find(key) != this->end()); - } - -} // namespace xios - -#endif // __XIOS_CAttributeMap__ diff --git a/xios_2311_src/trunk/.svn/pristine/39/39e3322eb89b34688b1bbd65b52c1146571ce83b.svn-base b/xios_2311_src/trunk/.svn/pristine/39/39e3322eb89b34688b1bbd65b52c1146571ce83b.svn-base deleted file mode 100644 index b812278d1cd67e64f30cf684e4abe1cb384da07d..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/39/39e3322eb89b34688b1bbd65b52c1146571ce83b.svn-base +++ /dev/null @@ -1,3 +0,0 @@ -DECLARE_TYPE(type) -DECLARE_ATTRIBUTE(StdString, name) -DECLARE_ENUM4(ts_target, file, field, both, none) diff --git a/xios_2311_src/trunk/.svn/pristine/3a/3a102c7435868d5f79cdf6f64b9ffae906f61f0e.svn-base b/xios_2311_src/trunk/.svn/pristine/3a/3a102c7435868d5f79cdf6f64b9ffae906f61f0e.svn-base deleted file mode 100644 index e4cb3a95cae4151b14d85c27653e00782e2af8e6..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/3a/3a102c7435868d5f79cdf6f64b9ffae906f61f0e.svn-base +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef __XIOS_CReorderDomain__ -#define __XIOS_CReorderDomain__ - -/// xios headers /// -#include "xios_spl.hpp" -#include "attribute_enum.hpp" -#include "attribute_enum_impl.hpp" -#include "attribute_array.hpp" -#include "declare_attribute.hpp" -#include "object_template.hpp" -#include "group_factory.hpp" -#include "declare_group.hpp" -#include "transformation.hpp" -#include "domain.hpp" - -namespace xios { - /// ////////////////////// Déclarations ////////////////////// /// - class CReorderDomainGroup; - class CReorderDomainAttributes; - class CReorderDomain; - class CDomain; - class CGenericAlgorithmTransformation ; - class CGrid; - ///-------------------------------------------------------------- - - // Declare/Define CReorderDomainAttribute - BEGIN_DECLARE_ATTRIBUTE_MAP(CReorderDomain) -#include "reorder_domain_attribute.conf" - END_DECLARE_ATTRIBUTE_MAP(CReorderDomain) - - ///-------------------------------------------------------------- - /*! - \class CReorderDomain - This class describes reorder_domain in xml file. - */ - class CReorderDomain - : public CObjectTemplate - , public CReorderDomainAttributes - , public CTransformation - { - public : - typedef CObjectTemplate SuperClass; - typedef CReorderDomainAttributes SuperClassAttribute; - typedef CReorderDomain MyClass ; - typedef CTransformation SuperTransform ; - - public : - /// Constructeurs /// - CReorderDomain(void); - explicit CReorderDomain(const StdString& id); - - /// Destructeur /// - virtual ~CReorderDomain(void); - - virtual void checkValid(CDomain* domainSrc); - - /// Accesseurs statiques /// - static StdString GetName(void); - static StdString GetDefName(void); - static ENodeType GetType(void); - const string& getId(void) { return this->SuperClass::getId();} - ETranformationType getTransformationType(void) { return TRANS_REORDER_DOMAIN ;} - static CTransformation* getTransformation(const StdString& id) { return SuperClass::get(id);} - virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} - virtual shared_ptr createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) ; - private: - static bool registerTrans(); - static CTransformation* create(const StdString& id, xml::CXMLNode* node); - static bool _dummyRegistered; - }; // class CReorderDomain - - DECLARE_GROUP(CReorderDomain); -} // namespace xios - -#endif // __XIOS_CReorderDomain__ diff --git a/xios_2311_src/trunk/.svn/pristine/3a/3a485c51443c4fda3190650d2939147c868a1adf.svn-base b/xios_2311_src/trunk/.svn/pristine/3a/3a485c51443c4fda3190650d2939147c868a1adf.svn-base deleted file mode 100644 index e21d920c2769f79e29e611ad78b115fe5fe8e3c4..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/3a/3a485c51443c4fda3190650d2939147c868a1adf.svn-base +++ /dev/null @@ -1,1169 +0,0 @@ -/********************************************************************* - * Copyright 2008, University Corporation for Atmospheric Research - * See netcdf/COPYRIGHT file for copying and redistribution conditions. - * $Id: nctime.c,v 1.9 2010/05/05 22:15:39 dmh Exp $ - *********************************************************************/ - -/* - * This code was extracted with permission from the CDMS time - * conversion and arithmetic routines developed by Bob Drach, Lawrence - * Livermore National Laboratory as part of the cdtime library. Russ - * Rew of the UCAR Unidata Program made changes and additions to - * support the "-t" option of the netCDF ncdump utility, including a - * 366-day climate calendar. - * - * For the complete time conversion and climate calendar facilities of - * the CDMS library, get the original sources from LLNL. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "nctime.h" - -static int cuErrOpts; /* Error options */ -static int cuErrorOccurred = 0; /* True iff cdError was called */ - -#define CU_FATAL 1 /* Exit immediately on fatal error */ -#define CU_VERBOSE 2 /* Report errors */ - -#define CD_DEFAULT_BASEYEAR "1979" /* Default base year for relative time (no 'since' clause) */ -#define VALCMP(a,b) ((a)<(b)?-1:(b)<(a)?1:0) - -/* forward declarations */ -static void cdComp2Rel(cdCalenType timetype, cdCompTime comptime, char* relunits, double* reltime); -static void cdRel2CompMixed(double reltime, cdUnitTime unit, cdCompTime basetime, cdCompTime *comptime); -static void cdRel2Comp(cdCalenType timetype, char* relunits, double reltime, cdCompTime* comptime); - -/* Trim trailing whitespace, up to n characters. */ -/* If no whitespace up to the last character, set */ -/* the last character to null, else set the first */ -/* whitespace character to null. */ -static void -cdTrim(char* s, int n) -{ - char* c; - - if(s==NULL) - return; - for(c=s; *c && cyear (long) (year since 0 BC) - * date->timeType (CdTimetype) (time type) - * date->baseYear base year for relative times - * Output: - * date->month (short) (month in year) - * date->day (short) (day in month) - * - * - * Derived from NRL NEONS V3.6. - */ - -static void -CdMonthDay(int *doy, CdTime *date) -{ - int i; /* month counter */ - int idoy; /* day of year counter */ - long year; - - if ((idoy = *doy) < 1) { - date->month = 0; - date->day = 0; - return; - } - - if(!(date->timeType & CdChronCal)) /* Ignore year for Clim calendar */ - year = 0; - else if(!(date->timeType & CdBase1970)) /* year is offset from base for relative time */ - year = date->baseYear + date->year; - else - year = date->year; - - if (ISLEAP(year,date->timeType)) { - mon_day_cnt[1] = 29; - } else { - mon_day_cnt[1] = 28; - } - date->month = 0; - for (i = 0; i < 12; i++) { - (date->month)++; - date->day = idoy; - if ((idoy -= ((date->timeType & Cd365) ? (mon_day_cnt[date->month-1]) : 30)) <= 0) { - return; - } - } - return; -} - -/* Compute day-of-year from year, month and day - * - * Input: - * date->year (long) (year since 0 BC) - * date->month (short) (month in year) - * date->day (short) (day in month) - * date->baseYear base year for relative times - * Output: doy (int) (day-of-year) - * - * Derived from NRL NEONS V3.6 - */ - -static void -CdDayOfYear(CdTime *date, int *doy) -{ - int leap_add = 0; /* add 1 day if leap year */ - int month; /* month */ - long year; - - month = date->month; - if (month < 1 || month > 12) { - cdError( "Day-of-year error; month: %d\n", month); - month = 1; - } - - if(!(date->timeType & CdChronCal)) /* Ignore year for Clim calendar */ - year = 0; - else if(!(date->timeType & CdBase1970)) /* year is offset from base for relative time */ - year = date->baseYear + date->year; - else - year = date->year; - - if (ISLEAP(year,date->timeType) && month > 2) leap_add = 1; - if( ((date->timeType) & Cd365) || ((date->timeType) & Cd366) ) { - *doy = days_sum[month-1] + date->day + leap_add ; - } else { /* date->timeType & Cd360 */ - *doy = 30*(month-1) + date->day + leap_add ; - } - return; -} - -/* Convert epochal time (hours since 00 jan 1, 1970) - * to human time (structured) - * - * Input: - * etime = epochal time representation - * timeType = time type (e.g., CdChron, CdClim, etc.) as defined in cdms.h - * baseYear = base real, used for relative time types only - * - * Output: htime = human (structured) time representation - * - * Derived from NRL Neons V3.6 - */ -void -Cde2h(double etime, CdTimeType timeType, long baseYear, CdTime *htime) -{ - long ytemp; /* temporary year holder */ - int yr_day_cnt; /* count of days in year */ - int doy; /* day of year */ - int daysInLeapYear; /* number of days in a leap year */ - int daysInYear; /* days in non-leap year */ - extern void CdMonthDay(int *doy, CdTime *date); - - doy = (long) floor(etime / 24.) + 1; - htime->hour = etime - (double) (doy - 1) * 24.; - - /* Correct for goofy floor func on J90 */ - if(htime->hour >= 24.){ - doy += 1; - htime->hour -= 24.; - } - - htime->baseYear = (timeType & CdBase1970) ? 1970 : baseYear; - if(!(timeType & CdChronCal)) htime->baseYear = 0; /* Set base year to 0 for Clim */ - if(timeType & Cd366) { - daysInLeapYear = 366; - daysInYear = 366; - } else { - daysInLeapYear = (timeType & Cd365) ? 366 : 360; - daysInYear = (timeType & Cd365) ? 365 : 360; - } - - if (doy > 0) { - for (ytemp = htime->baseYear; ; ytemp++) { - yr_day_cnt = ISLEAP(ytemp,timeType) ? daysInLeapYear : daysInYear; - if (doy <= yr_day_cnt) break; - doy -= yr_day_cnt; - } - } else { - for (ytemp = htime->baseYear-1; ; ytemp--) { - yr_day_cnt = ISLEAP(ytemp,timeType) ? daysInLeapYear : daysInYear; - doy += yr_day_cnt; - if (doy > 0) break; - } - } - htime->year = (timeType & CdBase1970) ? ytemp : (ytemp - htime->baseYear); - if(!(timeType & CdChronCal)) htime->year = 0; /* Set year to 0 for Clim */ - htime->timeType = timeType; - CdMonthDay(&doy,htime); - - return; -} - -/* Add 'nDel' times 'delTime' to epochal time 'begEtm', - * return the result in epochal time 'endEtm'. - */ -static void -CdAddDelTime(double begEtm, long nDel, CdDeltaTime delTime, CdTimeType timeType, - long baseYear, double *endEtm) -{ - double delHours; - long delMonths, delYears; - CdTime bhtime, ehtime; - - extern void Cde2h(double etime, CdTimeType timeType, long baseYear, CdTime *htime); - extern void Cdh2e(CdTime *htime, double *etime); - - switch(delTime.units){ - case CdYear: - delMonths = 12; - break; - case CdSeason: - delMonths = 3; - break; - case CdMonth: - delMonths = 1; - break; - case CdWeek: - delHours = 168.0; - break; - case CdDay: - delHours = 24.0; - break; - case CdHour: - delHours = 1.0; - break; - case CdMinute: - delHours = 1./60.; - break; - case CdSecond: - delHours = 1./3600.; - break; - default: - cdError("Invalid delta time units: %d\n",delTime.units); - return; - } - - switch(delTime.units){ - case CdYear: case CdSeason: case CdMonth: - Cde2h(begEtm,timeType,baseYear,&bhtime); - delMonths = delMonths * nDel * delTime.count + bhtime.month - 1; - delYears = (delMonths >= 0 ? (delMonths/12) : (delMonths+1)/12 - 1); - ehtime.year = bhtime.year + delYears; - ehtime.month = delMonths - (12 * delYears) + 1; - ehtime.day = 1; - ehtime.hour = 0.0; - ehtime.timeType = timeType; - ehtime.baseYear = !(timeType & CdChronCal) ? 0 : - (timeType & CdBase1970) ? 1970 : baseYear; /* base year is 0 for Clim, */ - /* 1970 for Chron, */ - /* or input base year for Rel */ - Cdh2e(&ehtime,endEtm); - break; - case CdWeek: case CdDay: case CdHour: case CdMinute: case CdSecond: - delHours *= (nDel * delTime.count); - *endEtm = begEtm + delHours; - break; - default: break; - } - return; -} - -/* Parse relative units, returning the unit and base component time. */ -/* Function returns 1 if error, 0 on success */ -int -cdParseRelunits(cdCalenType timetype, char* relunits, cdUnitTime* unit, cdCompTime* base_comptime) -{ - char charunits[CD_MAX_RELUNITS]; - char basetime_1[CD_MAX_CHARTIME]; - char basetime_2[CD_MAX_CHARTIME]; - char basetime[CD_MAX_CHARTIME]; - int nconv1, nconv2, nconv; - - /* Parse the relunits */ - /* Allow ISO-8601 "T" date-time separator as well as blank separator */ - nconv1 = sscanf(relunits,"%s since %[^T]T%s",charunits,basetime_1,basetime_2); - if(nconv1==EOF || nconv1==0){ - cdError("Error on relative units conversion, string = %s\n",relunits); - return 1; - } - nconv2 = sscanf(relunits,"%s since %s %s",charunits,basetime_1,basetime_2); - if(nconv2==EOF || nconv2==0){ - cdError("Error on relative units conversion, string = %s\n",relunits); - return 1; - } - if(nconv1 < nconv2) { - nconv = nconv2; - } else { - nconv = sscanf(relunits,"%s since %[^T]T%s",charunits,basetime_1,basetime_2); - } - /* Get the units */ - cdTrim(charunits,CD_MAX_RELUNITS); - if(!strncmp(charunits,"sec",3) || !strcmp(charunits,"s")){ - *unit = cdSecond; - } - else if(!strncmp(charunits,"min",3) || !strcmp(charunits,"mn")){ - *unit = cdMinute; - } - else if(!strncmp(charunits,"hour",4) || !strcmp(charunits,"hr")){ - *unit = cdHour; - } - else if(!strncmp(charunits,"day",3) || !strcmp(charunits,"dy")){ - *unit = cdDay; - } - else if(!strncmp(charunits,"week",4) || !strcmp(charunits,"wk")){ - *unit = cdWeek; - } - else if(!strncmp(charunits,"month",5) || !strcmp(charunits,"mo")){ - *unit = cdMonth; - } - else if(!strncmp(charunits,"season",6)){ - *unit = cdSeason; - } - else if(!strncmp(charunits,"year",4) || !strcmp(charunits,"yr")){ - if(!(timetype & cdStandardCal)){ - cdError("Error on relative units conversion: climatological units cannot be 'years'.\n"); - return 1; - } - *unit = cdYear; - } - else { - cdError("Error on relative units conversion: invalid units = %s\n",charunits); - return 1; - } - - /* Build the basetime, if any (default is 1979), */ - /* or month 1 for climatological time. */ - if(nconv == 1){ - if(timetype & cdStandardCal) - strcpy(basetime,CD_DEFAULT_BASEYEAR); - else - strcpy(basetime,"1"); - } - /* Convert the basetime to component, then epochal (hours since 1970) */ - else{ - if(nconv == 2){ - cdTrim(basetime_1,CD_MAX_CHARTIME); - strcpy(basetime,basetime_1); - } - else{ - cdTrim(basetime_1,CD_MAX_CHARTIME); - cdTrim(basetime_2,CD_MAX_CHARTIME); - sprintf(basetime,"%s %s",basetime_1,basetime_2); - } - } - - cdChar2Comp(timetype, basetime, base_comptime); - - return 0; -} - -/* ca - cb in Gregorian calendar */ -/* Result is in hours. */ -static double -cdDiffGregorian(cdCompTime ca, cdCompTime cb){ - - double rela, relb; - - cdComp2Rel(cdStandard, ca, "hours", &rela); - cdComp2Rel(cdStandard, cb, "hours", &relb); - return (rela - relb); -} - -/* Return -1, 0, 1 as ca is less than, equal to, */ -/* or greater than cb, respectively. */ -static int -cdCompCompare(cdCompTime ca, cdCompTime cb){ - - int test; - - if ((test = VALCMP(ca.year, cb.year))) - return test; - else if ((test = VALCMP(ca.month, cb.month))) - return test; - else if ((test = VALCMP(ca.day, cb.day))) - return test; - else - return (VALCMP(ca.hour, cb.hour)); -} - -/* ca - cb in Julian calendar. Result is in hours. */ -static double -cdDiffJulian(cdCompTime ca, cdCompTime cb){ - - double rela, relb; - - cdComp2Rel(cdJulian, ca, "hours", &rela); - cdComp2Rel(cdJulian, cb, "hours", &relb); - return (rela - relb); -} - -/* ca - cb in mixed Julian/Gregorian calendar. */ -/* Result is in hours. */ -static double -cdDiffMixed(cdCompTime ca, cdCompTime cb){ - - static cdCompTime ZA = {1582, 10, 5, 0.0}; - static cdCompTime ZB = {1582, 10, 15, 0.0}; - double result; - - if (cdCompCompare(cb, ZB) == -1){ - if (cdCompCompare(ca, ZB) == -1) { - result = cdDiffJulian(ca, cb); - } - else { - result = cdDiffGregorian(ca, ZB) + cdDiffJulian(ZA, cb); - } - } - else { - if (cdCompCompare(ca, ZB) == -1){ - result = cdDiffJulian(ca, ZA) + cdDiffGregorian(ZB, cb); - } - else { - result = cdDiffGregorian(ca, cb); - } - } - return result; -} - -/* Divide ('endEtm' - 'begEtm') by 'delTime', - * return the integer portion of the result in 'nDel'. - */ -static void -CdDivDelTime(double begEtm, double endEtm, CdDeltaTime delTime, CdTimeType timeType, - long baseYear, long *nDel) -{ - double delHours, frange; - long delMonths, range; - CdTime bhtime, ehtime; - int hoursInYear; - - extern void Cde2h(double etime, CdTimeType timeType, long baseYear, CdTime *htime); - - switch(delTime.units){ - case CdYear: - delMonths = 12; - break; - case CdSeason: - delMonths = 3; - break; - case CdMonth: - delMonths = 1; - break; - case CdWeek: - delHours = 168.0; - break; - case CdDay: - delHours = 24.0; - break; - case CdHour: - delHours = 1.0; - break; - case CdMinute: - delHours = 1./60.; - break; - case CdSecond: - delHours = 1./3600.; - break; - default: - cdError("Invalid delta time units: %d\n",delTime.units); - return; - } - - switch(delTime.units){ - case CdYear: case CdSeason: case CdMonth: - delMonths *= delTime.count; - Cde2h(begEtm,timeType,baseYear,&bhtime); - Cde2h(endEtm,timeType,baseYear,&ehtime); - if(timeType & CdChronCal){ /* Chron and Rel time */ - range = 12*(ehtime.year - bhtime.year) - + (ehtime.month - bhtime.month); - } - else{ /* Clim time, ignore year */ - range = (ehtime.month - bhtime.month); - if(range < 0) range += 12; - } - *nDel = abs(range)/delMonths; - break; - case CdWeek: case CdDay: case CdHour: case CdMinute: case CdSecond: - delHours *= (double)delTime.count; - if(timeType & CdChronCal){ /* Chron and Rel time */ - frange = fabs(endEtm - begEtm); - } - else{ /* Clim time, ignore year, but */ - /* wraparound relative to hours-in-year*/ - frange = endEtm - begEtm; - if(timeType & Cd366) { - hoursInYear = 8784; - } else { - hoursInYear = (timeType & Cd365) ? 8760. : 8640.; - } - /* Normalize frange to interval [0,hoursInYear) */ - if(frange < 0.0 || frange >= hoursInYear) - frange -= hoursInYear * floor(frange/hoursInYear); - } - *nDel = (frange + 1.e-10*delHours)/delHours; - break; - default: break; - } - return; -} - -/* Value is in hours. Translate to units. */ -static double -cdFromHours(double value, cdUnitTime unit){ - double result; - - switch(unit){ - case cdSecond: - result = value * 3600.0; - break; - case cdMinute: - result = value * 60.0; - break; - case cdHour: - result = value; - break; - case cdDay: - result = value/24.0; - break; - case cdWeek: - result = value/168.0; - break; - case cdMonth: - case cdSeason: - case cdYear: - case cdFraction: - default: - cdError("Error on conversion from hours to vague unit"); - result = 0; - break; - } - return result; -} - /* Map to old timetypes */ -static int -cdToOldTimetype(cdCalenType newtype, CdTimeType* oldtype) -{ - switch(newtype){ - case cdStandard: - *oldtype = CdChron; - break; - case cdJulian: - *oldtype = CdJulianCal; - break; - case cdNoLeap: - *oldtype = CdChronNoLeap; - break; - case cd360: - *oldtype = CdChron360; - break; - case cd366: - *oldtype = CdChron366; - break; - case cdClim: - *oldtype = CdClim; - break; - case cdClimLeap: - *oldtype = CdClimLeap; - break; - case cdClim360: - *oldtype = CdClim360; - break; - default: - cdError("Error on relative units conversion, invalid timetype = %d",newtype); - return 1; - } - return 0; -} - -/* Convert human time to epochal time (hours since 00 jan 1, 1970) - * - * Input: htime = human time representation - * - * Output: etime = epochal time representation - * - * Derived from NRL Neons V3.6 - */ -void -Cdh2e(CdTime *htime, double *etime) -{ - long ytemp, year; /* temporary year holder */ - int day_cnt; /* count of days */ - int doy; /* day of year */ - long baseYear; /* base year for epochal time */ - int daysInLeapYear; /* number of days in a leap year */ - int daysInYear; /* days in non-leap year */ - extern void CdDayOfYear(CdTime *date, int *doy); - - CdDayOfYear(htime,&doy); - - day_cnt = 0; - - baseYear = ((htime->timeType) & CdBase1970) ? 1970 : htime->baseYear; - year = ((htime->timeType) & CdBase1970) ? htime->year : (htime->year + htime->baseYear); - if(!((htime->timeType) & CdChronCal)) baseYear = year = 0; /* set year and baseYear to 0 for Clim */ - if((htime->timeType) & Cd366) { - daysInLeapYear = 366; - daysInYear = 366; - } else { - daysInLeapYear = ((htime->timeType) & Cd365) ? 366 : 360; - daysInYear = ((htime->timeType) & Cd365) ? 365 : 360; - } - - if (year > baseYear) { - for (ytemp = year - 1; ytemp >= baseYear; ytemp--) { - day_cnt += ISLEAP(ytemp,htime->timeType) ? daysInLeapYear : daysInYear; - } - } else if (year < baseYear) { - for (ytemp = year; ytemp < baseYear; ytemp++) { - day_cnt -= ISLEAP(ytemp,htime->timeType) ? daysInLeapYear : daysInYear; - } - } - *etime = (double) (day_cnt + doy - 1) * 24. + htime->hour; - return; -} - -/* Validate the component time, return 0 if valid, 1 if not */ -static int -cdValidateTime(cdCalenType timetype, cdCompTime comptime) -{ - if(comptime.month<1 || comptime.month>12){ - cdError("Error on time conversion: invalid month = %hd\n",comptime.month); - return 1; - } - if(comptime.day<1 || comptime.day>31){ - cdError("Error on time conversion: invalid day = %hd\n",comptime.day); - return 1; - } - if(comptime.hour<0.0 || comptime.hour>24.0){ - cdError("Error on time conversion: invalid hour = %lf\n",comptime.hour); - return 1; - } - return 0; -} - -void -cdChar2Comp(cdCalenType timetype, char* chartime, cdCompTime* comptime) -{ - double sec; - int ihr, imin, nconv; - long year; - short day; - short month; - - comptime->year = CD_NULL_YEAR; - comptime->month = CD_NULL_MONTH; - comptime->day = CD_NULL_DAY; - comptime->hour = CD_NULL_HOUR; - - if(timetype & cdStandardCal){ - nconv = sscanf(chartime,"%ld-%hd-%hd %d:%d:%lf",&year,&month,&day,&ihr,&imin,&sec); - if(nconv==EOF || nconv==0){ - cdError("Error on character time conversion, string = %s\n",chartime); - return; - } - if(nconv >= 1){ - comptime->year = year; - } - if(nconv >= 2){ - comptime->month = month; - } - if(nconv >= 3){ - comptime->day = day; - } - if(nconv >= 4){ - if(ihr<0 || ihr>23){ - cdError("Error on character time conversion: invalid hour = %d\n",ihr); - return; - } - comptime->hour = (double)ihr; - } - if(nconv >= 5){ - if(imin<0 || imin>59){ - cdError("Error on character time conversion: invalid minute = %d\n",imin); - return; - } - comptime->hour += (double)imin/60.; - } - if(nconv >= 6){ - if(sec<0.0 || sec>60.0){ - cdError("Error on character time conversion: invalid second = %lf\n",sec); - return; - } - comptime->hour += sec/3600.; - } - } - else{ /* Climatological */ - nconv = sscanf(chartime,"%hd-%hd %d:%d:%lf",&month,&day,&ihr,&imin,&sec); - if(nconv==EOF || nconv==0){ - cdError("Error on character time conversion, string = %s",chartime); - return; - } - if(nconv >= 1){ - comptime->month = month; - } - if(nconv >= 2){ - comptime->day = day; - } - if(nconv >= 3){ - if(ihr<0 || ihr>23){ - cdError("Error on character time conversion: invalid hour = %d\n",ihr); - return; - } - comptime->hour = (double)ihr; - } - if(nconv >= 4){ - if(imin<0 || imin>59){ - cdError("Error on character time conversion: invalid minute = %d\n",imin); - return; - } - comptime->hour += (double)imin/60.; - } - if(nconv >= 5){ - if(sec<0.0 || sec>60.0){ - cdError("Error on character time conversion: invalid second = %lf\n",sec); - return; - } - comptime->hour += sec/3600.; - } - } - (void)cdValidateTime(timetype,*comptime); - return; -} - -/* Convert ct to relunits (unit, basetime) */ -/* in the mixed Julian/Gregorian calendar. */ -/* unit is anything but year, season, month. unit and basetime are */ -/* from the parsed relunits. Return result in reltime. */ -static void -cdComp2RelMixed(cdCompTime ct, cdUnitTime unit, cdCompTime basetime, double *reltime){ - - double hourdiff; - - hourdiff = cdDiffMixed(ct, basetime); - *reltime = cdFromHours(hourdiff, unit); - return; -} - -static void -cdComp2Rel(cdCalenType timetype, cdCompTime comptime, char* relunits, double* reltime) -{ - cdCompTime base_comptime; - CdDeltaTime deltime; - CdTime humantime; - CdTimeType old_timetype; - cdUnitTime unit; - double base_etm, etm, delta; - long ndel, hoursInYear; - - /* Parse the relunits */ - if(cdParseRelunits(timetype, relunits, &unit, &base_comptime)) - return; - - /* Handle mixed Julian/Gregorian calendar */ - if (timetype == cdMixed){ - switch(unit){ - case cdWeek: case cdDay: case cdHour: case cdMinute: case cdSecond: - cdComp2RelMixed(comptime, unit, base_comptime, reltime); - return; - case cdYear: case cdSeason: case cdMonth: - timetype = cdStandard; - break; - case cdFraction: - cdError("invalid unit in conversion"); - break; - default: break; - } - } - - /* Convert basetime to epochal */ - humantime.year = base_comptime.year; - humantime.month = base_comptime.month; - humantime.day = base_comptime.day; - humantime.hour = base_comptime.hour; - humantime.baseYear = 1970; - /* Map to old-style timetype */ - if(cdToOldTimetype(timetype,&old_timetype)) - return; - humantime.timeType = old_timetype; - Cdh2e(&humantime,&base_etm); - - /* Map end time to epochal */ - humantime.year = comptime.year; - humantime.month = comptime.month; - humantime.day = comptime.day; - humantime.hour = comptime.hour; - Cdh2e(&humantime,&etm); - /* Calculate relative time value for months or hours */ - deltime.count = 1; - deltime.units = (CdTimeUnit)unit; - switch(unit){ - case cdWeek: case cdDay: case cdHour: case cdMinute: case cdSecond: - delta = etm - base_etm; - if(!(timetype & cdStandardCal)){ /* Climatological time */ - hoursInYear = (timetype & cd365Days) ? 8760. : (timetype & cdHasLeap) ? 8784. : 8640.; - /* Normalize delta to interval [0,hoursInYear) */ - if(delta < 0.0 || delta >= hoursInYear) - delta -= hoursInYear * floor(delta/hoursInYear); - } - break; - case cdYear: case cdSeason: case cdMonth: - CdDivDelTime(base_etm, etm, deltime, old_timetype, 1970, &ndel); - break; - case cdFraction: - cdError("invalid unit in conversion"); - break; - default: break; - } - - /* Convert to output units */ - switch(unit){ - case cdSecond: - *reltime = 3600.0 * delta; - break; - case cdMinute: - *reltime = 60.0 * delta; - break; - case cdHour: - *reltime = delta; - break; - case cdDay: - *reltime = delta/24.0; - break; - case cdWeek: - *reltime = delta/168.0; - break; - case cdMonth: case cdSeason: case cdYear: /* Already in correct units */ - if(timetype & cdStandardCal) - *reltime = (base_etm <= etm) ? (double)ndel : (double)(-ndel); - else /* Climatological time is already normalized*/ - *reltime = (double)ndel; - break; - default: - cdError("invalid unit in conversion"); - break; - } - - return; -} - -/* Add (value,unit) to comptime. */ -/* value is in hours. */ -/* calendar is anything but cdMixed. */ -static void -cdCompAdd(cdCompTime comptime, double value, cdCalenType calendar, cdCompTime *result){ - - double reltime; - - cdComp2Rel(calendar, comptime, "hours", &reltime); - reltime += value; - cdRel2Comp(calendar, "hours", reltime, result); - return; -} - -/* Add value in hours to ct, in the mixed Julian/Gregorian - * calendar. */ -static void -cdCompAddMixed(cdCompTime ct, double value, cdCompTime *result){ - - static cdCompTime ZA = {1582, 10, 5, 0.0}; - static cdCompTime ZB = {1582, 10, 15, 0.0}; - double xj, xg; - - if (cdCompCompare(ct, ZB) == -1){ - xj = cdDiffJulian(ZA, ct); - if (value <= xj){ - cdCompAdd(ct, value, cdJulian, result); - } - else { - cdCompAdd(ZB, value-xj, cdStandard, result); - } - } - else { - xg = cdDiffGregorian(ZB, ct); - if (value > xg){ - cdCompAdd(ct, value, cdStandard, result); - } - else { - cdCompAdd(ZA, value-xg, cdJulian, result); - } - } - return; -} - -/* Return value expressed in hours. */ -static double -cdToHours(double value, cdUnitTime unit){ - - double result = 0; - - switch(unit){ - case cdSecond: - result = value/3600.0; - break; - case cdMinute: - result = value/60.0; - break; - case cdHour: - result = value; - break; - case cdDay: - result = 24.0 * value; - break; - case cdWeek: - result = 168.0 * value; - break; - default: - cdError("invalid unit in conversion"); - break; - - } - return result; -} - -/* Convert relative time (reltime, unit, basetime) to comptime in the - * mixed Julian/Gregorian calendar. unit is anything but year, season, - * month. unit and basetime are from the parsed relunits. Return - * result in comptime. */ -static void -cdRel2CompMixed(double reltime, cdUnitTime unit, cdCompTime basetime, cdCompTime *comptime){ - - reltime = cdToHours(reltime, unit); - cdCompAddMixed(basetime, reltime, comptime); - return; -} - - -static void -cdRel2Comp(cdCalenType timetype, char* relunits, double reltime, cdCompTime* comptime) -{ - CdDeltaTime deltime; - CdTime humantime; - CdTimeType old_timetype; - cdCompTime base_comptime; - cdUnitTime unit, baseunits; - double base_etm, result_etm; - double delta; - long idelta; - - /* Parse the relunits */ - if(cdParseRelunits(timetype, relunits, &unit, &base_comptime)) - return; - - if (timetype == cdMixed){ - switch(unit){ - case cdWeek: case cdDay: case cdHour: case cdMinute: case cdSecond: - cdRel2CompMixed(reltime, unit, base_comptime, comptime); - return; - case cdYear: case cdSeason: case cdMonth: - timetype = cdStandard; - break; - case cdFraction: - cdError("invalid unit in conversion"); - break; - default: break; - } - } - - baseunits =cdBadUnit; - switch(unit){ - case cdSecond: - delta = reltime/3600.0; - baseunits = cdHour; - break; - case cdMinute: - delta = reltime/60.0; - baseunits = cdHour; - break; - case cdHour: - delta = reltime; - baseunits = cdHour; - break; - case cdDay: - delta = 24.0 * reltime; - baseunits = cdHour; - break; - case cdWeek: - delta = 168.0 * reltime; - baseunits = cdHour; - break; - case cdMonth: - idelta = (long)(reltime + (reltime<0 ? -1.e-10 : 1.e-10)); - baseunits = cdMonth; - break; - case cdSeason: - idelta = (long)(3.0 * reltime + (reltime<0 ? -1.e-10 : 1.e-10)); - baseunits = cdMonth; - break; - case cdYear: - idelta = (long)(12 * reltime + (reltime<0 ? -1.e-10 : 1.e-10)); - baseunits = cdMonth; - break; - default: - cdError("invalid unit in conversion"); - break; - } - - deltime.count = 1; - deltime.units = (CdTimeUnit)baseunits; - - humantime.year = base_comptime.year; - humantime.month = base_comptime.month; - humantime.day = base_comptime.day; - humantime.hour = base_comptime.hour; - humantime.baseYear = 1970; - /* Map to old-style timetype */ - if(cdToOldTimetype(timetype,&old_timetype)) - return; - humantime.timeType = old_timetype; - - Cdh2e(&humantime,&base_etm); - /* If months, seasons, or years, */ - if(baseunits == cdMonth){ - - /* Calculate new epochal time from integer months. */ - /* Convert back to human, then comptime. */ - /* For zero reltime, just return the basetime*/ - if(reltime != 0.0){ - CdAddDelTime(base_etm,idelta,deltime,old_timetype,1970,&result_etm); - Cde2h(result_etm, old_timetype, 1970, &humantime); - } - } - /* Calculate new epochal time. */ - /* Convert back to human, then comptime. */ - else if(baseunits == cdHour){ - Cde2h(base_etm+delta, old_timetype, 1970, &humantime); - - } - comptime->year = humantime.year; - comptime->month = humantime.month; - comptime->day = humantime.day; - comptime->hour = humantime.hour; - - return; -} - -/* rkr: output as ISO 8601 strings */ -static void -cdComp2Iso(cdCalenType timetype, int separator, cdCompTime comptime, char* time) -{ - double dtmp, sec; - int ihr, imin, isec; - int nskip; - - if(cdValidateTime(timetype,comptime)) - return; - - ihr = (int)comptime.hour; - dtmp = 60.0 * (comptime.hour - (double)ihr); - imin = (int)dtmp; - sec = 60.0 * (dtmp - (double)imin); - isec = sec; - - if(sec == isec) - if(isec == 0) - if(imin == 0) - if(ihr == 0) - nskip = 4; - else - nskip = 3; - else - nskip = 2; - else - nskip = 1; - else - nskip = 0; - - if(timetype & cdStandardCal){ - switch (nskip) { - case 0: /* sec != 0 && (int)sec != sec */ - sprintf(time,"%4.4ld-%2.2hd-%2.2hd%c%2.2d:%2.2d:%lf", - comptime.year,comptime.month,comptime.day,separator,ihr,imin,sec); - break; - case 1: - sprintf(time,"%4.4ld-%2.2hd-%2.2hd%c%2.2d:%2.2d:%2.2d", - comptime.year,comptime.month,comptime.day,separator,ihr,imin,isec); - break; - case 2: - sprintf(time,"%4.4ld-%2.2hd-%2.2hd%c%2.2d:%2.2d", - comptime.year,comptime.month,comptime.day,separator,ihr,imin); - break; - case 3: - sprintf(time,"%4.4ld-%2.2hd-%2.2hd%c%2.2d", - comptime.year,comptime.month,comptime.day,separator,ihr); - break; - case 4: - sprintf(time,"%4.4ld-%2.2hd-%2.2hd", - comptime.year,comptime.month,comptime.day); - break; - } - } - else { /* Climatological */ - switch (nskip) { - case 0: /* sec != 0 && (int)sec != sec */ - sprintf(time,"%2.2hd-%2.2hd%c%2.2d:%2.2d:%lf", - comptime.month,comptime.day,separator,ihr,imin,sec); - break; - case 1: - sprintf(time,"%2.2hd-%2.2hd%c%2.2d:%2.2d:%2.2d", - comptime.month,comptime.day,separator,ihr,imin,isec); - break; - case 2: - sprintf(time,"%2.2hd-%2.2hd%c%2.2d:%2.2d", - comptime.month,comptime.day,separator,ihr,imin); - break; - case 3: - sprintf(time,"%2.2hd-%2.2hd%c%2.2d", - comptime.month,comptime.day,separator,ihr); - break; - case 4: - sprintf(time,"%2.2hd-%2.2hd", - comptime.month,comptime.day); - break; - } - } - return; -} - -/* rkr: added for output closer to ISO 8601 */ -void -cdRel2Iso(cdCalenType timetype, char* relunits, int separator, double reltime, char* chartime) -{ - cdCompTime comptime; - - cdRel2Comp(timetype, relunits, reltime, &comptime); - cdComp2Iso(timetype, separator, comptime, chartime); - - return; -} diff --git a/xios_2311_src/trunk/.svn/pristine/3a/3a6bc485d83aa19ad9d473d26d3c858faa86391f.svn-base b/xios_2311_src/trunk/.svn/pristine/3a/3a6bc485d83aa19ad9d473d26d3c858faa86391f.svn-base deleted file mode 100644 index 27983fb0c52580bc975940b683c50b5186b1bfe6..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/3a/3a6bc485d83aa19ad9d473d26d3c858faa86391f.svn-base +++ /dev/null @@ -1,757 +0,0 @@ -/* Copyright 2009, UCAR/Unidata and OPeNDAP, Inc. - See the COPYRIGHT file for more information. */ - -#include "config.h" -#include "ocinternal.h" -#include "ocdebug.h" - -static const unsigned int MAX_UINT = 0xffffffff; - -static OCerror occomputeskipdatar(OCstate*, OCnode*, ocoffset_t offset); -static int mergedas1(OCnode* dds, OCnode* das); -static int converttype(OCtype etype, char* value, char* memory); -static char* pathtostring(OClist* path, char* separator, int usecdfname); -static void computefullname(OCnode* node); - -/* Process ocnodes to fix various semantic issues*/ -void -occomputesemantics(OClist* ocnodes) -{ - unsigned int i; - OCASSERT((ocnodes != NULL)); - for(i=0;ioctype == OC_Dimension && node->dim.array != NULL) { - node->container = node->dim.array->container; - } - } -} - -void -occomputefullnames(OCnode* root) -{ - unsigned int i; - if(root->name != NULL) computefullname(root); - if(root->subnodes != NULL) { /* recurse*/ - for(i=0;isubnodes);i++) { - OCnode* node = (OCnode*)oclistget(root->subnodes,i); - occomputefullnames(node); - } - } -} - -static void -computefullname(OCnode* node) -{ - char* tmp; - char* fullname; - OClist* path; - - OCASSERT((node->name != NULL)); - path = oclistnew(); - occollectpathtonode(node,path); - tmp = pathtostring(path,PATHSEPARATOR,1); - if(tmp == NULL) { - fullname = nulldup(node->name); - } else { - fullname = tmp; - } - node->fullname = fullname; - oclistfree(path); -} - -/* Convert path to a string; leave off the dataset name*/ -static char* -pathtostring(OClist* path, char* separator, int usecdfname) -{ - int slen,i,len; - char* pathname; - if(path == NULL || (len = oclistlength(path))==0) return NULL; - for(slen=0,i=0;icontainer == NULL || node->name == NULL) continue; - slen += strlen(node->name); - } - slen += ((len-1)*strlen(separator)); - slen += 1; /* for null terminator*/ - pathname = (char*)ocmalloc(slen); - MEMCHECK(pathname,NULL); - pathname[0] = '\0'; - for(i=0;icontainer == NULL || node->name == NULL) continue; - if(strlen(pathname) > 0) strcat(pathname,separator); - strcat(pathname,node->name); - } - return pathname; -} - -/* Collect the set of nodes ending in "node"*/ -void -occollectpathtonode(OCnode* node, OClist* path) -{ - if(node == NULL) return; - occollectpathtonode(node->container,path); - oclistpush(path,(ocelem)node); -} - -OCnode* -ocmakenode(char* name, OCtype ptype, OCnode* root) -{ - OCnode* cdf = (OCnode*)ocmalloc(sizeof(OCnode)); - MEMCHECK(cdf,(OCnode*)NULL); - memset((void*)cdf,0,sizeof(OCnode)); - cdf->magic = OCMAGIC; - cdf->name = (name?nulldup(name):NULL); - cdf->octype = ptype; - cdf->array.dimensions = NULL; - cdf->root = root; - return cdf; -} - -OCattribute* -makeattribute(char* name, OCtype ptype, OClist* values) -{ - OCattribute* att = (OCattribute*)ocmalloc(sizeof(OCattribute)); /* ocmalloc zeros*/ - MEMCHECK(att,(OCattribute*)NULL); - att->name = nulldup(name); - att->etype = ptype; - att->nvalues = oclistlength(values); - att->values = NULL; - if(att->nvalues > 0) { - int i; - att->values = (char**)ocmalloc(sizeof(char*)*att->nvalues); - for(i=0;invalues;i++) - att->values[i] = nulldup((char*)oclistget(values,i)); - } - return att; -} - -static void -marklostattribute(OCnode* att) -{ - oc_log(LOGWARN,"Lost attribute: %s",att->name); -} - -void* -oclinearize(OCtype etype, unsigned int nstrings, char** strings) -{ - int i; - size_t typesize; - char* memp; - char* memory; - - if(nstrings == 0) return NULL; - typesize = octypesize(etype); - memory = (char*)ocmalloc(nstrings*typesize); - MEMCHECK(memory,NULL); - memp = memory; - for(i=0;i OC_BYTE_MAX || iv < OC_BYTE_MIN) {iv = OC_BYTE_MAX; outofrange = 1;} - *((signed char*)memory) = (signed char)iv; - break; - case OC_UByte: - if(sscanf(value,"%lu",&uiv) != 1) goto fail; - else if(uiv > OC_UBYTE_MAX) {uiv = OC_UBYTE_MAX; outofrange = 1;} - *((unsigned char*)memory) = (unsigned char)uiv; - break; - case OC_Int16: - if(sscanf(value,"%ld",&iv) != 1) goto fail; - else if(iv > OC_INT16_MAX || iv < OC_INT16_MIN) {iv = OC_INT16_MAX; outofrange = 1;} - *((signed short*)memory) = (signed short)iv; - break; - case OC_UInt16: - if(sscanf(value,"%lu",&uiv) != 1) goto fail; - else if(uiv > OC_UINT16_MAX) {uiv = OC_UINT16_MAX; outofrange = 1;} - *((unsigned short*)memory) = (unsigned short)uiv; - break; - case OC_Int32: - if(sscanf(value,"%ld",&iv) != 1) goto fail; - else if(iv > OC_INT32_MAX || iv < OC_INT32_MIN) {iv = OC_INT32_MAX; outofrange = 1;} - *((signed int*)memory) = (signed int)iv; - break; - case OC_UInt32: - if(sscanf(value,"%lu",&uiv) != 1) goto fail; - else if(uiv > OC_UINT32_MAX) {uiv = OC_UINT32_MAX; outofrange = 1;} - *((unsigned char*)memory) = (unsigned int)uiv; - break; -#ifdef HAVE_LONG_LONG_INT - case OC_Int64: - if(sscanf(value,"%lld",&llv) != 1) goto fail; - /*else if(iv > OC_INT64_MAX || iv < OC_INT64_MIN) goto fail;*/ - *((signed long long*)memory) = (signed long long)llv; - break; - case OC_UInt64: - if(sscanf(value,"%llu",&ullv) != 1) goto fail; - *((unsigned long long*)memory) = (unsigned long long)ullv; - break; -#endif - case OC_Float32: - if(sscanf(value,"%lf",&dv) != 1) goto fail; - *((float*)memory) = (float)dv; - break; - case OC_Float64: - if(sscanf(value,"%lf",&dv) != 1) goto fail; - *((double*)memory) = (double)dv; - break; - case OC_String: case OC_URL: - *((char**)memory) = nulldup(value); - break; - default: - goto fail; - } - if(outofrange) - oc_log(LOGWARN,"converttype range failure: %d: %s",etype,value); - return 1; -fail: - oc_log(LOGERR,"converttype bad value: %d: %s",etype,value); - return 0; -} - - -void -ocfreeroot(OCnode* root) -{ - OCtree* tree; - OCstate* state; - int i; - - if(root == NULL || root->tree == NULL) return; - - tree = root->tree; - /* Remove the root from the state->trees list */ - state = tree->state; - for(i=0;itrees);i++) { - OCnode* node = (OCnode*)oclistget(state->trees,i); - if(root == node) - oclistremove(state->trees,i); - } - /* Note: it is ok if state->trees does not contain this root */ - ocfreetree(tree); -} - -void -ocfreetree(OCtree* tree) -{ - if(tree == NULL) return; - ocfreenodes(tree->nodes); - ocfree(tree->constraint); - ocfree(tree->text); - if(tree->data.xdrs != NULL) { - xxdr_free(tree->data.xdrs); - } - ocfree(tree->data.filename); /* may be null */ - if(tree->data.file != NULL) fclose(tree->data.file); - ocfree(tree->data.memory); - ocfree(tree); -} - -void -ocfreenodes(OClist* nodes) -{ - unsigned int i,j; - for(i=0;iname); - ocfree(node->fullname); - while(oclistlength(node->att.values) > 0) { - char* value = (char*)oclistpop(node->att.values); - ocfree(value); - } - while(oclistlength(node->attributes) > 0) { - OCattribute* attr = (OCattribute*)oclistpop(node->attributes); - ocfree(attr->name); - /* If the attribute type is string, then we need to free them*/ - if(attr->etype == OC_String || attr->etype == OC_URL) { - char** strings = (char**)attr->values; - for(j=0;jnvalues;j++) {ocfree(*strings); strings++;} - } - ocfree(attr->values); - ocfree(attr); - } - if(node->array.dimensions != NULL) oclistfree(node->array.dimensions); - if(node->subnodes != NULL) oclistfree(node->subnodes); - if(node->att.values != NULL) oclistfree(node->att.values); - if(node->attributes != NULL) oclistfree(node->attributes); - ocfree(node); - } - oclistfree(nodes); -} - -/* -In order to be as compatible as possible with libdap, -we try to use the same algorithm for DAS->DDS matching. -As described there, the algorithm is as follows. - If the [attribute] name contains one or - more field separators then look for a [DDS]variable whose - name matches exactly. If the name contains no field separators then - the look first in the top level [of the DDS] and then in all subsequent - levels and return the first occurrence found. In general, this - searches constructor types in the order in which they appear - in the DDS, but there is no requirement that it do so. - - Note: If a dataset contains two constructor types which have field names - that are the same (say point.x and pair.x) one should use fully qualified - names to get each of those variables. -*/ - -int -ocddsdasmerge(OCstate* state, OCnode* dasroot, OCnode* ddsroot) -{ - OClist* dasglobals = oclistnew(); - OClist* dasnodes = oclistnew(); - OClist* varnodes = oclistnew(); - OClist* ddsnodes; - unsigned int i,j; - - if(dasroot->tree == NULL || dasroot->tree->dxdclass != OCDAS) - return OCTHROW(OC_EINVAL); - if(ddsroot->tree == NULL || (ddsroot->tree->dxdclass != OCDDS - && ddsroot->tree->dxdclass != OCDATADDS)) - return OCTHROW(OC_EINVAL); - - ddsnodes = ddsroot->tree->nodes; - - /* 1. collect all the relevant DAS nodes; - namely those that contain at least one - attribute value. - Simultaneously look for potential ambiguities - if found; complain but continue: result are indeterminate. - also collect globals separately*/ - for(i=0;itree->nodes);i++) { - OCnode* das = (OCnode*)oclistget(dasroot->tree->nodes,i); - int hasattributes = 0; - if(das->octype == OC_Attribute) continue; /* ignore these for now*/ - if(das->name == NULL || das->att.isglobal) { - oclistpush(dasglobals,(ocelem)das); - continue; - } - for(j=0;jsubnodes);j++) { - OCnode* subnode = (OCnode*)oclistget(das->subnodes,j); - if(subnode->octype == OC_Attribute) {hasattributes = 1; break;} - } - if(hasattributes) { - /* Look for previously collected nodes with same name*/ - for(j=0;jname == NULL || das2->name == NULL) continue; - if(strcmp(das->name,das2->name)==0) { - oc_log(LOGWARN,"oc_mergedas: potentially ambiguous DAS name: %s",das->name); - } - } - oclistpush(dasnodes,(ocelem)das); - } - } - - /* 2. collect all the leaf DDS nodes (of type OC_Primitive)*/ - for(i=0;ioctype == OC_Primitive) oclistpush(varnodes,(ocelem)dds); - } - - /* 3. For each das node, locate matching DDS node(s) and attach - attributes to the DDS node(s). - Match means: - 1. DAS->fullname :: DDS->fullname - 2. DAS->name :: DDS->fullname (support DAS names with embedded '.' - 3. DAS->name :: DDS->name - */ - for(i=0;ifullname,dds->fullname)==0 - || strcmp(das->name,dds->fullname)==0 - || strcmp(das->name,dds->name)==0) { - mergedas1(dds,das); - /* remove from dasnodes list*/ - oclistset(dasnodes,i,(ocelem)NULL); - } - } - } - - /* 4. If there are attributes left, then complain about them being lost.*/ - for(i=0;iattributes == NULL) dds->attributes = oclistnew(); - /* assign the simple attributes in the das set to this dds node*/ - for(i=0;isubnodes);i++) { - OCnode* attnode = (OCnode*)oclistget(das->subnodes,i); - if(attnode->octype == OC_Attribute) { - OCattribute* att = makeattribute(attnode->name, - attnode->etype, - attnode->att.values); - oclistpush(dds->attributes,(ocelem)att); - } - } - return OCTHROW(stat); -} - - - -#ifdef OCIGNORE - -int -ocddsdasmerge(OCstate* state, OCnode* ddsroot, OCnode* dasroot) -{ - int i,j; - int stat = OC_NOERR; - OClist* globals = oclistnew(); - if(dasroot == NULL) return OCTHROW(stat); - /* Start by looking for global attributes*/ - for(i=0;isubnodes);i++) { - OCnode* node = (OCnode*)oclistget(dasroot->subnodes,i); - if(node->att.isglobal) { - for(j=0;jsubnodes);j++) { - OCnode* attnode = (OCnode*)oclistget(node->subnodes,j); - Attribute* att = makeattribute(attnode->name, - attnode->etype, - attnode->att.values); - oclistpush(globals,(ocelem)att); - } - } - } - ddsroot->attributes = globals; - /* Now try to match subnode names with attribute set names*/ - for(i=0;isubnodes);i++) { - OCnode* das = (OCnode*)oclistget(dasroot->subnodes,i); - int match = 0; - if(das->att.isglobal) continue; - if(das->octype == OC_Attributeset) { - for(j=0;jsubnodes) && !match;j++) { - OCnode* dds = (OCnode*)oclistget(ddsroot->subnodes,j); - if(strcmp(das->name,dds->name) == 0) { - match = 1; - stat = mergedas1(dds,das); - if(stat != OC_NOERR) break; - } - } - } - if(!match) {marklostattribute(das);} - } - if(stat == OC_NOERR) ddsroot->attributed = 1; - return OCTHROW(stat); -} - -/* Merge das attributes into the dds node*/ - -static int -mergedas1(OCnode* dds, OCnode* das) -{ - int i,j; - int stat = OC_NOERR; - if(dds->attributes == NULL) dds->attributes = oclistnew(); - /* assign the simple attributes in the das set to this dds node*/ - for(i=0;isubnodes);i++) { - OCnode* attnode = (OCnode*)oclistget(das->subnodes,i); - if(attnode->octype == OC_Attribute) { - Attribute* att = makeattribute(attnode->name, - attnode->etype, - attnode->att.values); - oclistpush(dds->attributes,(ocelem)att); - } - } - /* Try to merge any enclosed sets with subnodes of dds*/ - for(i=0;isubnodes);i++) { - OCnode* dasnode = (OCnode*)oclistget(das->subnodes,i); - int match = 0; - if(dasnode->octype == OC_Attribute) continue; /* already dealt with above*/ - for(j=0;jsubnodes) && !match;j++) { - OCnode* ddsnode = (OCnode*)oclistget(dds->subnodes,j); - if(strcmp(dasnode->name,ddsnode->name) == 0) { - match = 1; - stat = mergedas1(ddsnode,dasnode); - if(stat != OC_NOERR) break; - } - } - if(!match) {marklostattribute(dasnode);} - } - return OCTHROW(stat); -} -#endif - -static void -ocuncorrelate(OCnode* root) -{ - OCtree* tree = root->tree; - unsigned int i; - if(tree == NULL) return; - for(i=0;inodes);i++) { - OCnode* node = (OCnode*)oclistget(tree->nodes,i); - node->datadds = NULL; - } -} - -static OCerror -occorrelater(OCnode* dds, OCnode* dxd) -{ - int i,j; - OCerror ocstat = OC_NOERR; - - if(dds->octype != dxd->octype) { - OCTHROWCHK((ocstat = OC_EINVAL)); goto fail; - } - if(dxd->name != NULL && dxd->name != NULL - && strcmp(dxd->name,dds->name) != 0) { - OCTHROWCHK((ocstat = OC_EINVAL)); goto fail; - } else if(dxd->name != dxd->name) { /* test NULL==NULL */ - OCTHROWCHK((ocstat = OC_EINVAL)); goto fail; - } - - if(dxd->array.rank != dds->array.rank) { - OCTHROWCHK((ocstat = OC_EINVAL)); goto fail; - } - - dds->datadds = dxd; - - switch (dds->octype) { - case OC_Dataset: - case OC_Structure: - case OC_Grid: - case OC_Sequence: - /* Remember: there may be fewer datadds fields than dds fields */ - for(i=0;isubnodes);i++) { - OCnode* dxd1 = (OCnode*)oclistget(dxd->subnodes,i); - for(j=0;jsubnodes);j++) { - OCnode* dds1 = (OCnode*)oclistget(dds->subnodes,j); - if(strcmp(dxd1->name,dds1->name) == 0) { - ocstat = occorrelater(dds1,dxd1); - if(ocstat != OC_NOERR) {OCTHROWCHK(ocstat); goto fail;} - break; - } - } - } - break; - case OC_Dimension: - case OC_Primitive: - break; - default: OCPANIC1("unexpected node type: %d",dds->octype); - } - /* Correlate the dimensions */ - if(dds->array.rank > 0) { - for(i=0;isubnodes);i++) { - OCnode* ddsdim = (OCnode*)oclistget(dds->array.dimensions,i); - OCnode* dxddim = (OCnode*)oclistget(dxd->array.dimensions,i); - ocstat = occorrelater(ddsdim,dxddim); - if(!ocstat) goto fail; - } - } - -fail: - return OCTHROW(ocstat); - -} - -OCerror -occorrelate(OCnode* dds, OCnode* dxd) -{ - if(dds == NULL || dxd == NULL) return OC_EINVAL; - ocuncorrelate(dds); - return occorrelater(dds,dxd); -} - -/* -Mark cacheable those primitive String/URL typed nodes -that are contained only in structures with rank > 0. -*/ -void -ocmarkcacheable(OCstate* state, OCnode* ddsroot) -{ - int i,j; -#ifdef OCIGNORE - int ok; -#endif - OClist* treenodes = ddsroot->tree->nodes; - OClist* path = oclistnew(); - for(i=0;ioctype != OC_Primitive) continue; - if(node->etype != OC_String && node->etype != OC_URL) continue; - /* collect node path */ - oclistclear(path); - occollectpathtonode(node,path); -#ifdef OCIGNORE - ok = 1; -#endif - for(j=1;joctype != OC_Structure - || pathnode->array.rank > 0) { -#ifdef OCIGNORE - ok=0; -#endif - break; - } - } -#ifdef OCIGNORE - if(ok) { - node->cache.cacheable = 1; - node->cache.valid = 0; - } -#endif - } - oclistfree(path); -} - - -/* -Fill in the OCnode.skip fields -*/ -OCerror -occomputeskipdata(OCstate* state, OCnode* ddsroot) -{ - OCerror stat = OC_NOERR; - OCASSERT(ddsroot->octype == OC_Dataset); - stat = occomputeskipdatar(state,ddsroot,0); - return stat; -} - -/* Recursive helper for computeskipdata */ -static OCerror -occomputeskipdatar(OCstate* state, OCnode* xnode, ocoffset_t offset) -{ - OCerror stat = OC_NOERR; - int i,nfields; - int scalar = 0; - ocoffset_t instancesize = 0; - ocoffset_t totalsize = 0; - - scalar = (xnode->array.rank == 0 ? 1 : 0); - - /* Set skip count and offset*/ - if(xnode->octype == OC_Sequence) - xnode->skip.count = OCINDETERMINATE; - else - xnode->skip.count = totaldimsize(xnode); - - xnode->skip.offset = offset; /* possibly overridden below */ - - switch (xnode->octype) { - - case OC_Primitive: - switch(xnode->etype) { - case OC_String: case OC_URL: - instancesize = OCINDETERMINATE; - totalsize = OCINDETERMINATE; - break; - case OC_Char: case OC_Byte: case OC_UByte: - if(!scalar) {/*=>packed*/ - instancesize = octypesize(xnode->etype); - totalsize = instancesize * xnode->skip.count; - totalsize = RNDUP(totalsize); - totalsize += 2*XDRUNIT; /* overhead is double count */ - break; - } - /* !packed => singleton char object */ - /* fall thru */ - case OC_Int16: case OC_UInt16: - case OC_Int32: case OC_UInt32: - case OC_Int64: case OC_UInt64: - case OC_Float32: case OC_Float64: - instancesize = octypesize(xnode->etype); - instancesize = RNDUP(instancesize); /* make multiple of XDRUNIT */ - totalsize = (instancesize*xnode->skip.count); /* overhead is double count */ - if(!scalar) - totalsize += 2*XDRUNIT; /* overhead is double count */ - break; - - default: - OCPANIC("unexpected etype"); /* better not happen */ - } - break; - - case OC_Sequence: - offset = (xnode->skip.offset = OCINDETERMINATE); /* do not know field offsets for arbitrary record */ - case OC_Dataset: - case OC_Grid: - case OC_Structure: - /* Compute size of each field and sum */ - nfields = oclistlength(xnode->subnodes); - instancesize = 0; /* of structure as a whole */ - for(i=0;isubnodes,i); - ocoffset_t fieldsize; - if(offset == OCINDETERMINATE || instancesize == OCINDETERMINATE) - stat = occomputeskipdatar(state,subnode,OCINDETERMINATE); - else - stat = occomputeskipdatar(state,subnode,offset+instancesize); - if(stat != OC_NOERR) goto done; - fieldsize = subnode->skip.totalsize; - if(instancesize == OCINDETERMINATE || fieldsize == OCINDETERMINATE) - instancesize = OCINDETERMINATE; - else - instancesize += fieldsize; - } - if(instancesize != OCINDETERMINATE) { - instancesize = RNDUP(instancesize); /* make multiple of XDRUNIT */ - totalsize = (instancesize*xnode->skip.count); /* overhead is single count */ - if(!scalar) - totalsize += XDRUNIT; /* overhead is single count */ - } else { - totalsize = OCINDETERMINATE; - } - if(xnode->octype == OC_Sequence) { - totalsize = OCINDETERMINATE; - offset = OCINDETERMINATE; - } - break; - - default: OCPANIC("unexpected octype"); /* better not happen */ - } - - xnode->skip.offset = offset; - xnode->skip.instancesize = instancesize; - xnode->skip.totalsize = totalsize; - -done: - return stat; -} diff --git a/xios_2311_src/trunk/.svn/pristine/3a/3a8f9b70f8c8a642606941dc1204991a24b76f76.svn-base b/xios_2311_src/trunk/.svn/pristine/3a/3a8f9b70f8c8a642606941dc1204991a24b76f76.svn-base deleted file mode 100644 index a7b779f95180327734a75873363df4f2d2c93a08..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/3a/3a8f9b70f8c8a642606941dc1204991a24b76f76.svn-base +++ /dev/null @@ -1,117 +0,0 @@ -#ifndef __XIOS_CAttributeTemplate__ -#define __XIOS_CAttributeTemplate__ - -/// boost headers /// -#include - -/// XIOS headers /// -#include "xios_spl.hpp" -#include "exception.hpp" -#include "attribute.hpp" -#include "buffer_in.hpp" -#include "buffer_out.hpp" -#include "type.hpp" - -namespace xios -{ - /// ////////////////////// Déclarations ////////////////////// /// - /*! - \class CAttributeTemplate - The class implements attribute of some basic types - */ - template - class CAttributeTemplate : public CAttribute, public CType - { - typedef CAttribute SuperClass; - - public : - - /// Typedef /// - typedef T ValueType; - - /// Constructeurs /// - explicit CAttributeTemplate(const StdString & id); - CAttributeTemplate(const StdString & id, - xios_map & umap); - CAttributeTemplate(const StdString & id, const ValueType & value); - CAttributeTemplate(const StdString & id, const ValueType & value, - xios_map & umap); -// CAttributeTemplate(const CAttribute & attribut) throw (CException); -// CAttributeTemplate(const CAttribute * const attribut); // Not implemented. - - public : - - /// Accesseur /// - ValueType getValue(void) const; -// ValueType* getRef(void) ; - - /// Mutateurs /// - void setValue(const ValueType & value); - - void set(const CAttribute& attr) ; - void set(const CAttributeTemplate& attr) ; - void reset(void) ; - void checkEmpty(void) const; - - - void setInheritedValue(const CAttributeTemplate& attr ); - void setInheritedValue(const CAttribute& attr ); - T getInheritedValue(void) const ; - bool hasInheritedValue(void) const; - - bool isEqual(const CAttribute& attr ); - - /// Destructeur /// - virtual ~CAttributeTemplate(void) { } - - /// Operateur /// - CAttributeTemplate& operator=(const ValueType & value); - - /// Autre /// - virtual StdString toString(void) const { return _toString();} - virtual void fromString(const StdString & str) { if (str==resetInheritanceStr) { reset(); _canInherite=false ;} else _fromString(str);} -// virtual CAttributeTemplate* clone() const {} -// virtual void toBinary (StdOStream & os) const; -// virtual void fromBinary(StdIStream & is); - virtual StdString dump(void) const { return _dump();} - virtual StdString dumpGraph(void) const { return _dumpGraph();} - - virtual bool toBuffer (CBufferOut& buffer) const { return _toBuffer(buffer);} - virtual bool fromBuffer(CBufferIn& buffer) { return _fromBuffer(buffer); } -// virtual size_t size(void) const; - virtual void generateCInterface(ostream& oss,const string& className) ; - virtual void generateFortran2003Interface(ostream& oss,const string& className) ; - virtual void generateFortranInterfaceDeclaration_(ostream& oss,const string& className) ; - virtual void generateFortranInterfaceBody_(ostream& oss,const string& className) ; - virtual void generateFortranInterfaceDeclaration(ostream& oss,const string& className) ; - virtual void generateFortranInterfaceGetDeclaration_(ostream& oss,const string& className) ; - virtual void generateFortranInterfaceGetBody_(ostream& oss,const string& className) ; - virtual void generateFortranInterfaceGetDeclaration(ostream& oss,const string& className) ; -// virtual void generateFortranInterfaceIsDefinedDeclaration_(ostream& oss,const string& className) ; -// virtual void generateFortranInterfaceIsDefinedBody_(ostream& oss,const string& className) ; -// virtual void generateFortranInterfaceIsDefinedDeclaration(ostream& oss,const string& className) ; - - - protected : - - /// Constructeurs /// -// CAttributeTemplate(void); // Not implemented. - private : - bool isEqual_(const CAttributeTemplate& attr); - StdString _toString(void) const; - StdString _dump(void) const; - StdString _dumpGraph(void) const; - void _fromString(const StdString & str); - bool _toBuffer (CBufferOut& buffer) const; - bool _fromBuffer(CBufferIn& buffer) ; - - CType inheritedValue ; - }; // class CAttribute - - - template void FromBinary(StdIStream & is, T & obj); - - -} // namespace xios - -#endif // __XIOS_CAttributeTemplate__ diff --git a/xios_2311_src/trunk/.svn/pristine/3a/3ad3259a1fe49d560c672af7c267e459ca1bf62c.svn-base b/xios_2311_src/trunk/.svn/pristine/3a/3ad3259a1fe49d560c672af7c267e459ca1bf62c.svn-base deleted file mode 100644 index 9593ea7f23786e610e70d3b0a80b2bff6133b938..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/3a/3ad3259a1fe49d560c672af7c267e459ca1bf62c.svn-base +++ /dev/null @@ -1,42 +0,0 @@ -MODULE TIMER_INTERFACE - USE, INTRINSIC :: ISO_C_BINDING - - INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99 - - SUBROUTINE cxios_timer_resume(timer_id, len_timer_id, trace) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: timer_id - INTEGER(kind = C_INT) , VALUE :: len_timer_id - LOGICAL (kind = C_BOOL) , VALUE :: trace - - END SUBROUTINE cxios_timer_resume - - SUBROUTINE cxios_timer_suspend(timer_id, len_timer_id, trace) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: timer_id - INTEGER(kind = C_INT) , VALUE :: len_timer_id - LOGICAL (kind = C_BOOL) , VALUE :: trace - END SUBROUTINE cxios_timer_suspend - - - SUBROUTINE cxios_timer_reset(timer_id, len_timer_id) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: timer_id - INTEGER(kind = C_INT) , VALUE :: len_timer_id - END SUBROUTINE cxios_timer_reset - - SUBROUTINE cxios_timer_get_time(time) BIND(C) - USE ISO_C_BINDING - REAL (kind = C_DOUBLE) :: time - END SUBROUTINE cxios_timer_get_time - - SUBROUTINE cxios_timer_get_cumulated_time(timer_id, len_timer_id, time) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: timer_id - INTEGER(kind = C_INT) , VALUE :: len_timer_id - REAL (kind = C_DOUBLE) :: time - END SUBROUTINE cxios_timer_get_cumulated_time - - END INTERFACE - -END MODULE TIMER_INTERFACE \ No newline at end of file diff --git a/xios_2311_src/trunk/.svn/pristine/3b/3b40367347d9852f0d5ebdd7afcf8cf64d0de2a8.svn-base b/xios_2311_src/trunk/.svn/pristine/3b/3b40367347d9852f0d5ebdd7afcf8cf64d0de2a8.svn-base deleted file mode 100644 index 2765b1917a12added1d89cdd07526666c9387141..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/3b/3b40367347d9852f0d5ebdd7afcf8cf64d0de2a8.svn-base +++ /dev/null @@ -1,4 +0,0 @@ -module unload netcdf -module unload intel -module load intel/16.0.2 -module load netcdf-mpi/4.4.0 diff --git a/xios_2311_src/trunk/.svn/pristine/3b/3b697db277101bdb5d4a9abb38208816ca2a15e2.svn-base b/xios_2311_src/trunk/.svn/pristine/3b/3b697db277101bdb5d4a9abb38208816ca2a15e2.svn-base deleted file mode 100644 index 7c516e8ec85cf098fdb0e9b0c7176bb52d3dd5d1..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/3b/3b697db277101bdb5d4a9abb38208816ca2a15e2.svn-base +++ /dev/null @@ -1,22 +0,0 @@ -MODULE INVERSE_AXIS_INTERFACE - USE, INTRINSIC :: ISO_C_BINDING - - INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99 - - SUBROUTINE cxios_inverse_axis_handle_create(ret, idt, idt_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_inverse_axis_handle_create - - SUBROUTINE cxios_inverse_axis_valid_id(ret, idt, idt_size) BIND(C) - USE ISO_C_BINDING - LOGICAL (kind = C_BOOL) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_inverse_axis_valid_id - - END INTERFACE - -END MODULE INVERSE_AXIS_INTERFACE diff --git a/xios_2311_src/trunk/.svn/pristine/3b/3b8a8f6f8b5002e146b369044d0534d9e867d2d8.svn-base b/xios_2311_src/trunk/.svn/pristine/3b/3b8a8f6f8b5002e146b369044d0534d9e867d2d8.svn-base deleted file mode 100644 index 29a8fa0a118b9e9065e399f263c27e2476d685af..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/3b/3b8a8f6f8b5002e146b369044d0534d9e867d2d8.svn-base +++ /dev/null @@ -1,130 +0,0 @@ -/*! - \file netCdfInterface_impl.hpp - \author Ha NGUYEN - \date 08 Oct 2014 - \since 06 Oct 2014 - - \brief Implementation of some templated functions in netCdfInterface - */ - -#ifndef __NETCDF_INTERFACE_IMPL_HPP__ -#define __NETCDF_INTERFACE_IMPL_HPP__ - -#include "netCdfInterface.hpp" -#include "netCdfException.hpp" - -namespace xios -{ - /*! - This function reads a variable attribute or a global attribute - given a location id, a variable id and the attribute name - \param [in] ncid Id of group (or file id) - \param [in] varId Id of the variable - \param [in] attrName Name of the attribute - \param [out] data Array of values - \return Status code - */ - template - int CNetCdfInterface::getAttType(int ncid, int varId, const StdString& attrName, T* data) - { - int status = ncGetAttType(ncid, varId, attrName.c_str(), data); - if (NC_NOERR != status) - { - StdStringStream sstr; - StdString varName; - sstr << "Error when calling function ncGetAttType(ncid, varId, attrName.c_str(), data)" << std::endl; - sstr << nc_strerror(status) << std::endl; - inqVarName(ncid, varId, varName); - sstr << "Unable to read attribute " << attrName << " given the location id: " << ncid << " and the variable whose id: " << varId << " and name: " << varName << std::endl; - throw CNetCdfException(sstr.str()); - } - - return status; - } - - /*! - This function adds or modifies a variable attribute or a global attribute - given a location id, a variable id and the attribute name - \param [in] ncid Id of group (or file id) - \param [in] varId Id of the variable - \param [in] attrName Name of the attribute - \param [in] numVal Number of values to set - \param [in] data Array of values - \return Status code - */ - template - int CNetCdfInterface::putAttType(int ncid, int varId, const StdString& attrName, - StdSize numVal, const T* data) - { - int status = ncPutAttType(ncid, varId, attrName.c_str(), numVal, data); - if (NC_NOERR != status) - { - StdStringStream sstr; - StdString varName; - sstr << "Error when calling function ncPutAttType(ncid, varId, attrName.c_str(), numVal, data)" << std::endl; - sstr << nc_strerror(status) << std::endl; - inqVarName(ncid, varId, varName); - sstr << "Unable to set attribute " << attrName << " given the location id: " << ncid << " and the variable whose id: " << varId << " and name: " << varName << std::endl - << " with " << numVal << " elements." << std::endl; - throw CNetCdfException(sstr.str()); - } - - return status; - } - - /*! - This function reads data for the specified variable. - \param [in] ncid Id of group (or file id) - \param [in] varId Id of the variable - \param [in] start Array specifying the index in the variable where the first data value will be written - \param [in] count Array specifying the edge lengths along each dimension of the data block - \param [out] data Array of values - \return Status code - */ - template - int CNetCdfInterface::getVaraType(int ncid, int varId, const StdSize* start, const StdSize* count, T* data) - { - int status = ncGetVaraType(ncid, varId, start, count, data); - if (NC_NOERR != status) - { - StdStringStream sstr; - StdString varName; - sstr << "Error when calling function ncGetVaraType(ncid, varId, start, count, data)" << std::endl; - sstr << nc_strerror(status) << std::endl; - inqVarName(ncid, varId, varName); - sstr << "Unable to read data given the location id: " << ncid << " and the variable whose id: " << varId << " and name: " << varName << std::endl; - throw CNetCdfException(sstr.str()); - } - - return status; - } - - /*! - This function writes the given data for the specified variable. - \param [in] ncid Id of group (or file id) - \param [in] varId Id of the variable - \param [in] start Array specifying the index in the variable where the first data value will be written - \param [in] count Array specifying the edge lengths along each dimension of the data block - \param [in] data Array of values - \return Status code - */ - template - int CNetCdfInterface::putVaraType(int ncid, int varId, const StdSize* start, const StdSize* count, const T* data) - { - int status = ncPutVaraType(ncid, varId, start, count, data); - if (NC_NOERR != status) - { - StdStringStream sstr; - StdString varName; - sstr << "Error when calling function ncPutVaraType(ncid, varId, start, count, data)" << std::endl; - sstr << nc_strerror(status) << std::endl; - inqVarName(ncid, varId, varName); - sstr << "Unable to write data given the location id: " << ncid << " and the variable whose id: " << varId << " and name: " << varName << std::endl; - throw CNetCdfException(sstr.str()); - } - - return status; - } -} - -#endif // __NETCDF_INTERFACE_IMPL_HPP__ diff --git a/xios_2311_src/trunk/.svn/pristine/3b/3baefd583737469eb4d260958fa5c9dad8f8ada9.svn-base b/xios_2311_src/trunk/.svn/pristine/3b/3baefd583737469eb4d260958fa5c9dad8f8ada9.svn-base deleted file mode 100644 index 049c0dd436e8758c4de12880278777deabcf7240..0000000000000000000000000000000000000000 Binary files a/xios_2311_src/trunk/.svn/pristine/3b/3baefd583737469eb4d260958fa5c9dad8f8ada9.svn-base and /dev/null differ diff --git a/xios_2311_src/trunk/.svn/pristine/3b/3bb53908365515a5fe783a8dcba59229cfca1b7f.svn-base b/xios_2311_src/trunk/.svn/pristine/3b/3bb53908365515a5fe783a8dcba59229cfca1b7f.svn-base deleted file mode 100644 index be6134f026c8910738c0feeeb060864b2f2af804..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/3b/3bb53908365515a5fe783a8dcba59229cfca1b7f.svn-base +++ /dev/null @@ -1,240 +0,0 @@ -! * ************************************************************************** * -! * Interface auto generated - do not modify * -! * ************************************************************************** * -#include "xios_fortran_prefix.hpp" - -MODULE iexpand_domain_attr - USE, INTRINSIC :: ISO_C_BINDING - USE iexpand_domain - USE expand_domain_interface_attr - -CONTAINS - - SUBROUTINE xios(set_expand_domain_attr) & - ( expand_domain_id, i_periodic, j_periodic, order, type ) - - IMPLICIT NONE - TYPE(txios(expand_domain)) :: expand_domain_hdl - CHARACTER(LEN=*), INTENT(IN) ::expand_domain_id - LOGICAL , OPTIONAL, INTENT(IN) :: i_periodic - LOGICAL (KIND=C_BOOL) :: i_periodic_tmp - LOGICAL , OPTIONAL, INTENT(IN) :: j_periodic - LOGICAL (KIND=C_BOOL) :: j_periodic_tmp - INTEGER , OPTIONAL, INTENT(IN) :: order - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type - - CALL xios(get_expand_domain_handle) & - (expand_domain_id,expand_domain_hdl) - CALL xios(set_expand_domain_attr_hdl_) & - ( expand_domain_hdl, i_periodic, j_periodic, order, type ) - - END SUBROUTINE xios(set_expand_domain_attr) - - SUBROUTINE xios(set_expand_domain_attr_hdl) & - ( expand_domain_hdl, i_periodic, j_periodic, order, type ) - - IMPLICIT NONE - TYPE(txios(expand_domain)) , INTENT(IN) :: expand_domain_hdl - LOGICAL , OPTIONAL, INTENT(IN) :: i_periodic - LOGICAL (KIND=C_BOOL) :: i_periodic_tmp - LOGICAL , OPTIONAL, INTENT(IN) :: j_periodic - LOGICAL (KIND=C_BOOL) :: j_periodic_tmp - INTEGER , OPTIONAL, INTENT(IN) :: order - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type - - CALL xios(set_expand_domain_attr_hdl_) & - ( expand_domain_hdl, i_periodic, j_periodic, order, type ) - - END SUBROUTINE xios(set_expand_domain_attr_hdl) - - SUBROUTINE xios(set_expand_domain_attr_hdl_) & - ( expand_domain_hdl, i_periodic_, j_periodic_, order_, type_ ) - - IMPLICIT NONE - TYPE(txios(expand_domain)) , INTENT(IN) :: expand_domain_hdl - LOGICAL , OPTIONAL, INTENT(IN) :: i_periodic_ - LOGICAL (KIND=C_BOOL) :: i_periodic__tmp - LOGICAL , OPTIONAL, INTENT(IN) :: j_periodic_ - LOGICAL (KIND=C_BOOL) :: j_periodic__tmp - INTEGER , OPTIONAL, INTENT(IN) :: order_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type_ - - IF (PRESENT(i_periodic_)) THEN - i_periodic__tmp = i_periodic_ - CALL cxios_set_expand_domain_i_periodic & - (expand_domain_hdl%daddr, i_periodic__tmp) - ENDIF - - IF (PRESENT(j_periodic_)) THEN - j_periodic__tmp = j_periodic_ - CALL cxios_set_expand_domain_j_periodic & - (expand_domain_hdl%daddr, j_periodic__tmp) - ENDIF - - IF (PRESENT(order_)) THEN - CALL cxios_set_expand_domain_order & - (expand_domain_hdl%daddr, order_) - ENDIF - - IF (PRESENT(type_)) THEN - CALL cxios_set_expand_domain_type & - (expand_domain_hdl%daddr, type_, len(type_)) - ENDIF - - END SUBROUTINE xios(set_expand_domain_attr_hdl_) - - SUBROUTINE xios(get_expand_domain_attr) & - ( expand_domain_id, i_periodic, j_periodic, order, type ) - - IMPLICIT NONE - TYPE(txios(expand_domain)) :: expand_domain_hdl - CHARACTER(LEN=*), INTENT(IN) ::expand_domain_id - LOGICAL , OPTIONAL, INTENT(OUT) :: i_periodic - LOGICAL (KIND=C_BOOL) :: i_periodic_tmp - LOGICAL , OPTIONAL, INTENT(OUT) :: j_periodic - LOGICAL (KIND=C_BOOL) :: j_periodic_tmp - INTEGER , OPTIONAL, INTENT(OUT) :: order - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type - - CALL xios(get_expand_domain_handle) & - (expand_domain_id,expand_domain_hdl) - CALL xios(get_expand_domain_attr_hdl_) & - ( expand_domain_hdl, i_periodic, j_periodic, order, type ) - - END SUBROUTINE xios(get_expand_domain_attr) - - SUBROUTINE xios(get_expand_domain_attr_hdl) & - ( expand_domain_hdl, i_periodic, j_periodic, order, type ) - - IMPLICIT NONE - TYPE(txios(expand_domain)) , INTENT(IN) :: expand_domain_hdl - LOGICAL , OPTIONAL, INTENT(OUT) :: i_periodic - LOGICAL (KIND=C_BOOL) :: i_periodic_tmp - LOGICAL , OPTIONAL, INTENT(OUT) :: j_periodic - LOGICAL (KIND=C_BOOL) :: j_periodic_tmp - INTEGER , OPTIONAL, INTENT(OUT) :: order - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type - - CALL xios(get_expand_domain_attr_hdl_) & - ( expand_domain_hdl, i_periodic, j_periodic, order, type ) - - END SUBROUTINE xios(get_expand_domain_attr_hdl) - - SUBROUTINE xios(get_expand_domain_attr_hdl_) & - ( expand_domain_hdl, i_periodic_, j_periodic_, order_, type_ ) - - IMPLICIT NONE - TYPE(txios(expand_domain)) , INTENT(IN) :: expand_domain_hdl - LOGICAL , OPTIONAL, INTENT(OUT) :: i_periodic_ - LOGICAL (KIND=C_BOOL) :: i_periodic__tmp - LOGICAL , OPTIONAL, INTENT(OUT) :: j_periodic_ - LOGICAL (KIND=C_BOOL) :: j_periodic__tmp - INTEGER , OPTIONAL, INTENT(OUT) :: order_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type_ - - IF (PRESENT(i_periodic_)) THEN - CALL cxios_get_expand_domain_i_periodic & - (expand_domain_hdl%daddr, i_periodic__tmp) - i_periodic_ = i_periodic__tmp - ENDIF - - IF (PRESENT(j_periodic_)) THEN - CALL cxios_get_expand_domain_j_periodic & - (expand_domain_hdl%daddr, j_periodic__tmp) - j_periodic_ = j_periodic__tmp - ENDIF - - IF (PRESENT(order_)) THEN - CALL cxios_get_expand_domain_order & - (expand_domain_hdl%daddr, order_) - ENDIF - - IF (PRESENT(type_)) THEN - CALL cxios_get_expand_domain_type & - (expand_domain_hdl%daddr, type_, len(type_)) - ENDIF - - END SUBROUTINE xios(get_expand_domain_attr_hdl_) - - SUBROUTINE xios(is_defined_expand_domain_attr) & - ( expand_domain_id, i_periodic, j_periodic, order, type ) - - IMPLICIT NONE - TYPE(txios(expand_domain)) :: expand_domain_hdl - CHARACTER(LEN=*), INTENT(IN) ::expand_domain_id - LOGICAL, OPTIONAL, INTENT(OUT) :: i_periodic - LOGICAL(KIND=C_BOOL) :: i_periodic_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: j_periodic - LOGICAL(KIND=C_BOOL) :: j_periodic_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: order - LOGICAL(KIND=C_BOOL) :: order_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: type - LOGICAL(KIND=C_BOOL) :: type_tmp - - CALL xios(get_expand_domain_handle) & - (expand_domain_id,expand_domain_hdl) - CALL xios(is_defined_expand_domain_attr_hdl_) & - ( expand_domain_hdl, i_periodic, j_periodic, order, type ) - - END SUBROUTINE xios(is_defined_expand_domain_attr) - - SUBROUTINE xios(is_defined_expand_domain_attr_hdl) & - ( expand_domain_hdl, i_periodic, j_periodic, order, type ) - - IMPLICIT NONE - TYPE(txios(expand_domain)) , INTENT(IN) :: expand_domain_hdl - LOGICAL, OPTIONAL, INTENT(OUT) :: i_periodic - LOGICAL(KIND=C_BOOL) :: i_periodic_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: j_periodic - LOGICAL(KIND=C_BOOL) :: j_periodic_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: order - LOGICAL(KIND=C_BOOL) :: order_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: type - LOGICAL(KIND=C_BOOL) :: type_tmp - - CALL xios(is_defined_expand_domain_attr_hdl_) & - ( expand_domain_hdl, i_periodic, j_periodic, order, type ) - - END SUBROUTINE xios(is_defined_expand_domain_attr_hdl) - - SUBROUTINE xios(is_defined_expand_domain_attr_hdl_) & - ( expand_domain_hdl, i_periodic_, j_periodic_, order_, type_ ) - - IMPLICIT NONE - TYPE(txios(expand_domain)) , INTENT(IN) :: expand_domain_hdl - LOGICAL, OPTIONAL, INTENT(OUT) :: i_periodic_ - LOGICAL(KIND=C_BOOL) :: i_periodic__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: j_periodic_ - LOGICAL(KIND=C_BOOL) :: j_periodic__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: order_ - LOGICAL(KIND=C_BOOL) :: order__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: type_ - LOGICAL(KIND=C_BOOL) :: type__tmp - - IF (PRESENT(i_periodic_)) THEN - i_periodic__tmp = cxios_is_defined_expand_domain_i_periodic & - (expand_domain_hdl%daddr) - i_periodic_ = i_periodic__tmp - ENDIF - - IF (PRESENT(j_periodic_)) THEN - j_periodic__tmp = cxios_is_defined_expand_domain_j_periodic & - (expand_domain_hdl%daddr) - j_periodic_ = j_periodic__tmp - ENDIF - - IF (PRESENT(order_)) THEN - order__tmp = cxios_is_defined_expand_domain_order & - (expand_domain_hdl%daddr) - order_ = order__tmp - ENDIF - - IF (PRESENT(type_)) THEN - type__tmp = cxios_is_defined_expand_domain_type & - (expand_domain_hdl%daddr) - type_ = type__tmp - ENDIF - - END SUBROUTINE xios(is_defined_expand_domain_attr_hdl_) - -END MODULE iexpand_domain_attr diff --git a/xios_2311_src/trunk/.svn/pristine/3b/3bfd1c85239e6d2e3f296a267827c72397ea5419.svn-base b/xios_2311_src/trunk/.svn/pristine/3b/3bfd1c85239e6d2e3f296a267827c72397ea5419.svn-base deleted file mode 100644 index 8ca0d76769743fd2b5eb9dd2d9c5e908ad7f15c2..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/3b/3bfd1c85239e6d2e3f296a267827c72397ea5419.svn-base +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef __LEADER_PROCESS_HPP__ -#define __LEADER_PROCESS_HPP__ -#include - -namespace xios -{ - void computeLeaderProcess(int clientRank, int clientSize, int serverSize, - std::list& rankRecvLeader, - std::list& rankRecvNotLeader) ; - int getLeaderRank(int clientSize, int serverSize, int serverRank) ; -} - -#endif diff --git a/xios_2311_src/trunk/.svn/pristine/3c/3ca3c2e96d3d7053a3f0db8f821f4d6dc6c3feec.svn-base b/xios_2311_src/trunk/.svn/pristine/3c/3ca3c2e96d3d7053a3f0db8f821f4d6dc6c3feec.svn-base deleted file mode 100644 index 118888302f2a9d19a7ec680c9221dd46497b27ea..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/3c/3ca3c2e96d3d7053a3f0db8f821f4d6dc6c3feec.svn-base +++ /dev/null @@ -1,26 +0,0 @@ -/* PRIVATE ATTRIBUTES */ -DECLARE_ATTRIBUTE_PRIVATE(double, lon_start) -DECLARE_ATTRIBUTE_PRIVATE(double, lon_end) -DECLARE_ATTRIBUTE_PRIVATE(double, lat_start) -DECLARE_ATTRIBUTE_PRIVATE(double, lat_end) - -DECLARE_ATTRIBUTE_PRIVATE(double, bounds_lon_start) -DECLARE_ATTRIBUTE_PRIVATE(double, bounds_lon_end) -DECLARE_ATTRIBUTE_PRIVATE(double, bounds_lat_start) -DECLARE_ATTRIBUTE_PRIVATE(double, bounds_lat_end) - -// Array contain whole value (non distributed) of longitude and latitude read from a file -DECLARE_ARRAY_PRIVATE(double, 1, lonvalue_rectilinear_read_from_file) -DECLARE_ARRAY_PRIVATE(double, 1, latvalue_rectilinear_read_from_file) - -// Array containing longitude and latitude of LOCAL curvilinear domain to be read from a file -DECLARE_ARRAY_PRIVATE(double, 2, lonvalue_curvilinear_read_from_file) -DECLARE_ARRAY_PRIVATE(double, 2, latvalue_curvilinear_read_from_file) -DECLARE_ARRAY_PRIVATE(double, 3, bounds_lonvalue_curvilinear_read_from_file) -DECLARE_ARRAY_PRIVATE(double, 3, bounds_latvalue_curvilinear_read_from_file) - -// Array containing longitude and latitude of LOCAL unstructured domain to be read from a file -DECLARE_ARRAY_PRIVATE(double, 1, lonvalue_unstructured_read_from_file) -DECLARE_ARRAY_PRIVATE(double, 1, latvalue_unstructured_read_from_file) -DECLARE_ARRAY_PRIVATE(double, 2, bounds_lonvalue_unstructured_read_from_file) -DECLARE_ARRAY_PRIVATE(double, 2, bounds_latvalue_unstructured_read_from_file) \ No newline at end of file diff --git a/xios_2311_src/trunk/.svn/pristine/3d/3d0e075a613e11e2ac1a413b116c29ebe85b3f7b.svn-base b/xios_2311_src/trunk/.svn/pristine/3d/3d0e075a613e11e2ac1a413b116c29ebe85b3f7b.svn-base deleted file mode 100644 index 8bb2d4e6f464dbecc4b8d2009bd8b7f2fa0e144b..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/3d/3d0e075a613e11e2ac1a413b116c29ebe85b3f7b.svn-base +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef __XIOS_CJulianCalendar__ -#define __XIOS_CJulianCalendar__ - -/// XIOS headers /// -#include "xios_spl.hpp" -#include "calendar.hpp" - -namespace xios -{ - /// ////////////////////// Déclarations ////////////////////// /// - class CJulianCalendar : public CCalendar - { - /// Typedef /// - typedef CCalendar SuperClass; - - public : - - /// Constructeur /// -// CJulianCalendar(void); // Not implemented yet. - CJulianCalendar(const CDate& startDate); - CJulianCalendar(const CDate& startDate, const CDate& timeOrigin); - CJulianCalendar(int yr = 0, int mth = 1, int d = 1, - int hr = 0, int min = 0, int sec = 0); - CJulianCalendar(const CJulianCalendar& calendar); // Not implemented yet. - CJulianCalendar(const CJulianCalendar* calendar); // Not implemented yet. - - /// Accesseurs /// - virtual int getYearTotalLength(const CDate & date) const; - virtual int getMonthLength(const CDate & date) const; - virtual StdString getType(void) const; - - virtual bool hasLeapYear() const; - - /// Destructeur /// - virtual ~CJulianCalendar(void); - - }; // class CJulianCalendar - -} // namespace xios - -#endif // __XIOS_CJulianCalendar__ diff --git a/xios_2311_src/trunk/.svn/pristine/3d/3d2ed9039a90f7eb197dfab5d5f4a965e1d26871.svn-base b/xios_2311_src/trunk/.svn/pristine/3d/3d2ed9039a90f7eb197dfab5d5f4a965e1d26871.svn-base deleted file mode 100644 index 07f19d50698fa86bdcffa325c4251c0dddbd81a3..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/3d/3d2ed9039a90f7eb197dfab5d5f4a965e1d26871.svn-base +++ /dev/null @@ -1,100 +0,0 @@ -/* Copyright 2009, UCAR/Unidata and OPeNDAP, Inc. - See the COPYRIGHT file for more information. */ - -#ifndef DCEPARSELEX_H -#define DCEPARSELEX_H - -#include "config.h" -#include "dcetab.h" - -#ifdef WIN32 -#define strcasecmp stricmp -#define snprintf _snprintf -#endif - -/* For consistency with Java parser */ -#ifndef null -#define null NULL -#endif - -typedef void* Object; - -#define YYSTYPE Object - -#define MAX_TOKEN_LENGTH 1024 - -/*! Specifies DCElexstate. */ -typedef struct DCElexstate { - char* input; - char* next; /* next char in uri.query */ - NCbytes* yytext; - /*! Specifies the Lasttoken. */ - int lasttoken; - char lasttokentext[MAX_TOKEN_LENGTH+1]; /* leave room for trailing null */ - NClist* reclaim; /* reclaim SCAN_WORD instances */ -} DCElexstate; - -/*! Specifies DCEparsestate. */ -typedef struct DCEparsestate { - DCEconstraint* constraint; - char errorbuf[1024]; - int errorcode; - DCElexstate* lexstate; -} DCEparsestate; - -/* Define a generic object carrier; this serves - essentially the same role as the typical bison %union - declaration -*/ - - -extern int ceerror(DCEparsestate*,char*); -extern void ce_parse_error(DCEparsestate*,const char *fmt, ...); - -/* bison parse entry point */ -extern int dceparse(DCEparsestate*); - -extern int dceerror(DCEparsestate* state, char* msg); -extern void projections(DCEparsestate* state, Object list0); -extern void selections(DCEparsestate* state, Object list0); -extern Object projectionlist(DCEparsestate* state, Object list0, Object decl); -extern Object projection(DCEparsestate* state, Object segmentlist); -extern Object segmentlist(DCEparsestate* state, Object list0, Object decl); -extern Object segment(DCEparsestate* state, Object name, Object slices0); -extern Object array_indices(DCEparsestate* state, Object list0, Object decl); -extern Object range(DCEparsestate* state, Object, Object, Object); -extern Object selectionlist(DCEparsestate* state, Object list0, Object decl); -extern Object sel_clause(DCEparsestate* state, int selcase, Object path0, Object relop0, Object values); -extern Object selectionpath(DCEparsestate* state, Object list0, Object text); -extern Object arrayelement(DCEparsestate* state, Object name, Object index); -extern Object function(DCEparsestate* state, Object fcnname, Object args); -extern Object arg_list(DCEparsestate* state, Object list0, Object decl); -extern Object value_list(DCEparsestate* state, Object list0, Object decl); -extern Object value(DCEparsestate* state, Object value); -extern Object makeselectiontag(CEsort); -extern Object indexer(DCEparsestate* state, Object name, Object indices); -extern Object indexpath(DCEparsestate* state, Object list0, Object index); -extern Object var(DCEparsestate* state, Object indexpath); -extern Object constant(DCEparsestate* state, Object val, int tag); -extern Object clauselist(DCEparsestate* state, Object list0, Object decl); -extern Object range1(DCEparsestate* state, Object rangenumber); -extern Object rangelist(DCEparsestate* state, Object list0, Object decl); - -/* lexer interface */ -extern int dcelex(YYSTYPE*, DCEparsestate*); -extern void dcelexinit(char* input, DCElexstate** lexstatep); -extern void dcelexcleanup(DCElexstate** lexstatep); - -extern int dcedebug; - -#ifdef PARSEDEBUG -extern Object debugobject(Object); -#define checkobject(x) debugobject(x) -#else -#define checkobject(x) (x) -#endif - -extern int dapceparse(char* input, DCEconstraint*, char**); - -#endif /*DCEPARSELEX_H*/ - diff --git a/xios_2311_src/trunk/.svn/pristine/3d/3d9ac4961f6ec201161ea9d07d4a3f3ad1a24476.svn-base b/xios_2311_src/trunk/.svn/pristine/3d/3d9ac4961f6ec201161ea9d07d4a3f3ad1a24476.svn-base deleted file mode 100644 index 2021874e08596fe36d46a7f223f712514596a84e..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/3d/3d9ac4961f6ec201161ea9d07d4a3f3ad1a24476.svn-base +++ /dev/null @@ -1,169 +0,0 @@ -#ifndef __XIOS_CException__ -#define __XIOS_CException__ - -/// XIOS headers /// -#include "xios_spl.hpp" -#include "object.hpp" -#include -#include - -namespace xios -{ - /// ////////////////////// Déclarations ////////////////////// /// - - class CException - : private CObject, public StdOStringStream - { - typedef CObject SuperClass; - - public : - - /// Constructeurs /// - CException(void); - explicit CException(const StdString & id); - CException(const CException & exception); - CException(const CException * const exception); // Not implemented. - - /// Accesseurs /// - StdString getMessage(void) const; - StdOStringStream & getStream(void); - - /// Destructeur /// - virtual ~CException(void); - - /// Autre /// - virtual StdString toString(void) const; - virtual void fromString(const StdString & str); - - struct StackInfo - { - StdString file; - StdString function; - int line; - StdString info; - }; - - std::list stack; - - private : - - /// Propriétés /// - bool desc_rethrow; // throw destructor - StdOStringStream stream; - - }; // CException -} // namespace xios - -/// //////////////////////////// Macros //////////////////////////// /// - -#define FILE_NAME (std::strrchr("/" __FILE__, '/') + 1) - -#define FUNCTION_NAME (StdString(BOOST_CURRENT_FUNCTION).length() > 100 ? \ - StdString(BOOST_CURRENT_FUNCTION).substr(0,100).append("...)") : BOOST_CURRENT_FUNCTION) - -#define INFO(x) \ - "In file \""<< FILE_NAME <<"\", function \"" << BOOST_CURRENT_FUNCTION <<"\", line " << __LINE__ << " -> " x << std::endl; - -#ifdef __XIOS_DEBUG -# define DEBUG(x) std::clog << "> Debug " << INFO(x) -#else -# define DEBUG(x) -#endif - -#define ERROR(id, x) \ -{ \ - xios::CException exc(id); \ - exc.getStream() << INFO(x); \ - error << exc.getMessage() << std::endl; \ - throw exc; \ -} - -#define MISSING_RETURN(id) \ -{ \ - xios::CException exc(id); \ - exc.getStream() << INFO("Missing return"); \ - error << exc.getMessage() << std::endl; \ - throw exc; \ -} - -#ifdef __XIOS_EXCEPTION - #define TRY \ - { \ - int funcFirstLine = __LINE__; \ - try - #define CATCH \ - catch(CException& e) \ - { \ - CException::StackInfo stk; \ - stk.file = FILE_NAME; \ - stk.function = FUNCTION_NAME; \ - stk.line = funcFirstLine; \ - e.stack.push_back(stk); \ - if (CXios::xiosStack) \ - throw; \ - else \ - throw 0; \ - } \ - } - #define CATCH_DUMP_ATTR \ - catch(CException& e) \ - { \ - CException::StackInfo stk; \ - stk.info.append(StdString("Object id=\"" + this->getId()) + "\" object type=\"" + this->getName() + "\"\n"); \ - stk.info.append("*** XIOS attributes as defined in XML file(s) or via Fortran interface:\n"); \ - stk.info.append("[" + this->dumpXiosAttributes() + "]\n"); \ - stk.info.append("*** Additional information:\n"); \ - stk.info.append("[" + this->dumpClassAttributes() + "]\n"); \ - stk.file = FILE_NAME; \ - stk.function = FUNCTION_NAME; \ - stk.line = funcFirstLine; \ - e.stack.push_back(stk); \ - if (CXios::xiosStack) \ - throw; \ - else \ - throw 0; \ - } \ - } - #define CATCH_DUMP_STACK \ - catch(CException& e) \ - { \ - CException::StackInfo stk; \ - int i = 1; \ - stk.file = FILE_NAME; \ - stk.function = FUNCTION_NAME; \ - stk.line = funcFirstLine; \ - e.stack.push_back(stk); \ - for (auto itr = e.stack.crbegin(); itr!=e.stack.crend(); ++itr) \ - { \ - error << "("<< i <<") **************** "; \ - error << itr->function << std::endl; \ - error << itr->info << std::endl; \ - ++i; \ - } \ - error << left << " "; \ - error << left << std::setw(40) << "File " ; \ - error << left << std::setw(106) << "Function " ; \ - error << std::setw(5) << "Line " << std::endl; \ - i = e.stack.size(); \ - for (auto itr = e.stack.begin(); itr!=e.stack.end(); itr++) \ - { \ - StdOStringStream tmp; \ - tmp << "("<< i <<")"; \ - error << left << std::setw(6) << tmp.str(); \ - error << left << std::setw(40) << itr->file; \ - error << left << std::setw(106) << itr->function; \ - error << left << std::setw(5) << itr->line << std::endl; \ - --i; \ - } \ - throw; \ - } \ - } -#else - #define TRY - #define CATCH - #define CATCH_DUMP_ATTR - #define CATCH_DUMP_STACK -#endif - -#endif // __XIOS_CException__ - diff --git a/xios_2311_src/trunk/.svn/pristine/3d/3db0b8c30af91ab00c5c958d297c0161c435b57e.svn-base b/xios_2311_src/trunk/.svn/pristine/3d/3db0b8c30af91ab00c5c958d297c0161c435b57e.svn-base deleted file mode 100644 index ac7851ff3ef12f342276c9c8175099f6ffdd20d7..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/3d/3db0b8c30af91ab00c5c958d297c0161c435b57e.svn-base +++ /dev/null @@ -1,17 +0,0 @@ -#include "grid_local_view.hpp" -#include "grid_elements.hpp" - -namespace xios -{ - CGridLocalView::CGridLocalView(shared_ptr parent, CElementView::type type) : localMask_(parent->getLocalMask()) - { - size_ = 1 ; - for(auto element : parent->getElements()) - { - views_.push_back(element->getView(type)) ; - size_ *= element->getView(type)->getSize() ; - } - - } - -} \ No newline at end of file diff --git a/xios_2311_src/trunk/.svn/pristine/3e/3e293c78e3d80d7112812376de5c92c966ec7c20.svn-base b/xios_2311_src/trunk/.svn/pristine/3e/3e293c78e3d80d7112812376de5c92c966ec7c20.svn-base deleted file mode 100644 index bc327539babfa61b35f102a4d273fb8171ff0e30..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/3e/3e293c78e3d80d7112812376de5c92c966ec7c20.svn-base +++ /dev/null @@ -1,13 +0,0 @@ -PROGRAM parse_xml - USE, INTRINSIC :: ISO_C_BINDING - IMPLICIT NONE - - INTERFACE - SUBROUTINE xios_init() BIND(C, name='cxios_init') - END SUBROUTINE - END INTERFACE - - CALL xios_init() ! This will parse the XML file and report any parsing error - WRITE (*,*) 'Parsing finished successfully.' - -END PROGRAM parse_xml diff --git a/xios_2311_src/trunk/.svn/pristine/3e/3e33e724689926e9a6988c13357ec43bc37c54f2.svn-base b/xios_2311_src/trunk/.svn/pristine/3e/3e33e724689926e9a6988c13357ec43bc37c54f2.svn-base deleted file mode 100644 index 0bb2edfda4fc14065dbd68718628f30e0d07d289..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/3e/3e33e724689926e9a6988c13357ec43bc37c54f2.svn-base +++ /dev/null @@ -1,26 +0,0 @@ -#ifdef __XIOS_CAverage__ - DECLARE_FUNCTOR(Average , average) -#endif //__XIOS_CAverage__ - -#ifdef __XIOS_CAccumulate__ - DECLARE_FUNCTOR(Accumulate , accumulate) -#endif //__XIOS_CAccumulate__ - -#ifdef __XIOS_CInstant__ - DECLARE_FUNCTOR(Instant, instant) -#endif //__XIOS_CInstant__ - -#ifdef __XIOS_COnce__ - DECLARE_FUNCTOR(Once, once) -#endif //__XIOS_COnce__ - -#ifdef __XIOS_CMaximum__ - DECLARE_FUNCTOR(Maximum , maximum) -#endif //__XIOS_CMaximum__ - -#ifdef __XIOS_CMinimum__ - DECLARE_FUNCTOR(Minimum , minimum) -#endif //__XIOS_CMinimum__ - - -#undef DECLARE_FUNCTOR diff --git a/xios_2311_src/trunk/.svn/pristine/3e/3eb98adf4573eb76926c7760ee06b9313afc27d0.svn-base b/xios_2311_src/trunk/.svn/pristine/3e/3eb98adf4573eb76926c7760ee06b9313afc27d0.svn-base deleted file mode 100644 index 8fca3c320489e063de8aafe878161814a62a1628..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/3e/3eb98adf4573eb76926c7760ee06b9313afc27d0.svn-base +++ /dev/null @@ -1,369 +0,0 @@ -/********************************************************************* - * Copyright 1993, UCAR/Unidata - * See netcdf/COPYRIGHT file for copying and redistribution conditions. - * $Header$ - *********************************************************************/ -#include "ncdap3.h" -#include "dapodom.h" -#include "dapdump.h" - -static int iscacheableconstraint(DCEconstraint* con); - -/* Return 1 if we can reuse cached data to address - the current get_vara request; return 0 otherwise. - Target is in the constrained tree space. - Currently, if the target matches a cache that is not - a whole variable, then match is false. -*/ -int -iscached(NCDAPCOMMON* nccomm, CDFnode* target, NCcachenode** cachenodep) -{ - int i,j,found,index; - NCcache* cache; - NCcachenode* cachenode; - - found = 0; - if(target == NULL) goto done; - - /* Match the target variable against the prefetch, if any */ - /* Note that prefetches are always whole variable */ - cache = nccomm->cdf.cache; - cachenode = cache->prefetch; - if(cachenode!= NULL) { - for(found=0,i=0;ivars);i++) { - CDFnode* var = (CDFnode*)nclistget(cachenode->vars,i); - if(var == target) { - if(cachenodep) *cachenodep = cachenode; - found=1; - goto done; - } - } - } - - /*search other cache nodes starting at latest first */ - index = 0; - for(i=nclistlength(cache->nodes)-1;i>=0;i--) { - cachenode = (NCcachenode*)nclistget(cache->nodes,i); - /* We currently do not try to match constraints; - If the cachenode is constrained by more than - simple wholevariable projections, then skip it. - */ - if(!cachenode->wholevariable) continue; - for(found=0,j=0;jvars);j++) { - CDFnode* var = (CDFnode*)nclistget(cachenode->vars,j); - if(var == target) {found=1;index=i;break;} - } - if(found) break; - } - - if(found) { - ASSERT((cachenode != NULL)); - if(nclistlength(cache->nodes) > 1) { - /* Manage the cache nodes as LRU */ - nclistremove(cache->nodes,index); - nclistpush(cache->nodes,(ncelem)cachenode); - } - if(cachenodep) *cachenodep = cachenode; - } - -done: -#ifdef DEBUG -fprintf(stderr,"iscached: search: %s\n",makecdfpathstring3(target,".")); -if(found) - fprintf(stderr,"iscached: found: %s\n",dumpcachenode(cachenode)); -else - fprintf(stderr,"iscached: notfound\n"); -#endif - return found; -} - -/* Compute the set of prefetched data. - Notes: - 1. Even if caching is off, we will - still prefetch the small variables. - 2. All prefetches are whole variable fetches. - 3. If the data set is unconstrainable, we - will prefetch the whole thing -*/ -NCerror -prefetchdata3(NCDAPCOMMON* nccomm) -{ - int i,j; - NCerror ncstat = NC_NOERR; - NClist* allvars = nccomm->cdf.varnodes; - DCEconstraint* urlconstraint = nccomm->oc.dapconstraint; - NClist* vars = nclistnew(); - NCcachenode* cache = NULL; - DCEconstraint* newconstraint = NULL; - int isnc4 = FLAGSET(nccomm->controls,NCF_NC4); - - - if(FLAGSET(nccomm->controls,NCF_UNCONSTRAINABLE)) { - /* If we cannot constrain and caching is enabled, - then pull in everything */ - if(FLAGSET(nccomm->controls,NCF_CACHE)) { - for(i=0;icdf.cache->prefetch = NULL; - goto done; - } - } else { /* can do constraints */ - /* pull in those variables of sufficiently small size */ - for(i=0;inctype == NC_Sequence || dapinsequence(var)) continue; - } - - /* Compute the # of elements in the variable */ - for(j=0;jarray.dimset0);j++) { - CDFnode* dim = (CDFnode*)nclistget(var->array.dimset0,j); - nelems *= dim->dim.declsize; - } -if(SHOWFETCH) { -nclog(NCLOGDBG,"prefetch: %s=%lu",var->ncfullname,(unsigned long)nelems); -} - if(nelems <= nccomm->cdf.smallsizelimit) { - nclistpush(vars,(ncelem)var); -if(SHOWFETCH) { -nclog(NCLOGDBG,"prefetch: %s",var->ncfullname); -} - } - } - } - - /* If there are no vars, then do nothing */ - if(nclistlength(vars) == 0) { - nccomm->cdf.cache->prefetch = NULL; - goto done; - } - - /* Create a single constraint consisting of the projections for the variables; - each projection is whole variable. The selections are passed on as is. - */ - - newconstraint = (DCEconstraint*)dcecreate(CES_CONSTRAINT); - newconstraint->projections = nclistnew(); - newconstraint->selections = dceclonelist(urlconstraint->selections); - - for(i=0;iprojections,(ncelem)varprojection); - } -if(SHOWFETCH) { -char* s = dumpprojections(newconstraint->projections); -LOG1(NCLOGNOTE,"prefetch.final: %s",s); -nullfree(s); -} - ncstat = buildcachenode34(nccomm,newconstraint,vars,&cache,!isnc4); - newconstraint = NULL; /* buildcachenode34 takes control of newconstraint */ - if(ncstat) goto done; - cache->wholevariable = 1; /* All prefetches are whole variable */ - /* Make cache node be the prefetch node */ - nccomm->cdf.cache->prefetch = cache; -if(SHOWFETCH) { -LOG0(NCLOGNOTE,"prefetch.complete"); -} - -if(SHOWFETCH) { -char* s = NULL; -/* Log the set of prefetch variables */ -NCbytes* buf = ncbytesnew(); -ncbytescat(buf,"prefetch.vars: "); -for(i=0;ioc.conn; - OCobject ocroot = OCNULL; - CDFnode* dxdroot = NULL; - NCcachenode* cachenode = NULL; - char* ce = NULL; - - ce = buildconstraintstring3(constraint); - - ocstat = dap_fetch(nccomm,conn,ce,OCDATADDS,&ocroot); - nullfree(ce); - if(ocstat) {THROWCHK(ocerrtoncerr(ocstat)); goto done;} - - ncstat = buildcdftree34(nccomm,ocroot,OCDATA,&dxdroot); - if(ncstat) {THROWCHK(ncstat); goto done;} - - /* regrid */ - if(!FLAGSET(nccomm->controls,NCF_UNCONSTRAINABLE)) { - ncstat = regrid3(dxdroot,nccomm->cdf.ddsroot,constraint->projections); - if(ncstat) {THROWCHK(ncstat); goto done;} - } - - /* create the cache node */ - cachenode = createnccachenode(); - cachenode->prefetch = isprefetch; - cachenode->vars = nclistclone(varlist); - cachenode->datadds = dxdroot; - /* Give the constraint over to the cachenode */ - cachenode->constraint = constraint; - constraint = NULL; - cachenode->wholevariable = iscacheableconstraint(cachenode->constraint); - - /* save the root content*/ - cachenode->ocroot = ocroot; - cachenode->content = oc_data_new(conn); - ocstat = oc_data_root(conn,ocroot,cachenode->content); - if(ocstat) {THROWCHK(ocerrtoncerr(ocstat)); goto done;} - - /* capture the packet size */ - ocstat = oc_raw_xdrsize(conn,ocroot,&cachenode->xdrsize); - if(ocstat) {THROWCHK(ocerrtoncerr(ocstat)); goto done;} - -#ifdef DEBUG -fprintf(stderr,"buildcachenode: new cache node: %s\n", - dumpcachenode(cachenode)); -#endif - /* Insert into the cache. If not caching, then - remove any previous cache node - */ - if(!isprefetch) { - NCcache* cache = nccomm->cdf.cache; - if(cache->nodes == NULL) cache->nodes = nclistnew(); - /* remove cache nodes to get below the max cache size */ - while(cache->cachesize + cachenode->xdrsize > cache->cachelimit - && nclistlength(cache->nodes) > 0) { - NCcachenode* node = (NCcachenode*)nclistremove(cache->nodes,0); -#ifdef DEBUG -fprintf(stderr,"buildcachenode: purge cache node: %s\n", - dumpcachenode(cachenode)); -#endif - cache->cachesize -= node->xdrsize; - freenccachenode(nccomm,node); - } - /* Remove cache nodes to get below the max cache count */ - /* If not caching, then cachecount should be 0 */ - while(nclistlength(cache->nodes) > cache->cachecount) { - NCcachenode* node = (NCcachenode*)nclistremove(cache->nodes,0); -#ifdef DEBUG -fprintf(stderr,"buildcachenode: count purge cache node: %s\n", - dumpcachenode(node)); -#endif - cache->cachesize -= node->xdrsize; - freenccachenode(nccomm,node); - } - nclistpush(nccomm->cdf.cache->nodes,(ncelem)cachenode); - cache->cachesize += cachenode->xdrsize; - } - -#ifdef DEBUG -fprintf(stderr,"buildcachenode: %s\n",dumpcachenode(cachenode)); -#endif - -done: - if(constraint != NULL) dcefree((DCEnode*)constraint); - if(cachep) *cachep = cachenode; - if(ocstat != OC_NOERR) ncstat = ocerrtoncerr(ocstat); - if(ncstat) { - freecdfroot34(dxdroot); - freenccachenode(nccomm,cachenode); - } - return THROW(ncstat); -} - -NCcachenode* -createnccachenode(void) -{ - NCcachenode* mem = (NCcachenode*)calloc(1,sizeof(NCcachenode)); - return mem; -} - -void -freenccachenode(NCDAPCOMMON* nccomm, NCcachenode* node) -{ - if(node == NULL) return; - oc_data_free(nccomm->oc.conn,node->content); - dcefree((DCEnode*)node->constraint); - freecdfroot34(node->datadds); - nclistfree(node->vars); - nullfree(node); -} - -void -freenccache(NCDAPCOMMON* nccomm, NCcache* cache) -{ - int i; - if(cache == NULL) return; - freenccachenode(nccomm,cache->prefetch); - for(i=0;inodes);i++) { - freenccachenode(nccomm,(NCcachenode*)nclistget(cache->nodes,i)); - } - nclistfree(cache->nodes); - nullfree(cache); -} - -NCcache* -createnccache(void) -{ - NCcache* c = (NCcache*)calloc(1,sizeof(NCcache)); - c->cachelimit = DFALTCACHELIMIT; - c->cachesize = 0; - c->nodes = nclistnew(); - c->cachecount = DFALTCACHECOUNT; - return c; -} - -static int -iscacheableprojection(DCEprojection* proj) -{ - int i,cacheable; - if(proj->discrim != CES_VAR) return 0; - cacheable = 1; /* assume so */ - for(i=0;ivar->segments);i++) { - DCEsegment* segment = (DCEsegment*)nclistget(proj->var->segments,i); - if(!iswholesegment(segment)) {cacheable = 0; break;} - } - return cacheable; -} - -static int -iscacheableconstraint(DCEconstraint* con) -{ - int i; - if(con == NULL) return 1; - if(con->selections != NULL && nclistlength(con->selections) > 0) - return 0; /* cant deal with selections */ - for(i=0;iprojections);i++) { - if(!iscacheableprojection((DCEprojection*)nclistget(con->projections,i))) - return 0; - } - return 1; -} diff --git a/xios_2311_src/trunk/.svn/pristine/3f/3f17701359d75e413405b216328606e92cb2a4c9.svn-base b/xios_2311_src/trunk/.svn/pristine/3f/3f17701359d75e413405b216328606e92cb2a4c9.svn-base deleted file mode 100644 index 6eed3404e324baf110b01c95c26a5b6eba72d2c1..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/3f/3f17701359d75e413405b216328606e92cb2a4c9.svn-base +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef __POOL_RESSOURCE_HPP__ -#define __POOL_RESSOURCE_HPP__ - -#include "mpi.hpp" -#include "window_manager.hpp" -#include "services_manager.hpp" - - -namespace xios -{ - - class CService ; - - class CPoolRessource - { - private: - - const size_t maxBufferSize_=1024*1024 ; - const int localLeader_ = 0 ; - - CWindowManager* winNotify_ ; - - public: - CPoolRessource(MPI_Comm poolComm, const std::string& Id) ; - ~CPoolRessource() ; - - void createService(const std::string& serviceId, int type, int size, int nbPartition) ; - void createService(MPI_Comm serviceComm, const std::string& serviceId, int partitionId, int type, int nbPartitions) ; - void createServiceNotify(int rank, const std::string& serviceId, int type, int size, int nbPartitions, bool in) ; - void createServiceDumpOut(CBufferOut& buffer) ; - void createServiceDumpIn(CBufferIn& buffer) ; - void checkCreateServiceNotification(void) ; - void createNewService(const std::string& serviceId, int type, int size, int nbPartitions, bool in) ; - bool eventLoop(bool serviceOnly=false) ; - CService* getService(const std::string serviceId, int partitionId) { return services_[make_tuple(serviceId,partitionId)]; } - void finalizeSignal(void) ; - string getId(void) { return Id_; } - - private: - MPI_Comm poolComm_ ; - - std::multimap occupancy_ ; - std::list > notifications_; - std::map< std::tuple, CService*> services_ ; - std::string Id_ ; - bool finalizeSignal_ ; - - const double eventLoopLatency_=0; - double lastEventLoop_=0. ; - }; - -} - - - -#endif \ No newline at end of file diff --git a/xios_2311_src/trunk/.svn/pristine/3f/3f1acb1b275911074d7f59e68db8daccda37fd7f.svn-base b/xios_2311_src/trunk/.svn/pristine/3f/3f1acb1b275911074d7f59e68db8daccda37fd7f.svn-base deleted file mode 100644 index 09e864577ea41f34f4a5b7c093baf80cc51a0839..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/3f/3f1acb1b275911074d7f59e68db8daccda37fd7f.svn-base +++ /dev/null @@ -1,22 +0,0 @@ -MODULE EXPAND_DOMAIN_INTERFACE - USE, INTRINSIC :: ISO_C_BINDING - - INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99 - - SUBROUTINE cxios_expand_domain_handle_create(ret, idt, idt_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_expand_domain_handle_create - - SUBROUTINE cxios_expand_domain_valid_id(ret, idt, idt_size) BIND(C) - USE ISO_C_BINDING - LOGICAL (kind = C_BOOL) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_expand_domain_valid_id - - END INTERFACE - -END MODULE EXPAND_DOMAIN_INTERFACE diff --git a/xios_2311_src/trunk/.svn/pristine/3f/3fa1ef2fb8a477cd60b75444310c00df87d4d360.svn-base b/xios_2311_src/trunk/.svn/pristine/3f/3fa1ef2fb8a477cd60b75444310c00df87d4d360.svn-base deleted file mode 100644 index ee5c275c208337a4e7a98edc9d4d7ce0c364f0b6..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/3f/3fa1ef2fb8a477cd60b75444310c00df87d4d360.svn-base +++ /dev/null @@ -1,159 +0,0 @@ -/********************************************************************* - * Copyright 2008, University Corporation for Atmospheric Research - * See netcdf/COPYRIGHT file for copying and redistribution conditions. - * $Id: nctime.h,v 1.6 2010/03/18 19:24:26 russ Exp $ - *********************************************************************/ - -struct bounds_node{ - int ncid; /* group (or file) in which variable with associated - * bounds variable resides */ - int varid; /* has "bounds" attribute naming its bounds variable */ - char *bounds_name; /* the named variable, which stores bounds for varid */ - struct bounds_node *next; /* next node on list or NULL ifn last list node */ -}; - -typedef struct bounds_node bounds_node_t; - -/* - * This code was extracted with permission from the CDMS time - * conversion and arithmetic routines developed by Bob Drach, Lawrence - * Livermore National Laboratory as part of the cdtime library. - * Changes and additions were made to support the "-t" option of the - * netCDF ncdump utility. - * - * For the complete time conversion and climate calendar facilities of - * the CDMS library, get the original sources from LLNL. - */ - -#define CD_MAX_RELUNITS 64 /* Max characters in relative units */ -#define CD_MAX_CHARTIME 48 /* Max characters in character time */ -#define CD_NULL_DAY 1 /* Null day value */ -#define CD_NULL_HOUR 0.0 /* Null hour value */ -#define CD_NULL_ID 0 /* Reserved ID */ -#define CD_NULL_MONTH 1 /* Null month value */ -#define CD_NULL_YEAR 0 /* Null year value, component time */ - -typedef enum CdTimeUnit { - CdBadTimeUnit = 0, - CdMinute = 1, - CdHour = 2, - CdDay = 3, - CdWeek = 4, /* Always = 7 days */ - CdMonth = 5, - CdSeason = 6, /* Always = 3 months */ - CdYear = 7, - CdSecond = 8 -} CdTimeUnit; - -typedef enum cdUnit { - cdBadUnit = CdBadTimeUnit, - cdMinute = CdMinute, - cdHour = CdHour, - cdDay = CdDay, - cdWeek = CdWeek, /* Always = 7 days */ - cdMonth = CdMonth, - cdSeason = CdSeason, /* Always = 3 months */ - cdYear = CdYear, - cdSecond = CdSecond, - cdFraction /* Fractional part of absolute time */ -} cdUnitTime; - -#define CdChronCal 0x1 -#define CdClimCal 0x0 -#define CdBaseRel 0x00 -#define CdBase1970 0x10 -#define CdHasLeap 0x100 -#define CdNoLeap 0x000 -#define Cd366 0x2000 -#define Cd365 0x1000 -#define Cd360 0x0000 -#define CdJulianType 0x10000 - -typedef enum CdTimeType { - CdChron = ( CdChronCal | CdBase1970 | CdHasLeap | Cd365), /* 4369 */ - CdJulianCal = ( CdChronCal | CdBase1970 | CdHasLeap | Cd365 | CdJulianType), - CdChronNoLeap = ( CdChronCal | CdBase1970 | CdNoLeap | Cd365), /* 4113 */ - CdChron360 = ( CdChronCal | CdBase1970 | CdNoLeap | Cd360), /* 17 */ - CdRel = ( CdChronCal | CdBaseRel | CdHasLeap | Cd365), /* 4353 */ - CdRelNoLeap = ( CdChronCal | CdBaseRel | CdNoLeap | Cd365), /* 4097 */ - CdClim = ( CdClimCal | CdBaseRel | CdNoLeap | Cd365), /* 4096 */ - CdClimLeap = ( CdClimCal | CdBaseRel | CdHasLeap | Cd365), - CdClim360 = ( CdClimCal | CdBaseRel | CdNoLeap | Cd365), - CdChron366 = ( CdChronCal | CdBase1970 | CdNoLeap | Cd366) -} CdTimeType; - -typedef struct { - long year; /* e.g., 1979 */ - short month; /* e.g., CdDec */ - short day; /* e.g., 30 */ - double hour; /* hour and fractional hour */ - long baseYear; /* base year for relative, 1970 for CdChron */ - CdTimeType timeType; /* e.g., CdChron */ -} CdTime; - -#define cdStandardCal 0x11 -#define cdClimCal 0x0 -#define cdHasLeap 0x100 -#define cdHasNoLeap 0x000 -#define cd366Days 0x2000 -#define cd365Days 0x1000 -#define cd360Days 0x0000 -#define cdJulianCal 0x10000 -#define cdMixedCal 0x20000 - -typedef enum cdCalenType { - cdStandard = ( cdStandardCal | cdHasLeap | cd365Days), - cdJulian = ( cdStandardCal | cdHasLeap | cd365Days | cdJulianCal), - cdNoLeap = ( cdStandardCal | cdHasNoLeap | cd365Days), - cd360 = ( cdStandardCal | cdHasNoLeap | cd360Days), - cd366 = ( cdStandardCal | cdHasNoLeap | cd366Days), - cdClim = ( cdClimCal | cdHasNoLeap | cd365Days), - cdClimLeap = ( cdClimCal | cdHasLeap | cd365Days), - cdClim360 = ( cdClimCal | cdHasNoLeap | cd360Days), - cdMixed = ( cdStandardCal | cdHasLeap | cd365Days | cdMixedCal) -} cdCalenType; - -/* Component time */ -typedef struct { - long year; /* Year */ - short month; /* Numerical month (1..12) */ - short day; /* Day of month (1..31) */ - double hour; /* Hour and fractional hours */ -} cdCompTime; - -typedef struct { - long count; /* units count */ - CdTimeUnit units; /* time interval units */ -} CdDeltaTime; - -typedef struct timeinfo_t { - cdCalenType calendar; - cdUnitTime unit; - char *units; - cdCompTime origin; -} timeinfo_t; - - - -#if defined(DLL_NETCDF) /* Defined when library is a DLL */ -# if defined(DLL_EXPORT) /* define when building the library. */ -# define MSC_NCTIME_EXTRA __declspec(dllexport) -# else -# define MSC_NCTIME_EXTRA __declspec(dllimport) -# endif - -MSC_NCTIME_EXTRA extern void cdRel2Iso(cdCalenType timetype, char* relunits, int separator, double reltime, char* chartime); -MSC_NCTIME_EXTRA extern void cdChar2Comp(cdCalenType timetype, char* chartime, cdCompTime* comptime); -MSC_NCTIME_EXTRA extern void Cdh2e(CdTime *htime, double *etime); -MSC_NCTIME_EXTRA extern void Cde2h(double etime, CdTimeType timeType, long baseYear, CdTime *htime); -MSC_NCTIME_EXTRA extern int cdParseRelunits(cdCalenType timetype, char* relunits, cdUnitTime* unit, cdCompTime* base_comptime); -#else -extern void cdRel2Iso(cdCalenType timetype, char* relunits, int separator, double reltime, char* chartime); -extern void cdChar2Comp(cdCalenType timetype, char* chartime, cdCompTime* comptime); -extern void Cdh2e(CdTime *htime, double *etime); -extern void Cde2h(double etime, CdTimeType timeType, long baseYear, CdTime *htime); -extern int cdParseRelunits(cdCalenType timetype, char* relunits, cdUnitTime* unit, cdCompTime* base_comptime); -#endif /* DLL Considerations. */ - - - diff --git a/xios_2311_src/trunk/.svn/pristine/40/40007b9534905774bc6c98c9e17977246b6ab182.svn-base b/xios_2311_src/trunk/.svn/pristine/40/40007b9534905774bc6c98c9e17977246b6ab182.svn-base deleted file mode 100644 index 88dbc6fbe404a83cb459b4c0285596e339252f29..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/40/40007b9534905774bc6c98c9e17977246b6ab182.svn-base +++ /dev/null @@ -1,266 +0,0 @@ -#include "daemons_manager.hpp" -#include "services_manager.hpp" -#include "ressources_manager.hpp" -#include "cxios.hpp" -#include "pool_ressource.hpp" -#include "type.hpp" -#include "server.hpp" -#include "servers_ressource.hpp" -#include "timer.hpp" - -namespace xios -{ - - - - CServicesManager::CServicesManager(bool isXiosServer) - { - - int commRank ; - xiosComm_ = CXios::getXiosComm() ; - MPI_Comm_rank(xiosComm_, &commRank) ; - - - // The global manager leader will be the process of rank 0 - // By "xiosComm" communicator construction - // - if servers exits it will be the root process of the servers communicator - // - otherwise the root process of the first model - - managerGlobalLeader_ = 0 ; - - MPI_Comm_rank(xiosComm_, &commRank) ; - winNotify_ = new CWindowManager(xiosComm_, maxBufferSize_) ; - winNotify_->lockWindow(commRank,0) ; - winNotify_->updateToWindow(commRank, this, &CServicesManager::notificationsDumpOut) ; - winNotify_->unlockWindow(commRank,0) ; - - winServices_ = new CWindowManager(xiosComm_, maxBufferSize_) ; - winServices_->lockWindow(commRank,0) ; - winServices_->updateToWindow(commRank, this, &CServicesManager::servicesDumpOut) ; - winServices_->unlockWindow(commRank,0) ; - - MPI_Barrier(xiosComm_) ; - } - - CServicesManager::~CServicesManager() - { - delete winNotify_ ; - delete winServices_ ; - } - - bool CServicesManager::createServices(const std::string& poolId, const std::string& serviceId, - int type, int size, int nbPartitions, bool wait) - { - - int leader ; - int poolSize ; - - info(40)<<"CServicesManager : waiting for pool info : "<getPoolInfo(poolId, poolSize, leader) ; - if (wait) - { - while (!ok) - { - CXios::getDaemonsManager()->eventLoop() ; - ok=CXios::getRessourcesManager()->getPoolInfo(poolId, poolSize, leader) ; - } - } - - if (ok) - { - info(40)<<"CServicesManager : create service notification to leader "<lockWindow(rank,0) ; - winNotify_->updateFromWindow(rank, this, &CServicesManager::notificationsDumpIn) ; - notifications_.push_back(std::make_tuple(serviceId,type,size,nbPartitions)) ; - winNotify_->updateToWindow(rank, this, &CServicesManager::notificationsDumpOut) ; - winNotify_->unlockWindow(rank,0) ; - } - - - void CServicesManager::checkCreateServicesNotification(void) - { - int commRank ; - MPI_Comm_rank(xiosComm_,&commRank) ; - winNotify_->lockWindow(commRank,0) ; - winNotify_->updateFromWindow(commRank, this, &CServicesManager::notificationsDumpIn) ; - - if (!notifications_.empty()) - { - auto info = notifications_.front() ; - xios::info(40)<<"CServicesManager : receive create service notification : "<(info)<getPoolRessource()->createService(get<0>(info), get<1>(info), get<2>(info), get<3>(info)) ; - notifications_.pop_front() ; - winNotify_->updateToWindow(commRank, this, &CServicesManager::notificationsDumpOut) ; - } - winNotify_->unlockWindow(commRank,0) ; - - } - - void CServicesManager::eventLoop(void) - { - CTimer::get("CServicesManager::eventLoop").resume(); - int flag ; - MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &flag, MPI_STATUS_IGNORE); - double time=MPI_Wtime() ; - if (time-lastEventLoop_ > eventLoopLatency_) - { - checkCreateServicesNotification() ; - lastEventLoop_=time ; - } - CTimer::get("CServicesManager::eventLoop").suspend(); - } - - - void CServicesManager::notificationsDumpOut(CBufferOut& buffer) - { - - buffer.realloc(maxBufferSize_) ; - - buffer<<(int)notifications_.size(); - - for(auto it=notifications_.begin();it!=notifications_.end(); ++it) - buffer << std::get<0>(*it) << static_cast(std::get<1>(*it))<< std::get<2>(*it) << std::get<3>(*it) ; - } - - void CServicesManager::notificationsDumpIn(CBufferIn& buffer) - { - std::string id ; - int type ; - int size; - int nbPartitions ; - - notifications_.clear() ; - int nbNotifications ; - buffer>>nbNotifications ; - for(int i=0;i>id>>type>>size>>nbPartitions ; - notifications_.push_back(std::make_tuple(id,type,size,nbPartitions)) ; - } - } - - - void CServicesManager::servicesDumpOut(CBufferOut& buffer) - { - - buffer.realloc(maxBufferSize_) ; - - buffer<<(int)services_.size(); - - for(auto it=services_.begin();it!=services_.end(); ++it) - { - auto key = it->first ; - auto val = it->second ; - buffer << std::get<0>(key) << std::get<1>(key) << std::get<2>(key) - << static_cast(std::get<0>(val)) << std::get<1>(val) << std::get<2>(val) << std::get<3>(val) ; - } - } - - void CServicesManager::servicesDumpIn(CBufferIn& buffer) - { - std::string poolId, serviceId ; - int partitionId ; - int type ; - int size; - int nbPartitions ; - int leader ; - - services_.clear() ; - int nbServices ; - buffer>>nbServices ; - for(int i=0;i>poolId>>serviceId>>partitionId>>type>>size>>nbPartitions>>leader ; - services_[std::tuple(poolId,serviceId,partitionId)]=std::make_tuple(type,size,nbPartitions,leader) ; - } - } - - void CServicesManager::registerService(const std::string& poolId, const std::string& serviceId, const int& partitionId, int type, - int size, int nbPartitions, int leader) - { - - info(40)<<"CServicesManager : registering service, poolId : "<lockWindowExclusive(managerGlobalLeader_) ; - winServices_->updateFromLockedWindow(managerGlobalLeader_, this, &CServicesManager::servicesDumpIn) ; - winServices_->flushWindow(managerGlobalLeader_) ; - services_[std::tuple(poolId,serviceId,partitionId)]=std::make_tuple(type,size,nbPartitions,leader) ; - winServices_->updateToLockedWindow(managerGlobalLeader_, this, &CServicesManager::servicesDumpOut) ; - winServices_->unlockWindow(managerGlobalLeader_) ; - -/* - winServices_->lockWindow(managerGlobalLeader_,0) ; - winServices_->updateFromWindow(managerGlobalLeader_, this, &CServicesManager::servicesDumpIn) ; - services_[std::tuple(poolId,serviceId,partitionId)]=std::make_tuple(type,size,nbPartitions,leader) ; - winServices_->updateToWindow(managerGlobalLeader_, this, &CServicesManager::servicesDumpOut) ; - winServices_->unlockWindow(managerGlobalLeader_,0) ;*/ - } - - bool CServicesManager::getServiceInfo(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& type, - int& size, int& nbPartitions, int& leader) - { - - winServices_->lockWindowShared(managerGlobalLeader_) ; - winServices_->updateFromLockedWindow(managerGlobalLeader_, this, &CServicesManager::servicesDumpIn) ; - winServices_->unlockWindow(managerGlobalLeader_) ; -/* - winServices_->lockWindow(managerGlobalLeader_,0) ; - winServices_->updateFromWindow(managerGlobalLeader_, this, &CServicesManager::servicesDumpIn) ; - winServices_->unlockWindow(managerGlobalLeader_,0) ;*/ - - auto it=services_.find(std::tuple(poolId,serviceId,partitionId)) ; - if ( it == services_.end()) return false ; - else - { - type= std::get<0>(it->second); - size= std::get<1>(it->second); - nbPartitions = std::get<2>(it->second); - leader = std::get<3>(it->second); - return true ; - } - } - - bool CServicesManager::getServiceLeader(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& leader) - { - int type; - int size ; - int nbPartitions; - return getServiceInfo(poolId, serviceId, partitionId, type, size, nbPartitions, leader) ; - } - - bool CServicesManager::getServiceType(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& type) - { - int size ; - int nbPartitions; - int leader; - return getServiceInfo(poolId, serviceId, partitionId, type, size, nbPartitions, leader) ; - } - - bool CServicesManager::getServiceNbPartitions(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& nbPartitions) - { - int size ; - int type; - int leader; - return getServiceInfo(poolId, serviceId, partitionId, type, size, nbPartitions, leader) ; - } - - bool CServicesManager::hasService(const std::string& poolId, const std::string& serviceId, const int& partitionId) - { - winServices_->lockWindow(managerGlobalLeader_,0) ; - winServices_->updateFromWindow(managerGlobalLeader_, this, &CServicesManager::servicesDumpIn) ; - winServices_->unlockWindow(managerGlobalLeader_,0) ; - auto it=services_.find(std::tuple(poolId, serviceId, partitionId)) ; - if ( it == services_.end()) return false ; - else return true ; - } - -} \ No newline at end of file diff --git a/xios_2311_src/trunk/.svn/pristine/40/401ec81a575dabf66be0e2a77e86173fe6a59060.svn-base b/xios_2311_src/trunk/.svn/pristine/40/401ec81a575dabf66be0e2a77e86173fe6a59060.svn-base deleted file mode 100644 index c75482b31294a6b403bb379a27c8884399c86a0b..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/40/401ec81a575dabf66be0e2a77e86173fe6a59060.svn-base +++ /dev/null @@ -1,21 +0,0 @@ -/********************************************************************* - * Copyright 1993, UCAR/Unidata - * See netcdf/COPYRIGHT file for copying and redistribution conditions. - * $Header: /upc/share/CVS/netcdf-3/libncdap3/dapnc.h,v 1.10 2009/09/23 22:26:01 dmh Exp $ - *********************************************************************/ -#ifndef DAPNC_H -#define DAPNC_H - -/* Take some types from libsrc4/netcdf.h*/ -#define NC_UBYTE 7 /* unsigned 1 byte int */ -#define NC_USHORT 8 /* unsigned 2-byte int */ -#define NC_UINT 9 /* unsigned 4-byte int */ -#define NC_INT64 10 /* signed 8-byte int */ -#define NC_UINT64 11 /* unsigned 8-byte int */ -#define NC_STRING 12 /* string */ -#define NC_VLEN 13 /* used internally for vlen types */ -#define NC_OPAQUE 14 /* used internally for opaque types */ -#define NC_ENUM 15 /* used internally for enum types */ -#define NC_COMPOUND 16 /* used internally for compound types */ - -#endif /*DAPNC_H*/ diff --git a/xios_2311_src/trunk/.svn/pristine/40/40289ac4ff7a8f486ca747ecba2c563306bda175.svn-base b/xios_2311_src/trunk/.svn/pristine/40/40289ac4ff7a8f486ca747ecba2c563306bda175.svn-base deleted file mode 100644 index 448199e89b35bbf9a4e27decac105392034cd540..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/40/40289ac4ff7a8f486ca747ecba2c563306bda175.svn-base +++ /dev/null @@ -1,371 +0,0 @@ -/* ************************************************************************** * - * Interface auto generated - do not modify * - * ************************************************************************** */ - -#include -#include "xios.hpp" -#include "attribute_template.hpp" -#include "object_template.hpp" -#include "group_template.hpp" -#include "icutil.hpp" -#include "icdate.hpp" -#include "timer.hpp" -#include "node_type.hpp" - -extern "C" -{ - typedef xios::CScalar* scalar_Ptr; - - void cxios_set_scalar_axis_type(scalar_Ptr scalar_hdl, const char * axis_type, int axis_type_size) - { - std::string axis_type_str; - if (!cstr2string(axis_type, axis_type_size, axis_type_str)) return; - CTimer::get("XIOS").resume(); - scalar_hdl->axis_type.fromString(axis_type_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_scalar_axis_type(scalar_Ptr scalar_hdl, char * axis_type, int axis_type_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(scalar_hdl->axis_type.getInheritedStringValue(), axis_type, axis_type_size)) - ERROR("void cxios_get_scalar_axis_type(scalar_Ptr scalar_hdl, char * axis_type, int axis_type_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_scalar_axis_type(scalar_Ptr scalar_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = scalar_hdl->axis_type.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_scalar_bounds(scalar_Ptr scalar_hdl, double* bounds, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(bounds, shape(extent[0]), neverDeleteData); - scalar_hdl->bounds.reference(tmp.copy()); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_scalar_bounds(scalar_Ptr scalar_hdl, double* bounds, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(bounds, shape(extent[0]), neverDeleteData); - tmp=scalar_hdl->bounds.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_scalar_bounds(scalar_Ptr scalar_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = scalar_hdl->bounds.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_scalar_bounds_name(scalar_Ptr scalar_hdl, const char * bounds_name, int bounds_name_size) - { - std::string bounds_name_str; - if (!cstr2string(bounds_name, bounds_name_size, bounds_name_str)) return; - CTimer::get("XIOS").resume(); - scalar_hdl->bounds_name.setValue(bounds_name_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_scalar_bounds_name(scalar_Ptr scalar_hdl, char * bounds_name, int bounds_name_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(scalar_hdl->bounds_name.getInheritedValue(), bounds_name, bounds_name_size)) - ERROR("void cxios_get_scalar_bounds_name(scalar_Ptr scalar_hdl, char * bounds_name, int bounds_name_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_scalar_bounds_name(scalar_Ptr scalar_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = scalar_hdl->bounds_name.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_scalar_comment(scalar_Ptr scalar_hdl, const char * comment, int comment_size) - { - std::string comment_str; - if (!cstr2string(comment, comment_size, comment_str)) return; - CTimer::get("XIOS").resume(); - scalar_hdl->comment.setValue(comment_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_scalar_comment(scalar_Ptr scalar_hdl, char * comment, int comment_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(scalar_hdl->comment.getInheritedValue(), comment, comment_size)) - ERROR("void cxios_get_scalar_comment(scalar_Ptr scalar_hdl, char * comment, int comment_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_scalar_comment(scalar_Ptr scalar_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = scalar_hdl->comment.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_scalar_label(scalar_Ptr scalar_hdl, const char * label, int label_size) - { - std::string label_str; - if (!cstr2string(label, label_size, label_str)) return; - CTimer::get("XIOS").resume(); - scalar_hdl->label.setValue(label_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_scalar_label(scalar_Ptr scalar_hdl, char * label, int label_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(scalar_hdl->label.getInheritedValue(), label, label_size)) - ERROR("void cxios_get_scalar_label(scalar_Ptr scalar_hdl, char * label, int label_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_scalar_label(scalar_Ptr scalar_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = scalar_hdl->label.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_scalar_long_name(scalar_Ptr scalar_hdl, const char * long_name, int long_name_size) - { - std::string long_name_str; - if (!cstr2string(long_name, long_name_size, long_name_str)) return; - CTimer::get("XIOS").resume(); - scalar_hdl->long_name.setValue(long_name_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_scalar_long_name(scalar_Ptr scalar_hdl, char * long_name, int long_name_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(scalar_hdl->long_name.getInheritedValue(), long_name, long_name_size)) - ERROR("void cxios_get_scalar_long_name(scalar_Ptr scalar_hdl, char * long_name, int long_name_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_scalar_long_name(scalar_Ptr scalar_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = scalar_hdl->long_name.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_scalar_mask(scalar_Ptr scalar_hdl, bool mask) - { - CTimer::get("XIOS").resume(); - scalar_hdl->mask.setValue(mask); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_scalar_mask(scalar_Ptr scalar_hdl, bool* mask) - { - CTimer::get("XIOS").resume(); - *mask = scalar_hdl->mask.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_scalar_mask(scalar_Ptr scalar_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = scalar_hdl->mask.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_scalar_name(scalar_Ptr scalar_hdl, const char * name, int name_size) - { - std::string name_str; - if (!cstr2string(name, name_size, name_str)) return; - CTimer::get("XIOS").resume(); - scalar_hdl->name.setValue(name_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_scalar_name(scalar_Ptr scalar_hdl, char * name, int name_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(scalar_hdl->name.getInheritedValue(), name, name_size)) - ERROR("void cxios_get_scalar_name(scalar_Ptr scalar_hdl, char * name, int name_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_scalar_name(scalar_Ptr scalar_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = scalar_hdl->name.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_scalar_positive(scalar_Ptr scalar_hdl, const char * positive, int positive_size) - { - std::string positive_str; - if (!cstr2string(positive, positive_size, positive_str)) return; - CTimer::get("XIOS").resume(); - scalar_hdl->positive.fromString(positive_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_scalar_positive(scalar_Ptr scalar_hdl, char * positive, int positive_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(scalar_hdl->positive.getInheritedStringValue(), positive, positive_size)) - ERROR("void cxios_get_scalar_positive(scalar_Ptr scalar_hdl, char * positive, int positive_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_scalar_positive(scalar_Ptr scalar_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = scalar_hdl->positive.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_scalar_prec(scalar_Ptr scalar_hdl, int prec) - { - CTimer::get("XIOS").resume(); - scalar_hdl->prec.setValue(prec); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_scalar_prec(scalar_Ptr scalar_hdl, int* prec) - { - CTimer::get("XIOS").resume(); - *prec = scalar_hdl->prec.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_scalar_prec(scalar_Ptr scalar_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = scalar_hdl->prec.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_scalar_scalar_ref(scalar_Ptr scalar_hdl, const char * scalar_ref, int scalar_ref_size) - { - std::string scalar_ref_str; - if (!cstr2string(scalar_ref, scalar_ref_size, scalar_ref_str)) return; - CTimer::get("XIOS").resume(); - scalar_hdl->scalar_ref.setValue(scalar_ref_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_scalar_scalar_ref(scalar_Ptr scalar_hdl, char * scalar_ref, int scalar_ref_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(scalar_hdl->scalar_ref.getInheritedValue(), scalar_ref, scalar_ref_size)) - ERROR("void cxios_get_scalar_scalar_ref(scalar_Ptr scalar_hdl, char * scalar_ref, int scalar_ref_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_scalar_scalar_ref(scalar_Ptr scalar_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = scalar_hdl->scalar_ref.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_scalar_standard_name(scalar_Ptr scalar_hdl, const char * standard_name, int standard_name_size) - { - std::string standard_name_str; - if (!cstr2string(standard_name, standard_name_size, standard_name_str)) return; - CTimer::get("XIOS").resume(); - scalar_hdl->standard_name.setValue(standard_name_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_scalar_standard_name(scalar_Ptr scalar_hdl, char * standard_name, int standard_name_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(scalar_hdl->standard_name.getInheritedValue(), standard_name, standard_name_size)) - ERROR("void cxios_get_scalar_standard_name(scalar_Ptr scalar_hdl, char * standard_name, int standard_name_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_scalar_standard_name(scalar_Ptr scalar_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = scalar_hdl->standard_name.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_scalar_unit(scalar_Ptr scalar_hdl, const char * unit, int unit_size) - { - std::string unit_str; - if (!cstr2string(unit, unit_size, unit_str)) return; - CTimer::get("XIOS").resume(); - scalar_hdl->unit.setValue(unit_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_scalar_unit(scalar_Ptr scalar_hdl, char * unit, int unit_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(scalar_hdl->unit.getInheritedValue(), unit, unit_size)) - ERROR("void cxios_get_scalar_unit(scalar_Ptr scalar_hdl, char * unit, int unit_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_scalar_unit(scalar_Ptr scalar_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = scalar_hdl->unit.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_scalar_value(scalar_Ptr scalar_hdl, double value) - { - CTimer::get("XIOS").resume(); - scalar_hdl->value.setValue(value); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_scalar_value(scalar_Ptr scalar_hdl, double* value) - { - CTimer::get("XIOS").resume(); - *value = scalar_hdl->value.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_scalar_value(scalar_Ptr scalar_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = scalar_hdl->value.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } -} diff --git a/xios_2311_src/trunk/.svn/pristine/40/404d919d869aeee08eb87c12d936288870122887.svn-base b/xios_2311_src/trunk/.svn/pristine/40/404d919d869aeee08eb87c12d936288870122887.svn-base deleted file mode 100644 index a16f4468513ecf5f7da0eff49d11c1fa3bb5a222..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/40/404d919d869aeee08eb87c12d936288870122887.svn-base +++ /dev/null @@ -1,22 +0,0 @@ -MODULE ZOOM_AXIS_INTERFACE - USE, INTRINSIC :: ISO_C_BINDING - - INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99 - - SUBROUTINE cxios_zoom_axis_handle_create(ret, idt, idt_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_zoom_axis_handle_create - - SUBROUTINE cxios_zoom_axis_valid_id(ret, idt, idt_size) BIND(C) - USE ISO_C_BINDING - LOGICAL (kind = C_BOOL) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_zoom_axis_valid_id - - END INTERFACE - -END MODULE ZOOM_AXIS_INTERFACE diff --git a/xios_2311_src/trunk/.svn/pristine/40/408d45f17278bf30c7a772ca814c493208065c4f.svn-base b/xios_2311_src/trunk/.svn/pristine/40/408d45f17278bf30c7a772ca814c493208065c4f.svn-base deleted file mode 100644 index 132cf13eb615d4987321c1e88f9da5f9fdd6df86..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/40/408d45f17278bf30c7a772ca814c493208065c4f.svn-base +++ /dev/null @@ -1,51 +0,0 @@ -/* ************************************************************************** * - * Copyright © IPSL/LSCE, xios, Avril 2010 - Octobre 2011 * - * ************************************************************************** */ - -#include - -#include - -#include "xios.hpp" - -#include "object_template.hpp" -#include "group_template.hpp" -#include "attribute_template.hpp" - -#include "icutil.hpp" -#include "timer.hpp" -#include "generate_rectilinear_domain.hpp" - -extern "C" -{ -// /////////////////////////////// Définitions ////////////////////////////// // - - // ----------------------- Redéfinition de types ---------------------------- - - typedef xios::CGenerateRectilinearDomain * XGenDomainPtr; - - // ------------------------ Création des handle ----------------------------- - void cxios_generate_rectilinear_domain_handle_create(XGenDomainPtr * _ret, const char * _id, int _id_len) - TRY - { - std::string id; - if (!cstr2string(_id, _id_len, id)) return; - CTimer::get("XIOS").resume() ; - *_ret = xios::CGenerateRectilinearDomain::get(id); - CTimer::get("XIOS").suspend() ; - } - CATCH_DUMP_STACK - - // -------------------- Vérification des identifiants ----------------------- - void cxios_generate_rectilinear_domain_valid_id(bool * _ret, const char * _id, int _id_len) - TRY - { - std::string id; - if (!cstr2string(_id, _id_len, id)) return; - - CTimer::get("XIOS").resume() ; - *_ret = xios::CGenerateRectilinearDomain::has(id); - CTimer::get("XIOS").suspend() ; - } - CATCH_DUMP_STACK -} // extern "C" diff --git a/xios_2311_src/trunk/.svn/pristine/40/409aea5ae43150b40e8654289388c1e127523aea.svn-base b/xios_2311_src/trunk/.svn/pristine/40/409aea5ae43150b40e8654289388c1e127523aea.svn-base deleted file mode 100644 index e5807ff2f39fbf05cbaca1c2e8ebe1098768d457..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/40/409aea5ae43150b40e8654289388c1e127523aea.svn-base +++ /dev/null @@ -1,69 +0,0 @@ -#include "object_template_impl.hpp" -#include "xios_spl.hpp" -#include "node_type.hpp" - -namespace xios -{ - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; - template class CObjectTemplate; -} diff --git a/xios_2311_src/trunk/.svn/pristine/40/40ffc067e8b62fad32bc757eb39c05ffabaccc46.svn-base b/xios_2311_src/trunk/.svn/pristine/40/40ffc067e8b62fad32bc757eb39c05ffabaccc46.svn-base deleted file mode 100644 index 4021a4d32254b42930b6935f022a4bb65b059011..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/40/40ffc067e8b62fad32bc757eb39c05ffabaccc46.svn-base +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 1996, University Corporation for Atmospheric Research - * See netcdf/COPYRIGHT file for copying and redistribution conditions. - */ -/* $Id: rnd.h,v 2.13 1996/12/11 05:46:54 davis Exp $ */ -#ifndef _RNDUP - -/* useful for aligning memory */ -#define _RNDUP(x, unit) ((((x) + (unit) - 1) / (unit)) \ - * (unit)) -#define _RNDDOWN(x, unit) ((x) - ((x)%(unit))) - -#define M_RND_UNIT (sizeof(double)) -#define M_RNDUP(x) _RNDUP(x, M_RND_UNIT) -#define M_RNDDOWN(x) __RNDDOWN(x, M_RND_UNIT) - -#endif diff --git a/xios_2311_src/trunk/.svn/pristine/41/4101e7748d7c091bd0bcdb6dd2f06f70bcb77302.svn-base b/xios_2311_src/trunk/.svn/pristine/41/4101e7748d7c091bd0bcdb6dd2f06f70bcb77302.svn-base deleted file mode 100644 index 6d09f3ef0e67b1142a25406361f6cb1d0e1fc289..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/41/4101e7748d7c091bd0bcdb6dd2f06f70bcb77302.svn-base +++ /dev/null @@ -1,77 +0,0 @@ -/*! - \file dht_data_types.hpp - \author Ha NGUYEN - \since 17 Mars 2016 - \date 17 Mars 2016 - - \brief Customized data type for dht - */ - -#ifndef __XIOS_DHT_DATATYPES_HPP__ -#define __XIOS_DHT_DATATYPES_HPP__ - -#include "utils.hpp" - -namespace xios -{ -typedef std::pair PairIntInt; - -template -struct ProcessDHTElement -{ - typedef T Type; - static int typeSize() - { - return sizeof(Type); - } - - static void packElement(const T& inputElement, unsigned char* packedElement, int& index) - { - if (NULL == packedElement) index += sizeof(Type); - else - { - *(T *)(&packedElement[index]) = inputElement; - index+=sizeof(Type); - } - } - - static void unpackElement(T& outputElement, unsigned char* unpackedElement, int& index) - { - outputElement = *(Type*)(&unpackedElement[index]); - index+=sizeof(Type); - } -}; - -template<> -struct ProcessDHTElement -{ - typedef PairIntInt Type; - static int typeSize() - { - return (2*sizeof(int)); - } - - static void packElement(const PairIntInt& inputElement, unsigned char* packedElement, int& index) - { - if (NULL == packedElement) index +=(2*sizeof(int)); - else - { - *(int *)(&packedElement[index]) = inputElement.first; - index+=sizeof(int); - *(int *)(&packedElement[index]) = inputElement.second; - index+=sizeof(int); - } - } - - static void unpackElement(PairIntInt& outputElement, unsigned char* unpackedElement, int& index) - { - outputElement.first=*(int *)(&unpackedElement[index]); - index+=sizeof(int); - outputElement.second=*(int *)(&unpackedElement[index]); - index+=sizeof(int); - } -}; - -} - -#endif // __XIOS_DHT_DATATYPES_HPP__ diff --git a/xios_2311_src/trunk/.svn/pristine/41/414dcff2fdc6f0250b3f7b179d46895ea4be6fbe.svn-base b/xios_2311_src/trunk/.svn/pristine/41/414dcff2fdc6f0250b3f7b179d46895ea4be6fbe.svn-base deleted file mode 100644 index dd99202febc60d1f15ff4c8faf1769a6a23f1fbe..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/41/414dcff2fdc6f0250b3f7b179d46895ea4be6fbe.svn-base +++ /dev/null @@ -1,68 +0,0 @@ -/*! - \file axis_algorithm_interpolate.hpp - \author Ha NGUYEN - \since 23 June 2015 - \date 23 June 2015 - - \brief Algorithm for interpolation on an axis. - */ -#ifndef __XIOS_AXIS_ALGORITHM_INTERPOLATE_HPP__ -#define __XIOS_AXIS_ALGORITHM_INTERPOLATE_HPP__ - -#include "algorithm_transformation_weight.hpp" -#include "transformation.hpp" - -namespace xios { - -class CAxis; -class CGrid; -class CInterpolateAxis; - -/*! - \class CAxisAlgorithmInterpolate - Implementing interpolation on axis - The values on axis source are assumed monotonic -*/ -class CAxisAlgorithmInterpolate : public CAlgorithmTransformationWeight -{ -public: - CAxisAlgorithmInterpolate(bool isSource, CAxis* axisDestination, CAxis* axisSource, CInterpolateAxis* interpAxis); - - virtual ~CAxisAlgorithmInterpolate() {} - - static bool registerTrans(); - virtual StdString getAlgoName() {return "\\ninterpolate_axis";} - -private: - void computeRemap(const std::vector* >& dataAuxInputs) ; - void retrieveAllAxisValue(const CArray& axisValue, const CArray& axisMask, - std::vector& recvBuff, std::vector& indexVec); - void computeInterpolantPoint(const std::vector& recvBuff, const std::vector&, int transPos = 0); - void computeWeightedValueAndMapping(const std::map > >& interpolatingIndexValues, int transPos = 0); - void fillInAxisValue(std::vector >& vecAxisValue, - const std::vector* >& dataAuxInputs); - -private: - // Interpolation order - int order_; - StdString coordinate_; - std::vector > transPosition_; - CAxis* axisSrc_=nullptr ; - CAxis* axisDest_=nullptr; - -public: - static shared_ptr create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition); - static bool dummyRegistered_; -}; - -} - -#endif // __XIOS_AXIS_ALGORITHM_INTERPOLATE_HPP__ diff --git a/xios_2311_src/trunk/.svn/pristine/41/4164e861992073ef37efe8d4935ea29dd9082993.svn-base b/xios_2311_src/trunk/.svn/pristine/41/4164e861992073ef37efe8d4935ea29dd9082993.svn-base deleted file mode 100644 index 90a835d2b01763e5c7da46944329f9d2aa1c9fed..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/41/4164e861992073ef37efe8d4935ea29dd9082993.svn-base +++ /dev/null @@ -1,196 +0,0 @@ -#include "servers_ressource.hpp" -#include "window_manager.hpp" -#include "ressources_manager.hpp" -#include "pool_ressource.hpp" -#include "cxios.hpp" -#include "mpi.hpp" -#include "timer.hpp" -#include -#include - - - - -namespace xios -{ - using namespace std ; - - CServersRessource::CServersRessource(MPI_Comm serverComm) : poolRessource_(nullptr), finalizeSignal_(false) - { - - MPI_Comm_dup(serverComm, &serverComm_) ; - MPI_Comm xiosComm=CXios::getXiosComm() ; - - int localRank, globalRank ; - MPI_Comm_rank(xiosComm,&globalRank) ; - MPI_Comm_rank(serverComm_,&localRank) ; - - winNotify_ = new CWindowManager(serverComm_, maxBufferSize_) ; - MPI_Barrier(serverComm_) ; - if (localRank==localLeader_) - { - int commSize ; - MPI_Comm_size(serverComm_,&commSize) ; - CXios::getRessourcesManager()->registerServerLeader(globalRank) ; - CXios::getRessourcesManager()->registerRessourcesSize(commSize) ; - freeRessourcesRank_.resize(commSize) ; - for(int i=0;i newFreeRessourcesRank(freeRessourcesRank_.size()-size) ; - - bool isPartOf ; - - for(int i=0; ilockWindow(rank,0) ; - winNotify_->pushToWindow(rank, this, &CServersRessource::notificationsDumpOut) ; - winNotify_->unlockWindow(rank,0) ; - } - - - void CServersRessource::notificationsDumpOut(CBufferOut& buffer) - { - - buffer.realloc(maxBufferSize_) ; - - if (notifyOutType_==NOTIFY_CREATE_POOL) - { - auto& arg=notifyOutCreatePool_ ; - buffer << notifyOutType_ << std::get<0>(arg) << std::get<1>(arg) ; - } - else if (notifyOutType_==NOTIFY_FINALIZE) buffer << notifyOutType_ ; - } - - void CServersRessource::notificationsDumpIn(CBufferIn& buffer) - { - if (buffer.bufferSize() == 0) notifyInType_= NOTIFY_NOTHING ; - else - { - buffer>>notifyInType_; - if (notifyInType_==NOTIFY_CREATE_POOL) - { - auto& arg=notifyInCreatePool_ ; - buffer >> std::get<0>(arg) >> std::get<1>(arg) ; - } - else if (notifyInType_==NOTIFY_FINALIZE) { /*nothing to do*/} - } - } - - bool CServersRessource::eventLoop(bool serviceOnly) - { - CTimer::get("CServersRessource::eventLoop").resume(); - double time=MPI_Wtime() ; - int flag ; - MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &flag, MPI_STATUS_IGNORE); - - if (time-lastEventLoop_ > eventLoopLatency_) - { - checkNotifications() ; - lastEventLoop_=time ; - } - - if (poolRessource_!=nullptr) - { - if (poolRessource_->eventLoop(serviceOnly)) - { - delete poolRessource_ ; - poolRessource_=nullptr ; - // don't forget to free pool ressource later - } - } - CTimer::get("CServersRessource::eventLoop").suspend(); - if (poolRessource_==nullptr && finalizeSignal_) return true ; - else return false ; - } - - void CServersRessource::checkNotifications(void) - { - int commRank ; - MPI_Comm_rank(serverComm_, &commRank) ; - winNotify_->lockWindow(commRank,0) ; - winNotify_->popFromWindow(commRank, this, &CServersRessource::notificationsDumpIn) ; - winNotify_->unlockWindow(commRank,0) ; - if (notifyInType_==NOTIFY_CREATE_POOL) createPool() ; - else if (notifyInType_==NOTIFY_FINALIZE) finalizeSignal() ; - } - - void CServersRessource::createPool(void) - { - auto& arg=notifyInCreatePool_ ; - string poolId=get<0>(arg) ; - bool isPartOf=get<1>(arg) ; - - int commRank ; - MPI_Comm poolComm ; - MPI_Comm_rank(freeRessourcesComm_,&commRank) ; - MPI_Comm_split(freeRessourcesComm_, isPartOf, commRank, &poolComm) ; - - if (isPartOf) - { - poolRessource_ = new CPoolRessource(poolComm, poolId) ; - MPI_Comm_free(&poolComm) ; - } - else - { - MPI_Comm_free(&freeRessourcesComm_) ; - freeRessourcesComm_=poolComm ; - } - - } - - void CServersRessource::finalizeSignal(void) - { - finalizeSignal_=true ; - if (poolRessource_!=nullptr) poolRessource_->finalizeSignal() ; - } - - bool CServersRessource::isServerLeader(void) - { - int commRank ; - MPI_Comm_rank(serverComm_,&commRank) ; - if (commRank==localLeader_) return true ; - else return false ; - } - - CServersRessource::~CServersRessource() - { - delete winNotify_ ; - } -} \ No newline at end of file diff --git a/xios_2311_src/trunk/.svn/pristine/41/4192d78cf29b5072911b5770da855a9a0857c35c.svn-base b/xios_2311_src/trunk/.svn/pristine/41/4192d78cf29b5072911b5770da855a9a0857c35c.svn-base deleted file mode 100644 index 8504068d62fdc33b6f0d5a112c2b7ad2f6bfc87a..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/41/4192d78cf29b5072911b5770da855a9a0857c35c.svn-base +++ /dev/null @@ -1,304 +0,0 @@ -#include "intersection_ym.hpp" -#include "elt.hpp" -#include "clipper.hpp" -#include "gridRemap.hpp" -#include "triple.hpp" -#include "polyg.hpp" -#include -#include -#include -#include -#include -#include "earcut.hpp" -#include - - -#define epsilon 1e-3 // epsilon distance ratio over side lenght for approximate small circle by great circle -#define fusion_vertex 1e-13 - -namespace sphereRemap { - -using namespace std; -using namespace ClipperLib ; - - -double intersect_ym(Elt *a, Elt *b) -{ - - using N = uint32_t; - using Point = array; - vector vect_points; - vector< vector > polyline; - -// transform small circle into piece of great circle if necessary - - vector srcPolygon ; - createGreatCirclePolygon(*b, srcGrid.pole, srcPolygon) ; -// b->area=polygonarea(&srcPolygon[0],srcPolygon.size()) ; - vector dstPolygon ; - createGreatCirclePolygon(*a, tgtGrid.pole, dstPolygon) ; - a->area=polygonarea(&dstPolygon[0],dstPolygon.size()) ; // just for target - -// compute coordinates of the polygons into the gnomonique plane tangent to barycenter C of dst polygon -// transform system coordinate : Z axis along OC - int na=dstPolygon.size() ; - Coord *a_gno = new Coord[na]; - int nb=srcPolygon.size() ; - Coord *b_gno = new Coord[nb]; - - Coord OC=barycentre(a->vertex,a->n) ; - Coord Oz=OC ; - Coord Ox=crossprod(Coord(0,0,1),Oz) ; -// choose Ox not too small to avoid rounding error - if (norm(Ox)< 0.1) Ox=crossprod(Coord(0,1,0),Oz) ; - Ox=Ox*(1./norm(Ox)) ; - Coord Oy=crossprod(Oz,Ox) ; - double cos_alpha; - - /// vector polyline; - for(int n=0; n() ); - vect_points[n][0] = a_gno[n].x; - vect_points[n][1] = a_gno[n].y; - - } - - polyline.push_back(vect_points); - vector indices_a_gno = mapbox::earcut(polyline); - - double area_a_gno=0 ; - for(int i=0;i() ); - vect_points[n][0] = b_gno[n].x; - vect_points[n][1] = b_gno[n].y; - } - - - polyline.push_back(vect_points); - vector indices_b_gno = mapbox::earcut(polyline); - - double area_b_gno=0 ; - for(int i=0;i xmax) xmax=a_gno[n].x ; - - if (a_gno[n].y< ymin) ymin=a_gno[n].y ; - else if (a_gno[n].y > ymax) ymax=a_gno[n].y ; - } - - for(int n=0; n xmax) xmax=b_gno[n].x ; - - if (b_gno[n].y< ymin) ymin=b_gno[n].y ; - else if (b_gno[n].y > ymax) ymax=b_gno[n].y ; - } - - double xoffset=(xmin+xmax)*0.5 ; - double yoffset=(ymin+ymax)*0.5 ; - double xscale= 1e-4*0.5*hiRange/(xmax-xoffset) ; - double yscale= 1e-4*0.5*hiRange/(ymax-yoffset) ; -// Problem with numerical precision if using larger scaling factor - -// 2) Compute intersection with clipper -// clipper use only long integer value for vertex => offset and rescale - - Paths src(1), dst(1), intersection; - - for(int n=0; nfusion_vertex*fusion_vertex) - { - intersectPolygon[nv]=intersectPolygon[n] ; - vect_points.push_back( array() ); - vect_points[nv][0] = intersectPolygon[n].x; - vect_points[nv][1] = intersectPolygon[n].y; - nv++ ; - } - } - - polyline.push_back(vect_points); - vect_points.clear(); - - if (nv>2) - { - - vector indices = mapbox::earcut(polyline); - - double area2=0 ; - for(int i=0;ix = exact_barycentre(intersectPolygon,nv); -// is->area = polygonarea(intersectPolygon,nv) ; - is->area = area2 ; - -// if (is->area < 1e-12) cout<<"Small intersection : "<area<area==0.) delete is ; - else - { - is->id = b->id; /* intersection holds id of corresponding source element (see Elt class definition for details about id) */ - is->src_id = b->src_id; - is->n = nv; - (a->is).push_back(is); - (b->is).push_back(is); - area=is->area ; - } - } - delete[] intersectPolygon ; - } - - delete[] a_gno ; - delete[] b_gno ; - return area ; - -} - - - -void createGreatCirclePolygon(const Elt& element, const Coord& pole, vector& coordinates) -{ - int nv = element.n; - - double z,r ; - int north ; - int iterations ; - - Coord xa,xb,xi,xc ; - Coord x1,x2,x ; - - for(int i=0;i < nv ;i++) - { - north = (scalarprod(element.edge[i], pole) < 0) ? -1 : 1; - z=north*element.d[i] ; - - if (z != 0.0) - { - - xa=element.vertex[i] ; - xb=element.vertex[(i+1)%nv] ; - iterations=0 ; - -// compare max distance (at mid-point) between small circle and great circle -// if greater the epsilon refine the small circle by dividing it recursively. - - do - { - xc = pole * z ; - r=sqrt(1-z*z) ; - xi=(xa+xb)*0.5 ; - x1=xc+(xi-xc)*(r/norm(xi-xc)) ; - x2= xi*(1./norm(xi)) ; - ++iterations; - xb=x1 ; - } while(norm(x1-x2)/norm(xa-xb)>epsilon) ; - - iterations = 1 << (iterations-1) ; - -// small circle divided in "iterations" great circle arc - Coord delta=(element.vertex[(i+1)%nv]-element.vertex[i])*(1./iterations); - x=xa ; - for(int j=0; j -#include -#include -#include "exception.hpp" -#include "array_new.hpp" -#include "utils.hpp" - -using namespace std; - -namespace xios -{ - class COperatorExpr - { - public: - typedef double (*functionScalar)(double); - typedef double (*functionScalarScalar)(double, double); - typedef double (*functionScalarScalarScalar)(double, double,double); - typedef CArray (*functionField)(const CArray&); - typedef CArray (*functionFieldField)(const CArray&, const CArray&); - typedef CArray (*functionFieldScalar)(const CArray&, double); - typedef CArray (*functionScalarField)(double, const CArray&); - typedef CArray (*functionScalarScalarField)(double, double, const CArray&); - typedef CArray (*functionScalarFieldScalar)(double, const CArray&, double); - typedef CArray (*functionScalarFieldField)(double, const CArray&, const CArray&); - typedef CArray (*functionFieldScalarScalar)(const CArray&, double, double); - typedef CArray (*functionFieldScalarField)(const CArray&, double, const CArray&); - typedef CArray (*functionFieldFieldScalar)(const CArray&, const CArray&, double); - typedef CArray (*functionFieldFieldField)(const CArray&, const CArray&, const CArray&); - - COperatorExpr(void) - { - opScalar[string("neg")] = neg_s; - opScalar[string("cos")] = cos_s; - opScalar[string("sin")] = sin_s; - opScalar[string("tan")] = tan_s; - opScalar[string("exp")] = exp_s; - opScalar[string("log")] = log_s; - opScalar[string("log10")] = log10_s; - opScalar[string("sqrt")] = sqrt_s; - - opScalarScalar[string("add")] = add_ss; - opScalarScalar[string("minus")] = minus_ss; - opScalarScalar[string("mult")] = mult_ss; - opScalarScalar[string("div")] = div_ss; - opScalarScalar[string("pow")] = pow_ss; - opScalarScalar[string("eq")] = eq_ss; - opScalarScalar[string("lt")] = lt_ss; - opScalarScalar[string("gt")] = gt_ss; - opScalarScalar[string("le")] = le_ss; - opScalarScalar[string("ge")] = ge_ss; - opScalarScalar[string("ne")] = ne_ss; - opScalarScalarScalar[string("cond")] = cond_sss; - - opField[string("neg")] = neg_f; - opField[string("cos")] = cos_f; - opField[string("sin")] = sin_f; - opField[string("tan")] = tan_f; - opField[string("exp")] = exp_f; - opField[string("log")] = log_f; - opField[string("log10")] = log10_f; - opField[string("sqrt")] = sqrt_f; - - opFieldField[string("add")] = add_ff; - opFieldField[string("minus")] = minus_ff; - opFieldField[string("mult")] = mult_ff; - opFieldField[string("div")] = div_ff; - opFieldField[string("pow")] = pow_ff; - opFieldField[string("eq")] = eq_ff; - opFieldField[string("lt")] = lt_ff; - opFieldField[string("gt")] = gt_ff; - opFieldField[string("le")] = le_ff; - opFieldField[string("ge")] = ge_ff; - opFieldField[string("ne")] = ne_ff; - - opFieldScalar[string("add")] = add_fs; - opFieldScalar[string("minus")] = minus_fs; - opFieldScalar[string("mult")] = mult_fs; - opFieldScalar[string("div")] = div_fs; - opFieldScalar[string("pow")] = pow_fs; - opFieldScalar[string("eq")] = eq_fs; - opFieldScalar[string("lt")] = lt_fs; - opFieldScalar[string("gt")] = gt_fs; - opFieldScalar[string("le")] = le_fs; - opFieldScalar[string("ge")] = ge_fs; - opFieldScalar[string("ne")] = ne_fs; - - opScalarField[string("add")] = add_sf; - opScalarField[string("minus")] = minus_sf; - opScalarField[string("mult")] = mult_sf; - opScalarField[string("div")] = div_sf; - opScalarField[string("eq")] = eq_sf; - opScalarField[string("lt")] = lt_sf; - opScalarField[string("gt")] = gt_sf; - opScalarField[string("le")] = le_sf; - opScalarField[string("ge")] = ge_sf; - opScalarField[string("ne")] = ne_sf; - - opScalarScalarField[string("cond")] = cond_ssf; - opScalarFieldScalar[string("cond")] = cond_sfs; - opScalarFieldField[string("cond")] = cond_sff; - opFieldScalarScalar[string("cond")] = cond_fss; - opFieldScalarField[string("cond")] = cond_fsf; - opFieldFieldScalar[string("cond")] = cond_ffs; - opFieldFieldField[string("cond")] = cond_fff; - - - } - - functionScalar getOpScalar(const string& id) - { - map::iterator it; - it = opScalar.find(id); - if (it == opScalar.end()) ERROR("functionScalar COperatorExpr::getOpScalar(const string& id)", << "unknown operator : " << id) - return it->second; - } - - functionScalarScalar getOpScalarScalar(const string& id) - { - map::iterator it; - it = opScalarScalar.find(id); - if (it == opScalarScalar.end()) ERROR("functionScalarScalar COperatorExpr::getOpScalarScalar(const string& id)", << "unknown operator : " << id) - return it->second; - } - - functionScalarScalarScalar getOpScalarScalarScalar(const string& id) - { - map::iterator it; - it = opScalarScalarScalar.find(id); - if (it == opScalarScalarScalar.end()) ERROR("functionScalarScalarScalar getOpScalarScalarScalar(const string& id)", << "unknown operator : " << id) - return it->second; - } - - functionField getOpField(const string& id) - { - map::iterator it; - it = opField.find(id); - if (it == opField.end()) ERROR("functionField COperatorExpr::getOpField(const string& id)", << "unknown operator : " << id) - return it->second; - } - - functionFieldField getOpFieldField(const string& id) - { - map::iterator it; - it = opFieldField.find(id); - if (it == opFieldField.end()) ERROR("dfunctionFieldField COperatorExpr::getOpFieldField(const string& id)", << "unknown operator : " << id) - return it->second; - } - - functionFieldScalar getOpFieldScalar(const string& id) - { - map::iterator it; - it = opFieldScalar.find(id); - if (it == opFieldScalar.end()) ERROR("functionFieldScalar COperatorExpr::getOpFieldScalar(const string& id)", << "unknown operator : " << id) - return it->second; - } - - functionScalarField getOpScalarField(const string& id) - { - map::iterator it; - it = opScalarField.find(id); - if (it == opScalarField.end()) ERROR("functionScalarField COperatorExpr::getOpFieldField(const string& id)", << "unknown operator : " << id) - return it->second; - } - - functionScalarScalarField getOpScalarScalarField(const string& id) - { - map::iterator it; - it = opScalarScalarField.find(id); - if (it == opScalarScalarField.end()) ERROR("functionScalarScalarField getOpScalarScalarField(const string& id)", << "unknown operator : " << id) - return it->second; - } - - functionScalarFieldScalar getOpScalarFieldScalar(const string& id) - { - map::iterator it; - it = opScalarFieldScalar.find(id); - if (it == opScalarFieldScalar.end()) ERROR("functionScalarFieldScalar getOpScalarScalarField(const string& id)", << "unknown operator : " << id) - return it->second; - } - - functionScalarFieldField getOpScalarFieldField(const string& id) - { - map::iterator it; - it = opScalarFieldField.find(id); - if (it == opScalarFieldField.end()) ERROR("functionScalarFieldField getOpScalarFieldField(const string& id)", << "unknown operator : " << id) - return it->second; - } - - functionFieldScalarScalar getOpFieldScalarScalar(const string& id) - { - map::iterator it; - it = opFieldScalarScalar.find(id); - if (it == opFieldScalarScalar.end()) ERROR("functionFieldScalarScalar getOpFieldScalarScalar(const string& id)", << "unknown operator : " << id) - return it->second; - } - - functionFieldScalarField getOpFieldScalarField(const string& id) - { - map::iterator it; - it = opFieldScalarField.find(id); - if (it == opFieldScalarField.end()) ERROR("functionFieldScalarField getOpFieldScalarField(const string& id)", << "unknown operator : " << id) - return it->second; - } - - functionFieldFieldScalar getOpFieldFieldScalar(const string& id) - { - map::iterator it; - it = opFieldFieldScalar.find(id); - if (it == opFieldFieldScalar.end()) ERROR("functionFieldFieldScalar getOpFieldFieldScalar(const string& id)", << "unknown operator : " << id) - return it->second; - } - - functionFieldFieldField getOpFieldFieldField(const string& id) - { - map::iterator it; - it = opFieldFieldField.find(id); - if (it == opFieldFieldField.end()) ERROR("functionFieldFieldField getOpFieldFieldField(const string& id)", << "unknown operator : " << id) - return it->second; - } - - - map opScalar; - map opScalarScalar; - map opScalarScalarScalar; - map opField; - map opFieldField; - map opFieldScalar; - map opScalarField; - map opScalarScalarField; - map opScalarFieldScalar; - map opScalarFieldField; - map opFieldScalarScalar; - map opFieldScalarField; - map opFieldFieldScalar; - map opFieldFieldField; - - - - static inline double neg_s(double x) { return -x; } - static inline double cos_s(double x) { return std::cos(x); } - static inline double sin_s(double x) { return std::sin(x); } - static inline double tan_s(double x) { return std::tan(x); } - static inline double exp_s(double x) { return std::exp(x); } - static inline double log_s(double x) { return std::log(x); } - static inline double log10_s(double x) { return std::log10(x); } - static inline double sqrt_s(double x) { return std::sqrt(x); } - - static inline double add_ss(double x, double y) { return x + y; } - static inline double minus_ss(double x, double y) { return x - y; } - static inline double mult_ss(double x, double y) { return x * y; } - static inline double div_ss(double x, double y) { return x / y; } - static inline double pow_ss(double x, double y) { return std::pow(x,y); } - - static inline double eq_ss(double x, double y) // specific check for NaN - { - bool xNan=NumTraits::isNan(x) ; - bool yNan=NumTraits::isNan(y) ; - if (xNan && yNan) return true ; - else if (xNan) return false ; - else if (yNan) return false ; - else return x == y; - } - - static inline double lt_ss(double x, double y) { return x < y; } - static inline double gt_ss(double x, double y) { return x > y; } - static inline double le_ss(double x, double y) { return x <= y; } - static inline double ge_ss(double x, double y) { return x >= y; } - - static inline double ne_ss(double x, double y) // specific check for NaN - { - bool xNan=NumTraits::isNan(x) ; - bool yNan=NumTraits::isNan(y) ; - if (xNan && yNan) return false ; - else if (xNan) return true ; - else if (yNan) return true ; - else return x != y; - } - - static inline CArray neg_f(const CArray& x) { return Array(-x); } - static inline CArray cos_f(const CArray& x) { return Array(cos(x)); } - static inline CArray sin_f(const CArray& x) { return Array(sin(x)); } - static inline CArray tan_f(const CArray& x) { return Array(tan(x)); } - static inline CArray exp_f(const CArray& x) { return Array(exp(x)); } - static inline CArray log_f(const CArray& x) { return Array(log(x)); } - static inline CArray log10_f(const CArray& x) { return Array(log10(x)); } - static inline CArray sqrt_f(const CArray& x) { return Array(sqrt(x)); } - - static inline CArray add_ff(const CArray& x, const CArray& y) { return Array(x + y); } - static inline CArray minus_ff(const CArray& x, const CArray& y) { return Array(x - y); } - static inline CArray mult_ff(const CArray& x, const CArray& y) { return Array(x * y); } - static inline CArray div_ff(const CArray& x, const CArray& y) { return Array(x / y); } - static inline CArray pow_ff(const CArray& x, const CArray& y) { return Array(pow(x,y)); } - static inline CArray eq_ff(const CArray& x, const CArray& y) { return Array(x == y); } - static inline CArray lt_ff(const CArray& x, const CArray& y) { return Array(x < y); } - static inline CArray gt_ff(const CArray& x, const CArray& y) { return Array(x > y); } - static inline CArray le_ff(const CArray& x, const CArray& y) { return Array(x <= y); } - static inline CArray ge_ff(const CArray& x, const CArray& y) { return Array(x >= y); } - static inline CArray ne_ff(const CArray& x, const CArray& y) { return Array(x != y); } - - static inline CArray add_fs(const CArray& x, double y) { return Array(x + y); } - static inline CArray minus_fs(const CArray& x, double y) { return Array(x - y); } - static inline CArray mult_fs(const CArray& x, double y) { return Array(x * y); } - static inline CArray div_fs(const CArray& x, double y) { return Array(x / y); } - static inline CArray pow_fs(const CArray& x, double y) { return Array(pow(x,y)); } - - static inline CArray eq_fs(const CArray& x, double y) // specific check for NaN - { - if (NumTraits::isNan(y)) - { - CArray ret(x.numElements()) ; - Array::const_iterator itx=x.begin(),itxe=x.end(); - Array::iterator itret=ret.begin() ; - for(;itx!=itxe;++itx,++itret) *itret=NumTraits::isNan(*itx) ; - return ret ; - } - else return Array(x == y); - } - - static inline CArray lt_fs(const CArray& x, double y) { return Array(x < y); } - static inline CArray gt_fs(const CArray& x, double y) { return Array(x > y); } - static inline CArray le_fs(const CArray& x, double y) { return Array(x <= y); } - static inline CArray ge_fs(const CArray& x, double y) { return Array(x >= y); } - - static inline CArray ne_fs(const CArray& x, double y) // specific check for NaN - { - if (NumTraits::isNan(y)) - { - CArray ret(x.numElements()) ; - Array::const_iterator itx=x.begin(),itxe=x.end(); - Array::iterator itret=ret.begin() ; - for(;itx!=itxe;++itx,++itret) *itret = !NumTraits::isNan(*itx) ; - return ret ; - } - else return Array(x != y); - } - - static inline CArray add_sf(double x, const CArray& y) { return Array(x + y); } - static inline CArray minus_sf(double x, const CArray& y) { return Array(x - y); } - static inline CArray mult_sf(double x, const CArray& y) { return Array(x * y); } - static inline CArray div_sf(double x, const CArray& y) { return Array(x / y); } - - static inline CArray eq_sf(double x, const CArray& y) // specific check for NaN - { - if (NumTraits::isNan(x)) - { - CArray ret(y.numElements()) ; - Array::const_iterator ity=y.begin(),itye=y.end(); - Array::iterator itret=ret.begin() ; - for(;ity!=itye;++ity,++itret) *itret=NumTraits::isNan(*ity) ; - return ret ; - } - else return Array(x == y); - } - static inline CArray lt_sf(double x, const CArray& y) { return Array(x < y); } - static inline CArray gt_sf(double x, const CArray& y) { return Array(x > y); } - static inline CArray le_sf(double x, const CArray& y) { return Array(x <= y); } - static inline CArray ge_sf(double x, const CArray& y) { return Array(x >= y); } - - static inline CArray ne_sf(double x, const CArray& y) // specific check for NaN - { - if (NumTraits::isNan(x)) - { - CArray ret(y.numElements()) ; - Array::const_iterator ity=y.begin(),itye=y.end(); - Array::iterator itret=ret.begin() ; - for(;ity!=itye;++ity,++itret) *itret=!NumTraits::isNan(*ity) ; - return ret ; - } - else return Array(x != y); - } - static inline double cond_sss(double x, double y, double z) { return (x==0) ? z : y ; } - - static inline CArray cond_ssf(double x, double y, const CArray& z) - { - CArray ret(z.numElements()) ; - if (x==0) ret=z ; - else ret=y ; - return ret ; - } - - static inline CArray cond_sfs(double x, const CArray& y, double z) - { - CArray ret(y.numElements()) ; - if (x==0) ret=z ; - else ret=y ; - return ret ; - } - - static inline CArray cond_sff(double x, const CArray& y, const CArray& z) - { - CArray ret(y.numElements()) ; - if (x==0) ret=z ; - else ret=y ; - return ret ; - } - - static inline CArray cond_fss(const CArray& x, double y, double z) - { - CArray ret(x.numElements()) ; - Array::const_iterator itx=x.begin(),itxe=x.end(); - Array::iterator itret=ret.begin() ; - - for(;itx!=itxe;++itx,++itret) *itret=( (*itx==0)?z:y) ; - return ret ; - } - - static inline CArray cond_fsf(const CArray& x, double y, const CArray& z) - { - CArray ret(x.numElements()) ; - Array::const_iterator itx=x.begin(), itxe=x.end(), itz=z.begin(); - Array::iterator itret=ret.begin() ; - for(;itx!=itxe;++itx,++itz,++itret) *itret=( (*itx==0)?*itz:y) ; - return ret ; - } - - static inline CArray cond_ffs(const CArray& x, const CArray& y, double z) - { - CArray ret(x.numElements()) ; - Array::const_iterator itx=x.begin(), itxe=x.end(), ity=y.begin() ; - Array::iterator itret=ret.begin() ; - for(;itx!=itxe;++itx,++ity,++itret) *itret=( (*itx==0)?z:*ity) ; - return ret ; - } - - static inline CArray cond_fff(const CArray& x, const CArray& y, const CArray& z) - { - CArray ret(x.numElements()) ; - Array::const_iterator itx=x.begin(), itxe=x.end(), ity=y.begin(), itz=z.begin() ; - Array::iterator itret=ret.begin() ; - for(;itx!=itxe;++itx,++ity,++itz,++itret) *itret=( (*itx==0)?*itz:*ity) ; - return ret ; - } - - void release(void) - { - opScalar.clear(); - opScalarScalar.clear(); - opScalarScalarScalar.clear(); - opField.clear(); - opFieldField.clear(); - opFieldScalar.clear(); - opScalarField.clear(); - opScalarScalarField.clear(); - opScalarFieldScalar.clear(); - opScalarFieldField.clear(); - opFieldScalarScalar.clear(); - opFieldScalarField.clear(); - opFieldFieldScalar.clear(); - opFieldFieldField.clear(); - } - }; - - extern COperatorExpr operatorExpr; - -} - -#endif - diff --git a/xios_2311_src/trunk/.svn/pristine/41/41efba05d9401834396fa231a50c9eb246426a9e.svn-base b/xios_2311_src/trunk/.svn/pristine/41/41efba05d9401834396fa231a50c9eb246426a9e.svn-base deleted file mode 100644 index f9793dccf5e25f55b0c0934c3424d74246cffbdc..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/41/41efba05d9401834396fa231a50c9eb246426a9e.svn-base +++ /dev/null @@ -1,423 +0,0 @@ -#include "xios_spl.hpp" -#include "exception.hpp" -#include "log.hpp" -#include "buffer_out.hpp" -#include "buffer_client.hpp" -#include "cxios.hpp" -#include "mpi.hpp" -#include "tracer.hpp" -#include "timeline_events.hpp" -#include "timer.hpp" - -namespace xios -{ - size_t CClientBuffer::maxRequestSize = 0; - - CClientBuffer::CClientBuffer(MPI_Comm interComm, int serverRank, StdSize bufferSize, StdSize estimatedMaxEventSize) - : interComm(interComm) - , clientRank_(0) - , serverRank(serverRank) - , bufferSize(bufferSize) - , estimatedMaxEventSize(estimatedMaxEventSize) - , maxEventSize(0) - , current(0) - , count(0) - , pending(false) - , hasWindows(false) - { - /* - if (windows[0]==MPI_WIN_NULL && windows[1]==MPI_WIN_NULL) hasWindows=false ; - else hasWindows=true ; - */ - - MPI_Alloc_mem(bufferSize+headerSize_, MPI_INFO_NULL, &bufferHeader[0]) ; - MPI_Alloc_mem(bufferSize+headerSize_, MPI_INFO_NULL, &bufferHeader[1]) ; - buffer[0] = bufferHeader[0]+headerSize_ ; - buffer[1] = bufferHeader[1]+headerSize_ ; - firstTimeLine[0]=(size_t*)bufferHeader[0] + timeLineOffset_ ; - firstTimeLine[1]=(size_t*)bufferHeader[1] + timeLineOffset_ ; - bufferCount[0]=(size_t*)bufferHeader[0] + countOffset_ ; - bufferCount[1]=(size_t*)bufferHeader[1] + countOffset_ ; - control[0]=(size_t*)bufferHeader[0] + controlOffset_ ; - control[1]=(size_t*)bufferHeader[1] + controlOffset_ ; - notify[0]=(size_t*)bufferHeader[0] + notifyOffset_ ; - notify[1]=(size_t*)bufferHeader[1] + notifyOffset_ ; - - *firstTimeLine[0]=0 ; - *firstTimeLine[1]=0 ; - *bufferCount[0]=0 ; - *bufferCount[1]=0 ; - *control[0]=0 ; - *control[1]=0 ; - *notify[0]=notifyNothing_ ; - *notify[1]=notifyNothing_ ; - winState[0]=false ; - winState[1]=false ; - - - if (hasWindows) - { - - MPI_Aint buffSize=bufferSize+headerSize_ ; - MPI_Win_attach(windows_[0], bufferHeader[0], buffSize) ; - MPI_Win_attach(windows_[1], bufferHeader[1], buffSize) ; - - MPI_Group group ; - int groupSize,groupRank ; - MPI_Win_get_group(windows_[0], &group) ; - MPI_Group_size(group, &groupSize) ; - MPI_Group_rank(group, &groupRank) ; - if (groupRank!=clientRank_) ERROR("CClientBuffer::CClientBuffer",<< " ClientRank != groupRank "<& windows) - { - windows_=windows ; - if (windows_[0]==MPI_WIN_NULL && windows_[1]==MPI_WIN_NULL) hasWindows=false ; - else hasWindows=true ; - - if (hasWindows) - { - MPI_Aint buffSize=bufferSize+headerSize_ ; - MPI_Win_attach(windows_[0], bufferHeader[0], buffSize) ; - MPI_Win_attach(windows_[1], bufferHeader[1], buffSize) ; - - MPI_Group group ; - int groupSize,groupRank ; - MPI_Win_get_group(windows_[0], &group) ; - MPI_Group_size(group, &groupSize) ; - MPI_Group_rank(group, &groupRank) ; - if (groupRank!=clientRank_) ERROR("CClientBuffer::CClientBuffer",<< " ClientRank != groupRank "< 0 ) return false ; - - if (size > bufferSize) - { - resizingBufferStep_=1 ; - *firstTimeLine[current]=0 ; - newBufferSize_=size ; - return false ; - } - - if (size > maxEventSize) - { - maxEventSize = size; - - if (size > estimatedMaxEventSize) - error(0) << "WARNING: Unexpected event of size " << size << " for server " << serverRank - << " (estimated max event size = " << estimatedMaxEventSize << ")" << std::endl; - - if (size > maxRequestSize) maxRequestSize = size; - } - - if (size > remain()) - { - if (isGrowableBuffer_) - { - resizingBufferStep_ = 1 ; - *firstTimeLine[current]=0 ; - newBufferSize_ = (count+size)*growFactor_ ; - } - return false ; - } - else return true ; - } - - - CBufferOut* CClientBuffer::getBuffer(size_t timeLine, StdSize size) - { - if (size <= remain()) - { - retBuffer->realloc(buffer[current] + count, size); - count += size; - if (*firstTimeLine[current]==0) *firstTimeLine[current]=timeLine ; - *bufferCount[current]=count ; - return retBuffer; - } - else - { - ERROR("CBufferOut* CClientBuffer::getBuffer(StdSize size)", - << "Not enough space in buffer, this should not have happened..."); - return NULL; - } - } - - void CClientBuffer::infoBuffer(void) - { - - char checksum=0 ; - for(size_t i=0;i<*bufferCount[current];i++) checksum=checksum+buffer[current][i] ; - - char checksumFirst=0 ; - for(size_t i=5; i<10 && i<*bufferCount[current] ;i++) checksumFirst=checksumFirst+buffer[current][i] ; - - char checksumLast=0 ; - for(size_t i=(*bufferCount[current]<10)?0:*bufferCount[current]-10; i<*bufferCount[current] ; i++) checksumLast=checksumLast+buffer[current][i] ; - - info(45)<<"CClientBuffer::infoBuffer "<<" clientRank_ "< 0) - { - double time=MPI_Wtime() ; - if (time - lastCheckedWithNothing_ > latency_) - { - lockBuffer() ; - if (*bufferCount[current] > 0) - { - MPI_Issend(buffer[current], count, MPI_CHAR, serverRank, 20, interComm, &request); - if (resizingBufferStep_==4) resizingBufferStep_=0 ; - pending = true; - *firstTimeLine[current]=0 ; - *bufferCount[current]=0 ; - - unlockBuffer() ; - - if (current == 1) current = 0; - else current = 1; - count = 0; - } - else - { - unlockBuffer() ; - lastCheckedWithNothing_ = time ; - } - } - } - else - { - if (resizingBufferStep_==1) resizeBufferNotify() ; - else if (resizingBufferStep_==2) isNotifiedChangeBufferSize() ; - else if (resizingBufferStep_==3) resizeBuffer(newBufferSize_) ; - } - } - - return pending; - } - - void CClientBuffer::resizeBufferNotify(void) - { - // notify server of changing buffers size - lockBuffer() ; - int size=sizeof(int)+sizeof(size_t) ; - CBufferOut* bufOut = this->getBuffer(timelineEventNotifyChangeBufferSize, size); - bufOut->put(size); - bufOut->put(timelineEventNotifyChangeBufferSize); - resizingBufferStep_ = 2 ; - unlockBuffer() ; - } - - void CClientBuffer::resizeBuffer(size_t newSize) - { - - if (hasWindows) - { - MPI_Win_detach(windows_[0], bufferHeader[0]) ; - MPI_Win_detach(windows_[1], bufferHeader[1]) ; - } - MPI_Free_mem(bufferHeader[0]) ; - MPI_Free_mem(bufferHeader[1]) ; - - bufferSize=newSize ; - MPI_Alloc_mem(bufferSize+headerSize_, MPI_INFO_NULL, &bufferHeader[0]) ; - MPI_Alloc_mem(bufferSize+headerSize_, MPI_INFO_NULL, &bufferHeader[1]) ; - buffer[0] = bufferHeader[0]+headerSize_ ; - buffer[1] = bufferHeader[1]+headerSize_ ; - firstTimeLine[0]=(size_t*)bufferHeader[0] + timeLineOffset_; - firstTimeLine[1]=(size_t*)bufferHeader[1] + timeLineOffset_; - bufferCount[0]=(size_t*)bufferHeader[0] + countOffset_ ; - bufferCount[1]=(size_t*)bufferHeader[1] + countOffset_ ; - control[0]=(size_t*)bufferHeader[0] + controlOffset_ ; // control=0 => nothing ; control=1 => changeBufferSize - control[1]=(size_t*)bufferHeader[1] + controlOffset_ ; - notify[0]=(size_t*)bufferHeader[0] + notifyOffset_ ; - notify[1]=(size_t*)bufferHeader[1] + notifyOffset_ ; - - *firstTimeLine[0]=0 ; - *firstTimeLine[1]=0 ; - *bufferCount[0]=0 ; - *bufferCount[1]=0 ; - *control[0]=0 ; - *control[1]=0 ; - *notify[0] = notifyNothing_ ; - *notify[1] = notifyNothing_ ; - winState[0]=false ; - winState[1]=false ; - current=0 ; - - if (hasWindows) - { - - MPI_Win_attach(windows_[0], bufferHeader[0], bufferSize+headerSize_) ; - MPI_Win_attach(windows_[1], bufferHeader[1], bufferSize+headerSize_) ; - - MPI_Win_lock(MPI_LOCK_EXCLUSIVE, clientRank_, 0, windows_[0]) ; - MPI_Win_lock(MPI_LOCK_EXCLUSIVE, clientRank_, 0, windows_[1]) ; - - MPI_Win_unlock(clientRank_, windows_[1]) ; - MPI_Win_unlock(clientRank_, windows_[0]) ; - } - - lockBuffer() ; - - int size=sizeof(int)+2*sizeof(size_t)+2*sizeof(MPI_Aint) ; - CBufferOut* bufOut = this->getBuffer(timelineEventChangeBufferSize, size); - bufOut->put(size); - bufOut->put(timelineEventChangeBufferSize); - bufOut->put(newBufferSize_); - bufOut->put(this->getWinAddress(0)); - bufOut->put(this->getWinAddress(1)); - - resizingBufferStep_=4; - unlockBuffer() ; - info(100)<<"CClientBuffer::resizeBuffer(size_t newSize) : resizing buffer of server "<getWinAddress(0)<<" winAdress[1] "<getWinAddress(1)< 0); - } - - bool CClientBuffer::isNotifiedChangeBufferSize(void) - { - - bool ret ; - lockBuffer() ; - ret=*notify[current] == notifyResizeBuffer_ ? true : false ; - if (ret || !hasWindows) - { - *notify[current] = notifyNothing_ ; - resizingBufferStep_=3; - } - unlockBuffer() ; - - return ret; - } - - bool CClientBuffer::isNotifiedFinalized(void) - { - if (!isFinalized_) - { - double time=MPI_Wtime() ; -// if (time - lastCheckedNotify_ > latency_) - { - int flag ; - MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &flag, MPI_STATUS_IGNORE); - lockBuffer() ; - isFinalized_=*notify[current] == notifyFinalize_ ? true : false ; - unlockBuffer() ; - lastCheckedNotify_=time ; - } - } - return isFinalized_ ; - } - -} diff --git a/xios_2311_src/trunk/.svn/pristine/42/42441e500ebde9cf5a01dee83ba6afd1aed61688.svn-base b/xios_2311_src/trunk/.svn/pristine/42/42441e500ebde9cf5a01dee83ba6afd1aed61688.svn-base deleted file mode 100644 index ba815bb944f4cde5da0d3f9ba6593523c4965722..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/42/42441e500ebde9cf5a01dee83ba6afd1aed61688.svn-base +++ /dev/null @@ -1,81 +0,0 @@ -#ifndef __MAPPER_HPP__ -#define __MAPPER_HPP__ -#include "parallel_tree.hpp" -#include "mpi.hpp" -#include "timerRemap.hpp" - -namespace sphereRemap { - -enum verbosity -{ - SILENT = 0, - PROGRESS = 1, - DETAILS = 2 -}; - -void cptOffsetsFromLengths(const int *lengths, int *offsets, int sz); - -class Mapper -{ -public: - Mapper(MPI_Comm comm=MPI_COMM_WORLD) : communicator(comm), verbose(SILENT), neighbourElements(NULL), sstree(comm) {} - ~Mapper(); - void setVerbosity(verbosity v) {verbose=v ;} - - void setSourceMesh(const double* boundsLon, const double* boundsLat, const double* area, int nVertex, int nbCells, const double* pole, const long int* globalId=NULL) ; - void setTargetMesh(const double* boundsLon, const double* boundsLat, const double* area, int nVertex, int nbCells, const double* pole, const long int* globalId=NULL) ; - void setSourceValue(const double* val) ; - void getTargetValue(double* val) ; - - void buildSSTree(vector& srcMsh, vector& trgMsh) - { - sstree.build(srcMsh, trgMsh); - } - - /** @param trgElts are the elements of the unstructured target grid - Returns the timings for substeps: */ - vector computeWeights(int interpOrder, bool renormalize=false, bool quantity=false); - int getNbWeights(void) { return nWeights ; } -/* - void getWeigths(double* weights, double* sourceInd, double* targetInd) ; - void getWeights(vector& weights, vector& sourceInd, vector& targetInd) ; -*/ - /* where weights are returned after call to `computeWeights` */ - double *remapMatrix; - int *srcAddress; - int *srcRank; - int *dstAddress; - int nWeights; - long int* sourceWeightId ; - long int* targetWeightId ; - -private: - /** @return number of weights (local to cpu) */ - int remap(Elt* elements, int nbElements, int order, bool renormalize=false, bool quantity=false); - - void buildMeshTopology(); - void computeGrads(); - void computeIntersection(Elt* elements, int nbElements); - - int verbose; - - /** Holds adaptional leaf nodes as ghost cells for gradient computations (hold neighbour elements from other ranks). - They will be inserted to the local trees but not saved in its leaf array */ - vector neighbourNodes; - - int nbNeighbourElements; - Elt* neighbourElements; - - CParallelTree sstree; - MPI_Comm communicator ; - std::vector sourceElements ; - std::vector sourceMesh ; - std::vector targetElements ; - std::vector targetMesh ; - std::vector sourceGlobalId ; - std::vector targetGlobalId ; - -}; - -} -#endif diff --git a/xios_2311_src/trunk/.svn/pristine/42/4261f4685ce28bc0397bddd3458dfd82b3a3f68c.svn-base b/xios_2311_src/trunk/.svn/pristine/42/4261f4685ce28bc0397bddd3458dfd82b3a3f68c.svn-base deleted file mode 100644 index 453664631dbbba42b68f23c39a1399e5b0ed3a8f..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/42/4261f4685ce28bc0397bddd3458dfd82b3a3f68c.svn-base +++ /dev/null @@ -1,22 +0,0 @@ -MODULE TEMPORAL_SPLITTING_INTERFACE - USE, INTRINSIC :: ISO_C_BINDING - - INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99 - - SUBROUTINE cxios_temporal_splitting_handle_create(ret, idt, idt_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_temporal_splitting_handle_create - - SUBROUTINE cxios_temporal_splitting_valid_id(ret, idt, idt_size) BIND(C) - USE ISO_C_BINDING - LOGICAL (kind = C_BOOL) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_temporal_splitting_valid_id - - END INTERFACE - -END MODULE TEMPORAL_SPLITTING_INTERFACE diff --git a/xios_2311_src/trunk/.svn/pristine/42/426647e987e4a56c75aa7eb3a377ed87a28a74dc.svn-base b/xios_2311_src/trunk/.svn/pristine/42/426647e987e4a56c75aa7eb3a377ed87a28a74dc.svn-base deleted file mode 100644 index 303bce9ef05726735cf56269646ace3c274a0bc3..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/42/426647e987e4a56c75aa7eb3a377ed87a28a74dc.svn-base +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef __XIOS_DATA_INPUT__ -#define __XIOS_DATA_INPUT__ - -/// XIOS headers /// -#include "xios_spl.hpp" -#include "exception.hpp" -#include "field.hpp" - - -namespace xios -{ - class CDataInput - { - public: - /// Input type /// - typedef enum { ONE_FILE = 0, MULTI_GROUP, MULTI_FILE } EDataInputType; - - /// Read methods /// - StdSize getFieldNbRecords(CField* field); - void readFieldData(CField* field, int record, CArray& data); - void readFieldAttributesMetaData(CField* field); - void readFieldAttributesValues(CField* field); - void closeFile(void); - - virtual ~CDataInput(void); - - protected: - virtual StdSize getFieldNbRecords_(CField* field) = 0; - virtual void readFieldData_(CField* field, int record, CArray& data) = 0; - virtual void readFieldAttributes_(CField* field, bool readAttributeValues) = 0; - virtual void closeFile_(void) = 0; - - /// Protected properties /// - EDataInputType type; - }; // class CDataInput -} // namespace xios - -#endif //__XIOS_DATA_INPUT__ diff --git a/xios_2311_src/trunk/.svn/pristine/42/42a76c7c05f51466b08d73149d7f58a735b6dd29.svn-base b/xios_2311_src/trunk/.svn/pristine/42/42a76c7c05f51466b08d73149d7f58a735b6dd29.svn-base deleted file mode 100644 index b047c9d9a3bbab70f8a488669a10a99e502c4ccd..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/42/42a76c7c05f51466b08d73149d7f58a735b6dd29.svn-base +++ /dev/null @@ -1,132 +0,0 @@ -#ifndef __XIOS_CCouplerIn__ -#define __XIOS_CCouplerIn__ - -/// XIOS headers /// -#include "xios_spl.hpp" -#include "field.hpp" -#include "declare_group.hpp" -#include "date.hpp" -#include "attribute_enum.hpp" -#include "attribute_enum_impl.hpp" -#include "context_client.hpp" -#include "mpi.hpp" -#include "string_tools.hpp" - -namespace xios -{ - - /// ////////////////////// Déclarations ////////////////////// /// - - class CCouplerInGroup; - class CCouplerInAttributes; - class CCouplerIn; - - class CGarbageCollector; - - ///-------------------------------------------------------------- - - // Declare/Define CCouplerInAttribute - BEGIN_DECLARE_ATTRIBUTE_MAP(CCouplerIn) -# include "coupler_in_attribute.conf" - END_DECLARE_ATTRIBUTE_MAP(CCouplerIn) - - ///-------------------------------------------------------------- - - /*! - \class CCouplerIn - This class corresponds to file component of the xml. - The class contains all the nessceary information to write data into a netcdf file: The most important thing - is the field(s) which will be written into file. Besides, there are some options to write - data into file, e.g: writting into only one file or multiple file; splitting a running into several files. - Moreover, there are some other attributes of netcdf file which are also stored in this class - */ - class CCouplerIn - : public CObjectTemplate - , public CCouplerInAttributes - { - /// typedef /// - typedef CObjectTemplate SuperClass; - typedef CCouplerInAttributes SuperClassAttribute; - - public : - enum EEventId - { - NO_EVENT - }; - - typedef CCouplerInAttributes RelAttributes; - typedef CCouplerInGroup RelGroup; - - /// Constructeurs /// - CCouplerIn(void); - explicit CCouplerIn(const StdString& id); - CCouplerIn(const CCouplerIn& couplerIn); // Not implemented yet. - CCouplerIn(const CCouplerIn* const couplerIn); // Not implemented yet. - - /// Destructeur /// - virtual ~CCouplerIn(void); - - public: - /// Accesseurs /// - CFieldGroup* getVirtualFieldGroup(void) const; - std::vector getAllFields(void) const; - std::vector getEnabledFields(void); - - StdString dumpClassAttributes(void); - - public : - void setVirtualFieldGroup(CFieldGroup* newVFieldGroup); - - // Add component into coupler - CField* addField(const string& id = ""); - CFieldGroup* addFieldGroup(const string& id = ""); - - public: - /// Accesseurs statiques /// - static StdString GetName(void); - static StdString GetDefName(void); - static ENodeType GetType(void); - public: - /// Traitements /// - virtual void parse(xml::CXMLNode& node); -// virtual StdString toString(void) const; - - public: - virtual void solveDescInheritance(bool apply, const CAttributeMap* const parent = 0); - void solveFieldRefInheritance(bool apply); - void createInterCommunicator(void) ; - void assignContext(void) ; - - private: - CContextClient* client_=nullptr ; - public: - CContextClient* getContextClient(void) {return client_; } - - private: - string couplingContextId_ ; - public: - const string& getCouplingContextId(void) ; - - private : - - CFieldGroup* virtualFieldGroup; - -// std::shared_ptr data_out; -// std::shared_ptr data_in; - std::vector enabledFields; - - - public: - - }; // class CCouplerIn - - ///-------------------------------------------------------------- - - // Declare/Define CCouplerInGroup and CCouplerInDefinition - DECLARE_GROUP(CCouplerIn); - - ///-------------------------------------------------------------- - -} // namespace xios - -#endif // __XIOS_CCouplingIn__ \ No newline at end of file diff --git a/xios_2311_src/trunk/.svn/pristine/42/42b8d35606d2575b4e88394f4ffe257f6d5f77b6.svn-base b/xios_2311_src/trunk/.svn/pristine/42/42b8d35606d2575b4e88394f4ffe257f6d5f77b6.svn-base deleted file mode 100644 index 7152b9368ffd099850d79066f74614f67f309879..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/42/42b8d35606d2575b4e88394f4ffe257f6d5f77b6.svn-base +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef __XIOS_Configure__ -#define __XIOS_Configure__ - - -/// /////////// Macros /////////// /// -#define DECLARE_PROPERTY(type, name, value) \ - extern type name; // = value - -namespace xios -{ -#include "properties.conf" -} // namespace xios - -#endif // __XIOS_Configure__ diff --git a/xios_2311_src/trunk/.svn/pristine/42/42f64e03cbb8f40c93fec333d269859f2e584df3.svn-base b/xios_2311_src/trunk/.svn/pristine/42/42f64e03cbb8f40c93fec333d269859f2e584df3.svn-base deleted file mode 100644 index 6574135c74ecd8d430421e1bd892f935bc90e1fb..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/42/42f64e03cbb8f40c93fec333d269859f2e584df3.svn-base +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef __ERRHANDLE_H__ -#define __ERRHANDLE_H__ - -#include -#include -#include - -namespace sphereRemap { - -static inline void error_exit(const std::string& msg) -{ - std::cerr << "Error: " << msg << std::endl; - exit(0); -} - -static inline void exit_on_failure(int status, const std::string& msg) -{ - if (status) error_exit(msg); -} - -} -#endif diff --git a/xios_2311_src/trunk/.svn/pristine/43/432863891bfcbcdab3ff254a675c2b12795c28f4.svn-base b/xios_2311_src/trunk/.svn/pristine/43/432863891bfcbcdab3ff254a675c2b12795c28f4.svn-base deleted file mode 100644 index 847543b715736954685b43304a1f97f25df343fc..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/43/432863891bfcbcdab3ff254a675c2b12795c28f4.svn-base +++ /dev/null @@ -1,52 +0,0 @@ -#include "minimum.hpp" -#include "array_new.hpp" -#include -#include "utils.hpp" - -namespace xios -{ - namespace func - { - /// ////////////////////// Définitions ////////////////////// /// - - CMinimum::CMinimum(CArray& doutput) - : SuperClass(StdString("minimum"), doutput) - { /* Ne rien faire de plus */ } - - CMinimum::CMinimum(CArray& doutput, double missingValue) - : SuperClass(StdString("minimum"), doutput, missingValue) - { /* Ne rien faire de plus */ } - - CMinimum::~CMinimum(void) - { /* Ne rien faire de plus */ } - - //--------------------------------------------------------------- - - void CMinimum::apply(const CArray& _dinput, - CArray& _doutput) - { - const double * it1 = _dinput.dataFirst(), - *end1 = _dinput.dataFirst() + _dinput.numElements(); - double * it = _doutput.dataFirst(); - - if (this->nbcall == 1) for (; it1 != end1; it1++, it++) *it = *it1; - else - { - if (hasMissingValue) - { - for (; it1 != end1; it1++, it++) - if (!NumTraits::isNan(*it1)) - { - if (!NumTraits::isNan(*it)) *it = std::min(*it1, *it); - else *it=*it1 ; - } - } - else for (; it1 != end1; it1++, it++) *it = std::min(*it1, *it); - } - - } - - //--------------------------------------------------------------- - - } // namespace func -} // namespace xios diff --git a/xios_2311_src/trunk/.svn/pristine/43/432dd39d9200a67c398b5924489835d0ea0b3c15.svn-base b/xios_2311_src/trunk/.svn/pristine/43/432dd39d9200a67c398b5924489835d0ea0b3c15.svn-base deleted file mode 100644 index 64f29d183d6130631e6222da0251e10f0dd28e4a..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/43/432dd39d9200a67c398b5924489835d0ea0b3c15.svn-base +++ /dev/null @@ -1,147 +0,0 @@ -#include "mpi.hpp" -#include -#include "errhandle.hpp" -#include "libmapper.hpp" -#include "mapper.hpp" - -#include "node.hpp" - -using namespace sphereRemap ; - -int ncread(double *lon, double *lat, double* val, int nElt, const char* filename) -{ - int ncid, blonid, blatid, valid, neltid; - size_t nEltCheck; - exit_on_failure(nc_open(filename, NC_NOWRITE, &ncid), std::string("Cannot open netCDF file ") + filename); - exit_on_failure(nc_inq_dimid(ncid, "elt", &neltid), std::string("No dimension elt in file ") + filename); - nc_inq_dimlen(ncid, neltid, &nEltCheck); - exit_on_failure(nElt != nEltCheck, std::string("Array sizes do not match!")); - - nc_inq_varid(ncid, "bounds_lon", &blonid); - nc_inq_varid(ncid, "bounds_lat", &blatid); - nc_inq_varid(ncid, "val", &valid); - nc_get_var_double(ncid, blonid, lon); - nc_get_var_double(ncid, blatid, lat); - nc_get_var_double(ncid, valid, val); - nc_close(ncid); -} - -int ncwriteValue(double *val, const char* filename) -{ - int ncid, valid ; - nc_open(filename, NC_WRITE, &ncid); - nc_inq_varid(ncid, "val", &valid); - nc_put_var_double(ncid, valid, val); - nc_close(ncid); -} - - - -void compute_distribution(int nGlobalElts, int &start, int &nLocalElts) -{ - int mpiSize, mpiRank; - MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); - MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); - start = 0; - nLocalElts = 0; - for (int i = 0; i <= mpiRank; i++) - { - start += nLocalElts; - nLocalElts = nGlobalElts/mpiSize; - if (i < nGlobalElts % mpiSize) nLocalElts++; - } -} - -int main() -{ - int interpOrder = 2; -/* low resolution */ -/* - char srcFile[] = "h14.nc"; - char dstFile[] = "r180x90.nc"; - double srcPole[] = {0, 0, 0}; - double dstPole[] = {0, 0, 1}; - int nSrcElt = 13661; - int nDstElt = 16200; -*/ -/* high resolution */ - - char srcFile[] = "t740.nc"; - char dstFile[] = "r1440x720.nc"; - double srcPole[] = {0, 0, 0}; - double dstPole[] = {0, 0, 1}; - int nSrcElt = 741034; - int nDstElt = 1036800; - - int nVert = 10; - int nSrcLocal, nDstLocal, startSrc, startDst; - int nWeight; - int mpi_rank, mpi_size ; - - MPI_Init(NULL, NULL); - MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank) ; - MPI_Comm_size(MPI_COMM_WORLD, &mpi_size) ; - - double *srcLon = (double *) malloc(nSrcElt*nVert*sizeof(double)); - double *srcLat = (double *) malloc(nSrcElt*nVert*sizeof(double)); - double *srcVal = (double *) malloc(nSrcElt*sizeof(double)); - double *dstLon = (double *) malloc(nDstElt*nVert*sizeof(double)); - double *dstLat = (double *) malloc(nDstElt*nVert*sizeof(double)); - double *dstVal = (double *) malloc(nDstElt*sizeof(double)); - double *globalVal = (double *) malloc(nDstElt*sizeof(double)); - - ncread(srcLon, srcLat, srcVal, nSrcElt, srcFile); - ncread(dstLon, dstLat, dstVal, nDstElt, dstFile); - - compute_distribution(nSrcElt, startSrc, nSrcLocal); - compute_distribution(nDstElt, startDst, nDstLocal); - - - - Mapper mapper(MPI_COMM_WORLD); - mapper.setVerbosity(PROGRESS) ; - mapper.setSourceMesh(srcLon + startSrc*nVert, srcLat + startSrc*nVert, nVert, nSrcLocal, srcPole ) ; - mapper.setTargetMesh(dstLon + startDst*nVert, dstLat + startDst*nVert, nVert, nDstLocal, dstPole ) ; - - for(int i=0;i timings = mapper.computeWeights(interpOrder); - - - for(int i=0;i -#include "nc4dispatch.h" -#include "ncdispatch.h" - -#ifdef USE_HDF4 -#include -#endif - -#ifdef USE_PNETCDF -#include -#endif - -/* This is to track opened HDF5 objects to make sure they are - * closed. */ -#ifdef EXTRA_TESTS -extern int num_plists; -extern int num_spaces; -#endif /* EXTRA_TESTS */ - -#define MIN_DEFLATE_LEVEL 0 -#define MAX_DEFLATE_LEVEL 9 - -/* These are the special attributes added by the HDF5 dimension scale - * API. They will be ignored by netCDF-4. */ -#define REFERENCE_LIST "REFERENCE_LIST" -#define CLASS "CLASS" -#define DIMENSION_LIST "DIMENSION_LIST" -#define NAME "NAME" - -/* Forward */ -static int NC4_enddef(int ncid); -static int nc4_rec_read_types(NC_GRP_INFO_T *grp); -static int nc4_rec_read_vars(NC_GRP_INFO_T *grp); - -#ifdef IGNORE -/* This extern points to the pointer that holds the list of open - * netCDF files. */ -extern NC_FILE_INFO_T *nc_file; -#endif - -/* These are the default chunk cache sizes for HDF5 files created or - * opened with netCDF-4. */ -size_t nc4_chunk_cache_size = CHUNK_CACHE_SIZE; -size_t nc4_chunk_cache_nelems = CHUNK_CACHE_NELEMS; -float nc4_chunk_cache_preemption = CHUNK_CACHE_PREEMPTION; - -/* This is set by nc_set_default_format in libsrc/nc.c. */ -extern int default_create_format; - -/* To turn off HDF5 error messages, I have to catch an early - invocation of a netcdf function. */ -static int virgin = 1; - -/* For performance, fill this array only the first time, and keep it - * in global memory for each further use. */ -#define NUM_TYPES 12 -static hid_t native_type_constant[NUM_TYPES]; - -static char nc_type_name[NUM_TYPES][NC_MAX_NAME + 1] = {"char", "byte", "short", "int", "float", - "double", "ubyte", "ushort", "uint", - "int64", "uint64", "string"}; -int nc4_free_global_hdf_string_typeid(); - -/* Set chunk cache size. Only affects files opened/created *after* it - * is called. */ -int -nc_set_chunk_cache(size_t size, size_t nelems, float preemption) -{ - if (preemption < 0 || preemption > 1) - return NC_EINVAL; - nc4_chunk_cache_size = size; - nc4_chunk_cache_nelems = nelems; - nc4_chunk_cache_preemption = preemption; - return NC_NOERR; -} - -/* Get chunk cache size. Only affects files opened/created *after* it - * is called. */ -int -nc_get_chunk_cache(size_t *sizep, size_t *nelemsp, float *preemptionp) -{ - if (sizep) - *sizep = nc4_chunk_cache_size; - - if (nelemsp) - *nelemsp = nc4_chunk_cache_nelems; - - if (preemptionp) - *preemptionp = nc4_chunk_cache_preemption; - return NC_NOERR; -} - -/* Required for fortran to avoid size_t issues. */ -int -nc_set_chunk_cache_ints(int size, int nelems, int preemption) -{ - if (size <= 0 || nelems <= 0 || preemption < 0 || preemption > 100) - return NC_EINVAL; - nc4_chunk_cache_size = size; - nc4_chunk_cache_nelems = nelems; - nc4_chunk_cache_preemption = (float)preemption / 100; - return NC_NOERR; -} - -int -nc_get_chunk_cache_ints(int *sizep, int *nelemsp, int *preemptionp) -{ - if (sizep) - *sizep = (int)nc4_chunk_cache_size; - if (nelemsp) - *nelemsp = (int)nc4_chunk_cache_nelems; - if (preemptionp) - *preemptionp = (int)(nc4_chunk_cache_preemption * 100); - - return NC_NOERR; -} - -/* This will return the length of a netcdf data type in bytes. */ -int -nc4typelen(nc_type type) -{ - switch(type){ - case NC_BYTE: - case NC_CHAR: - case NC_UBYTE: - return 1; - case NC_USHORT: - case NC_SHORT: - return 2; - case NC_FLOAT: - case NC_INT: - case NC_UINT: - return 4; - case NC_DOUBLE: - case NC_INT64: - case NC_UINT64: - return 8; - } - return -1; -} - -/* Given a filename, check to see if it is a HDF5 file. */ -#define MAGIC_NUMBER_LEN 4 -#define NC_HDF5_FILE 1 -#define NC_HDF4_FILE 2 -static int -nc_check_for_hdf(const char *path, int use_parallel, MPI_Comm comm, MPI_Info info, - int *hdf_file) -{ - char blob[MAGIC_NUMBER_LEN]; - - assert(hdf_file && path); - LOG((3, "nc_check_for_hdf: path %s", path)); - -/* Get the 4-byte blob from the beginning of the file. Don't use posix - * for parallel, use the MPI functions instead. */ -#ifdef USE_PARALLEL - if (use_parallel) - { - MPI_File fh; - MPI_Status status; - int retval; - if ((retval = MPI_File_open(comm, (char *)path, MPI_MODE_RDONLY, - info, &fh)) != MPI_SUCCESS) - return NC_EPARINIT; - if ((retval = MPI_File_read(fh, blob, MAGIC_NUMBER_LEN, MPI_CHAR, - &status)) != MPI_SUCCESS) - return NC_EPARINIT; - if ((retval = MPI_File_close(&fh)) != MPI_SUCCESS) - return NC_EPARINIT; - } - else -#endif /* USE_PARALLEL */ - { - FILE *fp; - if (!(fp = fopen(path, "r")) || - fread(blob, MAGIC_NUMBER_LEN, 1, fp) != 1) - return errno; - fclose(fp); - } - - /* Ignore the first byte for HDF5. */ - if (blob[1] == 'H' && blob[2] == 'D' && blob[3] == 'F') - *hdf_file = NC_HDF5_FILE; - else if (!strncmp(blob, "\016\003\023\001", MAGIC_NUMBER_LEN)) - *hdf_file = NC_HDF4_FILE; - else - *hdf_file = 0; - - return NC_NOERR; -} - -/* Create a HDF5/netcdf-4 file. In this case, ncid has already been - * selected in ncfunc.c. */ -static int -nc4_create_file(const char *path, int cmode, MPI_Comm comm, MPI_Info info, - NC_FILE_INFO_T *nc) -{ - hid_t fcpl_id, fapl_id; - unsigned flags; - FILE *fp; - int retval = NC_NOERR; - int persist = 0; /* Should diskless try to persist its data into file?*/ - - if(cmode & NC_DISKLESS) - flags = H5F_ACC_TRUNC; - else if(cmode & NC_NOCLOBBER) - flags = H5F_ACC_EXCL; - else - flags = H5F_ACC_TRUNC; - - LOG((3, "nc4_create_file: path %s mode 0x%x", path, cmode)); - assert(nc && path); - - - /* If this file already exists, and NC_NOCLOBBER is specified, - return an error. */ - if (cmode & NC_DISKLESS) { - if(cmode & NC_WRITE) - persist = 1; - } else if ((cmode & NC_NOCLOBBER) && (fp = fopen(path, "r"))) { - fclose(fp); - return NC_EEXIST; - } - - /* Add necessary structs to hold netcdf-4 file data. */ - if ((retval = nc4_nc4f_list_add(nc, path, (NC_WRITE | cmode)))) - BAIL(retval); - assert(nc->nc4_info && nc->nc4_info->root_grp); - - /* Need this access plist to control how HDF5 handles open onjects - * on file close. (Setting H5F_CLOSE_SEMI will cause H5Fclose to - * fail if there are any open objects in the file. */ - if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) - BAIL(NC_EHDFERR); -#ifdef EXTRA_TESTS - num_plists++; -#endif -#ifdef EXTRA_TESTS - if (H5Pset_fclose_degree(fapl_id, H5F_CLOSE_SEMI)) - BAIL(NC_EHDFERR); -#else - if (H5Pset_fclose_degree(fapl_id, H5F_CLOSE_STRONG)) - BAIL(NC_EHDFERR); -#endif /* EXTRA_TESTS */ - -#ifdef USE_PARALLEL - /* If this is a parallel file create, set up the file creation - property list. */ - if ((cmode & NC_MPIIO) || (cmode & NC_MPIPOSIX)) - { - nc->nc4_info->parallel++; - if (cmode & NC_MPIIO) /* MPI/IO */ - { - LOG((4, "creating parallel file with MPI/IO")); - if (H5Pset_fapl_mpio(fapl_id, comm, info) < 0) - BAIL(NC_EPARINIT); - } - else /* MPI/POSIX */ - { - LOG((4, "creating parallel file with MPI/posix")); - if (H5Pset_fapl_mpiposix(fapl_id, comm, 0) < 0) - BAIL(NC_EPARINIT); - } - } -#else /* only set cache for non-parallel... */ - if(cmode & NC_DISKLESS) { - if (H5Pset_fapl_core(fapl_id, 4096, persist)) - BAIL(NC_EDISKLESS); - } - if (H5Pset_cache(fapl_id, 0, nc4_chunk_cache_nelems, nc4_chunk_cache_size, - nc4_chunk_cache_preemption) < 0) - BAIL(NC_EHDFERR); - LOG((4, "nc4_create_file: set HDF raw chunk cache to size %d nelems %d preemption %f", - nc4_chunk_cache_size, nc4_chunk_cache_nelems, nc4_chunk_cache_preemption)); -#endif /* USE_PARALLEL */ - - if (H5Pset_libver_bounds(fapl_id, H5F_LIBVER_18, H5F_LIBVER_18) < 0) - BAIL(NC_EHDFERR); - - /* Create the property list. */ - if ((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0) - BAIL(NC_EHDFERR); -#ifdef EXTRA_TESTS - num_plists++; -#endif - - /* Set latest_format in access propertly list and - * H5P_CRT_ORDER_TRACKED in the creation property list. This turns - * on HDF5 creation ordering. */ - if (H5Pset_link_creation_order(fcpl_id, (H5P_CRT_ORDER_TRACKED | - H5P_CRT_ORDER_INDEXED)) < 0) - BAIL(NC_EHDFERR); - if (H5Pset_attr_creation_order(fcpl_id, (H5P_CRT_ORDER_TRACKED | - H5P_CRT_ORDER_INDEXED)) < 0) - BAIL(NC_EHDFERR); - - /* Create the file. */ - if ((nc->nc4_info->hdfid = H5Fcreate(path, flags, fcpl_id, fapl_id)) < 0) - BAIL(NC_EFILEMETA); - - /* Open the root group. */ - if ((nc->nc4_info->root_grp->hdf_grpid = H5Gopen2(nc->nc4_info->hdfid, "/", - H5P_DEFAULT)) < 0) - BAIL(NC_EFILEMETA); - - /* Release the property lists. */ - if (H5Pclose(fapl_id) < 0 || - H5Pclose(fcpl_id) < 0) - BAIL(NC_EHDFERR); -#ifdef EXTRA_TESTS - num_plists--; - num_plists--; -#endif - - /* Define mode gets turned on automatically on create. */ - nc->nc4_info->flags |= NC_INDEF; - - return NC_NOERR; - - exit: - if (nc->nc4_info->hdfid > 0) H5Fclose(nc->nc4_info->hdfid); - return retval; -} - -/** \ingroup netcdf4 -Create a netCDF-4/HDF5 file. - -\param path The file name of the new file. -\param cmode The creation mode flag. -\param initialsz Ignored by this function. -\param basepe Ignored by this function. -\param chunksizehintp Ignored by this function. -\param use_parallel 0 for sequential, non-zero for parallel I/O. -\param mpidata pointer to struct holdind data for parallel I/O -layer. Ignored if NULL. -\param dispatch Pointer to the dispatch table for this file. -\param ncpp Pointer to start of linked list of open files. -\return NC_INVAL Invalid input (check cmode). -*/ -int -NC4_create(const char* path, int cmode, size_t initialsz, int basepe, - size_t *chunksizehintp, int use_parallel, void *mpidata, - NC_Dispatch *dispatch, NC **ncpp) -{ - NC_FILE_INFO_T *nc_file = NULL; -#ifdef USE_PARALLEL - MPI_Comm comm = 0; - MPI_Info info = 0; -#else - int comm = 0, info = 0; -#endif /* USE_PARALLEL */ - int res; - - assert(ncpp && path); - - LOG((1, "nc4_create_file: path %s cmode 0x%x comm %d info %d", - path, cmode, comm, info)); - -#ifdef USE_PARALLEL - if (mpidata) - { - comm = ((NC_MPI_INFO *)mpidata)->comm; - info = ((NC_MPI_INFO *)mpidata)->info; - } -#endif /* USE_PARALLEL */ - - /* If this is our first file, turn off HDF5 error messages. */ - if (virgin) - { - if (H5Eset_auto(NULL, NULL) < 0) - LOG((0, "Couldn't turn off HDF5 error messages!")); - LOG((1, "HDF5 error messages have been turned off.")); - virgin = 0; - } - - /* Check the cmode for validity. */ - if (cmode & ~(NC_NOCLOBBER | NC_64BIT_OFFSET - | NC_NETCDF4 | NC_CLASSIC_MODEL - | NC_SHARE | NC_MPIIO | NC_MPIPOSIX | NC_LOCK | NC_PNETCDF - | NC_DISKLESS - | NC_WRITE /* to support diskless persistence */ - ) - || (cmode & NC_MPIIO && cmode & NC_MPIPOSIX) - || (cmode & NC_64BIT_OFFSET && cmode & NC_NETCDF4) - || (cmode & (NC_MPIIO | NC_MPIPOSIX) && cmode & NC_DISKLESS) - ) - return NC_EINVAL; - - /* Allocate the storage for this file info struct, and fill it with - zeros. This add the file metadata to the front of the global - nc_file list. */ - if ((res = nc4_file_list_add(&nc_file, dispatch))) - return res; - - /* Apply default create format. */ - if (default_create_format == NC_FORMAT_64BIT) - cmode |= NC_64BIT_OFFSET; - else if (default_create_format == NC_FORMAT_NETCDF4) - cmode |= NC_NETCDF4; - else if (default_create_format == NC_FORMAT_NETCDF4_CLASSIC) - { - cmode |= NC_NETCDF4; - cmode |= NC_CLASSIC_MODEL; - } - LOG((2, "cmode after applying default format: 0x%x", cmode)); - - /* Check to see if we want a netcdf3 or netcdf4 file. Open it, and - call the appropriate nc*_create. */ - if (cmode & NC_NETCDF4) - { - nc_file->int_ncid = nc_file->ext_ncid; - res = nc4_create_file(path, cmode, comm, info, nc_file); - } -#ifdef USE_PNETCDF - else if (cmode & NC_PNETCDF) - { - nc_file->pnetcdf_file++; - res = ncmpi_create(comm, path, cmode, info, &(nc_file->int_ncid)); - } -#endif /* USE_PNETCDF */ - else - { - return NC_EINVAL; - } - - /* Delete this file list entry if there was a failure. */ - if (res) - { - if (nc_file) - nc4_file_list_del(nc_file); - } - else - *ncpp = (NC *)nc_file; - - return res; -} - -/* This function is called by read_dataset when a dimension scale - * dataset is encountered. It reads in the dimension data (creating a - * new NC_DIM_INFO_T object), and also checks to see if this is a - * dimension without a variable - that is, a coordinate dimension - * which does not have any coordinate data. */ -static int -read_scale(NC_GRP_INFO_T *grp, hid_t datasetid, char *obj_name, - hsize_t scale_size, hsize_t max_scale_size, - int *dim_without_var) -{ - /*char *start_of_len;*/ - char dimscale_name_att[NC_MAX_NAME + 1] = ""; - hid_t attid = 0; - int max_len; - int retval; - - /* Add a dimension for this scale. */ - if ((retval = nc4_dim_list_add(&grp->dim))) - return retval; - - /* Assign dimid and increment number of dimensions. */ - grp->dim->dimid = grp->file->nc4_info->next_dimid++; - grp->ndims++; - - /* Does this dataset have a hidden attribute that tells us its - * dimid? If so, read it. */ - H5E_BEGIN_TRY { - if ((attid = H5Aopen_by_name(datasetid, ".", NC_DIMID_ATT_NAME, - H5P_DEFAULT, H5P_DEFAULT)) > 0) - { - if (H5Aread(attid, H5T_NATIVE_INT, &grp->dim->dimid) < 0) - return NC_EHDFERR; - if (H5Aclose(attid) < 0) - return NC_EHDFERR; - } - } H5E_END_TRY; - - max_len = strlen(obj_name) > NC_MAX_NAME ? NC_MAX_NAME : strlen(obj_name); - if (!(grp->dim->name = malloc((max_len + 1) * sizeof(char)))) - return NC_ENOMEM; - strncpy(grp->dim->name, obj_name, max_len + 1); - if (SIZEOF_SIZE_T < 8 && scale_size > NC_MAX_UINT) - { - grp->dim->len = NC_MAX_UINT; - grp->dim->too_long = 1; - } - else - grp->dim->len = scale_size; - grp->dim->hdf_dimscaleid = datasetid; - - /* If the dimscale has an unlimited dimension, then this dimension - * is unlimited. */ - if (max_scale_size == H5S_UNLIMITED) - grp->dim->unlimited++; - - /* If the scale name is set to DIM_WITHOUT_VARIABLE, then this is a - * dimension, but not a variable. (If get_scale_name returns an - * error, just move on, there's no NAME.) */ - if (H5DSget_scale_name(datasetid, dimscale_name_att, NC_MAX_NAME) >= 0) - { - if (!strncmp(dimscale_name_att, DIM_WITHOUT_VARIABLE, - strlen(DIM_WITHOUT_VARIABLE))) - { - if (grp->dim->unlimited) - { - size_t len = 0, *lenp = &len; - if ((retval = nc4_find_dim_len(grp, grp->dim->dimid, &lenp))) - return retval; - grp->dim->len = *lenp; - } - (*dim_without_var)++; - } - } - - return NC_NOERR; -} - -/* This function reads the hacked in coordinates attribute I use for - * multi-dimensional coordinates. */ -static int -read_coord_dimids(NC_VAR_INFO_T *var) -{ - hid_t coord_att_typeid = -1, coord_attid = -1, spaceid = -1; - hssize_t coord_array_size; - int ret = 0; - - /* There is a hidden attribute telling us the ids of the - * dimensions that apply to this multi-dimensional coordinate - * variable. Read it. */ - if ((coord_attid = H5Aopen_name(var->hdf_datasetid, COORDINATES)) < 0) ret++; - if (!ret && (coord_att_typeid = H5Aget_type(coord_attid)) < 0) ret++; - if (!ret && H5Aread(coord_attid, coord_att_typeid, var->dimids) < 0) ret++; - LOG((4, "dimscale %s is multidimensional and has coords", var->name)); - - /* How many dimensions are there? */ - if ((spaceid = H5Aget_space(coord_attid)) < 0) ret++; -#ifdef EXTRA_TESTS - num_spaces++; -#endif - if ((coord_array_size = H5Sget_simple_extent_npoints(spaceid)) < 0) ret++; - - /* Malloc space to the array of pointers to dims. */ - - - /* Set my HDF5 IDs free! */ - if (spaceid >= 0 && H5Sclose(spaceid) < 0) ret++; -#ifdef EXTRA_TESTS - num_spaces--; -#endif - if (coord_att_typeid >= 0 && H5Tclose(coord_att_typeid) < 0) ret++; - if (coord_attid >= 0 && H5Aclose(coord_attid) < 0) ret++; - return ret ? NC_EATTMETA : NC_NOERR; -} - -/* This function is called when reading a file's metadata for each - * dimension scale attached to a variable.*/ -static herr_t -dimscale_visitor(hid_t did, unsigned dim, hid_t dsid, - void *dimscale_hdf5_objids) -{ - H5G_stat_t statbuf; - - /* Get more info on the dimscale object.*/ - if (H5Gget_objinfo(dsid, ".", 1, &statbuf) < 0) - return -1; - - /* Pass this information back to caller. */ -/* (*(HDF5_OBJID_T *)dimscale_hdf5_objids).fileno = statbuf.fileno; - (*(HDF5_OBJID_T *)dimscale_hdf5_objids).objno = statbuf.objno;*/ - (*(HDF5_OBJID_T *)dimscale_hdf5_objids).fileno[0] = statbuf.fileno[0]; - (*(HDF5_OBJID_T *)dimscale_hdf5_objids).fileno[1] = statbuf.fileno[1]; - (*(HDF5_OBJID_T *)dimscale_hdf5_objids).objno[0] = statbuf.objno[0]; - (*(HDF5_OBJID_T *)dimscale_hdf5_objids).objno[1] = statbuf.objno[1]; - return 0; -} - -/* Given an HDF5 type, set a pointer to netcdf type. */ -static int -get_netcdf_type(NC_HDF5_FILE_INFO_T *h5, hid_t native_typeid, - nc_type *xtype) -{ - NC_TYPE_INFO_T *type; - hid_t class; - htri_t is_str, equal = 0; - - assert(h5 && xtype); - - if ((class = H5Tget_class(native_typeid)) < 0) - return NC_EHDFERR; - - /* H5Tequal doesn't work with H5T_C_S1 for some reason. But - * H5Tget_class will return H5T_STRING if this is a string. */ - if (class == H5T_STRING) - { - if ((is_str = H5Tis_variable_str(native_typeid)) < 0) - return NC_EHDFERR; - if (is_str) - *xtype = NC_STRING; - else - *xtype = NC_CHAR; - return NC_NOERR; - } - else if (class == H5T_INTEGER || class == H5T_FLOAT) - { - /* For integers and floats, we don't have to worry about - * endianness if we compare native types. */ - if ((equal = H5Tequal(native_typeid, H5T_NATIVE_SCHAR)) < 0) - return NC_EHDFERR; - if (equal) - { - *xtype = NC_BYTE; - return NC_NOERR; - } - if ((equal = H5Tequal(native_typeid, H5T_NATIVE_SHORT)) < 0) - return NC_EHDFERR; - if (equal) - { - *xtype = NC_SHORT; - return NC_NOERR; - } - if ((equal = H5Tequal(native_typeid, H5T_NATIVE_INT)) < 0) - return NC_EHDFERR; - if (equal) - { - *xtype = NC_INT; - return NC_NOERR; - } - if ((equal = H5Tequal(native_typeid, H5T_NATIVE_FLOAT)) < 0) - return NC_EHDFERR; - if (equal) - { - *xtype = NC_FLOAT; - return NC_NOERR; - } - if ((equal = H5Tequal(native_typeid, H5T_NATIVE_DOUBLE)) < 0) - return NC_EHDFERR; - if (equal) - { - *xtype = NC_DOUBLE; - return NC_NOERR; - } - if ((equal = H5Tequal(native_typeid, H5T_NATIVE_UCHAR)) < 0) - return NC_EHDFERR; - if (equal) - { - *xtype = NC_UBYTE; - return NC_NOERR; - } - if ((equal = H5Tequal(native_typeid, H5T_NATIVE_USHORT)) < 0) - return NC_EHDFERR; - if (equal) - { - *xtype = NC_USHORT; - return NC_NOERR; - } - if ((equal = H5Tequal(native_typeid, H5T_NATIVE_UINT)) < 0) - return NC_EHDFERR; - if (equal) - { - *xtype = NC_UINT; - return NC_NOERR; - } - if ((equal = H5Tequal(native_typeid, H5T_NATIVE_LLONG)) < 0) - return NC_EHDFERR; - if (equal) - { - *xtype = NC_INT64; - return NC_NOERR; - } - if ((equal = H5Tequal(native_typeid, H5T_NATIVE_ULLONG)) < 0) - return NC_EHDFERR; - if (equal) - { - *xtype = NC_UINT64; - return NC_NOERR; - } - } - - /* Maybe we already know about this type. */ - if (!equal) - if((type = nc4_rec_find_hdf_type(h5->root_grp, native_typeid))) - { - *xtype = type->nc_typeid; - return NC_NOERR; - } - - *xtype = NC_NAT; - return NC_EBADTYPID; -} - -/* Given an HDF5 type, set a pointer to netcdf type_info struct, - * either an existing one (for user-defined types) or a newly created - * one. */ -static int -get_type_info2(NC_HDF5_FILE_INFO_T *h5, hid_t datasetid, - nc_type *xtype, NC_TYPE_INFO_T **type_info) -{ - NC_TYPE_INFO_T *type; - htri_t is_str, equal = 0; - hid_t class, native_typeid, hdf_typeid; -#if 0 - nc_type my_nc_type = 0; -#endif - H5T_order_t order; - int endianness; - nc_type nc_type_constant[NUM_TYPES] = {NC_CHAR, NC_BYTE, NC_SHORT, NC_INT, NC_FLOAT, - NC_DOUBLE, NC_UBYTE, NC_USHORT, NC_UINT, - NC_INT64, NC_UINT64, NC_STRING}; - int type_size[NUM_TYPES] = {sizeof(char), sizeof(char), sizeof(short), - sizeof(int), sizeof(float), sizeof(double), - sizeof(unsigned char), sizeof(unsigned short), - sizeof(unsigned int), sizeof(long long), - sizeof(unsigned long long), 0}; - int t; - - assert(h5 && xtype && type_info); - - /* Because these N5T_NATIVE_* constants are actually function calls - * (!) in H5Tpublic.h, I can't initialize this array in the usual - * way, because at least some C compilers (like Irix) complain - * about calling functions when defining constants. So I have to do - * it like this. Note that there's no native types for char or - * string. Those are handled later. */ - if (!native_type_constant[1]) - { - native_type_constant[1] = H5T_NATIVE_SCHAR; - native_type_constant[2] = H5T_NATIVE_SHORT; - native_type_constant[3] = H5T_NATIVE_INT; - native_type_constant[4] = H5T_NATIVE_FLOAT; - native_type_constant[5] = H5T_NATIVE_DOUBLE; - native_type_constant[6] = H5T_NATIVE_UCHAR; - native_type_constant[7] = H5T_NATIVE_USHORT; - native_type_constant[8] = H5T_NATIVE_UINT; - native_type_constant[9] = H5T_NATIVE_LLONG; - native_type_constant[10] = H5T_NATIVE_ULLONG; - } - - /* Get the HDF5 typeid - we'll need it later. */ - if ((hdf_typeid = H5Dget_type(datasetid)) < 0) - return NC_EHDFERR; - - /* Get the native typeid. Will be equivalent to hdf_typeid when - * creating but not necessarily when reading, a variable. */ - if ((native_typeid = H5Tget_native_type(hdf_typeid, H5T_DIR_DEFAULT)) < 0) - return NC_EHDFERR; - - /* Is this type an integer, string, compound, or what? */ - if ((class = H5Tget_class(native_typeid)) < 0) - return NC_EHDFERR; - - /* Is this an atomic type? */ - if (class == H5T_STRING || class == H5T_INTEGER || class == H5T_FLOAT) - { - /* Allocate a phony NC_TYPE_INFO_T struct to hold type info. */ - if (!(*type_info = calloc(1, sizeof(NC_TYPE_INFO_T)))) - return NC_ENOMEM; - (*type_info)->class = class; - - /* H5Tequal doesn't work with H5T_C_S1 for some reason. But - * H5Tget_class will return H5T_STRING if this is a string. */ - if (class == H5T_STRING) - { - if ((is_str = H5Tis_variable_str(native_typeid)) < 0) - return NC_EHDFERR; - /* Make sure fixed-len strings will work like variable-len strings */ - if (is_str || H5Tget_size(hdf_typeid) > 1) - t = NUM_TYPES - 1; - else - t = 0; - } - else if (class == H5T_INTEGER || class == H5T_FLOAT) - { - for (t = 1; t < NUM_TYPES - 1; t++) - { - if ((equal = H5Tequal(native_typeid, native_type_constant[t])) < 0) - return NC_EHDFERR; - if (equal) - { -#if 0 - my_nc_type = nc_type_constant[t]; -#endif - break; - } - } - - /* Find out about endianness. */ - if (class == H5T_INTEGER) - { - if ((order = H5Tget_order(hdf_typeid)) < 0) - return NC_EHDFERR; - if (order == H5T_ORDER_LE) - endianness = NC_ENDIAN_LITTLE; - else if (order == H5T_ORDER_BE) - endianness = NC_ENDIAN_BIG; - else /* don't support H5T_ORDER_VAX, H5T_ORDER_MIXED, H5T_ORDER_NONE */ - return NC_EBADTYPE; - /* Copy this into the type_info struct. */ - (*type_info)->endianness = endianness; - } - } - *xtype = nc_type_constant[t]; - (*type_info)->nc_typeid = nc_type_constant[t]; - (*type_info)->size = type_size[t]; - if (!((*type_info)->name = malloc((strlen(nc_type_name[t]) + 1) * sizeof(char)))) - return NC_ENOMEM; - strcpy((*type_info)->name, nc_type_name[t]); - (*type_info)->class = class; - (*type_info)->hdf_typeid = hdf_typeid; - (*type_info)->native_typeid = native_typeid; - (*type_info)->close_hdf_typeid = 1; - return NC_NOERR; - } - else - { - /* This is a user-defined type. */ - if((type = nc4_rec_find_hdf_type(h5->root_grp, native_typeid))) - { - *xtype = type->nc_typeid; - *type_info = type; - } - - /* The type entry in the array of user-defined types already has - * an open data typeid (and native typeid), so close the ones we - * opened above. */ - if (H5Tclose(native_typeid) < 0) - return NC_EHDFERR; - if (H5Tclose(hdf_typeid) < 0) - return NC_EHDFERR; - - if (type) - return NC_NOERR; - } - - *xtype = NC_NAT; - return NC_EBADTYPID; -} - -/* Read an attribute. */ -static int -read_hdf5_att(NC_GRP_INFO_T *grp, hid_t attid, NC_ATT_INFO_T *att) -{ - hid_t spaceid = 0, file_typeid = 0; - hsize_t dims[1]; /* netcdf attributes always 1-D. */ - int retval = NC_NOERR; - size_t type_size; - int att_ndims; - hssize_t att_npoints; - H5T_class_t att_class; - int fixed_len_string = 0; - size_t fixed_size = 0; - - assert(att->name); - LOG((5, "read_hdf5_att: att->attnum %d att->name %s " - "att->xtype %d att->len %d", att->attnum, att->name, - att->xtype, att->len)); - - /* Get type of attribute in file. */ - if ((file_typeid = H5Aget_type(attid)) < 0) - return NC_EATTMETA; - if ((att->native_typeid = H5Tget_native_type(file_typeid, H5T_DIR_DEFAULT)) < 0) - BAIL(NC_EHDFERR); - if ((att_class = H5Tget_class(att->native_typeid)) < 0) - BAIL(NC_EATTMETA); - if (att_class == H5T_STRING && !H5Tis_variable_str(att->native_typeid)) - { - fixed_len_string++; - if (!(fixed_size = H5Tget_size(att->native_typeid))) - BAIL(NC_EATTMETA); - } - if ((retval = get_netcdf_type(grp->file->nc4_info, att->native_typeid, &(att->xtype)))) - BAIL(retval); - - - /* Get len. */ - if ((spaceid = H5Aget_space(attid)) < 0) - BAIL(NC_EATTMETA); -#ifdef EXTRA_TESTS - num_spaces++; -#endif - if ((att_ndims = H5Sget_simple_extent_ndims(spaceid)) < 0) - BAIL(NC_EATTMETA); - if ((att_npoints = H5Sget_simple_extent_npoints(spaceid)) < 0) - BAIL(NC_EATTMETA); - - /* If both att_ndims and att_npoints are zero, then this is a - * zero length att. */ - if (att_ndims == 0 && att_npoints == 0) - { - dims[0] = 0; - } - else if (att->xtype == NC_STRING) { - dims[0] = att_npoints; - } - else if (att->xtype == NC_CHAR) - { - /* NC_CHAR attributes are written as a scalar in HDF5, of type - * H5T_C_S1, of variable length. */ - if (att_ndims == 0) - { - if (!(dims[0] = H5Tget_size(file_typeid))) - BAIL(NC_EATTMETA); - } - else - { - /* This is really a string type! */ - att->xtype = NC_STRING; - dims[0] = att_npoints; - } - } - else - { - /* All netcdf attributes are scalar or 1-D only. */ - if (att_ndims > 1) - BAIL(NC_EATTMETA); - - /* Read the size of this attribute. */ - if (H5Sget_simple_extent_dims(spaceid, dims, NULL) < 0) - BAIL(NC_EATTMETA); - } - - /* Tell the user what the length if this attribute is. */ - att->len = dims[0]; - - /* Allocate some memory if the len is not zero, and read the - attribute. */ - if (dims[0]) - { - if ((retval = nc4_get_typelen_mem(grp->file->nc4_info, att->xtype, 0, - &type_size))) - return retval; - if (att_class == H5T_VLEN) - { - if (!(att->vldata = malloc((unsigned int)(att->len * sizeof(hvl_t))))) - BAIL(NC_ENOMEM); - if (H5Aread(attid, att->native_typeid, att->vldata) < 0) - BAIL(NC_EATTMETA); - } - else if (att->xtype == NC_STRING) - { - if (!(att->stdata = calloc(att->len, sizeof(char *)))) - BAIL(NC_ENOMEM); - /* For a fixed length HDF5 string, the read requires - * contiguous memory. Meanwhile, the netCDF API requires that - * nc_free_string be called on string arrays, which would not - * work if one contiguous memory block were used. So here I - * convert the contiguous block of strings into an array of - * malloced strings (each string with its own malloc). Then I - * copy the data and free the contiguous memory. This - * involves copying the data, which is bad, but this only - * occurs for fixed length string attributes, and presumably - * these are small. (And netCDF-4 does not create them - it - * always uses variable length strings. */ - if (fixed_len_string) - { - int i; - char *contig_buf, *cur; - - /* Alloc space for the contiguous memory read. */ - if (!(contig_buf = malloc(att->len * fixed_size * sizeof(char)))) - BAIL(NC_ENOMEM); - - /* Read the fixed-len strings as one big block. */ - if (H5Aread(attid, att->native_typeid, contig_buf) < 0) - BAIL(NC_EATTMETA); - - /* Copy strings, one at a time, into their new home. Alloc - space for each string. The user will later free this - space with nc_free_string. */ - cur = contig_buf; - for (i = 0; i < att->len; i++) - { - if (!(att->stdata[i] = malloc(fixed_size))) - BAIL(NC_ENOMEM); - strncpy(att->stdata[i], cur, fixed_size); - cur += fixed_size; - } - - /* Free contiguous memory buffer. */ - free(contig_buf); - } - else - { - /* Read variable-length string atts. */ - if (H5Aread(attid, att->native_typeid, att->stdata) < 0) - BAIL(NC_EATTMETA); - } - } - else - { - if (!(att->data = malloc((unsigned int)(att->len * type_size)))) - BAIL(NC_ENOMEM); - if (H5Aread(attid, att->native_typeid, att->data) < 0) - BAIL(NC_EATTMETA); - } - } - - if (H5Tclose(file_typeid) < 0) - BAIL(NC_EHDFERR); - if (H5Sclose(spaceid) < 0) - return NC_EHDFERR; -#ifdef EXTRA_TESTS - num_spaces--; -#endif - - return NC_NOERR; - - exit: - if (H5Tclose(file_typeid) < 0) - BAIL2(NC_EHDFERR); - if (spaceid > 0 && H5Sclose(spaceid) < 0) - BAIL2(NC_EHDFERR); -#ifdef EXTRA_TESTS - num_spaces--; -#endif - return retval; -} - -/* Read information about a user defined type from the HDF5 file, and - * stash it in the group's list of types. Return the netcdf typeid - * through a pointer, if caller desires it. */ -static int -read_type(NC_GRP_INFO_T *grp, char *type_name) -{ - NC_TYPE_INFO_T *type; - H5T_class_t class; - hid_t hdf_typeid, native_typeid = 0; - int nmembers; - hid_t member_hdf_typeid, base_hdf_typeid = 0; - char *member_name = NULL; - size_t type_size = 0, member_offset; - unsigned int m; - nc_type ud_type_type = NC_NAT, base_nc_type = NC_NAT, member_xtype; - htri_t ret; - int retval = NC_NOERR; - void *value; - int i; - - assert(grp && type_name); - - if (strlen(type_name) > NC_MAX_NAME) - return NC_EBADNAME; - - LOG((4, "read_type: type_name %s grp->name %s", type_name, grp->name)); - - if ((hdf_typeid = H5Topen2(grp->hdf_grpid, type_name, H5P_DEFAULT)) < 0) - return NC_EHDFERR; - - /* What is the native type for this platform? */ - if ((native_typeid = H5Tget_native_type(hdf_typeid, H5T_DIR_DEFAULT)) < 0) - return NC_EHDFERR; - - /* What is the size of this type on this platform. */ - if (!(type_size = H5Tget_size(native_typeid))) - return NC_EHDFERR; - LOG((5, "type_size %d", type_size)); - - /* What is the class of this type, compound, vlen, etc. */ - if ((class = H5Tget_class(hdf_typeid)) < 0) - return NC_EHDFERR; - switch (class) - { - case H5T_STRING: - ud_type_type = NC_STRING; - break; - case H5T_COMPOUND: - ud_type_type = NC_COMPOUND; - break; - case H5T_VLEN: - /* For conveninence we allow user to pass vlens of strings - * with null terminated strings. This means strings are - * treated slightly differently by the API, although they are - * really just VLENs of characters. */ - if ((ret = H5Tis_variable_str(hdf_typeid)) < 0) - return NC_EHDFERR; - if (ret) - ud_type_type = NC_STRING; - else - { - ud_type_type = NC_VLEN; - - /* Find the base type of this vlen (i.e. what is this a - * vlen of?) */ - if (!(base_hdf_typeid = H5Tget_super(native_typeid))) - return NC_EHDFERR; - - /* What size is this type? */ - if (!(type_size = H5Tget_size(base_hdf_typeid))) - return NC_EHDFERR; - - /* What is the netcdf corresponding type. */ - if ((retval = get_netcdf_type(grp->file->nc4_info, base_hdf_typeid, - &base_nc_type))) - return retval; - LOG((5, "base_hdf_typeid 0x%x type_size %d base_nc_type %d", - base_hdf_typeid, type_size, base_nc_type)); - } - break; - case H5T_OPAQUE: - ud_type_type = NC_OPAQUE; - /* What size is this type? */ - if (!(type_size = H5Tget_size(hdf_typeid))) - return NC_EHDFERR; - LOG((5, "type_size %d", type_size)); - break; - case H5T_ENUM: - ud_type_type = NC_ENUM; - - /* Find the base type of this enum (i.e. what is this a - * enum of?) */ - if (!(base_hdf_typeid = H5Tget_super(hdf_typeid))) - return NC_EHDFERR; - /* What size is this type? */ - if (!(type_size = H5Tget_size(base_hdf_typeid))) - return NC_EHDFERR; - /* What is the netcdf corresponding type. */ - if ((retval = get_netcdf_type(grp->file->nc4_info, base_hdf_typeid, - &base_nc_type))) - return retval; - LOG((5, "base_hdf_typeid 0x%x type_size %d base_nc_type %d", - base_hdf_typeid, type_size, base_nc_type)); - break; - default: - LOG((0, "unknown class")); - return NC_EBADCLASS; - } - - /* Add to the list for this new type, and get a local pointer to it. */ - if ((retval = nc4_type_list_add(&grp->type, &type))) - return retval; - assert(type); - - /* Remember info about this type. */ - type->nc_typeid = grp->file->nc4_info->next_typeid++; - type->size = type_size; - if (!(type->name = malloc((strlen(type_name) + 1) * sizeof(char)))) - return NC_ENOMEM; - strcpy(type->name, type_name); - type->class = ud_type_type; - type->base_nc_type = base_nc_type; - type->committed++; - type->hdf_typeid = hdf_typeid; - type->native_typeid = native_typeid; - - /* Read info about each member of this compound type. */ - if (ud_type_type == NC_COMPOUND) - { - if ((nmembers = H5Tget_nmembers(hdf_typeid)) < 0) - return NC_EHDFERR; - LOG((5, "compound type has %d members", nmembers)); - for (m = 0; m < nmembers; m++) - { - H5T_class_t mem_class; - hid_t member_native_typeid; - int ndims = 0, dim_size[NC_MAX_VAR_DIMS]; - hsize_t dims[NC_MAX_VAR_DIMS]; - int d; - - /* Get the typeid and native typeid of this member of the - * compound type. */ - if ((member_hdf_typeid = H5Tget_member_type(type->native_typeid, m)) < 0) - return NC_EHDFERR; - if ((member_native_typeid = H5Tget_native_type(member_hdf_typeid, H5T_DIR_DEFAULT)) < 0) - return NC_EHDFERR; - - /* Get the name of the member.*/ - member_name = H5Tget_member_name(type->native_typeid, m); - if (!member_name || strlen(member_name) > NC_MAX_NAME) - return NC_EBADNAME; - - /* Offset in bytes on *this* platform. */ - member_offset = H5Tget_member_offset(type->native_typeid, m); - - /* Get dimensional data if this member is an array of something. */ - if ((mem_class = H5Tget_class(member_hdf_typeid)) < 0) - return NC_EHDFERR; - if (mem_class == H5T_ARRAY) - { - if ((ndims = H5Tget_array_ndims(member_hdf_typeid)) < 0) - return NC_EHDFERR; - if (H5Tget_array_dims(member_hdf_typeid, dims, NULL) != ndims) - return NC_EHDFERR; - for (d = 0; d < ndims; d++) - dim_size[d] = dims[d]; - /* What is the netCDF typeid of this member? */ - if ((retval = get_netcdf_type(grp->file->nc4_info, H5Tget_super(member_hdf_typeid), - &member_xtype))) - return retval; - } - else - { - /* What is the netCDF typeid of this member? */ - if ((retval = get_netcdf_type(grp->file->nc4_info, member_native_typeid, - &member_xtype))) - return retval; - } - - /* Add this member to our list of fields in this compound type. */ - if (ndims) - { - if ((retval = nc4_field_list_add(&type->field, type->num_fields++, member_name, - member_offset, H5Tget_super(member_hdf_typeid), - H5Tget_super(member_native_typeid), - member_xtype, ndims, dim_size))) - return retval; - } - else - { - if ((retval = nc4_field_list_add(&type->field, type->num_fields++, member_name, - member_offset, member_hdf_typeid, member_native_typeid, - member_xtype, 0, NULL))) - return retval; - } - - /* HDF5 allocated this for us. */ - free(member_name); - } - } - else if (ud_type_type == NC_VLEN) - { - type->base_hdf_typeid = base_hdf_typeid; - } - else if (ud_type_type == NC_ENUM) - { - /* Remember the base HDF5 type for this enum. */ - type->base_hdf_typeid = base_hdf_typeid; - - /* Find out how many member are in the enum. */ - if ((type->num_enum_members = H5Tget_nmembers(hdf_typeid)) < 0) - return NC_EHDFERR; - - /* Allocate space for one value. */ - if (!(value = calloc(1, type_size))) - return NC_ENOMEM; - - /* Read each name and value defined in the enum. */ - for (i = 0; i < type->num_enum_members; i++) - { - /* Get the name and value from HDF5. */ - if (!(member_name = H5Tget_member_name(hdf_typeid, i))) - return NC_EHDFERR; - if (!member_name || strlen(member_name) > NC_MAX_NAME) - return NC_EBADNAME; - if (H5Tget_member_value(hdf_typeid, i, value) < 0) - return NC_EHDFERR; - - /* Insert new field into this type's list of fields. */ - if ((retval = nc4_enum_member_add(&type->enum_member, type->size, - member_name, value))) - return retval; - free(member_name); - } - - /* Free the tempory memory for one value, and the member name - * (which HDF5 allocated for us). */ - free(value); - } - - return retval; -} - -/* This function is called by read_dataset, (which is called by - * nc4_rec_read_metadata) when a netCDF variable is found in the - * file. This function reads in all the metadata about the var, - * including the attributes. */ -static int -read_var(NC_GRP_INFO_T *grp, hid_t datasetid, char *obj_name, - size_t ndims, int is_scale, int num_scales, hid_t access_pid) -{ - NC_VAR_INFO_T *var; - int natts, a, d; - - NC_ATT_INFO_T *att; - hid_t attid = 0; - char att_name[NC_MAX_HDF5_NAME + 1]; - -#define CD_NELEMS_ZLIB 1 -#define CD_NELEMS_SZIP 4 - H5Z_filter_t filter; - int num_filters; - unsigned int cd_values[CD_NELEMS_SZIP]; - size_t cd_nelems = CD_NELEMS_SZIP; - hid_t propid = 0; - H5D_fill_value_t fill_status; - H5D_layout_t layout; - hsize_t chunksize[NC_MAX_VAR_DIMS]; - int retval = NC_NOERR; - double rdcc_w0; - int f; - - assert(obj_name && grp); - LOG((4, "read_var: obj_name %s", obj_name)); - - /* Add a variable to the end of the group's var list. */ - if ((retval = nc4_var_list_add(&grp->var, &var))) - return retval; - - /* Fill in what we already know. */ - var->hdf_datasetid = datasetid; - var->varid = grp->nvars++; - var->created++; - var->ndims = ndims; - - /* We need some room to store information about dimensions for this - * var. */ - if (var->ndims) - { - if (!(var->dim = calloc(var->ndims, sizeof(NC_DIM_INFO_T *)))) - return NC_ENOMEM; - if (!(var->dimids = calloc(var->ndims, sizeof(int)))) - return NC_ENOMEM; - } - - /* Learn about current chunk cache settings. */ - if ((H5Pget_chunk_cache(access_pid, &(var->chunk_cache_nelems), - &(var->chunk_cache_size), &rdcc_w0)) < 0) - return NC_EHDFERR; - var->chunk_cache_preemption = rdcc_w0; - - /* Allocate space for the name. */ - if (!(var->name = malloc((strlen(obj_name) + 1) * sizeof(char)))) - return NC_ENOMEM; - - /* Check for a weird case: a non-coordinate (and non-scalar) - * variable that has the same name as a dimension. It's legal in - * netcdf, and requires that the HDF5 dataset name be changed. */ - if (var->ndims && - !strncmp(obj_name, NON_COORD_PREPEND, strlen(NON_COORD_PREPEND))) - { - if (strlen(obj_name) > NC_MAX_NAME) - return NC_EMAXNAME; - strcpy(var->name, &obj_name[strlen(NON_COORD_PREPEND)]); - } - else - strcpy(var->name, obj_name); - - /* Find out what filters are applied to this HDF5 dataset, - * fletcher32, deflate, and/or shuffle. All other filters are - * ignored. */ - if ((propid = H5Dget_create_plist(datasetid)) < 0) - BAIL(NC_EHDFERR); -#ifdef EXTRA_TESTS - num_plists++; -#endif /* EXTRA_TESTS */ - - /* Get the chunking info for non-scalar vars. */ - if ((layout = H5Pget_layout(propid)) < -1) - BAIL(NC_EHDFERR); - if (layout == H5D_CHUNKED) - { - if (H5Pget_chunk(propid, NC_MAX_VAR_DIMS, chunksize) < 0) - BAIL(NC_EHDFERR); - if (!(var->chunksizes = malloc(var->ndims * sizeof(size_t)))) - BAIL(NC_ENOMEM); - for (d = 0; d < var->ndims; d++) - var->chunksizes[d] = chunksize[d]; - } - else if (layout == H5D_CONTIGUOUS) - var->contiguous++; - - /* The possible values of filter (which is just an int) can be - * found in H5Zpublic.h. */ - if ((num_filters = H5Pget_nfilters(propid)) < 0) - BAIL(NC_EHDFERR); - for (f = 0; f < num_filters; f++) - { - if ((filter = H5Pget_filter2(propid, f, NULL, &cd_nelems, - cd_values, 0, NULL, NULL)) < 0) - BAIL(NC_EHDFERR); - switch (filter) - { - case H5Z_FILTER_SHUFFLE: - var->shuffle = 1; - break; - case H5Z_FILTER_FLETCHER32: - var->fletcher32 = 1; - break; - case H5Z_FILTER_DEFLATE: - var->deflate++; - if (cd_nelems != CD_NELEMS_ZLIB || - cd_values[0] > MAX_DEFLATE_LEVEL) - BAIL(NC_EHDFERR); - var->deflate_level = cd_values[0]; - break; - case H5Z_FILTER_SZIP: - var->deflate++; - if (cd_nelems != CD_NELEMS_SZIP) - BAIL(NC_EHDFERR); - var->options_mask = cd_values[0]; - var->pixels_per_block = cd_values[1]; - break; - default: - LOG((1, "Yikes! Unknown filter type found on dataset!")); - break; - } - } - - /* Learn all about the type of this variable. */ - if ((retval = get_type_info2(grp->file->nc4_info, datasetid, - &var->xtype, &var->type_info))) - BAIL(retval); - - /* Is there a fill value associated with this dataset? */ - if (H5Pfill_value_defined(propid, &fill_status) < 0) - BAIL(NC_EHDFERR); - - /* Get the fill value, if there is one defined. */ - if (fill_status == H5D_FILL_VALUE_USER_DEFINED) - { - /* Allocate space to hold the fill value. */ - if (!var->fill_value) - { - if (var->type_info->class == NC_VLEN) - { - if (!(var->fill_value = malloc(sizeof(nc_vlen_t)))) - BAIL(NC_ENOMEM); - } - else if (var->type_info->size) - { - if (!(var->fill_value = malloc(var->type_info->size))) - BAIL(NC_ENOMEM); - } - else - { - if (!(var->fill_value = malloc(sizeof(char *)))) - BAIL(NC_ENOMEM); - } - } - - /* Get the fill value from the HDF5 property lust. */ - if (H5Pget_fill_value(propid, var->type_info->native_typeid, - var->fill_value) < 0) - BAIL(NC_EHDFERR); - } - else - var->no_fill = 1; - - /* If it's a scale, mark it as such. If not, allocate space to - * remember whether the dimscale has been attached for each - * dimension. */ - if (is_scale) - { - assert(ndims); - var->dimscale++; - if (var->ndims > 1) - { - if ((retval = read_coord_dimids(var))) - BAIL(retval); - } - else - { - var->dimids[0] = grp->dim->dimid; - var->dim[0] = grp->dim; - } - } - else - if (num_scales && ndims && - !(var->dimscale_attached = calloc(ndims, sizeof(int)))) - BAIL(NC_ENOMEM); - - /* If this is not a scale, and has scales, iterate - * through them. (i.e. this is a variable that is not a - * coordinate variable) */ - if (!is_scale && num_scales) - { - /* Store id information allowing us to match hdf5 - * dimscales to netcdf dimensions. */ - if (!(var->dimscale_hdf5_objids = malloc(ndims * sizeof(struct hdf5_objid)))) - BAIL(NC_ENOMEM); - for (d = 0; d < var->ndims; d++) - { - LOG((5, "read_var: about to iterate over scales for dim %d", d)); - if (H5DSiterate_scales(var->hdf_datasetid, d, NULL, dimscale_visitor, - &(var->dimscale_hdf5_objids[d])) < 0) - BAIL(NC_EHDFERR); -/* LOG((5, "read_var: collected scale info for dim %d " - "var %s fileno[0] %d objno[0] %d fileno[1] %d objno[1] %d", - d, var->name, var->dimscale_hdf5_objids[d].fileno[0], - var->dimscale_hdf5_objids[d].objno[0], - var->dimscale_hdf5_objids[d].fileno[1], - var->dimscale_hdf5_objids[d].objno[1]));*/ - var->dimscale_attached[d]++; - } - } - - /* Now read all the attributes of this variable, ignoring the - ones that hold HDF5 dimension scale information. */ - if ((natts = H5Aget_num_attrs(var->hdf_datasetid)) < 0) - BAIL(NC_EATTMETA); - for (a = 0; a < natts; a++) - { - /* Close the attribute and try to move on with our - * lives. Like bits through the network port, so - * flows the Days of Our Lives! */ - if (attid && H5Aclose(attid) < 0) - BAIL(NC_EHDFERR); - - /* Open the att and get its name. */ - if ((attid = H5Aopen_idx(var->hdf_datasetid, (unsigned int)a)) < 0) - BAIL(NC_EATTMETA); - if (H5Aget_name(attid, NC_MAX_HDF5_NAME, att_name) < 0) - BAIL(NC_EATTMETA); - LOG((4, "read_var: a %d att_name %s", a, att_name)); - - /* Should we ignore this attribute? */ - if (strcmp(att_name, REFERENCE_LIST) && - strcmp(att_name, CLASS) && - strcmp(att_name, DIMENSION_LIST) && - strcmp(att_name, NAME) && - strcmp(att_name, COORDINATES)) - { - /* Is this the hidden attribute that holds the netCDF - * dimension id for a coordinate variable? */ - if (!strcmp(att_name, NC_DIMID_ATT_NAME)) - { - - } - else - { - /* Add to the end of the list of atts for this var. */ - if ((retval = nc4_att_list_add(&var->att))) - BAIL(retval); - for (att = var->att; att->next; att = att->next) - ; - - /* Fill in the information we know. */ - att->attnum = var->natts++; - if (!(att->name = malloc((strlen(att_name) + 1) * sizeof(char)))) - BAIL(NC_ENOMEM); - strcpy(att->name, att_name); - - /* Read the rest of the info about the att, - * including its values. */ - if ((retval = read_hdf5_att(grp, attid, att))) - BAIL(retval); - - att->created++; - } /* endif not HDF5 att */ - } - } /* next attribute */ - - /* Is this a deflated variable with a chunksize greater than the - * current cache size? */ - if ((retval = nc4_adjust_var_cache(grp, var))) - BAIL(retval); - - exit: - if (propid > 0 && H5Pclose(propid) < 0) - BAIL2(NC_EHDFERR); -#ifdef EXTRA_TESTS - num_plists--; -#endif - if (attid > 0 && H5Aclose(attid) < 0) - BAIL2(NC_EHDFERR); - return retval; -} - -/* This function is called by nc4_rec_read_metadata to read all the - * group level attributes (the NC_GLOBAL atts for this group). */ -static int -read_grp_atts(NC_GRP_INFO_T *grp) -{ - hid_t attid = 0; - hsize_t num_obj, i; - NC_ATT_INFO_T *att; - NC_TYPE_INFO_T *type; - char obj_name[NC_MAX_HDF5_NAME + 1]; - int max_len; - int retval = NC_NOERR; - - num_obj = H5Aget_num_attrs(grp->hdf_grpid); - for (i = 0; i < num_obj; i++) - { - if (attid > 0) - H5Aclose(attid); - if ((attid = H5Aopen_idx(grp->hdf_grpid, (unsigned int)i)) < 0) - BAIL(NC_EATTMETA); - if (H5Aget_name(attid, NC_MAX_NAME + 1, obj_name) < 0) - BAIL(NC_EATTMETA); - LOG((3, "reading attribute of _netCDF group, named %s", obj_name)); - - /* This may be an attribute telling us that strict netcdf-3 - * rules are in effect. If so, we will make note of the fact, - * but not add this attribute to the metadata. It's not a user - * attribute, but an internal netcdf-4 one. */ - if (!strcmp(obj_name, NC3_STRICT_ATT_NAME)) - grp->file->nc4_info->cmode |= NC_CLASSIC_MODEL; - else - { - /* Add an att struct at the end of the list, and then go to it. */ - if ((retval = nc4_att_list_add(&grp->att))) - BAIL(retval); - for (att = grp->att; att->next; att = att->next) - ; - - /* Add the info about this attribute. */ - max_len = strlen(obj_name) > NC_MAX_NAME ? NC_MAX_NAME : strlen(obj_name); - if (!(att->name = malloc((max_len + 1) * sizeof(char)))) - BAIL(NC_ENOMEM); - strncpy(att->name, obj_name, max_len); - att->name[max_len] = 0; - att->attnum = grp->natts++; - if ((retval = read_hdf5_att(grp, attid, att))) - BAIL(retval); - att->created++; - if ((retval = nc4_find_type(grp->file->nc4_info, att->xtype, &type))) - BAIL(retval); - if (type) - att->class = type->class; - } - } - - exit: - if (attid > 0 && H5Aclose(attid) < 0) - BAIL2(NC_EHDFERR); - return retval; -} - -/* This function is called when nc4_rec_read_vars encounters an HDF5 - * dataset when reading a file. */ -static int -read_dataset(NC_GRP_INFO_T *grp, char *obj_name) -{ - hid_t datasetid = 0; - hid_t spaceid = 0, access_pid = 0; - int ndims; - hsize_t dims[NC_MAX_DIMS], max_dims[NC_MAX_DIMS]; - int is_scale = 0; - int dim_without_var = 0; - int num_scales = 0; - int retval = NC_NOERR; - - /* Open this dataset. */ - if ((datasetid = H5Dopen2(grp->hdf_grpid, obj_name, H5P_DEFAULT)) < 0) - BAIL(NC_EVARMETA); - - /* Get the current chunk cache settings. */ - if ((access_pid = H5Dget_access_plist(datasetid)) < 0) - BAIL(NC_EVARMETA); -#ifdef EXTRA_TESTS - num_plists++; -#endif - - /* Get the dimension information for this dataset. */ - if ((spaceid = H5Dget_space(datasetid)) < 0) - BAIL(NC_EHDFERR); -#ifdef EXTRA_TESTS - num_spaces++; -#endif - if ((ndims = H5Sget_simple_extent_ndims(spaceid)) < 0) - BAIL(NC_EHDFERR); - if (ndims > NC_MAX_DIMS) - BAIL(NC_EMAXDIMS); - if (H5Sget_simple_extent_dims(spaceid, dims, max_dims) < 0) - BAIL(NC_EHDFERR); - - /* Is this a dimscale? */ - if ((is_scale = H5DSis_scale(datasetid)) < 0) - BAIL(NC_EHDFERR); - if (is_scale) - { - /* Read the scale information. */ - if ((retval = read_scale(grp, datasetid, obj_name, dims[0], - max_dims[0], &dim_without_var))) - BAIL(retval); - } - else - { - /* Find out how many scales are attached to this - * dataset. H5DSget_num_scales returns an error if there are no - * scales, so convert a negative return value to zero. */ - num_scales = H5DSget_num_scales(datasetid, 0); - if (num_scales < 0) - num_scales = 0; - } - - /* Add a var to the linked list, and get its metadata, - * unless this is one of those funny dimscales that are a - * dimension in netCDF but not a variable. (Spooky!) */ - if (!dim_without_var) - if ((retval = read_var(grp, datasetid, obj_name, ndims, - is_scale, num_scales, access_pid))) - BAIL(retval); - - if (access_pid && H5Pclose(access_pid) < 0) - BAIL2(retval); -#ifdef EXTRA_TESTS - num_plists--; -#endif - if (spaceid && H5Sclose(spaceid) < 0) - BAIL2(retval); -#ifdef EXTRA_TESTS - num_spaces--; -#endif - return NC_NOERR; - - exit: - if (access_pid && H5Pclose(access_pid) < 0) - BAIL2(retval); -#ifdef EXTRA_TESTS - num_plists--; -#endif - if (datasetid && H5Dclose(datasetid) < 0) - BAIL2(retval); - if (spaceid && H5Sclose(spaceid) <0) - BAIL2(retval); -#ifdef EXTRA_TESTS - num_spaces--; -#endif - return retval; -} - -/* Given index, get the HDF5 name of an object and the class of the - * object (group, type, dataset, etc.). This function will try to use - * creation ordering, but if that fails it will use default - * (i.e. alphabetical) ordering. (This is necessary to read existing - * HDF5 archives without creation ordering). */ -/* static int */ -/* get_name_by_idx(NC_HDF5_FILE_INFO_T *h5, hid_t hdf_grpid, int i, */ -/* int *obj_class, char *obj_name) */ -/* { */ -/* H5O_info_t obj_info; */ -/* H5_index_t idx_field = H5_INDEX_CRT_ORDER; */ -/* ssize_t size; */ -/* herr_t res; */ - -/* /\* These HDF5 macros prevent an HDF5 error message when a */ -/* * non-creation-ordered HDF5 file is opened. *\/ */ -/* H5E_BEGIN_TRY { */ -/* res = H5Oget_info_by_idx(hdf_grpid, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, */ -/* i, &obj_info, H5P_DEFAULT); */ -/* } H5E_END_TRY; */ - -/* /\* Creation ordering not available, so make sure this file is */ -/* * opened for read-only access. This is a plain old HDF5 file being */ -/* * read by netCDF-4. *\/ */ -/* if (res < 0) */ -/* { */ -/* if (H5Oget_info_by_idx(hdf_grpid, ".", H5_INDEX_NAME, H5_ITER_INC, */ -/* i, &obj_info, H5P_DEFAULT) < 0) */ -/* return NC_EHDFERR; */ -/* if (!h5->no_write) */ -/* return NC_ECANTWRITE; */ -/* h5->ignore_creationorder = 1; */ -/* idx_field = H5_INDEX_NAME; */ -/* } */ - -/* *obj_class = obj_info.type; */ -/* if ((size = H5Lget_name_by_idx(hdf_grpid, ".", idx_field, H5_ITER_INC, i, */ -/* NULL, 0, H5P_DEFAULT)) < 0) */ -/* return NC_EHDFERR; */ -/* if (size > NC_MAX_NAME) */ -/* return NC_EMAXNAME; */ -/* if (H5Lget_name_by_idx(hdf_grpid, ".", idx_field, H5_ITER_INC, i, */ -/* obj_name, size+1, H5P_DEFAULT) < 0) */ -/* return NC_EHDFERR; */ - -/* LOG((4, "get_name_by_idx: encountered HDF5 object obj_name %s", obj_name)); */ - -/* return NC_NOERR; */ -/* } */ - -#define USE_ITERATE_CODE -#ifdef USE_ITERATE_CODE - -static int -nc4_rec_read_types_cb(hid_t grpid, const char *name, const H5L_info_t *info, - void *_op_data) -{ - hid_t oid=-1; - H5I_type_t otype=-1; - char oname[NC_MAX_NAME + 1]; - NC_GRP_INFO_T *child_grp; - NC_GRP_INFO_T *grp = (NC_GRP_INFO_T *) (_op_data); - NC_HDF5_FILE_INFO_T *h5 = grp->file->nc4_info; - - /* Open this critter. */ - if ((oid = H5Oopen(grpid, name, H5P_DEFAULT)) < 0) - return H5_ITER_ERROR; - - if ((otype = H5Iget_type( oid ))<0) { - H5Oclose(oid); - return H5_ITER_ERROR; - } - H5Oclose(oid); - - strncpy(oname, name, NC_MAX_NAME); - - /* Deal with groups and types; ignore the rest. */ - if (otype == H5I_GROUP) - { - LOG((3, "found group %s", oname)); - if (nc4_grp_list_add(&(grp->children), h5->next_nc_grpid++, - grp, grp->file, oname, &child_grp)) - return H5_ITER_ERROR; - - if (nc4_rec_read_types(child_grp)) - return H5_ITER_ERROR; - } - else if (otype == H5I_DATATYPE) - { - LOG((3, "found datatype %s", oname)); - if (read_type(grp, oname)) - return H5_ITER_ERROR; - } - - return (H5_ITER_CONT); -} - -static int -nc4_rec_read_types(NC_GRP_INFO_T *grp) -{ - hsize_t idx=0; - int res = 0; - hid_t pid = 0; - unsigned crt_order_flags = 0; - NC_HDF5_FILE_INFO_T *h5 = grp->file->nc4_info; - - assert(grp && grp->name); - LOG((3, "nc4_rec_read_types: grp->name %s", grp->name)); - - /* Open this HDF5 group and retain its grpid. It will remain open - * with HDF5 until this file is nc_closed. */ - if (!grp->hdf_grpid) - { - if (grp->parent) - { - if ((grp->hdf_grpid = H5Gopen2(grp->parent->hdf_grpid, - grp->name, H5P_DEFAULT)) < 0) - return NC_EHDFERR; - } - else - { - if ((grp->hdf_grpid = H5Gopen2(grp->file->nc4_info->hdfid, - "/", H5P_DEFAULT)) < 0) - return NC_EHDFERR; - } - } - assert(grp->hdf_grpid > 0); - - pid = H5Gget_create_plist(grp->hdf_grpid); - H5Pget_link_creation_order(pid, &crt_order_flags); - H5Pclose(pid); - - crt_order_flags = crt_order_flags & H5_INDEX_CRT_ORDER; - - if (crt_order_flags == H5_INDEX_CRT_ORDER) - { - res = H5Literate(grp->hdf_grpid, H5_INDEX_CRT_ORDER, H5_ITER_INC, - &idx, nc4_rec_read_types_cb, (void *)grp); - } else - { - /* Without creation ordering, file must be read-only. */ - if (!idx && !h5->no_write) - return NC_ECANTWRITE; - - res = H5Literate(grp->hdf_grpid, H5_INDEX_NAME, H5_ITER_INC, - &idx, nc4_rec_read_types_cb, (void *)grp); - } - if (res<0) - return NC_EHDFERR; - return NC_NOERR; /* everything worked! */ -} - -static int -nc4_rec_read_vars_cb(hid_t grpid, const char *name, const H5L_info_t *info, - void *_op_data) -{ - hid_t oid=-1; - H5I_type_t otype=-1; - char oname[NC_MAX_NAME + 1]; - NC_GRP_INFO_T *child_grp; - NC_GRP_INFO_T *grp = (NC_GRP_INFO_T *) (_op_data); -#if 0 - NC_HDF5_FILE_INFO_T *h5 = grp->file->nc4_info; -#endif - - memset(oname, 0, NC_MAX_NAME); - /* Open this critter. */ - if ((oid = H5Oopen(grpid, name, H5P_DEFAULT)) < 0) - return H5_ITER_ERROR; - - if ((otype = H5Iget_type( oid ))<0) { - H5Oclose(oid); - return H5_ITER_ERROR; - } - H5Oclose(oid); - - strncpy(oname, name, NC_MAX_NAME); - - /* Deal with datasets. */ - switch(otype) - { - case H5I_GROUP: - LOG((3, "re-encountering group %s", oname)); - - /* The NC_GROUP_INFO_T for this group already exists. Find it. */ - for (child_grp = grp->children; child_grp; child_grp = child_grp->next) - if (!strcmp(child_grp->name, oname)) - break; - if (!child_grp) - return H5_ITER_ERROR; - - /* Recursively read the child group's vars. */ - if (nc4_rec_read_vars(child_grp)) - return H5_ITER_ERROR; - break; - case H5I_DATASET: - LOG((3, "found dataset %s", oname)); - - /* Learn all about this dataset, which may be a dimscale - * (i.e. dimension metadata), or real data. */ - if (read_dataset(grp, oname)) - return H5_ITER_ERROR; - break; - case H5I_DATATYPE: - LOG((3, "already handled type %s", oname)); - break; - default: - LOG((0, "Unknown object class %d in nc4_rec_read_vars!", otype)); - } - return (H5_ITER_CONT); -} - -static int -nc4_rec_read_vars(NC_GRP_INFO_T *grp) -{ - hsize_t idx = 0; - int retval = NC_NOERR; - int res = 0; - hid_t pid = 0; - unsigned crt_order_flags = 0; - NC_HDF5_FILE_INFO_T *h5 = grp->file->nc4_info; - - assert(grp && grp->name && grp->hdf_grpid > 0); - LOG((3, "nc4_rec_read_vars: grp->name %s", grp->name)); - - pid = H5Gget_create_plist(grp->hdf_grpid); - H5Pget_link_creation_order(pid, &crt_order_flags); - H5Pclose(pid); - - crt_order_flags = crt_order_flags & H5_INDEX_CRT_ORDER; - - if (crt_order_flags == H5_INDEX_CRT_ORDER) - { - res = H5Literate(grp->hdf_grpid, H5_INDEX_CRT_ORDER, H5_ITER_INC, - &idx, nc4_rec_read_vars_cb, (void *)grp); - } else - { - /* Without creation ordering, file must be read-only. */ - if (!idx && !h5->no_write) - return NC_ECANTWRITE; - - res = H5Literate(grp->hdf_grpid, H5_INDEX_NAME, H5_ITER_INC, - &idx, nc4_rec_read_vars_cb, (void *)grp); - } - if (res<0) - return NC_EHDFERR; - - /* Scan the group for global (i.e. group-level) attributes. */ - if ((retval = read_grp_atts(grp))) - return retval; - - return NC_NOERR; /* everything worked! */ -} - -#else - -/** \internal -This struct is used to pass information back from the callback -function used with H5Literate. -*/ -struct nc_hdf5_link_info -{ - char name[NC_MAX_NAME + 1]; - H5I_type_t obj_type; -}; - -/* This is a callback function for H5Literate(). - -The parameters of this callback function have the following values or -meanings: - -g_id Group that serves as root of the iteration; same value as the -H5Lvisit group_id parameter - -name Name of link, relative to g_id, being examined at current step of -the iteration - -info H5L_info_t struct containing information regarding that link - -op_data User-defined pointer to data required by the application in -processing the link; a pass-through of the op_data pointer provided -with the H5Lvisit function call - -*/ -static herr_t -visit_link(hid_t g_id, const char *name, const H5L_info_t *info, - void *op_data) -{ - /* A positive return value causes the visit iterator to immediately - * return that positive value, indicating short-circuit - * success. The iterator can be restarted at the next group - * member. */ - int ret = 1; - hid_t id; - - /* Get the name, truncating at NC_MAX_NAME. */ - strncpy(((struct nc_hdf5_link_info *)op_data)->name, name, - NC_MAX_NAME); - - /* Open this critter. */ - if ((id = H5Oopen_by_addr(g_id, info->u.address)) < 0) - return NC_EHDFERR; - - /* Is this critter a group, type, data, attribute, or what? */ - if ((((struct nc_hdf5_link_info *)op_data)->obj_type = H5Iget_type(id)) < 0) - ret = NC_EHDFERR; - - /* Close the critter to release resouces. */ - if (H5Oclose(id) < 0) - return NC_EHDFERR; - - return ret; -} - -/* Iterate over one link in the group at a time, returning - * link_info. The creation_ordering and idx pointers keep track of - * whether creation ordering works and the most recently examined - * link. */ -static int -nc4_iterate_link(int *ordering_checked, int *creation_ordering, - hid_t grpid, hsize_t *idx, struct nc_hdf5_link_info *link_info) -{ - int res = 0; - - if (*creation_ordering) - { - /* These HDF5 macros prevent an HDF5 error message when a - * non-creation-ordered HDF5 file is opened. */ - H5E_BEGIN_TRY { - res = H5Literate(grpid, H5_INDEX_CRT_ORDER, H5_ITER_INC, - idx, visit_link, (void *)link_info); - if (res < 0 && *ordering_checked) - return NC_EHDFERR; - } H5E_END_TRY; - } - - if (!*creation_ordering || res < 0) - { - if (H5Literate(grpid, H5_INDEX_NAME, H5_ITER_INC, idx, - visit_link, link_info) != 1) - return NC_EHDFERR; - /* If it didn't work with creation ordering, but did without, - * then we don't have creation ordering. */ - *creation_ordering = 0; - } - - *ordering_checked = 1; - return NC_NOERR; -} - -/* Recursively open groups and read types. */ -int -nc4_rec_read_types(NC_GRP_INFO_T *grp) -{ - hsize_t num_obj, i; - NC_HDF5_FILE_INFO_T *h5 = grp->file->nc4_info; - NC_GRP_INFO_T *child_grp; - hsize_t idx = 0; - struct nc_hdf5_link_info link_info; - int ordering_checked = 0; - int creation_ordering = 1; /* Assume we have it. */ - int retval = NC_NOERR; - - assert(grp && grp->name); - LOG((3, "nc4_rec_read_types: grp->name %s", grp->name)); - - /* Open this HDF5 group and retain its grpid. It will remain open - * with HDF5 until this file is nc_closed. */ - if (!grp->hdf_grpid) - { - if (grp->parent) - { - if ((grp->hdf_grpid = H5Gopen2(grp->parent->hdf_grpid, - grp->name, H5P_DEFAULT)) < 0) - return NC_EHDFERR; - } - else - { - if ((grp->hdf_grpid = H5Gopen2(grp->file->nc4_info->hdfid, - "/", H5P_DEFAULT)) < 0) - return NC_EHDFERR; - } - } - assert(grp->hdf_grpid > 0); - - /* How many objects in this group? */ - if (H5Gget_num_objs(grp->hdf_grpid, &num_obj) < 0) - return NC_EVARMETA; - - /* For each object in the group... */ - for (i = 0; i < num_obj; i++) - { - if ((retval = nc4_iterate_link(&ordering_checked, &creation_ordering, - grp->hdf_grpid, &idx, &link_info))) - return retval; - - /* Without creation ordering, file must be read-only. */ - if (!i && !creation_ordering && !h5->no_write) - return NC_ECANTWRITE; - - /* Deal with groups and types; ignore the rest. */ - if (link_info.obj_type == H5I_GROUP) - { - LOG((3, "found group %s", link_info.name)); - if ((retval = nc4_grp_list_add(&(grp->children), h5->next_nc_grpid++, - grp, grp->file, link_info.name, &child_grp))) - return retval; - if ((retval = nc4_rec_read_types(child_grp))) - return retval; - } - else if (link_info.obj_type == H5I_DATATYPE) - { - LOG((3, "found datatype %s", link_info.name)); - if ((retval = read_type(grp, link_info.name))) - return retval; - } - } - - return NC_NOERR; /* everything worked! */ -} - -/* This function recursively reads all the var and attribute metadata - in a HDF5 group, and creates and fills in the netCDF-4 global - metadata structure. */ -int -nc4_rec_read_vars(NC_GRP_INFO_T *grp) -{ - hsize_t num_obj, i; - NC_GRP_INFO_T *child_grp; - struct nc_hdf5_link_info link_info; - hsize_t idx = 0; - int ordering_checked = 0; - int creation_ordering = 1; /* Assume we have it. */ - int retval = NC_NOERR; - - assert(grp && grp->name && grp->hdf_grpid > 0); - LOG((3, "nc4_rec_read_vars: grp->name %s", grp->name)); - - /* How many objects in this group? */ - if (H5Gget_num_objs(grp->hdf_grpid, &num_obj) < 0) - return NC_EVARMETA; - - /* For each object in the group... */ - for (i = 0; i < num_obj; i++) - { - if ((retval = nc4_iterate_link(&ordering_checked, &creation_ordering, - grp->hdf_grpid, &idx, &link_info))) - return retval; - - /* Deal with datasets. */ - switch(link_info.obj_type) - { - case H5I_GROUP: - LOG((3, "re-encountering group %s", link_info.name)); - - /* The NC_GROUP_INFO_T for this group already exists. Find it. */ - for (child_grp = grp->children; child_grp; child_grp = child_grp->next) - if (!strcmp(child_grp->name, link_info.name)) - break; - if (!child_grp) - return NC_EHDFERR; - - /* Recursively read the child group's vars. */ - if ((retval = nc4_rec_read_vars(child_grp))) - return retval; - break; - case H5I_DATASET: - LOG((3, "found dataset %s", link_info.name)); - - /* Learn all about this dataset, which may be a dimscale - * (i.e. dimension metadata), or real data. */ - if ((retval = read_dataset(grp, link_info.name))) - return retval; - break; - case H5I_DATATYPE: - LOG((3, "already handled type %s", link_info.name)); - break; - default: - LOG((0, "Unknown object class %d in nc4_rec_read_vars!", - link_info.obj_type)); - } - } - - /* Scan the group for global (i.e. group-level) attributes. */ - if ((retval = read_grp_atts(grp))) - return retval; - - return NC_NOERR; /* everything worked! */ -} -#endif - -/* Open a netcdf-4 file. Things have already been kicked off in - * ncfunc.c in nc_open, but here the netCDF-4 part of opening a file - * is handled. */ -static int -nc4_open_file(const char *path, int mode, MPI_Comm comm, - MPI_Info info, NC_FILE_INFO_T *nc) -{ - hid_t fapl_id = H5P_DEFAULT; - unsigned flags = (mode & NC_WRITE) ? - H5F_ACC_RDWR : H5F_ACC_RDONLY; - int retval; - - LOG((3, "nc4_open_file: path %s mode %d", path, mode)); - assert(path && nc); - - /* Stop diskless open in its tracks */ - if(mode & NC_DISKLESS) - return NC_EDISKLESS; - - /* Add necessary structs to hold netcdf-4 file data. */ - if ((retval = nc4_nc4f_list_add(nc, path, mode))) - BAIL(retval); - assert(nc->nc4_info && nc->nc4_info->root_grp); - - /* Need this access plist to control how HDF5 handles open onjects - * on file close. (Setting H5F_CLOSE_SEMI will cause H5Fclose to - * fail if there are any open objects in the file. */ - if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) - BAIL(NC_EHDFERR); -#ifdef EXTRA_TESTS - num_plists++; -#endif -#ifdef EXTRA_TESTS - if (H5Pset_fclose_degree(fapl_id, H5F_CLOSE_SEMI)) - BAIL(NC_EHDFERR); -#else - if (H5Pset_fclose_degree(fapl_id, H5F_CLOSE_STRONG)) - BAIL(NC_EHDFERR); -#endif - -#ifdef USE_PARALLEL - /* If this is a parallel file create, set up the file creation - property list. */ - if (mode & NC_MPIIO || mode & NC_MPIPOSIX) - { - nc->nc4_info->parallel++; - if (mode & NC_MPIIO) /* MPI/IO */ - { - LOG((4, "opening parallel file with MPI/IO")); - if (H5Pset_fapl_mpio(fapl_id, comm, info) < 0) - BAIL(NC_EPARINIT); - } - else /* MPI/POSIX */ - { - LOG((4, "opening parallel file with MPI/posix")); - if (H5Pset_fapl_mpiposix(fapl_id, comm, 0) < 0) - BAIL(NC_EPARINIT); - } - } -#else /* only set cache for non-parallel. */ - if (H5Pset_cache(fapl_id, 0, nc4_chunk_cache_nelems, nc4_chunk_cache_size, - nc4_chunk_cache_preemption) < 0) - BAIL(NC_EHDFERR); - LOG((4, "nc4_open_file: set HDF raw chunk cache to size %d nelems %d preemption %f", - nc4_chunk_cache_size, nc4_chunk_cache_nelems, nc4_chunk_cache_preemption)); -#endif /* USE_PARALLEL */ - - /* The NetCDF-3.x prototype contains an mode option NC_SHARE for - multiple processes accessing the dataset concurrently. As there - is no HDF5 equivalent, NC_SHARE is treated as NC_NOWRITE. */ - if ((nc->nc4_info->hdfid = H5Fopen(path, flags, fapl_id)) < 0) - BAIL(NC_EHDFERR); - - /* Does the mode specify that this file is read-only? */ - if ((mode & NC_WRITE) == 0) - nc->nc4_info->no_write++; - - /* Now read in all the metadata. Some types and dimscale - * information may be difficult to resolve here, if, for example, a - * dataset of user-defined type is encountered before the - * definition of that type. */ - if ((retval = nc4_rec_read_types(nc->nc4_info->root_grp))) - BAIL(retval); - if ((retval = nc4_rec_read_vars(nc->nc4_info->root_grp))) - BAIL(retval); - - /* Now figure out which netCDF dims are indicated by the dimscale - * information. */ - if ((retval = nc4_rec_match_dimscales(nc->nc4_info->root_grp))) - BAIL(retval); - -#ifdef LOGGING - /* This will print out the names, types, lens, etc of the vars and - atts in the file, if the logging level is 2 or greater. */ - log_metadata_nc(nc); -#endif - - /* Close the property list. */ - if (H5Pclose(fapl_id) < 0) - BAIL(NC_EHDFERR); -#ifdef EXTRA_TESTS - num_plists--; -#endif - - return NC_NOERR; - - exit: - if (fapl_id != H5P_DEFAULT) H5Pclose(fapl_id); -#ifdef EXTRA_TESTS - num_plists--; -#endif - if (nc->nc4_info->hdfid > 0) H5Fclose(nc->nc4_info->hdfid); - if (nc->nc4_info) free(nc->nc4_info); - return retval; -} - -/* Given an HDF4 type, set a pointer to netcdf type. */ -#ifdef USE_HDF4 -static int -get_netcdf_type_from_hdf4(NC_HDF5_FILE_INFO_T *h5, int32 hdf4_typeid, - nc_type *xtype, NC_TYPE_INFO_T *type_info) -{ - int t; - assert(h5 && xtype); - - switch(hdf4_typeid) - { - case DFNT_CHAR: - *xtype = NC_CHAR; - t = 0; - break; - case DFNT_UCHAR: - case DFNT_UINT8: - *xtype = NC_UBYTE; - t = 6; - break; - case DFNT_INT8: - *xtype = NC_BYTE; - t = 1; - break; - case DFNT_INT16: - *xtype = NC_SHORT; - t = 2; - break; - case DFNT_UINT16: - *xtype = NC_USHORT; - t = 7; - break; - case DFNT_INT32: - *xtype = NC_INT; - t = 3; - break; - case DFNT_UINT32: - *xtype = NC_UINT; - t = 8; - break; - case DFNT_FLOAT32: - *xtype = NC_FLOAT; - t = 4; - break; - case DFNT_FLOAT64: - *xtype = NC_DOUBLE; - t = 5; - break; - default: - *xtype = NC_NAT; - return NC_EBADTYPID; - } - - if (type_info) - { - if (hdf4_typeid == DFNT_FLOAT32 || hdf4_typeid == DFNT_FLOAT64) - type_info->class = H5T_FLOAT; - else if (hdf4_typeid == DFNT_CHAR) - type_info->class = H5T_STRING; - else - type_info->class = H5T_INTEGER; - type_info->endianness = NC_ENDIAN_BIG; - type_info->nc_typeid = *xtype; - if (type_info->name) - free(type_info->name); - if (!(type_info->name = malloc((strlen(nc_type_name[t]) + 1) * sizeof(char)))) - return NC_ENOMEM; - strcpy(type_info->name, nc_type_name[t]); - } - - return NC_NOERR; -} -#endif /* USE_HDF4 */ - -/* Open a HDF4 file. Things have already been kicked off in nc_open, - * but here the netCDF-4 part of opening a file is handled. */ -static int -nc4_open_hdf4_file(const char *path, int mode, NC_FILE_INFO_T *nc) -{ -#ifdef USE_HDF4 - NC_HDF5_FILE_INFO_T *h5; - NC_GRP_INFO_T *grp; - NC_ATT_INFO_T *att; - NC_VAR_INFO_T *var; - int32 num_datasets, num_gatts; - int32 rank; - int v, d, a; - int retval; - - LOG((3, "nc4_open_hdf4_file: path %s mode %d", path, mode)); - assert(path && nc); - - /* Must be read-only access to hdf4 files. */ - if (mode & NC_WRITE) - return NC_EINVAL; - - /* Add necessary structs to hold netcdf-4 file data. */ - if ((retval = nc4_nc4f_list_add(nc, path, mode))) - return retval; - assert(nc->nc4_info && nc->nc4_info->root_grp); - h5 = nc->nc4_info; - h5->hdf4++; - grp = h5->root_grp; - h5->no_write++; - - /* Open the file and initialize SD interface. */ - if ((h5->sdid = SDstart(path, DFACC_READ)) == FAIL) - return NC_EHDFERR; - - /* Learn how many datasets and global atts we have. */ - if (SDfileinfo(h5->sdid, &num_datasets, &num_gatts)) - return NC_EHDFERR; - - /* Read the atts. */ - for (a = 0; a < num_gatts; a++) - { - int32 att_data_type, att_count; - size_t att_type_size; - - /* Add to the end of the list of atts for this var. */ - if ((retval = nc4_att_list_add(&h5->root_grp->att))) - return retval; - for (att = h5->root_grp->att; att->next; att = att->next) - ; - att->attnum = grp->natts++; - att->created++; - - /* Learn about this attribute. */ - if (!(att->name = malloc(NC_MAX_HDF4_NAME * sizeof(char)))) - return NC_ENOMEM; - if (SDattrinfo(h5->sdid, a, att->name, &att_data_type, &att_count)) - return NC_EATTMETA; - if ((retval = get_netcdf_type_from_hdf4(h5, att_data_type, - &att->xtype, NULL))) - return retval; - att->len = att_count; - - /* Allocate memory to hold the data. */ - if ((retval = nc4_get_typelen_mem(h5, att->xtype, 0, &att_type_size))) - return retval; - if (!(att->data = malloc(att_type_size * att->len))) - return NC_ENOMEM; - - /* Read the data. */ - if (SDreadattr(h5->sdid, a, att->data)) - return NC_EHDFERR; - } - - /* Read each dataset. */ - for (v = 0; v < num_datasets; v++) - { - int32 data_type, num_atts; - int32 dimsize[NC_MAX_DIMS]; - size_t var_type_size; - int a; - - /* Add a variable to the end of the group's var list. */ - if ((retval = nc4_var_list_add(&grp->var, &var))) - return retval; - var->varid = grp->nvars++; - var->created = 1; - var->written_to = 1; - - /* Open this dataset in HDF4 file. */ - if ((var->sdsid = SDselect(h5->sdid, v)) == FAIL) - return NC_EVARMETA; - - /* Get shape, name, type, and attribute info about this dataset. */ - if (!(var->name = malloc(NC_MAX_HDF4_NAME + 1))) - return NC_ENOMEM; - if (SDgetinfo(var->sdsid, var->name, &rank, dimsize, &data_type, &num_atts)) - return NC_EVARMETA; - var->ndims = rank; - var->hdf4_data_type = data_type; - - /* Fill special type_info struct for variable type information. */ - if (!(var->type_info = calloc(1, sizeof(NC_TYPE_INFO_T)))) - return NC_ENOMEM; - if ((retval = get_netcdf_type_from_hdf4(h5, data_type, &var->xtype, var->type_info))) - return retval; - if ((retval = nc4_get_typelen_mem(h5, var->xtype, 0, &var_type_size))) - return retval; - var->type_info->size = var_type_size; - LOG((3, "reading HDF4 dataset %s, rank %d netCDF type %d", var->name, - rank, var->xtype)); - - /* Get the fill value. */ - if (!(var->fill_value = malloc(var_type_size))) - return NC_ENOMEM; - if (SDgetfillvalue(var->sdsid, var->fill_value)) - { - /* Whoops! No fill value! */ - free(var->fill_value); - var->fill_value = NULL; - } - - /* Allocate storage for dimension info in this variable. */ - if (var->ndims) - { - if (!(var->dim = malloc(sizeof(NC_DIM_INFO_T *) * var->ndims))) - return NC_ENOMEM; - if (!(var->dimids = malloc(sizeof(int) * var->ndims))) - return NC_ENOMEM; - } - - /* Find its dimensions. */ - for (d = 0; d < var->ndims; d++) - { - int32 dimid, dim_len, dim_data_type, dim_num_attrs; - char dim_name[NC_MAX_NAME + 1]; - NC_DIM_INFO_T *dim; - - if ((dimid = SDgetdimid(var->sdsid, d)) == FAIL) - return NC_EDIMMETA; - if (SDdiminfo(dimid, dim_name, &dim_len, &dim_data_type, - &dim_num_attrs)) - return NC_EDIMMETA; - - /* Do we already have this dimension? HDF4 explicitly uses - * the name to tell. */ - for (dim = grp->dim; dim; dim = dim->next) - if (!strcmp(dim->name, dim_name)) - break; - - /* If we didn't find this dimension, add one. */ - if (!dim) - { - LOG((4, "adding dimension %s for HDF4 dataset %s", - dim_name, var->name)); - if ((retval = nc4_dim_list_add(&grp->dim))) - return retval; - grp->ndims++; - dim = grp->dim; - dim->dimid = grp->file->nc4_info->next_dimid++; - if (strlen(dim_name) > NC_MAX_HDF4_NAME) - return NC_EMAXNAME; - if (!(dim->name = malloc(NC_MAX_HDF4_NAME + 1))) - return NC_ENOMEM; - strcpy(dim->name, dim_name); - if (dim_len) - dim->len = dim_len; - else - dim->len = *dimsize; - } - - /* Tell the variable the id of this dimension. */ - var->dimids[d] = dim->dimid; - } - - /* Read the atts. */ - for (a = 0; a < num_atts; a++) - { - int32 att_data_type, att_count; - size_t att_type_size; - - /* Add to the end of the list of atts for this var. */ - if ((retval = nc4_att_list_add(&var->att))) - return retval; - for (att = var->att; att->next; att = att->next) - ; - att->attnum = var->natts++; - att->created++; - - /* Learn about this attribute. */ - if (!(att->name = malloc(NC_MAX_HDF4_NAME * sizeof(char)))) - return NC_ENOMEM; - if (SDattrinfo(var->sdsid, a, att->name, &att_data_type, &att_count)) - return NC_EATTMETA; - if ((retval = get_netcdf_type_from_hdf4(h5, att_data_type, - &att->xtype, NULL))) - return retval; - att->len = att_count; - - /* Allocate memory to hold the data. */ - if ((retval = nc4_get_typelen_mem(h5, att->xtype, 0, &att_type_size))) - return retval; - if (!(att->data = malloc(att_type_size * att->len))) - return NC_ENOMEM; - - /* Read the data. */ - if (SDreadattr(var->sdsid, a, att->data)) - return NC_EHDFERR; - } - } /* next var */ - -#ifdef LOGGING - /* This will print out the names, types, lens, etc of the vars and - atts in the file, if the logging level is 2 or greater. */ - log_metadata_nc(h5->root_grp->file); -#endif - return NC_NOERR; -#endif /* USE_HDF4 */ - return NC_ENOTBUILT; -} - -int -NC4_open(const char *path, int mode, int basepe, size_t *chunksizehintp, - int use_parallel, void *mpidata, NC_Dispatch *dispatch, NC **ncpp) -{ - int hdf_file = 0; - NC_FILE_INFO_T *nc_file; -#ifdef USE_PARALLEL - MPI_Comm comm = 0; - MPI_Info info = 0; -#else - int comm = 0, info = 0; -#endif /* USE_PARALLEL */ - int res; - - assert(ncpp && path); - - LOG((1, "nc_open_file: path %s mode %d comm %d info %d", - path, mode, comm, info)); - -#ifdef USE_PARALLEL - if (mpidata) - { - NC_MPI_INFO *nmi = (NC_MPI_INFO *)mpidata; - comm = nmi->comm; info = nmi->info; - } -#endif /* USE_PARALLEL */ - - /* If this is our first file, turn off HDF5 error messages. */ - if (virgin) - { - if (H5Eset_auto(NULL, NULL) < 0) - LOG((0, "Couldn't turn off HDF5 error messages!")); - LOG((1, "HDF5 error messages turned off!")); - virgin = 0; - } - - /* Check the mode for validity. First make sure only certain bits - * are turned on. Also MPI I/O and MPI POSIX cannot both be - * selected at once. */ - if (mode & ~(NC_WRITE | NC_SHARE | NC_MPIIO | NC_MPIPOSIX | - NC_PNETCDF | NC_NOCLOBBER | NC_NETCDF4 | NC_CLASSIC_MODEL) || - (mode & NC_MPIIO && mode & NC_MPIPOSIX)) - return NC_EINVAL; - - /* Figure out if this is a hdf4 or hdf5 file. */ - if ((res = nc_check_for_hdf(path, use_parallel, comm, info, &hdf_file))) - return res; - - /* Allocate the storage for this file info struct, and fill it with - zeros. */ - if ((res = nc4_file_list_add(&nc_file,dispatch))) - return res; - - /* Depending on the type of file, open it. */ - if (hdf_file == NC_HDF5_FILE) - { - nc_file->int_ncid = nc_file->ext_ncid; - res = nc4_open_file(path, mode, comm, info, nc_file); - } - else if (hdf_file == NC_HDF4_FILE) - { - nc_file->int_ncid = nc_file->ext_ncid; - res = nc4_open_hdf4_file(path, mode, nc_file); - } -#ifdef USE_PNETCDF - else if (mode & NC_PNETCDF) - { - int pnetcdf_nvars, i; - - res = ncmpi_open(comm, path, mode, info, &(nc_file->int_ncid)); - nc_file->pnetcdf_file++; - - /* Default to independent access, like netCDF-4/HDF5 files. */ - if (!res) - res = ncmpi_begin_indep_data(nc_file->int_ncid); - - /* I need to keep track of the ndims of each var to translate - * start, count, and stride arrays to MPI_Offset type. */ - if (!res) - { - res = ncmpi_inq_nvars(nc_file->int_ncid, &pnetcdf_nvars); - for (i = 0; i < pnetcdf_nvars; i++) - res = ncmpi_inq_varndims(nc_file->int_ncid, i, - &(nc_file->pnetcdf_ndims[i])); - - } - } -#endif /* USE_PNETCDF */ - else /* netcdf */ - { - assert(0); - } - - /* If it succeeds, pass back the new ncid. Otherwise, remove this - file from the list. */ - if (res) - { - if(nc_file != NULL) nc4_file_list_del(nc_file); - } - else - { - *ncpp = (NC*)nc_file; - } - - return res; -} - -/* Unfortunately HDF only allows specification of fill value only when - a dataset is created. Whereas in netcdf, you first create the - variable and then (optionally) specify the fill value. To - accomplish this in HDF5 I have to delete the dataset, and recreate - it, with the fill value specified. */ -int -NC4_set_fill(int ncid, int fillmode, int *old_modep) -{ - NC_FILE_INFO_T *nc; - - LOG((2, "nc_set_fill: ncid 0x%x fillmode %d", ncid, fillmode)); - - if (!(nc = nc4_find_nc_file(ncid))) - return NC_EBADID; - - /* Is this a netcdf-3 file? */ - assert(nc->nc4_info); - - /* Trying to set fill on a read-only file? You sicken me! */ - if (nc->nc4_info->no_write) - return NC_EPERM; - - /* Did you pass me some weird fillmode? */ - if (fillmode != NC_FILL && fillmode != NC_NOFILL) - return NC_EINVAL; - - /* If the user wants to know, tell him what the old mode was. */ - if (old_modep) - *old_modep = nc->nc4_info->fill_mode; - - nc->nc4_info->fill_mode = fillmode; - - return NC_NOERR; -} - -/* Put the file back in redef mode. This is done automatically for - * netcdf-4 files, if the user forgets. */ -int -NC4_redef(int ncid) -{ - NC_FILE_INFO_T *nc; - - LOG((1, "nc_redef: ncid 0x%x", ncid)); - - /* Find this file's metadata. */ - if (!(nc = nc4_find_nc_file(ncid))) - return NC_EBADID; - -#ifdef USE_PNETCDF - /* Take care of files created/opened with parallel-netcdf library. */ - if (nc->pnetcdf_file) - return ncmpi_redef(nc->int_ncid); -#endif /* USE_PNETCDF */ - - /* Handle netcdf-3 files. */ - assert(nc->nc4_info); - - /* If we're already in define mode, return an error. */ - if (nc->nc4_info->flags & NC_INDEF) - return NC_EINDEFINE; - - /* If the file is read-only, return an error. */ - if (nc->nc4_info->no_write) - return NC_EPERM; - - /* Set define mode. */ - nc->nc4_info->flags |= NC_INDEF; - - /* For nc_abort, we need to remember if we're in define mode as a - redef. */ - nc->nc4_info->redef++; - - return NC_NOERR; -} - -/* For netcdf-4 files, this just calls nc_enddef, ignoring the extra - * parameters. */ -int -NC4__enddef(int ncid, size_t h_minfree, size_t v_align, - size_t v_minfree, size_t r_align) -{ - if (!nc4_find_nc_file(ncid)) - return NC_EBADID; - - return NC4_enddef(ncid); -} - -/* Take the file out of define mode. This is called automatically for - * netcdf-4 files, if the user forgets. */ -static int NC4_enddef(int ncid) -{ - NC_FILE_INFO_T *nc; - - LOG((1, "nc_enddef: ncid 0x%x", ncid)); - - if (!(nc = nc4_find_nc_file(ncid))) - return NC_EBADID; - -#ifdef USE_PNETCDF - if (nc->pnetcdf_file) - { - int res; - res = ncmpi_enddef(nc->int_ncid); - if (!res) - { - if (nc->pnetcdf_access_mode == NC_INDEPENDENT) - res = ncmpi_begin_indep_data(nc->int_ncid); - } - return res; - } -#endif /* USE_PNETCDF */ - - /* Take care of netcdf-3 files. */ - assert(nc->nc4_info); - - return nc4_enddef_netcdf4_file(nc->nc4_info); -} - -/* This function will write all changed metadata, and (someday) reread - * all metadata from the file. */ -static int -sync_netcdf4_file(NC_HDF5_FILE_INFO_T *h5) -{ - int retval; - - assert(h5); - LOG((3, "sync_netcdf4_file")); - - /* If we're in define mode, that's an error, for strict nc3 rules, - * otherwise, end define mode. */ - if (h5->flags & NC_INDEF) - { - if (h5->cmode & NC_CLASSIC_MODEL) - return NC_EINDEFINE; - - /* Turn define mode off. */ - h5->flags ^= NC_INDEF; - - /* Redef mode needs to be tracked seperately for nc_abort. */ - h5->redef = 0; - } - -#ifdef LOGGING - /* This will print out the names, types, lens, etc of the vars and - atts in the file, if the logging level is 2 or greater. */ - log_metadata_nc(h5->root_grp->file); -#endif - - /* Write any metadata that has changed. */ - if (!(h5->cmode & NC_NOWRITE)) - { - if ((retval = nc4_rec_write_types(h5->root_grp))) - return retval; - if ((retval = nc4_rec_write_metadata(h5->root_grp))) - return retval; - } - - H5Fflush(h5->hdfid, H5F_SCOPE_GLOBAL); - - /* Reread all the metadata. */ - /*if ((retval = nc4_rec_read_metadata(grp))) - return retval;*/ - - return retval; -} - -/* Flushes all buffers associated with the file, after writing all - changed metadata. This may only be called in data mode. */ -int -NC4_sync(int ncid) -{ - NC_FILE_INFO_T *nc; - int retval; - - LOG((2, "nc_sync: ncid 0x%x", ncid)); - - if (!(nc = nc4_find_nc_file(ncid))) - return NC_EBADID; - -#ifdef USE_PNETCDF - /* Take care of files created/opened with parallel-netcdf library. */ - if (nc->pnetcdf_file) - return ncmpi_sync(nc->int_ncid); -#endif /* USE_PNETCDF */ - - /* Take care of netcdf-3 files. */ - assert(nc->nc4_info); - - /* If we're in define mode, we can't sync. */ - if (nc->nc4_info && nc->nc4_info->flags & NC_INDEF) - { - if (nc->nc4_info->cmode & NC_CLASSIC_MODEL) - return NC_EINDEFINE; - if ((retval = nc_enddef(ncid))) - return retval; - } - - return sync_netcdf4_file(nc->nc4_info); -} - -/* This function will free all allocated metadata memory, and close - the HDF5 file. The group that is passed in must be the root group - of the file. */ -static int -close_netcdf4_file(NC_HDF5_FILE_INFO_T *h5, int abort) -{ - int retval; - - assert(h5 && h5->root_grp); - LOG((3, "close_netcdf4_file: h5->path %s abort %d", - h5->path, abort)); - - /* According to the docs, always end define mode on close. */ - if (h5->flags & NC_INDEF) - h5->flags ^= NC_INDEF; - - /* Sync the file, unless we're aborting, or this is a read-only - * file. */ - if (!h5->no_write && !abort) - if ((retval = sync_netcdf4_file(h5))) - return retval; - - /* Delete all the list contents for vars, dims, and atts, in each - * group. */ - if ((retval = nc4_rec_grp_del(&h5->root_grp, h5->root_grp))) - return retval; - - /* Close hdf file. */ - if (h5->hdf4) - { -#ifdef USE_HDF4 - if (SDend(h5->sdid)) - return NC_EHDFERR; -#endif /* USE_HDF4 */ - } - else - { - if (H5Fclose(h5->hdfid) < 0) - { - int nobjs; - nobjs = H5Fget_obj_count(h5->hdfid, H5F_OBJ_ALL); - /* Apparently we can get an error even when nobjs == 0 */ - if(nobjs < 0) { - return NC_EHDFERR; - } else if(nobjs > 0) { -#ifdef LOGGING - /* If the close doesn't work, probably there are still some HDF5 - * objects open, which means there's a bug in the library. So - * print out some info on to help the poor programmer figure it - * out. */ - LOG((0, "There are %d HDF5 objects open!", nobjs)); -#endif - return NC_EHDFERR; - } - } -/* if (H5garbage_collect() < 0) - return NC_EHDFERR; */ - } - - /* Delete the memory for the path, if it's been allocated. */ - if (h5->path) - free(h5->path); - - /* Free the nc4_info struct. */ - free(h5); - return NC_NOERR; -} - -/* From the netcdf-3 docs: The function nc_abort just closes the - netCDF dataset, if not in define mode. If the dataset is being - created and is still in define mode, the dataset is deleted. If - define mode was entered by a call to nc_redef, the netCDF dataset - is restored to its state before definition mode was entered and the - dataset is closed. */ -int -NC4_abort(int ncid) -{ - NC_FILE_INFO_T *nc; - int delete_file = 0; - char path[NC_MAX_NAME + 1]; - int retval = NC_NOERR; - - LOG((2, "nc_abort: ncid 0x%x", ncid)); - - /* Find metadata for this file. */ - if (!(nc = nc4_find_nc_file(ncid))) - return NC_EBADID; - -#ifdef USE_PNETCDF - /* Take care of files created/opened with parallel-netcdf library. */ - if (nc->pnetcdf_file) - return ncmpi_abort(nc->int_ncid); -#endif /* USE_PNETCDF */ - - /* If this is a netcdf-3 file, let the netcdf-3 library handle it. */ - assert(nc->nc4_info); - - /* If we're in define mode, but not redefing the file, delete it. */ - if (nc->nc4_info->flags & NC_INDEF && !nc->nc4_info->redef) - { - delete_file++; - strcpy(path, nc->nc4_info->path); - /*strcpy(path, nc->path);*/ - } - - /* Free any resources the netcdf-4 library has for this file's - * metadata. */ - if ((retval = close_netcdf4_file(nc->nc4_info, 1))) - return retval; - - /* Delete the file, if we should. */ - if (delete_file) - remove(path); - - /* Delete this entry from our list of open files. */ - nc4_file_list_del(nc); - - return retval; -} - -/* Close the netcdf file, writing any changes first. */ -int -NC4_close(int ncid) -{ - NC_GRP_INFO_T *grp; - NC_FILE_INFO_T *nc; - NC_HDF5_FILE_INFO_T *h5; - int retval; - - LOG((1, "nc_close: ncid 0x%x", ncid)); - - /* Find our metadata for this file. */ - if ((retval = nc4_find_nc_grp_h5(ncid, &nc, &grp, &h5))) - return retval; - -#ifdef USE_PNETCDF - /* Take care of files created/opened with parallel-netcdf library. */ - if (nc->pnetcdf_file) - return ncmpi_close(nc->int_ncid); -#endif /* USE_PNETCDF */ - - assert(h5 && nc); - - /* This must be the root group. */ - if (grp->parent) - return NC_EBADGRPID; - - /* Call the nc4 close. */ - if ((retval = close_netcdf4_file(grp->file->nc4_info, 0))) - return retval; - - /* Delete this entry from our list of open files. */ - if (nc->path) - free(nc->path); - nc4_file_list_del(nc); - - /* Reset the ncid numbers if there are no more files open. */ - if(count_NCList() == 0) - nc4_file_list_free(); - - return NC_NOERR; -} - -/* It's possible for any of these pointers to be NULL, in which case - don't try to figure out that value. */ -int -NC4_inq(int ncid, int *ndimsp, int *nvarsp, int *nattsp, int *unlimdimidp) -{ - NC_FILE_INFO_T *nc; - NC_HDF5_FILE_INFO_T *h5; - NC_GRP_INFO_T *grp; - NC_DIM_INFO_T *dim; - NC_ATT_INFO_T *att; - NC_VAR_INFO_T *var; - int retval; - - LOG((2, "nc_inq: ncid 0x%x", ncid)); - - /* Find file metadata. */ - if ((retval = nc4_find_nc_grp_h5(ncid, &nc, &grp, &h5))) - return retval; - -#ifdef USE_PNETCDF - /* Take care of files created/opened with parallel-netcdf library. */ - if (nc->pnetcdf_file) - return ncmpi_inq(nc->int_ncid, ndimsp, nvarsp, nattsp, unlimdimidp); -#endif /* USE_PNETCDF */ - - /* Netcdf-3 files are already taken care of. */ - assert(h5 && grp && nc); - - /* Count the number of dims, vars, and global atts. */ - if (ndimsp) - { - *ndimsp = 0; - for (dim = grp->dim; dim; dim = dim->next) - (*ndimsp)++; - } - if (nvarsp) - { - *nvarsp = 0; - for (var = grp->var; var; var= var->next) - (*nvarsp)++; - } - if (nattsp) - { - *nattsp = 0; - for (att = grp->att; att; att = att->next) - (*nattsp)++; - } - - if (unlimdimidp) - { - /* Default, no unlimited dimension */ - int found = 0; - *unlimdimidp = -1; - - /* If there's more than one unlimited dim, which was not possible - with netcdf-3, then only the last unlimited one will be reported - back in xtendimp. */ - /* Note that this code is inconsistent with nc_inq_unlimid() */ - for (dim = grp->dim; dim; dim = dim->next) - if (dim->unlimited) - { - *unlimdimidp = dim->dimid; - break; - } - } - - return NC_NOERR; -} - - -/* This function will do the enddef stuff for a netcdf-4 file. */ -int -nc4_enddef_netcdf4_file(NC_HDF5_FILE_INFO_T *h5) -{ - assert(h5); - LOG((3, "nc4_enddef_netcdf4_file")); - - /* If we're not in define mode, return an error. */ - if (!(h5->flags & NC_INDEF)) - return NC_ENOTINDEFINE; - - /* Turn define mode off. */ - h5->flags ^= NC_INDEF; - - /* Redef mode needs to be tracked seperately for nc_abort. */ - h5->redef = 0; - - return sync_netcdf4_file(h5); -} - -#ifdef EXTRA_TESTS -int -nc_exit() -{ - if (num_plists || num_spaces) - return NC_EHDFERR; - - return NC_NOERR; -} -#endif /* EXTRA_TESTS */ - -#ifdef USE_PARALLEL -int -nc_use_parallel_enabled() -{ - return 0; -} -#endif /* USE_PARALLEL */ - - diff --git a/xios_2311_src/trunk/.svn/pristine/43/43df9aa83f482f43e9b56c73e6b07bc9bfba3633.svn-base b/xios_2311_src/trunk/.svn/pristine/43/43df9aa83f482f43e9b56c73e6b07bc9bfba3633.svn-base deleted file mode 100644 index 8179eee086080d3dc4e8a0704f21dc5f67b26c12..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/43/43df9aa83f482f43e9b56c73e6b07bc9bfba3633.svn-base +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -set -x - -export revision=$(svn info --show-item revision .. 2>&1) - -python config_compile.py - -ccc_msub -E "--wait" job_compile_irene.sh - -build_dir=${xios_test_suite_repository}/BUILD -mkdir -p $build_dir ; CHMOD $build_dir -mkdir -p ${build_dir}/build_${xios_machine_name} - -cp build_*.txt ${build_dir}/build_${xios_machine_name} -CHMOD -R ${build_dir}/build_${xios_machine_name} - -bash -c "python ./generate_compile.py" - diff --git a/xios_2311_src/trunk/.svn/pristine/44/445f8fced265c63391c3c3c10cdcdcbf55dcabfb.svn-base b/xios_2311_src/trunk/.svn/pristine/44/445f8fced265c63391c3c3c10cdcdcbf55dcabfb.svn-base deleted file mode 100644 index 15e9abaf877a18bb05962f0a2342733079899ba0..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/44/445f8fced265c63391c3c3c10cdcdcbf55dcabfb.svn-base +++ /dev/null @@ -1,34 +0,0 @@ -/*! - \file netCdfException.hpp - \author Ha NGUYEN - \date 08 Oct 2014 - \since 07 Oct 2014 - - \brief Exception management. - */ -#ifndef __NETCDF_EXCEPTION_HPP__ -#define __NETCDF_EXCEPTION_HPP__ - -#include -#include - -namespace xios -{ -/*! -\class CNetCdfException - This class manages exceptions risen by CNetCdfInterface -*/ -class CNetCdfException : public virtual std::exception -{ -public: - CNetCdfException(const std::string& ss) : exStr_(ss) {} - CNetCdfException(const CNetCdfException& netEx) : exStr_(netEx.exStr_) {} - ~CNetCdfException() throw() {} - const char* what() const throw() { return exStr_.c_str();} -protected: - std::string exStr_; -}; - -} - -#endif // __NETCDF_EXCEPTION_HPP__ diff --git a/xios_2311_src/trunk/.svn/pristine/44/44782703c99f8cd5ee01ae3d4740f58b09b37c02.svn-base b/xios_2311_src/trunk/.svn/pristine/44/44782703c99f8cd5ee01ae3d4740f58b09b37c02.svn-base deleted file mode 100644 index 5bd4e64e9980ff50972a8013842d461b6ba09389..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/44/44782703c99f8cd5ee01ae3d4740f58b09b37c02.svn-base +++ /dev/null @@ -1,22 +0,0 @@ -MODULE SCALAR_INTERFACE - USE, INTRINSIC :: ISO_C_BINDING - - INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99 - - SUBROUTINE cxios_scalar_handle_create(ret, idt, idt_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_scalar_handle_create - - SUBROUTINE cxios_scalar_valid_id(ret, idt, idt_size) BIND(C) - USE ISO_C_BINDING - LOGICAL (kind = C_BOOL) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_scalar_valid_id - - END INTERFACE - -END MODULE SCALAR_INTERFACE diff --git a/xios_2311_src/trunk/.svn/pristine/44/44db7a9e8567250567b1a1766f52419bbe199214.svn-base b/xios_2311_src/trunk/.svn/pristine/44/44db7a9e8567250567b1a1766f52419bbe199214.svn-base deleted file mode 100644 index 74673cf5a2c209bd222f3f88cdd979f9d1b05186..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/44/44db7a9e8567250567b1a1766f52419bbe199214.svn-base +++ /dev/null @@ -1,71 +0,0 @@ -#include "indent.hpp" -#include -#include - -using namespace std ; - -namespace xios -{ - Cindent iendl ; - Cindent ireset(0,true) ; - int Cindent::defaultIncSize=2 ; - int Cindent::index=ios::xalloc() ; - - Cindent::Cindent(int i,bool r) : offset(i), reset(r), incSize(defaultIncSize) - { } - - Cindent Cindent::operator++() - { - return Cindent(incSize) ; - } - - Cindent Cindent::operator--() - { - return Cindent(-incSize) ; - } - - Cindent Cindent::operator++(int) - { - return Cindent(incSize) ; - } - - Cindent Cindent::operator--(int) - { - return Cindent(-incSize) ; - } - - Cindent Cindent::operator+=(int i) - { - return Cindent(incSize*i) ; - } - - Cindent Cindent::operator-=(int i) - { - return Cindent(-incSize*i) ; - } - - ostream& Cindent::iendl(ostream& o) const - { - if (reset) - { - o.iword(index)=0 ; - return o ; - } - else - { - o.iword(index)+=offset ; - if (o.iword(index)<0) o.iword(index)=0 ; - o<<"\n" ; - int mem=o.width(o.iword(index)) ; - o<<""; - o.width(mem) ; - return o ; - } - } - - ostream& operator <<(ostream& o, const Cindent& indent) - { - return indent.iendl(o) ; - } - -} diff --git a/xios_2311_src/trunk/.svn/pristine/44/44e70434208fe913f5c43839d1590b4a1db6d3a3.svn-base b/xios_2311_src/trunk/.svn/pristine/44/44e70434208fe913f5c43839d1590b4a1db6d3a3.svn-base deleted file mode 100644 index 041b7bed9c55e80285e444267202085804ed380c..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/44/44e70434208fe913f5c43839d1590b4a1db6d3a3.svn-base +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef __XIOS_NETCDF_VERSION_HPP__ -#define __XIOS_NETCDF_VERSION_HPP__ - -#if defined(NC_DISKLESS) && defined (NC_MMAP) - -# define NETCDF_VERSION 4211 - -#elif defined(NC_ETRANSLATION) - -# define NETCDF_VERSION 4130 - -#elif defined(NC_EURL) && defined(NC_ECONSTRAINT) - -# define NETCDF_VERSION 4120 - -#elif defined (NC_PNETCDF) - -# define NETCDF_VERSION 4110 - -#elif defined(NC_CHUNKED) && defined(NC_CONTIGUOUS) - -# define NETCDF_VERSION 4010 - -#elif defined(NC_NETCDF4) - -# define NETCDF_VERSION 4000 - -#else - -# error "netcdf version prior 4.0 incompatible with XIOS" - -#endif - -#endif diff --git a/xios_2311_src/trunk/.svn/pristine/45/45461fc0787c76b878cddd4bd35d4d55b29fbf32.svn-base b/xios_2311_src/trunk/.svn/pristine/45/45461fc0787c76b878cddd4bd35d4d55b29fbf32.svn-base deleted file mode 100644 index 8824c1955583c357052d999b41966e0df59c03d2..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/45/45461fc0787c76b878cddd4bd35d4d55b29fbf32.svn-base +++ /dev/null @@ -1,89 +0,0 @@ -#include "xios_fortran_prefix.hpp" - -MODULE ICALENDAR_WRAPPER - USE, INTRINSIC :: ISO_C_BINDING - USE CALENDAR_WRAPPER_INTERFACE - USE IDATE - USE IDURATION - - TYPE txios(calendar_wrapper) - INTEGER(kind = C_INTPTR_T) :: daddr - END TYPE txios(calendar_wrapper) - - CONTAINS ! Fonctions disponibles pour les utilisateurs. - - SUBROUTINE xios(get_calendar_wrapper_handle)(idt, ret) - IMPLICIT NONE - CHARACTER(len = *), INTENT(IN) :: idt - TYPE(txios(calendar_wrapper)), INTENT(OUT) :: ret - - CALL cxios_calendar_wrapper_handle_create(ret%daddr, idt, len(idt)) - END SUBROUTINE xios(get_calendar_wrapper_handle) - - SUBROUTINE xios(get_default_calendar_wrapper_handle)(ret) - IMPLICIT NONE - TYPE(txios(calendar_wrapper)), INTENT(OUT) :: ret - - CALL cxios_get_current_calendar_wrapper(ret%daddr) - END SUBROUTINE xios(get_default_calendar_wrapper_handle) - - LOGICAL FUNCTION xios(is_valid_calendar_wrapper)(idt) - IMPLICIT NONE - CHARACTER(len = *), INTENT(IN) :: idt - LOGICAL (kind = 1) :: val - - CALL cxios_calendar_wrapper_valid_id(val, idt, len(idt)); - xios(is_valid_calendar_wrapper) = val - END FUNCTION xios(is_valid_calendar_wrapper) - - SUBROUTINE xios(create_calendar)(hdl) - IMPLICIT NONE - TYPE(txios(calendar_wrapper)), INTENT(IN) :: hdl - - CALL cxios_create_calendar(hdl%daddr) - END SUBROUTINE xios(create_calendar) - - SUBROUTINE xios(update_calendar_timestep)(hdl) - IMPLICIT NONE - TYPE(txios(calendar_wrapper)), INTENT(IN) :: hdl - - CALL cxios_update_calendar_timestep(hdl%daddr) - END SUBROUTINE xios(update_calendar_timestep) - - SUBROUTINE xios(set_start_date_hdl)(hdl, start_date) - USE IDATE - IMPLICIT NONE - TYPE(txios(calendar_wrapper)), INTENT(IN) :: hdl - TYPE(txios(date)), INTENT(IN) :: start_date - - CALL cxios_set_calendar_wrapper_date_start_date(hdl%daddr, start_date) - END SUBROUTINE xios(set_start_date_hdl) - - SUBROUTINE xios(get_start_date_hdl)(hdl, start_date) - USE IDATE - IMPLICIT NONE - TYPE(txios(calendar_wrapper)), INTENT(IN) :: hdl - TYPE(txios(date)), INTENT(OUT) :: start_date - - CALL cxios_get_calendar_wrapper_date_start_date(hdl%daddr, start_date) - END SUBROUTINE xios(get_start_date_hdl) - - SUBROUTINE xios(set_time_origin_hdl)(hdl, time_origin) - USE IDATE - IMPLICIT NONE - TYPE(txios(calendar_wrapper)), INTENT(IN) :: hdl - TYPE(txios(date)), INTENT(IN) :: time_origin - - CALL cxios_set_calendar_wrapper_date_time_origin(hdl%daddr, time_origin) - END SUBROUTINE xios(set_time_origin_hdl) - - SUBROUTINE xios(get_time_origin_hdl)(hdl, time_origin) - USE IDATE - IMPLICIT NONE - TYPE(txios(calendar_wrapper)), INTENT(IN) :: hdl - TYPE(txios(date)), INTENT(OUT) :: time_origin - - CALL cxios_get_calendar_wrapper_date_time_origin(hdl%daddr, time_origin) - END SUBROUTINE xios(get_time_origin_hdl) - -END MODULE ICALENDAR_WRAPPER diff --git a/xios_2311_src/trunk/.svn/pristine/45/456bb290b4a6a48dc24f0859aaf1a61cdb192b58.svn-base b/xios_2311_src/trunk/.svn/pristine/45/456bb290b4a6a48dc24f0859aaf1a61cdb192b58.svn-base deleted file mode 100644 index 48caee9b9f1267f2857dd851f689ed2c8bc425a8..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/45/456bb290b4a6a48dc24f0859aaf1a61cdb192b58.svn-base +++ /dev/null @@ -1,187 +0,0 @@ -#include "duration.hpp" -#include "date.hpp" -#include "calendar.hpp" -#include "calendar_util.hpp" - -namespace xios -{ - /// ////////////////////// Définitions ////////////////////// /// - - const CDuration Year ( 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ); - const CDuration Month ( 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ); - const CDuration Week ( 0.0, 0.0, 7.0, 0.0, 0.0, 0.0, 0.0 ); - const CDuration Day ( 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0 ); - const CDuration Hour ( 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0 ); - const CDuration Minute ( 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0 ); - const CDuration Second ( 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0 ); - const CDuration TimeStep ( 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0 ); - const CDuration NoneDu ( 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ); - - ///--------------------------------------------------------------- - - CDuration::CDuration(double y, double m, double d, double h, double min, double s, double ts) : - year(y), month(m), day(d), hour(h), minute(min), second(s), timestep(ts) - { - } - - ///--------------------------------------------------------------- - - CDuration& CDuration::operator=(const CDuration& duration) - { - year = duration.year; month = duration.month; day = duration.day; - hour = duration.hour; minute = duration.minute; second = duration.second; timestep = duration.timestep; - return *this; - } - - /*! - This operation may not serve much, it's here because of the need of operator== from generic class CType - */ - bool CDuration::operator==(const CDuration& duration) - { - return (year == duration.year && month == duration.month && day == duration.day && - hour == duration.hour && minute == duration.minute && second == duration.second && timestep == duration.timestep); - } - - StdOStream& operator<<(StdOStream& out, const CDuration& duration) - { - out << duration.toString(); - return out; - } - - StdIStream& operator>>(StdIStream& in , CDuration& duration) - { - duration = NoneDu; - double v = 1.0; - char c = '/'; - bool invalidUnit = false; - CDuration sentinel = NoneDu; - -#define setDuration(unit, value) \ - { \ - if (sentinel.unit) \ - ERROR("StdIStream& operator>>(StdIStream& in , CDuration& duration)", \ - << "Bad duration format: " #unit " has already been set."); \ - \ - duration.unit = value; \ - sentinel.unit = 1.0; \ - } - - do - { - in >> v >> c; - if (in.fail()) - ERROR("StdIStream& operator>>(StdIStream& in , CDuration& duration)", - << "Bad duration format: impossible to read a pair (value, unit)."); - - switch (c) - { - case 'y': setDuration(year, v) break; - case 'd': setDuration(day, v) break; - case 'h': setDuration(hour, v) break; - case 's': setDuration(second, v) break; - case 'm': - { - in >> c; - if (c == 'i') setDuration(minute, v) - else if (c == 'o') setDuration(month, v) - else invalidUnit = true; - break; - } - case 't': - { - in >> c; - if (c == 's') setDuration(timestep, v) - else invalidUnit = true; - break; - } - default: - invalidUnit = true; - break; - } - - if (invalidUnit) - ERROR("StdIStream& operator>>(StdIStream& in , CDuration& duration)", - << "Bad duration format: invalid unit, unexpected '" << c << "' character."); - } while (in.peek() != EOF); // check whether there is a next character to read - -#undef setDuration - - return in; - } - - //----------------------------------------------------------------- - - bool CDuration::isNone(void) const - { - return (*this == NoneDu); - } - - //----------------------------------------------------------------- - - CDuration& CDuration::solveTimeStep(const CCalendar& c) - { - CDuration timeStep = c.getTimeStep(); - second += timestep * timeStep.second; - minute += timestep * timeStep.minute; - hour += timestep * timeStep.hour; - day += timestep * timeStep.day; - month += timestep * timeStep.month; - year += timestep * timeStep.year; - timestep = 0.0; - return *this; - } - - CDuration& CDuration::resolve(const CCalendar& c, bool noNegativeTime /*= false*/) - { - return c.resolve(*this, noNegativeTime); - } - - //----------------------------------------------------------------- - - StdString CDuration::toString(void) const - { - StdOStringStream sout; - bool forceOutput = true; - - if (year != 0.0) { forceOutput = false; sout << year << "y "; } - if (month != 0.0) { forceOutput = false; sout << month << "mo "; } - if (day != 0.0) { forceOutput = false; sout << day << "d "; } - if (hour != 0.0) { forceOutput = false; sout << hour << "h "; } - if (minute != 0.0) { forceOutput = false; sout << minute << "mi "; } - if (second != 0.0) { forceOutput = false; sout << second << "s "; } - if (timestep != 0.0 || forceOutput) { sout << timestep << "ts "; } - - // Remove the trailing space - StdString strOut = sout.str(); - return strOut.erase(strOut.size() - 1); - } - - StdString CDuration::toStringUDUnits(void) const - { - if (timestep != 0.0) - ERROR("StdString CDuration::toStringUDUnits(void) const", - "Impossible to convert a duration to string using UDUnits when a timestep is set."); - - StdOStringStream sout; - bool forceOutput = true; - - if (year != 0.0) { forceOutput = false; sout << year << " yr "; } - if (month != 0.0) { forceOutput = false; sout << month << " month "; } - if (day != 0.0) { forceOutput = false; sout << day << " d "; } - if (hour != 0.0) { forceOutput = false; sout << hour << " h "; } - if (minute != 0.0) { forceOutput = false; sout << minute << " min "; } - if (second != 0.0 || forceOutput) { sout << second << " s "; } - - // Remove the trailing space - StdString strOut = sout.str(); - return strOut.erase(strOut.size() - 1); - } - - CDuration CDuration::FromString(const StdString& str) - { - CDuration dr = NoneDu; - StdIStringStream iss(str); iss >> dr; - return dr; - } -} // namespace xios - diff --git a/xios_2311_src/trunk/.svn/pristine/45/45a6c818566d1f1c6d773defb411fc3d71b63fc8.svn-base b/xios_2311_src/trunk/.svn/pristine/45/45a6c818566d1f1c6d773defb411fc3d71b63fc8.svn-base deleted file mode 100644 index 443e96b2dfb9e366fa4f6feedc7ba71f93d37f03..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/45/45a6c818566d1f1c6d773defb411fc3d71b63fc8.svn-base +++ /dev/null @@ -1,1485 +0,0 @@ -/* -This file is part of netcdf-4, a netCDF-like interface for HDF5, or a -HDF5 backend for netCDF, depending on your point of view. - -This file handles the nc4 variable functions. - -Copyright 2003-2006, University Corporation for Atmospheric -Research. See COPYRIGHT file for copying and redistribution -conditions. -*/ - -#include -#include "nc4dispatch.h" -#include - -#ifdef USE_PNETCDF -#include -#endif - -/* Min and max deflate levels tolerated by HDF5. */ -#define MIN_DEFLATE_LEVEL 0 -#define MAX_DEFLATE_LEVEL 9 - -/* This is to track opened HDF5 objects to make sure they are - * closed. */ -#ifdef EXTRA_TESTS -extern int num_plists; -#endif /* EXTRA_TESTS */ - -/* One meg is the minimum buffer size. */ -#define ONE_MEG 1048576 - -/* Szip options. */ -#define NC_SZIP_EC_OPTION_MASK 4 -#define NC_SZIP_NN_OPTION_MASK 32 -#define NC_SZIP_MAX_PIXELS_PER_BLOCK 32 - -int nc4_get_default_fill_value(NC_TYPE_INFO_T *type_info, void *fill_value); - - -/* If the HDF5 dataset for this variable is open, then close it and - * reopen it, with the perhaps new settings for chunk caching. */ -int -nc4_reopen_dataset(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var) -{ - hid_t access_pid; - - if (var->hdf_datasetid) - { - if ((access_pid = H5Pcreate(H5P_DATASET_ACCESS)) < 0) - return NC_EHDFERR; -#ifdef EXTRA_TESTS - num_plists++; -#endif - if (H5Pset_chunk_cache(access_pid, var->chunk_cache_nelems, - var->chunk_cache_size, - var->chunk_cache_preemption) < 0) - return NC_EHDFERR; - if (H5Dclose(var->hdf_datasetid) < 0) - return NC_EHDFERR; - if ((var->hdf_datasetid = H5Dopen2(grp->hdf_grpid, var->name, - access_pid)) < 0) - return NC_EHDFERR; - if (H5Pclose(access_pid) < 0) - return NC_EHDFERR; -#ifdef EXTRA_TESTS - num_plists--; -#endif - - if (var->dimscale) - var->dim[0]->hdf_dimscaleid = var->hdf_datasetid; - } - - return NC_NOERR; -} - -/* Set chunk cache size for a variable. */ -int -NC4_set_var_chunk_cache(int ncid, int varid, size_t size, size_t nelems, - float preemption) -{ - NC_FILE_INFO_T *nc; - NC_GRP_INFO_T *grp; - NC_HDF5_FILE_INFO_T *h5; - NC_VAR_INFO_T *var; - int retval; - - /* Check input for validity. */ - if (preemption < 0 || preemption > 1) - return NC_EINVAL; - - /* Find info for this file and group, and set pointer to each. */ - if ((retval = nc4_find_nc_grp_h5(ncid, &nc, &grp, &h5))) - return retval; - - /* An attempt to do any of these things on a netCDF-3 file is - * ignored with no error. */ - if (!h5) - return NC_NOERR; - - assert(nc && grp && h5); - - /* Find the var. */ - for (var = grp->var; var; var = var->next) - if (var->varid == varid) - break; - if (!var) - return NC_ENOTVAR; - - /* Set the values. */ - var->chunk_cache_size = size; - var->chunk_cache_nelems = nelems; - var->chunk_cache_preemption = preemption; - - if ((retval = nc4_reopen_dataset(grp, var))) - return retval; - - return NC_NOERR; -} - -/* Need this version for fortran. Accept negative numbers to leave - * settings as they are. */ -int -nc_set_var_chunk_cache_ints(int ncid, int varid, int size, int nelems, - int preemption) -{ - size_t real_size = H5D_CHUNK_CACHE_NBYTES_DEFAULT; - size_t real_nelems = H5D_CHUNK_CACHE_NSLOTS_DEFAULT; - float real_preemption = H5D_CHUNK_CACHE_W0_DEFAULT; - - if (size >= 0) - real_size = size * MEGABYTE; - - if (nelems >= 0) - real_nelems = nelems; - - if (preemption >= 0) - real_preemption = preemption / 100.; - - return nc_set_var_chunk_cache(ncid, varid, real_size, real_nelems, - real_preemption); -} - -/* Get chunk cache size for a variable. */ -int -NC4_get_var_chunk_cache(int ncid, int varid, size_t *sizep, - size_t *nelemsp, float *preemptionp) -{ - NC_FILE_INFO_T *nc; - NC_GRP_INFO_T *grp; - NC_HDF5_FILE_INFO_T *h5; - NC_VAR_INFO_T *var; - int retval; - - /* Find info for this file and group, and set pointer to each. */ - if ((retval = nc4_find_nc_grp_h5(ncid, &nc, &grp, &h5))) - return retval; - - /* Attempting to do any of these things on a netCDF-3 file produces - * an error. */ - if (!h5) - return NC_ENOTNC4; - - assert(nc && grp && h5); - - /* Find the var. */ - for (var = grp->var; var; var = var->next) - if (var->varid == varid) - break; - if (!var) - return NC_ENOTVAR; - - /* Give the user what they want. */ - if (sizep) - *sizep = var->chunk_cache_size; - if (nelemsp) - *nelemsp = var->chunk_cache_nelems; - if (preemptionp) - *preemptionp = var->chunk_cache_preemption; - - return NC_NOERR; -} - -/* Get chunk cache size for a variable. */ -int -nc_get_var_chunk_cache_ints(int ncid, int varid, int *sizep, - int *nelemsp, int *preemptionp) -{ - size_t real_size, real_nelems; - float real_preemption; - int ret; - - if ((ret = nc_get_var_chunk_cache(ncid, varid, &real_size, - &real_nelems, &real_preemption))) - return ret; - - if (sizep) - *sizep = real_size / MEGABYTE; - if (nelemsp) - *nelemsp = (int)real_nelems; - if(preemptionp) - *preemptionp = (int)(real_preemption * 100); - - return NC_NOERR; -} - -/* Check a set of chunksizes to see if they add up to a chunk that is too big. */ -static int -check_chunksizes(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var, const size_t *chunksizes) -{ - NC_TYPE_INFO_T *type_info; - float total; - size_t type_len; - int d; - int retval; - - if ((retval = nc4_get_typelen_mem(grp->file->nc4_info, var->xtype, 0, &type_len))) - return retval; - if ((retval = nc4_find_type(grp->file->nc4_info, var->xtype, &type_info))) - return retval; - if (type_info && type_info->class == NC_VLEN) - total = sizeof(hvl_t); - else - total = type_len; - for (d = 0; d < var->ndims; d++) - { - if (chunksizes[d] < 1) - return NC_EINVAL; - total *= chunksizes[d]; - } - - if (total > NC_MAX_UINT) - return NC_EBADCHUNK; - - return NC_NOERR; -} - -/* Find the default chunk nelems (i.e. length of chunk along each - * dimension). */ -static int -nc4_find_default_chunksizes2(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var) -{ - int d; - size_t type_size, max_len = 0; - float num_values = 1, num_set = 0; - int retval; -#ifdef LOGGING - int max_dim; - float total_chunk_size; -#endif - - if (var->type_info->nc_typeid == NC_STRING) - type_size = sizeof(char *); - else - type_size = var->type_info->size; - - /* Later this will become the total number of bytes in the default - * chunk. */ -#ifdef LOGGING - total_chunk_size = type_size; -#endif - - /* How many values in the variable (or one record, if there are - * unlimited dimensions); which is the largest dimension, and how - * long is it? */ - for (d = 0; d < var->ndims; d++) - { - assert(var->dim[d]); - if (var->dim[d]->len) - num_values *= (float)var->dim[d]->len; - else - num_set++; - - if (var->dim[d]->len > max_len) - { - max_len = var->dim[d]->len; -#ifdef LOGGING - max_dim = d; -#endif - } - LOG((4, "d = %d max_dim %d max_len %ld num_values %f", d, max_dim, max_len, - num_values)); - } - - /* If a dim is several orders of magnitude smaller than the max - * dimension, set it's chunk size to the full extent of the smaller - * dimension. */ -#define NC_DIM_MULTIPLIER 10000 - for (d = 0; d < var->ndims; d++) - if (var->dim[d]->unlimited) - var->chunksizes[d] = 1; - else if (!var->dim[d]->unlimited && var->dim[d]->len * NC_DIM_MULTIPLIER < max_len) - { - var->chunksizes[d] = var->dim[d]->len; - num_set++; - } - - /* Pick a chunk length for each dimension, if one has not already - * been picked above. */ - for (d = 0; d < var->ndims; d++) - if (!var->chunksizes[d]) - { - size_t suggested_size; - suggested_size = (pow((double)DEFAULT_CHUNK_SIZE/(num_values * type_size), - 1/(double)(var->ndims - num_set)) * var->dim[d]->len - .5); - if (suggested_size > var->dim[d]->len) - suggested_size = var->dim[d]->len; - var->chunksizes[d] = suggested_size ? suggested_size : 1; - LOG((4, "nc_def_var_nc4: name %s dim %d DEFAULT_CHUNK_SIZE %d num_values %f type_size %d " - "chunksize %ld", var->name, d, DEFAULT_CHUNK_SIZE, num_values, type_size, var->chunksizes[d])); - } - - /* Find total chunk size. */ -#ifdef LOGGING - for (d = 0; d < var->ndims; d++) - total_chunk_size *= var->chunksizes[d]; - LOG((4, "total_chunk_size %f", total_chunk_size)); -#endif - - /* But did this add up to a chunk that is too big? */ - retval = check_chunksizes(grp, var, var->chunksizes); - if (retval) - { - /* Other error? */ - if (retval != NC_EBADCHUNK) - return retval; - - /* Chunk is too big! Reduce each dimension by half and try again. */ - for ( ; retval == NC_EBADCHUNK; retval = check_chunksizes(grp, var, var->chunksizes)) - for (d = 0; d < var->ndims; d++) - var->chunksizes[d] = var->chunksizes[d]/2 ? var->chunksizes[d]/2 : 1; - } - - /* Do we have any big data overhangs? They can be dangerous to - * babies, the elderly, or confused campers who have had too much - * beer. */ - for (d = 0; d < var->ndims; d++) - { - int num_chunks; - size_t overhang; - assert(var->chunksizes[d] > 0); - num_chunks = (var->dim[d]->len + var->chunksizes[d] - 1) / var->chunksizes[d]; - if(num_chunks > 0) { - overhang = (num_chunks * var->chunksizes[d]) - var->dim[d]->len; - var->chunksizes[d] -= overhang / num_chunks; - } - } - - return NC_NOERR; -} - -/* This is called when a new netCDF-4 variable is defined. Break it - * down! */ -static int -nc_def_var_nc4(int ncid, const char *name, nc_type xtype, - int ndims, const int *dimidsp, int *varidp) -{ - NC_GRP_INFO_T *grp; - NC_VAR_INFO_T *var; - NC_DIM_INFO_T *dim; - NC_HDF5_FILE_INFO_T *h5; - NC_TYPE_INFO_T *type_info; - char norm_name[NC_MAX_NAME + 1]; - int new_varid = 0; - int num_unlim = 0; - int d; - size_t num_values = 1; - int retval; - - /* Find info for this file and group, and set pointer to each. */ - if ((retval = nc4_find_grp_h5(ncid, &grp, &h5))) - return retval; - assert(grp && h5); - - /* If it's not in define mode, strict nc3 files error out, - * otherwise switch to define mode. */ - if (!(h5->flags & NC_INDEF)) - { - if (h5->cmode & NC_CLASSIC_MODEL) - return NC_ENOTINDEFINE; - if ((retval = NC4_redef(ncid))) - return retval; - } - - /* Check and normalize the name. */ - if ((retval = nc4_check_name(name, norm_name))) - return retval; - - /* Not a Type is, well, not a type.*/ - if (xtype == NC_NAT) - return NC_EBADTYPE; - - /* For classic files, only classic types are allowed. */ - if (h5->cmode & NC_CLASSIC_MODEL && xtype > NC_DOUBLE) - return NC_ESTRICTNC3; - - /* If this is a user defined type, find it. */ - if (xtype > NC_STRING) - if (nc4_find_type(grp->file->nc4_info, xtype, &type_info)) - return NC_EBADTYPE; - - /* cast needed for braindead systems with signed size_t */ - if((unsigned long) ndims > X_INT_MAX) /* Backward compat */ - return NC_EINVAL; - - /* Classic model files have a limit on number of vars. */ - if(h5->cmode & NC_CLASSIC_MODEL && h5->nvars >= NC_MAX_VARS) - return NC_EMAXVARS; - - /* Check that this name is not in use as a var, grp, or type. */ - if ((retval = nc4_check_dup_name(grp, norm_name))) - return retval; - - /* If the file is read-only, return an error. */ - if (h5->no_write) - return NC_EPERM; - - /* Get the new varid. */ - for (var = grp->var; var; var = var->next) - new_varid++; - - /* Check all the dimids to make sure they exist. */ - for (d = 0; d < ndims; d++) - { - if ((retval = nc4_find_dim(grp, dimidsp[d], &dim, NULL))) - return retval; - if (dim->unlimited) - num_unlim++; - else - num_values *= dim->len; - } - - /* These degrubbing messages sure are handy! */ - LOG((3, "nc_def_var_nc4: name %s type %d ndims %d", norm_name, xtype, ndims)); -#ifdef LOGGING - { - int dd; - for (dd = 0; dd < ndims; dd++) - LOG((4, "dimid[%d] %d", dd, dimidsp[dd])); - } -#endif - - /* Add the var to the end of the list. */ - if ((retval = nc4_var_list_add(&grp->var, &var))) - return retval; - - /* Now fill in the values in the var info structure. */ - if (!(var->name = malloc((strlen(norm_name) + 1) * sizeof(char)))) - return NC_ENOMEM; - strcpy(var->name, norm_name); - var->varid = grp->nvars++; - var->xtype = xtype; - var->ndims = ndims; - var->dirty++; - - /* If this is a user-defined type, there is a type_info stuct with - * all the type information. For atomic types, fake up a type_info - * struct. */ - if (xtype > NC_STRING) - var->type_info = type_info; - else - { - if (!(var->type_info = calloc(1, sizeof(NC_TYPE_INFO_T)))) - return NC_ENOMEM; - var->type_info->nc_typeid = xtype; - if ((retval = nc4_get_hdf_typeid(h5, var->xtype, &var->type_info->hdf_typeid, - var->type_info->endianness))) - return retval; - if ((var->type_info->native_typeid = H5Tget_native_type(var->type_info->hdf_typeid, - H5T_DIR_DEFAULT)) < 0) - return NC_EHDFERR; - if ((retval = nc4_get_typelen_mem(h5, var->type_info->nc_typeid, 0, - &var->type_info->size))) - return retval; - } - if (!num_unlim) - var->contiguous = 1; - - /* Allocate space for dimension information. */ - if (ndims) - { - if (!(var->dim = calloc(ndims, sizeof(NC_DIM_INFO_T *)))) - return NC_ENOMEM; - if (!(var->dimids = calloc(ndims, sizeof(int)))) - return NC_ENOMEM; - } - - /* At the same time, check to see if this is a coordinate - * variable. If so, it will have the same name as one of its - * dimensions. If it is a coordinate var, is it a coordinate var in - * the same group as the dim? */ - for (d = 0; d < ndims; d++) - { - NC_GRP_INFO_T *dim_grp; - if ((retval = nc4_find_dim(grp, dimidsp[d], &dim, &dim_grp))) - return retval; - if (strcmp(dim->name, norm_name) == 0 && dim_grp == grp && d == 0) - { - var->dimscale++; - dim->coord_var = var; - dim->coord_var_in_grp++; - } - var->dimids[d] = dimidsp[d]; - var->dim[d] = dim; - } - - /* Determine default chunksizes for this variable. (Even for - * variables which may be contiguous. */ - LOG((4, "allocating array of %d size_t to hold chunksizes for var %s", - var->ndims, var->name)); - if (var->ndims) - if (!(var->chunksizes = calloc(var->ndims, sizeof(size_t)))) - return NC_ENOMEM; - - if ((retval = nc4_find_default_chunksizes2(grp, var))) - return retval; - - /* Is this a variable with a chunksize greater than the current - * cache size? */ - if ((retval = nc4_adjust_var_cache(grp, var))) - return retval; - - /* If the user names this variable the same as a dimension, but - * doesn't use that dimension first in its list of dimension ids, - * is not a coordinate variable. I need to change its HDF5 name, - * because the dimension will cause a HDF5 dataset to be created, - * and this var has the same name. */ - for (dim = grp->dim; dim; dim = dim->next) - if (!strcmp(dim->name, norm_name) && - (!var->ndims || dimidsp[0] != dim->dimid)) - { - /* Set a different hdf5 name for this variable to avoid name - * clash. */ - if (strlen(norm_name) + strlen(NON_COORD_PREPEND) > NC_MAX_NAME) - return NC_EMAXNAME; - if (!(var->hdf5_name = malloc((strlen(NON_COORD_PREPEND) + - strlen(norm_name) + 1) * sizeof(char)))) - return NC_ENOMEM; - - sprintf(var->hdf5_name, "%s%s", NON_COORD_PREPEND, norm_name); - } - - /* If this is a coordinate var, it is marked as a HDF5 dimension - * scale. (We found dim above.) Otherwise, allocate space to - * remember whether dimension scales have been attached to each - * dimension. */ - if (!var->dimscale && ndims) - if (ndims && !(var->dimscale_attached = calloc(ndims, sizeof(int)))) - return NC_ENOMEM; - - /* Return the varid. */ - if (varidp) - *varidp = var->varid; - LOG((4, "new varid %d", var->varid)); - - return retval; -} - -/* Create a new variable to hold user data. This is what it's all - * about baby! */ -int -NC4_def_var(int ncid, const char *name, nc_type xtype, int ndims, - const int *dimidsp, int *varidp) -{ - NC_FILE_INFO_T *nc; - - LOG((2, "nc_def_var: ncid 0x%x name %s xtype %d ndims %d", - ncid, name, xtype, ndims)); - - /* If there are dimensions, I need their ids. */ - if (ndims && !dimidsp) - return NC_EINVAL; - - /* Find metadata for this file. */ - if (!(nc = nc4_find_nc_file(ncid))) - return NC_EBADID; - -#ifdef USE_PNETCDF - /* Take care of files created/opened with parallel-netcdf library. */ - if (nc->pnetcdf_file) - { - int ret; - - ret = ncmpi_def_var(nc->int_ncid, name, xtype, ndims, - dimidsp, varidp); - nc->pnetcdf_ndims[*varidp] = ndims; - return ret; - } -#endif /* USE_PNETCDF */ - - /* Netcdf-3 cases handled by dispatch layer. */ - assert(nc->nc4_info); - - /* Handle netcdf-4 cases. */ - return nc_def_var_nc4(ncid, name, xtype, ndims, dimidsp, varidp); -} - -/* Get all the information about a variable. Pass NULL for whatever - * you don't care about. This is an internal function, not exposed to - * the user. */ -int -NC4_inq_var_all(int ncid, int varid, char *name, nc_type *xtypep, - int *ndimsp, int *dimidsp, int *nattsp, - int *shufflep, int *deflatep, int *deflate_levelp, - int *fletcher32p, int *contiguousp, size_t *chunksizesp, - int *no_fill, void *fill_valuep, int *endiannessp, - int *options_maskp, int *pixels_per_blockp) -{ - NC_FILE_INFO_T *nc; - NC_GRP_INFO_T *grp; - NC_HDF5_FILE_INFO_T *h5; - NC_VAR_INFO_T *var; - NC_ATT_INFO_T *att; - int natts=0; - size_t type_size; - int d; - int retval; - - LOG((2, "nc_inq_var_all: ncid 0x%x varid %d", ncid, varid)); - - /* Find info for this file and group, and set pointer to each. */ - if ((retval = nc4_find_nc_grp_h5(ncid, &nc, &grp, &h5))) - return retval; - assert(nc && grp && h5); - -#ifdef USE_PNETCDF - /* Take care of files created/opened with parallel-netcdf library. */ - if (nc->pnetcdf_file) - return ncmpi_inq_var(nc->int_ncid, varid, name, xtypep, ndimsp, - dimidsp, nattsp); -#endif /* USE_PNETCDF */ - - /* Walk through the list of vars, and return the info about the one - with a matching varid. If the varid is -1, find the global - atts and call it a day. */ - if (varid == NC_GLOBAL) - { - if (nattsp) - { - for (att = grp->att; att; att = att->next) - natts++; - *nattsp = natts; - } - return NC_NOERR; - } - - /* Find the var. */ - for (var = grp->var; var; var = var->next) - if (var->varid == varid) - break; - - /* Oh no! Maybe we couldn't find it (*sob*)! */ - if (!var) - return NC_ENOTVAR; - - /* Copy the data to the user's data buffers. */ - if (name) - strcpy(name, var->name); - if (xtypep) - *xtypep = var->xtype; - if (ndimsp) - *ndimsp = var->ndims; - if (dimidsp) - for (d = 0; d < var->ndims; d++) - dimidsp[d] = var->dimids[d]; - if (nattsp) - { - for (att = var->att; att; att = att->next) - natts++; - *nattsp = natts; - } - - /* Chunking stuff. */ - if (!var->contiguous && chunksizesp) - for (d = 0; d < var->ndims; d++) - { - chunksizesp[d] = var->chunksizes[d]; - LOG((4, "chunksizesp[%d]=%d", d, chunksizesp[d])); - } - - if (contiguousp) - *contiguousp = var->contiguous ? NC_CONTIGUOUS : NC_CHUNKED; - - /* Filter stuff. */ - if (deflatep) - *deflatep = var->deflate; - if (deflate_levelp) - *deflate_levelp = var->deflate_level; - if (shufflep) - *shufflep = var->shuffle; - if (fletcher32p) - *fletcher32p = var->fletcher32; - if (options_maskp) - *options_maskp = var->options_mask; - if (pixels_per_blockp) - *pixels_per_blockp = var->pixels_per_block; - - /* Fill value stuff. */ - if (no_fill) - *no_fill = var->no_fill; - - /* Don't do a thing with fill_valuep if no_fill mode is set for - * this var, or if fill_valuep is NULL. */ - if (!var->no_fill && fill_valuep) - { - /* Do we have a fill value for this var? */ - if (var->fill_value) - { - if ((retval = nc4_get_typelen_mem(grp->file->nc4_info, var->xtype, 0, &type_size))) - return retval; - memcpy(fill_valuep, var->fill_value, type_size); - } - else - { - if ((retval = nc4_get_default_fill_value(var->type_info, fill_valuep))) - return retval; - } - } - - /* Does the user want the endianness of this variable? */ - if (endiannessp) - *endiannessp = var->type_info->endianness; - - return NC_NOERR; -} - -/* This functions sets extra stuff about a netCDF-4 variable which - must be set before the enddef but after the def_var. This is an - internal function, deliberately hidden from the user so that we can - change the prototype of this functions without changing the API. */ -static int -nc_def_var_extra(int ncid, int varid, int *shuffle, int *deflate, - int *deflate_level, int *fletcher32, int *contiguous, - const size_t *chunksizes, int *no_fill, - const void *fill_value, int *endianness, - int *options_mask, int *pixels_per_block) -{ - NC_FILE_INFO_T *nc; - NC_GRP_INFO_T *grp; - NC_HDF5_FILE_INFO_T *h5; - NC_VAR_INFO_T *var; - NC_DIM_INFO_T *dim; - size_t type_size; - int d; - int retval; - - LOG((2, "nc_def_var_extra: ncid 0x%x varid %d", ncid, varid)); - - /* Find info for this file and group, and set pointer to each. */ - if ((retval = nc4_find_nc_grp_h5(ncid, &nc, &grp, &h5))) - return retval; - - /* Attempting to do any of these things on a netCDF-3 file produces - * an error. */ - if (!h5) - return NC_ENOTNC4; - - assert(nc && grp && h5); - - /* Find the var. */ - for (var = grp->var; var; var = var->next) - if (var->varid == varid) - break; - - /* Oh no! Maybe we couldn't find it (*sob*)! */ - if (!var) - return NC_ENOTVAR; - - /* Can't turn on contiguous and deflate/fletcher32/szip. */ - if (contiguous) - if ((*contiguous != NC_CHUNKED && deflate) || - (*contiguous != NC_CHUNKED && fletcher32) || - (*contiguous != NC_CHUNKED && options_mask)) - return NC_EINVAL; - - /* If the HDF5 dataset has already been created, then it is too - * late to set all the extra stuff. */ - if (var->created) - return NC_ELATEDEF; - - /* Check compression options. */ - if ((deflate && options_mask) || - (deflate && !deflate_level) || - (options_mask && !pixels_per_block)) - return NC_EINVAL; - - /* Valid deflate level? */ - if (deflate && deflate_level) - { - if (*deflate) - if (*deflate_level < MIN_DEFLATE_LEVEL || - *deflate_level > MAX_DEFLATE_LEVEL) - return NC_EINVAL; - if (var->options_mask) - return NC_EINVAL; - - /* For scalars, just ignore attempt to deflate. */ - if (!var->ndims) - return NC_NOERR; - - /* Well, if we couldn't find any errors, I guess we have to take - * the users settings. Darn! */ - var->contiguous = 0; - var->deflate = *deflate; - if (*deflate) - var->deflate_level = *deflate_level; - LOG((3, "nc_def_var_extra: *deflate_level %d", *deflate_level)); - } - - /* Szip in use? */ - if (options_mask) - { -#ifndef USE_SZIP - return NC_EINVAL; -#endif - if (var->deflate) - return NC_EINVAL; - if ((*options_mask != NC_SZIP_EC_OPTION_MASK) && - (*options_mask != NC_SZIP_NN_OPTION_MASK)) - return NC_EINVAL; - if ((*pixels_per_block > NC_SZIP_MAX_PIXELS_PER_BLOCK) || - (var->type_info->nc_typeid >= NC_STRING)) - return NC_EINVAL; - var->options_mask = *options_mask; - var->pixels_per_block = *pixels_per_block; - var->contiguous = 0; - } - - /* Shuffle filter? */ - if (shuffle) - { - var->shuffle = *shuffle; - var->contiguous = 0; - } - - /* Fltcher32 checksum error protection? */ - if (fletcher32) - { - var->fletcher32 = *fletcher32; - var->contiguous = 0; - } - - /* Does the user want a contiguous dataset? Not so fast! Make sure - * that there are no unlimited dimensions, and no filters in use - * for this data. */ - if (contiguous && *contiguous) - { - if (var->deflate || var->fletcher32 || var->shuffle || var->options_mask) - return NC_EINVAL; - - for (d = 0; d < var->ndims; d++) - { - if ((retval = nc4_find_dim(grp, var->dimids[d], &dim, NULL))) - return retval; - if (dim->unlimited) - return NC_EINVAL; - } - - var->contiguous = NC_CONTIGUOUS; - } - - /* Chunksizes anyone? */ - if (contiguous && *contiguous == NC_CHUNKED) - { - var->contiguous = 0; - - /* If the user provided chunksizes, check that they are not too - * big, and that their total size of chunk is less than 4 GB. */ - if (chunksizes) - { - - if ((retval = check_chunksizes(grp, var, chunksizes))) - return retval; - - /* Set the chunksizes for this variable. */ - for (d = 0; d < var->ndims; d++) - var->chunksizes[d] = chunksizes[d]; - } - } - - /* Is this a variable with a chunksize greater than the current - * cache size? */ - if (var->contiguous == NC_CHUNKED && (chunksizes || deflate || contiguous)) - { - /* Determine default chunksizes for this variable. */ - if (!var->chunksizes[0]) - if ((retval = nc4_find_default_chunksizes2(grp, var))) - return retval; - - /* Adjust the cache. */ - if ((retval = nc4_adjust_var_cache(grp, var))) - return retval; - } - - /* Are we setting a fill modes? */ - if (no_fill) - { - if (*no_fill) - var->no_fill = 1; - else - var->no_fill = 0; - } - - /* Are we setting a fill value? */ - if (fill_value && !var->no_fill) - { - /* If fill value hasn't been set, allocate space. */ - if ((retval = nc4_get_typelen_mem(h5, var->xtype, 0, &type_size))) - return retval; - if (!var->fill_value) - if (!(var->fill_value = malloc(type_size))) - return NC_ENOMEM; - - /* Copy the fill_value. */ - LOG((4, "Copying fill value into metadata for variable %s", - var->name)); - memcpy(var->fill_value, fill_value, type_size); - - /* If there's a _FillValue attribute, delete it. */ - retval = nc_del_att(ncid, varid, _FillValue); - if (retval && retval != NC_ENOTATT) - return retval; - - /* Create a _FillValue attribute. */ - if ((retval = nc_put_att(ncid, varid, _FillValue, var->xtype, 1, fill_value))) - return retval; - } - - /* Is the user setting the endianness? */ - if (endianness) - var->type_info->endianness = *endianness; - - return NC_NOERR; -} - -/* Set the deflate level for a var, lower is faster, higher is - * better. Must be called after nc_def_var and before nc_enddef or any - * functions which writes data to the file. */ -int -NC4_def_var_deflate(int ncid, int varid, int shuffle, int deflate, - int deflate_level) -{ - return nc_def_var_extra(ncid, varid, &shuffle, &deflate, - &deflate_level, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); -} - -/* Set checksum for a var. This must be called after the nc_def_var - * but before the nc_enddef. */ -int -NC4_def_var_fletcher32(int ncid, int varid, int fletcher32) -{ - return nc_def_var_extra(ncid, varid, NULL, NULL, NULL, &fletcher32, - NULL, NULL, NULL, NULL, NULL, NULL, NULL); -} - -/* Define chunking stuff for a var. This must be done after nc_def_var - and before nc_enddef. - - Chunking is required in any dataset with one or more unlimited - dimension in HDF5, or any dataset using a filter. - - Where chunksize is a pointer to an array of size ndims, with the - chunksize in each dimension. -*/ -int -NC4_def_var_chunking(int ncid, int varid, int contiguous, const size_t *chunksizesp) -{ - return nc_def_var_extra(ncid, varid, NULL, NULL, NULL, NULL, - &contiguous, chunksizesp, NULL, NULL, NULL, NULL, NULL); -} - -/* Inquire about chunking stuff for a var. This is a private, - * undocumented function, used by the f77 API to avoid size_t - * problems. */ -int -nc_inq_var_chunking_ints(int ncid, int varid, int *contiguousp, int *chunksizesp) -{ - NC_FILE_INFO_T *nc; - NC_GRP_INFO_T *grp; - NC_HDF5_FILE_INFO_T *h5; - NC_VAR_INFO_T *var; - size_t *cs = NULL; - int i, retval; - - /* Find this ncid's file info. */ - if ((retval = nc4_find_nc_grp_h5(ncid, &nc, &grp, &h5))) - return retval; - assert(nc); - - /* Must be netcdf-4. */ - if (!h5) - return NC_ENOTNC4; - - /* Find var cause I need the number of dims. */ - if ((retval = nc4_find_g_var_nc(nc, ncid, varid, &grp, &var))) - return retval; - - /* Allocate space for the size_t copy of the chunksizes array. */ - if (var->ndims) - if (!(cs = malloc(var->ndims * sizeof(size_t)))) - return NC_ENOMEM; - - retval = NC4_inq_var_all(ncid, varid, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, contiguousp, cs, NULL, - NULL, NULL, NULL, NULL); - - /* Copy to size_t array. */ - if (*contiguousp == NC_CHUNKED) - for (i = 0; i < var->ndims; i++) - { - chunksizesp[i] = cs[i]; - if (cs[i] > NC_MAX_INT) - retval = NC_ERANGE; - } - - if (var->ndims) - free(cs); - return retval; -} - -/* This function defines the chunking with ints, which works better - * with F77 portability. It is a secret function, which has been - * rendered unmappable, and it is impossible to apparate anywhere in - * this function. */ -int -nc_def_var_chunking_ints(int ncid, int varid, int contiguous, int *chunksizesp) -{ - NC_FILE_INFO_T *nc; - NC_GRP_INFO_T *grp; - NC_HDF5_FILE_INFO_T *h5; - NC_VAR_INFO_T *var; - size_t *cs = NULL; - int i, retval; - - /* Find this ncid's file info. */ - if ((retval = nc4_find_nc_grp_h5(ncid, &nc, &grp, &h5))) - return retval; - assert(nc); - - /* Must be netcdf-4. */ - if (!h5) - return NC_ENOTNC4; - - /* Find var cause I need the number of dims. */ - if ((retval = nc4_find_g_var_nc(nc, ncid, varid, &grp, &var))) - return retval; - - /* Allocate space for the size_t copy of the chunksizes array. */ - if (var->ndims) - if (!(cs = malloc(var->ndims * sizeof(size_t)))) - return NC_ENOMEM; - - /* Copy to size_t array. */ - for (i = 0; i < var->ndims; i++) - cs[i] = chunksizesp[i]; - - retval = nc_def_var_extra(ncid, varid, NULL, NULL, NULL, NULL, - &contiguous, cs, NULL, NULL, NULL, NULL, NULL); - - if (var->ndims) - free(cs); - return retval; -} - -/* Define fill value behavior for a variable. This must be done after - nc_def_var and before nc_enddef. */ -int -NC4_def_var_fill(int ncid, int varid, int no_fill, const void *fill_value) -{ - return nc_def_var_extra(ncid, varid, NULL, NULL, NULL, NULL, NULL, - NULL, &no_fill, fill_value, NULL, NULL, NULL); -} - - -/* Define the endianness of a variable. */ -int -NC4_def_var_endian(int ncid, int varid, int endianness) -{ - return nc_def_var_extra(ncid, varid, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, &endianness, NULL, NULL); -} - -/* Get var id from name. */ -int -NC4_inq_varid(int ncid, const char *name, int *varidp) -{ - NC_FILE_INFO_T *nc; - NC_GRP_INFO_T *grp; - NC_HDF5_FILE_INFO_T *h5; - NC_VAR_INFO_T *var; - char norm_name[NC_MAX_NAME + 1]; - int retval; - - if (!name) - return NC_EINVAL; - if (!varidp) - return NC_NOERR; - - LOG((2, "nc_inq_varid: ncid 0x%x name %s", ncid, name)); - - /* Find info for this file and group, and set pointer to each. */ - if ((retval = nc4_find_nc_grp_h5(ncid, &nc, &grp, &h5))) - return retval; - - /* Handle netcdf-3. */ - assert(h5); - - /* Normalize name. */ - if ((retval = nc4_normalize_name(name, norm_name))) - return retval; - - /* Find var of this name. */ - for (var = grp->var; var; var = var->next) - if (!(strcmp(var->name, norm_name))) - { - *varidp = var->varid; - return NC_NOERR; - } - - return NC_ENOTVAR; -} - -/* Rename a var to "bubba," for example. - - According to the netcdf-3.5 docs: If the new name is longer than - the old name, the netCDF dataset must be in define mode. */ -int -NC4_rename_var(int ncid, int varid, const char *name) -{ - NC_FILE_INFO_T *nc; - NC_GRP_INFO_T *grp; - NC_HDF5_FILE_INFO_T *h5; - NC_VAR_INFO_T *var; - int retval = NC_NOERR; - - LOG((2, "nc_rename_var: ncid 0x%x varid %d name %s", - ncid, varid, name)); - - /* Find info for this file and group, and set pointer to each. */ - if ((retval = nc4_find_nc_grp_h5(ncid, &nc, &grp, &h5))) - return retval; - -#ifdef USE_PNETCDF - /* Take care of files created/opened with parallel-netcdf library. */ - if (nc->pnetcdf_file) - return ncmpi_rename_var(nc->int_ncid, varid, name); -#endif /* USE_PNETCDF */ - - /* Take care of netcdf-3 files. */ - assert(h5); - - /* Is the new name too long? */ - if (strlen(name) > NC_MAX_NAME) - return NC_EMAXNAME; - - /* Trying to write to a read-only file? No way, Jose! */ - if (h5->no_write) - return NC_EPERM; - - /* Check name validity, if strict nc3 rules are in effect for this - * file. */ - if ((retval = NC_check_name(name))) - return retval; - - /* Is name in use? */ - for (var = grp->var; var; var = var->next) - if (!strncmp(var->name, name, NC_MAX_NAME)) - return NC_ENAMEINUSE; - - /* Find the var. */ - for (var = grp->var; var; var = var->next) - if (var->varid == varid) - break; - if (!var) - return NC_ENOTVAR; - - /* If we're not in define mode, new name must be of equal or - less size, if strict nc3 rules are in effect for this . */ - if (!(h5->flags & NC_INDEF) && strlen(name) > strlen(var->name) && - (h5->cmode & NC_CLASSIC_MODEL)) - return NC_ENOTINDEFINE; - - /* Change the HDF5 file, if this var has already been created - there. */ - if (var->created) - { - if (H5Gmove(grp->hdf_grpid, var->name, name) < 0) - BAIL(NC_EHDFERR); - } - - /* Now change the name in our metadata. */ - free(var->name); - if (!(var->name = malloc((strlen(name) + 1) * sizeof(char)))) - return NC_ENOMEM; - strcpy(var->name, name); - - exit: - return retval; -} - - -int -NC4_var_par_access(int ncid, int varid, int par_access) -{ -#ifndef USE_PARALLEL - return NC_ENOPAR; -#else - NC_FILE_INFO_T *nc; - NC_GRP_INFO_T *grp; - NC_HDF5_FILE_INFO_T *h5; - NC_VAR_INFO_T *var; - int retval; - - LOG((1, "nc_var_par_access: ncid 0x%x varid %d par_access %d", ncid, - varid, par_access)); - - if (par_access != NC_INDEPENDENT && par_access != NC_COLLECTIVE) - return NC_EINVAL; - - /* Find info for this file and group, and set pointer to each. */ - if ((retval = nc4_find_nc_grp_h5(ncid, &nc, &grp, &h5))) - return retval; - -#ifdef USE_PNETCDF - /* Handle files opened/created with parallel-netcdf library. */ - if (nc->pnetcdf_file) - { - if (par_access == nc->pnetcdf_access_mode) - return NC_NOERR; - - nc->pnetcdf_access_mode = par_access; - if (par_access == NC_INDEPENDENT) - return ncmpi_begin_indep_data(nc->int_ncid); - else - return ncmpi_end_indep_data(nc->int_ncid); - } -#endif /* USE_PNETCDF */ - - /* This function only for files opened with nc_open_par or nc_create_par. */ - if (!h5->parallel) - return NC_ENOPAR; - - /* Find the var, and set its preference. */ - for (var = grp->var; var; var = var->next) - if (var->varid == varid) - break; - if (!var) - return NC_ENOTVAR; - - if (par_access) - var->parallel_access = NC_COLLECTIVE; - else - var->parallel_access = NC_INDEPENDENT; - return NC_NOERR; -#endif /* USE_PARALLEL */ -} - -static int -nc4_put_vara_tc(int ncid, int varid, nc_type mem_type, int mem_type_is_long, - const size_t *startp, const size_t *countp, const void *op) -{ - NC_FILE_INFO_T *nc; - - LOG((2, "nc4_put_vara_tc: ncid 0x%x varid %d mem_type %d mem_type_is_long %d", - ncid, varid, mem_type, mem_type_is_long)); - - if (!(nc = nc4_find_nc_file(ncid))) - return NC_EBADID; - -#ifdef USE_PNETCDF - /* Handle files opened/created with the parallel-netcdf library. */ - if (nc->pnetcdf_file) - { - MPI_Offset mpi_start[NC_MAX_DIMS], mpi_count[NC_MAX_DIMS]; - int d; - - /* No NC_LONGs for parallel-netcdf library! */ - if (mem_type_is_long) - return NC_EINVAL; - - /* We must convert the start, count, and stride arrays to - * MPI_Offset type. */ - for (d = 0; d < nc->pnetcdf_ndims[varid]; d++) - { - mpi_start[d] = startp[d]; - mpi_count[d] = countp[d]; - } - - if (nc->pnetcdf_access_mode == NC_INDEPENDENT) - { - switch(mem_type) - { - case NC_BYTE: - return ncmpi_put_vara_schar(nc->int_ncid, varid, mpi_start, mpi_count, op); - case NC_UBYTE: - return ncmpi_put_vara_uchar(nc->int_ncid, varid, mpi_start, mpi_count, op); - case NC_CHAR: - return ncmpi_put_vara_text(nc->int_ncid, varid, mpi_start, mpi_count, op); - case NC_SHORT: - return ncmpi_put_vara_short(nc->int_ncid, varid, mpi_start, mpi_count, op); - case NC_INT: - return ncmpi_put_vara_int(nc->int_ncid, varid, mpi_start, mpi_count, op); - case NC_FLOAT: - return ncmpi_put_vara_float(nc->int_ncid, varid, mpi_start, mpi_count, op); - case NC_DOUBLE: - return ncmpi_put_vara_double(nc->int_ncid, varid, mpi_start, mpi_count, op); - case NC_NAT: - default: - return NC_EBADTYPE; - } - } - else - { - switch(mem_type) - { - case NC_BYTE: - return ncmpi_put_vara_schar_all(nc->int_ncid, varid, mpi_start, mpi_count, op); - case NC_UBYTE: - return ncmpi_put_vara_uchar_all(nc->int_ncid, varid, mpi_start, mpi_count, op); - case NC_CHAR: - return ncmpi_put_vara_text_all(nc->int_ncid, varid, mpi_start, mpi_count, op); - case NC_SHORT: - return ncmpi_put_vara_short_all(nc->int_ncid, varid, mpi_start, mpi_count, op); - case NC_INT: - return ncmpi_put_vara_int_all(nc->int_ncid, varid, mpi_start, mpi_count, op); - case NC_FLOAT: - return ncmpi_put_vara_float_all(nc->int_ncid, varid, mpi_start, mpi_count, op); - case NC_DOUBLE: - return ncmpi_put_vara_double_all(nc->int_ncid, varid, mpi_start, mpi_count, op); - case NC_NAT: - default: - return NC_EBADTYPE; - } - } - } -#endif /* USE_PNETCDF */ - - /* NetCDF-3 cases handled by dispatch layer. */ - assert(nc->nc4_info); - - return nc4_put_vara(nc, ncid, varid, startp, countp, mem_type, - mem_type_is_long, (void *)op); -} - -int -nc4_get_hdf4_vara(NC_FILE_INFO_T *nc, int ncid, int varid, const size_t *startp, - const size_t *countp, nc_type mem_nc_type, int is_long, void *data) -{ -#ifdef USE_HDF4 - NC_GRP_INFO_T *grp, *g; - NC_HDF5_FILE_INFO_T *h5; - NC_VAR_INFO_T *var; - NC_DIM_INFO_T *dim; - int32 start32[NC_MAX_VAR_DIMS], edge32[NC_MAX_VAR_DIMS]; - int retval, d; - - /* Find our metadata for this file, group, and var. */ - assert(nc); - if ((retval = nc4_find_g_var_nc(nc, ncid, varid, &grp, &var))) - return retval; - h5 = nc->nc4_info; - assert(grp && h5 && var && var->name); - - for (d = 0; d < var->ndims; d++) - { - start32[d] = startp[d]; - edge32[d] = countp[d]; - } - - if (SDreaddata(var->sdsid, start32, NULL, edge32, data)) - return NC_EHDFERR; - -#endif /* USE_HDF4 */ - return NC_NOERR; -} - -/* Get an array. */ -static int -nc4_get_vara_tc(int ncid, int varid, nc_type mem_type, int mem_type_is_long, - const size_t *startp, const size_t *countp, void *ip) -{ - NC_FILE_INFO_T *nc; - - LOG((2, "nc4_get_vara_tc: ncid 0x%x varid %d mem_type %d mem_type_is_long %d", - ncid, varid, mem_type, mem_type_is_long)); - - if (!(nc = nc4_find_nc_file(ncid))) - return NC_EBADID; - -#ifdef USE_PNETCDF - /* Handle files opened/created with the parallel-netcdf library. */ - if (nc->pnetcdf_file) - { - MPI_Offset mpi_start[NC_MAX_VAR_DIMS], mpi_count[NC_MAX_VAR_DIMS]; - int d; - - /* No NC_LONGs for parallel-netcdf library! */ - if (mem_type_is_long) - return NC_EINVAL; - - /* We must convert the start, count, and stride arrays to - * MPI_Offset type. */ - for (d = 0; d < nc->pnetcdf_ndims[varid]; d++) - { - mpi_start[d] = startp[d]; - mpi_count[d] = countp[d]; - } - - if (nc->pnetcdf_access_mode == NC_INDEPENDENT) - { - switch(mem_type) - { - case NC_BYTE: - return ncmpi_get_vara_schar(nc->int_ncid, varid, mpi_start, mpi_count, ip); - case NC_UBYTE: - return ncmpi_get_vara_uchar(nc->int_ncid, varid, mpi_start, mpi_count, ip); - case NC_CHAR: - return ncmpi_get_vara_text(nc->int_ncid, varid, mpi_start, mpi_count, ip); - case NC_SHORT: - return ncmpi_get_vara_short(nc->int_ncid, varid, mpi_start, mpi_count, ip); - case NC_INT: - return ncmpi_get_vara_int(nc->int_ncid, varid, mpi_start, mpi_count, ip); - case NC_FLOAT: - return ncmpi_get_vara_float(nc->int_ncid, varid, mpi_start, mpi_count, ip); - case NC_DOUBLE: - return ncmpi_get_vara_double(nc->int_ncid, varid, mpi_start, mpi_count, ip); - case NC_NAT: - default: - return NC_EBADTYPE; - } - } - else - { - switch(mem_type) - { - case NC_BYTE: - return ncmpi_get_vara_schar_all(nc->int_ncid, varid, mpi_start, mpi_count, ip); - case NC_UBYTE: - return ncmpi_get_vara_uchar_all(nc->int_ncid, varid, mpi_start, mpi_count, ip); - case NC_CHAR: - return ncmpi_get_vara_text_all(nc->int_ncid, varid, mpi_start, mpi_count, ip); - case NC_SHORT: - return ncmpi_get_vara_short_all(nc->int_ncid, varid, mpi_start, mpi_count, ip); - case NC_INT: - return ncmpi_get_vara_int_all(nc->int_ncid, varid, mpi_start, mpi_count, ip); - case NC_FLOAT: - return ncmpi_get_vara_float_all(nc->int_ncid, varid, mpi_start, mpi_count, ip); - case NC_DOUBLE: - return ncmpi_get_vara_double_all(nc->int_ncid, varid, mpi_start, mpi_count, ip); - case NC_NAT: - default: - return NC_EBADTYPE; - } - } - } -#endif /* USE_PNETCDF */ - - /* Handle netCDF-3 cases. */ - assert(nc->nc4_info); - - /* Handle HDF4 cases. */ - if (nc->nc4_info->hdf4) - return nc4_get_hdf4_vara(nc, ncid, varid, startp, countp, mem_type, - mem_type_is_long, (void *)ip); - - /* Handle HDF5 cases. */ - return nc4_get_vara(nc, ncid, varid, startp, countp, mem_type, - mem_type_is_long, (void *)ip); -} - -int -NC4_put_vara(int ncid, int varid, const size_t *startp, - const size_t *countp, const void *op, int memtype) -{ - return nc4_put_vara_tc(ncid, varid, memtype, 0, startp, countp, op); -} - - -/* Read an array of values. */ -int -NC4_get_vara(int ncid, int varid, const size_t *startp, - const size_t *countp, void *ip, int memtype) -{ - return nc4_get_vara_tc(ncid, varid, memtype, 0, startp, countp, ip); -} diff --git a/xios_2311_src/trunk/.svn/pristine/45/45c8775e602dad4d262ce9b1e8d59585813c7e95.svn-base b/xios_2311_src/trunk/.svn/pristine/45/45c8775e602dad4d262ce9b1e8d59585813c7e95.svn-base deleted file mode 100644 index 45be9d4cba220e52c7dc57df20c7c61c984dcf42..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/45/45c8775e602dad4d262ce9b1e8d59585813c7e95.svn-base +++ /dev/null @@ -1,187 +0,0 @@ -#include "coupler_in.hpp" -#include "attribute_template.hpp" -#include "object_template.hpp" -#include "group_template.hpp" -#include "object_factory.hpp" -#include "context.hpp" -#include "xios_spl.hpp" - -namespace xios -{ - - CCouplerIn::CCouplerIn(void) : CObjectTemplate(), CCouplerInAttributes(), - virtualFieldGroup(), enabledFields() - { - setVirtualFieldGroup(CFieldGroup::create(getId() + "_virtual_field_group")); - } - - CCouplerIn::CCouplerIn(const StdString & id) : CObjectTemplate(id), CCouplerInAttributes(), - virtualFieldGroup(), enabledFields() - { - setVirtualFieldGroup(CFieldGroup::create(getId() + "_virtual_field_group")); - } - - CCouplerIn::~CCouplerIn(void) - { /* Ne rien faire de plus */ } - - ///--------------------------------------------------------------- - //! Get name of coupler_in - StdString CCouplerIn::GetName(void) { return (StdString("coupler_in")); } - StdString CCouplerIn::GetDefName(void){ return (CCouplerIn::GetName()); } - ENodeType CCouplerIn::GetType(void) { return (eCouplerIn); } - - std::vector CCouplerIn::getEnabledFields(void) - TRY - { - if (enabledFields.empty()) - { - this->enabledFields = this->getAllFields(); - std::vector newEnabledFields; - bool enabled ; - for ( auto it = this->enabledFields.begin(); it != this->enabledFields.end(); it++ ) - { - if ((*it)->enabled.isEmpty()) enabled=true ; - else enabled=(*it)->enabled ; - if (enabled) newEnabledFields.push_back(*it); - } - enabledFields = newEnabledFields; - } - return (this->enabledFields); - } - CATCH_DUMP_ATTR - - const string& CCouplerIn::getCouplingContextId(void) - { - if (couplingContextId_.empty()) - { - vector vectStr=splitRegex(context,"::") ; - string poolId=vectStr[0] ; - string serviceId=poolId ; - string contextId=vectStr[1] ; - int contextLeader ; - int type = CServicesManager::CLIENT ; - couplingContextId_=CXios::getContextsManager()->getServerContextName(poolId, serviceId, 0, type, contextId) ; - } - return couplingContextId_ ; - } - - void CCouplerIn::createInterCommunicator(void) - TRY - { - if (context.isEmpty()) - { - ERROR("void CCouplerOut::createInterCommunicator(void)", - "The attribute must be defined to specify the target coupling context"); - } - CContext* contextPtr = CContext::getCurrent(); - contextPtr->addCouplingChanel(getCouplingContextId(), false) ; - } - CATCH_DUMP_ATTR - - - /*! - \brief Parse xml file and write information into coupler_in object - \param [in] node xmld node corresponding in xml coupler_in - */ - void CCouplerIn::parse(xml::CXMLNode & node) - TRY - { - SuperClass::parse(node); - - if (node.goToChildElement()) - { - do - { - if (node.getElementName()=="field" || node.getElementName()=="field_group") this->getVirtualFieldGroup()->parseChild(node); - } while (node.goToNextElement()); - node.goToParentElement(); - } - } - CATCH_DUMP_ATTR - - /*! - \brief Get virtual field group - In each CCouplerIn, there always exists a field group which is the ancestor of all - fields in the CCouplerIn. This is considered be virtual because it is created automatically during - CCouplerIn initialization and it normally doesn't appear on xml file - \return Pointer to field group - */ - CFieldGroup* CCouplerIn::getVirtualFieldGroup(void) const - TRY - { - return (this->virtualFieldGroup); - } - CATCH - - void CCouplerIn::solveDescInheritance(bool apply, const CAttributeMap * const parent) - TRY - { - SuperClassAttribute::setAttributes(parent,apply); - this->getVirtualFieldGroup()->solveDescInheritance(apply, NULL); - } - CATCH_DUMP_ATTR - - void CCouplerIn::solveFieldRefInheritance(bool apply) - TRY - { - // Rsolution des hritages par rfrence de chacun des champs contenus dans le fichier. - std::vector allF = this->getAllFields(); - for (unsigned int i = 0; i < allF.size(); i++) - allF[i]->solveRefInheritance(apply); - } - CATCH_DUMP_ATTR - /*! - \brief Get virtual variable group - In each CCouplerIn, there always exists a variable group which is the ancestor of all - variable in the CCouplerIn. This is considered be virtual because it is created automatically during - CCouplerIn initialization and it normally doesn't appear on xml file - \return Pointer to variable group - */ - - //! Get all fields of a file - std::vector CCouplerIn::getAllFields(void) const - TRY - { - return (this->virtualFieldGroup->getAllChildren()); - } - CATCH - - /*! - * assign the context associated to the coupler to the enabled fields - */ - void CCouplerIn::assignContext(void) - { - client_ = CContext::getCurrent()->getCouplerInClient(getCouplingContextId()); - for (auto& field : getEnabledFields()) field->setContextClient(client_) ; - } - - //---------------------------------------------------------------- - //! Change virtual field group to a new one - void CCouplerIn::setVirtualFieldGroup(CFieldGroup* newVirtualFieldGroup) - TRY - { - this->virtualFieldGroup = newVirtualFieldGroup; - } - CATCH_DUMP_ATTR - - ///-------------------------------------------------------------- - /*! - */ - StdString CCouplerIn::dumpClassAttributes(void) - { - StdString str; - CContext* context = CContext::getCurrent(); - str.append("context=\""); - str.append(context->getId()); - str.append("\""); - str.append(" enabled fields=\""); - int size = this->enabledFields.size(); - for (int i = 0; i < size; ++i) - { - str.append(this->enabledFields[i]->getId()); - str.append(" "); - } - str.append("\""); - return str; - } -} \ No newline at end of file diff --git a/xios_2311_src/trunk/.svn/pristine/45/45e659d59318cba29d33b05c25db7799f0e044b4.svn-base b/xios_2311_src/trunk/.svn/pristine/45/45e659d59318cba29d33b05c25db7799f0e044b4.svn-base deleted file mode 100644 index 7d901ed4159c722871bd0a92c44a5226388815cb..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/45/45e659d59318cba29d33b05c25db7799f0e044b4.svn-base +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef __XIOS__ -#define __XIOS__ - -#include "xios_spl.hpp" - -/// XIOS headers /// -#include "nc4_data_output.hpp" - - -using namespace xios; -using namespace xios::xml; -using namespace xios::func; - -#endif //__XIOS__ diff --git a/xios_2311_src/trunk/.svn/pristine/45/45f7731b59e543f730f2f99323c06bfc4ee0985d.svn-base b/xios_2311_src/trunk/.svn/pristine/45/45f7731b59e543f730f2f99323c06bfc4ee0985d.svn-base deleted file mode 100644 index 3592eff6e802ed0705bc21578d3580067cce1b88..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/45/45f7731b59e543f730f2f99323c06bfc4ee0985d.svn-base +++ /dev/null @@ -1,274 +0,0 @@ -#include "ressources_manager.hpp" -#include "server.hpp" -#include "servers_ressource.hpp" -#include "timer.hpp" - - - - - -namespace xios -{ - using namespace std; - - CRessourcesManager::CRessourcesManager(bool isXiosServer) - { - - xiosComm_ = CXios::getXiosComm() ; - - int commRank ; - MPI_Comm_rank(xiosComm_, &commRank) ; - if (commRank==0 && isXiosServer) MPI_Comm_rank(xiosComm_, &commRank) ; - else commRank=0 ; - MPI_Allreduce(&commRank, &managerGlobalLeader_, 1, MPI_INT, MPI_SUM, xiosComm_) ; - - MPI_Comm_rank(xiosComm_, &commRank) ; - winNotify_ = new CWindowManager(xiosComm_, maxBufferSize_) ; - - - winRessources_ = new CWindowManager(xiosComm_, maxBufferSize_) ; - winRessources_->lockWindow(commRank,0) ; - serverLeader_=-1 ; - winRessources_->updateToWindow(commRank, this, &CRessourcesManager::ressourcesDumpOut) ; - winRessources_->unlockWindow(commRank,0) ; - - MPI_Barrier(xiosComm_) ; - } - - CRessourcesManager::~CRessourcesManager() - { - delete winNotify_ ; - delete winRessources_ ; - } - - void CRessourcesManager::createPool(const string& poolId, int size) - { - info(40)<<"CRessourcesManager::createPool : calling createPool : "<lockWindow(managerGlobalLeader_,0) ; - winRessources_->updateFromWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ; - winRessources_->unlockWindow(managerGlobalLeader_,0) ; - - notifyType_=NOTIFY_CREATE_POOL ; - notifyCreatePool_=make_tuple(poolId, size) ; - info(40)<<"CRessourcesManager::createPool : send notification creating pool to server leader "<lockWindow(managerGlobalLeader_,0) ; - winRessources_->updateFromWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ; - winRessources_->unlockWindow(managerGlobalLeader_,0) ; - - if (serverLeader_!=-1) - { - notifyType_=NOTIFY_FINALIZE ; - info(40)<<"CRessourcesManager::finalize : send notification finalize to server leader "<lockWindowExclusive(rank) ; - winNotify_->pushToLockedWindow(rank, this, &CRessourcesManager::notificationsDumpOut) ; - winNotify_->unlockWindow(rank) ; - } - - - void CRessourcesManager::notificationsDumpOut(CBufferOut& buffer) - { - - buffer.realloc(maxBufferSize_) ; - - if (notifyType_==NOTIFY_CREATE_POOL) - { - auto& arg=notifyCreatePool_ ; - buffer << notifyType_<< get<0>(arg) << get<1>(arg) ; - } - else if (notifyType_==NOTIFY_FINALIZE) - { - buffer << notifyType_ ; - } - } - - void CRessourcesManager::notificationsDumpIn(CBufferIn& buffer) - { - if (buffer.bufferSize() == 0) notifyType_= NOTIFY_NOTHING ; - else - { - buffer>>notifyType_; - if (notifyType_==NOTIFY_CREATE_POOL) - { - auto& arg=notifyCreatePool_ ; - buffer >> get<0>(arg) >> get<1>(arg) ; - } - else if (notifyType_==NOTIFY_FINALIZE) { /*nothing to do*/ } - } - - } - - void CRessourcesManager::eventLoop(void) - { - CTimer::get("CRessourcesManager::eventLoop").resume(); - int flag ; - MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &flag, MPI_STATUS_IGNORE); - double time=MPI_Wtime() ; - if (time-lastEventLoop_ > eventLoopLatency_) - { - checkNotifications() ; - lastEventLoop_=time ; - } - - CTimer::get("CRessourcesManager::eventLoop").suspend(); - } - - void CRessourcesManager::checkNotifications(void) - { - int commRank ; - MPI_Comm_rank(xiosComm_, &commRank) ; - CTimer::get("CRessourcesManager::checkNotifications lock").resume(); - winNotify_->lockWindowExclusive(commRank) ; - CTimer::get("CRessourcesManager::checkNotifications lock").suspend(); - CTimer::get("CRessourcesManager::checkNotifications pop").resume(); - winNotify_->popFromLockedWindow(commRank, this, &CRessourcesManager::notificationsDumpIn) ; - CTimer::get("CRessourcesManager::checkNotifications pop").suspend(); - CTimer::get("CRessourcesManager::checkNotifications unlock").resume(); - winNotify_->unlockWindow(commRank) ; - CTimer::get("CRessourcesManager::checkNotifications unlock").suspend(); - if (notifyType_==NOTIFY_CREATE_POOL) createPool() ; - else if (notifyType_==NOTIFY_FINALIZE) finalizeSignal() ; - } - - void CRessourcesManager::createPool(void) - { - - auto& arg=notifyCreatePool_ ; - string poolId=get<0>(arg) ; - int size=get<1>(arg) ; - info(40)<<"CRessourcesManager::createPool : receive create pool notification : "<< poolId<<" of size "<createPool(poolId,size) ; - } - - void CRessourcesManager::finalizeSignal(void) - { - info(40)<<"CRessourcesManager::createPool : receive finalize notification"<finalize() ; - } - - void CRessourcesManager::ressourcesDumpOut(CBufferOut& buffer) - { - - buffer.realloc(maxBufferSize_) ; - - buffer<first ; - auto val = it->second ; - buffer << key<(val) << std::get<1>(val) ; - } - } - - void CRessourcesManager::ressourcesDumpIn(CBufferIn& buffer) - { - std::string poolId ; - int size ; - int leader ; - - buffer>>serverLeader_ ; - pools_.clear() ; - int nbPools ; - buffer>>nbPools ; - for(int i=0;i>poolId>>size>>leader ; - pools_[poolId]=std::make_tuple(size,leader) ; - } - } - - void CRessourcesManager::registerServerLeader(int serverLeaderRank) - { - winRessources_->lockWindow(managerGlobalLeader_,0) ; - winRessources_->updateFromWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ; - serverLeader_ = serverLeaderRank ; - winRessources_->updateToWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpOut) ; - winRessources_->unlockWindow(managerGlobalLeader_,0) ; - } - - void CRessourcesManager::registerRessourcesSize(int size) - { - winRessources_->lockWindow(managerGlobalLeader_,0) ; - winRessources_->updateFromWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ; - ressourcesSize_ = size ; - freeRessourcesSize_ = size ; - winRessources_->updateToWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpOut) ; - winRessources_->unlockWindow(managerGlobalLeader_,0) ; - } - - - void CRessourcesManager::registerPool(const string& poolId, int size, int leader) - { - winRessources_->lockWindow(managerGlobalLeader_,0) ; - winRessources_->updateFromWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ; - pools_[poolId] = make_tuple(size,leader) ; - freeRessourcesSize_-=size ; - winRessources_->updateToWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpOut) ; - winRessources_->unlockWindow(managerGlobalLeader_,0) ; - } - - - bool CRessourcesManager::getPoolInfo(const string& poolId, int& size, int& leader) - { - winRessources_->lockWindow(managerGlobalLeader_,0) ; - winRessources_->updateFromWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ; - winRessources_->unlockWindow(managerGlobalLeader_,0) ; - - auto it=pools_.find(poolId) ; - if ( it == pools_.end()) return false ; - else - { - size=get<0>(it->second) ; - leader=get<1>(it->second) ; - return true ; - } - } - - int CRessourcesManager::getRessourcesSize(void) - { - winRessources_->lockWindow(managerGlobalLeader_,0) ; - winRessources_->updateFromWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ; - winRessources_->unlockWindow(managerGlobalLeader_,0) ; - - return ressourcesSize_ ; - } - - int CRessourcesManager::getFreeRessourcesSize(void) - { - winRessources_->lockWindow(managerGlobalLeader_,0) ; - winRessources_->updateFromWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ; - winRessources_->unlockWindow(managerGlobalLeader_,0) ; - - return freeRessourcesSize_ ; - } - - bool CRessourcesManager::getPoolLeader(const string& poolId, int& leader) - { - int size ; - return getPoolInfo(poolId, size, leader) ; - } - - bool CRessourcesManager::getPoolSize(const string& poolId, int& size) - { - int leader ; - return getPoolInfo(poolId, size, leader) ; - } - - bool CRessourcesManager::hasPool(const string& poolId) - { - int leader,size ; - return getPoolInfo(poolId, size, leader) ; - } -} \ No newline at end of file diff --git a/xios_2311_src/trunk/.svn/pristine/46/460139db8bbe0104d39b75b80790228701a6a4f9.svn-base b/xios_2311_src/trunk/.svn/pristine/46/460139db8bbe0104d39b75b80790228701a6a4f9.svn-base deleted file mode 100644 index 7618e0cc943df76697e0a2494d42f1441b97e003..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/46/460139db8bbe0104d39b75b80790228701a6a4f9.svn-base +++ /dev/null @@ -1,525 +0,0 @@ -/*! - \file server_distribution_description.hpp - \author Ha NGUYEN - \since 04 Jan 2015 - \date 11 Jan 2016 - - \brief Description of index distribution on server(s). - */ - -#include "server_distribution_description.hpp" -#include "exception.hpp" - -namespace xios -{ - /*! - \param [in] globalDimensionSize global dimension of grid - \param [in] nServer number of server - \param [in] serType type of server distribution. For now, we can distribute server by band or plan - */ -CServerDistributionDescription::CServerDistributionDescription(const std::vector& globalDimensionSize, - int nServer, - ServerDistributionType serType) - : nGlobal_(globalDimensionSize), indexBegin_(), dimensionSizes_(), globalIndex_(), - vecGlobalIndex_(), serverType_(serType), nServer_(nServer), positionDimensionDistributed_(1) -{ -} - -CServerDistributionDescription::~CServerDistributionDescription() -{ /* Nothing to do */ } - -int CServerDistributionDescription::defaultDistributedDimension(int gridDimension, - ServerDistributionType serType) -{ - switch (serType) - { - case BAND_DISTRIBUTION: - return ((1 == gridDimension) ? 0 : 1); - break; - default: - break; - } - - MISSING_RETURN( "int CServerDistributionDescription::defaultDistributedDimension(int gridDimension, ServerDistributionType serType)" ); - return -1; -} - -/*! - Compute pre-defined global index distribution of server(s). - \param [in] doComputeGlobalIndex flag to compute global index on each server. By default, false - -*/ -void CServerDistributionDescription::computeServerDistribution(bool doComputeGlobalIndex, - int positionDimensionDistributed) -{ - switch (serverType_) { - case BAND_DISTRIBUTION: - computeBandDistribution(nServer_, positionDimensionDistributed); - break; - default: - break; - } - - if (doComputeGlobalIndex) - { - vecGlobalIndex_.resize(nServer_); - int dim = nGlobal_.size(); - std::vector currentIndex(dim); - - for (int idxServer = 0; idxServer < nServer_; ++idxServer) - { - size_t ssize = 1, idx = 0; - for (int j = 0; j < dim; ++j) ssize *= dimensionSizes_[idxServer][j]; - vecGlobalIndex_[idxServer].resize(ssize); - - std::vector idxLoop(dim,0); - - int innerLoopSize = dimensionSizes_[idxServer][0]; - - while (idx CServerDistributionDescription::computeServerGlobalIndexInRange(const std::pair& indexBeginEnd, - int positionDimensionDistributed) -{ - int nBand = 0; - switch (serverType_) - { - case BAND_DISTRIBUTION: - nBand = computeBandDistribution(nServer_, positionDimensionDistributed); - break; - case ROOT_DISTRIBUTION: - nBand = computeRootDistribution(nServer_); - default: - break; - } - - size_t indexBegin = indexBeginEnd.first; - size_t indexEnd = indexBeginEnd.second; - if (indexBegin > indexEnd) - ERROR("CServerDistributionDescription::computeServerGlobalIndexInRange", - << "Index begin is larger than index end"); - - globalIndex_.rehash(std::ceil((indexEnd-indexBegin+1)/globalIndex_.max_load_factor())); - - int dim = nGlobal_.size(); - std::vector currentIndex(dim); - - for (int idxServer = 0; idxServer < nBand; ++idxServer) - { - size_t ssize = 1, idx = 0; - for (int j = 0; j < dim; ++j) ssize *= dimensionSizes_[idxServer][j]; - - std::vector idxLoop(dim,0); - int innerLoopSize = dimensionSizes_[idxServer][0]; - - while (idx zeroIndexServer(nServer_-nBand); - for (int idxServer = nBand; idxServer < nServer_; ++idxServer) - zeroIndexServer[idxServer-nBand] = idxServer; - - return zeroIndexServer; -} - -/*! - Compute the global index of grid elements (domain, axis) and their associated server rank. - Each client knows the general distribution of servers and from which they can compute the pieces of information to hold - \param [out] indexServerOnElement global index of each element as well as the corresponding server which contains these indices - \param [in] clientRank rank of client - \param [in] clientSize number of client - \param [in] axisDomainOrder the order of element in grid (2 for domain, 1 for axis, 0 for scalar) - \param [in] positionDimensionDistributed dimension of server on which we make the cut. -*/ -std::vector CServerDistributionDescription::computeServerGlobalByElement(std::vector > >& indexServerOnElement, - int clientRank, - int clientSize, - const CArray& axisDomainOrder, - int positionDimensionDistributed) -{ - int nBand = 0; - switch (serverType_) { - case BAND_DISTRIBUTION: - nBand = computeBandDistribution(nServer_, positionDimensionDistributed); - break; - default: - break; - } - - int nbElement = axisDomainOrder.numElements(); - indexServerOnElement.resize(nbElement); - int idx = 0; - std::vector idxMap(nbElement); - for (int i = 0; i < nbElement; ++i) - { - idxMap[i] = idx; - if (2 == axisDomainOrder(i)) idx += 2; - else if (1 == axisDomainOrder(i)) idx += 1; - // nothing for scalar - } - - for (int idxServer = 0; idxServer < nBand; ++idxServer) - { - std::vector elementDimension(4); - for (int i = 0; i < nbElement; ++i) - { - int elementSize = 1; - if (2 == axisDomainOrder(i)) - { - elementSize *= dimensionSizes_[idxServer][idxMap[i]] * dimensionSizes_[idxServer][idxMap[i]+1]; - elementDimension[0] = indexBegin_[idxServer][idxMap[i]]; - elementDimension[1] = indexBegin_[idxServer][idxMap[i]+1]; - elementDimension[2] = dimensionSizes_[idxServer][idxMap[i]]; - elementDimension[3] = dimensionSizes_[idxServer][idxMap[i]+1]; - } - - else if (1 == axisDomainOrder(i)) - { - elementSize *= dimensionSizes_[idxServer][idxMap[i]]; - elementDimension[0] = indexBegin_[idxServer][idxMap[i]]; - elementDimension[1] = 0; - elementDimension[2] = dimensionSizes_[idxServer][idxMap[i]]; - elementDimension[3] = 1; - } - else - { - elementSize *= dimensionSizes_[idxServer][idxMap[i]]; - elementDimension[0] = 0; - elementDimension[1] = 0; - elementDimension[2] = 1; - elementDimension[3] = 1; - } - - int rangeBegin, rangeSize; - computeRangeProcIndex(clientRank, clientSize, elementSize, rangeBegin, rangeSize); - - size_t globalIndexElement; - idx = 0; int idxRange = 0; - for (int k = 0; k < elementDimension[3]; ++k) - for (int l = 0; l < elementDimension[2]; ++l) - { - globalIndexElement = (l+elementDimension[0]) + (k+elementDimension[1])*elementDimension[2]; - if ((rangeBegin <= idx) && (idxRange < rangeSize)) - { - indexServerOnElement[i][globalIndexElement].push_back(idxServer); - ++idxRange; - } - ++idx; - } - } - } - - // List of servers without distribution (cause total number of server is greater than number of bands, for example) - std::vector zeroIndexServer(nServer_-nBand); - for (int idxServer = nBand; idxServer < nServer_; ++idxServer) - zeroIndexServer[idxServer-nBand] = idxServer; - - return zeroIndexServer; -} - -/*! - Compute a range of index on server which a client holds - For a range of index on a specific server, each client can hold a piece of the index range - If the range size is smaller than the number of client, there are some clients holding the same index - \param [in] clientRank rank of client - \param [in] clientSize number of client - \param [in] rangeProcSize index range size - \param [out] rangeBegin begin of range index a client holds - \param [out] rangeSize size of range index a client holds -*/ -void CServerDistributionDescription::computeRangeProcIndex(int clientRank, - int clientSize, - int rangeProcSize, - int& rangeBegin, - int& rangeSize) -{ - if (rangeProcSize < clientSize) - { - int rangeIndex = 0; - for (int idx = 0; idx < clientSize; ++idx) - { - if (idx == clientRank) - { - rangeBegin = rangeIndex; - rangeSize = 1; - } - ++rangeIndex; - if (rangeIndex == rangeProcSize) rangeIndex = 0; - } - return; - } - - int range, indexBegin = 0; - for (int i = 0; i < clientSize; ++i) - { - range = rangeProcSize / clientSize; - if (i < (rangeProcSize%clientSize)) ++range; - if (i == clientRank) break; - indexBegin += range; - } - rangeBegin = indexBegin; - rangeSize = range; -} - -/*! - Compute global index of servers with band distribution - \param [in] nServer number of server -*/ -int CServerDistributionDescription::computeBandDistribution(int nServer, int positionDimensionDistributed) -{ - int dim = nGlobal_.size(); - positionDimensionDistributed_ = positionDimensionDistributed; - if (1 == dim) positionDimensionDistributed_ = 0; - if (positionDimensionDistributed_ > dim) - ERROR("CServerDistributionDescription::computeBandDistribution(int nServer, int positionDimensionDistributed)", - << "Position of distributed dimension is invalid" << std::endl - << "Position of distributed dimension is " << positionDimensionDistributed_ - << "Dimension " << dim) - - indexBegin_.resize(nServer); - dimensionSizes_.resize(nServer); - - for (int i = 0; i< nServer; ++i) - { - indexBegin_[i].resize(dim); - dimensionSizes_[i].resize(dim); - } - - int njRangeSize; - int nGlobTemp = 0; - std::vector njRangeBegin(nServer,0); - std::vector njRangeEnd(nServer,0); - - int positionDistributed = (1 dim) - ERROR("CServerDistributionDescription::computeBandDistribution(int nServer, int positionDimensionDistributed)", - << "Position of distributed dimension is invalid" << std::endl - << "Position of distributed dimension is " << positionDimensionDistributed_ - << "Dimension " << dim) - - indexBegin_.resize(nServer); - dimensionSizes_.resize(nServer); - - for (int i = 0; i< nServer; ++i) - { - indexBegin_[i].resize(dim); - dimensionSizes_[i].resize(dim); - } - - int nGlobTemp = 0; - - int positionDistributed = (1 > CServerDistributionDescription::getServerDimensionSizes() const -{ - return dimensionSizes_; -} - -/*! - Get index begin of each dimension on distributed server - \return index begin of dimensions on server(s) -*/ -std::vector > CServerDistributionDescription::getServerIndexBegin() const -{ - return indexBegin_; -} - -/*! - Get global index on distributed server - \return global index on server(s) -*/ -const std::vector >& CServerDistributionDescription::getGlobalIndex() const -{ - return vecGlobalIndex_; -} - -/*! - Get global index calculated by computeServerGlobalIndexInRange -*/ -const std::unordered_map& CServerDistributionDescription::getGlobalIndexRange() const -{ - return globalIndex_; -} - -int CServerDistributionDescription::getDimensionDistributed() -{ - return ((1 - bool advance(size_t n) ; - - bool advance(size_t n) ; - - template - bool get(T& data) ; - - template - bool get(T* data, size_t n) ; - - template - bool advance_template(size_t n) ; - - template - bool get_template(T& data) ; - - template - bool get_template(T* data, size_t n) ; - - void* ptr(void) ; - void* start(void) {return begin ; } - - - size_t remain(void) ; - size_t count(void) ; -// size_t size(void) ; - size_t bufferSize() ; - ~CBufferIn() ; - - char* begin ; - char* end ; - char* current ; - size_t count_ ; - size_t size_ ; - bool own ; - } ; - -} - -//#include "buffer_in_impl.hpp" - - -#endif diff --git a/xios_2311_src/trunk/.svn/pristine/46/4666cc1e65b763cb5cceee6e20b1dfe371d67fda.svn-base b/xios_2311_src/trunk/.svn/pristine/46/4666cc1e65b763cb5cceee6e20b1dfe371d67fda.svn-base deleted file mode 100644 index 52bfe79d13af2109185aa8ced1e2dd5d5c61b6e1..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/46/4666cc1e65b763cb5cceee6e20b1dfe371d67fda.svn-base +++ /dev/null @@ -1,867 +0,0 @@ -! * ************************************************************************** * -! * Interface auto generated - do not modify * -! * ************************************************************************** * -#include "../fortran/xios_fortran_prefix.hpp" - -MODULE domaingroup_interface_attr - USE, INTRINSIC :: ISO_C_BINDING - - INTERFACE - ! Do not call directly / interface FORTRAN 2003 <-> C99 - - SUBROUTINE cxios_set_domaingroup_area(domaingroup_hdl, area, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - REAL (KIND=C_DOUBLE) , DIMENSION(*) :: area - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_set_domaingroup_area - - SUBROUTINE cxios_get_domaingroup_area(domaingroup_hdl, area, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - REAL (KIND=C_DOUBLE) , DIMENSION(*) :: area - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_get_domaingroup_area - - FUNCTION cxios_is_defined_domaingroup_area(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_area - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_area - - - SUBROUTINE cxios_set_domaingroup_bounds_lat_1d(domaingroup_hdl, bounds_lat_1d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - REAL (KIND=C_DOUBLE) , DIMENSION(*) :: bounds_lat_1d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_set_domaingroup_bounds_lat_1d - - SUBROUTINE cxios_get_domaingroup_bounds_lat_1d(domaingroup_hdl, bounds_lat_1d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - REAL (KIND=C_DOUBLE) , DIMENSION(*) :: bounds_lat_1d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_get_domaingroup_bounds_lat_1d - - FUNCTION cxios_is_defined_domaingroup_bounds_lat_1d(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_bounds_lat_1d - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_bounds_lat_1d - - - SUBROUTINE cxios_set_domaingroup_bounds_lat_2d(domaingroup_hdl, bounds_lat_2d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - REAL (KIND=C_DOUBLE) , DIMENSION(*) :: bounds_lat_2d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_set_domaingroup_bounds_lat_2d - - SUBROUTINE cxios_get_domaingroup_bounds_lat_2d(domaingroup_hdl, bounds_lat_2d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - REAL (KIND=C_DOUBLE) , DIMENSION(*) :: bounds_lat_2d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_get_domaingroup_bounds_lat_2d - - FUNCTION cxios_is_defined_domaingroup_bounds_lat_2d(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_bounds_lat_2d - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_bounds_lat_2d - - - SUBROUTINE cxios_set_domaingroup_bounds_lat_name(domaingroup_hdl, bounds_lat_name, bounds_lat_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: bounds_lat_name - INTEGER (kind = C_INT) , VALUE :: bounds_lat_name_size - END SUBROUTINE cxios_set_domaingroup_bounds_lat_name - - SUBROUTINE cxios_get_domaingroup_bounds_lat_name(domaingroup_hdl, bounds_lat_name, bounds_lat_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: bounds_lat_name - INTEGER (kind = C_INT) , VALUE :: bounds_lat_name_size - END SUBROUTINE cxios_get_domaingroup_bounds_lat_name - - FUNCTION cxios_is_defined_domaingroup_bounds_lat_name(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_bounds_lat_name - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_bounds_lat_name - - - SUBROUTINE cxios_set_domaingroup_bounds_lon_1d(domaingroup_hdl, bounds_lon_1d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - REAL (KIND=C_DOUBLE) , DIMENSION(*) :: bounds_lon_1d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_set_domaingroup_bounds_lon_1d - - SUBROUTINE cxios_get_domaingroup_bounds_lon_1d(domaingroup_hdl, bounds_lon_1d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - REAL (KIND=C_DOUBLE) , DIMENSION(*) :: bounds_lon_1d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_get_domaingroup_bounds_lon_1d - - FUNCTION cxios_is_defined_domaingroup_bounds_lon_1d(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_bounds_lon_1d - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_bounds_lon_1d - - - SUBROUTINE cxios_set_domaingroup_bounds_lon_2d(domaingroup_hdl, bounds_lon_2d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - REAL (KIND=C_DOUBLE) , DIMENSION(*) :: bounds_lon_2d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_set_domaingroup_bounds_lon_2d - - SUBROUTINE cxios_get_domaingroup_bounds_lon_2d(domaingroup_hdl, bounds_lon_2d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - REAL (KIND=C_DOUBLE) , DIMENSION(*) :: bounds_lon_2d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_get_domaingroup_bounds_lon_2d - - FUNCTION cxios_is_defined_domaingroup_bounds_lon_2d(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_bounds_lon_2d - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_bounds_lon_2d - - - SUBROUTINE cxios_set_domaingroup_bounds_lon_name(domaingroup_hdl, bounds_lon_name, bounds_lon_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: bounds_lon_name - INTEGER (kind = C_INT) , VALUE :: bounds_lon_name_size - END SUBROUTINE cxios_set_domaingroup_bounds_lon_name - - SUBROUTINE cxios_get_domaingroup_bounds_lon_name(domaingroup_hdl, bounds_lon_name, bounds_lon_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: bounds_lon_name - INTEGER (kind = C_INT) , VALUE :: bounds_lon_name_size - END SUBROUTINE cxios_get_domaingroup_bounds_lon_name - - FUNCTION cxios_is_defined_domaingroup_bounds_lon_name(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_bounds_lon_name - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_bounds_lon_name - - - SUBROUTINE cxios_set_domaingroup_comment(domaingroup_hdl, comment, comment_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: comment - INTEGER (kind = C_INT) , VALUE :: comment_size - END SUBROUTINE cxios_set_domaingroup_comment - - SUBROUTINE cxios_get_domaingroup_comment(domaingroup_hdl, comment, comment_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: comment - INTEGER (kind = C_INT) , VALUE :: comment_size - END SUBROUTINE cxios_get_domaingroup_comment - - FUNCTION cxios_is_defined_domaingroup_comment(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_comment - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_comment - - - SUBROUTINE cxios_set_domaingroup_data_dim(domaingroup_hdl, data_dim) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - INTEGER (KIND=C_INT) , VALUE :: data_dim - END SUBROUTINE cxios_set_domaingroup_data_dim - - SUBROUTINE cxios_get_domaingroup_data_dim(domaingroup_hdl, data_dim) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - INTEGER (KIND=C_INT) :: data_dim - END SUBROUTINE cxios_get_domaingroup_data_dim - - FUNCTION cxios_is_defined_domaingroup_data_dim(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_data_dim - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_data_dim - - - SUBROUTINE cxios_set_domaingroup_data_i_index(domaingroup_hdl, data_i_index, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - INTEGER (KIND=C_INT) , DIMENSION(*) :: data_i_index - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_set_domaingroup_data_i_index - - SUBROUTINE cxios_get_domaingroup_data_i_index(domaingroup_hdl, data_i_index, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - INTEGER (KIND=C_INT) , DIMENSION(*) :: data_i_index - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_get_domaingroup_data_i_index - - FUNCTION cxios_is_defined_domaingroup_data_i_index(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_data_i_index - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_data_i_index - - - SUBROUTINE cxios_set_domaingroup_data_ibegin(domaingroup_hdl, data_ibegin) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - INTEGER (KIND=C_INT) , VALUE :: data_ibegin - END SUBROUTINE cxios_set_domaingroup_data_ibegin - - SUBROUTINE cxios_get_domaingroup_data_ibegin(domaingroup_hdl, data_ibegin) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - INTEGER (KIND=C_INT) :: data_ibegin - END SUBROUTINE cxios_get_domaingroup_data_ibegin - - FUNCTION cxios_is_defined_domaingroup_data_ibegin(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_data_ibegin - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_data_ibegin - - - SUBROUTINE cxios_set_domaingroup_data_j_index(domaingroup_hdl, data_j_index, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - INTEGER (KIND=C_INT) , DIMENSION(*) :: data_j_index - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_set_domaingroup_data_j_index - - SUBROUTINE cxios_get_domaingroup_data_j_index(domaingroup_hdl, data_j_index, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - INTEGER (KIND=C_INT) , DIMENSION(*) :: data_j_index - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_get_domaingroup_data_j_index - - FUNCTION cxios_is_defined_domaingroup_data_j_index(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_data_j_index - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_data_j_index - - - SUBROUTINE cxios_set_domaingroup_data_jbegin(domaingroup_hdl, data_jbegin) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - INTEGER (KIND=C_INT) , VALUE :: data_jbegin - END SUBROUTINE cxios_set_domaingroup_data_jbegin - - SUBROUTINE cxios_get_domaingroup_data_jbegin(domaingroup_hdl, data_jbegin) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - INTEGER (KIND=C_INT) :: data_jbegin - END SUBROUTINE cxios_get_domaingroup_data_jbegin - - FUNCTION cxios_is_defined_domaingroup_data_jbegin(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_data_jbegin - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_data_jbegin - - - SUBROUTINE cxios_set_domaingroup_data_ni(domaingroup_hdl, data_ni) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - INTEGER (KIND=C_INT) , VALUE :: data_ni - END SUBROUTINE cxios_set_domaingroup_data_ni - - SUBROUTINE cxios_get_domaingroup_data_ni(domaingroup_hdl, data_ni) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - INTEGER (KIND=C_INT) :: data_ni - END SUBROUTINE cxios_get_domaingroup_data_ni - - FUNCTION cxios_is_defined_domaingroup_data_ni(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_data_ni - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_data_ni - - - SUBROUTINE cxios_set_domaingroup_data_nj(domaingroup_hdl, data_nj) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - INTEGER (KIND=C_INT) , VALUE :: data_nj - END SUBROUTINE cxios_set_domaingroup_data_nj - - SUBROUTINE cxios_get_domaingroup_data_nj(domaingroup_hdl, data_nj) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - INTEGER (KIND=C_INT) :: data_nj - END SUBROUTINE cxios_get_domaingroup_data_nj - - FUNCTION cxios_is_defined_domaingroup_data_nj(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_data_nj - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_data_nj - - - SUBROUTINE cxios_set_domaingroup_dim_i_name(domaingroup_hdl, dim_i_name, dim_i_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: dim_i_name - INTEGER (kind = C_INT) , VALUE :: dim_i_name_size - END SUBROUTINE cxios_set_domaingroup_dim_i_name - - SUBROUTINE cxios_get_domaingroup_dim_i_name(domaingroup_hdl, dim_i_name, dim_i_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: dim_i_name - INTEGER (kind = C_INT) , VALUE :: dim_i_name_size - END SUBROUTINE cxios_get_domaingroup_dim_i_name - - FUNCTION cxios_is_defined_domaingroup_dim_i_name(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_dim_i_name - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_dim_i_name - - - SUBROUTINE cxios_set_domaingroup_dim_j_name(domaingroup_hdl, dim_j_name, dim_j_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: dim_j_name - INTEGER (kind = C_INT) , VALUE :: dim_j_name_size - END SUBROUTINE cxios_set_domaingroup_dim_j_name - - SUBROUTINE cxios_get_domaingroup_dim_j_name(domaingroup_hdl, dim_j_name, dim_j_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: dim_j_name - INTEGER (kind = C_INT) , VALUE :: dim_j_name_size - END SUBROUTINE cxios_get_domaingroup_dim_j_name - - FUNCTION cxios_is_defined_domaingroup_dim_j_name(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_dim_j_name - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_dim_j_name - - - SUBROUTINE cxios_set_domaingroup_domain_ref(domaingroup_hdl, domain_ref, domain_ref_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: domain_ref - INTEGER (kind = C_INT) , VALUE :: domain_ref_size - END SUBROUTINE cxios_set_domaingroup_domain_ref - - SUBROUTINE cxios_get_domaingroup_domain_ref(domaingroup_hdl, domain_ref, domain_ref_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: domain_ref - INTEGER (kind = C_INT) , VALUE :: domain_ref_size - END SUBROUTINE cxios_get_domaingroup_domain_ref - - FUNCTION cxios_is_defined_domaingroup_domain_ref(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_domain_ref - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_domain_ref - - - SUBROUTINE cxios_set_domaingroup_group_ref(domaingroup_hdl, group_ref, group_ref_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: group_ref - INTEGER (kind = C_INT) , VALUE :: group_ref_size - END SUBROUTINE cxios_set_domaingroup_group_ref - - SUBROUTINE cxios_get_domaingroup_group_ref(domaingroup_hdl, group_ref, group_ref_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: group_ref - INTEGER (kind = C_INT) , VALUE :: group_ref_size - END SUBROUTINE cxios_get_domaingroup_group_ref - - FUNCTION cxios_is_defined_domaingroup_group_ref(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_group_ref - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_group_ref - - - SUBROUTINE cxios_set_domaingroup_i_index(domaingroup_hdl, i_index, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - INTEGER (KIND=C_INT) , DIMENSION(*) :: i_index - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_set_domaingroup_i_index - - SUBROUTINE cxios_get_domaingroup_i_index(domaingroup_hdl, i_index, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - INTEGER (KIND=C_INT) , DIMENSION(*) :: i_index - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_get_domaingroup_i_index - - FUNCTION cxios_is_defined_domaingroup_i_index(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_i_index - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_i_index - - - SUBROUTINE cxios_set_domaingroup_ibegin(domaingroup_hdl, ibegin) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - INTEGER (KIND=C_INT) , VALUE :: ibegin - END SUBROUTINE cxios_set_domaingroup_ibegin - - SUBROUTINE cxios_get_domaingroup_ibegin(domaingroup_hdl, ibegin) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - INTEGER (KIND=C_INT) :: ibegin - END SUBROUTINE cxios_get_domaingroup_ibegin - - FUNCTION cxios_is_defined_domaingroup_ibegin(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_ibegin - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_ibegin - - - SUBROUTINE cxios_set_domaingroup_j_index(domaingroup_hdl, j_index, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - INTEGER (KIND=C_INT) , DIMENSION(*) :: j_index - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_set_domaingroup_j_index - - SUBROUTINE cxios_get_domaingroup_j_index(domaingroup_hdl, j_index, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - INTEGER (KIND=C_INT) , DIMENSION(*) :: j_index - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_get_domaingroup_j_index - - FUNCTION cxios_is_defined_domaingroup_j_index(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_j_index - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_j_index - - - SUBROUTINE cxios_set_domaingroup_jbegin(domaingroup_hdl, jbegin) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - INTEGER (KIND=C_INT) , VALUE :: jbegin - END SUBROUTINE cxios_set_domaingroup_jbegin - - SUBROUTINE cxios_get_domaingroup_jbegin(domaingroup_hdl, jbegin) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - INTEGER (KIND=C_INT) :: jbegin - END SUBROUTINE cxios_get_domaingroup_jbegin - - FUNCTION cxios_is_defined_domaingroup_jbegin(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_jbegin - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_jbegin - - - SUBROUTINE cxios_set_domaingroup_lat_name(domaingroup_hdl, lat_name, lat_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: lat_name - INTEGER (kind = C_INT) , VALUE :: lat_name_size - END SUBROUTINE cxios_set_domaingroup_lat_name - - SUBROUTINE cxios_get_domaingroup_lat_name(domaingroup_hdl, lat_name, lat_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: lat_name - INTEGER (kind = C_INT) , VALUE :: lat_name_size - END SUBROUTINE cxios_get_domaingroup_lat_name - - FUNCTION cxios_is_defined_domaingroup_lat_name(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_lat_name - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_lat_name - - - SUBROUTINE cxios_set_domaingroup_latvalue_1d(domaingroup_hdl, latvalue_1d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - REAL (KIND=C_DOUBLE) , DIMENSION(*) :: latvalue_1d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_set_domaingroup_latvalue_1d - - SUBROUTINE cxios_get_domaingroup_latvalue_1d(domaingroup_hdl, latvalue_1d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - REAL (KIND=C_DOUBLE) , DIMENSION(*) :: latvalue_1d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_get_domaingroup_latvalue_1d - - FUNCTION cxios_is_defined_domaingroup_latvalue_1d(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_latvalue_1d - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_latvalue_1d - - - SUBROUTINE cxios_set_domaingroup_latvalue_2d(domaingroup_hdl, latvalue_2d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - REAL (KIND=C_DOUBLE) , DIMENSION(*) :: latvalue_2d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_set_domaingroup_latvalue_2d - - SUBROUTINE cxios_get_domaingroup_latvalue_2d(domaingroup_hdl, latvalue_2d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - REAL (KIND=C_DOUBLE) , DIMENSION(*) :: latvalue_2d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_get_domaingroup_latvalue_2d - - FUNCTION cxios_is_defined_domaingroup_latvalue_2d(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_latvalue_2d - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_latvalue_2d - - - SUBROUTINE cxios_set_domaingroup_lon_name(domaingroup_hdl, lon_name, lon_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: lon_name - INTEGER (kind = C_INT) , VALUE :: lon_name_size - END SUBROUTINE cxios_set_domaingroup_lon_name - - SUBROUTINE cxios_get_domaingroup_lon_name(domaingroup_hdl, lon_name, lon_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: lon_name - INTEGER (kind = C_INT) , VALUE :: lon_name_size - END SUBROUTINE cxios_get_domaingroup_lon_name - - FUNCTION cxios_is_defined_domaingroup_lon_name(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_lon_name - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_lon_name - - - SUBROUTINE cxios_set_domaingroup_long_name(domaingroup_hdl, long_name, long_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: long_name - INTEGER (kind = C_INT) , VALUE :: long_name_size - END SUBROUTINE cxios_set_domaingroup_long_name - - SUBROUTINE cxios_get_domaingroup_long_name(domaingroup_hdl, long_name, long_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: long_name - INTEGER (kind = C_INT) , VALUE :: long_name_size - END SUBROUTINE cxios_get_domaingroup_long_name - - FUNCTION cxios_is_defined_domaingroup_long_name(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_long_name - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_long_name - - - SUBROUTINE cxios_set_domaingroup_lonvalue_1d(domaingroup_hdl, lonvalue_1d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - REAL (KIND=C_DOUBLE) , DIMENSION(*) :: lonvalue_1d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_set_domaingroup_lonvalue_1d - - SUBROUTINE cxios_get_domaingroup_lonvalue_1d(domaingroup_hdl, lonvalue_1d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - REAL (KIND=C_DOUBLE) , DIMENSION(*) :: lonvalue_1d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_get_domaingroup_lonvalue_1d - - FUNCTION cxios_is_defined_domaingroup_lonvalue_1d(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_lonvalue_1d - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_lonvalue_1d - - - SUBROUTINE cxios_set_domaingroup_lonvalue_2d(domaingroup_hdl, lonvalue_2d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - REAL (KIND=C_DOUBLE) , DIMENSION(*) :: lonvalue_2d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_set_domaingroup_lonvalue_2d - - SUBROUTINE cxios_get_domaingroup_lonvalue_2d(domaingroup_hdl, lonvalue_2d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - REAL (KIND=C_DOUBLE) , DIMENSION(*) :: lonvalue_2d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_get_domaingroup_lonvalue_2d - - FUNCTION cxios_is_defined_domaingroup_lonvalue_2d(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_lonvalue_2d - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_lonvalue_2d - - - SUBROUTINE cxios_set_domaingroup_mask_1d(domaingroup_hdl, mask_1d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - LOGICAL (KIND=C_BOOL) , DIMENSION(*) :: mask_1d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_set_domaingroup_mask_1d - - SUBROUTINE cxios_get_domaingroup_mask_1d(domaingroup_hdl, mask_1d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - LOGICAL (KIND=C_BOOL) , DIMENSION(*) :: mask_1d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_get_domaingroup_mask_1d - - FUNCTION cxios_is_defined_domaingroup_mask_1d(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_mask_1d - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_mask_1d - - - SUBROUTINE cxios_set_domaingroup_mask_2d(domaingroup_hdl, mask_2d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - LOGICAL (KIND=C_BOOL) , DIMENSION(*) :: mask_2d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_set_domaingroup_mask_2d - - SUBROUTINE cxios_get_domaingroup_mask_2d(domaingroup_hdl, mask_2d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - LOGICAL (KIND=C_BOOL) , DIMENSION(*) :: mask_2d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_get_domaingroup_mask_2d - - FUNCTION cxios_is_defined_domaingroup_mask_2d(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_mask_2d - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_mask_2d - - - SUBROUTINE cxios_set_domaingroup_name(domaingroup_hdl, name, name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: name - INTEGER (kind = C_INT) , VALUE :: name_size - END SUBROUTINE cxios_set_domaingroup_name - - SUBROUTINE cxios_get_domaingroup_name(domaingroup_hdl, name, name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: name - INTEGER (kind = C_INT) , VALUE :: name_size - END SUBROUTINE cxios_get_domaingroup_name - - FUNCTION cxios_is_defined_domaingroup_name(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_name - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_name - - - SUBROUTINE cxios_set_domaingroup_ni(domaingroup_hdl, ni) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - INTEGER (KIND=C_INT) , VALUE :: ni - END SUBROUTINE cxios_set_domaingroup_ni - - SUBROUTINE cxios_get_domaingroup_ni(domaingroup_hdl, ni) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - INTEGER (KIND=C_INT) :: ni - END SUBROUTINE cxios_get_domaingroup_ni - - FUNCTION cxios_is_defined_domaingroup_ni(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_ni - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_ni - - - SUBROUTINE cxios_set_domaingroup_ni_glo(domaingroup_hdl, ni_glo) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - INTEGER (KIND=C_INT) , VALUE :: ni_glo - END SUBROUTINE cxios_set_domaingroup_ni_glo - - SUBROUTINE cxios_get_domaingroup_ni_glo(domaingroup_hdl, ni_glo) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - INTEGER (KIND=C_INT) :: ni_glo - END SUBROUTINE cxios_get_domaingroup_ni_glo - - FUNCTION cxios_is_defined_domaingroup_ni_glo(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_ni_glo - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_ni_glo - - - SUBROUTINE cxios_set_domaingroup_nj(domaingroup_hdl, nj) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - INTEGER (KIND=C_INT) , VALUE :: nj - END SUBROUTINE cxios_set_domaingroup_nj - - SUBROUTINE cxios_get_domaingroup_nj(domaingroup_hdl, nj) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - INTEGER (KIND=C_INT) :: nj - END SUBROUTINE cxios_get_domaingroup_nj - - FUNCTION cxios_is_defined_domaingroup_nj(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_nj - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_nj - - - SUBROUTINE cxios_set_domaingroup_nj_glo(domaingroup_hdl, nj_glo) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - INTEGER (KIND=C_INT) , VALUE :: nj_glo - END SUBROUTINE cxios_set_domaingroup_nj_glo - - SUBROUTINE cxios_get_domaingroup_nj_glo(domaingroup_hdl, nj_glo) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - INTEGER (KIND=C_INT) :: nj_glo - END SUBROUTINE cxios_get_domaingroup_nj_glo - - FUNCTION cxios_is_defined_domaingroup_nj_glo(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_nj_glo - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_nj_glo - - - SUBROUTINE cxios_set_domaingroup_nvertex(domaingroup_hdl, nvertex) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - INTEGER (KIND=C_INT) , VALUE :: nvertex - END SUBROUTINE cxios_set_domaingroup_nvertex - - SUBROUTINE cxios_get_domaingroup_nvertex(domaingroup_hdl, nvertex) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - INTEGER (KIND=C_INT) :: nvertex - END SUBROUTINE cxios_get_domaingroup_nvertex - - FUNCTION cxios_is_defined_domaingroup_nvertex(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_nvertex - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_nvertex - - - SUBROUTINE cxios_set_domaingroup_prec(domaingroup_hdl, prec) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - INTEGER (KIND=C_INT) , VALUE :: prec - END SUBROUTINE cxios_set_domaingroup_prec - - SUBROUTINE cxios_get_domaingroup_prec(domaingroup_hdl, prec) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - INTEGER (KIND=C_INT) :: prec - END SUBROUTINE cxios_get_domaingroup_prec - - FUNCTION cxios_is_defined_domaingroup_prec(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_prec - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_prec - - - SUBROUTINE cxios_set_domaingroup_radius(domaingroup_hdl, radius) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - REAL (KIND=C_DOUBLE) , VALUE :: radius - END SUBROUTINE cxios_set_domaingroup_radius - - SUBROUTINE cxios_get_domaingroup_radius(domaingroup_hdl, radius) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - REAL (KIND=C_DOUBLE) :: radius - END SUBROUTINE cxios_get_domaingroup_radius - - FUNCTION cxios_is_defined_domaingroup_radius(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_radius - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_radius - - - SUBROUTINE cxios_set_domaingroup_standard_name(domaingroup_hdl, standard_name, standard_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: standard_name - INTEGER (kind = C_INT) , VALUE :: standard_name_size - END SUBROUTINE cxios_set_domaingroup_standard_name - - SUBROUTINE cxios_get_domaingroup_standard_name(domaingroup_hdl, standard_name, standard_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: standard_name - INTEGER (kind = C_INT) , VALUE :: standard_name_size - END SUBROUTINE cxios_get_domaingroup_standard_name - - FUNCTION cxios_is_defined_domaingroup_standard_name(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_standard_name - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_standard_name - - - SUBROUTINE cxios_set_domaingroup_type(domaingroup_hdl, type, type_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: type - INTEGER (kind = C_INT) , VALUE :: type_size - END SUBROUTINE cxios_set_domaingroup_type - - SUBROUTINE cxios_get_domaingroup_type(domaingroup_hdl, type, type_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: type - INTEGER (kind = C_INT) , VALUE :: type_size - END SUBROUTINE cxios_get_domaingroup_type - - FUNCTION cxios_is_defined_domaingroup_type(domaingroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_domaingroup_type - INTEGER (kind = C_INTPTR_T), VALUE :: domaingroup_hdl - END FUNCTION cxios_is_defined_domaingroup_type - - END INTERFACE - -END MODULE domaingroup_interface_attr diff --git a/xios_2311_src/trunk/.svn/pristine/46/4678787c6b3ff8d062e8105197f4ad4265a5bfda.svn-base b/xios_2311_src/trunk/.svn/pristine/46/4678787c6b3ff8d062e8105197f4ad4265a5bfda.svn-base deleted file mode 100644 index c2eda7b5df58d79b6395330f45ad9a54d33f35b6..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/46/4678787c6b3ff8d062e8105197f4ad4265a5bfda.svn-base +++ /dev/null @@ -1,11 +0,0 @@ -/* Copyright 2009, UCAR/Unidata and OPeNDAP, Inc. - See the COPYRIGHT file for more information. */ - -#ifndef OCCLIENTPARAMS_H -#define OCCLIENTPARAMS_H - -extern OClist* ocparamdecode(OCstate*); -extern const char* ocparamlookup(OCstate*, const char*); -extern void ocparamset(OCstate*,const char*); - -#endif /*OCCLIENTPARAMS_H*/ diff --git a/xios_2311_src/trunk/.svn/pristine/46/4681e3fc831fd24c56d1655119075183e0e6e0ce.svn-base b/xios_2311_src/trunk/.svn/pristine/46/4681e3fc831fd24c56d1655119075183e0e6e0ce.svn-base deleted file mode 100644 index f6080849530919f9e4e4a88edef609ab358e63c9..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/46/4681e3fc831fd24c56d1655119075183e0e6e0ce.svn-base +++ /dev/null @@ -1,78 +0,0 @@ -#include "model_to_client_source_filter.hpp" -#include "grid.hpp" -#include "exception.hpp" -#include "calendar_util.hpp" -#include -#include "workflow_graph.hpp" - -namespace xios -{ - CModelToClientSourceFilter::CModelToClientSourceFilter(CGarbageCollector& gc, CGrid* grid, bool hasMissingValue, double defaultValue) - : COutputPin(gc) - , grid_(grid) - , hasMissingValue_(hasMissingValue), defaultValue_(defaultValue) - { - if (!grid) - ERROR("CSourceFilter::CSourceFilter(CGrid* grid)", - "Impossible to construct a source filter without providing a grid."); - } - - template - void CModelToClientSourceFilter::streamData(CDate date, const CArray& data) - { - CDataPacketPtr packet(new CDataPacket); - packet->date = date; - packet->timestamp = date; - packet->status = CDataPacket::NO_ERROR; - - auto connector = grid_->getModelToWorkflowConnector() ; - - if (connector->getSrcSize() != data.numElements()) - ERROR("void CModelToClientSourceFilter::streamData(CDate date, const CArray& data)", - << "[ Awaiting data of size = " <getSrcSize() << ", " - << "Received data size = " << data.numElements() << " ] " - << "The data array does not have the right size! " - << "grid = " << grid_->getId()) - const double nanValue = std::numeric_limits::quiet_NaN(); - packet->data.resize(connector->getDstSize()) ; - connector->transfer(data, packet->data, nanValue) ; - - if (hasMissingValue_) - { - const double nanValue = std::numeric_limits::quiet_NaN(); - const size_t nbData = packet->data.numElements(); - for (size_t idx = 0; idx < nbData; ++idx) - if (defaultValue_ == packet->data(idx)) packet->data(idx) = nanValue; - } - - buildWorkflowGraph(packet); - onOutputReady(packet); - } - - void CModelToClientSourceFilter::buildWorkflowGraph(CDataPacketPtr packet) - { - if(this->graphEnabled) - { - this->graphPackage->filterId = CWorkflowGraph::getNodeSize(); - if(!packet->graphPackage) - { - packet->graphPackage = new CGraphDataPackage; - } - packet->graphPackage->fromFilter = this->graphPackage->filterId; - packet->graphPackage->currentField = this->graphPackage->inFields[0]; - CWorkflowGraph::addNode("Model to Client Source filter", 1, false, 0, packet); - } - } - - - - - template void CModelToClientSourceFilter::streamData<1>(CDate date, const CArray& data); - template void CModelToClientSourceFilter::streamData<2>(CDate date, const CArray& data); - template void CModelToClientSourceFilter::streamData<3>(CDate date, const CArray& data); - template void CModelToClientSourceFilter::streamData<4>(CDate date, const CArray& data); - template void CModelToClientSourceFilter::streamData<5>(CDate date, const CArray& data); - template void CModelToClientSourceFilter::streamData<6>(CDate date, const CArray& data); - template void CModelToClientSourceFilter::streamData<7>(CDate date, const CArray& data); - -} // namespace xios diff --git a/xios_2311_src/trunk/.svn/pristine/46/468ccdb07701d53ab5543eb81417c6e067db95a8.svn-base b/xios_2311_src/trunk/.svn/pristine/46/468ccdb07701d53ab5543eb81417c6e067db95a8.svn-base deleted file mode 100644 index e6c6f7ba14c7e365b30628342946a08867516161..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/46/468ccdb07701d53ab5543eb81417c6e067db95a8.svn-base +++ /dev/null @@ -1,94 +0,0 @@ -/*! - \file average.cpp - \author Ha NGUYEN - \since 8 Sep 2016 - \date 9 Jan 2017 - - \brief average reduction - */ -#include "average_reduction.hpp" -#include "utils.hpp" - -namespace xios { - -CAverageReductionAlgorithm::CAverageReductionAlgorithm() - : CReductionAlgorithm(), resetWeight_(true) -{ -} - -CReductionAlgorithm* CAverageReductionAlgorithm::create() -{ - return (new CAverageReductionAlgorithm()); -} - -bool CAverageReductionAlgorithm::registerTrans() -{ - return registerOperation(TRANS_REDUCE_AVERAGE, CAverageReductionAlgorithm::create); -} - -void CAverageReductionAlgorithm::apply(const std::vector >& localIndex, - const double* dataInput, - CArray& dataOut, - std::vector& flagInitial, - bool ignoreMissingValue, bool firstPass) -{ - if (resetWeight_) { weights_.resize(flagInitial.size()); weights_ = 1.0; resetWeight_ = false; } - - if (ignoreMissingValue) - { - int nbLocalIndex = localIndex.size(); - int currentlocalIndex = 0; - double currentWeight = 0.0; - - if (firstPass) dataOut=std::numeric_limits::quiet_NaN(); - - for (int idx = 0; idx < nbLocalIndex; ++idx) - { - currentlocalIndex = localIndex[idx].first; - currentWeight = localIndex[idx].second; - if (!NumTraits::isNan(*(dataInput + idx))) - { - if (flagInitial[currentlocalIndex]) - { - dataOut(currentlocalIndex) = *(dataInput + idx); - flagInitial[currentlocalIndex] = false; - } - else - { - dataOut(currentlocalIndex) += *(dataInput + idx); - weights_(currentlocalIndex) += 1.0; - } - } - } - } - else - { - int nbLocalIndex = localIndex.size(); - int currentlocalIndex = 0; - double currentWeight = 0.0; - for (int idx = 0; idx < nbLocalIndex; ++idx) - { - currentlocalIndex = localIndex[idx].first; - currentWeight = localIndex[idx].second; - - if (flagInitial[currentlocalIndex]) - { - dataOut(currentlocalIndex) = *(dataInput + idx); - flagInitial[currentlocalIndex] = false; - } - else - { - dataOut(currentlocalIndex) += *(dataInput + idx); - weights_(currentlocalIndex) += 1.0; - } - } - } -} - -void CAverageReductionAlgorithm::updateData(CArray& dataOut) -{ - dataOut /= weights_; - resetWeight_ = true; -} - -} diff --git a/xios_2311_src/trunk/.svn/pristine/46/46a0d889807ddbb12a04ef9564e03b729ad80c23.svn-base b/xios_2311_src/trunk/.svn/pristine/46/46a0d889807ddbb12a04ef9564e03b729ad80c23.svn-base deleted file mode 100644 index b8c75b4594bea6fc5e99ca9e44aec00089a7897b..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/46/46a0d889807ddbb12a04ef9564e03b729ad80c23.svn-base +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef __XIOS_SUFFIX__ -#define __XIOS_SUFFIX__ - -#define xios(arg) xios_##arg -#define txios(arg) xios_##arg - -#endif diff --git a/xios_2311_src/trunk/.svn/pristine/46/46b9f433999f62a5b3ba3acb3e066ef7abf789cc.svn-base b/xios_2311_src/trunk/.svn/pristine/46/46b9f433999f62a5b3ba3acb3e066ef7abf789cc.svn-base deleted file mode 100644 index 7b4fa34107c1058984ba9e6323ee2ec77ec4c1ed..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/46/46b9f433999f62a5b3ba3acb3e066ef7abf789cc.svn-base +++ /dev/null @@ -1,30 +0,0 @@ -#include "xios_fortran_prefix.hpp" - -MODULE IREDUCE_DOMAIN_TO_AXIS - USE, INTRINSIC :: ISO_C_BINDING - USE REDUCE_DOMAIN_TO_AXIS_INTERFACE - - TYPE txios(reduce_domain_to_axis) - INTEGER(kind = C_INTPTR_T) :: daddr - END TYPE txios(reduce_domain_to_axis) - - CONTAINS ! Fonctions disponibles pour les utilisateurs. - - SUBROUTINE xios(get_reduce_domain_to_axis_handle)(idt,ret) - IMPLICIT NONE - CHARACTER(len = *), INTENT(IN) :: idt - TYPE(txios(reduce_domain_to_axis)) , INTENT(OUT):: ret - CALL cxios_reduce_domain_to_axis_handle_create(ret%daddr, idt, len(idt)) - END SUBROUTINE xios(get_reduce_domain_to_axis_handle) - - LOGICAL FUNCTION xios(is_valid_reduce_domain_to_axis)(idt) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: idt - LOGICAL (kind = 1) :: val - - CALL cxios_reduce_domain_to_axis_valid_id(val, idt, len(idt)) - xios(is_valid_reduce_domain_to_axis) = val - - END FUNCTION xios(is_valid_reduce_domain_to_axis) - -END MODULE IREDUCE_DOMAIN_TO_AXIS diff --git a/xios_2311_src/trunk/.svn/pristine/47/473818dfb5983fa6ea3a6b52554cf92dbaa4cb9a.svn-base b/xios_2311_src/trunk/.svn/pristine/47/473818dfb5983fa6ea3a6b52554cf92dbaa4cb9a.svn-base deleted file mode 100644 index 876def71c53ed4743b9784dfa7bfd220f040a2db..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/47/473818dfb5983fa6ea3a6b52554cf92dbaa4cb9a.svn-base +++ /dev/null @@ -1,366 +0,0 @@ -#ifndef __XIOS_CDomain__ -#define __XIOS_CDomain__ - -/// XIOS headers /// -#include "xios_spl.hpp" -#include "group_factory.hpp" - -#include "declare_group.hpp" -#include "declare_ref_func.hpp" -#include "event_client.hpp" -#include "event_server.hpp" -#include "buffer_in.hpp" -#include "array_new.hpp" -#include "attribute_array.hpp" -#include "attribute_enum.hpp" -#include "transformation.hpp" -#include "transformation_enum.hpp" -#include "transformation_path.hpp" -#include "server_distribution_description.hpp" -#include "mesh.hpp" -#include "element.hpp" -#include "local_connector.hpp" -#include "scatterer_connector.hpp" -#include "gatherer_connector.hpp" -#include "distribution_type.hpp" -#include "generic_algorithm_transformation.hpp" - - -namespace xios -{ - - /// ////////////////////// Déclarations ////////////////////// /// - - class CDomainGroup; - class CDomainAttributes; - class CDomain; - class CFile; - class CField ; - - ///-------------------------------------------------------------- - - // Declare/Define CDomainAttribute - BEGIN_DECLARE_ATTRIBUTE_MAP(CDomain) -# include "domain_attribute.conf" -# include "domain_attribute_private.conf" - END_DECLARE_ATTRIBUTE_MAP(CDomain) - - ///-------------------------------------------------------------- - - class CDomain - : public CObjectTemplate - , public CDomainAttributes - { - /// typedef /// - typedef CObjectTemplate SuperClass; - typedef CDomainAttributes SuperClassAttribute; - public: - enum EEventId - { - EVENT_ID_DOMAIN_DISTRIBUTION, EVENT_ID_SEND_DISTRIBUTED_ATTRIBUTE - } ; - - public: - - typedef CDomainAttributes RelAttributes; - typedef CDomainGroup RelGroup; - - /// Constructeurs /// - CDomain(void); - explicit CDomain(const StdString & id); - CDomain(const CDomain & domain); // Not implemented yet. - CDomain(const CDomain * const domain); // Not implemented yet. - static void releaseStaticAllocation(void) ; // release static allocation on heap - - static CDomain* createDomain(); - static CDomain* get(const string& id, bool noError=false) ; //::TransformationMapTypes TransMapTypes; - private: - static bool initializeTransformationMap(std::map& m); - static std::map transformationMapList_; - static bool dummyTransformationMapList_; - TransMapTypes transformationMap_; - - public: - CTransformation* addTransformation(ETranformationType transType, const StdString& id=""); - CTransformation* addTransformation(ETranformationType transType, CTransformation* transformation) ; - void setTransformations(const TransMapTypes&); - void duplicateTransformation(CDomain*); - TransMapTypes getAllTransformations(); - bool hasTransformation(); - void solveInheritanceTransformation_old(); // to remove later - void solveInheritanceTransformation(); - private: - bool solveInheritanceTransformation_done_= false ; - public: - bool activateFieldWorkflow(CGarbageCollector& gc) ; - private: - bool activateFieldWorkflow_done_=false ; - - private: - shared_ptr transformationAlgorithm_ = nullptr ; - public: - void setTransformationAlgorithm(shared_ptr transformationAlgorithm) { transformationAlgorithm_=transformationAlgorithm ;} - shared_ptr getTransformationAlgorithm(void) { return transformationAlgorithm_ ;} - private: - CTransformationPaths transformationPaths_ ; - public: - CTransformationPaths getTransformationPaths(void) {return transformationPaths_;} - void setTransformationPaths(const CTransformationPaths& transformationPaths) { transformationPaths_=transformationPaths ;} - - //////////////////////////// - - void redistribute(int nbLocalDomain); - - public: - const std::set & getRelFiles(void) const; - bool IsWritten(const StdString & filename) const; - bool isWrittenCompressed(const StdString& filename) const; - - std::map getAttributesBufferSize(CContextClient* client, bool bufferForWriting = false); - - bool isEmpty(void) const; - bool isDistributed(void) const; - - public : - /*! - \brief return if the domain can be written or not in a compressed way. - ie if there are some masked or indexed point on the domain. Valid only on server side. - \return true if domain can be writtedn in a compressed way - */ - bool isCompressible(void) { if (!isCompressibleComputed_) computeIsCompressible() ; return isCompressible_ ;} - private : - bool isCompressible_ ; /** specify if the domain can be written in a compressed way */ - bool isCompressibleComputed_=false ; /** Indicate if compressability has been computed*/ - void computeIsCompressible() ; - - public : - bool isEqual(CDomain* domain); - - static bool dispatchEvent(CEventServer& event); - - private: - /** define if the domain is completed or not ie all attributes have been received before in case - of grid reading from file or coupling */ - bool isCompleted_=true ; - public: - /*! - \brief Check if a domain is completed - Before make any domain processing, we must be sure that all domain informations have - been sent, for exemple when reading a grid in a file or when grid elements are sent by an - other context (coupling). So all direct reference of the domain (domain_ref) must be also completed - \return true if domain and domain reference are completed - */ - bool isCompleted(void) - { - if (hasDirectDomainReference()) if (!getDirectDomainReference()->isCompleted()) return false; - else return isCompleted_ ; - - MISSING_RETURN( "bool CDomain::isCompleted() " ); - return true; - } - void setCompleted(void) { isCompleted_=true ; } - void unsetCompleted(void) { isCompleted_=false ; } - - public: - /// Mutateur /// - void addRelFile(const StdString & filename); - void addRelFileCompressed(const StdString& filename); - - void AllgatherRectilinearLonLat(CArray& lon, CArray& lat, - CArray& lon_g, CArray& lat_g); - - void fillInRectilinearBoundLonLat(CArray& lon, CArray& lat, - CArray& boundsLon, CArray& boundsLat); - - void fillInLonLat(); - bool distributionAttributesHaveValue() const; - - size_t getGlobalWrittenSize() ; - /// Destructeur /// - virtual ~CDomain(void); - - /// Accesseurs statiques /// - static StdString GetName(void); - static StdString GetDefName(void); - - static ENodeType GetType(void); - - public: - CArray lonvalue, latvalue; - CArray bounds_lonvalue, bounds_latvalue; - CArray areavalue; - - - CArray domainMask; // mask_1d, mask_2d -> domainMask - CArray localMask; // domainMask + indexing - bool isCurvilinear ; - bool hasBounds ; - bool hasArea; - bool hasLonLat; - bool hasPole ; - bool hasLatInReadFile_ ; // specify if latitude is defined on read file, so it can be read later when grid distribution will be defined - bool hasBoundsLatInReadFile_ ; // specify if latitude boundarues are defined on read file, so it can be read later when grid distribution will be defined - bool hasLonInReadFile_ ; // specify if longitude is defined on read file, so it can be read later when grid distribution will be defined - bool hasBoundsLonInReadFile_ ; // specify if longitude boundaries are defined on read file, so it can be read later when grid distribution will be defined - - void computeLocalMask(void) ; - - /** The number of server of a context client. Avoid to re-compute indice computed in a previous computeConnectedClient */ - private: std::set listNbServer_ ; - - private: - void checkDomain(void); - void checkLocalIDomain(void); - void checkLocalJDomain(void); - - void checkMask(void); - void checkDomainData(void); - void checkCompression(void); - - void checkBounds(void); - void checkArea(void); - void checkLonLat(); - - public: - void sendDomainToFileServer(CContextClient* client) ; - private: - std::set sendDomainToFileServer_done_ ; - public: - void sendDomainToCouplerOut(CContextClient* client, const string& fieldId, int posInGrid) ; - private: - std::set sendDomainToCouplerOut_done_ ; - - public: - void makeAliasForCoupling(const string& fieldId, int posInGrid) ; - string getCouplingAlias(const string& fieldId, int posInGrid) ; - private: - - void convertLonLatValue(); - void fillInRectilinearLonLat(); - void fillInCurvilinearLonLat(); - void fillInUnstructuredLonLat(); - void completeLonLatClient(void); - - - private: - -/** Clients that have to send a domain. There can be multiple clients in case of secondary server, otherwise only one client. */ - std::list clients; - std::set clientsSet; - - bool isChecked ; - std::set relFiles, relFilesCompressed; - -/** only on client side : Global index of each client sent to server: map> - indSrv_[nbServers] --> first map is related to the server distribution (ie associated with the contextClient) - indSrv_[nbServers][server_rank] -> array of global index sent to the server of rank "server_rank" - indSrv_[nbServers][server_rank](ind) --> global index on server of the local element "ind" sent (for lon, lat, mask, etc...) -*/ - std::map > > indSrv_; - - std::map > connectedServerRank_; - - bool isRedistributed_; - bool isUnstructed_; - - - ////////////////////////////////////////////////////////////////////////////////////// - // this part is related to distribution, element definition, views and connectors // - ////////////////////////////////////////////////////////////////////////////////////// - private: - shared_ptr localElement_ = nullptr ; - void initializeLocalElement(void) ; - - public: - shared_ptr getLocalElement(void) { if (localElement_==nullptr) initializeLocalElement() ; return localElement_ ; } - shared_ptr getLocalView(CElementView::type type) { return getLocalElement()->getView(type) ;} - - private: - void addFullView(void) ; - void addWorkflowView(void) ; - void addModelView(void) ; - - private: - shared_ptr modelToWorkflowConnector_ ; - void computeModelToWorkflowConnector(void) ; - public: - shared_ptr getModelToWorkflowConnector(void) { if (modelToWorkflowConnector_==nullptr) computeModelToWorkflowConnector() ; return modelToWorkflowConnector_ ;} - - public: - void computeRemoteElement(CContextClient* client, EDistributionType) ; - void distributeToServer(CContextClient* client, std::map>& globalIndexOut, std::map>& globalIndexIn, - shared_ptr &scattererConnector, const string& domainId="") ; - - static void recvDomainDistribution(CEventServer& event) ; - void receivedDomainDistribution(CEventServer& event, int phasis) ; - - void sendDistributedAttributes(CContextClient* client, shared_ptr scaterrerConnector, const string& domainId) ; - static void recvDistributedAttributes(CEventServer& event) ; - void recvDistributedAttributes(CEventServer& event, const string& type) ; - void setServerMask(CArray& serverMask, CContextClient* client) ; - - private: - map> remoteElement_ ; - public: - shared_ptr getRemoteElement(CContextClient* client) {return remoteElement_[client] ;} - private: - map> clientToServerConnector_ ; - public: - shared_ptr getClientToServerConnector(CContextClient* client) { return clientToServerConnector_[client] ;} - - private: - shared_ptr gathererConnector_ ; - public: - shared_ptr getGathererConnector(void) { return gathererConnector_ ;} - private: - shared_ptr serverFromClientConnector_ ; - shared_ptr elementFrom_ ; - public: - shared_ptr getServerFromClientConnector(void) { return serverFromClientConnector_ ;} - - private: - shared_ptr serverToClientConnector_ = nullptr ; - shared_ptr elementTo_ ; - public: - shared_ptr getServerToClientConnector(void) { return serverToClientConnector_ ;} - - private: - map> clientFromServerConnector_ ; - public: - shared_ptr getClientFromServerConnector(CContextClient* client) { return clientFromServerConnector_[client] ;} - - - DECLARE_REF_FUNC(Domain,domain) - - }; // class CDomain - - ///-------------------------------------------------------------- - - // Declare/Define CDomainGroup and CDomainDefinition - DECLARE_GROUP(CDomain); - - ///-------------------------------------------------------------- - -} // namespace xios - -#endif //__XIOS_CDomain__ diff --git a/xios_2311_src/trunk/.svn/pristine/47/4778d7d9f895ed156d13ea13bb352b1491145729.svn-base b/xios_2311_src/trunk/.svn/pristine/47/4778d7d9f895ed156d13ea13bb352b1491145729.svn-base deleted file mode 100644 index 89f59f35b7a44d1552cbdbe212c390241c49185e..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/47/4778d7d9f895ed156d13ea13bb352b1491145729.svn-base +++ /dev/null @@ -1,76 +0,0 @@ -#include "grid_algorithm_generic.hpp" -#include "grid_elements.hpp" -#include "grid_local_view.hpp" -#include "grid.hpp" -#include "algo_types.hpp" -#include "context.hpp" -#include "transform_filter.hpp" - -namespace xios -{ - - CGridAlgorithmGeneric::CGridAlgorithmGeneric(CGrid* gridSrc, CGrid* gridDst, int pos, shared_ptr algo) - : CGridAlgorithm(algo), gridSrc_(gridSrc), gridDst_(gridDst), pos_(pos) - { - } - - void CGridAlgorithmGeneric::computeAlgorithm(bool eliminateRedondant) - { - shared_ptr gridSrcElements = gridSrc_->getGridLocalElements() ; - shared_ptr gridDstElements = gridDst_->getGridLocalElements() ; - - shared_ptr srcView = gridSrcElements->getView(CElementView::WORKFLOW) ; - shared_ptr dstView = gridDstElements->getView(CElementView::WORKFLOW) ; - MPI_Comm comm = CContext::getCurrent()->getIntraComm() ; - int commSize = CContext::getCurrent()->getIntraCommSize() ; - int commRank = CContext::getCurrent()->getIntraCommRank() ; - - auto& elements = gridSrcElements->getElements() ; - int nElements = elements.size() ; - vector> remoteElements(nElements) ; - vector> remoteViews(nElements) ; - for(int i=0;igetRecvElement() ; - else - { - CArray globalIndexView ; - srcView->getView(i)->getGlobalIndexView(globalIndexView) ; - remoteElements[i] = make_shared(commRank, srcView->getView(i)->getGlobalSize(),globalIndexView) ; - remoteElements[i]->addFullView() ; - if (i>pos_) dimBefore_ *= srcView->getView(i)->getSize() ; - else dimAfter_ *= srcView->getView(i)->getSize() ; - - } - remoteViews[i] = remoteElements[i] -> getView(CElementView::FULL); - } - - gridTransformConnector_ = make_shared(srcView->getViews(), remoteViews, comm ) ; - gridTransformConnector_->computeConnector(eliminateRedondant) ; - - } - - void CGridAlgorithmGeneric::apply(const CArray& dataIn, CArray& dataOut) - { - CArray dataOutTmp ; - gridTransformConnector_->transfer(dataIn, dataOutTmp) ; - algorithm_->apply(dimBefore_, dimAfter_, dataOutTmp, dataOut) ; - } - - void CGridAlgorithmGeneric::apply(const CArray& dataIn, const vector>& auxData, CArray& dataOut) - { - CArray dataOutTmp ; - vector> auxDataOutTmp(auxData.size()) ; - - gridTransformConnector_->transfer(dataIn, dataOutTmp) ; - for (int i=0; itransformAuxField(i)) gridTransformConnector_->transfer(auxData[i], auxDataOutTmp[i]) ; - else auxDataOutTmp[i].reference(auxData[i]) ; - } - - algorithm_->apply(dimBefore_, dimAfter_, dataOutTmp, auxDataOutTmp, dataOut) ; - } - - -} \ No newline at end of file diff --git a/xios_2311_src/trunk/.svn/pristine/47/47944676339bb1b1c3fd522ac982aae3c945b0bb.svn-base b/xios_2311_src/trunk/.svn/pristine/47/47944676339bb1b1c3fd522ac982aae3c945b0bb.svn-base deleted file mode 100644 index cbf37e844524229e005496ca4948b4f98d32b395..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/47/47944676339bb1b1c3fd522ac982aae3c945b0bb.svn-base +++ /dev/null @@ -1,10 +0,0 @@ -module load compilerwrappers/no -module load netcdf/mpi/4.2.1 -module load hdf5/mpi/1.8.9 - -export NETCDF_INC=/bglocal/cn/pub/NetCDF/4.2.1/mpi/include -export NETCDF_LIB=/bglocal/cn/pub/NetCDF/4.2.1/mpi/lib - -export HDF5_INC=/bglocal/cn/pub/HDF5/1.8.9/par/include -export HDF5_LIB=/bglocal/cn/pub/HDF5/1.8.9/par/lib -export ZLIB=/bglocal/cn/pub/zlib/1.2.8/lib diff --git a/xios_2311_src/trunk/.svn/pristine/47/47a7202cca96cb18ec8512626637cceb9c7e5e6b.svn-base b/xios_2311_src/trunk/.svn/pristine/47/47a7202cca96cb18ec8512626637cceb9c7e5e6b.svn-base deleted file mode 100644 index 6b874380726e3555e9853a568fe0fce4b19b6188..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/47/47a7202cca96cb18ec8512626637cceb9c7e5e6b.svn-base +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - true - 50 - - - - memory - 1.0 - - - - 100 - true - - - - - diff --git a/xios_2311_src/trunk/.svn/pristine/48/481777edccf6e5254f65ed191497cd3278d9e44c.svn-base b/xios_2311_src/trunk/.svn/pristine/48/481777edccf6e5254f65ed191497cd3278d9e44c.svn-base deleted file mode 100644 index 2a9fa7ad3e224058b91e64876f7ca2b762da0fad..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/48/481777edccf6e5254f65ed191497cd3278d9e44c.svn-base +++ /dev/null @@ -1,7 +0,0 @@ -#all -xios_client_0.mem -xios_client_1.mem -xios_client_2.mem -xios_client_3.mem -xios_server_4.mem -xios_server_5.mem diff --git a/xios_2311_src/trunk/.svn/pristine/48/486ae2034c55dff0aa3e80d49619bc8951ee19c9.svn-base b/xios_2311_src/trunk/.svn/pristine/48/486ae2034c55dff0aa3e80d49619bc8951ee19c9.svn-base deleted file mode 100644 index 853ab8272bd952bad49d4dceaca22cc4d09b5dd7..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/48/486ae2034c55dff0aa3e80d49619bc8951ee19c9.svn-base +++ /dev/null @@ -1,36 +0,0 @@ -/* - * rc.h - * - * Created on: Mar 5, 2009 - * Author: rikki - */ - -#ifndef RC_H_ -#define RC_H_ - -/* Max .dodsrc line size */ -#define MAXRCLINESIZE 2048 - -/* Max number of triples in a .dodsrc */ -#define MAXRCLINES 2048 - -/* Create a triple store for (url,key,value) and sorted by url */ - -/* Actual triple store */ -extern struct OCTriplestore { - int ntriples; - struct OCTriple { - char url[MAXRCLINESIZE]; - char key[MAXRCLINESIZE]; - char value[MAXRCLINESIZE]; - } triples[MAXRCLINES]; -} *ocdodsrc; - -extern int ocdodsrc_read(char* basename,char *in_file_name); -extern int ocdodsrc_process(OCstate* state); -extern char* ocdodsrc_lookup(char* key, char* url); - -extern int occredentials_in_url(const char *url); -extern int ocextract_credentials(const char *url, char **name, char **pw, char **result_url); - -#endif /* RC_H_ */ diff --git a/xios_2311_src/trunk/.svn/pristine/49/4955ffab97f8a3133612c1ae1abee0511396cadc.svn-base b/xios_2311_src/trunk/.svn/pristine/49/4955ffab97f8a3133612c1ae1abee0511396cadc.svn-base deleted file mode 100644 index c12fb218d98c2c62822ea97fbbb350e03e17b411..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/49/4955ffab97f8a3133612c1ae1abee0511396cadc.svn-base +++ /dev/null @@ -1,11 +0,0 @@ -#include "memory.hpp" -#include "exception.hpp" - -namespace xios -{ - - void noMemory(void) - { - ERROR("void noMemory(void)",<<"Out of memory") ; - } -} diff --git a/xios_2311_src/trunk/.svn/pristine/49/496e600c037ee79ae80b7e9271be93b5a2a3c594.svn-base b/xios_2311_src/trunk/.svn/pristine/49/496e600c037ee79ae80b7e9271be93b5a2a3c594.svn-base deleted file mode 100644 index c16402f2498f0aadd8afc33649be2e5d79932851..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/49/496e600c037ee79ae80b7e9271be93b5a2a3c594.svn-base +++ /dev/null @@ -1,19 +0,0 @@ -NETCDF_INCDIR="-I $NETCDF_INC_DIR" -NETCDF_LIBDIR="-L $NETCDF_LIB_DIR" -NETCDF_LIB="-lnetcdff -lnetcdf" - -MPI_INCDIR="" -MPI_LIBDIR="" -MPI_LIB="-lcurl" - -HDF5_INCDIR="-I $HDF5_INC_DIR" -HDF5_LIBDIR="-L $HDF5_LIB_DIR" -HDF5_LIB="-lhdf5_hl -lhdf5 -lhdf5 -lz" - -BOOST_INCDIR="-I $BOOST_INC_DIR" -BOOST_LIBDIR="-L $BOOST_LIB_DIR" -BOOST_LIB="" - -OASIS_INCDIR="-I$PWD/../../oasis3-mct/BLD/build/lib/psmile.MPI1" -OASIS_LIBDIR="-L$PWD/../../oasis3-mct/BLD/lib" -OASIS_LIB="-lpsmile.MPI1 -lscrip -lmct -lmpeu" diff --git a/xios_2311_src/trunk/.svn/pristine/49/49b40d9394f64ecd84b65f1928d457c2fedebe04.svn-base b/xios_2311_src/trunk/.svn/pristine/49/49b40d9394f64ecd84b65f1928d457c2fedebe04.svn-base deleted file mode 100644 index 9d69f08d84757200faf7c8aed69d58556d317a98..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/49/49b40d9394f64ecd84b65f1928d457c2fedebe04.svn-base +++ /dev/null @@ -1,301 +0,0 @@ -! * ************************************************************************** * -! * Interface auto generated - do not modify * -! * ************************************************************************** * -#include "../fortran/xios_fortran_prefix.hpp" - -MODULE scalar_interface_attr - USE, INTRINSIC :: ISO_C_BINDING - - INTERFACE - ! Do not call directly / interface FORTRAN 2003 <-> C99 - - SUBROUTINE cxios_set_scalar_axis_type(scalar_hdl, axis_type, axis_type_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: axis_type - INTEGER (kind = C_INT) , VALUE :: axis_type_size - END SUBROUTINE cxios_set_scalar_axis_type - - SUBROUTINE cxios_get_scalar_axis_type(scalar_hdl, axis_type, axis_type_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: axis_type - INTEGER (kind = C_INT) , VALUE :: axis_type_size - END SUBROUTINE cxios_get_scalar_axis_type - - FUNCTION cxios_is_defined_scalar_axis_type(scalar_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_scalar_axis_type - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - END FUNCTION cxios_is_defined_scalar_axis_type - - - SUBROUTINE cxios_set_scalar_bounds(scalar_hdl, bounds, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - REAL (KIND=C_DOUBLE) , DIMENSION(*) :: bounds - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_set_scalar_bounds - - SUBROUTINE cxios_get_scalar_bounds(scalar_hdl, bounds, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - REAL (KIND=C_DOUBLE) , DIMENSION(*) :: bounds - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_get_scalar_bounds - - FUNCTION cxios_is_defined_scalar_bounds(scalar_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_scalar_bounds - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - END FUNCTION cxios_is_defined_scalar_bounds - - - SUBROUTINE cxios_set_scalar_bounds_name(scalar_hdl, bounds_name, bounds_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: bounds_name - INTEGER (kind = C_INT) , VALUE :: bounds_name_size - END SUBROUTINE cxios_set_scalar_bounds_name - - SUBROUTINE cxios_get_scalar_bounds_name(scalar_hdl, bounds_name, bounds_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: bounds_name - INTEGER (kind = C_INT) , VALUE :: bounds_name_size - END SUBROUTINE cxios_get_scalar_bounds_name - - FUNCTION cxios_is_defined_scalar_bounds_name(scalar_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_scalar_bounds_name - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - END FUNCTION cxios_is_defined_scalar_bounds_name - - - SUBROUTINE cxios_set_scalar_comment(scalar_hdl, comment, comment_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: comment - INTEGER (kind = C_INT) , VALUE :: comment_size - END SUBROUTINE cxios_set_scalar_comment - - SUBROUTINE cxios_get_scalar_comment(scalar_hdl, comment, comment_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: comment - INTEGER (kind = C_INT) , VALUE :: comment_size - END SUBROUTINE cxios_get_scalar_comment - - FUNCTION cxios_is_defined_scalar_comment(scalar_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_scalar_comment - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - END FUNCTION cxios_is_defined_scalar_comment - - - SUBROUTINE cxios_set_scalar_label(scalar_hdl, label, label_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: label - INTEGER (kind = C_INT) , VALUE :: label_size - END SUBROUTINE cxios_set_scalar_label - - SUBROUTINE cxios_get_scalar_label(scalar_hdl, label, label_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: label - INTEGER (kind = C_INT) , VALUE :: label_size - END SUBROUTINE cxios_get_scalar_label - - FUNCTION cxios_is_defined_scalar_label(scalar_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_scalar_label - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - END FUNCTION cxios_is_defined_scalar_label - - - SUBROUTINE cxios_set_scalar_long_name(scalar_hdl, long_name, long_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: long_name - INTEGER (kind = C_INT) , VALUE :: long_name_size - END SUBROUTINE cxios_set_scalar_long_name - - SUBROUTINE cxios_get_scalar_long_name(scalar_hdl, long_name, long_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: long_name - INTEGER (kind = C_INT) , VALUE :: long_name_size - END SUBROUTINE cxios_get_scalar_long_name - - FUNCTION cxios_is_defined_scalar_long_name(scalar_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_scalar_long_name - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - END FUNCTION cxios_is_defined_scalar_long_name - - - SUBROUTINE cxios_set_scalar_mask(scalar_hdl, mask) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - LOGICAL (KIND=C_BOOL) , VALUE :: mask - END SUBROUTINE cxios_set_scalar_mask - - SUBROUTINE cxios_get_scalar_mask(scalar_hdl, mask) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - LOGICAL (KIND=C_BOOL) :: mask - END SUBROUTINE cxios_get_scalar_mask - - FUNCTION cxios_is_defined_scalar_mask(scalar_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_scalar_mask - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - END FUNCTION cxios_is_defined_scalar_mask - - - SUBROUTINE cxios_set_scalar_name(scalar_hdl, name, name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: name - INTEGER (kind = C_INT) , VALUE :: name_size - END SUBROUTINE cxios_set_scalar_name - - SUBROUTINE cxios_get_scalar_name(scalar_hdl, name, name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: name - INTEGER (kind = C_INT) , VALUE :: name_size - END SUBROUTINE cxios_get_scalar_name - - FUNCTION cxios_is_defined_scalar_name(scalar_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_scalar_name - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - END FUNCTION cxios_is_defined_scalar_name - - - SUBROUTINE cxios_set_scalar_positive(scalar_hdl, positive, positive_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: positive - INTEGER (kind = C_INT) , VALUE :: positive_size - END SUBROUTINE cxios_set_scalar_positive - - SUBROUTINE cxios_get_scalar_positive(scalar_hdl, positive, positive_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: positive - INTEGER (kind = C_INT) , VALUE :: positive_size - END SUBROUTINE cxios_get_scalar_positive - - FUNCTION cxios_is_defined_scalar_positive(scalar_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_scalar_positive - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - END FUNCTION cxios_is_defined_scalar_positive - - - SUBROUTINE cxios_set_scalar_prec(scalar_hdl, prec) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - INTEGER (KIND=C_INT) , VALUE :: prec - END SUBROUTINE cxios_set_scalar_prec - - SUBROUTINE cxios_get_scalar_prec(scalar_hdl, prec) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - INTEGER (KIND=C_INT) :: prec - END SUBROUTINE cxios_get_scalar_prec - - FUNCTION cxios_is_defined_scalar_prec(scalar_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_scalar_prec - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - END FUNCTION cxios_is_defined_scalar_prec - - - SUBROUTINE cxios_set_scalar_scalar_ref(scalar_hdl, scalar_ref, scalar_ref_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: scalar_ref - INTEGER (kind = C_INT) , VALUE :: scalar_ref_size - END SUBROUTINE cxios_set_scalar_scalar_ref - - SUBROUTINE cxios_get_scalar_scalar_ref(scalar_hdl, scalar_ref, scalar_ref_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: scalar_ref - INTEGER (kind = C_INT) , VALUE :: scalar_ref_size - END SUBROUTINE cxios_get_scalar_scalar_ref - - FUNCTION cxios_is_defined_scalar_scalar_ref(scalar_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_scalar_scalar_ref - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - END FUNCTION cxios_is_defined_scalar_scalar_ref - - - SUBROUTINE cxios_set_scalar_standard_name(scalar_hdl, standard_name, standard_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: standard_name - INTEGER (kind = C_INT) , VALUE :: standard_name_size - END SUBROUTINE cxios_set_scalar_standard_name - - SUBROUTINE cxios_get_scalar_standard_name(scalar_hdl, standard_name, standard_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: standard_name - INTEGER (kind = C_INT) , VALUE :: standard_name_size - END SUBROUTINE cxios_get_scalar_standard_name - - FUNCTION cxios_is_defined_scalar_standard_name(scalar_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_scalar_standard_name - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - END FUNCTION cxios_is_defined_scalar_standard_name - - - SUBROUTINE cxios_set_scalar_unit(scalar_hdl, unit, unit_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: unit - INTEGER (kind = C_INT) , VALUE :: unit_size - END SUBROUTINE cxios_set_scalar_unit - - SUBROUTINE cxios_get_scalar_unit(scalar_hdl, unit, unit_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: unit - INTEGER (kind = C_INT) , VALUE :: unit_size - END SUBROUTINE cxios_get_scalar_unit - - FUNCTION cxios_is_defined_scalar_unit(scalar_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_scalar_unit - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - END FUNCTION cxios_is_defined_scalar_unit - - - SUBROUTINE cxios_set_scalar_value(scalar_hdl, value) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - REAL (KIND=C_DOUBLE) , VALUE :: value - END SUBROUTINE cxios_set_scalar_value - - SUBROUTINE cxios_get_scalar_value(scalar_hdl, value) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - REAL (KIND=C_DOUBLE) :: value - END SUBROUTINE cxios_get_scalar_value - - FUNCTION cxios_is_defined_scalar_value(scalar_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_scalar_value - INTEGER (kind = C_INTPTR_T), VALUE :: scalar_hdl - END FUNCTION cxios_is_defined_scalar_value - - END INTERFACE - -END MODULE scalar_interface_attr diff --git a/xios_2311_src/trunk/.svn/pristine/49/49e51a0f415ad7111b5c84ef18e024635b7d2cf5.svn-base b/xios_2311_src/trunk/.svn/pristine/49/49e51a0f415ad7111b5c84ef18e024635b7d2cf5.svn-base deleted file mode 100644 index 3b893ff4a4e968e5b163bb9406d459a6dce5669d..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/49/49e51a0f415ad7111b5c84ef18e024635b7d2cf5.svn-base +++ /dev/null @@ -1,265 +0,0 @@ -! * ************************************************************************** * -! * Interface auto generated - do not modify * -! * ************************************************************************** * -#include "../fortran/xios_fortran_prefix.hpp" - -MODULE gridgroup_interface_attr - USE, INTRINSIC :: ISO_C_BINDING - - INTERFACE - ! Do not call directly / interface FORTRAN 2003 <-> C99 - - SUBROUTINE cxios_set_gridgroup_comment(gridgroup_hdl, comment, comment_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: gridgroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: comment - INTEGER (kind = C_INT) , VALUE :: comment_size - END SUBROUTINE cxios_set_gridgroup_comment - - SUBROUTINE cxios_get_gridgroup_comment(gridgroup_hdl, comment, comment_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: gridgroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: comment - INTEGER (kind = C_INT) , VALUE :: comment_size - END SUBROUTINE cxios_get_gridgroup_comment - - FUNCTION cxios_is_defined_gridgroup_comment(gridgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_gridgroup_comment - INTEGER (kind = C_INTPTR_T), VALUE :: gridgroup_hdl - END FUNCTION cxios_is_defined_gridgroup_comment - - - SUBROUTINE cxios_set_gridgroup_description(gridgroup_hdl, description, description_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: gridgroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: description - INTEGER (kind = C_INT) , VALUE :: description_size - END SUBROUTINE cxios_set_gridgroup_description - - SUBROUTINE cxios_get_gridgroup_description(gridgroup_hdl, description, description_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: gridgroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: description - INTEGER (kind = C_INT) , VALUE :: description_size - END SUBROUTINE cxios_get_gridgroup_description - - FUNCTION cxios_is_defined_gridgroup_description(gridgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_gridgroup_description - INTEGER (kind = C_INTPTR_T), VALUE :: gridgroup_hdl - END FUNCTION cxios_is_defined_gridgroup_description - - - SUBROUTINE cxios_set_gridgroup_group_ref(gridgroup_hdl, group_ref, group_ref_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: gridgroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: group_ref - INTEGER (kind = C_INT) , VALUE :: group_ref_size - END SUBROUTINE cxios_set_gridgroup_group_ref - - SUBROUTINE cxios_get_gridgroup_group_ref(gridgroup_hdl, group_ref, group_ref_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: gridgroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: group_ref - INTEGER (kind = C_INT) , VALUE :: group_ref_size - END SUBROUTINE cxios_get_gridgroup_group_ref - - FUNCTION cxios_is_defined_gridgroup_group_ref(gridgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_gridgroup_group_ref - INTEGER (kind = C_INTPTR_T), VALUE :: gridgroup_hdl - END FUNCTION cxios_is_defined_gridgroup_group_ref - - - SUBROUTINE cxios_set_gridgroup_mask_0d(gridgroup_hdl, mask_0d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: gridgroup_hdl - LOGICAL (KIND=C_BOOL) , DIMENSION(*) :: mask_0d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_set_gridgroup_mask_0d - - SUBROUTINE cxios_get_gridgroup_mask_0d(gridgroup_hdl, mask_0d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: gridgroup_hdl - LOGICAL (KIND=C_BOOL) , DIMENSION(*) :: mask_0d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_get_gridgroup_mask_0d - - FUNCTION cxios_is_defined_gridgroup_mask_0d(gridgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_gridgroup_mask_0d - INTEGER (kind = C_INTPTR_T), VALUE :: gridgroup_hdl - END FUNCTION cxios_is_defined_gridgroup_mask_0d - - - SUBROUTINE cxios_set_gridgroup_mask_1d(gridgroup_hdl, mask_1d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: gridgroup_hdl - LOGICAL (KIND=C_BOOL) , DIMENSION(*) :: mask_1d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_set_gridgroup_mask_1d - - SUBROUTINE cxios_get_gridgroup_mask_1d(gridgroup_hdl, mask_1d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: gridgroup_hdl - LOGICAL (KIND=C_BOOL) , DIMENSION(*) :: mask_1d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_get_gridgroup_mask_1d - - FUNCTION cxios_is_defined_gridgroup_mask_1d(gridgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_gridgroup_mask_1d - INTEGER (kind = C_INTPTR_T), VALUE :: gridgroup_hdl - END FUNCTION cxios_is_defined_gridgroup_mask_1d - - - SUBROUTINE cxios_set_gridgroup_mask_2d(gridgroup_hdl, mask_2d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: gridgroup_hdl - LOGICAL (KIND=C_BOOL) , DIMENSION(*) :: mask_2d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_set_gridgroup_mask_2d - - SUBROUTINE cxios_get_gridgroup_mask_2d(gridgroup_hdl, mask_2d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: gridgroup_hdl - LOGICAL (KIND=C_BOOL) , DIMENSION(*) :: mask_2d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_get_gridgroup_mask_2d - - FUNCTION cxios_is_defined_gridgroup_mask_2d(gridgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_gridgroup_mask_2d - INTEGER (kind = C_INTPTR_T), VALUE :: gridgroup_hdl - END FUNCTION cxios_is_defined_gridgroup_mask_2d - - - SUBROUTINE cxios_set_gridgroup_mask_3d(gridgroup_hdl, mask_3d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: gridgroup_hdl - LOGICAL (KIND=C_BOOL) , DIMENSION(*) :: mask_3d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_set_gridgroup_mask_3d - - SUBROUTINE cxios_get_gridgroup_mask_3d(gridgroup_hdl, mask_3d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: gridgroup_hdl - LOGICAL (KIND=C_BOOL) , DIMENSION(*) :: mask_3d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_get_gridgroup_mask_3d - - FUNCTION cxios_is_defined_gridgroup_mask_3d(gridgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_gridgroup_mask_3d - INTEGER (kind = C_INTPTR_T), VALUE :: gridgroup_hdl - END FUNCTION cxios_is_defined_gridgroup_mask_3d - - - SUBROUTINE cxios_set_gridgroup_mask_4d(gridgroup_hdl, mask_4d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: gridgroup_hdl - LOGICAL (KIND=C_BOOL) , DIMENSION(*) :: mask_4d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_set_gridgroup_mask_4d - - SUBROUTINE cxios_get_gridgroup_mask_4d(gridgroup_hdl, mask_4d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: gridgroup_hdl - LOGICAL (KIND=C_BOOL) , DIMENSION(*) :: mask_4d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_get_gridgroup_mask_4d - - FUNCTION cxios_is_defined_gridgroup_mask_4d(gridgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_gridgroup_mask_4d - INTEGER (kind = C_INTPTR_T), VALUE :: gridgroup_hdl - END FUNCTION cxios_is_defined_gridgroup_mask_4d - - - SUBROUTINE cxios_set_gridgroup_mask_5d(gridgroup_hdl, mask_5d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: gridgroup_hdl - LOGICAL (KIND=C_BOOL) , DIMENSION(*) :: mask_5d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_set_gridgroup_mask_5d - - SUBROUTINE cxios_get_gridgroup_mask_5d(gridgroup_hdl, mask_5d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: gridgroup_hdl - LOGICAL (KIND=C_BOOL) , DIMENSION(*) :: mask_5d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_get_gridgroup_mask_5d - - FUNCTION cxios_is_defined_gridgroup_mask_5d(gridgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_gridgroup_mask_5d - INTEGER (kind = C_INTPTR_T), VALUE :: gridgroup_hdl - END FUNCTION cxios_is_defined_gridgroup_mask_5d - - - SUBROUTINE cxios_set_gridgroup_mask_6d(gridgroup_hdl, mask_6d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: gridgroup_hdl - LOGICAL (KIND=C_BOOL) , DIMENSION(*) :: mask_6d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_set_gridgroup_mask_6d - - SUBROUTINE cxios_get_gridgroup_mask_6d(gridgroup_hdl, mask_6d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: gridgroup_hdl - LOGICAL (KIND=C_BOOL) , DIMENSION(*) :: mask_6d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_get_gridgroup_mask_6d - - FUNCTION cxios_is_defined_gridgroup_mask_6d(gridgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_gridgroup_mask_6d - INTEGER (kind = C_INTPTR_T), VALUE :: gridgroup_hdl - END FUNCTION cxios_is_defined_gridgroup_mask_6d - - - SUBROUTINE cxios_set_gridgroup_mask_7d(gridgroup_hdl, mask_7d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: gridgroup_hdl - LOGICAL (KIND=C_BOOL) , DIMENSION(*) :: mask_7d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_set_gridgroup_mask_7d - - SUBROUTINE cxios_get_gridgroup_mask_7d(gridgroup_hdl, mask_7d, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: gridgroup_hdl - LOGICAL (KIND=C_BOOL) , DIMENSION(*) :: mask_7d - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_get_gridgroup_mask_7d - - FUNCTION cxios_is_defined_gridgroup_mask_7d(gridgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_gridgroup_mask_7d - INTEGER (kind = C_INTPTR_T), VALUE :: gridgroup_hdl - END FUNCTION cxios_is_defined_gridgroup_mask_7d - - - SUBROUTINE cxios_set_gridgroup_name(gridgroup_hdl, name, name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: gridgroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: name - INTEGER (kind = C_INT) , VALUE :: name_size - END SUBROUTINE cxios_set_gridgroup_name - - SUBROUTINE cxios_get_gridgroup_name(gridgroup_hdl, name, name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: gridgroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: name - INTEGER (kind = C_INT) , VALUE :: name_size - END SUBROUTINE cxios_get_gridgroup_name - - FUNCTION cxios_is_defined_gridgroup_name(gridgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_gridgroup_name - INTEGER (kind = C_INTPTR_T), VALUE :: gridgroup_hdl - END FUNCTION cxios_is_defined_gridgroup_name - - END INTERFACE - -END MODULE gridgroup_interface_attr diff --git a/xios_2311_src/trunk/.svn/pristine/49/49ee4eed86a11969a8236763e1df8fa6fa3da94e.svn-base b/xios_2311_src/trunk/.svn/pristine/49/49ee4eed86a11969a8236763e1df8fa6fa3da94e.svn-base deleted file mode 100644 index b80b9435a27e3599f41c10859c2e0f6d45bb7f31..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/49/49ee4eed86a11969a8236763e1df8fa6fa3da94e.svn-base +++ /dev/null @@ -1,595 +0,0 @@ -/* - * Copyright 1996, University Corporation for Atmospheric Research - * See netcdf/COPYRIGHT file for copying and redistribution conditions. - */ - -#include "config.h" -#include -#include -#include -#include -#ifdef _MSC_VER /* Microsoft Compilers */ -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_FCNTL_H -#include -#endif -#include "nc.h" - -#undef DEBUG - -#ifdef DEBUG -#include -#endif - -#include - -#ifndef MAP_ANONYMOUS -# ifdef MAP_ANON -# define MAP_ANONYMOUS MAP_ANON -# endif -#endif - -/* !MAP_ANONYMOUS => !HAVE_MMAP */ -#ifndef MAP_ANONYMOUS -#error mmap not fully implemented: missing MAP_ANONYMOUS -#endif - -#ifdef HAVE_MMAP - /* This is conditionalized by __USE_GNU ; why? */ - extern void *mremap(void*,size_t,size_t,int); -# ifndef MREMAP_MAYMOVE -# define MREMAP_MAYMOVE 1 -# endif -#endif /*HAVE_MMAP*/ - -#ifndef HAVE_SSIZE_T -#define ssize_t int -#endif - -#ifndef SEEK_SET -#define SEEK_SET 0 -#define SEEK_CUR 1 -#define SEEK_END 2 -#endif - -/* Define the mode flags for create: let umask decide */ -#define OPENMODE 0666 - -#include "ncio.h" -#include "fbits.h" -#include "rnd.h" - -/* #define INSTRUMENT 1 */ -#if INSTRUMENT /* debugging */ -#undef NDEBUG -#include -/*#include "instr.h"*/ -#endif - -#ifndef MMAP_MAXBLOCKSIZE -#define MMAP_MAXBLOCKSIZE 268435456 /* sanity check, about X_SIZE_T_MAX/8 */ -#endif - -#undef MIN /* system may define MIN somewhere and complain */ -#define MIN(mm,nn) (((mm) < (nn)) ? (mm) : (nn)) - -#if !defined(NDEBUG) && !defined(X_INT_MAX) -#define X_INT_MAX 2147483647 -#endif - -#if 0 /* !defined(NDEBUG) && !defined(X_ALIGN) */ -#define X_ALIGN 4 -#else -#undef X_ALIGN -#endif - -/* Private data for mmap */ - -typedef struct NCMMAPIO { - int locked; /* => we cannot realloc */ - int persist; /* => save to a file; triggered by NC_WRITE */ - char* memory; - off_t alloc; - off_t size; - off_t pos; - int mapfd; -} NCMMAPIO; - -/* Forward */ -static int mmapio_rel(ncio *const nciop, off_t offset, int rflags); -static int mmapio_get(ncio *const nciop, off_t offset, size_t extent, int rflags, void **const vpp); -static int mmapio_move(ncio *const nciop, off_t to, off_t from, size_t nbytes, int rflags); -static int mmapio_sync(ncio *const nciop); -static int mmapio_filesize(ncio* nciop, off_t* filesizep); -static int mmapio_pad_length(ncio* nciop, off_t length); -static int mmapio_close(ncio* nciop, int); - -/* Mnemonic */ -#define DOOPEN 1 - -static long pagesize = 0; - -/* Create a new ncio struct to hold info about the file. */ -static int -mmapio_new(const char* path, int ioflags, off_t initialsize, ncio** nciopp, NCMMAPIO** mmapp) -{ - int status = NC_NOERR; - ncio* nciop = NULL; - NCMMAPIO* mmapio = NULL; - int openfd = -1; - - if(pagesize == 0) { -#if defined HAVE_SYSCONF - pagesize = sysconf(_SC_PAGE_SIZE); -#elif defined HAVE_GETPAGESIZE - pagesize = getpagesize(); -#else - pagesize = 4096; /* good guess */ -#endif - } - - errno = 0; - - /* Always force the allocated size to be a multiple of pagesize */ - if(initialsize == 0) initialsize = pagesize; - if((initialsize % pagesize) != 0) - initialsize += (pagesize - (initialsize % pagesize)); - - nciop = (ncio* )calloc(1,sizeof(ncio)); - if(nciop == NULL) {status = NC_ENOMEM; goto fail;} - - nciop->ioflags = ioflags; - *((int*)&nciop->fd) = -1; /* caller will fix */ - - *((char**)&nciop->path) = strdup(path); - if(nciop->path == NULL) {status = NC_ENOMEM; goto fail;} - - *((ncio_relfunc**)&nciop->rel) = mmapio_rel; - *((ncio_getfunc**)&nciop->get) = mmapio_get; - *((ncio_movefunc**)&nciop->move) = mmapio_move; - *((ncio_syncfunc**)&nciop->sync) = mmapio_sync; - *((ncio_filesizefunc**)&nciop->filesize) = mmapio_filesize; - *((ncio_pad_lengthfunc**)&nciop->pad_length) = mmapio_pad_length; - *((ncio_closefunc**)&nciop->close) = mmapio_close; - - mmapio = (NCMMAPIO*)calloc(1,sizeof(NCMMAPIO)); - if(mmapio == NULL) {status = NC_ENOMEM; goto fail;} - *((void* *)&nciop->pvt) = mmapio; - - mmapio->alloc = initialsize; - - mmapio->memory = NULL; - mmapio->size = 0; - mmapio->pos = 0; - mmapio->persist = fIsSet(ioflags,NC_WRITE); - - /* See if ok to use mmap */ - if(sizeof(void*) < 8 && fIsSet(ioflags,NC_64BIT_OFFSET)) - return NC_DISKLESS; /* cannot support */ - mmapio->mapfd = -1; - - if(nciopp) *nciopp = nciop; - if(mmapp) *mmapp = mmapio; - -done: - if(openfd >= 0) close(openfd); - return status; - -fail: - if(nciop != NULL) { - if(nciop->path != NULL) free((char*)nciop->path); - } - goto done; -} - -/* Create a file, and the ncio struct to go with it. This function is - only called from nc__create_mp. - - path - path of file to create. - ioflags - flags from nc_create - initialsz - From the netcdf man page: "The argument - Iinitialsize sets the initial size of the file at creation time." - igeto - - igetsz - - sizehintp - the size of a page of data for buffered reads and writes. - nciopp - pointer to a pointer that will get location of newly - created and inited ncio struct. - mempp - pointer to pointer to the initial memory read. -*/ -int -mmapio_create(const char* path, int ioflags, - size_t initialsz, - off_t igeto, size_t igetsz, size_t* sizehintp, - ncio* *nciopp, void** const mempp) -{ - ncio* nciop; - int fd; - int status; - NCMMAPIO* mmapio = NULL; - int persist = (ioflags & NC_WRITE?1:0); - int oflags; - - if(path == NULL ||* path == 0) - return NC_EINVAL; - - /* For diskless open has, the file must be classic version 1 or 2.*/ - if(fIsSet(ioflags,NC_NETCDF4)) - return NC_EDISKLESS; /* violates constraints */ - - status = mmapio_new(path, ioflags, initialsz, &nciop, &mmapio); - if(status != NC_NOERR) - return status; - mmapio->size = 0; - - if(!persist) { - mmapio->mapfd = -1; - mmapio->memory = (char*)mmap(NULL,mmapio->alloc, - PROT_READ|PROT_WRITE, - MAP_PRIVATE|MAP_ANONYMOUS, - mmapio->mapfd,0); - {mmapio->memory[0] = 0;} /* test writing of the mmap'd memory */ - } else { /*persist */ - /* Open the file, but make sure we can write it if needed */ - oflags = (persist ? O_RDWR : O_RDONLY); -#ifdef O_BINARY - fSet(oflags, O_BINARY); -#endif - oflags |= (O_CREAT|O_TRUNC); - if(fIsSet(ioflags,NC_NOCLOBBER)) - oflags |= O_EXCL; -#ifdef vms - fd = open(path, oflags, 0, "ctx=stm"); -#else - fd = open(path, oflags, OPENMODE); -#endif - if(fd < 0) {status = errno; goto unwind_open;} - mmapio->mapfd = fd; - - { /* Cause the output file to have enough allocated space */ - lseek(fd,mmapio->alloc-1,SEEK_SET); /* cause file to appear */ - write(fd,"",mmapio->alloc); - lseek(fd,0,SEEK_SET); /* rewind */ - } - mmapio->memory = (char*)mmap(NULL,mmapio->alloc, - PROT_READ|PROT_WRITE, - MAP_SHARED, - mmapio->mapfd,0); - if(mmapio->memory == NULL) { - return NC_EDISKLESS; - } - } /*!persist*/ - -#ifdef DEBUG -fprintf(stderr,"mmap_create: initial memory: %lu/%lu\n",(unsigned long)mmapio->memory,(unsigned long)mmapio->alloc); -#endif - - fd = nc__pseudofd(); - *((int* )&nciop->fd) = fd; - - fSet(nciop->ioflags, NC_WRITE); - - if(igetsz != 0) - { - status = nciop->get(nciop, - igeto, igetsz, - RGN_WRITE, - mempp); - if(status != NC_NOERR) - goto unwind_open; - } - - /* Pick a default sizehint */ - if(sizehintp) *sizehintp = pagesize; - - *nciopp = nciop; - return NC_NOERR; - -unwind_open: - mmapio_close(nciop,1); - return status; -} - -/* This function opens the data file. It is only called from nc.c, - from nc__open_mp and nc_delete_mp. - - path - path of data file. - ioflags - flags passed into nc_open. - igeto - looks like this function can do an initial page get, and - igeto is going to be the offset for that. But it appears to be - unused - igetsz - the size in bytes of initial page get (a.k.a. extent). Not - ever used in the library. - sizehintp - the size of a page of data for buffered reads and writes. - nciopp - pointer to pointer that will get address of newly created - and inited ncio struct. - mempp - pointer to pointer to the initial memory read. -*/ -int -mmapio_open(const char* path, - int ioflags, - off_t igeto, size_t igetsz, size_t* sizehintp, - ncio* *nciopp, void** const mempp) -{ - ncio* nciop; - int fd; - int status; - int persist = (fIsSet(ioflags,NC_WRITE)?1:0); - int oflags; - NCMMAPIO* mmapio = NULL; - size_t sizehint; - off_t filesize; - - if(path == NULL ||* path == 0) - return EINVAL; - - assert(sizehintp != NULL); - sizehint = *sizehintp; - - /* Open the file, but make sure we can write it if needed */ - oflags = (persist ? O_RDWR : O_RDONLY); -#ifdef O_BINARY - fSet(oflags, O_BINARY); -#endif - oflags |= O_EXCL; -#ifdef vms - fd = open(path, oflags, 0, "ctx=stm"); -#else - fd = open(path, oflags, OPENMODE); -#endif - if(fd < 0) {status = errno; goto unwind_open;} - - /* get current filesize = max(|file|,initialize)*/ - filesize = lseek(fd,0,SEEK_END); - if(filesize < 0) {status = errno; goto unwind_open;} - /* move pointer back to beginning of file */ - (void)lseek(fd,0,SEEK_SET); - if(filesize < (off_t)sizehint) - filesize = (off_t)sizehint; - - status = mmapio_new(path, ioflags, filesize, &nciop, &mmapio); - if(status != NC_NOERR) - return status; - mmapio->size = filesize; - - mmapio->mapfd = fd; - mmapio->memory = (char*)mmap(NULL,mmapio->alloc, - persist?(PROT_READ|PROT_WRITE):(PROT_READ), - MAP_SHARED, - mmapio->mapfd,0); -#ifdef DEBUG -fprintf(stderr,"mmapio_open: initial memory: %lu/%lu\n",(unsigned long)mmapio->memory,(unsigned long)mmapio->alloc); -#endif - - /* Use half the filesize as the blocksize */ - sizehint = filesize/2; - - fd = nc__pseudofd(); - *((int* )&nciop->fd) = fd; - - if(igetsz != 0) - { - status = nciop->get(nciop, - igeto, igetsz, - 0, - mempp); - if(status != NC_NOERR) - goto unwind_open; - } - - *sizehintp = sizehint; - *nciopp = nciop; - return NC_NOERR; - -unwind_open: - mmapio_close(nciop,0); - return status; -} - - -/* - * Get file size in bytes. - */ -static int -mmapio_filesize(ncio* nciop, off_t* filesizep) -{ - NCMMAPIO* mmapio; - if(nciop == NULL || nciop->pvt == NULL) return NC_EINVAL; - mmapio = (NCMMAPIO*)nciop->pvt; - if(filesizep != NULL) *filesizep = mmapio->size; - return NC_NOERR; -} - -/* - * Sync any changes to disk, then truncate or extend file so its size - * is length. This is only intended to be called before close, if the - * file is open for writing and the actual size does not match the - * calculated size, perhaps as the result of having been previously - * written in NOFILL mode. - */ -static int -mmapio_pad_length(ncio* nciop, off_t length) -{ - NCMMAPIO* mmapio; - if(nciop == NULL || nciop->pvt == NULL) return NC_EINVAL; - mmapio = (NCMMAPIO*)nciop->pvt; - - if(!fIsSet(nciop->ioflags, NC_WRITE)) - return EPERM; /* attempt to write readonly file*/ - - if(mmapio->locked > 0) - return NC_EDISKLESS; - - if(length > mmapio->alloc) { - /* Realloc the allocated memory to a multiple of the pagesize*/ - off_t newsize = length; - void* newmem = NULL; - /* Round to a multiple of pagesize */ - if((newsize % pagesize) != 0) - newsize += (pagesize - (newsize % pagesize)); - - /* Force file size to be properly extended */ - { /* Cause the output file to have enough allocated space */ - off_t pos = lseek(mmapio->mapfd,0,SEEK_CUR); /* save current position*/ - /* cause file to be extended in size */ - lseek(mmapio->mapfd,newsize-1,SEEK_SET); - write(mmapio->mapfd,"",mmapio->alloc); - lseek(mmapio->mapfd,pos,SEEK_SET); /* reset position */ - } - - newmem = (char*)mremap(mmapio->memory,mmapio->alloc,newsize,MREMAP_MAYMOVE); - if(newmem == NULL) return NC_ENOMEM; - -#ifdef DEBUG -fprintf(stderr,"realloc: %lu/%lu -> %lu/%lu\n", -(unsigned long)mmapio->memory,(unsigned long)mmapio->alloc, -(unsigned long)newmem,(unsigned long)newsize); -#endif - mmapio->memory = newmem; - mmapio->alloc = newsize; - } - mmapio->size = length; - return NC_NOERR; -} - -/* Write out any dirty buffers to disk and - ensure that next read will get data from disk. - Sync any changes, then close the open file associated with the ncio - struct, and free its memory. - nciop - pointer to ncio to close. - doUnlink - if true, unlink file -*/ - -static int -mmapio_close(ncio* nciop, int doUnlink) -{ - int status = NC_NOERR; - NCMMAPIO* mmapio; - if(nciop == NULL || nciop->pvt == NULL) return NC_NOERR; - - mmapio = (NCMMAPIO*)nciop->pvt; - assert(mmapio != NULL); - - /* Since we are using mmap, persisting to a file should be automatic */ - status = munmap(mmapio->memory,mmapio->alloc); - mmapio->memory = NULL; /* so we do not try to free it */ - - /* Close file if it was open */ - if(mmapio->mapfd >= 0) - close(mmapio->mapfd); - - /* do cleanup */ - if(mmapio != NULL) free(mmapio); - if(nciop->path != NULL) free((char*)nciop->path); - free(nciop); - return status; -} - -static int -guarantee(ncio* nciop, off_t endpoint) -{ - NCMMAPIO* mmapio = (NCMMAPIO*)nciop->pvt; - if(endpoint > mmapio->alloc) { - /* extend the allocated memory and size */ - int status = mmapio_pad_length(nciop,endpoint); - if(status != NC_NOERR) return status; - } - if(mmapio->size < endpoint) - mmapio->size = endpoint; - return NC_NOERR; -} - -/* - * Request that the region (offset, extent) - * be made available through *vpp. - */ -static int -mmapio_get(ncio* const nciop, off_t offset, size_t extent, int rflags, void** const vpp) -{ - int status = NC_NOERR; - NCMMAPIO* mmapio; - if(nciop == NULL || nciop->pvt == NULL) return NC_EINVAL; - mmapio = (NCMMAPIO*)nciop->pvt; - status = guarantee(nciop, offset+extent); - mmapio->locked++; - if(status != NC_NOERR) return status; - if(vpp) *vpp = mmapio->memory+offset; - return NC_NOERR; -} - -/* - * Like memmove(), safely move possibly overlapping data. - */ -static int -mmapio_move(ncio* const nciop, off_t to, off_t from, size_t nbytes, int ignored) -{ - int status = NC_NOERR; - NCMMAPIO* mmapio; - - if(nciop == NULL || nciop->pvt == NULL) return NC_EINVAL; - mmapio = (NCMMAPIO*)nciop->pvt; - if(from < to) { - /* extend if "to" is not currently allocated */ - status = guarantee(nciop,to+nbytes); - if(status != NC_NOERR) return status; - } - /* check for overlap */ - if((to + nbytes) > from || (from + nbytes) > to) { - /* Ranges overlap */ -#ifdef HAVE_MEMMOVE - memmove((void*)(mmapio->memory+to),(void*)(mmapio->memory+from),nbytes); -#else - off_t overlap; - off_t nbytes1; - if((from + nbytes) > to) { - overlap = ((from + nbytes) - to); /* # bytes of overlap */ - nbytes1 = (nbytes - overlap); /* # bytes of non-overlap */ - /* move the non-overlapping part */ - memcpy((void*)(mmapio->memory+(to+overlap)), - (void*)(mmapio->memory+(from+overlap)), - nbytes1); - /* move the overlapping part */ - memcpy((void*)(mmapio->memory+to), - (void*)(mmapio->memory+from), - overlap); - } else { /*((to + nbytes) > from) */ - overlap = ((to + nbytes) - from); /* # bytes of overlap */ - nbytes1 = (nbytes - overlap); /* # bytes of non-overlap */ - /* move the non-overlapping part */ - memcpy((void*)(mmapio->memory+to), - (void*)(mmapio->memory+from), - nbytes1); - /* move the overlapping part */ - memcpy((void*)(mmapio->memory+(to+nbytes1)), - (void*)(mmapio->memory+(from+nbytes1)), - overlap); - } -#endif - } else {/* no overlap */ - memcpy((void*)(mmapio->memory+to),(void*)(mmapio->memory+from),nbytes); - } - return status; -} - -static int -mmapio_rel(ncio* const nciop, off_t offset, int rflags) -{ - NCMMAPIO* mmapio; - if(nciop == NULL || nciop->pvt == NULL) return NC_EINVAL; - mmapio = (NCMMAPIO*)nciop->pvt; - mmapio->locked--; - return NC_NOERR; /* do nothing */ -} - -/* - * Write out any dirty buffers to disk and - * ensure that next read will get data from disk. - */ -static int -mmapio_sync(ncio* const nciop) -{ - return NC_NOERR; /* do nothing */ -} diff --git a/xios_2311_src/trunk/.svn/pristine/4a/4a7eede576709ddffdb4fe541973534614801692.svn-base b/xios_2311_src/trunk/.svn/pristine/4a/4a7eede576709ddffdb4fe541973534614801692.svn-base deleted file mode 100644 index 652f680821709f6771bf3a245aacba2c2f158497..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/4a/4a7eede576709ddffdb4fe541973534614801692.svn-base +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef __XIOS_FILE_READER_SOURCE_FILTER_HPP__ -#define __XIOS_FILE_READER_SOURCE_FILTER_HPP__ - -#include "output_pin.hpp" - -namespace xios -{ - class CField; - class CFile ; - class CGrid ; - - /*! - * A source filter is the entry point of the data in the graph of filters. - */ - class CFileReaderSourceFilter : public COutputPin - { - public: - /*! - * Constructs a source filter accepting data attached to the specified grid. - * - * \param gc the garbage collector associated with this filter - * \param field the field to which the data is related - */ - CFileReaderSourceFilter(CGarbageCollector& gc, CField* field); - - /*! - * Transforms the data received from the model into a packet and send it - * in the filter graph. The array containing the data can safely be reused - * immediately after this method returns. - * - * \param date the date associated to the data - * \param data an array containing the data - */ - void streamData(void); - void initialize(void) ; - void readData(CArray& data) ; - - private: - CGrid* grid_; //!< The grid attached to the data the filter can accept - CField* field_ ; - CFile* file_ ; - bool hasScaleFactor_ = false; - bool hasAddOffset_ = false ; - bool isInitialized_ = false ; - bool isCyclic_ = false ; - double scaleFactor_= 1.0 ; - double addOffset_= 0. ; - int nStepMax_ ; - int nStep_ ; - - }; // class CFileReaderSourceFilter -} // namespace xios - -#endif // __XIOS_FILE_READER_SOURCE_FILTER_HPP__ \ No newline at end of file diff --git a/xios_2311_src/trunk/.svn/pristine/4a/4a7f905135555408f37508ff4dede0a6ddd4bb4c.svn-base b/xios_2311_src/trunk/.svn/pristine/4a/4a7f905135555408f37508ff4dede0a6ddd4bb4c.svn-base deleted file mode 100644 index 50e4ce56f75e3f7839f25331386e414eab002ef0..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/4a/4a7f905135555408f37508ff4dede0a6ddd4bb4c.svn-base +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef __XIOS_CXMLParser__ -#define __XIOS_CXMLParser__ - -/// XIOS headers /// -#include "xios_spl.hpp" -#include "exception.hpp" -#include "cxios.hpp" -#include "xml_node.hpp" - - -namespace xios -{ - namespace xml - { - /// ////////////////////// Déclarations ////////////////////// /// - class CXMLParser - { - public : - - static void ParseFile(const StdString & filename, const std::set& parseList = std::set()); - static void ParseString(const StdString & xmlContent); - static void ParseStream(StdIStream & stream, const string& fluxId, const std::set& parseList); - template - static void ParseInclude(StdIStream & stream, const string& fluxId, T & object); - - }; //class CXMLParser -/* - template - void CXMLParser::ParseInclude(StdIStream & stream, T& object) - { - StdOStringStream oss; - while(!stream.eof() && !stream.fail ()) - oss.put(stream.get()); - try - { - const StdString xmlcontent( oss.str(), 0, oss.str().size()-1 ); - rapidxml::xml_document doc; - doc.parse<0>(const_cast(xmlcontent.c_str())); - CXMLNode node(doc.first_node()); - object.parse(node); - } - catch (rapidxml::parse_error & exc) - { - ERROR("CXMLParser::ParseStream(StdIStream & stream)", - << "RapidXML error : " << exc.what() << " !"); - } - } -*/ - }// namespace xml -} // namespace xios - -#endif // __XIOS_CXMLParser__ diff --git a/xios_2311_src/trunk/.svn/pristine/4a/4ad9b2bca68f88db0b1677be2f1a5fb5c37d70b6.svn-base b/xios_2311_src/trunk/.svn/pristine/4a/4ad9b2bca68f88db0b1677be2f1a5fb5c37d70b6.svn-base deleted file mode 100644 index f5f88822700d883a1cd8871463190460cc6d7cab..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/4a/4ad9b2bca68f88db0b1677be2f1a5fb5c37d70b6.svn-base +++ /dev/null @@ -1,6 +0,0 @@ -/* GLOBAL */ -DECLARE_ATTRIBUTE(StdString, type) -DECLARE_ATTRIBUTE(int, order) -DECLARE_ATTRIBUTE(StdString, coordinate) -DECLARE_ATTRIBUTE(StdString, coordinate_src) -DECLARE_ATTRIBUTE(StdString, coordinate_dst) diff --git a/xios_2311_src/trunk/.svn/pristine/4a/4aed1c228277c5ba3139e8f66f21c9ad28c528b8.svn-base b/xios_2311_src/trunk/.svn/pristine/4a/4aed1c228277c5ba3139e8f66f21c9ad28c528b8.svn-base deleted file mode 100644 index eca7e29f29967f27e88df4837a43df78517a0408..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/4a/4aed1c228277c5ba3139e8f66f21c9ad28c528b8.svn-base +++ /dev/null @@ -1,126 +0,0 @@ -#ifndef __XIOS_CCouplerOut__ -#define __XIOS_CCouplerOut__ - -/// XIOS headers /// -#include "xios_spl.hpp" -#include "field.hpp" -#include "declare_group.hpp" -#include "date.hpp" -#include "attribute_enum.hpp" -#include "attribute_enum_impl.hpp" -#include "context_client.hpp" -#include "mpi.hpp" - -namespace xios -{ - - /// ////////////////////// Déclarations ////////////////////// /// - - class CCouplerOutGroup; - class CCouplerOutAttributes; - class CCouplerOut; - - class CGarbageCollector; - - ///-------------------------------------------------------------- - - // Declare/Define CCouplerOutAttribute - BEGIN_DECLARE_ATTRIBUTE_MAP(CCouplerOut) -# include "coupler_out_attribute.conf" - END_DECLARE_ATTRIBUTE_MAP(CCouplerOut) - - ///-------------------------------------------------------------- - - /*! - \class CCouplerOut - - */ - class CCouplerOut - : public CObjectTemplate - , public CCouplerOutAttributes - { - /// typedef /// - typedef CObjectTemplate SuperClass; - typedef CCouplerOutAttributes SuperClassAttribute; - - public : - enum EEventId - { - NO_EVENT - }; - - typedef CCouplerOutAttributes RelAttributes; - typedef CCouplerOutGroup RelGroup; - - /// Constructeurs /// - CCouplerOut(void); - explicit CCouplerOut(const StdString& id); - CCouplerOut(const CCouplerOut& couplerOut); // Not implemented yet. - CCouplerOut(const CCouplerOut* const couplerOut); // Not implemented yet. - - /// Destructeur /// - virtual ~CCouplerOut(void); - - public: - /// Accesseurs /// - CFieldGroup* getVirtualFieldGroup(void) const; - std::vector getAllFields(void) const; - std::vector getEnabledFields(void); - - StdString dumpClassAttributes(void); - - public : - void setVirtualFieldGroup(CFieldGroup* newVFieldGroup); - - // Add component into coupler - CField* addField(const string& id = ""); - CFieldGroup* addFieldGroup(const string& id = ""); - - public: - /// Accesseurs statiques /// - static StdString GetName(void); - static StdString GetDefName(void); - static ENodeType GetType(void); - public: - /// Traitements /// - virtual void parse(xml::CXMLNode& node); -// virtual StdString toString(void) const; - - public: - virtual void solveDescInheritance(bool apply, const CAttributeMap* const parent = 0); - void solveFieldRefInheritance(bool apply); - void createInterCommunicator(void) ; - void checkGridOfEnabledFields(void) ; - void assignContext(void) ; - private: - // the contextClient associated to the context Id attribute - CContextClient* client_=nullptr ; - public: - CContextClient* getContextClient(void) {return client_; } - - private: - string couplingContextId_ ; - public: - const string& getCouplingContextId(void) ; - private: - CFieldGroup* virtualFieldGroup; - -// std::shared_ptr data_out; -// std::shared_ptr data_in; - std::vector enabledFields; - - - public: - - }; // class CCouplerOut - - ///-------------------------------------------------------------- - - // Declare/Define CFileGroup and CFileDefinition - DECLARE_GROUP(CCouplerOut); - - ///-------------------------------------------------------------- - -} // namespace xios - -#endif // __XIOS_CCouplingIn__2 \ No newline at end of file diff --git a/xios_2311_src/trunk/.svn/pristine/4b/4b2b8f5899eacf91b1b8e36b324080ac591671cf.svn-base b/xios_2311_src/trunk/.svn/pristine/4b/4b2b8f5899eacf91b1b8e36b324080ac591671cf.svn-base deleted file mode 100644 index 3b3f6914c0158e99c1fac02575b7343758bd1e91..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/4b/4b2b8f5899eacf91b1b8e36b324080ac591671cf.svn-base +++ /dev/null @@ -1,15 +0,0 @@ -NETCDF_INCDIR="-I $NETCDF_INCDIR" -NETCDF_LIBDIR="-L$NETCDF_LIBDIR" -NETCDF_LIB="-lnetcdf" - -MPI_INCDIR="" -MPI_LIBDIR="" -MPI_LIB="" - -HDF5_INCDIR="" -HDF5_LIBDIR="" -HDF5_LIB="-lhdf5_hl -lhdf5 -lz -lcurl" - -OASIS_INCDIR="-I$PWD/../../oasis3-mct/BLD/build/lib/psmile.MPI1" -OASIS_LIBDIR="-L$PWD/../../oasis3-mct/BLD/lib" -OASIS_LIB="-lpsmile.MPI1 -lscrip -lmct -lmpeu" diff --git a/xios_2311_src/trunk/.svn/pristine/4b/4b5d7117b111e83f0ec6a63ca45d8b8565e286fb.svn-base b/xios_2311_src/trunk/.svn/pristine/4b/4b5d7117b111e83f0ec6a63ca45d8b8565e286fb.svn-base deleted file mode 100644 index 02b46decc45dc6114b590d8f7e8a9ddd4d1b45c0..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/4b/4b5d7117b111e83f0ec6a63ca45d8b8565e286fb.svn-base +++ /dev/null @@ -1,88 +0,0 @@ -#ifndef __XIOS_CCalendarWrapper__ -#define __XIOS_CCalendarWrapper__ - -/// XIOS headers /// -#include "xios_spl.hpp" -#include "attribute_enum.hpp" -#include "attribute_enum_impl.hpp" -#include "attribute_array.hpp" -#include "declare_attribute.hpp" -#include "object_template.hpp" - -#include "calendar.hpp" - -namespace xios { - - /// ////////////////////// Déclarations ////////////////////// /// - class CCalendarWrapperAttributes; - class CCalendarWrapper; - ///-------------------------------------------------------------- - - // Declare/Define CFileAttribute - BEGIN_DECLARE_ATTRIBUTE_MAP(CCalendarWrapper) -#include "calendar_wrapper_attribute.conf" - END_DECLARE_ATTRIBUTE_MAP(CCalendarWrapper) - - ///-------------------------------------------------------------- - /*! - \class CCalendarWrapper - This class a simple wrapper for the calendar - */ - class CCalendarWrapper - : public CObjectTemplate - , public CCalendarWrapperAttributes - { - public : - - /// typedef /// - typedef CObjectTemplate SuperClass; - typedef CCalendarWrapperAttributes SuperClassAttribute; - - //--------------------------------------------------------- - - public : - - /// Constructeurs /// - CCalendarWrapper(void); - explicit CCalendarWrapper(const StdString& id); - - /// Destructeur /// - virtual ~CCalendarWrapper(void); - - /// Accesseurs statiques /// - static StdString GetName(void); - static StdString GetDefName(void); - static ENodeType GetType(void); - - //--------------------------------------------------------- - - public : - // Parse xml calendar node - virtual void parse(xml::CXMLNode& node); - // Try to create the calendar from the current attributes - void createCalendar(void); - // Try to update the timestep of the calendar with the corresponding attribute - void updateTimestep(void); - - public : - /// Accesseurs /// - std::shared_ptr getCalendar(bool checkValid = false) const; - - const CDate& getInitDate() const; - const CDate& getTimeOrigin() const; - - /// Mutateurs /// - void setInitDate(const CDate& initDate); - void setTimeOrigin(const CDate& timeOrigin); - - private: - // Calendar of context - std::shared_ptr calendar; - - }; // class CCalendarWrapper - - typedef CCalendarWrapper CCalendarWrapperGroup; - typedef CCalendarWrapper CCalendarWrapperDefinition; -} // namespace xios - -#endif // __XIOS_CCalendarWrapper__ diff --git a/xios_2311_src/trunk/.svn/pristine/4b/4ba80c783beeca935332a745c30dac87c421196a.svn-base b/xios_2311_src/trunk/.svn/pristine/4b/4ba80c783beeca935332a745c30dac87c421196a.svn-base deleted file mode 100644 index 677933c04df9e529472b10dc4bda05e5ec831437..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/4b/4ba80c783beeca935332a745c30dac87c421196a.svn-base +++ /dev/null @@ -1,41 +0,0 @@ -#include "weight_transform_connector.hpp" - -namespace xios -{ - - CWeightTransformConnector::CWeightTransformConnector(shared_ptr srcView, shared_ptr dstView, unordered_map>& indexMap, - unordered_map>& weightMap) : srcView_(srcView), dstView_(dstView) - { - computeConnector(indexMap, weightMap) ; - } - - void CWeightTransformConnector::computeConnector(unordered_map>& indexMap, - unordered_map>& weightMap) - { - CArray dstGlobalIndex ; - CArray srcGlobalIndex ; - dstView_->getGlobalIndexView(dstGlobalIndex) ; - srcView_->getGlobalIndexView(srcGlobalIndex) ; - unordered_map srcMapIndex ; - srcSize_ = srcGlobalIndex.numElements() ; - dstSize_ = dstGlobalIndex.numElements() ; - - for(int i=0;i C99 - - SUBROUTINE cxios_set_reduce_axis_to_scalar_operation(reduce_axis_to_scalar_hdl, operation, operation_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: reduce_axis_to_scalar_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: operation - INTEGER (kind = C_INT) , VALUE :: operation_size - END SUBROUTINE cxios_set_reduce_axis_to_scalar_operation - - SUBROUTINE cxios_get_reduce_axis_to_scalar_operation(reduce_axis_to_scalar_hdl, operation, operation_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: reduce_axis_to_scalar_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: operation - INTEGER (kind = C_INT) , VALUE :: operation_size - END SUBROUTINE cxios_get_reduce_axis_to_scalar_operation - - FUNCTION cxios_is_defined_reduce_axis_to_scalar_operation(reduce_axis_to_scalar_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_reduce_axis_to_scalar_operation - INTEGER (kind = C_INTPTR_T), VALUE :: reduce_axis_to_scalar_hdl - END FUNCTION cxios_is_defined_reduce_axis_to_scalar_operation - - END INTERFACE - -END MODULE reduce_axis_to_scalar_interface_attr diff --git a/xios_2311_src/trunk/.svn/pristine/4b/4bd8f49344b834dc5bfeab5a43c74a4c8516e775.svn-base b/xios_2311_src/trunk/.svn/pristine/4b/4bd8f49344b834dc5bfeab5a43c74a4c8516e775.svn-base deleted file mode 100644 index 9e7fd94dfc2c7f4697dbfcb4e38cb4145f8b7ba3..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/4b/4bd8f49344b834dc5bfeab5a43c74a4c8516e775.svn-base +++ /dev/null @@ -1,600 +0,0 @@ -#ifndef __XIOS_CObjectTemplate_impl__ -#define __XIOS_CObjectTemplate_impl__ - -#include "xios_spl.hpp" -#include "context_client.hpp" -#include "object_factory.hpp" -#include "context.hpp" -#include "buffer_in.hpp" -#include "attribute.hpp" -#include "event_client.hpp" -#include "object_template.hpp" -#include "context_client.hpp" -#include "indent.hpp" -#include "type_util.hpp" -#include "message.hpp" -#include "type.hpp" -#include "type_util.hpp" -#include "group_template.hpp" - -namespace xios -{ - /// ////////////////////// Définitions ////////////////////// /// - template - xios_map > > CObjectTemplate::AllMapObj; - - template - xios_map > > CObjectTemplate::AllVectObj; - - template - xios_map CObjectTemplate::GenId; - - template - CObjectTemplate::CObjectTemplate(void) - : CAttributeMap() - , CObject() - { /* Ne rien faire de plus */ } - - template - CObjectTemplate::CObjectTemplate(const StdString & id) - : CAttributeMap() - , CObject(id, CObjectFactory::IsGenUId(id)) - { /* Ne rien faire de plus */ } - - template - CObjectTemplate::CObjectTemplate - (const CObjectTemplate & object, bool withAttrList, bool withId) - : CAttributeMap() - , CObject() - { - if (object.hasId() && withId) - this->setId(object.getId(), object.hasAutoGeneratedId()); - ERROR("CObjectTemplate construtor 3", << "Not completly implemented yet !"); - } - - template - CObjectTemplate::~CObjectTemplate(void) - { /* Ne rien faire de plus */ } - - ///-------------------------------------------------------------- - - template - std::vector > & - CObjectTemplate::GetAllVectobject(const StdString & contextId) - { - return (CObjectTemplate::AllVectObj[contextId]); - } - - template - void CObjectTemplate::cleanStaticDataStructure(void) - { - xios_map > >* allMap = &(CObjectTemplate::AllMapObj); - for(auto it = allMap->begin(); it != allMap->end(); ++it) - { - for(auto it2 = it->second.begin(); it2 != it->second.end(); ++it2) - { - std::shared_ptr todel = it2->second; - todel.reset(); - } - it->second.clear(); - - std::vector >* allVect = &(CObjectTemplate::AllVectObj[it->first]); - for(auto it = allVect->begin(); it != allVect->end(); ++it) - { - it->reset(); - } - allVect->clear(); - } - allMap->clear(); - } - - //--------------------------------------------------------------- - - template - StdString CObjectTemplate::toString(void) const - { - StdOStringStream oss; - oss << "<" << T::GetName(); - if (this->hasId()) - oss << " id=\"" << this->getId() << "\""; - oss << " " << SuperClassMap::toString() << "/>"; - return (oss.str()); - } - - template - void CObjectTemplate::fromString(const StdString & str) - { - ERROR("CObjectTemplate::fromString(str)", - << "[ str = " << str << "] Not implemented yet !"); - } - - //--------------------------------------------------------------- - -/* - template - void CObjectTemplate::toBinary(StdOStream & os) const - { - SuperClassMap::toBinary(os); - } - - template - void CObjectTemplate::fromBinary(StdIStream & is) - { - SuperClassMap::fromBinary(is); - } -*/ - - //--------------------------------------------------------------- - - template - void CObjectTemplate::parse(xml::CXMLNode & node) - TRY - { - xml::THashAttributes attributes = node.getAttributes(); - CAttributeMap::setAttributes(attributes); - } - CATCH - - //--------------------------------------------------------------- - - template - ENodeType CObjectTemplate::getType(void) const - { - return (T::GetType()); - } - - template - string CObjectTemplate::getName(void) const - { - return (T::GetName()); - } - - //--------------------------------------------------------------- - - template - bool CObjectTemplate::hasChild(void) const - { - return (false); - } - - /*! - Compare two object of same type - */ - template - bool CObjectTemplate::isEqual(const string& id, const vector& excludedAttrs) - { - T* obj = CObjectTemplate::get(id); - return this->isEqual(obj, excludedAttrs); - } - - template - bool CObjectTemplate::isEqual(T* obj, const vector& excludedAttrs) - { - - CAttributeMap& attrMapThis = *this; - CAttributeMap& attrMapObj = *obj; - return (attrMapThis.isEqual(attrMapObj, excludedAttrs)); - } - - // --------------------------------------------------------------- - template - void CObjectTemplate::setInheritedId(T* obj) - { - if (!hasInheritedId_) - { - if (!(hasId() && !hasAutoGeneratedId())) - if (obj->hasId() && !obj->hasAutoGeneratedId()) - { - hasInheritedId_=true ; - inheritedId_=obj->getId() ; - } - } - } - - template - void CObjectTemplate::setTemplateId(T* obj) - { - if (hasId() && !hasAutoGeneratedId()) - { - templateId_ = getId() ; - hasTemplateId_ = true ; - } - else if (obj->hasId() && !obj->hasAutoGeneratedId()) - { - templateId_ = obj->getId() ; - hasTemplateId_ = true ; - } - else if (obj->hasTemplateId()) - { - templateId_= obj->getTemplateId() ; - hasTemplateId_=true ; - } - } - - - //--------------------------------------------------------------- - - template - void CObjectTemplate::solveDescInheritance(bool apply, const CAttributeMap * const parent) - { - if (parent != NULL) - SuperClassMap::setAttributes(parent, apply); - } - - //--------------------------------------------------------------- - - template - void CObjectTemplate::ClearAllAttributes(void) - { - vector avect = CObjectTemplate::getAll(); - typename vector::iterator - it = avect.begin(), end = avect.end(); - - for (;it != end; it++) - { - CAttributeMap & amap = **it; - amap.clearAllAttributes(); - } - } - - template - std::map CObjectTemplate::getMinimumBufferSizeForAttributes(CContextClient* client) - { - std::map minimumSizes; - - if (client->isServerLeader()) - { - size_t minimumSize = 0; - CAttributeMap& attrMap = *this; - CAttributeMap::const_iterator it = attrMap.begin(), itE = attrMap.end(); - for (; it != itE; ++it) - { - if (!it->second->isEmpty()) - { - size_t size = it->second->getName().size() + sizeof(size_t) + it->second->size(); - if (size > minimumSize) - minimumSize = size; - } - } - - if (minimumSize) - { - // Account for extra header info - minimumSize += CEventClient::headerSize + getId().size() + sizeof(size_t); - - const std::list& ranks = client->getRanksServerLeader(); - for (std::list::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) - minimumSizes.insert(std::make_pair(*itRank, minimumSize)); - } - } - return minimumSizes; - } - - template - void CObjectTemplate::sendAllAttributesToServer(CContextClient* client, const string& objectId) - { - CAttributeMap& attrMap = *this; - CAttributeMap::const_iterator it = attrMap.begin(), itE = attrMap.end(); - for (; it != itE; ++it) - { - if (it->second->doSend() && !(it->second)->isEmpty()) sendAttributToServer(*(it->second), client, objectId); - } - } - - template - void CObjectTemplate::sendAttributToServer(const string& id, CContextClient* client, const string& objectId ) - { - CAttributeMap & attrMap = *this; - CAttribute* attr=attrMap[id]; - sendAttributToServer(*attr, client); - } - - template - void CObjectTemplate::sendAttributToServer(CAttribute& attr, CContextClient* client, const string& objectId) - { - CEventClient event(getType(),EVENT_ID_SEND_ATTRIBUTE); - if (client->isServerLeader()) - { - CMessage msg; - if (objectId.empty()) msg << this->getId(); - else msg << objectId; - msg << attr.getName(); - msg << attr; - const std::list& ranks = client->getRanksServerLeader(); - for (std::list::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) - event.push(*itRank,1,msg); - client->sendEvent(event); - } - else client->sendEvent(event); - } - -/* specialisation for context, because context Id on client is not the same on server, and no need to transfer context Id */ - template <> - void CObjectTemplate::sendAttributToServer(CAttribute& attr, CContextClient* client, const string& objectId) - { - CEventClient event(getType(),EVENT_ID_SEND_ATTRIBUTE); - if (client->isServerLeader()) - { - CMessage msg; - msg << attr.getName(); - msg << attr; - const std::list& ranks = client->getRanksServerLeader(); - for (std::list::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) - event.push(*itRank,1,msg); - client->sendEvent(event); - } - else client->sendEvent(event); - } - - /*! - This generic funtion only provides instance for sending, for receving, each - child class must define itself. - \param [in] id Id of added item - \param [in] itemType type of added item - */ - - template - void CObjectTemplate::sendAddItem(const StdString& id, int itemType, CContextClient* client, const string& objectId) - { - typedef typename T::EEventId ItemType; - CEventClient event(this->getType(),ItemType(itemType)); - if (client->isServerLeader()) - { - CMessage msg; - if (objectId.empty()) msg << this->getId(); - else msg << objectId; - msg << id; - const std::list& ranks = client->getRanksServerLeader(); - for (std::list::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) - event.push(*itRank,1,msg); - client->sendEvent(event); - } - else client->sendEvent(event); - } - - template - void CObjectTemplate::recvAttributFromClient(CEventServer& event) - { - - CBufferIn* buffer=event.subEvents.begin()->buffer; - string id,attrId; - *buffer>>id; - CAttributeMap & attrMap = *get(id); - *buffer>>attrId; - CAttribute* attr=attrMap[attrId]; - info(50) << "attribut recu " << attrId << " "; - if (attr->isEmpty()) info(50) << "--> empty" << endl; - else info(50) /*getValue()*/ << endl; - *buffer>>*attr; - info(50) << "attribut recu " << attrId << " "; - if (attr->isEmpty()) info(50) << "--> empty" << endl; - else info(50) /*attr->getValue()*/ << endl; - } - -/* specialisation for context, because context Id on client is not the same on server and no need to transfer context Id */ - template <> - void CObjectTemplate::recvAttributFromClient(CEventServer& event) - { - - CBufferIn* buffer=event.subEvents.begin()->buffer; - string attrId; - CAttributeMap & attrMap = *CContext::getCurrent(); - *buffer>>attrId; - CAttribute* attr=attrMap[attrId]; - info(50) << "attribut recu " << attrId << " "; - if (attr->isEmpty()) info(50) << "--> empty" << endl; - else info(50) /*getValue()*/ << endl; - *buffer>>*attr; - info(50) << "attribut recu " << attrId << " "; - if (attr->isEmpty()) info(50) << "--> empty" << endl; - else info(50) /*attr->getValue()*/ << endl; - } - - - template - bool CObjectTemplate::dispatchEvent(CEventServer& event) - { - switch(event.type) - { - case EVENT_ID_SEND_ATTRIBUTE : - recvAttributFromClient(event); - return true; - break; - - default : - return false; -// ERROR("void CObjectTemplate::recvEvent(CEventServer& event)", << "Unknown Event"); - } - } - - template - bool CObjectTemplate::has(const string & id) - { - return CObjectFactory::HasObject(id); - } - - template - bool CObjectTemplate::has(const string& contextId, const string & id) - { - return CObjectFactory::HasObject(contextId,id); - } - - template - T* CObjectTemplate::get(const string & id) - { - return CObjectFactory::GetObject(id).get(); - } - - template - T* CObjectTemplate::get(const T* ptr) - { - return CObjectFactory::GetObject(ptr).get(); - } - - template - std::shared_ptr CObjectTemplate::getShared(const T* ptr) - { - return CObjectFactory::GetObject(ptr); - } - - template - std::shared_ptr CObjectTemplate::getShared(void) - { - return CObjectFactory::GetObject((T*)this); - } - - template - const vector CObjectTemplate::getAll() - { - const vector< std::shared_ptr >& shared_vect= CObjectFactory::GetObjectVector(); - vector vect; - - typename vector >::const_iterator it; - for(it=shared_vect.begin();it!=shared_vect.end();++it) vect.push_back(it->get()); - return vect; - } - - template - const vector CObjectTemplate::getAll(const string & id) - { - const vector< std::shared_ptr >& shared_vect= CObjectFactory::GetObjectVector(id); - vector vect; - - typename vector >::const_iterator it; - for(it=shared_vect.begin();it!=shared_vect.end();++it) vect.push_back(it->get()); - return vect; - } - - template - T* CObjectTemplate::get(const string& contextId, const string & id) - { - return CObjectFactory::GetObject(contextId,id).get(); - } - - template - T* CObjectTemplate::create(const string & id) - { - return CObjectFactory::CreateObject(id).get(); - } ///-------------------------------------------------------------- - - template - T* CObjectTemplate::createAlias(const string & id, const string& alias) - { - return CObjectFactory::CreateAlias(id, alias).get(); - } ///-------------------------------------------------------------- - - template - void CObjectTemplate::createAlias(const string& alias) - { - get()->createAlias(getId(),alias) ; - } // - - template - T* CObjectTemplate::get(void) - { - return CObjectFactory::GetObject((T*)this).get(); - } - - template - void CObjectTemplate::generateCInterface(ostream& oss) - { - string className=getName(); - int found=className.rfind("_group"); - if (found!=string::npos) className.replace(found,1,0,'x'); - - oss << "/* ************************************************************************** *" << iendl; - oss << " * Interface auto generated - do not modify *" << iendl; - oss << " * ************************************************************************** */" << iendl; - oss << iendl; - oss << "#include " << iendl; - oss << "#include \"xios.hpp\"" << iendl; - oss << "#include \"attribute_template.hpp\"" << iendl; - oss << "#include \"object_template.hpp\"" << iendl; - oss << "#include \"group_template.hpp\"" << iendl; - oss << "#include \"icutil.hpp\"" << iendl; - oss << "#include \"icdate.hpp\"" << iendl; - oss << "#include \"timer.hpp\"" << iendl; - oss << "#include \"node_type.hpp\"" << iendl; - oss << iendl; - oss << "extern \"C\"" << iendl; - oss << "{" << iendl++; - oss << "typedef xios::" << getStrType() << "* " << className << "_Ptr;"; - SuperClassMap::generateCInterface(oss,className); - oss << "}" << iendl--; - } - - template - void CObjectTemplate::generateFortran2003Interface(ostream& oss) - { - string className=getName(); - int found=className.rfind("_group"); - if (found!=string::npos) className.replace(found,1,0,'x'); - - oss << "! * ************************************************************************** *" << iendl; - oss << "! * Interface auto generated - do not modify *" << iendl; - oss << "! * ************************************************************************** *" << iendl; - oss << "#include \"../fortran/xios_fortran_prefix.hpp\"" << iendl; - oss << iendl; - oss << "MODULE " << className << "_interface_attr" << iendl++; - oss << "USE, INTRINSIC :: ISO_C_BINDING" << std::endl; - oss << iendl; - oss << "INTERFACE" << iendl++; - oss << "! Do not call directly / interface FORTRAN 2003 <-> C99"; - SuperClassMap::generateFortran2003Interface(oss, className); - oss << iendl--; - oss << "END INTERFACE" << iendl--; - oss << iendl; - oss << "END MODULE " << className << "_interface_attr" << iendl; - } - - template - void CObjectTemplate::generateFortranInterface(ostream& oss) - { - string className=getName(); - int found=className.rfind("_group"); - if (found!=string::npos) className.erase(found,1); - string superClassName=getName(); - found=superClassName.find("_group"); - if (found!=string::npos) superClassName.erase(found,6); - - oss << "! * ************************************************************************** *" << iendl; - oss << "! * Interface auto generated - do not modify *" << iendl; - oss << "! * ************************************************************************** *" << iendl; - oss << "#include \"xios_fortran_prefix.hpp\"" << iendl; - oss << iendl; - oss << "MODULE i" << className << "_attr" << iendl++; - oss << "USE, INTRINSIC :: ISO_C_BINDING" << iendl; - oss << "USE i" << superClassName << iendl; - oss << "USE " << className << "_interface_attr" << iendl--; -// oss << "TYPE txios(" << className << ")" << iendl; -// oss << " INTEGER(kind = C_INTPTR_T) :: daddr" << iendl; -// oss << "END TYPE txios(" << className << ")" << iendl; - oss << iendl; - oss << "CONTAINS" << iendl; - oss << iendl++; - SuperClassMap::generateFortranInterface_id(oss,className); - oss << iendl; - SuperClassMap::generateFortranInterface_hdl(oss,className); - oss << iendl; - SuperClassMap::generateFortranInterface_hdl_(oss,className); - oss << iendl; - SuperClassMap::generateFortranInterfaceGet_id(oss,className); - oss << iendl; - SuperClassMap::generateFortranInterfaceGet_hdl(oss,className); - oss << iendl; - SuperClassMap::generateFortranInterfaceGet_hdl_(oss,className); - oss << iendl; - SuperClassMap::generateFortranInterfaceIsDefined_id(oss,className); - oss << iendl; - SuperClassMap::generateFortranInterfaceIsDefined_hdl(oss,className); - oss << iendl; - SuperClassMap::generateFortranInterfaceIsDefined_hdl_(oss,className); - oss << iendl--; - oss << "END MODULE i" << className << "_attr" << iendl; - } -} // namespace xios - -#endif // __XIOS_CObjectTemplate_impl__ diff --git a/xios_2311_src/trunk/.svn/pristine/4c/4cdd2e80a7112e15823cd1db2475380363ae9d48.svn-base b/xios_2311_src/trunk/.svn/pristine/4c/4cdd2e80a7112e15823cd1db2475380363ae9d48.svn-base deleted file mode 100644 index c93b5a4c3fa47a3a39a16ea846f8f08e98f0f653..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/4c/4cdd2e80a7112e15823cd1db2475380363ae9d48.svn-base +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -FORGE_DIR=/ipsl/forge/projets/ioserver/XIOS_TEST_SUITE -forge_IP=ioserver@forge.ipsl.jussieu.fr - -files=$* - -for file in $files -do - scp $file $forge_IP:$FORGE_DIR - ssh $forge_IP "chmod --quiet a+rw ${FORGE_DIR}/${file}" -done diff --git a/xios_2311_src/trunk/.svn/pristine/4d/4d324e5267de862bd2543d87b6ce6cc46c62da83.svn-base b/xios_2311_src/trunk/.svn/pristine/4d/4d324e5267de862bd2543d87b6ce6cc46c62da83.svn-base deleted file mode 100644 index 36b28e8851dee697dca26bf0c307708205506041..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/4d/4d324e5267de862bd2543d87b6ce6cc46c62da83.svn-base +++ /dev/null @@ -1,268 +0,0 @@ -#include "user_defined.hpp" -#include "calendar_util.hpp" - -namespace xios -{ - /// ////////////////////// Définitions ////////////////////// /// - - CUserDefinedCalendar::CUserDefinedCalendar(int dayLength, const CArray& monthLengths) - : CCalendar("user_defined") - , dayLength(dayLength) - , monthLengths(monthLengths) - , yearLength(sum(monthLengths) * dayLength) - , leapYearMonth(0) - , leapYearDrift(0.0) - , leapYearDriftOffset(0.0) - { - if (dayLength <= 0) - ERROR("CUserDefinedCalendar::CUserDefinedCalendar(int dayLength, const CArray& monthLengths)", - << "The day length must be strictly positive."); - if (monthLengths.numElements() == 0) - ERROR("CUserDefinedCalendar::CUserDefinedCalendar(int dayLength, const CArray& monthLengths)", - << "The month lengths must be specified."); - if (min(monthLengths) <= 0) - ERROR("CUserDefinedCalendar::CUserDefinedCalendar(int dayLength, const CArray& monthLengths)", - << "All month lengths must be strictly positive."); - // Ensure that the month lengths array is always 0-indexed - this->monthLengths.reindexSelf(TinyVector(0)); - } - - CUserDefinedCalendar::CUserDefinedCalendar(int dayLength, int yearLength) - : CCalendar("user_defined") - , dayLength(dayLength) - , yearLength(yearLength) - , leapYearMonth(0) - , leapYearDrift(0.0) - , leapYearDriftOffset(0.0) - { - if (dayLength <= 0) - ERROR("CUserDefinedCalendar::CUserDefinedCalendar(int dayLength, int yearLength)", - << "The day length must be strictly positive."); - if (yearLength <= 0) - ERROR("CUserDefinedCalendar::CUserDefinedCalendar(int dayLength, int yearLength)", - << "The year length must be strictly positive."); - } - - CUserDefinedCalendar::~CUserDefinedCalendar(void) - { /* Nothing to do here */ } - - ///-------------------------------------------------------------- - - void CUserDefinedCalendar::configureLeapYear(int leapYearMonth, double leapYearDrift, double leapYearDriftOffset /*= 0.0*/) - { - if (monthLengths.numElements() == 0) - ERROR("void CUserDefinedCalendar::configureLeapYear(int leapYearMonth, double leapYearDrift, double leapYearDriftOffset /*= 0.0*/)", - << "Impossible to define leap years on a calendar without months."); - if (leapYearMonth < 1 || leapYearMonth > monthLengths.numElements()) - ERROR("void CUserDefinedCalendar::configureLeapYear(int leapYearMonth, double leapYearDrift, double leapYearDriftOffset /*= 0.0*/)", - << "The month chosen for the additional day must be in the range [1, " << monthLengths.numElements() << "]."); - if (leapYearDrift < 0.0 || leapYearDrift >= 1.0) - ERROR("void CUserDefinedCalendar::configureLeapYear(int leapYearMonth, double leapYearDrift, double leapYearDriftOffset /*= 0.0*/)", - << "The year drift must be in the range [0.0, 1.0)."); - if (leapYearDriftOffset < 0.0 || leapYearDriftOffset >= 1.0) - ERROR("void CUserDefinedCalendar::configureLeapYear(int leapYearMonth, double leapYearDrift, double leapYearDriftOffset /*= 0.0*/)", - << "The year drift offset must be in the range [0.0, 1.0)."); - - this->leapYearMonth = leapYearMonth; - this->leapYearDrift = leapYearDrift; - this->leapYearDriftOffset = leapYearDriftOffset; - } - - ///-------------------------------------------------------------- - - StdString CUserDefinedCalendar::getType(void) const { return StdString("user_defined"); } - - /*! Returns the duration of the date's month in days. */ - int CUserDefinedCalendar::getMonthLength(const CDate& date) const - { - int monthLength = 0; - if (monthLengths.numElements() > 0) - { - monthLength = monthLengths(date.getMonth() - 1); - if (date.getMonth() == leapYearMonth && isLeapYear(date.getYear())) - monthLength++; - } - return monthLength; - } - - /*! Returns the duration of the date's year in seconds. */ - int CUserDefinedCalendar::getYearTotalLength(const CDate& date) const - { - return isLeapYear(date.getYear()) ? yearLength + dayLength : yearLength; - } - - /*! Returns the duration of a day in hours. Note that this value is - not necessarily exact since it can be rounded but it is always - the smallest integer number of hours that can hold a day. */ - int CUserDefinedCalendar::getDayLength(void) const { return int(ceil(double(dayLength) / (getHourLength() * getMinuteLength()))); } - - /*! Returns the duration of a year in months. */ - int CUserDefinedCalendar::getYearLength(void) const { return monthLengths.numElements(); } - - /*! Returns the day length expressed in seconds. */ - int CUserDefinedCalendar::getDayLengthInSeconds(void) const { return dayLength; } - - /*! Test if the calendar can have leap year. */ - bool CUserDefinedCalendar::hasLeapYear() const{ return (leapYearDrift != 0.0); } - - /*! - Test if the specified year is a leap year. - \param year the year to be tested - \return true if and only the specified year is a leap year - */ - bool CUserDefinedCalendar::isLeapYear(int year) const - { - double intPart; // dummy variable - return (hasLeapYear() && - (abs(1.0 - (modf(leapYearDriftOffset + (year - getTimeOrigin().getYear()) * leapYearDrift, &intPart) + leapYearDrift)) < 1e-14)); - } - - CDuration& CUserDefinedCalendar::resolve(CDuration& dur, bool noNegativeTime /*= false*/) const - { - if (monthLengths.numElements() > 0) // normal case, we can rely on the generic function - return CCalendar::resolve(dur, noNegativeTime); - - if (dur.month) - ERROR("CDuration& CUserDefinedCalendar::resolve(CDuration& dur, bool noNegativeTime /*= false*/) const", - << "month = " << dur.month << " but the user defined calendar has no month."); - - const int hourLengthInSeconds = getHourLength() * getMinuteLength(); - - // Convert everything in seconds - Time t = Time(dur.year * yearLength + dur.day * dayLength - + (dur.hour * getHourLength() + dur.minute) * getMinuteLength() + dur.second); - - // Then convert back to years - dur.year = int(t / yearLength); - t %= yearLength; - - // days - dur.day = int(t / dayLength); - t %= dayLength; - - // Do we allow hour, minute, second to be negative? - if (noNegativeTime) - { - // If we don't, we remove some days or years until the time is positive - double& val = (dayLength < yearLength) ? dur.day : dur.year; - int length = (dayLength < yearLength) ? dayLength : yearLength; - while (t < 0) - { - t += length; - val -= 1.0; - } - } - - // hours - dur.hour = int(t / hourLengthInSeconds); - t %= hourLengthInSeconds; - // minutes - dur.minute = int(t / getMinuteLength()); - // secondes - dur.second = int(t % getMinuteLength()); - - return dur; - } - - /*! Parse a date using the calendar's parser. */ - void CUserDefinedCalendar::parseDate(StdIStream& in, CDate& date) const - { - if (monthLengths.numElements() > 0) // normal case, we can rely on the generic function - { - CCalendar::parseDate(in, date); - return; - } - - char sep = '-'; // Le caractère c est utilisé pour "recueillir" les séparateurs "/" et ":". - char c; - - // Default initialize the date - int year = 00, month = 01, day = 01; - int hour = 00, minute = 00, second = 00; - - // Read the year - in >> year; - // Read the day only if the day length is smaller than the year length - c = in.get(); - if (c == sep && dayLength < yearLength) - { - in >> day; - c = in.get(); - } - // Read the time - sep = ' '; - if (c == sep) - { - in >> hour >> c; - sep = ':'; - if (c == sep) - { - in >> minute >> c; - if (c == sep) - { - in >> second; - in >> c; - } - } - } - - date.setDate(year, month, day, hour, minute, second); - - // Delay the verification until we get a calendar we can compare the date to - if (!checkDate(date)) - ERROR("void CUserDefinedCalendar::parseDate(StdIStream& in, CDate& date) const", - << "Bad date format or not conform to calendar"); - - if (c == '+') // We will be adding a duration to the date - { - CDuration dur; - in >> dur; - date = date + dur; - } - else if (!in.eof()) - ERROR("void CUserDefinedCalendar::parseDate(StdIStream& in, CDate& date) const", - << "Invalid date format: unexpected trailing character(s)"); - } - - /*! Test if a date is valid with regard to the current calendar. */ - bool CUserDefinedCalendar::checkDate(CDate& date) const - { - if (monthLengths.numElements() > 0) // normal case, we can rely on the generic function - return CCalendar::checkDate(date); - - const int maxDay = (yearLength + dayLength - 1) / dayLength; - - bool isValid = true; - - // Vérification de la valeur du mois. - if (date.getMonth() != 1) - { isValid = false; date.setMonth(1); } - - // Vérification de la valeur du jour. - if (date.getDay() < 1) - { isValid = false; date.setDay(1); } - else if (date.getDay() > maxDay) - { isValid = false; date.setDay(maxDay); } - - // Vérification de la valeur de l'heure. - if (date.getHour() < 0) - { isValid = false; date.setHour(0); } - else if (date.getHour() >= getDayLength()) - { isValid = false; date.setHour(getDayLength() - 1); } - - // Vérification de la valeur des minutes. - if (date.getMinute() < 0) - { isValid = false; date.setMinute(0); } - else if (date.getMinute() >= getHourLength()) - { isValid = false; date.setMinute(getHourLength() - 1); } - - // Vérification de la valeur des secondes. - if (date.getSecond() < 0) - { isValid = false; date.setSecond(0); } - else if (date.getSecond() >= getMinuteLength()) - { isValid = false; date.setSecond(getMinuteLength() - 1); } - - return isValid; - } -} // namespace xios - diff --git a/xios_2311_src/trunk/.svn/pristine/4d/4d3f05c3be53e2fe5bf54aff715946b3ddbee201.svn-base b/xios_2311_src/trunk/.svn/pristine/4d/4d3f05c3be53e2fe5bf54aff715946b3ddbee201.svn-base deleted file mode 100644 index 61efd2c30902185faa0810c3a2fc10b92978df44..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/4d/4d3f05c3be53e2fe5bf54aff715946b3ddbee201.svn-base +++ /dev/null @@ -1,332 +0,0 @@ -/********************************************************************* - * Copyright 1993, UCAR/Unidata - * See netcdf/COPYRIGHT file for copying and redistribution conditions. - * $Header: /upc/share/CVS/netcdf-3/libncdap3/dapalign.c,v 1.5 2009/09/23 22:26:00 dmh Exp $ - *********************************************************************/ - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* -This code is a variantion of the H5detect.c code from HDF5. -Author: D. Heimbigner 10/7/2008 -*/ -#include "config.h" -#ifndef OFFSETTEST -#include "ncdap3.h" -#else -#include -#include -#include -#endif - -#include "dapnc.h" -#include "dapdebug.h" -#include "dapalign.h" - -typedef struct nccalignvlen_t { - size_t len; - void* p; -} nccalignvlen_t; - -#ifdef OFFSETTEST -typedef int nc_type; -#define NC_NAT 0 /* NAT = 'Not A Type' (c.f. NaN) */ -#define NC_BYTE 1 /* signed 1 byte integer */ -#define NC_CHAR 2 /* ISO/ASCII character */ -#define NC_SHORT 3 /* signed 2 byte integer */ -#define NC_INT 4 /* signed 4 byte integer */ -#define NC_FLOAT 5 /* single precision floating point number */ -#define NC_DOUBLE 6 /* double precision floating point number */ -#define NC_UBYTE 7 /* unsigned 1 byte int */ -#define NC_USHORT 8 /* unsigned 2-byte int */ -#define NC_UINT 9 /* unsigned 4-byte int */ -#define NC_INT64 10 /* signed 8-byte int */ -#define NC_UINT64 11 /* unsigned 8-byte int */ -#define NC_STRING 12 /* string */ -#define NC_VLEN 13 -#define NC_OPAQUE 14 -#endif - -/* -The heart of this is the following macro, -which computes the offset of a field x -when preceded by a char field. -The assumptions appear to be as follows: -1. the offset produced in this situation indicates - the alignment for x relative in such a way that it - depends only on the types that precede it in the struct. -2. the compiler does not reorder fields. -3. arrays are tightly packed. -4. nested structs are alignd according to their first member - (this actually follows from C language requirement that - a struct can legally be cast to an instance of its first member). -Given the alignments for the various common primitive types, -it is assumed that one can use them anywhere to construct -the layout of a struct of such types. -It seems to work for HDF5 for a wide variety of machines. -*/ - -#define COMP_ALIGNMENT(DST,TYPE) {\ - struct {char f1; TYPE x;} tmp; \ - DST.typename = #TYPE ; \ - DST.alignment = (size_t)((char*)(&(tmp.x)) - (char*)(&tmp));} - - -#define NCCTYPECOUNT (NCCTYPENCVLEN+1) - -static NCtypealignvec vec[NCCTYPECOUNT]; -static NCtypealignset set; -static int dapaligninit = 0; - -unsigned int -ncctypealignment(int nctype) -{ - NCtypealignment* align = NULL; - int index = 0; - if(!dapaligninit) compute_nccalignments(); - switch (nctype) { - case NC_BYTE: index = NCCTYPEUCHAR; break; - case NC_CHAR: index = NCCTYPECHAR; break; - case NC_SHORT: index = NCCTYPESHORT; break; - case NC_INT: index = NCCTYPEINT; break; - case NC_FLOAT: index = NCCTYPEFLOAT; break; - case NC_DOUBLE: index = NCCTYPEDOUBLE; break; - case NC_UBYTE: index = NCCTYPEUCHAR; break; - case NC_USHORT: index = NCCTYPEUSHORT; break; - case NC_UINT: index = NCCTYPEUINT; break; - case NC_INT64: index = NCCTYPELONGLONG; break; - case NC_UINT64: index = NCCTYPEULONGLONG; break; - case NC_STRING: index = NCCTYPEPTR; break; - case NC_VLEN: index = NCCTYPENCVLEN; break; - case NC_OPAQUE: index = NCCTYPEUCHAR; break; - default: -#ifndef OFFSETTEST - PANIC1("nctypealignment: bad type code: %d",nctype); -#else - return 0; -#endif - } - align = &vec[index]; - return align->alignment; -} - - -void -compute_nccalignments(void) -{ - /* Compute the alignments for all the common C data types*/ - /* First for the struct*/ - /* initialize*/ - memset((void*)&set,0,sizeof(set)); - memset((void*)vec,0,sizeof(vec)); - - COMP_ALIGNMENT(set.charalign,char); - COMP_ALIGNMENT(set.ucharalign,unsigned char); - COMP_ALIGNMENT(set.shortalign,short); - COMP_ALIGNMENT(set.ushortalign,unsigned short); - COMP_ALIGNMENT(set.intalign,int); - COMP_ALIGNMENT(set.uintalign,unsigned int); - COMP_ALIGNMENT(set.longalign,long); - COMP_ALIGNMENT(set.ulongalign,unsigned long); - COMP_ALIGNMENT(set.longlongalign,long long); - COMP_ALIGNMENT(set.ulonglongalign,unsigned long long); - COMP_ALIGNMENT(set.floatalign,float); - COMP_ALIGNMENT(set.doublealign,double); - COMP_ALIGNMENT(set.ptralign,void*); - COMP_ALIGNMENT(set.ncvlenalign,nccalignvlen_t); - - /* Then the vector*/ - COMP_ALIGNMENT(vec[NCCTYPECHAR],char); - COMP_ALIGNMENT(vec[NCCTYPEUCHAR],unsigned char); - COMP_ALIGNMENT(vec[NCCTYPESHORT],short); - COMP_ALIGNMENT(vec[NCCTYPEUSHORT],unsigned short); - COMP_ALIGNMENT(vec[NCCTYPEINT],int); - COMP_ALIGNMENT(vec[NCCTYPEUINT],unsigned int); - COMP_ALIGNMENT(vec[NCCTYPELONG],long); - COMP_ALIGNMENT(vec[NCCTYPEULONG],unsigned long); - COMP_ALIGNMENT(vec[NCCTYPELONGLONG],long long); - COMP_ALIGNMENT(vec[NCCTYPEULONGLONG],unsigned long long); - COMP_ALIGNMENT(vec[NCCTYPEFLOAT],float); - COMP_ALIGNMENT(vec[NCCTYPEDOUBLE],double); - COMP_ALIGNMENT(vec[NCCTYPEPTR],void*); - COMP_ALIGNMENT(vec[NCCTYPENCVLEN],nccalignvlen_t); - - dapaligninit = 1; -} - -/* Compute padding */ -int -nccpadding(unsigned long offset, int alignment) -{ - int pad,rem; - rem = (alignment==0?0:(offset % alignment)); - pad = (rem==0?0:(alignment - rem)); - return pad; -} - -#ifdef OFFSETTEST - -#define COMP_ALIGNMENT1(DST,TYPE1,TYPE) {\ - struct {TYPE1 f1; TYPE x;} tmp; \ - DST.typename = #TYPE ; \ - DST.alignment = (size_t)((char*)(&(tmp.x)) - (char*)(&tmp));} - -#define COMP_ALIGNMENT2(DST,TYPE1,TYPE2,TYPE) {\ - struct {TYPE1 f1, TYPE2 f2; TYPE x;} tmp; \ - DST.typename = #TYPE ; \ - DST.alignment = (size_t)((char*)(&(tmp.x)) - (char*)(&tmp));} - -#define COMP_SIZE0(DST,TYPE1,TYPE2) {\ - struct {TYPE1 c; TYPE2 x;} tmp; \ - DST = sizeof(tmp); } - -static char* -padname(char* name) -{ -#define MAX 20 - if(name == NULL) name = "null"; - int len = strlen(name); - if(len > MAX) len = MAX; - char* s = (char*)malloc(MAX+1); - memset(s,' ',MAX); - s[MAX+1] = '\0'; - strncpy(s,name,len); - return s; -} - -static void -verify(NCtypealignvec* vec) -{ - int i,j; - NCtypealignvec* vec16; - NCtypealignvec* vec32; - int* sizes8; - int* sizes16; - int* sizes32; - - vec16 = (NCtypealignvec*)malloc(sizeof(NCtypealignvec)*NCCTYPECOUNT); - vec32 = (NCtypealignvec*)malloc(sizeof(NCtypealignvec)*NCCTYPECOUNT); - sizes8 = (int*)malloc(sizeof(int)*NCCTYPECOUNT); - sizes16 = (int*)malloc(sizeof(int)*NCCTYPECOUNT); - sizes32 = (int*)malloc(sizeof(int)*NCCTYPECOUNT); - - COMP_SIZE0(sizes8[1],char,char); - COMP_SIZE0(sizes8[2],unsigned char,char); - COMP_SIZE0(sizes8[3],short,char); - COMP_SIZE0(sizes8[4],unsigned short,char); - COMP_SIZE0(sizes8[5],int,char); - COMP_SIZE0(sizes8[6],unsigned int,char); - COMP_SIZE0(sizes8[7],long,char); - COMP_SIZE0(sizes8[8],unsigned long,char); - COMP_SIZE0(sizes8[9],long long,char); - COMP_SIZE0(sizes8[10],unsigned long long,char); - COMP_SIZE0(sizes8[11],float,char); - COMP_SIZE0(sizes8[12],double,char) ; - COMP_SIZE0(sizes8[13],void*,char); - COMP_SIZE0(sizes8[14],alignvlen_t,char); - - COMP_SIZE0(sizes16[1],char,short); - COMP_SIZE0(sizes16[2],unsigned char,short); - COMP_SIZE0(sizes16[3],short,short); - COMP_SIZE0(sizes16[4],unsigned short,short); - COMP_SIZE0(sizes16[5],int,short); - COMP_SIZE0(sizes16[6],unsigned int,short); - COMP_SIZE0(sizes16[7],long,short); - COMP_SIZE0(sizes16[8],unsigned long,short); - COMP_SIZE0(sizes16[9],long long,short); - COMP_SIZE0(sizes16[10],unsigned long long,short); - COMP_SIZE0(sizes16[11],float,short); - COMP_SIZE0(sizes16[12],double,short) ; - COMP_SIZE0(sizes16[13],void*,short); - COMP_SIZE0(sizes16[14],alignvlen_t*,short); - - COMP_SIZE0(sizes32[1],char,int); - COMP_SIZE0(sizes32[2],unsigned char,int); - COMP_SIZE0(sizes32[3],short,int); - COMP_SIZE0(sizes32[4],unsigned short,int); - COMP_SIZE0(sizes32[5],int,int); - COMP_SIZE0(sizes32[6],unsigned int,int); - COMP_SIZE0(sizes32[7],long,int); - COMP_SIZE0(sizes32[8],unsigned long,int); - COMP_SIZE0(sizes32[9],long long,int); - COMP_SIZE0(sizes32[10],unsigned long long,int); - COMP_SIZE0(sizes32[11],float,int); - COMP_SIZE0(sizes32[12],double,int) ; - COMP_SIZE0(sizes32[13],void*,int); - COMP_SIZE0(sizes32[14],alignvlen_t*,int); - - COMP_ALIGNMENT1(vec16[1],char,short); - COMP_ALIGNMENT1(vec16[2],unsigned char,short); - COMP_ALIGNMENT1(vec16[3],short,short); - COMP_ALIGNMENT1(vec16[4],unsigned short,short); - COMP_ALIGNMENT1(vec16[5],int,short); - COMP_ALIGNMENT1(vec16[6],unsigned int,short); - COMP_ALIGNMENT1(vec32[7],long,short); - COMP_ALIGNMENT1(vec32[8],unsigned long,short); - COMP_ALIGNMENT1(vec32[9],long long,short); - COMP_ALIGNMENT1(vec32[10],unsigned long long,short); - COMP_ALIGNMENT1(vec16[11],float,short); - COMP_ALIGNMENT1(vec16[12],double,short); - COMP_ALIGNMENT1(vec16[13],void*,short); - COMP_ALIGNMENT1(vec16[14],alignvlen_t*,short); - - COMP_ALIGNMENT1(vec32[1],char,short); - COMP_ALIGNMENT1(vec32[2],unsigned char,short); - COMP_ALIGNMENT1(vec32[3],char,short); - COMP_ALIGNMENT1(vec32[4],unsigned short,short); - COMP_ALIGNMENT1(vec32[5],int,int); - COMP_ALIGNMENT1(vec32[6],unsigned int,int); - COMP_ALIGNMENT1(vec32[7],long,int); - COMP_ALIGNMENT1(vec32[8],unsigned long,int); - COMP_ALIGNMENT1(vec32[9],long long,int); - COMP_ALIGNMENT1(vec32[10],unsigned long long,int); - COMP_ALIGNMENT1(vec32[11],float,int); - COMP_ALIGNMENT1(vec32[12],double,int); - COMP_ALIGNMENT1(vec32[13],void*,int); - COMP_ALIGNMENT1(vec32[14],alignvlen_t*,int); - - for(i=0;i - , public CReduceDomainToScalarAttributes - , public CTransformation - { - public : - typedef CObjectTemplate SuperClass; - typedef CReduceDomainToScalarAttributes SuperClassAttribute; - typedef CReduceDomainToScalar MyClass ; - typedef CTransformation SuperTransform ; - - public : - /// Constructeurs /// - CReduceDomainToScalar(void); - explicit CReduceDomainToScalar(const StdString& id); - - /// Destructeur /// - virtual ~CReduceDomainToScalar(void); - - virtual void checkValid(CScalar* scalarDst, CDomain* domainSrc); - - /// Accesseurs statiques /// - static StdString GetName(void); - static StdString GetDefName(void); - static ENodeType GetType(void); - const string& getId(void) { return this->SuperClass::getId();} - ETranformationType getTransformationType(void) { return TRANS_REDUCE_DOMAIN_TO_SCALAR ;} - static CTransformation* getTransformation(const StdString& id) { return SuperClass::get(id);} - virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} - virtual shared_ptr createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) ; - private: - static bool registerTrans(); - static CTransformation* create(const StdString& id, xml::CXMLNode* node); - static bool _dummyRegistered; - }; // class CReduceDomainToScalar - - DECLARE_GROUP(CReduceDomainToScalar); -} // namespace xios - -#endif // __XIOS_CReduceDomainToScalar__ diff --git a/xios_2311_src/trunk/.svn/pristine/4d/4dc266f4b2bb0642671f2376b00381b33549402d.svn-base b/xios_2311_src/trunk/.svn/pristine/4d/4dc266f4b2bb0642671f2376b00381b33549402d.svn-base deleted file mode 100644 index 80cb06d1d7fefd40d024d979eebbf2c0985bbc0b..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/4d/4dc266f4b2bb0642671f2376b00381b33549402d.svn-base +++ /dev/null @@ -1,96 +0,0 @@ -#ifndef __CONTEXTS_MANAGER_HPP__ -#define __CONTEXTS_MANAGER_HPP__ - -#include "xios_spl.hpp" -#include "mpi.hpp" -#include "buffer_in.hpp" -#include "buffer_out.hpp" - -#include -#include -#include "window_manager.hpp" -#include "register_context_info.hpp" - - -namespace xios -{ - - class CContextsManager - { - private: - - const int NOTIFY_NOTHING=0 ; - const int NOTIFY_CREATE_CONTEXT=1 ; - const int NOTIFY_CREATE_INTERCOMM=2 ; - - - public: - - CContextsManager(bool isXiosServer) ; - ~CContextsManager() ; - - bool createServerContext(const std::string& poolId, const std::string& serviceId, const int& partitionId, const string& contextId, bool wait=true) ; - - bool createServerContextIntercomm(const std::string& poolId, const std::string& serviceId, const int& partitionId, - const std::string& contextId, const string& sourceContext, bool wait=true) ; - - string getServerContextName(const std::string& poolId, const std::string& serviceId, const int& partitionId, - const int& type, const string& contextId) ; - - - void sendNotification(int rank); - void checkNotifications(void) ; - - void eventLoop(void) ; - void notificationsDumpOut(CBufferOut& buffer) ; - void notificationsDumpIn(CBufferIn& buffer) ; - - void registerContext(const std::string& fullContextId, const SRegisterContextInfo& contextInfo) ; - - bool getContextInfo(const std::string& fullContextId, SRegisterContextInfo& contextInfo, MPI_Comm comm=MPI_COMM_NULL) ; - bool getContextPoolId(const string& fullContextId, string& poolId, MPI_Comm comm=MPI_COMM_NULL) ; - bool getContextServiceId(const string& fullContextId, string& serviceId, MPI_Comm comm=MPI_COMM_NULL) ; - bool getContextPartitionId(const string& fullContextId, int& partitionId, MPI_Comm comm=MPI_COMM_NULL) ; - bool getContextId(const string& fullContextId, string& contextId, MPI_Comm comm=MPI_COMM_NULL) ; - bool getContextLeader(const string& fullContextId, int& leader, MPI_Comm comm=MPI_COMM_NULL) ; - bool getContextSize(const string& fullContextId, int& size, MPI_Comm comm=MPI_COMM_NULL) ; - bool getContextServiceType(const string& fullContextId, int& serviceType, MPI_Comm comm=MPI_COMM_NULL) ; - - bool hasContext(const std::string& fullContextId, MPI_Comm comm=MPI_COMM_NULL) ; - - void contextsDumpOut(CBufferOut& buffer) ; - void contextsDumpIn(CBufferIn& buffer) ; - - void createServerContext(void) ; //private - void createServerContextIntercomm(void) ; //private - - private : - - CWindowManager* winContexts_ ; - CWindowManager* winNotify_ ; - - - const size_t maxBufferSize_=1024*1024 ; - - MPI_Comm xiosComm_ ; - - int notifyType_ ; - tuple notifyCreateContext_ ; - tuple notifyCreateIntercomm_ ; - - std::map contexts_ ; - - int managerGlobalLeader_ ; - - const double eventLoopLatency_=0; - double lastEventLoop_=0. ; - - friend class CWindowManager ; - - } ; - -} - - - -#endif diff --git a/xios_2311_src/trunk/.svn/pristine/4e/4e0ecdee0c35a9ed82c706d3ec68b89e10585200.svn-base b/xios_2311_src/trunk/.svn/pristine/4e/4e0ecdee0c35a9ed82c706d3ec68b89e10585200.svn-base deleted file mode 100644 index 36471ce39959e7560ab5ff963dbbe22e6c7044ef..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/4e/4e0ecdee0c35a9ed82c706d3ec68b89e10585200.svn-base +++ /dev/null @@ -1,62 +0,0 @@ -/* Copyright 2010, University Corporation for Atmospheric Research. See - COPYRIGHT file for copying and redistribution conditions. - - This file is part of netcdf-4, a netCDF-like interface for HDF5, or - a HDF5 backend for netCDF, depending on your point of view. - - This file contains macros and prototyes relating to logging. - - $Id: nc_logging.h,v 1.1 2010/06/01 15:34:49 ed Exp $ -*/ - -#ifndef _NCLOGGING_ -#define _NCLOGGING_ - -#include -#include - -#ifdef LOGGING - -/* To log something... */ -void nc_log(int severity, const char *fmt, ...); -void nc_log_hdf5(void); - -#define LOG(e) nc_log e - -/* To log based on error code, and set retval. */ -#define BAIL2(e) do { \ -retval = e; \ -LOG((0, "file %s, line %d.\n%s", __FILE__, __LINE__, nc_strerror(e))); \ -nc_log_hdf5(); \ -} while (0) - -/* To log an error message, set retval, and jump to exit. */ -#define BAIL(e) do { \ -BAIL2(e); \ -goto exit; \ -} while (0) - -/* To set retval and jump to exit, without logging error message. */ -#define BAIL_QUIET(e) do { \ -retval = e; \ -goto exit; \ -} while (0) - -#else - -/* These definitions will be used unless LOGGING is defined. */ -#define LOG(e) -#define BAIL(e) do { \ -retval = e; \ -goto exit; \ -} while (0) -#define BAIL_QUIET BAIL -#define BAIL2(e) do { \ -goto exit; \ -} while (0) -#define nc_set_log_level(e) -#endif - -#endif /* _NCLOGGING_ */ - - diff --git a/xios_2311_src/trunk/.svn/pristine/4e/4e16bda5f08fbd6f8b80e302ded8466a2628a376.svn-base b/xios_2311_src/trunk/.svn/pristine/4e/4e16bda5f08fbd6f8b80e302ded8466a2628a376.svn-base deleted file mode 100644 index 1529e48d77d40ea6b462fae86fe558bfceecb3a4..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/4e/4e16bda5f08fbd6f8b80e302ded8466a2628a376.svn-base +++ /dev/null @@ -1,20 +0,0 @@ -#include "release_static_allocation.hpp" -#include "operator_expr.hpp" -#include "netCdf_cf_constant.hpp" -#include "context.hpp" -#include "server_context.hpp" -#include "timer.hpp" -#include "mem_checker.hpp" - -namespace xios -{ - void releaseStaticAllocation(void) - { - CContext::releaseStaticAllocation() ; // free memory from static allocation - CCFConvention::releaseStaticAllocation() ; // free memory from static allocation - CServerContext::releaseStaticAllocation() ; - CTimer::release() ; - CMemChecker::release() ; - operatorExpr.release(); - } -} \ No newline at end of file diff --git a/xios_2311_src/trunk/.svn/pristine/4e/4e3ea922d3d17b38b349c9e4ef87b11c7403ad7e.svn-base b/xios_2311_src/trunk/.svn/pristine/4e/4e3ea922d3d17b38b349c9e4ef87b11c7403ad7e.svn-base deleted file mode 100644 index 05c6382ba10c9667145832e1989846102548e6ee..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/4e/4e3ea922d3d17b38b349c9e4ef87b11c7403ad7e.svn-base +++ /dev/null @@ -1,132 +0,0 @@ -#ifndef __XIOS_SCALAR_EXPR_NODE_HPP__ -#define __XIOS_SCALAR_EXPR_NODE_HPP__ - -#include -#include - -namespace xios -{ - /*! - * Interface implemented by all the nodes of a tree representing an expression - * which can be reduced to a scalar value. - */ - struct IScalarExprNode - { - /*! - * Builds a filter graph corresponding to the expression tree. - * - * \return the output pin of the filter producing the result of the expression - */ - virtual double reduce() const = 0; - }; - - /*! - * Expression node corresponding to a scalar value. - */ - class CScalarValExprNode : public IScalarExprNode - { - public: - /*! - * Constructs an expression node corresponding to the specified scalar value. - * - * \param strVal the string representation of the scalar value - */ - CScalarValExprNode(const std::string& strVal); - - double reduce() const; - - private: - std::string strVal; //!< The string representation of the scalar value - }; - - /*! - * Expression node corresponding to a scalar variable. - */ - class CScalarVarExprNode : public IScalarExprNode - { - public: - /*! - * Constructs an expression node corresponding - * to the scalar variable whose id is provided. - * - * \param varId the identifier of the scalar variable - */ - CScalarVarExprNode(const std::string& varId); - - double reduce() const; - - private: - std::string varId; //!< The identifier of the field - }; - - /*! - * Expression node corresponding to a unary operation on a scalar. - */ - class CScalarUnaryOpExprNode : public IScalarExprNode - { - public: - /*! - * Constructs an expression node corresponding to the specified unary operation - * applied to the provided scalar node. - * Note that the child node will be destroyed automatically when the parent node - * is destroyed. - * - * \param opId the identifier of the operator - * \param child the scalar child node to which the operator is applied - */ - CScalarUnaryOpExprNode(const std::string& opId, IScalarExprNode* child); - - double reduce() const; - - private: - std::string opId; //!< The identifier of the field - boost::scoped_ptr child; //!< The scalar child node to which the operator is applied - }; - - /*! - * Expression node corresponding to a binary operation on two scalars. - */ - class CScalarBinaryOpExprNode : public IScalarExprNode - { - public: - /*! - * Constructs an expression node corresponding to the specified binary operation - * applied to the provided scalar child nodes. - * Note that the child nodes will be destroyed automatically when the parent node - * is destroyed. - * - * \param opId the identifier of the operator - * \param child1, child2 the scalar child nodes to which the operator is applied - */ - CScalarBinaryOpExprNode(IScalarExprNode* child1, const std::string& opId, IScalarExprNode* child2); - - double reduce() const; - - private: - std::string opId; //!< The identifier of the field - boost::scoped_ptr child1, child2; //!< The scalar child nodes to which the operator is applied - }; - - class CScalarTernaryOpExprNode : public IScalarExprNode - { - public: - /*! - * Constructs an expression node corresponding to the specified ternary operation - * applied to the provided scalar child nodes. - * Note that the child nodes will be destroyed automatically when the parent node - * is destroyed. - * - * \param opId the identifier of the operator - * \param child1, child2 , child3 the scalar child nodes to which the operator is applied - */ - CScalarTernaryOpExprNode(IScalarExprNode* child1, const std::string& opId, IScalarExprNode* child2, IScalarExprNode* child3); - - double reduce() const; - - private: - std::string opId; //!< The identifier of the field - boost::scoped_ptr child1, child2, child3; //!< The scalar child nodes to which the operator is applied - }; -} - -#endif // __XIOS_SCALAR_EXPR_NODE_HPP__ diff --git a/xios_2311_src/trunk/.svn/pristine/4e/4e715c6aab1ab8b4bbfb70bf0308eb1726ba4aaa.svn-base b/xios_2311_src/trunk/.svn/pristine/4e/4e715c6aab1ab8b4bbfb70bf0308eb1726ba4aaa.svn-base deleted file mode 100644 index d4c5b8d9247969058173b59c9b777f7040e88a66..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/4e/4e715c6aab1ab8b4bbfb70bf0308eb1726ba4aaa.svn-base +++ /dev/null @@ -1,73 +0,0 @@ -#ifndef __XIOS_SPL__ -#define __XIOS_SPL__ - -/// standard C++ headers /// -#include -#include -#include -#include -#include -// standard C -#include -#include - -#include -// bug in cmath header => macro collision marco with DOMAIN -#ifdef DOMAIN -#undef DOMAIN -#endif - -#include - -// Conteneurs. -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// Flux. -#include -#include -#include - -/// boost headers /// -#include -#include - -/// Map /// -#define xios_map std::map - -/// Macro /// -#define UNUSED(parameter) - -/// Définition de types (issus de la bibliothèque standard)/// -typedef std::ostringstream StdOStringStream; -typedef std::istringstream StdIStringStream; -typedef std::stringstream StdStringStream; -typedef std::ofstream StdOFStream; -typedef std::ifstream StdIFStream; -typedef std::ostream StdOStream; -typedef std::istream StdIStream; -typedef std::string StdString; -typedef std::size_t StdSize; - -typedef unsigned short int ushort; -typedef unsigned int uint; -typedef unsigned long int ulong; -typedef long long int longlong; -typedef unsigned long long int ulonglong; - -const size_t stringArrayLen=255 ; - -/// XIOS headers /// -#include "configure.hpp" -#include "log.hpp" -using namespace std; -//using namespace boost ; - -#endif //__XIOS_SPL__ diff --git a/xios_2311_src/trunk/.svn/pristine/4e/4e747c8dda46933b41ef680153e895fd3085753e.svn-base b/xios_2311_src/trunk/.svn/pristine/4e/4e747c8dda46933b41ef680153e895fd3085753e.svn-base deleted file mode 100644 index ea1e15a0727618074cbfd091d554f7cad948ae1e..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/4e/4e747c8dda46933b41ef680153e895fd3085753e.svn-base +++ /dev/null @@ -1,165 +0,0 @@ -#include "temporal_filter.hpp" -#include "functor_type.hpp" -#include "calendar_util.hpp" -#include "workflow_graph.hpp" - -namespace xios -{ - static func::CFunctor* createFunctor(const std::string& opId, bool ignoreMissingValue, CArray& tmpData); - - CTemporalFilter::CTemporalFilter(CGarbageCollector& gc, const std::string& opId, - const CDate& initDate, const CDuration samplingFreq, const CDuration samplingOffset, const CDuration opFreq, - bool ignoreMissingValue /*= false*/) - : CFilter(gc, 1, this) - , functor(createFunctor(opId, ignoreMissingValue, tmpData)) - , isOnceOperation(functor->timeType() == func::CFunctor::once) - , isInstantOperation(functor->timeType() == func::CFunctor::instant) - , samplingFreq(samplingFreq) - , samplingOffset(samplingOffset) - , opFreq(opFreq) - , offsetMonth(0, this->samplingOffset.month, 0, 0, 0, 0, 0) - , offsetAllButMonth(this->samplingOffset.year, 0 , this->samplingOffset.day, - this->samplingOffset.hour, this->samplingOffset.minute, - this->samplingOffset.second, this->samplingOffset.timestep) - , initDate(initDate) -// , nextSamplingDate(initDate + (this->samplingOffset + initDate.getRelCalendar().getTimeStep())) - , nextSamplingDate(initDate + offsetMonth + ( offsetAllButMonth + initDate.getRelCalendar().getTimeStep())) - , nbOperationDates(1) - , nbSamplingDates(0) -// , nextOperationDate(initDate + opFreq + this->samplingOffset) - , isFirstOperation(true) - , graphCycleCompleted(true) - , temporalOperation(opId) - { - } - - std::string CTemporalFilter::getTemporalOperation() - { - return this->temporalOperation; - } - - void CTemporalFilter::buildWorkflowGraph(std::vector data) - { - if(this->graphEnabled ) - { - if(!data[0]->graphPackage) - { - data[0]->graphPackage = new CGraphDataPackage; - } - - if(graphCycleCompleted) - { - this->graphPackage->filterId = CWorkflowGraph::getNodeSize(); - CWorkflowGraph::addNode("Temporal filter \\n("+getTemporalOperation()+")", 3, false, 0, data[0]); - graphCycleCompleted = false; - } - - data[0]->graphPackage->currentField = this->graphPackage->inFields[0]; - std::rotate(this->graphPackage->inFields.begin(), this->graphPackage->inFields.begin() + 1, this->graphPackage->inFields.end()); - - CWorkflowGraph::addEdge(data[0]->graphPackage->fromFilter, this->graphPackage->filterId, data[0]); - data[0]->graphPackage->fromFilter = this->graphPackage->filterId; - // this->graphPackage->sourceFilterIds.push_back(data[0]->graphPackage->fromFilter); - data[0]->graphPackage->currentField = this->graphPackage->inFields[0]; - std::rotate(this->graphPackage->inFields.begin(), this->graphPackage->inFields.begin() + 1, this->graphPackage->inFields.end()); - } - - } - - CDataPacketPtr CTemporalFilter::apply(std::vector data) - { - buildWorkflowGraph(data); - - CDataPacketPtr packet; - - if (data[0]->status != CDataPacket::END_OF_STREAM) - { - bool usePacket, outputResult, copyLess; - if (isOnceOperation) - usePacket = outputResult = copyLess = isFirstOperation; - else - { - usePacket = (data[0]->date >= nextSamplingDate); - outputResult = (data[0]->date > initDate + nbOperationDates*opFreq - samplingFreq + offsetMonth + offsetAllButMonth); - copyLess = (isInstantOperation && usePacket && outputResult); - } - - if (usePacket) - { - nbSamplingDates ++; - if (!copyLess) - { - if (!tmpData.numElements()) - tmpData.resize(data[0]->data.numElements()); - - (*functor)(data[0]->data); - } - - nextSamplingDate = ((initDate + offsetMonth) + nbSamplingDates * samplingFreq) + offsetAllButMonth + initDate.getRelCalendar().getTimeStep(); - } - - if (outputResult) - { - nbOperationDates ++; - if (!copyLess) - { - functor->final(); - - packet = CDataPacketPtr(new CDataPacket); - packet->date = data[0]->date; - packet->timestamp = data[0]->timestamp; - packet->status = data[0]->status; - packet->data.resize(tmpData.numElements()); - packet->data = tmpData; - packet->graphPackage = data[0]->graphPackage; - } - else - packet = data[0]; - - isFirstOperation = false; - graphCycleCompleted = true; - } - } - - return packet; - } - - bool CTemporalFilter::mustAutoTrigger() const - { - return true; - } - - bool CTemporalFilter::isDataExpected(const CDate& date) const - { -// return isOnceOperation ? isFirstOperation : (date >= nextSamplingDate || date + samplingFreq > nextOperationDate); - return isOnceOperation ? isFirstOperation : (date >= nextSamplingDate || date > initDate + nbOperationDates*opFreq - samplingFreq + offsetMonth + offsetAllButMonth); - } - - static func::CFunctor* createFunctor(const std::string& opId, bool ignoreMissingValue, CArray& tmpData) - { - func::CFunctor* functor = NULL; - - double defaultValue = std::numeric_limits::quiet_NaN(); - -#define DECLARE_FUNCTOR(MType, mtype) \ - if (opId.compare(#mtype) == 0) \ - { \ - if (ignoreMissingValue) \ - { \ - functor = new func::C##MType(tmpData, defaultValue); \ - } \ - else \ - { \ - functor = new func::C##MType(tmpData); \ - } \ - } - -#include "functor_type.conf" - - if (!functor) - ERROR("createFunctor(const std::string& opId, ...)", - << "\"" << opId << "\" is not a valid operation."); - - return functor; - } -} // namespace xios diff --git a/xios_2311_src/trunk/.svn/pristine/4e/4ea7a28ac92d5f04877f47881d92064e81fb51ab.svn-base b/xios_2311_src/trunk/.svn/pristine/4e/4ea7a28ac92d5f04877f47881d92064e81fb51ab.svn-base deleted file mode 100644 index 491f72d6c9fb60395e3da9228d1e77188d07e042..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/4e/4ea7a28ac92d5f04877f47881d92064e81fb51ab.svn-base +++ /dev/null @@ -1,63 +0,0 @@ -/*! - \file axis_algorithm_reduce_domain.hpp - \author Ha NGUYEN - \since 23 June 2016 - \date 23 June 2016 - - \brief Algorithm for reduce an axis to a axis - */ -#ifndef __XIOS_AXIS_ALGORITHM_REDUCE_DOMAIN_HPP__ -#define __XIOS_AXIS_ALGORITHM_REDUCE_DOMAIN_HPP__ - -#include "algorithm_transformation_reduce.hpp" -#include "transformation.hpp" - -namespace xios { - -class CAxis; -class CDomain; -class CReduceDomainToAxis; -class CReductionAlgorithm; - -/*! - \class CAxisAlgorithmReduceDomain - Reduce a domain to an axis -*/ -class CAxisAlgorithmReduceDomain : public CAlgorithmTransformationReduce -{ -public: - CAxisAlgorithmReduceDomain(bool isSource, CAxis* axisDestination, CDomain* domainSource, CReduceDomainToAxis* algo); - - virtual ~CAxisAlgorithmReduceDomain(); - - static bool registerTrans(); - virtual StdString getAlgoName() {return "\\nreduce_domain";} - -protected: - enum ReduceDirection { - undefined = 0, - iDir = 1, - jDir = 2 - }; - - ReduceDirection dir_; - bool local ; - - CDomain* domainSrc_ ; - CAxis* axisDest_ ; - -public: - static shared_ptr create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition); - static bool dummyRegistered_; -}; - -} -#endif // __XIOS_AXIS_ALGORITHM_REDUCE_DOMAIN_HPP__ diff --git a/xios_2311_src/trunk/.svn/pristine/4e/4ec6fd0b1906d79bffa23b341f54c8514b5895b5.svn-base b/xios_2311_src/trunk/.svn/pristine/4e/4ec6fd0b1906d79bffa23b341f54c8514b5895b5.svn-base deleted file mode 100644 index 85795930a684325958fc9af33389d45cfcb95139..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/4e/4ec6fd0b1906d79bffa23b341f54c8514b5895b5.svn-base +++ /dev/null @@ -1,14 +0,0 @@ -/*! - \file globalScopeData.hpp - \author Ha NGUYEN - \since 24 Sep 2014 - \date 24 Sep 2014 - - Global scope variable and object definitions - */ -#ifndef __GLOBAL_SCOPE_DATA_HPP__ -#define __GLOBAL_SCOPE_DATA_HPP__ - -const int INVALID_RANK = -1; - -#endif // __GLOBAL_SCOPE_DATA__ diff --git a/xios_2311_src/trunk/.svn/pristine/4e/4ed454ef86ec14e1151e6047bb784f8ebcd16c0d.svn-base b/xios_2311_src/trunk/.svn/pristine/4e/4ed454ef86ec14e1151e6047bb784f8ebcd16c0d.svn-base deleted file mode 100644 index 9998cb89e917dd356429dfaf524534f938907441..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/4e/4ed454ef86ec14e1151e6047bb784f8ebcd16c0d.svn-base +++ /dev/null @@ -1,68 +0,0 @@ -/*! - \file distribution_server.hpp - \author Ha NGUYEN - \since 13 Jan 2015 - \date 04 Feb 2015 - - \brief Index distribution on server side. - */ - -#ifndef __XIOS_DISTRIBUTION_SERVER_HPP__ -#define __XIOS_DISTRIBUTION_SERVER_HPP__ - -#include "distribution.hpp" - -namespace xios { - -/*! - \class CDistributionServer - The class, for now, plays a role of computing local index for writing data on server -*/ -class CDistributionServer : public CDistribution -{ - public: - /** Default constructor */ - CDistributionServer(int rank, int dims, const CArray& globalIndex = CArray()); - CDistributionServer(int rank, const std::vector& nBeginServer, - const std::vector& nSizeServer, const std::vector& nGlobal); - CDistributionServer(int rank, const std::vector& nBeginServer, - const std::vector& nSizeServer, - const std::vector& nBeginGlobal, - const std::vector& nGlobal); - - CDistributionServer(int rank, - const std::vector >& globalIndexElements, - const CArray& elementOrder, - const std::vector& nBeginServer, - const std::vector& nSizeServer, - const std::vector& nBeginGlobal, - const std::vector& nGlobal); - - /** Default destructor */ - virtual ~CDistributionServer(); - - const GlobalLocalMap& getGlobalLocalIndex() const { return globalLocalIndexMap_; } - int getGridSize() const; - - virtual void computeLocalIndex(CArray& globalIndex); - virtual void computeGlobalIndex(CArray& indexes) const; - virtual void partialClear(void); //! clear heavy sized attibutes - - protected: - virtual void createGlobalIndex(); - void createGlobalIndex(const std::vector >& globalIndexElements, - const CArray& elementOrder); - - protected: - GlobalLocalMap globalLocalIndexMap_; - - private: - std::vector nGlobal_; - std::vector nBeginGlobal_; - std::vector nSize_; - std::vector nBegin_; - -}; - -} // namespace xios -#endif // __XIOS_DISTRIBUTION_SERVER_HPP__ diff --git a/xios_2311_src/trunk/.svn/pristine/4e/4ed916f3d6dc5a9dfbe2fc3fa8760dae625f063c.svn-base b/xios_2311_src/trunk/.svn/pristine/4e/4ed916f3d6dc5a9dfbe2fc3fa8760dae625f063c.svn-base deleted file mode 100644 index 228a2377cd7ed1dc9ee25c8bdc03c664d5ce1002..0000000000000000000000000000000000000000 Binary files a/xios_2311_src/trunk/.svn/pristine/4e/4ed916f3d6dc5a9dfbe2fc3fa8760dae625f063c.svn-base and /dev/null differ diff --git a/xios_2311_src/trunk/.svn/pristine/4e/4ed9a163c2ae060588e650070ac7c5bdf3a055ef.svn-base b/xios_2311_src/trunk/.svn/pristine/4e/4ed9a163c2ae060588e650070ac7c5bdf3a055ef.svn-base deleted file mode 100644 index 668df4d6c54bd5bc196630e96908c16417118a20..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/4e/4ed9a163c2ae060588e650070ac7c5bdf3a055ef.svn-base +++ /dev/null @@ -1,149 +0,0 @@ -/********************************************************************* - * Copyright 1993, UCAR/Unidata - * See netcdf/COPYRIGHT file for copying and redistribution conditions. - * $Header: /upc/share/CVS/netcdf-3/libncdap3/ncdap3.h,v 1.40 2010/05/30 19:45:52 dmh Exp $ - *********************************************************************/ -#ifndef NCDAP3_H -#define NCDAP3_H 1 - -#include "config.h" -#include -#include -#include -#include -#include -#include - -#include "ncbytes.h" -#include "nclist.h" -#include "nchashmap.h" -#include "nclog.h" -#include "nc_uri.h" -#include "fbits.h" -#include "dceconstraints.h" - -#include "oc.h" - -#include "nc.h" -#include "netcdf.h" -#include "ncdispatch.h" - /* netcdf overrides*/ -#include "dapnc.h" - -#include "dapdebug.h" -#include "daputil.h" - -/**************************************************/ -/* sigh, do the forwards */ -struct NCprojection; -struct NCselection; -struct Getvara; -struct NCcachenode; -struct NCcache; -struct NCslice; -struct NCsegment; - -/**************************************************/ - -#include "nccommon.h" -#include "getvara.h" -#include "constraints3.h" - -/**************************************************/ - -#ifndef USE_NETCDF4 -#define NC_UBYTE 7 /* unsigned 1 byte int */ -#define NC_USHORT 8 /* unsigned 2-byte int */ -#define NC_UINT 9 /* unsigned 4-byte int */ -#define NC_INT64 10 /* signed 8-byte int */ -#define NC_UINT64 11 /* unsigned 8-byte int */ -#define NC_STRING 12 /* string */ - -#define NC_MAX_BYTE 127 -#define NC_MIN_BYTE (-NC_MAX_BYTE-1) -#define NC_MAX_CHAR 255 -#define NC_MAX_SHORT 32767 -#define NC_MIN_SHORT (-NC_MAX_SHORT - 1) -#define NC_MAX_INT 2147483647 -#define NC_MIN_INT (-NC_MAX_INT - 1) -#define NC_MAX_FLOAT 3.402823466e+38f -#define NC_MIN_FLOAT (-NC_MAX_FLOAT) -#define NC_MAX_DOUBLE 1.7976931348623157e+308 -#define NC_MIN_DOUBLE (-NC_MAX_DOUBLE) -#define NC_MAX_UBYTE NC_MAX_CHAR -#define NC_MAX_USHORT 65535U -#define NC_MAX_UINT 4294967295U -#define NC_MAX_INT64 (9223372036854775807LL) -#define NC_MIN_INT64 (-9223372036854775807LL-1) -#define NC_MAX_UINT64 (18446744073709551615ULL) -#define X_INT64_MAX (9223372036854775807LL) -#define X_INT64_MIN (-X_INT64_MAX - 1) -#define X_UINT64_MAX (18446744073709551615ULL) -#endif /*USE_NETCDF4*/ - - -/**************************************************/ - -extern struct NCTMODEL nctmodels[]; - -/**************************************************/ -/* Import some internal procedures from libsrc*/ - -/* Internal, but non-static procedures */ -extern NCerror computecdfvarnames3(NCDAPCOMMON*,CDFnode*,NClist*); -extern NCerror computecdfnodesets3(NCDAPCOMMON* drno); -extern NCerror computevarnodes3(NCDAPCOMMON*, NClist*, NClist*); -extern NCerror collectvardefdims(NCDAPCOMMON* drno, CDFnode* var, NClist* dimset); -extern NCerror fixgrids3(NCDAPCOMMON* drno); -extern NCerror dapmerge3(NCDAPCOMMON* drno, CDFnode* node, OCobject dasroot); -extern NCerror sequencecheck3(NCDAPCOMMON* drno); -extern NCerror computecdfdimnames3(NCDAPCOMMON*); -extern NCerror attachdatadds3(struct NCDAPCOMMON*); -extern NCerror detachdatadds3(struct NCDAPCOMMON*); -extern void dapdispatch3init(void); - -/* -extern void dereference3(NCconstraint* constraint); -extern NCerror rereference3(NCconstraint*, NClist*); -*/ - -extern NCerror buildvaraprojection3(struct Getvara*, - const size_t* startp, const size_t* countp, const ptrdiff_t* stridep, - struct DCEprojection** projectionlist); - -extern NCerror nc3d_getvarx(int ncid, int varid, - const size_t *startp, - const size_t *countp, - const ptrdiff_t *stridep, - void *data, - nc_type dsttype0); - -/**************************************************/ - -/* From: ncdap3.c*/ -extern NCerror nc3d_open(const char* path, int mode, int* ncidp); -extern int nc3d_close(int ncid); -extern int nc3dinitialize(void); -extern NCerror regrid3(CDFnode* ddsroot, CDFnode* template, NClist*); -extern void setvisible(CDFnode* root, int visible); -extern NCerror mapnodes3(CDFnode* dstroot, CDFnode* srcroot); -extern void unmap3(CDFnode* root); - -/* From: ncdap3a.c*/ -extern NCerror fetchtemplatemetadata3(NCDAPCOMMON* nccomm); -extern NCerror fetchconstrainedmetadata3(NCDAPCOMMON* nccomm); -extern void applyclientparamcontrols3(NCDAPCOMMON*); -extern NCerror suppressunusablevars3(NCDAPCOMMON*); -extern NCerror addstringdims(NCDAPCOMMON* drno); -extern NCerror defseqdims(NCDAPCOMMON* drno); -extern NCerror fixzerodims3(NCDAPCOMMON*); -extern void estimatevarsizes3(NCDAPCOMMON*); -extern NCerror defrecorddim3(NCDAPCOMMON*); -extern NCerror showprojection3(NCDAPCOMMON*, CDFnode* var); - - -/* From: dapcvt.c*/ -extern NCerror dapconvert3(nc_type, nc_type, char*, char*, size_t); -extern int dapcvtattrval3(nc_type, void*, NClist*); - -#endif /*NCDAP3_H*/ diff --git a/xios_2311_src/trunk/.svn/pristine/4e/4ef2fbe9f2893952e6c2481c40c3a8ad69f3e508.svn-base b/xios_2311_src/trunk/.svn/pristine/4e/4ef2fbe9f2893952e6c2481c40c3a8ad69f3e508.svn-base deleted file mode 100644 index 2301be22bccebcabee33cb9a33a842ecc070fc7d..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/4e/4ef2fbe9f2893952e6c2481c40c3a8ad69f3e508.svn-base +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include "elt.hpp" - -namespace sphereRemap { - -void cptEltGeom(Elt& elt, const Coord &pole); -void cptAllEltsGeom(Elt *elt, int N, const Coord &pole); -void update_baryc(Elt *elt, int N); -void computeGradients(Elt **elt, int N); - -} diff --git a/xios_2311_src/trunk/.svn/pristine/4f/4f0c91e7283b2d7cb3acfaf7f7b6b67f4bc15311.svn-base b/xios_2311_src/trunk/.svn/pristine/4f/4f0c91e7283b2d7cb3acfaf7f7b6b67f4bc15311.svn-base deleted file mode 100644 index e8bb00869d4ecdd07b76efde1936c2b0da7f0fe6..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/4f/4f0c91e7283b2d7cb3acfaf7f7b6b67f4bc15311.svn-base +++ /dev/null @@ -1,302 +0,0 @@ -/* - * Copyright 1996, University Corporation for Atmospheric Research - * See netcdf/COPYRIGHT file for copying and redistribution conditions. - */ -/* $Id: string.c,v 1.76 2010/05/26 21:43:33 dmh Exp $ */ - -#include "config.h" -#include -#include -#include -#include -#include -#include "nc.h" -#include "rnd.h" -#include "utf8proc.h" - - -/* There are 3 levels of UTF8 checking: 1=> (exact)validating 2=>relaxed - and 3=>very relaxed -*/ -/* Use semi-relaxed check */ -#define UTF8_CHECK 2 - -/* - * Free string, and, if needed, its values. - * Formerly -NC_free_string() - */ -void -free_NC_string(NC_string *ncstrp) -{ - if(ncstrp==NULL) - return; - free(ncstrp); -} - - -int -nextUTF8(const char* cp) -{ - /* The goal here is to recognize the length of each - multibyte utf8 character sequence and skip it. - Again, we assume that every non-ascii character is legal. - We can define three possible tests of decreasing correctness - (in the sense that the least correct will allow some sequences that - are technically illegal UTF8). - As Regular expressions they are as follows: - 1. most correct: - UTF8 ([\xC2-\xDF][\x80-\xBF]) \ - | (\xE0[\xA0-\xBF][\x80-\xBF]) \ - | ([\xE1-\xEC][\x80-\xBF][\x80-\xBF]) \ - | (\xED[\x80-\x9F][\x80-\xBF]) \ - | ([\xEE-\xEF][\x80-\xBF][\x80-\xBF]) \ - | (\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF]) \ - | ([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF]) \ - | (\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF]) \ - - 2. partially relaxed: - UTF8 ([\xC0-\xDF][\x80-\xBF]) - |([\xE0-\xEF][\x80-\xBF][\x80-\xBF]) - |([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF]) - - 3. The most relaxed version of UTF8: - UTF8 ([\xC0-\xD6].)|([\xE0-\xEF]..)|([\xF0-\xF7]...) - - We use #2 here. - - The tests are derived from the table at - http://www.w3.org/2005/03/23-lex-U - */ - -/* Define a test macro to test against a range */ -#define RANGE(c,lo,hi) (((uchar)c) >= lo && ((uchar)c) <= hi) -/* Define a common RANGE */ -#define RANGE0(c) RANGE(c,0x80,0xBF) - - int ch0; - - int skip = -1; /* assume failed */ - - ch0 = (uchar)*cp; - if(ch0 <= 0x7f) skip = 1; /* remove ascii case */ - else - -#if UTF8_CHECK == 2 - /* Do relaxed validation check */ - if(RANGE(ch0,0xC0,0XDF)) {/* 2-bytes, but check */ - if(cp[1] != 0 && RANGE0(cp[1])) - skip = 2; /* two bytes */ - } else if(RANGE(ch0,0xE0,0XEF)) {/* 3-bytes, but check */ - if(cp[1] != 0 && RANGE0(cp[1]) && cp[2] != 0 && RANGE0(cp[1])) - skip = 3; /* three bytes */ - } else if(RANGE(ch0,0xF0,0XF7)) {/* 3-bytes, but check */ - if(cp[1] != 0 && RANGE0(cp[1]) && cp[2] != 0 - && RANGE0(cp[1]) && cp[3] != 0 && RANGE0(cp[1])) - skip = 4; /* four bytes*/ - } -#elif UTF8_CHECK == 1 - /* Do exact validation check */ - if(RANGE(ch0,0xC2,0xDF)) {/* non-overlong 2-bytes */ - int ch1 = (uchar)cp[1]; - if(ch1 != 0 && RANGE0(ch1)) skip = 2; - } else if((ch0 == 0xE0)) {/* 3-bytes, not overlong */ - int ch1 = (uchar)cp[1]; - if(ch1 != 0 && RANGE(ch1,0xA0,0xBF)) { - int ch2 = (uchar)cp[2]; - if(ch2 != 0 && RANGE0(ch2)) skip = 3; - } else if((ch0 == 0xED)) {/* 3-bytes minus surrogates */ - int ch1 = (uchar)cp[1]; - if(ch1 != 0 && RANGE(ch1,0x80,0x9f)) { - int ch2 = (uchar)cp[2]; - if(ch2 != 0 && RANGE0(ch2)) skip = 3; - } else if(RANGE(ch0,0xE1,0xEC) || ch0 == 0xEE || ch0 == 0xEF) - int ch1 = (uchar)cp[1]; - if(ch1 != 0 && RANGE0(ch1)) { - int ch2 = (uchar)cp[2]; - if(ch2 != 0 && RANGE0(ch2)) skip = 3; - } - } else if((ch0 == 0xF0)) {/* planes 1-3 */ - int ch1 = (uchar)cp[1]; - if(ch1 != 0 && RANGE(ch1,0x90,0xBF) { - int ch2 = (uchar)cp[2]; - if(ch2 != 0 && RANGE0(ch2)) { - int ch3 = (uchar)cp[3]; - if(ch3 != 0 && RANGE0(ch3)) skip = 4; - } - } - } else if((ch0 == 0xF4)) {/* plane 16 */ - int ch1 = (uchar)cp[1]; - if(ch1 != 0 && RANGE0(ch1)) { - int ch2 = (uchar)cp[2]; - if(ch2 != 0 && RANGE0(ch2)) { - int ch3 = (uchar)cp[3]; - if(ch3 != 0 && RANGE0(ch3)) skip = 4; - } - } - } else if(RANGE(ch0,0xF1,0xF3) { /* planes 4-15 */ - int ch1 = (uchar)cp[1]; - if(ch1 != 0 && RANGE0(ch1)) { - int ch2 = (uchar)cp[2]; - if(ch2 != 0 && RANGE0(ch2)) { - int ch3 = (uchar)cp[3]; - if(ch3 != 0 && RANGE0(ch3)) skip = 4; - } - } - } -#else -#error "Must Define UTF8_CHECK as 1 or 2" -#endif - return skip; -} - - -/* - * Verify that a name string is valid syntax. The allowed name - * syntax (in RE form) is: - * - * ([a-zA-Z0-9_]|{UTF8})([^\x00-\x1F\x7F/]|{UTF8})* - * - * where UTF8 represents a multibyte UTF-8 encoding. Also, no - * trailing spaces are permitted in names. This definition - * must be consistent with the one in ncgen.l. We do not allow '/' - * because HDF5 does not permit slashes in names as slash is used as a - * group separator. If UTF-8 is supported, then a multi-byte UTF-8 - * character can occur anywhere within an identifier. We later - * normalize UTF-8 strings to NFC to facilitate matching and queries. - */ -int -NC_check_name(const char *name) -{ - int skip; - int ch; - const char *cp = name; - ssize_t utf8_stat; - - assert(name != NULL); - - if(*name == 0 /* empty names disallowed */ - || strchr(cp, '/')) /* '/' can't be in a name */ - goto fail; - - /* check validity of any UTF-8 */ - utf8_stat = utf8proc_check((const unsigned char *)name); - if (utf8_stat < 0) - goto fail; - - /* First char must be [a-z][A-Z][0-9]_ | UTF8 */ - ch = (uchar)*cp; - if(ch <= 0x7f) { - if( !('A' <= ch && ch <= 'Z') - && !('a' <= ch && ch <= 'z') - && !('0' <= ch && ch <= '9') - && ch != '_' ) - goto fail; - cp++; - } else { - if((skip = nextUTF8(cp)) < 0) - goto fail; - cp += skip; - } - - while(*cp != 0) { - ch = (uchar)*cp; - /* handle simple 0x00-0x7f characters here */ - if(ch <= 0x7f) { - if( ch < ' ' || ch > 0x7E) /* control char or DEL */ - goto fail; - cp++; - } else { - if((skip = nextUTF8(cp)) < 0) goto fail; - cp += skip; - } - if(cp - name > NC_MAX_NAME) - return NC_EMAXNAME; - } - if(ch <= 0x7f && isspace(ch)) /* trailing spaces disallowed */ - goto fail; - return NC_NOERR; -fail: - return NC_EBADNAME; -} - - -/* - * Allocate a NC_string structure large enough - * to hold slen characters. - * Formerly -NC_new_string(count, str) - */ -NC_string * -new_NC_string(size_t slen, const char *str) -{ - NC_string *ncstrp; - size_t sz = M_RNDUP(sizeof(NC_string)) + slen + 1; - -#if 0 - sz = _RNDUP(sz, X_ALIGN); -#endif - - ncstrp = (NC_string *)malloc(sz); - if( ncstrp == NULL ) - return NULL; - (void) memset(ncstrp, 0, sz); - - ncstrp->nchars = sz - M_RNDUP(sizeof(NC_string)) - 1; - assert(ncstrp->nchars + 1 > slen); - ncstrp->cp = (char *)ncstrp + M_RNDUP(sizeof(NC_string)); - - if(str != NULL && *str != 0) - { - (void) strncpy(ncstrp->cp, str, ncstrp->nchars +1); - ncstrp->cp[ncstrp->nchars] = 0; - } - - return(ncstrp); -} - - -/* - * If possible, change the value of an NC_string to 'str'. - * - * Formerly -NC_re_string() - */ -int -set_NC_string(NC_string *ncstrp, const char *str) -{ - size_t slen; - - assert(str != NULL && *str != 0); - - slen = strlen(str); - - if(ncstrp->nchars < slen) - return NC_ENOTINDEFINE; - - strncpy(ncstrp->cp, str, ncstrp->nchars); - /* Don't adjust ncstrp->nchars, it includes extra space in the - * header for potential later expansion of string. */ - - return NC_NOERR; -} - -/**************************************************/ -/* Provide local alternatives for unix functions - not available on all machines. Place here so that - all subsequence code modules can use it. -*/ - -#ifndef HAVE_STRDUP -char* -strdup(const char* s) -{ - char* dup; - if(s == NULL) return NULL; - dup = malloc(strlen(s)+1); - strcpy(dup,s); - return dup; -} -#endif - -/**************************************************/ diff --git a/xios_2311_src/trunk/.svn/pristine/4f/4f2718a1ca513746afc05b9e19322b292e3496c3.svn-base b/xios_2311_src/trunk/.svn/pristine/4f/4f2718a1ca513746afc05b9e19322b292e3496c3.svn-base deleted file mode 100644 index fe5c7ab7c2dd95b4752deabb420aec7f3ca0f81d..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/4f/4f2718a1ca513746afc05b9e19322b292e3496c3.svn-base +++ /dev/null @@ -1,163 +0,0 @@ -#ifndef __XIOS_ENUM__ -#define __XIOS_ENUM__ - -#include "xios_spl.hpp" -#include "exception.hpp" -#include "buffer_in.hpp" -#include "buffer_out.hpp" -#include "base_type.hpp" -#include "message.hpp" - -#define __INLINE__ inline - - -namespace xios -{ - class CEnumBase - { - } ; - - template class CEnum_ref ; - - template - class CEnum : public virtual CBaseType, public T - { - public: - typedef typename T::t_enum T_enum ; - CEnum(void) ; - __INLINE__ CEnum(const T_enum& val) ; - __INLINE__ CEnum(const CEnum& type) ; - __INLINE__ CEnum(const CEnum_ref& type) ; - virtual ~CEnum() { _reset() ; } - - __INLINE__ T_enum& get(void) ; - __INLINE__ const T_enum& get(void) const; - - __INLINE__ void set(const T_enum& val) ; - __INLINE__ void set(const CEnum& val) ; - __INLINE__ void set(const CEnum_ref& val) ; - __INLINE__ CEnum& operator = (const T_enum& val) ; - __INLINE__ CEnum& operator = (const CEnum& val) ; - __INLINE__ CEnum& operator = (const CEnum_ref& val) ; - __INLINE__ operator T_enum&() ; - - inline virtual CBaseType* clone(void) const { return _clone(); } - virtual void fromString(const string& str) { _fromString(str); } - virtual string toString(void) const { return _toString(); } - virtual bool fromBuffer(CBufferIn& buffer) { return _fromBuffer(buffer) ; } - virtual bool toBuffer(CBufferOut& buffer) const { return _toBuffer(buffer); } - virtual void reset(void) { _reset(); } - virtual bool isEmpty() const { return _isEmpty(); } - virtual size_t size(void) const { return _size(); } - - __INLINE__ void allocate(void) ; - __INLINE__ void checkEmpty(void) const; - - T_enum* ptrValue ; - bool empty ; - - friend class CEnum_ref ; - - private : - - __INLINE__ CEnum* _clone(void) const; - __INLINE__ void _fromString(const string& str) ; - __INLINE__ string _toString(void) const; - __INLINE__ bool _fromBuffer(CBufferIn& buffer) ; - __INLINE__ bool _toBuffer(CBufferOut& buffer) const; - __INLINE__ void _reset(void) ; - __INLINE__ bool _isEmpty() const ; - __INLINE__ size_t _size(void) const ; - - } ; - - - - template - class CEnum_ref : public virtual CBaseType, public T - { - public: - - typedef typename T::t_enum T_enum ; - __INLINE__ CEnum_ref(void) ; - __INLINE__ CEnum_ref(T_enum& val) ; - __INLINE__ CEnum_ref(CEnum& type) ; - __INLINE__ CEnum_ref(const CEnum_ref& type) ; - virtual ~CEnum_ref() {}; - - __INLINE__ T_enum& get(void) const; - - __INLINE__ void set(const T_enum& val) const ; - __INLINE__ void set(const CEnum& val) const ; - __INLINE__ void set(const CEnum_ref& val) const ; - - __INLINE__ void set_ref(T_enum& val) ; - __INLINE__ void set_ref(CEnum& val) ; - __INLINE__ void set_ref(const CEnum_ref& val) ; - - __INLINE__ const CEnum_ref& operator = (T_enum& val) const ; - __INLINE__ const CEnum_ref& operator = (CEnum& val) const ; - __INLINE__ const CEnum_ref& operator = (const CEnum_ref& val) const; - __INLINE__ operator T_enum&() const; - - - inline virtual CBaseType* clone(void) const { return _clone(); } - virtual void fromString(const string& str) { _fromString(str); } - virtual void fromString(const string& str) const { _fromString(str); } - virtual string toString(void) const { return _toString(); } - virtual bool fromBuffer(CBufferIn& buffer) { return _fromBuffer(buffer) ; } - virtual bool fromBuffer(CBufferIn& buffer) const { return _fromBuffer(buffer); } - virtual bool toBuffer(CBufferOut& buffer) const { return _toBuffer(buffer); } - virtual void reset(void) { _reset(); } - virtual bool isEmpty() const { return _isEmpty(); } - virtual size_t size(void) const { return _size(); } - - __INLINE__ void checkEmpty(void) const; - - - T_enum mutable * ptrValue ; - bool empty ; - friend class CEnum ; - - private : - - __INLINE__ CEnum_ref* _clone(void) const; - __INLINE__ void _fromString(const string& str) ; - __INLINE__ void _fromString(const string& str) const; - __INLINE__ string _toString(void) const; - __INLINE__ bool _fromBuffer(CBufferIn& buffer) ; - __INLINE__ bool _fromBuffer(CBufferIn& buffer) const ; - __INLINE__ bool _toBuffer(CBufferOut& buffer) const; - __INLINE__ void _reset(void) ; - __INLINE__ bool _isEmpty() const ; - __INLINE__ size_t _size(void) const ; - } ; - - template bool operator== (const CEnum& lhs, const typename T::t_enum& rhs); - template bool operator== (const typename T::t_enum& lhs, const CEnum& rhs); - template bool operator== (const CEnum& lhs, const CEnum& rhs); - template bool operator== (const CEnum_ref& lhs, const CEnum_ref& rhs); - template bool operator== (const CEnum_ref& lhs, const typename T::t_enum& rhs); - template bool operator== (const typename T::t_enum& lhs, const CEnum_ref& rhs); - template bool operator== (const CEnum& lhs, const CEnum_ref& rhs) {return (lhs.get() == rhs.get());} - template bool operator== (const CEnum_ref& lhs, const CEnum& rhs) {return (rhs == lhs); } - - template __INLINE__ CBufferOut& operator<<(CBufferOut& buffer, const CEnum& type) ; - template __INLINE__ CBufferOut& operator<<(CBufferOut& buffer, const typename T::t_enum & type) ; - template __INLINE__ CBufferIn& operator>>(CBufferIn& buffer, CEnum& type) ; -// template __INLINE__ CMessage& operator<<(CMessage& msg, const CEnum& type) ; - template __INLINE__ CMessage& operator<<(CMessage& msg, const typename T::t_enum & type) ; - - template __INLINE__ CBufferOut& operator<<(CBufferOut& buffer, const CEnum& type) ; - template __INLINE__ CBufferOut& operator<<(CBufferOut& buffer, const typename T::t_enum & type); - template __INLINE__ CBufferIn& operator>>(CBufferIn& buffer, CEnum& type); -// template __INLINE__ CMessage& operator<<(CMessage& msg, const CEnum& type); - template __INLINE__ CMessage& operator<<(CMessage& msg, const typename T::t_enum & type); -} - -# ifdef __INLINE__ -# include "enum_impl.hpp" -# include "enum_ref_impl.hpp" -# endif - -#endif diff --git a/xios_2311_src/trunk/.svn/pristine/4f/4f3ec4a1207e22dbaf23e13571114b12a21baae6.svn-base b/xios_2311_src/trunk/.svn/pristine/4f/4f3ec4a1207e22dbaf23e13571114b12a21baae6.svn-base deleted file mode 100644 index 67041f2e1e7e3b9f834646062267798b29c69f00..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/4f/4f3ec4a1207e22dbaf23e13571114b12a21baae6.svn-base +++ /dev/null @@ -1,265 +0,0 @@ -/********************************************************************* - * Copyright 1993, UCAR/Unidata - * See netcdf/COPYRIGHT file for copying and redistribution conditions. - * $Header: /upc/share/CVS/netcdf-3/libncdap3/dapcvt.c,v 1.14 2009/11/29 00:16:26 dmh Exp $ - *********************************************************************/ -#include "config.h" -#include "ncdap3.h" -#include "dapodom.h" - -NCerror -dapconvert3(nc_type srctype, nc_type dsttype, char* memory0, char* value0, size_t count) -{ - NCerror ncstat = NC_NOERR; - size_t i; - char* memory = memory0; - char* value = value0; - - /* In order to deal with the DAP upgrade problem, - try to preserve the bit patterns - */ - - /* Provide space and pointer casts for intermediate results */ - signed char ncbyte; - signed char* ncbytep; - char ncchar; - char* nccharp; - short ncshort; - short* ncshortp; - int ncint; - int* ncintp; - float ncfloat; - float* ncfloatp; - double ncdouble; - double* ncdoublep; - unsigned char ncubyte; - unsigned char* ncubytep; - unsigned short ncushort; - unsigned short* ncushortp; - unsigned int ncuint; - unsigned int* ncuintp; - long long ncint64; - long long* ncint64p; - unsigned long long ncuint64; - unsigned long long* ncuint64p; - - -#define CASE(nc1,nc2) (nc1*256+nc2) -#define CUT8(e) ((unsigned char)((e) & 0xff)) -#define CUT16(e) ((unsigned short)((e) & 0xffff)) -#define CUT32(e) ((unsigned int)((e) & 0xffffffff)) -#define ARM(vs,ncs,ts,vd,ncd,td) \ -case CASE(ncs,ncd):\ - vs##p = (ts *)value;\ - vs = *vs##p;\ - vd##p = (td *)memory;\ - *vd##p = (td)vs;\ - break; - - for(i=0;i(), CCouplerOutAttributes(), - virtualFieldGroup(), enabledFields() - { - setVirtualFieldGroup(CFieldGroup::create(getId() + "_virtual_field_group")); - } - - CCouplerOut::CCouplerOut(const StdString & id) : CObjectTemplate(id), CCouplerOutAttributes(), - virtualFieldGroup(), enabledFields() - { - setVirtualFieldGroup(CFieldGroup::create(getId() + "_virtual_field_group")); - } - - CCouplerOut::~CCouplerOut(void) - { /* Ne rien faire de plus */ } - - ///--------------------------------------------------------------- - //! Get name of file - StdString CCouplerOut::GetName(void) { return (StdString("coupler_out")); } - StdString CCouplerOut::GetDefName(void){ return (CCouplerOut::GetName()); } - ENodeType CCouplerOut::GetType(void) { return (eCouplerIn); } - - /*! - \brief Parse xml file and write information into coupler_in object - \param [in] node xmld node corresponding in xml coupler_in - */ - void CCouplerOut::parse(xml::CXMLNode & node) - TRY - { - SuperClass::parse(node); - - if (node.goToChildElement()) - { - do - { - if (node.getElementName()=="field" || node.getElementName()=="field_group") this->getVirtualFieldGroup()->parseChild(node); - } while (node.goToNextElement()); - node.goToParentElement(); - } - } - CATCH_DUMP_ATTR - - const string& CCouplerOut::getCouplingContextId(void) - { - if (couplingContextId_.empty()) - { - vector vectStr=splitRegex(context,"::") ; - string poolId=vectStr[0] ; - string serviceId=poolId ; - string contextId=vectStr[1] ; - int contextLeader ; - int type = CServicesManager::CLIENT ; - couplingContextId_=CXios::getContextsManager()->getServerContextName(poolId, serviceId, 0, type, contextId) ; - } - return couplingContextId_ ; - } - - std::vector CCouplerOut::getEnabledFields(void) - TRY - { - if (enabledFields.empty()) - { - this->enabledFields = this->getAllFields(); - std::vector newEnabledFields; - bool enabled ; - for ( auto it = this->enabledFields.begin(); it != this->enabledFields.end(); it++ ) - { - if ((*it)->enabled.isEmpty()) enabled=true ; - else enabled=(*it)->enabled ; - if (enabled) newEnabledFields.push_back(*it); - } - enabledFields = newEnabledFields; - } - return (this->enabledFields); - } - CATCH_DUMP_ATTR - - /*! - * assign the context associated to the coupler to the enabled fields - */ - void CCouplerOut::assignContext(void) - { - client_ = CContext::getCurrent()->getCouplerOutClient(getCouplingContextId()); - for (auto& field : getEnabledFields()) field->setContextClient(client_) ; - } - - /*! - \brief Get virtual field group - In each CCouplerIn, there always exists a field group which is the ancestor of all - fields in the CCouplerIn. This is considered be virtual because it is created automatically during - CCouplerIn initialization and it normally doesn't appear on xml file - \return Pointer to field group - */ - CFieldGroup* CCouplerOut::getVirtualFieldGroup(void) const - TRY - { - return (this->virtualFieldGroup); - } - CATCH - - - /*! - \brief Get virtual variable group - In each CCouplerIn, there always exists a variable group which is the ancestor of all - variable in the CCouplerIn. This is considered be virtual because it is created automatically during - CCouplerIn initialization and it normally doesn't appear on xml file - \return Pointer to variable group - */ - - //! Get all fields of a file - std::vector CCouplerOut::getAllFields(void) const - TRY - { - return (this->virtualFieldGroup->getAllChildren()); - } - CATCH - - void CCouplerOut::solveDescInheritance(bool apply, const CAttributeMap * const parent) - TRY - { - SuperClassAttribute::setAttributes(parent,apply); - this->getVirtualFieldGroup()->solveDescInheritance(apply, NULL); - } - CATCH_DUMP_ATTR - - void CCouplerOut::solveFieldRefInheritance(bool apply) - TRY - { - // Rsolution des hritages par rfrence de chacun des champs contenus dans le fichier. - std::vector allF = this->getAllFields(); - for (unsigned int i = 0; i < allF.size(); i++) - allF[i]->solveRefInheritance(apply); - } - CATCH_DUMP_ATTR - - void CCouplerOut::createInterCommunicator(void) - TRY - { - if (context.isEmpty()) - { - ERROR("void CCouplerOut::createInterCommunicator(void)", - "The attribute must be defined to specify the target coupling context"); - } - CContext* contextPtr = CContext::getCurrent(); - contextPtr->addCouplingChanel(getCouplingContextId(), true) ; - } - CATCH_DUMP_ATTR - - - void CCouplerOut::checkGridOfEnabledFields(void) - TRY - { - int size = this->enabledFields.size(); - for (int i = 0; i < size; ++i) - { - this->enabledFields[i]->checkGridOfEnabledFields(); - } - } - CATCH_DUMP_ATTR - - //---------------------------------------------------------------- - //! Change virtual field group to a new one - void CCouplerOut::setVirtualFieldGroup(CFieldGroup* newVirtualFieldGroup) - TRY - { - this->virtualFieldGroup = newVirtualFieldGroup; - } - CATCH_DUMP_ATTR - - ///-------------------------------------------------------------- - /*! - */ - StdString CCouplerOut::dumpClassAttributes(void) - { - StdString str; - CContext* context = CContext::getCurrent(); - str.append("context=\""); - str.append(context->getId()); - str.append("\""); - str.append(" enabled fields=\""); - int size = this->enabledFields.size(); - for (int i = 0; i < size; ++i) - { - str.append(this->enabledFields[i]->getId()); - str.append(" "); - } - str.append("\""); - return str; - } -} \ No newline at end of file diff --git a/xios_2311_src/trunk/.svn/pristine/4f/4fa89b7e8e5241715d6eeedc8461ad924f3af463.svn-base b/xios_2311_src/trunk/.svn/pristine/4f/4fa89b7e8e5241715d6eeedc8461ad924f3af463.svn-base deleted file mode 100644 index 6fbdeafd734098576e4dac62610e5ae8973b40c7..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/4f/4fa89b7e8e5241715d6eeedc8461ad924f3af463.svn-base +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright 2009, UCAR/Unidata and OPeNDAP, Inc. - See the COPYRIGHT file for more information. */ - -#ifndef NC_URI_H -#define NC_URI_H - -/*! This is an open structure meaning - it is ok to directly access its fields*/ -typedef struct NC_URI { - char* uri; /* as passed by the caller */ - char* protocol; - char* user; /* from user:password@ */ - char* password; /* from user:password@ */ - char* host; /*!< host*/ - char* port; /*!< host */ - char* file; /*!< file */ - char* constraint; /*!< projection+selection */ - char* projection; /*!< without leading '?'*/ - char* selection; /*!< with leading '&'*/ - char* params; /* all params */ - char** paramlist; /*! entry not found; 1=>found; result holds value (may be null). - In any case, the result is imutable and should not be free'd. -*/ -extern int nc_urilookup(NC_URI*, const char* param, const char** result); - -#endif /*NC_URI_H*/ diff --git a/xios_2311_src/trunk/.svn/pristine/4f/4faf596e3cb04f1c2b0d15f981b07d38950e5d7d.svn-base b/xios_2311_src/trunk/.svn/pristine/4f/4faf596e3cb04f1c2b0d15f981b07d38950e5d7d.svn-base deleted file mode 100644 index 677007793debca7b7228aa47797ea40cfe640804..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/4f/4faf596e3cb04f1c2b0d15f981b07d38950e5d7d.svn-base +++ /dev/null @@ -1,191 +0,0 @@ -/* Copyright 2009, UCAR/Unidata and OPeNDAP, Inc. - See the COPYRIGHT file for more information. */ - -#include -#include -#include - -#include "ncbytes.h" - -#ifndef TRUE -#define TRUE 1 -#endif -#ifndef FALSE -#define FALSE 0 -#endif - -#define DEFAULTALLOC 1024 -#define ALLOCINCR 1024 - -static int ncbytesdebug = 1; - -static long -ncbytesfail(void) -{ - fflush(stdout); - fprintf(stderr,"bytebuffer failure\n"); - fflush(stderr); - if(ncbytesdebug) abort(); - return FALSE; -} - -NCbytes* -ncbytesnew(void) -{ - NCbytes* bb = (NCbytes*)malloc(sizeof(NCbytes)); - if(bb == NULL) return (NCbytes*)ncbytesfail(); - bb->alloc=0; - bb->length=0; - bb->content=NULL; - bb->nonextendible = 0; - return bb; -} - -int -ncbytessetalloc(NCbytes* bb, unsigned int sz) -{ - char* newcontent; - if(bb == NULL) return ncbytesfail(); - if(sz <= 0) {sz = (bb->alloc?2*bb->alloc:DEFAULTALLOC);} - if(bb->alloc >= sz) return TRUE; - if(bb->nonextendible) return ncbytesfail(); - newcontent=(char*)calloc(sz,sizeof(char)); - if(bb->alloc > 0 && bb->length > 0 && bb->content != NULL) { - memcpy((void*)newcontent,(void*)bb->content,sizeof(char)*bb->length); - } - if(bb->content != NULL) free(bb->content); - bb->content=newcontent; - bb->alloc=sz; - return TRUE; -} - -void -ncbytesfree(NCbytes* bb) -{ - if(bb == NULL) return; - if(!bb->nonextendible && bb->content != NULL) free(bb->content); - free(bb); -} - -int -ncbytessetlength(NCbytes* bb, unsigned int sz) -{ - if(bb == NULL) return ncbytesfail(); - if(sz > bb->alloc) {if(!ncbytessetalloc(bb,sz)) return ncbytesfail();} - bb->length = sz; - return TRUE; -} - -int -ncbytesfill(NCbytes* bb, char fill) -{ - unsigned int i; - if(bb == NULL) return ncbytesfail(); - for(i=0;ilength;i++) bb->content[i] = fill; - return TRUE; -} - -int -ncbytesget(NCbytes* bb, unsigned int index) -{ - if(bb == NULL) return -1; - if(index >= bb->length) return -1; - return bb->content[index]; -} - -int -ncbytesset(NCbytes* bb, unsigned int index, char elem) -{ - if(bb == NULL) return ncbytesfail(); - if(index >= bb->length) return ncbytesfail(); - bb->content[index] = elem; - return TRUE; -} - -int -ncbytesappend(NCbytes* bb, char elem) -{ - if(bb == NULL) return ncbytesfail(); - if(bb->length >= bb->alloc) if(!ncbytessetalloc(bb,0)) return ncbytesfail(); - bb->content[bb->length] = elem; - bb->length++; - return TRUE; -} - -/* This assumes s is a null terminated string*/ -int -ncbytescat(NCbytes* bb, char* s) -{ - ncbytesappendn(bb,(void*)s,strlen(s)+1); /* include trailing null*/ - /* back up over the trailing null*/ - if(bb->length == 0) return ncbytesfail(); - bb->length--; - return 1; -} - -int -ncbytesappendn(NCbytes* bb, void* elem, unsigned int n) -{ - if(bb == NULL || elem == NULL) return ncbytesfail(); - if(n == 0) {n = strlen((char*)elem);} - while(!ncbytesavail(bb,n)) {if(!ncbytessetalloc(bb,0)) return ncbytesfail();} - memcpy((void*)&bb->content[bb->length],(void*)elem,n); - bb->length += n; - return TRUE; -} - -int -ncbytesprepend(NCbytes* bb, char elem) -{ - int i; /* do not make unsigned */ - if(bb == NULL) return ncbytesfail(); - if(bb->length >= bb->alloc) if(!ncbytessetalloc(bb,0)) return ncbytesfail(); - /* could we trust memcpy? instead */ - for(i=bb->alloc;i>=1;i--) {bb->content[i]=bb->content[i-1];} - bb->content[0] = elem; - bb->length++; - return TRUE; -} - -char* -ncbytesdup(NCbytes* bb) -{ - char* result = (char*)malloc(bb->length+1); - memcpy((void*)result,(const void*)bb->content,bb->length); - result[bb->length] = '\0'; /* just in case it is a string*/ - return result; -} - -char* -ncbytesextract(NCbytes* bb) -{ - char* result = bb->content; - bb->alloc = 0; - bb->length = 0; - bb->content = NULL; - return result; -} - -int -ncbytessetcontents(NCbytes* bb, char* contents, unsigned int alloc) -{ - if(bb == NULL) return ncbytesfail(); - ncbytesclear(bb); - if(!bb->nonextendible && bb->content != NULL) free(bb->content); - bb->content = contents; - bb->length = 0; - bb->alloc = alloc; - bb->nonextendible = 1; - return 1; -} - -/* Null terminate the byte string without extending its length */ -/* For debugging */ -int -ncbytesnull(NCbytes* bb) -{ - ncbytesappend(bb,'\0'); - bb->length--; - return 1; -} - diff --git a/xios_2311_src/trunk/.svn/pristine/4f/4fb5ca9df10813c2c9c4067799398737e502a218.svn-base b/xios_2311_src/trunk/.svn/pristine/4f/4fb5ca9df10813c2c9c4067799398737e502a218.svn-base deleted file mode 100644 index 58fb91fa02f7436c6c2270c8c4d037b381bfca08..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/4f/4fb5ca9df10813c2c9c4067799398737e502a218.svn-base +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef __XIOS_ALGORITHM_TRANSFORMATION_WEIGHT_HPP__ -#define __XIOS_ALGORITHM_TRANSFORMATION_WEIGHT_HPP__ - -#include "generic_algorithm_transformation.hpp" -#include "array_new.hpp" -#include "local_view.hpp" -#include "transform_connector.hpp" -#include "weight_transform_connector.hpp" - -namespace xios -{ - - class CAlgorithmTransformationWeight : public CGenericAlgorithmTransformation - { - public: - - CAlgorithmTransformationWeight(bool isSource) : CGenericAlgorithmTransformation(isSource) {} - virtual ~CAlgorithmTransformationWeight() {}; - virtual void apply(int dimBefore, int dimAfter, const CArray& dataIn, CArray& dataOut); - virtual void computeRecvElement(shared_ptr srcView, shared_ptr dstView); - protected: - virtual void computeAlgorithm(shared_ptr srcView, shared_ptr dstView) ; - - //! Map between global index of destination element and source element - TransformationIndexMap transformationMapping_; - //! Weight corresponding of source to destination - TransformationWeightMap transformationWeight_; - shared_ptr weightTransformConnector_ ; - - }; - -} -#endif //__XIOS_ALGORITHM_TRANSFORMATION_WEIGHT_HPP__ diff --git a/xios_2311_src/trunk/.svn/pristine/50/503d530ac771df8c7ea703c22ca43d48c4924f9b.svn-base b/xios_2311_src/trunk/.svn/pristine/50/503d530ac771df8c7ea703c22ca43d48c4924f9b.svn-base deleted file mode 100644 index 94c0be8b83fec300270f94a21725da2c438f709a..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/50/503d530ac771df8c7ea703c22ca43d48c4924f9b.svn-base +++ /dev/null @@ -1,406 +0,0 @@ -/*! - \file axis_algorithm_interpolate.cpp - \author Ha NGUYEN - \since 23 June 2015 - \date 02 Jul 2015 - - \brief Algorithm for interpolation on an axis. - */ -#include "axis_algorithm_interpolate.hpp" -#include "axis.hpp" -#include "interpolate_axis.hpp" -#include -#include "context.hpp" -#include "context_client.hpp" -#include "utils.hpp" -#include "grid.hpp" -#include "grid_transformation_factory_impl.hpp" -#include "distribution_client.hpp" -#include "timer.hpp" - -namespace xios { -shared_ptr CAxisAlgorithmInterpolate::create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) -TRY -{ - std::vector axisListDestP = gridDst->getAxis(); - std::vector axisListSrcP = gridSrc->getAxis(); - - CInterpolateAxis* interpolateAxis = dynamic_cast (transformation); - int axisDstIndex = elementPositionInGridDst2AxisPosition[elementPositionInGrid]; - int axisSrcIndex = elementPositionInGridSrc2AxisPosition[elementPositionInGrid]; - - return make_shared(isSource, axisListDestP[axisDstIndex], axisListSrcP[axisSrcIndex], interpolateAxis); -} -CATCH - -bool CAxisAlgorithmInterpolate::dummyRegistered_ = CAxisAlgorithmInterpolate::registerTrans(); -bool CAxisAlgorithmInterpolate::registerTrans() -TRY -{ - /// descativate for now - // return CGridTransformationFactory::registerTransformation(TRANS_INTERPOLATE_AXIS, create); - return false; -} -CATCH - -CAxisAlgorithmInterpolate::CAxisAlgorithmInterpolate(bool isSource, CAxis* axisDestination, CAxis* axisSource, CInterpolateAxis* interpAxis) -: CAlgorithmTransformationWeight(isSource), coordinate_(), transPosition_(), axisSrc_(axisSource), axisDest_(axisDestination) -TRY -{ - interpAxis->checkValid(axisSource); - axisDestination->checkAttributes() ; - - order_ = interpAxis->order.getValue(); - if (!interpAxis->coordinate.isEmpty()) - { - coordinate_ = interpAxis->coordinate.getValue(); -// this->idAuxInputs_.resize(1); -// this->idAuxInputs_[0] = coordinate_; - } - std::vector* > dataAuxInputs ; - computeRemap(dataAuxInputs) ; - this->computeAlgorithm(axisSource->getLocalView(CElementView::WORKFLOW), axisDestination->getLocalView(CElementView::WORKFLOW)) ; -} -CATCH - -/*! - Compute the index mapping between axis on grid source and one on grid destination -*/ -void CAxisAlgorithmInterpolate::computeRemap(const std::vector* >& dataAuxInputs) -TRY -{ - CTimer::get("CAxisAlgorithmInterpolate::computeIndexSourceMapping_").resume() ; - CContext* context = CContext::getCurrent(); - int nbClient = context->intraCommSize_; - CArray& axisMask = axisSrc_->mask; - int srcSize = axisSrc_->n_glo.getValue(); - std::vector > vecAxisValue; - - // Fill in axis value from coordinate - fillInAxisValue(vecAxisValue, dataAuxInputs); - std::vector valueSrc(srcSize); - std::vector recvBuff(srcSize); - std::vector indexVec(srcSize); - - for (int idx = 0; idx < vecAxisValue.size(); ++idx) - { - CArray& axisValue = vecAxisValue[idx]; - retrieveAllAxisValue(axisValue, axisMask, recvBuff, indexVec); - XIOSAlgorithms::sortWithIndex(recvBuff, indexVec); - for (int i = 0; i < srcSize; ++i) valueSrc[i] = recvBuff[indexVec[i]]; - computeInterpolantPoint(valueSrc, indexVec, idx); - } - CTimer::get("CAxisAlgorithmInterpolate::computeIndexSourceMapping_").suspend() ; -} -CATCH - -/*! - Compute the interpolant points - Assume that we have all value of axis source, with these values, need to calculate weight (coeff) of Lagrange polynomial - \param [in] axisValue all value of axis source - \param [in] tranPos position of axis on a domain -*/ -void CAxisAlgorithmInterpolate::computeInterpolantPoint(const std::vector& axisValue, - const std::vector& indexVec, - int transPos) -TRY -{ - std::vector::const_iterator itb = axisValue.begin(), ite = axisValue.end(); - std::vector::const_iterator itLowerBound, itUpperBound, it, iteRange, itfirst, itsecond; - const double sfmax = NumTraits::sfmax(); - const double precision = NumTraits::dummy_precision(); - - int ibegin = axisDest_->begin.getValue(); - CArray& axisDestValue = axisDest_->value; - int numValue = axisDestValue.numElements(); - std::map > > interpolatingIndexValues; - - for (int idx = 0; idx < numValue; ++idx) - { - bool outOfRange = false; - double destValue = axisDestValue(idx); - if (destValue < *itb) outOfRange = true; - - itLowerBound = std::lower_bound(itb, ite, destValue); - itUpperBound = std::upper_bound(itb, ite, destValue); - if ((ite != itUpperBound) && (sfmax == *itUpperBound)) itUpperBound = ite; - - if ((ite == itLowerBound) || (ite == itUpperBound)) outOfRange = true; - - // We don't do extrapolation FOR NOW, maybe in the future - if (!outOfRange) - { - if ((itLowerBound == itUpperBound) && (itb != itLowerBound)) --itLowerBound; - double distanceToLower = destValue - *itLowerBound; - double distanceToUpper = *itUpperBound - destValue; - int order = (order_ + 1) - 2; - bool down = (distanceToLower < distanceToUpper) ? true : false; - for (int k = 0; k < order; ++k) - { - if ((itb != itLowerBound) && down) - { - --itLowerBound; - distanceToLower = destValue - *itLowerBound; - down = (distanceToLower < distanceToUpper) ? true : false; - continue; - } - if ((ite != itUpperBound) && (sfmax != *itUpperBound)) - { - ++itUpperBound; - distanceToUpper = *itUpperBound - destValue; - down = (distanceToLower < distanceToUpper) ? true : false; - - } - } - - iteRange = (ite == itUpperBound) ? itUpperBound : itUpperBound + 1; - itsecond = it = itLowerBound; ++itsecond; - while (it < iteRange) - { - while ( (itsecond < ite) && ((*itsecond -*it) < precision) ) - { ++itsecond; ++it; } - int index = std::distance(itb, it); - interpolatingIndexValues[idx+ibegin].push_back(make_pair(indexVec[index],*it)); - ++it; ++itsecond; - } - - } - } - computeWeightedValueAndMapping(interpolatingIndexValues, transPos); -} -CATCH - -/*! - Compute weight (coeff) of Lagrange's polynomial - \param [in] interpolatingIndexValues the necessary axis value to calculate the coeffs -*/ -void CAxisAlgorithmInterpolate::computeWeightedValueAndMapping(const std::map > >& interpolatingIndexValues, int transPos) -TRY -{ - TransformationIndexMap& transMap = this->transformationMapping_; - TransformationWeightMap& transWeight = this->transformationWeight_; - std::map > >::const_iterator itb = interpolatingIndexValues.begin(), it, - ite = interpolatingIndexValues.end(); - int ibegin = axisDest_->begin.getValue(); - for (it = itb; it != ite; ++it) - { - int globalIndexDest = it->first; - double localValue = axisDest_->value(globalIndexDest - ibegin); - const std::vector >& interpVal = it->second; - int interpSize = interpVal.size(); - transMap[globalIndexDest].resize(interpSize); - transWeight[globalIndexDest].resize(interpSize); - for (int idx = 0; idx < interpSize; ++idx) - { - int index = interpVal[idx].first; - double weight = 1.0; - - for (int k = 0; k < interpSize; ++k) - { - if (k == idx) continue; - weight *= (localValue - interpVal[k].second); - weight /= (interpVal[idx].second - interpVal[k].second); - } - transMap[globalIndexDest][idx] = index; - transWeight[globalIndexDest][idx] = weight; -/* - if (!transPosition_.empty()) - { - (this->transformationPosition_[transPos])[globalIndexDest] = transPosition_[transPos]; - } -*/ - } - } -/* - if (!transPosition_.empty() && this->transformationPosition_[transPos].empty()) - (this->transformationPosition_[transPos])[0] = transPosition_[transPos]; -*/ -} -CATCH - -/*! - Each client retrieves all values of an axis - \param [in/out] recvBuff buffer for receiving values (already allocated) - \param [in/out] indexVec mapping between values and global index of axis -*/ -void CAxisAlgorithmInterpolate::retrieveAllAxisValue(const CArray& axisValue, const CArray& axisMask, - std::vector& recvBuff, std::vector& indexVec) -TRY -{ - CContext* context = CContext::getCurrent(); - int nbClient = context->intraCommSize_; - - int srcSize = axisSrc_->n_glo.getValue(); - int numValue = axisValue.numElements(); - - if (srcSize == numValue) // Only one client or axis not distributed - { - for (int idx = 0; idx < srcSize; ++idx) - { - if (axisMask(idx)) - { - recvBuff[idx] = axisValue(idx); - indexVec[idx] = idx; - } - else - { - recvBuff[idx] = NumTraits::sfmax(); - indexVec[idx] = -1; - } - } - - } - else // Axis distributed - { - double* sendValueBuff = new double [numValue]; - int* sendIndexBuff = new int [numValue]; - int* recvIndexBuff = new int [srcSize]; - - int ibegin = axisSrc_->begin.getValue(); - for (int idx = 0; idx < numValue; ++idx) - { - if (axisMask(idx)) - { - sendValueBuff[idx] = axisValue(idx); - sendIndexBuff[idx] = idx + ibegin; - } - else - { - sendValueBuff[idx] = NumTraits::sfmax(); - sendIndexBuff[idx] = -1; - } - } - - int* recvCount=new int[nbClient]; - MPI_Allgather(&numValue,1,MPI_INT,recvCount,1,MPI_INT,context->intraComm_); - - int* displ=new int[nbClient]; - displ[0]=0 ; - for(int n=1;nintraComm_); - MPI_Allgatherv(sendValueBuff,numValue,MPI_DOUBLE,&(recvBuff[0]),recvCount,displ,MPI_DOUBLE,context->intraComm_); - - for (int idx = 0; idx < srcSize; ++idx) - { - indexVec[idx] = recvIndexBuff[idx]; - } - - delete [] displ; - delete [] recvCount; - delete [] recvIndexBuff; - delete [] sendIndexBuff; - delete [] sendValueBuff; - } -} -CATCH - -/*! - Fill in axis value dynamically from a field whose grid is composed of a domain and an axis - \param [in/out] vecAxisValue vector axis value filled in from input field -*/ -void CAxisAlgorithmInterpolate::fillInAxisValue(std::vector >& vecAxisValue, - const std::vector* >& dataAuxInputs) -TRY -{ - if (coordinate_.empty()) - { - vecAxisValue.resize(1); - vecAxisValue[0].resize(axisSrc_->value.numElements()); - vecAxisValue[0] = axisSrc_->value; -// this->transformationMapping_.resize(1); -// this->transformationWeight_.resize(1); - } - else - { -/* - CField* field = CField::get(coordinate_); - CGrid* grid = field->getGrid(); - - std::vector domListP = grid->getDomains(); - std::vector axisListP = grid->getAxis(); - if (domListP.empty() || axisListP.empty() || (1 < domListP.size()) || (1 < axisListP.size())) - ERROR("CAxisAlgorithmInterpolate::fillInAxisValue(std::vector >& vecAxisValue)", - << "XIOS only supports dynamic interpolation with coordinate (field) associated with grid composed of a domain and an axis" - << "Coordinate (field) id = " <getId() << std::endl - << "Associated grid id = " << grid->getId()); - - CDomain* dom = domListP[0]; - size_t vecAxisValueSize = dom->i_index.numElements(); - size_t vecAxisValueSizeWithMask = 0; - for (size_t idx = 0; idx < vecAxisValueSize; ++idx) - { - if (dom->domainMask(idx)) ++vecAxisValueSizeWithMask; - } - - int niGlobDom = dom->ni_glo.getValue(); - vecAxisValue.resize(vecAxisValueSizeWithMask); - if (transPosition_.empty()) - { - size_t indexMask = 0; - transPosition_.resize(vecAxisValueSizeWithMask); - for (size_t idx = 0; idx < vecAxisValueSize; ++idx) - { - if (dom->domainMask(idx)) - { - transPosition_[indexMask].resize(1); - transPosition_[indexMask][0] = (dom->i_index)(idx) + niGlobDom * (dom->j_index)(idx); - ++indexMask; - } - - } - } - this->transformationMapping_.resize(vecAxisValueSizeWithMask); - this->transformationWeight_.resize(vecAxisValueSizeWithMask); - this->transformationPosition_.resize(vecAxisValueSizeWithMask); - - const CDistributionClient::GlobalLocalDataMap& globalLocalIndexSendToServer = grid->getClientDistribution()->getGlobalLocalDataSendToServer(); - CDistributionClient::GlobalLocalDataMap::const_iterator itIndex, iteIndex = globalLocalIndexSendToServer.end(); - size_t axisSrcSize = axisSrc_->index.numElements(); - std::vector globalDimension = grid->getGlobalDimension(); - - size_t indexMask = 0; - for (size_t idx = 0; idx < vecAxisValueSize; ++idx) - { - if (dom->domainMask(idx)) - { - size_t axisValueSize = 0; - for (size_t jdx = 0; jdx < axisSrcSize; ++jdx) - { - size_t globalIndex = ((dom->i_index)(idx) + (dom->j_index)(idx)*globalDimension[0]) + (axisSrc_->index)(jdx)*globalDimension[0]*globalDimension[1]; - if (iteIndex != globalLocalIndexSendToServer.find(globalIndex)) - { - ++axisValueSize; - } - } - - vecAxisValue[indexMask].resize(axisValueSize); - axisValueSize = 0; - for (size_t jdx = 0; jdx < axisSrcSize; ++jdx) - { - size_t globalIndex = ((dom->i_index)(idx) + (dom->j_index)(idx)*globalDimension[0]) + (axisSrc_->index)(jdx)*globalDimension[0]*globalDimension[1]; - itIndex = globalLocalIndexSendToServer.find(globalIndex); - if (iteIndex != itIndex) - { - vecAxisValue[indexMask](axisValueSize) = (*dataAuxInputs[0])(itIndex->second); - ++axisValueSize; - } - } - ++indexMask; - } - } - */ - } -} -CATCH - -} diff --git a/xios_2311_src/trunk/.svn/pristine/50/50402a49e2c6eca643ef5c94baf580baa4980ba5.svn-base b/xios_2311_src/trunk/.svn/pristine/50/50402a49e2c6eca643ef5c94baf580baa4980ba5.svn-base deleted file mode 100644 index 52969f68820b42192d677c2034b9bda61219fa58..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/50/50402a49e2c6eca643ef5c94baf580baa4980ba5.svn-base +++ /dev/null @@ -1,41 +0,0 @@ -/*! - \file sum.hpp - \author Ha NGUYEN - \since 27 June 2016 - \date 27 June 2016 - - \brief Sum reduction - */ -#ifndef __XIOS_REDUCTION_SUM_ALGORITHM_HPP__ -#define __XIOS_REDUCTION_SUM_ALGORITHM_HPP__ - -#include "reduction.hpp" - -namespace xios { - -/*! - \class CSumReductionAlgorithm - Interface for all reduction alogrithms. -*/ -class CSumReductionAlgorithm : public CReductionAlgorithm -{ -public: - CSumReductionAlgorithm(); - - virtual void apply(const std::vector >& localIndex, - const double* dataInput, - CArray& dataOut, - std::vector& flagInitial, - bool ignoreMissingValue, bool firstPass); - - virtual ~CSumReductionAlgorithm() {} - -public: - static bool registerTrans(); - -protected: - static CReductionAlgorithm* create(); -}; - -} -#endif // __XIOS_REDUCTION_SUM_ALGORITHM_HPP__ diff --git a/xios_2311_src/trunk/.svn/pristine/50/50443f2d13b6da02c7bb8d98860aca8ff1fa38b5.svn-base b/xios_2311_src/trunk/.svn/pristine/50/50443f2d13b6da02c7bb8d98860aca8ff1fa38b5.svn-base deleted file mode 100644 index 6ea58f71d3c255d3ff3463cc0315462971b61b37..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/50/50443f2d13b6da02c7bb8d98860aca8ff1fa38b5.svn-base +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef __XIOS_calendar_type__ -#define __XIOS_calendar_type__ - -#include "allleap.hpp" -#include "d360.hpp" -#include "gregorian.hpp" -#include "julian.hpp" -#include "noleap.hpp" -#include "user_defined.hpp" - -#endif //__XIOS_calendar_type__ diff --git a/xios_2311_src/trunk/.svn/pristine/51/513715ab3ff4a555426a1ba0b6c0a8d866522abb.svn-base b/xios_2311_src/trunk/.svn/pristine/51/513715ab3ff4a555426a1ba0b6c0a8d866522abb.svn-base deleted file mode 100644 index 07f554214afa62ce247478d9c65f366df1e4e937..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/51/513715ab3ff4a555426a1ba0b6c0a8d866522abb.svn-base +++ /dev/null @@ -1,13 +0,0 @@ -! * ************************************************************************** * -! * Interface auto generated - do not modify * -! * ************************************************************************** * -#include "../fortran/xios_fortran_prefix.hpp" - -MODULE duplicate_scalar_to_axis_interface_attr - USE, INTRINSIC :: ISO_C_BINDING - - INTERFACE - ! Do not call directly / interface FORTRAN 2003 <-> C99 - END INTERFACE - -END MODULE duplicate_scalar_to_axis_interface_attr diff --git a/xios_2311_src/trunk/.svn/pristine/51/5147b66f2d56a3b7ab8d720fb2ff1fc3e9deea0d.svn-base b/xios_2311_src/trunk/.svn/pristine/51/5147b66f2d56a3b7ab8d720fb2ff1fc3e9deea0d.svn-base deleted file mode 100644 index f97a02ace635fca5560058303cd6a40e21a88f12..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/51/5147b66f2d56a3b7ab8d720fb2ff1fc3e9deea0d.svn-base +++ /dev/null @@ -1,87 +0,0 @@ -#include "scalar_expr_node.hpp" -#include "type.hpp" -#include "variable.hpp" -#include "operator_expr.hpp" - -namespace xios -{ - CScalarValExprNode::CScalarValExprNode(const std::string& strVal) - : strVal(strVal) - { /* Nothing to do */ } - - double CScalarValExprNode::reduce() const - { - CType val; - val.fromString(strVal); - return val; - } - - CScalarVarExprNode::CScalarVarExprNode(const std::string& varId) - : varId(varId) - { /* Nothing to do */ } - - double CScalarVarExprNode::reduce() const - { - // $missing_value will be replaced with NaN - if (varId == "missing_value") - { - return std::numeric_limits::quiet_NaN(); - } - else - { - if (!CVariable::has(varId)) - ERROR("double CScalarVarExprNode::reduce() const", << "The variable " << varId << " does not exist."); - - return CVariable::get(varId)->getData(); - } - } - - CScalarUnaryOpExprNode::CScalarUnaryOpExprNode(const std::string& opId, IScalarExprNode* child) - : opId(opId) - , child(child) - { - if (!child) - ERROR("CScalarUnaryOpExprNode::CScalarUnaryOpExprNode(const std::string& opId, IScalarExprNode* child)", - "Impossible to create the new expression node, an invalid child node was provided."); - } - - double CScalarUnaryOpExprNode::reduce() const - { - COperatorExpr::functionScalar op = operatorExpr.getOpScalar(opId); - return op(child->reduce()); - } - - CScalarBinaryOpExprNode::CScalarBinaryOpExprNode(IScalarExprNode* child1, const std::string& opId, IScalarExprNode* child2) - : child1(child1) - , opId(opId) - , child2(child2) - { - if (!child1 || !child2) - ERROR("CScalarBinaryOpExprNode::CScalarBinaryOpExprNode(IScalarExprNode* child1, const std::string& opId, IScalarExprNode* child2)", - "Impossible to create the new expression node, an invalid child node was provided."); - } - - double CScalarBinaryOpExprNode::reduce() const - { - COperatorExpr::functionScalarScalar op = operatorExpr.getOpScalarScalar(opId); - return op(child1->reduce(), child2->reduce()); - } - - - CScalarTernaryOpExprNode::CScalarTernaryOpExprNode(IScalarExprNode* child1, const std::string& opId, IScalarExprNode* child2, IScalarExprNode* child3) - : child1(child1) - , opId(opId) - , child2(child2) - , child3(child3) - { - if (!child1 || !child2 || !child3) - ERROR("CScalarTernaryOpExprNode::CScalarTernaryOpExprNode(IScalarExprNode* child1, const std::string& opId, IScalarExprNode* child2, IScalarExprNode* child3)", - "Impossible to create the new expression node, an invalid child node was provided."); - } - - double CScalarTernaryOpExprNode::reduce() const - { - COperatorExpr::functionScalarScalarScalar op = operatorExpr.getOpScalarScalarScalar(opId); - return op(child1->reduce(), child2->reduce(), child3->reduce()); - } -} diff --git a/xios_2311_src/trunk/.svn/pristine/51/5152521f601c46058d2133051e9f0bd3f5b0b943.svn-base b/xios_2311_src/trunk/.svn/pristine/51/5152521f601c46058d2133051e9f0bd3f5b0b943.svn-base deleted file mode 100644 index 50db267cd4910e4d7645ec25d84335ac31174da7..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/51/5152521f601c46058d2133051e9f0bd3f5b0b943.svn-base +++ /dev/null @@ -1,89 +0,0 @@ -#include "zoom_domain.hpp" -#include "domain_algorithm_zoom.hpp" -#include "type.hpp" - -namespace xios { - - /// ////////////////////// Définitions ////////////////////// /// - - CZoomDomain::CZoomDomain(void) - : CObjectTemplate(), CZoomDomainAttributes(), CTransformation() - { /* Ne rien faire de plus */ } - - CZoomDomain::CZoomDomain(const StdString & id) - : CObjectTemplate(id), CZoomDomainAttributes(), CTransformation() - { /* Ne rien faire de plus */ } - - CZoomDomain::~CZoomDomain(void) - {} - - CTransformation* CZoomDomain::create(const StdString& id, xml::CXMLNode* node) - { - CZoomDomain* zoomDomain = CZoomDomainGroup::get("zoom_domain_definition")->createChild(id); - if (node) zoomDomain->parse(*node); - return static_cast*>(zoomDomain); - } - - bool CZoomDomain::_dummyRegistered = CZoomDomain::registerTrans(); - bool CZoomDomain::registerTrans() - { - return registerTransformation(TRANS_ZOOM_DOMAIN, {create, getTransformation}); - } - - //---------------------------------------------------------------- - - StdString CZoomDomain::GetName(void) { return StdString("zoom_domain"); } - StdString CZoomDomain::GetDefName(void) { return StdString("zoom_domain"); } - ENodeType CZoomDomain::GetType(void) { return eZoomDomain; } - - void CZoomDomain::checkValid(CDomain* domainSrc) - { - int ni_glo = domainSrc->ni_glo.getValue(); - int nj_glo = domainSrc->nj_glo.getValue(); - - // Résolution et vérification des données globales de zoom. - if (!this->ni.isEmpty() || !this->nj.isEmpty() || - !this->ibegin.isEmpty() || !this->jbegin.isEmpty()) - { - if (this->ni.isEmpty() || this->nj.isEmpty() || - this->ibegin.isEmpty() || this->jbegin.isEmpty()) - { - ERROR("CZoomDomain::checkValid(CDomain* domainSrc)", - << "If one of zoom attributes is defined then all zoom attributes must be defined.") ; - } - else - { - int iend = ibegin + ni - 1; - int jend = jbegin + nj - 1; - - if (ibegin < 0 || jbegin < 0 || iend > ni_glo - 1 || jend > nj_glo - 1) - ERROR("CZoomDomain::checkValid(CDomain* domainSrc)", - << "Zoom is wrongly defined, " - << "please check the values : 'ni' (" << ni.getValue() << "), 'nj' (" << nj.getValue() << "), " - << "'ibegin' (" << ibegin.getValue() << "), 'jbegin' (" << jbegin.getValue() << ")"); - } - } - else - { - ni = ni_glo; - nj = nj_glo; - ibegin = 0; - jbegin = 0; - } - } - - shared_ptr CZoomDomain::createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) - { - return CDomainAlgorithmZoom::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, - elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, - elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition); - } -} diff --git a/xios_2311_src/trunk/.svn/pristine/51/51b4a2deb922778755bc6133a172fb0411de993c.svn-base b/xios_2311_src/trunk/.svn/pristine/51/51b4a2deb922778755bc6133a172fb0411de993c.svn-base deleted file mode 100644 index 9c0c2f32baf562039b09bc98e4198fd83206ee6c..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/51/51b4a2deb922778755bc6133a172fb0411de993c.svn-base +++ /dev/null @@ -1,390 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* -This code is a variant of the H5detect.c code from HDF5. -Author: D. Heimbigner 10/7/2008 -*/ - -#include -#include -#include -#include - -#include "ncaux.h" - -struct NCAUX_FIELD { - char* name; - nc_type fieldtype; - int ndims; - int dimsizes[NC_MAX_VAR_DIMS]; - size_t size; - size_t offset; - size_t alignment; -}; - -struct NCAUX_CMPD { - int ncid; - int mode; - char* name; - int nfields; - struct NCAUX_FIELD* fields; - size_t size; - size_t offset; /* cumulative as fields are added */ - size_t alignment; -}; - -static int ncaux_initialized = 0; - -static void compute_alignments(void); -static int computefieldinfo(struct NCAUX_CMPD* cmpd); - -int -ncaux_begin_compound(int ncid, const char *name, int alignmode, void** tagp) -{ - int status = NC_NOERR; - struct NCAUX_CMPD* cmpd = NULL; - - if(!ncaux_initialized) { - compute_alignments(); - ncaux_initialized = 1; - } - - if(tagp) *tagp = NULL; - - cmpd = (struct NCAUX_CMPD*)calloc(1,sizeof(struct NCAUX_CMPD)); - if(cmpd == NULL) {status = NC_ENOMEM; goto fail;} - cmpd->ncid = ncid; - cmpd->mode = alignmode; - cmpd->nfields = 0; - cmpd->name = strdup(name); - if(cmpd->name == NULL) {status = NC_ENOMEM; goto fail;} - - if(tagp) *tagp = (void*)cmpd; - - return status; - -fail: - ncaux_abort_compound((void*)cmpd); - return status; -} - -int -ncaux_abort_compound(void* tag) -{ - int i; - struct NCAUX_CMPD* cmpd = (struct NCAUX_CMPD*)tag; - if(cmpd == NULL) goto done; - if(cmpd->name) free(cmpd->name); - for(i=0;infields;i++) { - struct NCAUX_FIELD* field = &cmpd->fields[i]; - if(field->name) free(field->name); - } - if(cmpd->fields) free(cmpd->fields); - free(cmpd); - -done: - return NC_NOERR; -} - -int -ncaux_add_field(void* tag, const char *name, nc_type field_type, - int ndims, const int* dimsizes) -{ - int i; - int status = NC_NOERR; - struct NCAUX_CMPD* cmpd = (struct NCAUX_CMPD*)tag; - struct NCAUX_FIELD* newfields = NULL; - struct NCAUX_FIELD* field = NULL; - - if(cmpd == NULL) goto done; - if(ndims < 0) {status = NC_EINVAL; goto done;} - for(i=0;ifields == NULL) { - newfields = (struct NCAUX_FIELD*)calloc(1,sizeof(struct NCAUX_FIELD)); - } else { - newfields = (struct NCAUX_FIELD*)realloc(cmpd->fields,cmpd->nfields+1*sizeof(struct NCAUX_FIELD)); - } - if(cmpd->fields == NULL) {status = NC_ENOMEM; goto done;} - cmpd->fields = newfields; - field = &cmpd->fields[cmpd->nfields+1]; - field->name = strdup(name); - field->fieldtype = field_type; - if(field->name == NULL) {status = NC_ENOMEM; goto done;} - field->ndims = ndims; - memcpy(field->dimsizes,dimsizes,sizeof(int)*ndims); - cmpd->nfields++; - -done: - return status; -} - -static size_t -dimproduct(int ndims, int* dimsizes) -{ - int i; - size_t product = 1; - for(i=0;incid, cmpd->size, cmpd->name, idp); - if(status != NC_NOERR) goto done; - - for(i=0;infields;i++) { - struct NCAUX_FIELD* field = &cmpd->fields[i]; - if(field->ndims > 0) { - status = nc_insert_compound(cmpd->ncid, *idp, field->name, - field->offset, field->fieldtype); - } else { - status = nc_insert_array_compound(cmpd->ncid, *idp, field->name, - field->offset, field->fieldtype, - field->ndims,field->dimsizes); - } - if(status != NC_NOERR) goto done; - } - -done: - return status; -} - -/**************************************************/ - -/* -The heart of this is the following macro, -which computes the offset of a field x -when preceded by a char field. -The assumptions appear to be as follows: -1. the offset produced in this situation indicates - the alignment for x relative in such a way that it - depends only on the types that precede it in the struct. -2. the compiler does not reorder fields. -3. arrays are tightly packed. -4. nested structs are alignd according to their first member - (this actually follows from C language requirement that - a struct can legally be cast to an instance of its first member). -Given the alignments for the various common primitive types, -it is assumed that one can use them anywhere to construct -the layout of a struct of such types. -It seems to work for HDF5 for a wide variety of machines. -*/ - -#define COMP_ALIGNMENT(DST,TYPE) {\ - struct {char f1; TYPE x;} tmp; \ - DST.typename = #TYPE ; \ - DST.alignment = (size_t)((char*)(&(tmp.x)) - (char*)(&tmp));} - -/* Define indices for every primitive C type */ -/* NAT => NOT-A-TYPE*/ -#define NATINDEX 0 -#define CHARINDEX 1 -#define UCHARINDEX 2 -#define SHORTINDEX 3 -#define USHORTINDEX 4 -#define INTINDEX 5 -#define UINTINDEX 6 -#define LONGINDEX 7 -#define ULONGINDEX 8 -#define LONGLONGINDEX 9 -#define ULONGLONGINDEX 10 -#define FLOATINDEX 11 -#define DOUBLEINDEX 12 -#define PTRINDEX 13 -#define NCVLENINDEX 14 - -#define NCTYPES 15 - -typedef struct Alignment { - char* typename; - int alignment; -} Alignment; - -typedef Alignment Typealignvec; - -/* Capture in struct and in a vector*/ -typedef struct Typealignset { - Alignment charalign; /* char*/ - Alignment ucharalign; /* unsigned char*/ - Alignment shortalign; /* short*/ - Alignment ushortalign; /* unsigned short*/ - Alignment intalign; /* int*/ - Alignment uintalign; /* unsigned int*/ - Alignment longalign; /* long*/ - Alignment ulongalign; /* unsigned long*/ - Alignment longlongalign; /* long long*/ - Alignment ulonglongalign; /* unsigned long long*/ - Alignment floatalign; /* float*/ - Alignment doublealign; /* double*/ - Alignment ptralign; /* void**/ - Alignment ncvlenalign; /* nc_vlen_t*/ -} Typealignset; - -static Typealignvec vec[NCTYPES]; -static Typealignset set; - -static void -compute_alignments(void) -{ - /* Compute the alignments for all the common C data types*/ - /* First for the struct*/ - /* initialize*/ - memset((void*)&set,0,sizeof(set)); - memset((void*)vec,0,sizeof(vec)); - - COMP_ALIGNMENT(set.charalign,char); - COMP_ALIGNMENT(set.ucharalign,unsigned char); - COMP_ALIGNMENT(set.shortalign,short); - COMP_ALIGNMENT(set.ushortalign,unsigned short); - COMP_ALIGNMENT(set.intalign,int); - COMP_ALIGNMENT(set.uintalign,unsigned int); - COMP_ALIGNMENT(set.longalign,long); - COMP_ALIGNMENT(set.ulongalign,unsigned long); - COMP_ALIGNMENT(set.longlongalign,long long); - COMP_ALIGNMENT(set.ulonglongalign,unsigned long long); - COMP_ALIGNMENT(set.floatalign,float); - COMP_ALIGNMENT(set.doublealign,double); - COMP_ALIGNMENT(set.ptralign,void*); - COMP_ALIGNMENT(set.ncvlenalign,nc_vlen_t); - - /* Then the vector*/ - COMP_ALIGNMENT(vec[CHARINDEX],char); - COMP_ALIGNMENT(vec[UCHARINDEX],unsigned char); - COMP_ALIGNMENT(vec[SHORTINDEX],short); - COMP_ALIGNMENT(vec[USHORTINDEX],unsigned short); - COMP_ALIGNMENT(vec[INTINDEX],int); - COMP_ALIGNMENT(vec[UINTINDEX],unsigned int); - COMP_ALIGNMENT(vec[LONGINDEX],long); - COMP_ALIGNMENT(vec[ULONGINDEX],unsigned long); - COMP_ALIGNMENT(vec[LONGLONGINDEX],long long); - COMP_ALIGNMENT(vec[ULONGLONGINDEX],unsigned long long); - COMP_ALIGNMENT(vec[FLOATINDEX],float); - COMP_ALIGNMENT(vec[DOUBLEINDEX],double); - COMP_ALIGNMENT(vec[PTRINDEX],void*); - COMP_ALIGNMENT(vec[NCVLENINDEX],nc_vlen_t); -} - -static size_t -nctypealignment(nc_type nctype) -{ - Alignment* align = NULL; - int index = 0; - switch (nctype) { - case NC_BYTE: index = UCHARINDEX; break; - case NC_CHAR: index = CHARINDEX; break; - case NC_SHORT: index = SHORTINDEX; break; - case NC_INT: index = INTINDEX; break; - case NC_FLOAT: index = FLOATINDEX; break; - case NC_DOUBLE: index = DOUBLEINDEX; break; - case NC_UBYTE: index = UCHARINDEX; break; - case NC_USHORT: index = USHORTINDEX; break; - case NC_UINT: index = UINTINDEX; break; - case NC_INT64: index = LONGLONGINDEX; break; - case NC_UINT64: index = ULONGLONGINDEX; break; - case NC_STRING: index = PTRINDEX; break; - case NC_VLEN: index = NCVLENINDEX; break; - case NC_OPAQUE: index = UCHARINDEX; break; - default: assert(0); - } - align = &vec[index]; - return align->alignment; -} - -static int -getpadding(int offset, int alignment) -{ - int rem = (alignment==0?0:(offset % alignment)); - int pad = (rem==0?0:(alignment - rem)); - return pad; -} - -/* Find first primitive field of a possibly nested sequence of compounds */ -static nc_type -findfirstfield(int ncid, nc_type xtype) -{ - int status = NC_NOERR; - nc_type fieldtype = xtype; - if(xtype <= NC_MAX_ATOMIC_TYPE) goto done; - - status = nc_inq_compound_fieldtype(ncid, xtype, 0, &fieldtype); - if(status != NC_NOERR) goto done; - fieldtype = findfirstfield(ncid,fieldtype); - -done: - return (status == NC_NOERR?fieldtype:NC_NAT); -} - -static int -computefieldinfo(struct NCAUX_CMPD* cmpd) -{ - int i; - int status = NC_NOERR; - size_t offset = 0; - size_t totaldimsize; - - /* Assign the sizes for the fields */ - for(i=0;infields;i++) { - struct NCAUX_FIELD* field = &cmpd->fields[i]; - status = nc_inq_type(cmpd->ncid,field->fieldtype,NULL,&field->size); - if(status != NC_NOERR) goto done; - totaldimsize = dimproduct(field->ndims,field->dimsizes); - field->size *= totaldimsize; - } - - for(offset=0,i=0;infields;i++) { - struct NCAUX_FIELD* field = &cmpd->fields[i]; - int alignment = 0; - nc_type firsttype = findfirstfield(cmpd->ncid,field->fieldtype); - - /* only support 'c' alignment for now*/ - switch (field->fieldtype) { - case NC_OPAQUE: - field->alignment = 1; - break; - case NC_ENUM: - field->alignment = nctypealignment(firsttype); - break; - case NC_VLEN: /*fall thru*/ - case NC_COMPOUND: - field->alignment = nctypealignment(firsttype); - break; - default: - field->alignment = nctypealignment(field->fieldtype); - break; - } - offset += getpadding(offset,alignment); - field->offset = offset; - offset += field->size; - } - cmpd->size = offset; - cmpd->alignment = cmpd->fields[0].alignment; - -done: - return status; -} diff --git a/xios_2311_src/trunk/.svn/pristine/51/51ec5788b8d6dc6ad16c8ae97c76096bb40653a4.svn-base b/xios_2311_src/trunk/.svn/pristine/51/51ec5788b8d6dc6ad16c8ae97c76096bb40653a4.svn-base deleted file mode 100644 index f4241f199009141266af52c9b764ddde1136e74d..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/51/51ec5788b8d6dc6ad16c8ae97c76096bb40653a4.svn-base +++ /dev/null @@ -1,80 +0,0 @@ -/********************************************************************* - Copyright 2010, UCAR/Unidata See netcdf/COPYRIGHT file for - copying and redistribution conditions. - *********************************************************************/ - -#include -#include -#include -#include -#include "nc.h" - -#define ID_SHIFT (16) -#define NCFILELISTLENGTH 0x10000 -/* Version one just allocates the max space (sizeof(NC*)*2^16)*/ -static NC** nc_filelist = NULL; - -static int numfiles = 0; - -/* Common */ -int -count_NCList(void) -{ - return numfiles; -} - - -void -free_NCList(void) -{ - if(numfiles > 0) return; /* not empty */ - if(nc_filelist != NULL) free(nc_filelist); - nc_filelist = NULL; -} - -int -add_to_NCList(NC* ncp) -{ - int i; - int new_id; - if(nc_filelist == NULL) { - if (!(nc_filelist = calloc(1, sizeof(NC*)*NCFILELISTLENGTH))) - return NC_ENOMEM; - numfiles = 0; - } - new_id = 0; /* id's begin at 1 */ - for(i=1;i<0x10000;i++) { - if(nc_filelist[i] == NULL) {new_id = i; break;} - } - if(new_id == 0) return NC_ENOMEM; /* no more slots */ - nc_filelist[new_id] = ncp; - numfiles++; - new_id = (new_id << ID_SHIFT); - ncp->ext_ncid = new_id; - return NC_NOERR; -} - -void -del_from_NCList(NC* ncp) -{ - unsigned int ncid = ((unsigned int)ncp->ext_ncid) >> ID_SHIFT; - if(numfiles == 0 || ncid == 0 || nc_filelist == NULL) return; - if(nc_filelist[ncid] != ncp) return; - nc_filelist[ncid] = NULL; - numfiles--; - - /* If all files have been closed, release the filelist memory. */ - if (numfiles == 0) - free_NCList(); -} - -NC * -find_in_NCList(int ext_ncid) -{ - NC* f = NULL; - unsigned int ncid = ((unsigned int)ext_ncid) >> ID_SHIFT; - if(numfiles > 0 && nc_filelist != NULL && ncid < NCFILELISTLENGTH) - f = nc_filelist[ncid]; - return f; -} - diff --git a/xios_2311_src/trunk/.svn/pristine/51/51fedadcd303b503815ee98252bcfb63c32f06b8.svn-base b/xios_2311_src/trunk/.svn/pristine/51/51fedadcd303b503815ee98252bcfb63c32f06b8.svn-base deleted file mode 100644 index da1cd38e0ab5c5d478fb3ff17ff9845062acec80..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/51/51fedadcd303b503815ee98252bcfb63c32f06b8.svn-base +++ /dev/null @@ -1,5583 +0,0 @@ -#LyX 2.1 created this file. For more info see http://www.lyx.org/ -\lyxformat 474 -\begin_document -\begin_header -\textclass book -\begin_preamble -\usepackage{MnSymbol} -\end_preamble -\use_default_options true -\begin_modules -logicalmkup -\end_modules -\maintain_unincluded_children false -\language english -\language_package default -\inputencoding auto -\fontencoding global -\font_roman default -\font_sans default -\font_typewriter default -\font_math auto -\font_default_family default -\use_non_tex_fonts false -\font_sc false -\font_osf false -\font_sf_scale 100 -\font_tt_scale 100 -\graphics default -\default_output_format default -\output_sync 0 -\bibtex_command default -\index_command default -\paperfontsize default -\spacing single -\use_hyperref false -\papersize a4paper -\use_geometry false -\use_package amsmath 1 -\use_package amssymb 1 -\use_package cancel 1 -\use_package esint 1 -\use_package mathdots 1 -\use_package mathtools 1 -\use_package mhchem 1 -\use_package stackrel 1 -\use_package stmaryrd 1 -\use_package undertilde 1 -\cite_engine basic -\cite_engine_type default -\biblio_style plain -\use_bibtopic false -\use_indices false -\paperorientation portrait -\suppress_date false -\justification true -\use_refstyle 0 -\index Index -\shortcut idx -\color #008000 -\end_index -\secnumdepth 3 -\tocdepth 3 -\paragraph_separation indent -\paragraph_indentation default -\quotes_language english -\papercolumns 1 -\papersides 1 -\paperpagestyle default -\tracking_changes false -\output_changes false -\html_math_output 0 -\html_css_as_file 0 -\html_be_strict false -\end_header - -\begin_body - -\begin_layout Title -XIOS User Guide -\end_layout - -\begin_layout Author -Draft -\end_layout - -\begin_layout Chapter -Calendar -\end_layout - -\begin_layout Section -How to define a calendar -\end_layout - -\begin_layout Standard -XIOS has an embedded calendar module which needs to be configured before - you can run your simulation. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -Only the calendar type and the time step used by your simulation are mandatory - to have a well defined calendar. - For example, a minimal calendar definition could be: -\end_layout - -\begin_layout Itemize -from the XML configuration file: -\begin_inset Newline newline -\end_inset - - -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -from the Fortran interface: -\begin_inset Newline newline -\end_inset - - -\begin_inset listings -lstparams "language=Fortran,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - -! ... -\end_layout - -\begin_layout Plain Layout - -TYPE(xios_context) :: ctx_hdl -\end_layout - -\begin_layout Plain Layout - -! ... -\end_layout - -\begin_layout Plain Layout - -! Context initialization ommited, see the corresponding section of this - user manual and of the reference manual -\end_layout - -\begin_layout Plain Layout - -CALL xios_get_handle("test",ctx_hdl) -\end_layout - -\begin_layout Plain Layout - -CALL xios_set_current_context(ctx_hdl) -\end_layout - -\begin_layout Plain Layout - -CALL xios_define_calendar(type="Gregorian", timestep=1.5*xios_hour) -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -The calendar type definition is done once and for all, either from the XML - configuration file or the Fortran interface, and cannot be modified. - However there is no such restriction regarding the time step which can - be defined at a different time than the calendar type and even redefined - multiple times. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -For example, it is possible to the achieve the same minimal configuration - as above by using both the XML configuration file: -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - -and the Fortran interface: -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=Fortran,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - -! ... -\end_layout - -\begin_layout Plain Layout - -TYPE(xios_context) :: ctx_hdl -\end_layout - -\begin_layout Plain Layout - -! ... -\end_layout - -\begin_layout Plain Layout - -! Context initialization ommited, see the corresponding section of this - user manual and of the reference manual -\end_layout - -\begin_layout Plain Layout - -CALL xios_get_handle("test",ctx_hdl) -\end_layout - -\begin_layout Plain Layout - -CALL xios_set_current_context(ctx_hdl) -\end_layout - -\begin_layout Plain Layout - -! xios_define_calendar cannot be used here because the type was already - defined in the configuration file. -\end_layout - -\begin_layout Plain Layout - -! Ommiting the following line would lead to an error because the timestep - would be undefined. -\end_layout - -\begin_layout Plain Layout - -CALL xios_set_timestep(timestep=1.5*xios_hour) -\end_layout - -\end_inset - -The calendar also has two optional date parameters: -\end_layout - -\begin_layout Itemize -the start date which corresponds to the beginning of the simulation -\end_layout - -\begin_layout Itemize -the time origin which corresponds to the origin of the time axis. -\end_layout - -\begin_layout Standard -If they are undefined, those parameters are set by default to -\begin_inset Quotes eld -\end_inset - - -\series bold -\emph on -0000-01-01 00:00:00 -\series default -\emph default - -\begin_inset Quotes erd -\end_inset - -. - If you are not interested in specific dates, you can ignore those parameters - completely. - However if you wish to set them, please note that they must not be set - before the calendar is defined. - Thus the following XML configuration file would be for example invalid: -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - -while the following configuration file would be valid: -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - -Of course, it is always possible to define or redefine those parameters - from the Fortran interface, directly when defining the calendar: -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=Fortran,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - -! ... -\end_layout - -\begin_layout Plain Layout - -TYPE(xios_context) :: ctx_hdl -\end_layout - -\begin_layout Plain Layout - -! ... -\end_layout - -\begin_layout Plain Layout - -! Context initialization ommited, see the corresponding section of this - user manual and of the reference manual -\end_layout - -\begin_layout Plain Layout - -CALL xios_get_handle("test",ctx_hdl) -\end_layout - -\begin_layout Plain Layout - -CALL xios_set_current_context(ctx_hdl) -\end_layout - -\begin_layout Plain Layout - -CALL xios_define_calendar(type="Gregorian", time_origin=xios_date(1977, - 10, 19, 00, 00, 00), start_date=xios_date(2011, 11, 11, 13, 37, 42)) -\end_layout - -\end_inset - -or at a later time: -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=Fortran,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - -! ... -\end_layout - -\begin_layout Plain Layout - -TYPE(xios_context) :: ctx_hdl -\end_layout - -\begin_layout Plain Layout - -! ... -\end_layout - -\begin_layout Plain Layout - -! Context initialization ommited, see the corresponding section of this - user manual and of the reference manual -\end_layout - -\begin_layout Plain Layout - -CALL xios_get_handle("test",ctx_hdl) -\end_layout - -\begin_layout Plain Layout - -CALL xios_set_current_context(ctx_hdl) -\end_layout - -\begin_layout Plain Layout - -CALL xios_define_calendar(type="Gregorian") -\end_layout - -\begin_layout Plain Layout - -CALL xios_set_time_origin(time_origin=xios_date(1977, 10, 19, 00, 00, 00)) -\end_layout - -\begin_layout Plain Layout - -CALL xios_set_start_date(start_date=xios_date(2011, 11, 11, 13, 37, 42)) -\end_layout - -\end_inset - -To simplify the use of dates in the XML configuration files, it is possible - to partially define a date as long as the omitted parts are the rightmost. - In this case the remainder of the date is initialized as in the default - date. - For example, it would be valid to write: -\begin_inset Flex Code -status open - -\begin_layout Plain Layout -start_date="1977-10-19" -\end_layout - -\end_inset - - instead of -\begin_inset Flex Code -status open - -\begin_layout Plain Layout -start_date="1977-10-19 00:00:00" -\end_layout - -\end_inset - - or even -\begin_inset Flex Code -status open - -\begin_layout Plain Layout -time_origin="1789" -\end_layout - -\end_inset - - instead of -\begin_inset Flex Code -status open - -\begin_layout Plain Layout -time_origin="1789-01-01 00:00:00" -\end_layout - -\end_inset - -. - Similarly, it is possible to express a date with an optional duration offset - in the configuration file by using the -\begin_inset Flex Code -status open - -\begin_layout Plain Layout -date + duration -\end_layout - -\end_inset - - notation, with -\begin_inset Flex Code -status open - -\begin_layout Plain Layout -date -\end_layout - -\end_inset - - potentially partially defined or even completely omitted. - Consequently the following examples are all valid in the XML configuration - file: -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status open - -\begin_layout Plain Layout -time_origin="2011-11-11 13:37:00 + 42s" -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status open - -\begin_layout Plain Layout -time_origin="2014 + 1y 2d" -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -\begin_inset Flex Code -status open - -\begin_layout Plain Layout -start_date="+ 36h" -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Section -How to define a user defined calendar -\end_layout - -\begin_layout Standard -Predefined calendars might not be enough for your needs if you simulate - phenomenons on another planet than the Earth. - For this reason, XIOS can let you configure a completely user defined calendar - by setting the -\series bold -type -\series default - attribute to -\begin_inset Quotes eld -\end_inset - - -\series bold -\emph on -user_defined -\series default -\emph default - -\begin_inset Quotes erd -\end_inset - -. - In that case, the calendar type alone is not sufficient to define the calendar - and other parameters should be provided since the duration of a day or - a year are not known in advance. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -Two approaches are possible depending on whether you want that your custom - calendar to have months or not: either use the -\series bold -month_lengths -\series default - attribute to define the duration of each months in days or use the -\series bold -year_length -\series default - attribute to define the duration of the year in seconds. - In both cases, you have to define -\series bold -day_length -\series default -, the duration of a day in seconds. - Those attributes have to be defined at the same time than the calendar - type, either from the XML configuration file or the Fortran interface, - for example: -\begin_inset Newline newline -\end_inset - - -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - -or -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=Fortran,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - -! ... -\end_layout - -\begin_layout Plain Layout - -TYPE(xios_context) :: ctx_hdl -\end_layout - -\begin_layout Plain Layout - -! ... -\end_layout - -\begin_layout Plain Layout - -! Context initialization ommited, see the corresponding section of this - user manual and of the reference manual -\end_layout - -\begin_layout Plain Layout - -CALL xios_get_handle("test",ctx_hdl) -\end_layout - -\begin_layout Plain Layout - -CALL xios_set_current_context(ctx_hdl) -\end_layout - -\begin_layout Plain Layout - -CALL xios_define_calendar(type="Gregorian", day_length=86400, year_length=315576 -00) -\end_layout - -\end_inset - -Note that if no months are defined, the format of the dates is modified - in the XML configuration file since the month must be omitted. - For example, -\begin_inset Flex Code -status open - -\begin_layout Plain Layout -"2015-71 13:37:42" -\end_layout - -\end_inset - - would be the correct way to refer to the 71st day of the year 2015 at 13:37:42. - If you use the Fortran interface, the month cannot be omitted but you have - to make sure to always set it to -\begin_inset Flex Code -status open - -\begin_layout Plain Layout -1 -\end_layout - -\end_inset - - in that case. - For example, use -\begin_inset Flex Code -status open - -\begin_layout Plain Layout -xios_date(2015, 01, 71, 13, 37, 42) -\end_layout - -\end_inset - -for -\begin_inset Flex Code -status open - -\begin_layout Plain Layout -"2015-71 13:37:42" -\end_layout - -\end_inset - -. - Moreover, it is possible that the duration of the day is greater than the - duration of the year on some planets. - In this case, it obviously not possible to define months so you have to - use the -\series bold -year_length -\series default - attribute. - Additionally the day must also be omitted from the dates in the configuration - file (for example -\begin_inset Flex Code -status open - -\begin_layout Plain Layout -"2015 13:37:42" -\end_layout - -\end_inset - -) and must always be set to -\begin_inset Flex Code -status open - -\begin_layout Plain Layout -1 -\end_layout - -\end_inset - - when using the Fortran interface (for example -\begin_inset Flex Code -status open - -\begin_layout Plain Layout -xios_date(2015, 01, 01, 13, 37, 42) -\end_layout - -\end_inset - -). -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -If months have been defined, you might want to have leap years to correct - the drift between the calendar year and the astronomical year. - This can be achieved by using the -\series bold -leap_year_drift -\series default - and -\series bold -leap_year_month -\series default - attributes and optionally the -\series bold -leap_year_drift_offset -\series default - attribute. - The idea is to define -\series bold -leap_year_drift -\series default -, the yearly drift between the calendar year and the astronomical year as - a fraction of a day. - This yearly drift is summed each year to know the current drift and each - time the current drift is greater or equal to one day, the year is considered - a leap year. - In that case, an extra day is added to the month defined by -\series bold -leap_year_month -\series default - and one day is subtracted to the current drift. - The initial drift is null by default but it can be fixed by the -\series bold -leap_year_drift_offset -\series default - attribute. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -The following configuration file defines a simplified Gregorian calendar - using the user calendar feature: -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - -As you know, the astronomical year on Earth is approximately a quarter of - day longer than the Gregorian calendar year so we have to define the yearly - drift as 0.25 day. - In case of a leap year, an extra day is added at the end of February which - is the second month of the year so -\series bold -leap_year_month -\series default - should be set to 2. - We start our time axis in 2012 which was a leap year in the Gregorian calendar. - This means there was previously three non-leap years in a row so the current - drift was (approximately) -\begin_inset Formula $3\times0.25$ -\end_inset - - days, hence -\series bold -leap_year_drift_offset -\series default - should be set to 0.75. - At the beginning of 2013, the drift would have been -\begin_inset Formula $0.75+0.25=1$ -\end_inset - - day so 2012 will be a leap year as expected. -\end_layout - -\begin_layout Section -How to use the calendar -\end_layout - -\begin_layout Standard -The calendar is created immediately after the calendar type has been defined - and thus can be used even before the context definition has been closed. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -Once the calendar is created, you have to keep it updated so that it is - in sync with your simulation. - To do that, you have to call the -\series bold -xios_update_calendar -\series default - subroutine for each iteration of your code: -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=Fortran,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - -! ... -\end_layout - -\begin_layout Plain Layout - -INTEGER :: ts -\end_layout - -\begin_layout Plain Layout - -! ... -\end_layout - -\begin_layout Plain Layout - -DO ts=1,end -\end_layout - -\begin_layout Plain Layout - - CALL xios_update_calendar(ts) -\end_layout - -\begin_layout Plain Layout - - ! Do useful stuff -\end_layout - -\begin_layout Plain Layout - -ENDDO -\end_layout - -\end_inset - -The current date is updated to -\begin_inset Formula $start\_date+ts\times timestep$ -\end_inset - - after each call. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -Many other calendar operations are available, including: -\end_layout - -\begin_layout Itemize -accessing various calendar related information like the time step, the time - origin, the start date, the duration of a day or a year, the current date, - etc. - -\end_layout - -\begin_layout Itemize -doing arithmetic and comparison operations on date: -\begin_inset Newline newline -\end_inset - - -\begin_inset listings -lstparams "language=Fortran,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - -TYPE(xios_date) :: date1, date2 -\end_layout - -\begin_layout Plain Layout - -TYPE(xios_duration) :: duration -\end_layout - -\begin_layout Plain Layout - -LOGICAL :: res -\end_layout - -\begin_layout Plain Layout - -! we suppose a calendar is defined -\end_layout - -\begin_layout Plain Layout - -CALL xios_get_current_date(date1) -\end_layout - -\begin_layout Plain Layout - -duration = xios_duration(0, 0, 1, 0, 0, 0, 0, 0) + 12 * xios_hour -\end_layout - -\begin_layout Plain Layout - -date2 = date1 + duration + 0.5 * xios_hour -\end_layout - -\begin_layout Plain Layout - -res = date2 > date1 -\end_layout - -\begin_layout Plain Layout - -duration = date2 - date1 -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -converting dates to -\end_layout - -\begin_deeper -\begin_layout Itemize -the number of seconds since the time origin, the beginning of the year or - the beginning of the day, -\end_layout - -\begin_layout Itemize -the number of days since the beginning of the year, -\end_layout - -\begin_layout Itemize -the fraction of the day or the year. -\end_layout - -\end_deeper -\begin_layout Standard -For more detailed about the calendar attributes and operations, see the - XIOS reference guide. -\end_layout - -\begin_layout Chapter -Files -\end_layout - -\begin_layout Standard -Since files are central to an I/O server, the configuration of XIOS is built - around file objects. - Those objects correspond directly to files on the computer file system - which are either to be written or to be read. - Although, XIOS currently only supports the NetCDF format, XIOS files are - a generic abstraction. - Each file can contain one or more fields (each field being defined on a - grid) and optionally variables. - In the NetCDF nomenclature, fields defined in XIOS correspond to NetCDF - variables and XIOS variables are NetCDF attributes. - As fields, variables and grids are complex objects, they have their own - chapters and we will focus only on files in this section. -\end_layout - -\begin_layout Section -How to define your first file -\end_layout - -\begin_layout Standard -If you wish to input or to output data using XIOS, you will need to define - at least one file. - This can be done from both the XML configuration file and the Fortran interface. - Files are usually defined in the configuration file, although their definitions - are sometimes amended using the API. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -File objects are defined with the -\begin_inset Flex Code -status open - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - tag and should always be inside the -\begin_inset Flex Code -status open - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - section. - Only the output frequency is mandatory to have a well defined file but - it is generally a good idea to give it a name. - The following example shows a minimal configuration file which defines - one file. -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - -Note that the file extension could depend of the format so it is automatically - added to the chosen name by XIOS. - Since XIOS only support NetCDF formats for now, the extension is always - -\begin_inset Quotes eld -\end_inset - -.nc -\begin_inset Quotes erd -\end_inset - -. - If the name is not set, XIOS will use the id of the file object instead. - This id is generated automatically by XIOS if it was not set by the user. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -The output frequency is particularly important since it defines the interval - of time between two consecutive outputs, that is in NetCDF nomenclature - the interval between two records. - In the example, the data would be written for every timestep (independently - of the timestep duration). - It is possible to use any duration as the output frequency but be careful - if you are not using a duration which is a multiple of the timestep duration - since XIOS might not be doing what you want. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -The same configuration could be obtained from the Fortran interface as well: -\begin_inset Newline newline -\end_inset - - -\begin_inset listings -lstparams "language=Fortran,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - -! ... -\end_layout - -\begin_layout Plain Layout - -TYPE(xios_context) :: ctx_hdl -\end_layout - -\begin_layout Plain Layout - -TYPE(xios_file) :: file_hdl -\end_layout - -\begin_layout Plain Layout - -TYPE(xios_filegroup) :: filegroup_hdl -\end_layout - -\begin_layout Plain Layout - -! ... -\end_layout - -\begin_layout Plain Layout - -! Context and calendar initializations ommited, see the corresponding section - of this user manual and of the reference manual -\end_layout - -\begin_layout Plain Layout - -CALL xios_get_handle("test", ctx_hdl) -\end_layout - -\begin_layout Plain Layout - -CALL xios_set_current_context(ctx_hdl) -\end_layout - -\begin_layout Plain Layout - -CALL xios_get_filegroup_handle("file_definition", filegroup_hdl) -\end_layout - -\begin_layout Plain Layout - -CALL xios_add_file(filegroup_hdl, file_hdl) -\end_layout - -\begin_layout Plain Layout - -CALL xios_set_attr(file_hdl, name="output", output_freq=xios_timestep) -\end_layout - -\end_inset - -Another important parameter for file is the -\series bold -mode -\series default - attribute which is set by default to -\begin_inset Quotes eld -\end_inset - - -\series bold -\emph on -write -\series default -\emph default - -\begin_inset Quotes erd -\end_inset - -. - You need to set it to -\begin_inset Quotes eld -\end_inset - - -\series bold -\emph on -read -\series default -\emph default - -\begin_inset Quotes erd -\end_inset - - if you want to use XIOS to handle inputs. - Note that in this case the -\series bold -output_freq -\series default - attribute must correspond to the output frequency used to create the input - file. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -When using the -\begin_inset Quotes eld -\end_inset - - -\series bold -\emph on -write -\series default -\emph default - -\begin_inset Quotes erd -\end_inset - - mode, it is possible to append the data to an existing file instead of - overwriting it by setting the -\series bold -append -\series default - attribute to -\begin_inset Quotes eld -\end_inset - - -\series bold -\emph on -true -\series default -\emph default - -\begin_inset Quotes erd -\end_inset - -. - In this case, you must be careful not to modify the structure of the file, - in particular no fields should be added, modified nor removed, or XIOS - will throw an error. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -If you wish to disable a file without having to remove its definition from - the configuration file, you can set the -\series bold -enabled -\series default - attribute to -\begin_inset Quotes eld -\end_inset - - -\series bold -\emph on -false -\series default -\emph default - -\begin_inset Quotes erd -\end_inset - -. -\end_layout - -\begin_layout Section -How to use parallel I/O -\end_layout - -\begin_layout Standard -By default XIOS will create one file by server, each file being suffixed - with the rank of the server. - For example, if the sample configuration used in the previous section was - used with two servers, two files named -\begin_inset Quotes eld -\end_inset - -output_0.nc -\begin_inset Quotes erd -\end_inset - - and -\begin_inset Quotes eld -\end_inset - -output_1.nc -\begin_inset Quotes erd -\end_inset - - would be created. - Each file would contain only the portion of the fields affected to the - corresponding server. - This default mode can also be explicitly configured by setting the -\series bold -type -\series default - attribute to -\begin_inset Quotes eld -\end_inset - - -\series bold -\emph on -multiple_file -\series default -\emph default - -\begin_inset Quotes erd -\end_inset - -. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -Using the -\begin_inset Quotes eld -\end_inset - - -\series bold -\emph on -multiple_file -\series default -\emph default - -\begin_inset Quotes erd -\end_inset - - mode is often a reliable way to achieve good performances, particularly - if you only have a few servers. - However having multiple files also increases the complexity of the post-process -ing chains and it is often much easier to always get one file regardless - of how many servers are used. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -It is possible to achieve such behavior in XIOS by setting the -\series bold -type -\series default - attribute to -\begin_inset Quotes eld -\end_inset - - -\series bold -\emph on -one_file -\series default -\emph default - -\begin_inset Quotes erd -\end_inset - -. - This feature depends directly on the NetCDF library capabilities so you - need to make sure that XIOS was properly linked with a parallel version - of NetCDF. - If the library was not compiled with parallel input/output support, XIOS - will issue a warning and revert to the -\begin_inset Quotes eld -\end_inset - - -\series bold -\emph on -multiple_file -\series default -\emph default - -\begin_inset Quotes erd -\end_inset - - mode. -\end_layout - -\begin_layout Section -Supported NetCDF formats -\end_layout - -\begin_layout Standard -XIOS supports only the version 4 or later of NetCDF library. - It uses by default the new NetCDF-4 format which relies on HDF5 format - as a back-end. - This format can also be selected explicitly by setting the -\series bold -format -\series default - attribute to -\begin_inset Quotes eld -\end_inset - - -\series bold -\emph on -netcdf4 -\series default -\emph default - -\begin_inset Quotes erd -\end_inset - -. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -Alternatively, it also possible to force NetCDF-4 to use the classic NetCDF-3 - binary format by setting the -\series bold -format -\series default - attribute to -\begin_inset Quotes eld -\end_inset - - -\series bold -\emph on -netcdf4_classic -\series default -\emph default - -\begin_inset Quotes erd -\end_inset - -. - When using this older format, some features might be unavailable but current - version of XIOS should not be affected much. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -Depending on the format, there are some specific requirements on how the - NetCDF library should have been compiled: -\end_layout - -\begin_layout Itemize -\begin_inset Quotes eld -\end_inset - - -\series bold -\emph on -netcdf4 -\series default -\emph default - -\begin_inset Quotes erd -\end_inset - - format requires that HDF5 support has been enabled in NetCDF using the - configuration option -\begin_inset Flex Code -status open - -\begin_layout Plain Layout --\SpecialChar \nobreakdash- --enable-netcdf4 -\end_layout - -\end_inset - - and that the HDF5 library has been properly linked. -\end_layout - -\begin_layout Itemize -\begin_inset Quotes eld -\end_inset - - -\series bold -\emph on -netcdf4 -\series default -\emph default - -\begin_inset Quotes erd -\end_inset - - format used in -\begin_inset Quotes eld -\end_inset - - -\series bold -\emph on -one_file -\series default -\emph default - -\begin_inset Quotes erd -\end_inset - - mode requires that the HDF5 library has been compiled with parallel support - using the configuration option -\begin_inset Flex Code -status open - -\begin_layout Plain Layout --\SpecialChar \nobreakdash- --enable-parallel -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Itemize -\begin_inset Quotes eld -\end_inset - - -\series bold -\emph on -netcdf4_classic -\series default -\emph default - -\begin_inset Quotes erd -\end_inset - - format used in -\begin_inset Quotes eld -\end_inset - - -\series bold -\emph on -one_file -\series default -\emph default - -\begin_inset Quotes erd -\end_inset - - mode requires that Parallel NetCDF support has been enabled in NetCDF using - the configuration option -\begin_inset Flex Code -status open - -\begin_layout Plain Layout --\SpecialChar \nobreakdash- --enable-pnetcdf -\end_layout - -\end_inset - - and that the Parallel NetCDF library has been properly linked. -\end_layout - -\begin_layout Section -UGRID -\end_layout - -\begin_layout Standard -In addition to the CF conventions, it is also possible to output data using - -\begin_inset CommandInset href -LatexCommand href -name "UGRID" -target "https://ugrid-conventions.github.io/ugrid-conventions/" - -\end_inset - - metadata conventions developed for unstructured meshes. - It allows users to store the topology of an underlying unstructured mesh. - Currently XIOS supports 2D unstructured meshes of any shape (triangular, - quadrilateral, etc) and their mixture. - -\end_layout - -\begin_layout Standard -A 2D mesh can be described by a set of nodes, edges and/or faces. - XIOS allows one to define data on any of these three types of elements. - XIOS will generate a full list of connectivity attributes proposed by the - UGRID conventions. - For example in case of a mesh comprised of faces the following connectivity - parameters will be the calculated: -\end_layout - -\begin_layout Standard - -\family typewriter -edge_node_connectivity -\end_layout - -\begin_layout Standard - -\family typewriter -face_node_connectivity -\end_layout - -\begin_layout Standard - -\family typewriter -edge_nodes_connectivity -\end_layout - -\begin_layout Standard - -\family typewriter -face_nodes_connectivity -\end_layout - -\begin_layout Standard - -\family typewriter -face_edges_connectivity -\end_layout - -\begin_layout Standard - -\family typewriter -edge_face_connectivity -\end_layout - -\begin_layout Standard - -\family typewriter -face_face_connectivity -\end_layout - -\begin_layout Standard -In order to select UGRID output format, one has to set file attribute -\series bold -convention -\series default - to -\series bold -\shape italic -"UGRID" -\series default -\shape default - (its default value is -\series bold -\shape italic - -\begin_inset Quotes eld -\end_inset - -CF -\begin_inset Quotes erd -\end_inset - - -\series default -\shape default -). - Domain attribute -\series bold -nvertex -\series default - is mandatory for UGRID. - It servers for identifying one of three types of mesh elements on which - data can be defined: nodes (nvertex=1), edges (nvertex=2), and faces (nvertex -\begin_inset Formula $\geq$ -\end_inset - -3). - In order to write fields on the same mesh but on its different elements, - one has to assign the same domain name to each of the domains. - Example given below illustrates this point for three fields defined on - the same mesh but on its different elements: nodes, edges, and faces. -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Section -How to use file splitting -\end_layout - -\begin_layout Standard -Output files can often be quite huge, particularly if the -\begin_inset Quotes eld -\end_inset - - -\series bold -\emph on -one_file -\series default -\emph default - -\begin_inset Quotes erd -\end_inset - - mode is used. - In this case, it can be interesting to periodically split the file in order - to have a few smaller files containing contiguous temporal portions of - the output data. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -This behavior can be achieved in XIOS by setting the -\series bold -split_freq -\series default - attribute to the duration you want, as illustrated in the following example: -\begin_inset Newline newline -\end_inset - - -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - -With this configuration, some data will be outputted every day and a new - file will be created every year. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -Note that the split frequency is the duration after which a new file will - be created, it does not mean that a new file will be created at the beginning - of each period. - For example, if you start your simulation the first of June 2014 and run - it for two years with a split frequency of one year: -\end_layout - -\begin_layout Itemize -you will get two files containing respectively the period from June 1st, - 2014 to May 31th, 2015 and from June 1st, 2015 to May 31th, 2016. -\end_layout - -\begin_layout Itemize -you will NOT get three files containing respectively the last six months - of 2014, the full year of 2015 and the first six months of 2016. -\end_layout - -\begin_layout Standard -XIOS automatically suffixes the file names with the start and end dates - when using file splitting. - By default, it will try to use the shortest date that still enables to - distinguish the files. - Thus in the above example, the files would be named -\begin_inset Quotes eld -\end_inset - -output_2014-2015.nc -\begin_inset Quotes erd -\end_inset - - and -\begin_inset Quotes eld -\end_inset - -output_2015-2016.nc -\begin_inset Quotes erd -\end_inset - -. - If you wish to force the date format used to prefix the files, you can - define the -\series bold -split_freq_format -\series default - attribute to override the default behavior. -\end_layout - -\begin_layout Section -A word about file synchronization -\end_layout - -\begin_layout Standard -File synchronization is usually not something you should worry about. - However, it is important to understand that data written by XIOS might - not be immediately written on the disk in practice. - Input/output libraries like NetCDF and HDF5 and parallel file systems generally - use complex caching policies for performance reasons. - This means that your data might still be stored in memory after it was - supposedly written. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -It might become critical to control this behavior for two main reasons: -\end_layout - -\begin_layout Itemize -if you want to mitigate the impact of a crash, as all buffered data would - be lost ; -\end_layout - -\begin_layout Itemize -if you want to be able to access the data from the output file immediately - after writing it. -\end_layout - -\begin_layout Standard -By default, XIOS will never force file synchronization but you can require - it to do so by setting the -\series bold -sync_freq -\series default - attribute to the wanted duration. - In this case, XIOS will regularly instruct NetCDF to synchronize the file - on disk by flushing its internal buffers. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -Note file synchronization must be used sparingly as it can have a disastrous - impact on performance. - Make sure to use a reasonably high synchronization frequency to avoid any - issue. -\end_layout - -\begin_layout Chapter -Fields and variables -\end_layout - -\begin_layout Standard -XIOS outsources the input/output definitions in its XML configuration file. - In the last chapter we presented some general points about file objects. - This chapter focuses on how to use fields and variables (that is variables - and attributes in NetCDF nomenclature) to populate files. -\begin_inset Newline newline -\end_inset - - -\end_layout - -\begin_layout Section -How to define your first field -\end_layout - -\begin_layout Standard -If you wish to input or to output data using XIOS, you will need to define - at least one file with one field. - This can be done from both the XML configuration file and the Fortran interface. - Fields are often defined in the configuration file, although their definitions - are sometimes amended using the API. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -Field objects are defined with the -\begin_inset Flex Code -status open - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - tag and should always be inside a -\begin_inset Flex Code -status open - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - or a -\begin_inset Flex Code -status open - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - section. - Only the grid and the operation attached to the field are mandatory to - have a well defined field but it is generally a good idea to give it an - identifier. - The following example shows a minimal configuration file which defines - one file with one field. -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - -It defines one file named -\begin_inset Quotes eld -\end_inset - - -\emph on -output -\emph default - -\begin_inset Quotes erd -\end_inset - - which contains one field -\begin_inset Quotes eld -\end_inset - - -\emph on -field_A -\emph default - -\begin_inset Quotes erd -\end_inset - - defined on a grid -\begin_inset Quotes eld -\end_inset - - -\emph on -grid_A -\emph default - -\begin_inset Quotes erd -\end_inset - -. - The file and the field are configured so that the data is written in the - file at every timestep (using the -\series bold -output_freq -\series default - file attribute) without any transformation (using the -\series bold -operation -\series default - field attribute set to -\begin_inset Quotes eld -\end_inset - - -\series bold -\emph on -instant -\series default -\emph default - -\begin_inset Quotes erd -\end_inset - -). -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -The corresponding Fortran simulation loop could be: -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=Fortran,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - -DO ts=1,numberOfTimestep -\end_layout - -\begin_layout Plain Layout - - ! Inform XIOS of the current timestep -\end_layout - -\begin_layout Plain Layout - - CALL xios_update_calendar(ts) -\end_layout - -\begin_layout Plain Layout - - ! Compute field_A for current timestep -\end_layout - -\begin_layout Plain Layout - - ! ... -\end_layout - -\begin_layout Plain Layout - - ! Output the data -\end_layout - -\begin_layout Plain Layout - - CALL xios_send_field("field_A", field_A) -\end_layout - -\begin_layout Plain Layout - -ENDDO -\end_layout - -\end_inset - -As you can see, the -\series bold -id -\series default - of the field is used in the model to select the field for which data is - being provided which makes this attribute extremely important. - Note that it must be unique for all fields even if they are defined in - different files. - By default, the -\series bold -id -\series default - of a field is also used as the name of the corresponding NetCDF variable. - It is however possible to override this default name using the field attribute - -\series bold -name -\series default -. - Two fields can share the same -\series bold -name -\series default - as long as they are not used in the same file. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -The second argument of the -\begin_inset Flex Code -status open - -\begin_layout Plain Layout -xios_send_field -\end_layout - -\end_inset - - function is an array containing the data. - Its shape and content are not described here as they depend directly on - the grid. - For more information on the data layout, refer to the chapters focusing - on grids, domains and axis. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -The same configuration could also be obtained using the Fortran interface: -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=Fortran,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - -! ... -\end_layout - -\begin_layout Plain Layout - -TYPE(xios_context) :: ctx_hdl -\end_layout - -\begin_layout Plain Layout - -TYPE(xios_file) :: file_hdl -\end_layout - -\begin_layout Plain Layout - -TYPE(xios_filegroup) :: filegroup_hdl -\end_layout - -\begin_layout Plain Layout - -TYPE(xios_field) :: field_hdl -\end_layout - -\begin_layout Plain Layout - -! ... -\end_layout - -\begin_layout Plain Layout - -! Context, calendar and grid initializations ommited, see the corresponding - section of this user manual and of the reference manual -\end_layout - -\begin_layout Plain Layout - -CALL xios_get_handle("test", ctx_hdl) -\end_layout - -\begin_layout Plain Layout - -CALL xios_set_current_context(ctx_hdl) -\end_layout - -\begin_layout Plain Layout - -CALL xios_get_filegroup_handle("file_definition", filegroup_hdl) -\end_layout - -\begin_layout Plain Layout - -CALL xios_add_file(filegroup_hdl, file_hdl) -\end_layout - -\begin_layout Plain Layout - -CALL xios_set_attr(file_hdl, name="output", output_freq=xios_timestep) -\end_layout - -\begin_layout Plain Layout - -CALL xios_add_field(file_hdl, field_hdl, "field_A") -\end_layout - -\begin_layout Plain Layout - -CALL xios_set_attr(field_hdl, grid_ref="grid_A", operation="instant") -\end_layout - -\end_inset - -Note that if you want to define a field on a grid with only one domain and/or - one axis, it is possible to use the -\series bold -domain_ref -\series default - and -\series bold -axis_ref -\series default - attributes instead of the -\series bold -grid_ref -\series default - attribute. - A temporary grid will be created based on the domain and/or axis defined - this way. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -If you are using a grid with some masked points (see the relevant sections - of this manual), you must set the -\series bold -default_value -\series default - attribute to define the default value that will replace the missing values - in the output file. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -If you wish to disable a field without having to remove its definition from - the configuration file, you can set the -\series bold -enabled -\series default - attribute to -\begin_inset Quotes eld -\end_inset - - -\series bold -\emph on -false -\series default -\emph default - -\begin_inset Quotes erd -\end_inset - -. -\end_layout - -\begin_layout Section -How to use temporal operations -\end_layout - -\begin_layout Standard -The last section showed a very basic example where the data was outputted - at every timestep using the -\begin_inset Quotes eld -\end_inset - - -\series bold -\emph on -instant -\series default -\emph default - -\begin_inset Quotes erd -\end_inset - - -\series bold -operation -\series default -. - However in many use cases, it might be more interesting to output only - the mean value on a certain period of time for example. - This section describes the use of temporal operations available in XIOS. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -The field attribute -\series bold -operation -\series default - currently supports six modes: -\end_layout - -\begin_layout Itemize - -\series bold -\emph on -instant -\series default -\emph default -: no temporal operation is applied which means the new data always overrides - the previous one even if it was not outputted, -\end_layout - -\begin_layout Itemize - -\series bold -\emph on -average -\series default -\emph default -: compute and output the mean value, -\end_layout - -\begin_layout Itemize - -\series bold -\emph on -accumulate -\series default -\emph default -: compute and output the sum, -\end_layout - -\begin_layout Itemize - -\series bold -\emph on -minimum -\series default -\emph default -: compute and output the minimum value, -\end_layout - -\begin_layout Itemize - -\series bold -\emph on -maximum -\series default -\emph default -: compute and output the maximum value, -\end_layout - -\begin_layout Itemize - -\series bold -\emph on -once -\series default -\emph default - : the data is written to the file only the first time it is received from - the model, any subsequent data is ignored. - The corresponding NetCDF variable does not have a time dimension. -\end_layout - -\begin_layout Standard -The output frequency of the file defined by the -\series bold -output_freq -\series default - attribute is used as the temporal operation period (except for the -\begin_inset Quotes eld -\end_inset - - -\series bold -\emph on -once -\series default -\emph default - -\begin_inset Quotes erd -\end_inset - - -\series bold -operation -\series default - for which there is no period). - This means it is for example not possible to output a daily average and - a weekly average in the same file. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -This updated example shows how to output the daily average instead of the - instant data for all timesteps: -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - -Compared to the previous example, only the file attribute -\series bold -output_freq -\series default - and the field attribute -\series bold -operation -\series default - have been modified. - Computing the weekly minimum instead of the daily average would be as simple - as using -\begin_inset Flex Code -status open - -\begin_layout Plain Layout -output_freq="7d" -\end_layout - -\end_inset - -and -\begin_inset Flex Code -status open - -\begin_layout Plain Layout -operation="minimum" -\end_layout - -\end_inset - -. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -Note that if you use a temporal operation and have -\series bold -default_value -\series default - defined, it might be useful to set the attribute -\series bold - detect_missing_value -\series default - to -\begin_inset Quotes eld -\end_inset - - -\series bold -\emph on -true -\series default -\emph default - -\begin_inset Quotes erd -\end_inset - -. - This way temporal operations will not be applied when a default value is - detected. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -For example, we consider the values of a 2x2 domain for three timesteps: -\begin_inset Formula -\[ -\begin{bmatrix}3 & -1\\ -7 & 1 -\end{bmatrix},\qquad\begin{bmatrix}5 & 6\\ --1 & 2 -\end{bmatrix},\qquad\begin{bmatrix}-1 & 8\\ -3 & 4 -\end{bmatrix}. -\] - -\end_inset - -If we suppose that the field is configured to compute the average on three - timesteps, the resulting field would be: -\begin_inset Formula -\[ -\begin{bmatrix}\nicefrac{7}{3} & \nicefrac{13}{3}\\ -3 & \nicefrac{7}{3} -\end{bmatrix}. -\] - -\end_inset - -If -\series bold -default_value -\series default - is set to -\emph on - -\begin_inset Quotes eld -\end_inset - --1 -\begin_inset Quotes erd -\end_inset - - -\emph default - and -\series bold -detect_missing_value -\series default - is set to -\begin_inset Quotes eld -\end_inset - - -\series bold -\emph on -true -\series default -\emph default - -\begin_inset Quotes erd -\end_inset - -, the resulting field would be: -\begin_inset Formula -\[ -\begin{bmatrix}4 & 7\\ -5 & \nicefrac{7}{3} -\end{bmatrix}. -\] - -\end_inset - - -\end_layout - -\begin_layout Section -How to use a specific data sampling -\end_layout - -\begin_layout Standard -It is sometimes useful to have more control on the data sampling. - By default, the input data is used at every timestep but sometimes it is - not what you want. - The following examples illustrate such cases: -\end_layout - -\begin_layout Enumerate -the model is not computing updated values at the same frequency for all - fields (for example, a field is updated every two timesteps). -\end_layout - -\begin_layout Enumerate -you want to output a specific instant value in the interval between two - outputs. -\end_layout - -\begin_layout Enumerate -you want to compute an average without taking into account all instant values - in the interval between two outputs. -\end_layout - -\begin_layout Standard -Data sampling can be controlled in XIOS using the -\series bold -freq_op -\series default - (one timestep by default) and -\series bold -freq_offset -\series default - (null by default) attributes. - Those attributes define respectively how often data from the model must - be used and the amount of time before starting to use it. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -For following excerpts of configuration files show you to use those attributes - to handle the motivating examples. -\end_layout - -\begin_layout Enumerate -In this example, we suppose that we get two fields from the model: -\begin_inset Quotes eld -\end_inset - -field_A -\begin_inset Quotes erd -\end_inset - - which is computed for each timestep and -\begin_inset Quotes eld -\end_inset - -field_B -\begin_inset Quotes erd -\end_inset - - which is only computed every two timesteps. - For both fields, we show how to compute and output the sum of all values - received during 6 timesteps: -\begin_inset Newline newline -\end_inset - - -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Enumerate -In this example, we show how to output the 11th instant value every 12 timesteps -: -\begin_inset Newline newline -\end_inset - - -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Enumerate -In this example, we suppose that the timestep is equal to one hour and that - the simulation starts at midnight. - We show how to compute the weekly average of the field value at midday: -\begin_inset Newline newline -\end_inset - - -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Section -How to use field references -\end_layout - -\begin_layout Standard -It is quite common that different temporal operations must be applied to - the same instant data provided by the model. - In theory, the only solution to handle this scenario would be to define - a field for each operation, give them different -\series bold -id -\series default - and and call -\begin_inset Flex Code -status open - -\begin_layout Plain Layout -xios_send_field -\end_layout - -\end_inset - - with the same array of data for each of those fields. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -The following example illustrates this solution for a field for which we - want to compute the average, minimal and maximal values: -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - -To simplify the handling of such scenarios, XIOS has a -\begin_inset Quotes eld -\end_inset - -reference -\begin_inset Quotes erd -\end_inset - - feature which allows one field to inherit the attributes (except the -\series bold -id -\series default -) and the instant data of another field. - The above example can then be rewritten: -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - -With this configuration, only one call to -\begin_inset Flex Code -status open - -\begin_layout Plain Layout -xios_send_field( -\begin_inset Quotes eld -\end_inset - -field_A -\begin_inset Quotes erd -\end_inset - -, field_A) -\end_layout - -\end_inset - - is needed. - Note how inherited attributes (like -\series bold -name -\series default - or -\series bold -operation -\series default - for example) are overwritten to obtain the desired configuration. - Additionally, be aware that it is the instant values which are inherited, - not the result of the operation on the field. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -Similarly, it is sometimes useful to output the result of a temporal operation - on a field for different periods. - In this case, it does not really make sense to define the field that will - be then inherited in one file rather than another. - A solution is to make use of the -\begin_inset Flex Code -status open - -\begin_layout Plain Layout -field_definition -\end_layout - -\end_inset - - section so that it is clear that the field can be reused in any file. - This is illustrated in the following sample configuration file: -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Section -How to use arithmetic operations -\end_layout - -\begin_layout Standard -Since XIOS aims to reduce as much as possible the need for post-processing, - it can apply some arithmetic operations on the data it handles (regardless - of its provenance). -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -All usual operators (+, -, *, /, ^, that is addition, subtraction, multiplicatio -n, division and exponentiation) and some common functions (like cos, sin, - tan, exp, log, log10, sqrt) are supported. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -The following example shows how to use arithmetic operations: -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - field_A + 273.15 -\end_layout - -\begin_layout Plain Layout - - log10(field_B) -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - -With this configuration, only one call to -\begin_inset Flex Code -status open - -\begin_layout Plain Layout -xios_send_field( -\begin_inset Quotes eld -\end_inset - -field_A -\begin_inset Quotes erd -\end_inset - -, field_A) -\end_layout - -\end_inset - - is needed. - In this example -\series bold -field_ref -\series default - is used only to inherit the attributes from -\begin_inset Quotes eld -\end_inset - -field_A -\begin_inset Quotes erd -\end_inset - -, the instant values are not inherited since an expression has been given - for -\begin_inset Quotes eld -\end_inset - -field_B -\begin_inset Quotes erd -\end_inset - - and -\begin_inset Quotes eld -\end_inset - -field_C -\begin_inset Quotes erd -\end_inset - -. - Note that it is possible to use fields obtained from an expression in another - expression, thus the expression of -\begin_inset Quotes eld -\end_inset - -field_C -\begin_inset Quotes erd -\end_inset - - is equivalent to -\begin_inset Flex Code -status open - -\begin_layout Plain Layout -log10(field_A + 273.15) -\end_layout - -\end_inset - -. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -The special keyword -\series bold -this -\series default - can be used in an expression to refer to the instant data received from - the model by the current field. - For example, the previous configuration file could be rewritten as follow: -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - this - + 273.15 -\end_layout - -\begin_layout Plain Layout - - log10(field_B) -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - -and the Fortran call would be replaced by -\begin_inset Flex Code -status open - -\begin_layout Plain Layout -xios_send_field( -\begin_inset Quotes eld -\end_inset - -field_B -\begin_inset Quotes erd -\end_inset - -, field_B) -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Standard -XIOS also provides the means to define an expression in a Fortran code via - the field attribute -\begin_inset Quotes eld -\end_inset - -expr -\begin_inset Quotes erd -\end_inset - -. - The example above can rewritten as -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -while the two expressions can be specified with the following calls: -\begin_inset Flex Code -status open - -\begin_layout Plain Layout -xios_set_field_attr( -\begin_inset Quotes eld -\end_inset - -field_B -\begin_inset Quotes erd -\end_inset - -, expr= -\begin_inset Quotes erd -\end_inset - -@this + 273.15 -\begin_inset Quotes erd -\end_inset - - -\end_layout - -\end_inset - - and -\begin_inset Flex Code -status open - -\begin_layout Plain Layout -xios_set_field_attr( -\begin_inset Quotes eld -\end_inset - -field_C -\begin_inset Quotes erd -\end_inset - -, expr= -\begin_inset Quotes erd -\end_inset - -log10(field_B) -\begin_inset Quotes erd -\end_inset - - -\end_layout - -\end_inset - -. - -\end_layout - -\begin_layout Section -How to chain multiple temporal operations -\end_layout - -\begin_layout Standard -By default, all field names appearing in an expression refer to the instant - data of those fields. - To refer to the result of a temporal operation, the field name must be - prefixed with -\begin_inset Quotes eld -\end_inset - -@ -\begin_inset Quotes erd -\end_inset - -. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -This feature allows to chain multiple temporal operations as illustrated - bellow: -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - @field_A -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - -This example shows how to compute the minimum on 7 days of the daily average - of -\begin_inset Quotes eld -\end_inset - -field_A -\begin_inset Quotes erd -\end_inset - -. - In this context, the -\series bold -freq_op -\series default - attribute defines the period of the temporal operation for all fields pointed - with the -\begin_inset Quotes eld -\end_inset - -@ -\begin_inset Quotes erd -\end_inset - - operator in the expression. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -Another use of this feature is to do arithmetic operations on the result - of temporal operations. - The following configuration file for example shows how to output the standard - deviation for a field on a one day period: -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - field_A * field_A -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - sqrt(@field_A_square - @field_A^2) -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - -Note that since an -\series bold -\emph on - -\begin_inset Quotes eld -\end_inset - -instant -\begin_inset Quotes erd -\end_inset - - -\series default - -\emph default -operation is used, -\series bold -freq_op -\series default - and -\series bold -output_freq -\series default - are identical in this scenario. -\end_layout - -\begin_layout Section -How to access the data of a field -\end_layout - -\begin_layout Standard -In order not to waste memory, the instant data of a field can be read from - the model only if: -\end_layout - -\begin_layout Itemize -it is part of a file whose attribute -\series bold -mode -\series default - is -\series bold -\emph on - -\begin_inset Quotes eld -\end_inset - -read -\begin_inset Quotes erd -\end_inset - - -\end_layout - -\begin_layout Itemize -or its attribute -\series bold -read_access -\series default - is set to -\series bold -\emph on - -\begin_inset Quotes eld -\end_inset - -true -\begin_inset Quotes erd -\end_inset - - -\series default -\emph default -. -\end_layout - -\begin_layout Standard -In any other case, trying to access the field data would cause an error. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -The following configuration file: -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - -can be used with this Fortran code: -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=Fortran,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - -DO ts=1,numberOfTimestep -\end_layout - -\begin_layout Plain Layout - - ! Get field_A for current timestep -\end_layout - -\begin_layout Plain Layout - - CALL xios_recv_field("field_A", field_A) ! field_A must be an allocated - array with the right size -\end_layout - -\begin_layout Plain Layout - - ! Do useful things... -\end_layout - -\begin_layout Plain Layout - - ! Inform XIOS of the current timestep -\end_layout - -\begin_layout Plain Layout - - CALL xios_update_calendar(ts) -\end_layout - -\begin_layout Plain Layout - -ENDDO -\end_layout - -\end_inset - -The call to -\begin_inset Flex Code -status open - -\begin_layout Plain Layout -xios_recv_field -\end_layout - -\end_inset - - might block for a while if the data was not yet received from the server(s) - but it should not happen too often thanks to the prefetching done by XIOS. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -Since the -\series bold -read_access -\series default - attribute allows to the access fields which depend directly on data from - the model, you must be very careful with the order of the -\begin_inset Flex Code -status open - -\begin_layout Plain Layout -xios_send_field -\end_layout - -\end_inset - - and -\begin_inset Flex Code -status open - -\begin_layout Plain Layout -xios_recv_field -\end_layout - -\end_inset - - calls. - For example, consider the following configuration file (just a simple example - as in practice it does not make much sense to use it): -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - field_A / 42 -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - -If you call -\begin_inset Flex Code -status open - -\begin_layout Plain Layout -xios_recv_field( -\begin_inset Quotes eld -\end_inset - -field_B -\begin_inset Quotes erd -\end_inset - -, field_B) -\end_layout - -\end_inset - - before -\begin_inset Flex Code -status open - -\begin_layout Plain Layout -xios_send_field( -\begin_inset Quotes eld -\end_inset - -field_A -\begin_inset Quotes erd -\end_inset - -, field_A) -\end_layout - -\end_inset - -, the requested data will never be available and a deadlock could occur. - In practice, XIOS will detect the problem and throw an error. -\end_layout - -\begin_layout Section -How to reduce the size of an output file -\end_layout - -\begin_layout Standard -The size of the output files can sometimes become a problem. - XIOS provides some features which may help to reduce the size of the output - files losslessly. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -The first solution is to use the compression feature provided by HDF5 which - allows a field to be compressed using gzip. - Since it depends directly on HDF5, this feature works only when the NetCDF-4 - format is used. - Since HDF5 does not (yet) support compression for parallel output, one - has to use two server-level functionality (see Sec. - -\begin_inset CommandInset ref -LatexCommand ref -reference "sec:Launching-secondary-server" - -\end_inset - -) or to engage the -\series bold -\emph on - -\begin_inset Quotes eld -\end_inset - -multiple_file -\begin_inset Quotes erd -\end_inset - - -\series default -\emph default - mode. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -To enable the gzip compression of a field, you need to set the -\series bold -compression_level -\series default - attribute to any integer between 1 and 9 (by default this attribute is - set to 0 which means that compression is disabled). - Using an higher compression level should improve the compression ratio - at the cost of using more processing power. - Generally using a compression level of 2 should be a good trade-off. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -The following example illustrates the use of the gzip compression: -\begin_inset listings -lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - -Note that the -\series bold -compression_level -\series default - attribute can also be set at a file level, in this case it is inherited - by all fields of the file unless they explicitly override the attribute. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -The second solution is available only if you are using a grid with masked - values. - In this case, you can choose to output the indexed grid instead of the - full grid by setting the -\series bold -indexed_output -\series default - attribute to -\series bold -\emph on - -\begin_inset Quotes eld -\end_inset - -true -\begin_inset Quotes erd -\end_inset - - -\series default -\emph default -. - Missing values are then omitted and extra arrays are outputted so that - the translation from the -\begin_inset Quotes eld -\end_inset - -compressed -\begin_inset Quotes erd -\end_inset - - indexes to the true indexes can be done. - Due to those arrays of indexes, indexed output should be considered only - if there is enough masked values. - For more details about this feature, please refer to section 8.2 -\begin_inset Quotes eld -\end_inset - -Compression by Gathering -\begin_inset Quotes erd -\end_inset - - of the Climate and Forecast (CF) Convention. -\end_layout - -\begin_layout Standard -\begin_inset CommandInset include -LatexCommand include -filename "inputs/user/Grid.lyx" - -\end_inset - - -\end_layout - -\begin_layout Standard -\begin_inset CommandInset include -LatexCommand include -filename "inputs/user/Domain.lyx" - -\end_inset - - -\end_layout - -\begin_layout Standard -\begin_inset CommandInset include -LatexCommand include -filename "inputs/user/Axis.lyx" - -\end_inset - - -\end_layout - -\begin_layout Chapter -XIOS parameterization -\end_layout - -\begin_layout Standard -Some of XIOS behaviors can be configured using options. - Those options must be exprhessed as variables in a specific context whose - -\series bold -id -\series default - must be -\series bold -\emph on - -\begin_inset Quotes eld -\end_inset - -xios -\begin_inset Quotes erd -\end_inset - - -\series default -\emph default - as shown below. -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "breaklines=true,frame=tb,language=XML,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}},tabsize=2" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - option_value -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Section -Launching secondary server -\begin_inset CommandInset label -LatexCommand label -name "sec:Launching-secondary-server" - -\end_inset - - -\end_layout - -\begin_layout Standard -To improve I/O performance, it is possible to separate servers into two - levels: intermediaries (level one) and writers (level two). - Level-one servers will receive data from clients and will redistribute - and send the data to subsets of level-two servers (called “poolsâ€), whilst - level-two servers will do the I/O. - Each file is written by only one pool. - If one process is assigned per pool (which is the default option), the - I/O is sequential and HDF5 compression can be used even in the “multiple_file†- mode. - Level-two servers can be launched and controlled by means of three parameters: -\end_layout - -\begin_layout Itemize - -\series bold -using_server2 -\series default - (type: -\series bold -bool -\series default -) activates the secondary server -\end_layout - -\begin_layout Itemize - -\series bold -ratio_server2 -\series default - (type: -\series bold -int -\series default -) defines the percentage of servers that will be dedicated to level two. - The parameter can take value from 0 to 100 with the default value of 50%. - In case if the requested number of level-two servers is not valid (for - example, zero or equal to the total number of servers), XIOS will run in - its classical server mode with one server level. -\end_layout - -\begin_layout Itemize - -\series bold -number_pools_server2 -\series default -(type: -\series bold -int -\series default -) sets the number of server-two pools (i.e. - MPI communicators on level two). - By default the number of pools is equal to the number of level-two servers, - thus permitting one process per communicator. -\end_layout - -\begin_layout Standard -Shown in Fig. - -\begin_inset CommandInset ref -LatexCommand ref -reference "Fig:server2" - -\end_inset - - is the two-level server structure for the following definitions: -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "breaklines=true,frame=tb,language=XML,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}},tabsize=2" -inline false -status open - -\begin_layout Plain Layout - - -\end_layout - -\begin_layout Plain Layout - -... - -\end_layout - -\begin_layout Plain Layout - - true -\end_layout - -\begin_layout Plain Layout - - 75 -\end_layout - -\begin_layout Plain Layout - - 3 -\end_layout - -\begin_layout Plain Layout - -... -\end_layout - -\begin_layout Plain Layout - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -\begin_inset Float figure -placement H -wide false -sideways false -status open - -\begin_layout Plain Layout -\begin_inset Graphics - filename inputs/images/Server2.pdf - -\end_inset - - -\end_layout - -\begin_layout Plain Layout -\begin_inset Caption Standard - -\begin_layout Plain Layout -Two levels of servers for the total number of servers of 8 and ratio_server2=75%. - The number of level-two servers is -\begin_inset Formula $8\times\text{ratio\_server2}=6$ -\end_inset - - and, thus, the remaining 2 servers are of level one. - -\end_layout - -\end_inset - - -\begin_inset CommandInset label -LatexCommand label -name "Fig:server2" - -\end_inset - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -By default file distribution among server-two pools is optimized for bandwidth. - An alternative way of distributing files is possible in order to minimize - memory consumption by level-two servers. - For this, two additional parameters should be specified: -\end_layout - -\begin_layout Itemize - -\series bold -server2_dist_file_memory -\series default - (type: -\series bold -bool -\series default -) activates memory optimization. -\end_layout - -\begin_layout Itemize - -\series bold -server2_dist_file_memory_ratio -\series default - (type: -\series bold -double -\series default -) (optional) takes value from 0 (memory optimization) to 1 (bandwidth optimizati -on). - The default value is 0.5. -\end_layout - -\begin_layout Section -Buffer related options -\end_layout - -\begin_layout Standard -By default, XIOS tries to guess the required buffers sizes to ensure efficient - client-server communications. - However it might sometimes be useful to tweak the buffers sizes so XIOS - provides the following options: -\end_layout - -\begin_layout Itemize - -\series bold -optimal_buffer_size -\series default - (type: -\series bold -string -\series default -) can be either -\series bold -\emph on - -\begin_inset Quotes eld -\end_inset - -memory -\begin_inset Quotes erd -\end_inset - - -\series default -\emph default - or -\series bold -\emph on - -\begin_inset Quotes erd -\end_inset - -performance -\begin_inset Quotes erd -\end_inset - - -\series default -\emph default -. - When using the -\series bold -\emph on - -\begin_inset Quotes eld -\end_inset - -memory -\begin_inset Quotes erd -\end_inset - - -\series default -\emph default - mode, XIOS will try to use buffers as small as possible while still ensuring - that the bigger message will fit. - When using the -\series bold -\emph on - -\begin_inset Quotes erd -\end_inset - -performance -\begin_inset Quotes erd -\end_inset - - -\series default -\emph default - mode, XIOS will ensure that all active fields can be buffered without having - to flush the buffers. - This mode is used by default since it allows more asynchronism and thus - better performance at the cost of being quite memory hungry. -\end_layout - -\begin_layout Itemize - -\series bold -minimum_buffer_size -\series default - (type: -\series bold -int -\series default -) defines the minimum buffer size in bytes (8192 by default). - This value will be used by XIOS only for buffers whose detected size is - smaller than the user defined minimum size. -\end_layout - -\begin_layout Itemize - -\series bold -buffer_size_factor -\series default -(type: -\series bold -int -\series default -) allows to modify the buffers sizes by multiplying the detected sizes by - an user defined factor ( -\begin_inset Formula $1.0$ -\end_inset - - by default). - For each allocated buffers, the used size is defined as -\begin_inset Formula -\[ -{\scriptstyle used\_size\;=\;\min\left(minimum\_buffer\_size,\;detected\_size\;\times\;buffer\_size\_factor\right)} -\] - -\end_inset - - -\end_layout - -\end_body -\end_document diff --git a/xios_2311_src/trunk/.svn/pristine/52/5282457059bf05aa1e0b5a4cd4cf09d16a6b34e7.svn-base b/xios_2311_src/trunk/.svn/pristine/52/5282457059bf05aa1e0b5a4cd4cf09d16a6b34e7.svn-base deleted file mode 100644 index 1ad6886bd636e278395dadea6d033a7026d2d8cb..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/52/5282457059bf05aa1e0b5a4cd4cf09d16a6b34e7.svn-base +++ /dev/null @@ -1,50 +0,0 @@ -MODULE FIELD_INTERFACE - USE, INTRINSIC :: ISO_C_BINDING - - INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99 - - SUBROUTINE cxios_field_handle_create(ret, idt, idt_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_field_handle_create - - SUBROUTINE cxios_field_valid_id(ret, idt, idt_size) BIND(C) - USE ISO_C_BINDING - LOGICAL (kind = C_BOOL) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_field_valid_id - - SUBROUTINE cxios_field_is_active(field_hdl, at_current_timestep, ret) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - LOGICAL (kind = C_BOOL), VALUE :: at_current_timestep - LOGICAL (kind = C_BOOL) :: ret - END SUBROUTINE cxios_field_is_active - - SUBROUTINE cxios_field_get_domain_handle(ret, field_hdl, idx) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T) :: ret - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - INTEGER (kind = C_INT) , VALUE :: idx - END SUBROUTINE cxios_field_get_domain_handle - - SUBROUTINE cxios_field_get_axis_handle(ret, field_hdl, idx) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T) :: ret - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - INTEGER (kind = C_INT) , VALUE :: idx - END SUBROUTINE cxios_field_get_axis_handle - - SUBROUTINE cxios_field_get_scalar_handle(ret, field_hdl, idx) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T) :: ret - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - INTEGER (kind = C_INT) , VALUE :: idx - END SUBROUTINE cxios_field_get_scalar_handle - - END INTERFACE - -END MODULE FIELD_INTERFACE diff --git a/xios_2311_src/trunk/.svn/pristine/52/5285d5264ac8afb0e0314666b0b4481bd650a6d9.svn-base b/xios_2311_src/trunk/.svn/pristine/52/5285d5264ac8afb0e0314666b0b4481bd650a6d9.svn-base deleted file mode 100644 index beb8beda276989ed24f6dff9502b6dd5409fe37d..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/52/5285d5264ac8afb0e0314666b0b4481bd650a6d9.svn-base +++ /dev/null @@ -1,555 +0,0 @@ -! * ************************************************************************** * -! * Interface auto generated - do not modify * -! * ************************************************************************** * -#include "xios_fortran_prefix.hpp" - -MODULE iscalargroup_attr - USE, INTRINSIC :: ISO_C_BINDING - USE iscalar - USE scalargroup_interface_attr - -CONTAINS - - SUBROUTINE xios(set_scalargroup_attr) & - ( scalargroup_id, axis_type, bounds, bounds_name, comment, group_ref, label, long_name, mask & - , name, positive, prec, scalar_ref, standard_name, unit, value ) - - IMPLICIT NONE - TYPE(txios(scalargroup)) :: scalargroup_hdl - CHARACTER(LEN=*), INTENT(IN) ::scalargroup_id - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: axis_type - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: bounds(:) - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: bounds_name - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: comment - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: group_ref - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: label - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: long_name - LOGICAL , OPTIONAL, INTENT(IN) :: mask - LOGICAL (KIND=C_BOOL) :: mask_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: positive - INTEGER , OPTIONAL, INTENT(IN) :: prec - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: scalar_ref - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: standard_name - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: unit - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: value - - CALL xios(get_scalargroup_handle) & - (scalargroup_id,scalargroup_hdl) - CALL xios(set_scalargroup_attr_hdl_) & - ( scalargroup_hdl, axis_type, bounds, bounds_name, comment, group_ref, label, long_name, mask & - , name, positive, prec, scalar_ref, standard_name, unit, value ) - - END SUBROUTINE xios(set_scalargroup_attr) - - SUBROUTINE xios(set_scalargroup_attr_hdl) & - ( scalargroup_hdl, axis_type, bounds, bounds_name, comment, group_ref, label, long_name, mask & - , name, positive, prec, scalar_ref, standard_name, unit, value ) - - IMPLICIT NONE - TYPE(txios(scalargroup)) , INTENT(IN) :: scalargroup_hdl - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: axis_type - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: bounds(:) - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: bounds_name - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: comment - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: group_ref - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: label - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: long_name - LOGICAL , OPTIONAL, INTENT(IN) :: mask - LOGICAL (KIND=C_BOOL) :: mask_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: positive - INTEGER , OPTIONAL, INTENT(IN) :: prec - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: scalar_ref - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: standard_name - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: unit - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: value - - CALL xios(set_scalargroup_attr_hdl_) & - ( scalargroup_hdl, axis_type, bounds, bounds_name, comment, group_ref, label, long_name, mask & - , name, positive, prec, scalar_ref, standard_name, unit, value ) - - END SUBROUTINE xios(set_scalargroup_attr_hdl) - - SUBROUTINE xios(set_scalargroup_attr_hdl_) & - ( scalargroup_hdl, axis_type_, bounds_, bounds_name_, comment_, group_ref_, label_, long_name_ & - , mask_, name_, positive_, prec_, scalar_ref_, standard_name_, unit_, value_ ) - - IMPLICIT NONE - TYPE(txios(scalargroup)) , INTENT(IN) :: scalargroup_hdl - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: axis_type_ - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: bounds_(:) - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: bounds_name_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: comment_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: group_ref_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: label_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: long_name_ - LOGICAL , OPTIONAL, INTENT(IN) :: mask_ - LOGICAL (KIND=C_BOOL) :: mask__tmp - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: positive_ - INTEGER , OPTIONAL, INTENT(IN) :: prec_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: scalar_ref_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: standard_name_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: unit_ - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: value_ - - IF (PRESENT(axis_type_)) THEN - CALL cxios_set_scalargroup_axis_type & - (scalargroup_hdl%daddr, axis_type_, len(axis_type_)) - ENDIF - - IF (PRESENT(bounds_)) THEN - CALL cxios_set_scalargroup_bounds & - (scalargroup_hdl%daddr, bounds_, SHAPE(bounds_)) - ENDIF - - IF (PRESENT(bounds_name_)) THEN - CALL cxios_set_scalargroup_bounds_name & - (scalargroup_hdl%daddr, bounds_name_, len(bounds_name_)) - ENDIF - - IF (PRESENT(comment_)) THEN - CALL cxios_set_scalargroup_comment & - (scalargroup_hdl%daddr, comment_, len(comment_)) - ENDIF - - IF (PRESENT(group_ref_)) THEN - CALL cxios_set_scalargroup_group_ref & - (scalargroup_hdl%daddr, group_ref_, len(group_ref_)) - ENDIF - - IF (PRESENT(label_)) THEN - CALL cxios_set_scalargroup_label & - (scalargroup_hdl%daddr, label_, len(label_)) - ENDIF - - IF (PRESENT(long_name_)) THEN - CALL cxios_set_scalargroup_long_name & - (scalargroup_hdl%daddr, long_name_, len(long_name_)) - ENDIF - - IF (PRESENT(mask_)) THEN - mask__tmp = mask_ - CALL cxios_set_scalargroup_mask & - (scalargroup_hdl%daddr, mask__tmp) - ENDIF - - IF (PRESENT(name_)) THEN - CALL cxios_set_scalargroup_name & - (scalargroup_hdl%daddr, name_, len(name_)) - ENDIF - - IF (PRESENT(positive_)) THEN - CALL cxios_set_scalargroup_positive & - (scalargroup_hdl%daddr, positive_, len(positive_)) - ENDIF - - IF (PRESENT(prec_)) THEN - CALL cxios_set_scalargroup_prec & - (scalargroup_hdl%daddr, prec_) - ENDIF - - IF (PRESENT(scalar_ref_)) THEN - CALL cxios_set_scalargroup_scalar_ref & - (scalargroup_hdl%daddr, scalar_ref_, len(scalar_ref_)) - ENDIF - - IF (PRESENT(standard_name_)) THEN - CALL cxios_set_scalargroup_standard_name & - (scalargroup_hdl%daddr, standard_name_, len(standard_name_)) - ENDIF - - IF (PRESENT(unit_)) THEN - CALL cxios_set_scalargroup_unit & - (scalargroup_hdl%daddr, unit_, len(unit_)) - ENDIF - - IF (PRESENT(value_)) THEN - CALL cxios_set_scalargroup_value & - (scalargroup_hdl%daddr, value_) - ENDIF - - END SUBROUTINE xios(set_scalargroup_attr_hdl_) - - SUBROUTINE xios(get_scalargroup_attr) & - ( scalargroup_id, axis_type, bounds, bounds_name, comment, group_ref, label, long_name, mask & - , name, positive, prec, scalar_ref, standard_name, unit, value ) - - IMPLICIT NONE - TYPE(txios(scalargroup)) :: scalargroup_hdl - CHARACTER(LEN=*), INTENT(IN) ::scalargroup_id - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: axis_type - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: bounds(:) - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: bounds_name - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: comment - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: group_ref - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: label - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: long_name - LOGICAL , OPTIONAL, INTENT(OUT) :: mask - LOGICAL (KIND=C_BOOL) :: mask_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: positive - INTEGER , OPTIONAL, INTENT(OUT) :: prec - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: scalar_ref - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: standard_name - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: unit - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: value - - CALL xios(get_scalargroup_handle) & - (scalargroup_id,scalargroup_hdl) - CALL xios(get_scalargroup_attr_hdl_) & - ( scalargroup_hdl, axis_type, bounds, bounds_name, comment, group_ref, label, long_name, mask & - , name, positive, prec, scalar_ref, standard_name, unit, value ) - - END SUBROUTINE xios(get_scalargroup_attr) - - SUBROUTINE xios(get_scalargroup_attr_hdl) & - ( scalargroup_hdl, axis_type, bounds, bounds_name, comment, group_ref, label, long_name, mask & - , name, positive, prec, scalar_ref, standard_name, unit, value ) - - IMPLICIT NONE - TYPE(txios(scalargroup)) , INTENT(IN) :: scalargroup_hdl - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: axis_type - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: bounds(:) - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: bounds_name - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: comment - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: group_ref - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: label - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: long_name - LOGICAL , OPTIONAL, INTENT(OUT) :: mask - LOGICAL (KIND=C_BOOL) :: mask_tmp - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: positive - INTEGER , OPTIONAL, INTENT(OUT) :: prec - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: scalar_ref - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: standard_name - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: unit - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: value - - CALL xios(get_scalargroup_attr_hdl_) & - ( scalargroup_hdl, axis_type, bounds, bounds_name, comment, group_ref, label, long_name, mask & - , name, positive, prec, scalar_ref, standard_name, unit, value ) - - END SUBROUTINE xios(get_scalargroup_attr_hdl) - - SUBROUTINE xios(get_scalargroup_attr_hdl_) & - ( scalargroup_hdl, axis_type_, bounds_, bounds_name_, comment_, group_ref_, label_, long_name_ & - , mask_, name_, positive_, prec_, scalar_ref_, standard_name_, unit_, value_ ) - - IMPLICIT NONE - TYPE(txios(scalargroup)) , INTENT(IN) :: scalargroup_hdl - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: axis_type_ - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: bounds_(:) - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: bounds_name_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: comment_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: group_ref_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: label_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: long_name_ - LOGICAL , OPTIONAL, INTENT(OUT) :: mask_ - LOGICAL (KIND=C_BOOL) :: mask__tmp - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: positive_ - INTEGER , OPTIONAL, INTENT(OUT) :: prec_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: scalar_ref_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: standard_name_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: unit_ - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: value_ - - IF (PRESENT(axis_type_)) THEN - CALL cxios_get_scalargroup_axis_type & - (scalargroup_hdl%daddr, axis_type_, len(axis_type_)) - ENDIF - - IF (PRESENT(bounds_)) THEN - CALL cxios_get_scalargroup_bounds & - (scalargroup_hdl%daddr, bounds_, SHAPE(bounds_)) - ENDIF - - IF (PRESENT(bounds_name_)) THEN - CALL cxios_get_scalargroup_bounds_name & - (scalargroup_hdl%daddr, bounds_name_, len(bounds_name_)) - ENDIF - - IF (PRESENT(comment_)) THEN - CALL cxios_get_scalargroup_comment & - (scalargroup_hdl%daddr, comment_, len(comment_)) - ENDIF - - IF (PRESENT(group_ref_)) THEN - CALL cxios_get_scalargroup_group_ref & - (scalargroup_hdl%daddr, group_ref_, len(group_ref_)) - ENDIF - - IF (PRESENT(label_)) THEN - CALL cxios_get_scalargroup_label & - (scalargroup_hdl%daddr, label_, len(label_)) - ENDIF - - IF (PRESENT(long_name_)) THEN - CALL cxios_get_scalargroup_long_name & - (scalargroup_hdl%daddr, long_name_, len(long_name_)) - ENDIF - - IF (PRESENT(mask_)) THEN - CALL cxios_get_scalargroup_mask & - (scalargroup_hdl%daddr, mask__tmp) - mask_ = mask__tmp - ENDIF - - IF (PRESENT(name_)) THEN - CALL cxios_get_scalargroup_name & - (scalargroup_hdl%daddr, name_, len(name_)) - ENDIF - - IF (PRESENT(positive_)) THEN - CALL cxios_get_scalargroup_positive & - (scalargroup_hdl%daddr, positive_, len(positive_)) - ENDIF - - IF (PRESENT(prec_)) THEN - CALL cxios_get_scalargroup_prec & - (scalargroup_hdl%daddr, prec_) - ENDIF - - IF (PRESENT(scalar_ref_)) THEN - CALL cxios_get_scalargroup_scalar_ref & - (scalargroup_hdl%daddr, scalar_ref_, len(scalar_ref_)) - ENDIF - - IF (PRESENT(standard_name_)) THEN - CALL cxios_get_scalargroup_standard_name & - (scalargroup_hdl%daddr, standard_name_, len(standard_name_)) - ENDIF - - IF (PRESENT(unit_)) THEN - CALL cxios_get_scalargroup_unit & - (scalargroup_hdl%daddr, unit_, len(unit_)) - ENDIF - - IF (PRESENT(value_)) THEN - CALL cxios_get_scalargroup_value & - (scalargroup_hdl%daddr, value_) - ENDIF - - END SUBROUTINE xios(get_scalargroup_attr_hdl_) - - SUBROUTINE xios(is_defined_scalargroup_attr) & - ( scalargroup_id, axis_type, bounds, bounds_name, comment, group_ref, label, long_name, mask & - , name, positive, prec, scalar_ref, standard_name, unit, value ) - - IMPLICIT NONE - TYPE(txios(scalargroup)) :: scalargroup_hdl - CHARACTER(LEN=*), INTENT(IN) ::scalargroup_id - LOGICAL, OPTIONAL, INTENT(OUT) :: axis_type - LOGICAL(KIND=C_BOOL) :: axis_type_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: bounds - LOGICAL(KIND=C_BOOL) :: bounds_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: bounds_name - LOGICAL(KIND=C_BOOL) :: bounds_name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: comment - LOGICAL(KIND=C_BOOL) :: comment_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: group_ref - LOGICAL(KIND=C_BOOL) :: group_ref_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: label - LOGICAL(KIND=C_BOOL) :: label_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: long_name - LOGICAL(KIND=C_BOOL) :: long_name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: mask - LOGICAL(KIND=C_BOOL) :: mask_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: name - LOGICAL(KIND=C_BOOL) :: name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: positive - LOGICAL(KIND=C_BOOL) :: positive_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: prec - LOGICAL(KIND=C_BOOL) :: prec_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: scalar_ref - LOGICAL(KIND=C_BOOL) :: scalar_ref_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: standard_name - LOGICAL(KIND=C_BOOL) :: standard_name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: unit - LOGICAL(KIND=C_BOOL) :: unit_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: value - LOGICAL(KIND=C_BOOL) :: value_tmp - - CALL xios(get_scalargroup_handle) & - (scalargroup_id,scalargroup_hdl) - CALL xios(is_defined_scalargroup_attr_hdl_) & - ( scalargroup_hdl, axis_type, bounds, bounds_name, comment, group_ref, label, long_name, mask & - , name, positive, prec, scalar_ref, standard_name, unit, value ) - - END SUBROUTINE xios(is_defined_scalargroup_attr) - - SUBROUTINE xios(is_defined_scalargroup_attr_hdl) & - ( scalargroup_hdl, axis_type, bounds, bounds_name, comment, group_ref, label, long_name, mask & - , name, positive, prec, scalar_ref, standard_name, unit, value ) - - IMPLICIT NONE - TYPE(txios(scalargroup)) , INTENT(IN) :: scalargroup_hdl - LOGICAL, OPTIONAL, INTENT(OUT) :: axis_type - LOGICAL(KIND=C_BOOL) :: axis_type_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: bounds - LOGICAL(KIND=C_BOOL) :: bounds_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: bounds_name - LOGICAL(KIND=C_BOOL) :: bounds_name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: comment - LOGICAL(KIND=C_BOOL) :: comment_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: group_ref - LOGICAL(KIND=C_BOOL) :: group_ref_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: label - LOGICAL(KIND=C_BOOL) :: label_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: long_name - LOGICAL(KIND=C_BOOL) :: long_name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: mask - LOGICAL(KIND=C_BOOL) :: mask_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: name - LOGICAL(KIND=C_BOOL) :: name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: positive - LOGICAL(KIND=C_BOOL) :: positive_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: prec - LOGICAL(KIND=C_BOOL) :: prec_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: scalar_ref - LOGICAL(KIND=C_BOOL) :: scalar_ref_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: standard_name - LOGICAL(KIND=C_BOOL) :: standard_name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: unit - LOGICAL(KIND=C_BOOL) :: unit_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: value - LOGICAL(KIND=C_BOOL) :: value_tmp - - CALL xios(is_defined_scalargroup_attr_hdl_) & - ( scalargroup_hdl, axis_type, bounds, bounds_name, comment, group_ref, label, long_name, mask & - , name, positive, prec, scalar_ref, standard_name, unit, value ) - - END SUBROUTINE xios(is_defined_scalargroup_attr_hdl) - - SUBROUTINE xios(is_defined_scalargroup_attr_hdl_) & - ( scalargroup_hdl, axis_type_, bounds_, bounds_name_, comment_, group_ref_, label_, long_name_ & - , mask_, name_, positive_, prec_, scalar_ref_, standard_name_, unit_, value_ ) - - IMPLICIT NONE - TYPE(txios(scalargroup)) , INTENT(IN) :: scalargroup_hdl - LOGICAL, OPTIONAL, INTENT(OUT) :: axis_type_ - LOGICAL(KIND=C_BOOL) :: axis_type__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: bounds_ - LOGICAL(KIND=C_BOOL) :: bounds__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: bounds_name_ - LOGICAL(KIND=C_BOOL) :: bounds_name__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: comment_ - LOGICAL(KIND=C_BOOL) :: comment__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: group_ref_ - LOGICAL(KIND=C_BOOL) :: group_ref__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: label_ - LOGICAL(KIND=C_BOOL) :: label__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: long_name_ - LOGICAL(KIND=C_BOOL) :: long_name__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: mask_ - LOGICAL(KIND=C_BOOL) :: mask__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: name_ - LOGICAL(KIND=C_BOOL) :: name__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: positive_ - LOGICAL(KIND=C_BOOL) :: positive__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: prec_ - LOGICAL(KIND=C_BOOL) :: prec__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: scalar_ref_ - LOGICAL(KIND=C_BOOL) :: scalar_ref__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: standard_name_ - LOGICAL(KIND=C_BOOL) :: standard_name__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: unit_ - LOGICAL(KIND=C_BOOL) :: unit__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: value_ - LOGICAL(KIND=C_BOOL) :: value__tmp - - IF (PRESENT(axis_type_)) THEN - axis_type__tmp = cxios_is_defined_scalargroup_axis_type & - (scalargroup_hdl%daddr) - axis_type_ = axis_type__tmp - ENDIF - - IF (PRESENT(bounds_)) THEN - bounds__tmp = cxios_is_defined_scalargroup_bounds & - (scalargroup_hdl%daddr) - bounds_ = bounds__tmp - ENDIF - - IF (PRESENT(bounds_name_)) THEN - bounds_name__tmp = cxios_is_defined_scalargroup_bounds_name & - (scalargroup_hdl%daddr) - bounds_name_ = bounds_name__tmp - ENDIF - - IF (PRESENT(comment_)) THEN - comment__tmp = cxios_is_defined_scalargroup_comment & - (scalargroup_hdl%daddr) - comment_ = comment__tmp - ENDIF - - IF (PRESENT(group_ref_)) THEN - group_ref__tmp = cxios_is_defined_scalargroup_group_ref & - (scalargroup_hdl%daddr) - group_ref_ = group_ref__tmp - ENDIF - - IF (PRESENT(label_)) THEN - label__tmp = cxios_is_defined_scalargroup_label & - (scalargroup_hdl%daddr) - label_ = label__tmp - ENDIF - - IF (PRESENT(long_name_)) THEN - long_name__tmp = cxios_is_defined_scalargroup_long_name & - (scalargroup_hdl%daddr) - long_name_ = long_name__tmp - ENDIF - - IF (PRESENT(mask_)) THEN - mask__tmp = cxios_is_defined_scalargroup_mask & - (scalargroup_hdl%daddr) - mask_ = mask__tmp - ENDIF - - IF (PRESENT(name_)) THEN - name__tmp = cxios_is_defined_scalargroup_name & - (scalargroup_hdl%daddr) - name_ = name__tmp - ENDIF - - IF (PRESENT(positive_)) THEN - positive__tmp = cxios_is_defined_scalargroup_positive & - (scalargroup_hdl%daddr) - positive_ = positive__tmp - ENDIF - - IF (PRESENT(prec_)) THEN - prec__tmp = cxios_is_defined_scalargroup_prec & - (scalargroup_hdl%daddr) - prec_ = prec__tmp - ENDIF - - IF (PRESENT(scalar_ref_)) THEN - scalar_ref__tmp = cxios_is_defined_scalargroup_scalar_ref & - (scalargroup_hdl%daddr) - scalar_ref_ = scalar_ref__tmp - ENDIF - - IF (PRESENT(standard_name_)) THEN - standard_name__tmp = cxios_is_defined_scalargroup_standard_name & - (scalargroup_hdl%daddr) - standard_name_ = standard_name__tmp - ENDIF - - IF (PRESENT(unit_)) THEN - unit__tmp = cxios_is_defined_scalargroup_unit & - (scalargroup_hdl%daddr) - unit_ = unit__tmp - ENDIF - - IF (PRESENT(value_)) THEN - value__tmp = cxios_is_defined_scalargroup_value & - (scalargroup_hdl%daddr) - value_ = value__tmp - ENDIF - - END SUBROUTINE xios(is_defined_scalargroup_attr_hdl_) - -END MODULE iscalargroup_attr diff --git a/xios_2311_src/trunk/.svn/pristine/52/52e62af100fc1dc12a9286748c75d6407055be01.svn-base b/xios_2311_src/trunk/.svn/pristine/52/52e62af100fc1dc12a9286748c75d6407055be01.svn-base deleted file mode 100644 index 160db423d4f94486d2391ec3cb9aea674eb8940b..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/52/52e62af100fc1dc12a9286748c75d6407055be01.svn-base +++ /dev/null @@ -1,122 +0,0 @@ -/********************************************************************* - * Copyright 1993, UCAR/Unidata - * See netcdf/COPYRIGHT file for copying and redistribution conditions. - *********************************************************************/ -/* $Header$ */ - -#ifndef DCECONSTRAINTS_H -#define DCECONSTRAINTS_H 1 - -#include "ceconstraints.h" - -/* Provide a universal cast type containing common fields */ - -/* Define the common "supertype */ -typedef struct DCEnode { - CEsort sort; -} DCEnode; - -/* The slice structure is assumed common to all uses */ -typedef struct DCEslice { - DCEnode node; - size_t first; - size_t count; - size_t length; /* count*stride */ - size_t stride; - size_t stop; /* == first + count*/ - size_t declsize; /* from defining dimension, if any.*/ -} DCEslice; - -typedef struct DCEsegment { - DCEnode node; - char* name; - int slicesdefined; /*1=>slice counts defined, except declsize*/ - int slicesdeclized; /*1=>slice declsize defined */ - size_t rank; - DCEslice slices[NC_MAX_VAR_DIMS]; - void* annotation; -} DCEsegment; - -typedef struct DCEfcn { - DCEnode node; - char* name; - NClist* args; -} DCEfcn; - -typedef struct DCEvar { - DCEnode node; - NClist* segments; - void* annotation; -} DCEvar; - -typedef struct DCEconstant { - DCEnode node; - CEsort discrim; - char* text; - long long intvalue; - double floatvalue; -} DCEconstant; - -typedef struct DCEvalue { - DCEnode node; - CEsort discrim; - /* Do not bother with a union */ - DCEconstant* constant; - DCEvar* var; - DCEfcn* fcn; -} DCEvalue; - -typedef struct DCEselection { - DCEnode node; - CEsort operator; - DCEvalue* lhs; - NClist* rhs; -} DCEselection; - -typedef struct DCEprojection { - DCEnode node; - CEsort discrim; - /* Do not bother with a union */ - DCEvar* var; - DCEfcn* fcn; -} DCEprojection; - -typedef struct DCEconstraint { - DCEnode node; - NClist* projections; - NClist* selections; -} DCEconstraint; - - -extern int dceparseconstraints(char* constraints, DCEconstraint* DCEonstraint); -extern int dceslicemerge(DCEslice* dst, DCEslice* src); -extern int dcemergeprojectionlists(NClist* dst, NClist* src); - -extern DCEnode* dceclone(DCEnode* node); -extern NClist* dceclonelist(NClist* list); - -extern void dcefree(DCEnode* node); -extern void dcefreelist(NClist* list); - -extern char* dcetostring(DCEnode* node); -extern char* dcelisttostring(NClist* list,char*); -extern void dcetobuffer(DCEnode* node, NCbytes* buf); -extern void dcelisttobuffer(NClist* list, NCbytes* buf,char*); - -extern NClist* dceallnodes(DCEnode* node, CEsort which); - -extern DCEnode* dcecreate(CEsort sort); - -extern void dcemakewholeslice(DCEslice* slice, size_t declsize); -extern void dcemakewholeprojection(DCEprojection*); - -extern int dceiswholesegment(DCEsegment*); -extern int dceiswholeslice(DCEslice*); -extern int dceiswholeseglist(NClist*); -extern int dceiswholeprojection(DCEprojection*); -extern int dcesamepath(NClist* list1, NClist* list2); -extern int dcemergeprojections(DCEprojection* dst, DCEprojection* src); - -extern int dceverbose; - -#endif /*DCECONSTRAINTS_H*/ diff --git a/xios_2311_src/trunk/.svn/pristine/53/5315f5d0de94412efb4f38120e11dc0b6e83cc60.svn-base b/xios_2311_src/trunk/.svn/pristine/53/5315f5d0de94412efb4f38120e11dc0b6e83cc60.svn-base deleted file mode 100644 index c99e00a414dd06610decd186a9af01021e10f544..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/53/5315f5d0de94412efb4f38120e11dc0b6e83cc60.svn-base +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef __BUFFER_CS_BASE_HPP__ -#define __BUFFER_CS_BASE_HPP__ - -namespace xios -{ - class CBufferClientServerBase - { - protected: - - static const int headerSize_= 4*sizeof(size_t); - static const int timeLineOffset_ = 0 ; // in size_t - static const int countOffset_ = 1 ; // in size_t - static const int controlOffset_ = 2 ; // in size_t - static const int notifyOffset_ = 3 ; // in size_t - - static const int notifyNothing_ = 0 ; - static const int notifyFinalize_ = 1 ; - static const int notifyResizeBuffer_ = 2 ; - - } ; - -} - -#endif \ No newline at end of file diff --git a/xios_2311_src/trunk/.svn/pristine/53/533d863ebec7433bbbdece20097345824ce3d3b7.svn-base b/xios_2311_src/trunk/.svn/pristine/53/533d863ebec7433bbbdece20097345824ce3d3b7.svn-base deleted file mode 100644 index ec654fe9c0795a7d2342c07301f7f0bdc4b06b55..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/53/533d863ebec7433bbbdece20097345824ce3d3b7.svn-base +++ /dev/null @@ -1,7 +0,0 @@ -#all - -atm_output_domain_dynamico.nc -atm_output_domain_transformation_interpolate.nc -atm_output_domain_transformation_reorder.nc -atm_output_domain_transformation_extract.nc - diff --git a/xios_2311_src/trunk/.svn/pristine/53/53de6f0b9796f5bc1dfdf80d490c908b1c425be3.svn-base b/xios_2311_src/trunk/.svn/pristine/53/53de6f0b9796f5bc1dfdf80d490c908b1c425be3.svn-base deleted file mode 100644 index 1f34b94660eb18b8b163bba6d2a5abd224d27fb0..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/53/53de6f0b9796f5bc1dfdf80d490c908b1c425be3.svn-base +++ /dev/null @@ -1,678 +0,0 @@ -! * ************************************************************************** * -! * Interface auto generated - do not modify * -! * ************************************************************************** * -#include "../fortran/xios_fortran_prefix.hpp" - -MODULE fieldgroup_interface_attr - USE, INTRINSIC :: ISO_C_BINDING - - INTERFACE - ! Do not call directly / interface FORTRAN 2003 <-> C99 - - SUBROUTINE cxios_set_fieldgroup_add_offset(fieldgroup_hdl, add_offset) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - REAL (KIND=C_DOUBLE) , VALUE :: add_offset - END SUBROUTINE cxios_set_fieldgroup_add_offset - - SUBROUTINE cxios_get_fieldgroup_add_offset(fieldgroup_hdl, add_offset) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - REAL (KIND=C_DOUBLE) :: add_offset - END SUBROUTINE cxios_get_fieldgroup_add_offset - - FUNCTION cxios_is_defined_fieldgroup_add_offset(fieldgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_fieldgroup_add_offset - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - END FUNCTION cxios_is_defined_fieldgroup_add_offset - - - SUBROUTINE cxios_set_fieldgroup_axis_ref(fieldgroup_hdl, axis_ref, axis_ref_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: axis_ref - INTEGER (kind = C_INT) , VALUE :: axis_ref_size - END SUBROUTINE cxios_set_fieldgroup_axis_ref - - SUBROUTINE cxios_get_fieldgroup_axis_ref(fieldgroup_hdl, axis_ref, axis_ref_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: axis_ref - INTEGER (kind = C_INT) , VALUE :: axis_ref_size - END SUBROUTINE cxios_get_fieldgroup_axis_ref - - FUNCTION cxios_is_defined_fieldgroup_axis_ref(fieldgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_fieldgroup_axis_ref - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - END FUNCTION cxios_is_defined_fieldgroup_axis_ref - - - SUBROUTINE cxios_set_fieldgroup_cell_methods(fieldgroup_hdl, cell_methods, cell_methods_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: cell_methods - INTEGER (kind = C_INT) , VALUE :: cell_methods_size - END SUBROUTINE cxios_set_fieldgroup_cell_methods - - SUBROUTINE cxios_get_fieldgroup_cell_methods(fieldgroup_hdl, cell_methods, cell_methods_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: cell_methods - INTEGER (kind = C_INT) , VALUE :: cell_methods_size - END SUBROUTINE cxios_get_fieldgroup_cell_methods - - FUNCTION cxios_is_defined_fieldgroup_cell_methods(fieldgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_fieldgroup_cell_methods - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - END FUNCTION cxios_is_defined_fieldgroup_cell_methods - - - SUBROUTINE cxios_set_fieldgroup_cell_methods_mode(fieldgroup_hdl, cell_methods_mode, cell_methods_mode_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: cell_methods_mode - INTEGER (kind = C_INT) , VALUE :: cell_methods_mode_size - END SUBROUTINE cxios_set_fieldgroup_cell_methods_mode - - SUBROUTINE cxios_get_fieldgroup_cell_methods_mode(fieldgroup_hdl, cell_methods_mode, cell_methods_mode_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: cell_methods_mode - INTEGER (kind = C_INT) , VALUE :: cell_methods_mode_size - END SUBROUTINE cxios_get_fieldgroup_cell_methods_mode - - FUNCTION cxios_is_defined_fieldgroup_cell_methods_mode(fieldgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_fieldgroup_cell_methods_mode - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - END FUNCTION cxios_is_defined_fieldgroup_cell_methods_mode - - - SUBROUTINE cxios_set_fieldgroup_check_if_active(fieldgroup_hdl, check_if_active) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - LOGICAL (KIND=C_BOOL) , VALUE :: check_if_active - END SUBROUTINE cxios_set_fieldgroup_check_if_active - - SUBROUTINE cxios_get_fieldgroup_check_if_active(fieldgroup_hdl, check_if_active) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - LOGICAL (KIND=C_BOOL) :: check_if_active - END SUBROUTINE cxios_get_fieldgroup_check_if_active - - FUNCTION cxios_is_defined_fieldgroup_check_if_active(fieldgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_fieldgroup_check_if_active - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - END FUNCTION cxios_is_defined_fieldgroup_check_if_active - - - SUBROUTINE cxios_set_fieldgroup_comment(fieldgroup_hdl, comment, comment_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: comment - INTEGER (kind = C_INT) , VALUE :: comment_size - END SUBROUTINE cxios_set_fieldgroup_comment - - SUBROUTINE cxios_get_fieldgroup_comment(fieldgroup_hdl, comment, comment_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: comment - INTEGER (kind = C_INT) , VALUE :: comment_size - END SUBROUTINE cxios_get_fieldgroup_comment - - FUNCTION cxios_is_defined_fieldgroup_comment(fieldgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_fieldgroup_comment - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - END FUNCTION cxios_is_defined_fieldgroup_comment - - - SUBROUTINE cxios_set_fieldgroup_compression_level(fieldgroup_hdl, compression_level) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - INTEGER (KIND=C_INT) , VALUE :: compression_level - END SUBROUTINE cxios_set_fieldgroup_compression_level - - SUBROUTINE cxios_get_fieldgroup_compression_level(fieldgroup_hdl, compression_level) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - INTEGER (KIND=C_INT) :: compression_level - END SUBROUTINE cxios_get_fieldgroup_compression_level - - FUNCTION cxios_is_defined_fieldgroup_compression_level(fieldgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_fieldgroup_compression_level - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - END FUNCTION cxios_is_defined_fieldgroup_compression_level - - - SUBROUTINE cxios_set_fieldgroup_default_value(fieldgroup_hdl, default_value) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - REAL (KIND=C_DOUBLE) , VALUE :: default_value - END SUBROUTINE cxios_set_fieldgroup_default_value - - SUBROUTINE cxios_get_fieldgroup_default_value(fieldgroup_hdl, default_value) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - REAL (KIND=C_DOUBLE) :: default_value - END SUBROUTINE cxios_get_fieldgroup_default_value - - FUNCTION cxios_is_defined_fieldgroup_default_value(fieldgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_fieldgroup_default_value - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - END FUNCTION cxios_is_defined_fieldgroup_default_value - - - SUBROUTINE cxios_set_fieldgroup_detect_missing_value(fieldgroup_hdl, detect_missing_value) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - LOGICAL (KIND=C_BOOL) , VALUE :: detect_missing_value - END SUBROUTINE cxios_set_fieldgroup_detect_missing_value - - SUBROUTINE cxios_get_fieldgroup_detect_missing_value(fieldgroup_hdl, detect_missing_value) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - LOGICAL (KIND=C_BOOL) :: detect_missing_value - END SUBROUTINE cxios_get_fieldgroup_detect_missing_value - - FUNCTION cxios_is_defined_fieldgroup_detect_missing_value(fieldgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_fieldgroup_detect_missing_value - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - END FUNCTION cxios_is_defined_fieldgroup_detect_missing_value - - - SUBROUTINE cxios_set_fieldgroup_domain_ref(fieldgroup_hdl, domain_ref, domain_ref_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: domain_ref - INTEGER (kind = C_INT) , VALUE :: domain_ref_size - END SUBROUTINE cxios_set_fieldgroup_domain_ref - - SUBROUTINE cxios_get_fieldgroup_domain_ref(fieldgroup_hdl, domain_ref, domain_ref_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: domain_ref - INTEGER (kind = C_INT) , VALUE :: domain_ref_size - END SUBROUTINE cxios_get_fieldgroup_domain_ref - - FUNCTION cxios_is_defined_fieldgroup_domain_ref(fieldgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_fieldgroup_domain_ref - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - END FUNCTION cxios_is_defined_fieldgroup_domain_ref - - - SUBROUTINE cxios_set_fieldgroup_enabled(fieldgroup_hdl, enabled) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - LOGICAL (KIND=C_BOOL) , VALUE :: enabled - END SUBROUTINE cxios_set_fieldgroup_enabled - - SUBROUTINE cxios_get_fieldgroup_enabled(fieldgroup_hdl, enabled) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - LOGICAL (KIND=C_BOOL) :: enabled - END SUBROUTINE cxios_get_fieldgroup_enabled - - FUNCTION cxios_is_defined_fieldgroup_enabled(fieldgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_fieldgroup_enabled - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - END FUNCTION cxios_is_defined_fieldgroup_enabled - - - SUBROUTINE cxios_set_fieldgroup_expr(fieldgroup_hdl, expr, expr_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: expr - INTEGER (kind = C_INT) , VALUE :: expr_size - END SUBROUTINE cxios_set_fieldgroup_expr - - SUBROUTINE cxios_get_fieldgroup_expr(fieldgroup_hdl, expr, expr_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: expr - INTEGER (kind = C_INT) , VALUE :: expr_size - END SUBROUTINE cxios_get_fieldgroup_expr - - FUNCTION cxios_is_defined_fieldgroup_expr(fieldgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_fieldgroup_expr - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - END FUNCTION cxios_is_defined_fieldgroup_expr - - - SUBROUTINE cxios_set_fieldgroup_field_ref(fieldgroup_hdl, field_ref, field_ref_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: field_ref - INTEGER (kind = C_INT) , VALUE :: field_ref_size - END SUBROUTINE cxios_set_fieldgroup_field_ref - - SUBROUTINE cxios_get_fieldgroup_field_ref(fieldgroup_hdl, field_ref, field_ref_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: field_ref - INTEGER (kind = C_INT) , VALUE :: field_ref_size - END SUBROUTINE cxios_get_fieldgroup_field_ref - - FUNCTION cxios_is_defined_fieldgroup_field_ref(fieldgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_fieldgroup_field_ref - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - END FUNCTION cxios_is_defined_fieldgroup_field_ref - - - SUBROUTINE cxios_set_fieldgroup_freq_offset(fieldgroup_hdl, freq_offset) BIND(C) - USE ISO_C_BINDING - USE IDURATION - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - TYPE(txios(duration)), VALUE :: freq_offset - END SUBROUTINE cxios_set_fieldgroup_freq_offset - - SUBROUTINE cxios_get_fieldgroup_freq_offset(fieldgroup_hdl, freq_offset) BIND(C) - USE ISO_C_BINDING - USE IDURATION - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - TYPE(txios(duration)) :: freq_offset - END SUBROUTINE cxios_get_fieldgroup_freq_offset - - FUNCTION cxios_is_defined_fieldgroup_freq_offset(fieldgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_fieldgroup_freq_offset - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - END FUNCTION cxios_is_defined_fieldgroup_freq_offset - - - SUBROUTINE cxios_set_fieldgroup_freq_op(fieldgroup_hdl, freq_op) BIND(C) - USE ISO_C_BINDING - USE IDURATION - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - TYPE(txios(duration)), VALUE :: freq_op - END SUBROUTINE cxios_set_fieldgroup_freq_op - - SUBROUTINE cxios_get_fieldgroup_freq_op(fieldgroup_hdl, freq_op) BIND(C) - USE ISO_C_BINDING - USE IDURATION - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - TYPE(txios(duration)) :: freq_op - END SUBROUTINE cxios_get_fieldgroup_freq_op - - FUNCTION cxios_is_defined_fieldgroup_freq_op(fieldgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_fieldgroup_freq_op - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - END FUNCTION cxios_is_defined_fieldgroup_freq_op - - - SUBROUTINE cxios_set_fieldgroup_grid_path(fieldgroup_hdl, grid_path, grid_path_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: grid_path - INTEGER (kind = C_INT) , VALUE :: grid_path_size - END SUBROUTINE cxios_set_fieldgroup_grid_path - - SUBROUTINE cxios_get_fieldgroup_grid_path(fieldgroup_hdl, grid_path, grid_path_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: grid_path - INTEGER (kind = C_INT) , VALUE :: grid_path_size - END SUBROUTINE cxios_get_fieldgroup_grid_path - - FUNCTION cxios_is_defined_fieldgroup_grid_path(fieldgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_fieldgroup_grid_path - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - END FUNCTION cxios_is_defined_fieldgroup_grid_path - - - SUBROUTINE cxios_set_fieldgroup_grid_ref(fieldgroup_hdl, grid_ref, grid_ref_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: grid_ref - INTEGER (kind = C_INT) , VALUE :: grid_ref_size - END SUBROUTINE cxios_set_fieldgroup_grid_ref - - SUBROUTINE cxios_get_fieldgroup_grid_ref(fieldgroup_hdl, grid_ref, grid_ref_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: grid_ref - INTEGER (kind = C_INT) , VALUE :: grid_ref_size - END SUBROUTINE cxios_get_fieldgroup_grid_ref - - FUNCTION cxios_is_defined_fieldgroup_grid_ref(fieldgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_fieldgroup_grid_ref - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - END FUNCTION cxios_is_defined_fieldgroup_grid_ref - - - SUBROUTINE cxios_set_fieldgroup_group_ref(fieldgroup_hdl, group_ref, group_ref_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: group_ref - INTEGER (kind = C_INT) , VALUE :: group_ref_size - END SUBROUTINE cxios_set_fieldgroup_group_ref - - SUBROUTINE cxios_get_fieldgroup_group_ref(fieldgroup_hdl, group_ref, group_ref_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: group_ref - INTEGER (kind = C_INT) , VALUE :: group_ref_size - END SUBROUTINE cxios_get_fieldgroup_group_ref - - FUNCTION cxios_is_defined_fieldgroup_group_ref(fieldgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_fieldgroup_group_ref - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - END FUNCTION cxios_is_defined_fieldgroup_group_ref - - - SUBROUTINE cxios_set_fieldgroup_indexed_output(fieldgroup_hdl, indexed_output) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - LOGICAL (KIND=C_BOOL) , VALUE :: indexed_output - END SUBROUTINE cxios_set_fieldgroup_indexed_output - - SUBROUTINE cxios_get_fieldgroup_indexed_output(fieldgroup_hdl, indexed_output) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - LOGICAL (KIND=C_BOOL) :: indexed_output - END SUBROUTINE cxios_get_fieldgroup_indexed_output - - FUNCTION cxios_is_defined_fieldgroup_indexed_output(fieldgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_fieldgroup_indexed_output - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - END FUNCTION cxios_is_defined_fieldgroup_indexed_output - - - SUBROUTINE cxios_set_fieldgroup_level(fieldgroup_hdl, level) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - INTEGER (KIND=C_INT) , VALUE :: level - END SUBROUTINE cxios_set_fieldgroup_level - - SUBROUTINE cxios_get_fieldgroup_level(fieldgroup_hdl, level) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - INTEGER (KIND=C_INT) :: level - END SUBROUTINE cxios_get_fieldgroup_level - - FUNCTION cxios_is_defined_fieldgroup_level(fieldgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_fieldgroup_level - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - END FUNCTION cxios_is_defined_fieldgroup_level - - - SUBROUTINE cxios_set_fieldgroup_long_name(fieldgroup_hdl, long_name, long_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: long_name - INTEGER (kind = C_INT) , VALUE :: long_name_size - END SUBROUTINE cxios_set_fieldgroup_long_name - - SUBROUTINE cxios_get_fieldgroup_long_name(fieldgroup_hdl, long_name, long_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: long_name - INTEGER (kind = C_INT) , VALUE :: long_name_size - END SUBROUTINE cxios_get_fieldgroup_long_name - - FUNCTION cxios_is_defined_fieldgroup_long_name(fieldgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_fieldgroup_long_name - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - END FUNCTION cxios_is_defined_fieldgroup_long_name - - - SUBROUTINE cxios_set_fieldgroup_name(fieldgroup_hdl, name, name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: name - INTEGER (kind = C_INT) , VALUE :: name_size - END SUBROUTINE cxios_set_fieldgroup_name - - SUBROUTINE cxios_get_fieldgroup_name(fieldgroup_hdl, name, name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: name - INTEGER (kind = C_INT) , VALUE :: name_size - END SUBROUTINE cxios_get_fieldgroup_name - - FUNCTION cxios_is_defined_fieldgroup_name(fieldgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_fieldgroup_name - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - END FUNCTION cxios_is_defined_fieldgroup_name - - - SUBROUTINE cxios_set_fieldgroup_operation(fieldgroup_hdl, operation, operation_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: operation - INTEGER (kind = C_INT) , VALUE :: operation_size - END SUBROUTINE cxios_set_fieldgroup_operation - - SUBROUTINE cxios_get_fieldgroup_operation(fieldgroup_hdl, operation, operation_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: operation - INTEGER (kind = C_INT) , VALUE :: operation_size - END SUBROUTINE cxios_get_fieldgroup_operation - - FUNCTION cxios_is_defined_fieldgroup_operation(fieldgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_fieldgroup_operation - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - END FUNCTION cxios_is_defined_fieldgroup_operation - - - SUBROUTINE cxios_set_fieldgroup_prec(fieldgroup_hdl, prec) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - INTEGER (KIND=C_INT) , VALUE :: prec - END SUBROUTINE cxios_set_fieldgroup_prec - - SUBROUTINE cxios_get_fieldgroup_prec(fieldgroup_hdl, prec) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - INTEGER (KIND=C_INT) :: prec - END SUBROUTINE cxios_get_fieldgroup_prec - - FUNCTION cxios_is_defined_fieldgroup_prec(fieldgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_fieldgroup_prec - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - END FUNCTION cxios_is_defined_fieldgroup_prec - - - SUBROUTINE cxios_set_fieldgroup_read_access(fieldgroup_hdl, read_access) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - LOGICAL (KIND=C_BOOL) , VALUE :: read_access - END SUBROUTINE cxios_set_fieldgroup_read_access - - SUBROUTINE cxios_get_fieldgroup_read_access(fieldgroup_hdl, read_access) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - LOGICAL (KIND=C_BOOL) :: read_access - END SUBROUTINE cxios_get_fieldgroup_read_access - - FUNCTION cxios_is_defined_fieldgroup_read_access(fieldgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_fieldgroup_read_access - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - END FUNCTION cxios_is_defined_fieldgroup_read_access - - - SUBROUTINE cxios_set_fieldgroup_scalar_ref(fieldgroup_hdl, scalar_ref, scalar_ref_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: scalar_ref - INTEGER (kind = C_INT) , VALUE :: scalar_ref_size - END SUBROUTINE cxios_set_fieldgroup_scalar_ref - - SUBROUTINE cxios_get_fieldgroup_scalar_ref(fieldgroup_hdl, scalar_ref, scalar_ref_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: scalar_ref - INTEGER (kind = C_INT) , VALUE :: scalar_ref_size - END SUBROUTINE cxios_get_fieldgroup_scalar_ref - - FUNCTION cxios_is_defined_fieldgroup_scalar_ref(fieldgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_fieldgroup_scalar_ref - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - END FUNCTION cxios_is_defined_fieldgroup_scalar_ref - - - SUBROUTINE cxios_set_fieldgroup_scale_factor(fieldgroup_hdl, scale_factor) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - REAL (KIND=C_DOUBLE) , VALUE :: scale_factor - END SUBROUTINE cxios_set_fieldgroup_scale_factor - - SUBROUTINE cxios_get_fieldgroup_scale_factor(fieldgroup_hdl, scale_factor) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - REAL (KIND=C_DOUBLE) :: scale_factor - END SUBROUTINE cxios_get_fieldgroup_scale_factor - - FUNCTION cxios_is_defined_fieldgroup_scale_factor(fieldgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_fieldgroup_scale_factor - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - END FUNCTION cxios_is_defined_fieldgroup_scale_factor - - - SUBROUTINE cxios_set_fieldgroup_standard_name(fieldgroup_hdl, standard_name, standard_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: standard_name - INTEGER (kind = C_INT) , VALUE :: standard_name_size - END SUBROUTINE cxios_set_fieldgroup_standard_name - - SUBROUTINE cxios_get_fieldgroup_standard_name(fieldgroup_hdl, standard_name, standard_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: standard_name - INTEGER (kind = C_INT) , VALUE :: standard_name_size - END SUBROUTINE cxios_get_fieldgroup_standard_name - - FUNCTION cxios_is_defined_fieldgroup_standard_name(fieldgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_fieldgroup_standard_name - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - END FUNCTION cxios_is_defined_fieldgroup_standard_name - - - SUBROUTINE cxios_set_fieldgroup_ts_enabled(fieldgroup_hdl, ts_enabled) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - LOGICAL (KIND=C_BOOL) , VALUE :: ts_enabled - END SUBROUTINE cxios_set_fieldgroup_ts_enabled - - SUBROUTINE cxios_get_fieldgroup_ts_enabled(fieldgroup_hdl, ts_enabled) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - LOGICAL (KIND=C_BOOL) :: ts_enabled - END SUBROUTINE cxios_get_fieldgroup_ts_enabled - - FUNCTION cxios_is_defined_fieldgroup_ts_enabled(fieldgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_fieldgroup_ts_enabled - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - END FUNCTION cxios_is_defined_fieldgroup_ts_enabled - - - SUBROUTINE cxios_set_fieldgroup_ts_split_freq(fieldgroup_hdl, ts_split_freq) BIND(C) - USE ISO_C_BINDING - USE IDURATION - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - TYPE(txios(duration)), VALUE :: ts_split_freq - END SUBROUTINE cxios_set_fieldgroup_ts_split_freq - - SUBROUTINE cxios_get_fieldgroup_ts_split_freq(fieldgroup_hdl, ts_split_freq) BIND(C) - USE ISO_C_BINDING - USE IDURATION - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - TYPE(txios(duration)) :: ts_split_freq - END SUBROUTINE cxios_get_fieldgroup_ts_split_freq - - FUNCTION cxios_is_defined_fieldgroup_ts_split_freq(fieldgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_fieldgroup_ts_split_freq - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - END FUNCTION cxios_is_defined_fieldgroup_ts_split_freq - - - SUBROUTINE cxios_set_fieldgroup_unit(fieldgroup_hdl, unit, unit_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: unit - INTEGER (kind = C_INT) , VALUE :: unit_size - END SUBROUTINE cxios_set_fieldgroup_unit - - SUBROUTINE cxios_get_fieldgroup_unit(fieldgroup_hdl, unit, unit_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: unit - INTEGER (kind = C_INT) , VALUE :: unit_size - END SUBROUTINE cxios_get_fieldgroup_unit - - FUNCTION cxios_is_defined_fieldgroup_unit(fieldgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_fieldgroup_unit - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - END FUNCTION cxios_is_defined_fieldgroup_unit - - - SUBROUTINE cxios_set_fieldgroup_valid_max(fieldgroup_hdl, valid_max) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - REAL (KIND=C_DOUBLE) , VALUE :: valid_max - END SUBROUTINE cxios_set_fieldgroup_valid_max - - SUBROUTINE cxios_get_fieldgroup_valid_max(fieldgroup_hdl, valid_max) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - REAL (KIND=C_DOUBLE) :: valid_max - END SUBROUTINE cxios_get_fieldgroup_valid_max - - FUNCTION cxios_is_defined_fieldgroup_valid_max(fieldgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_fieldgroup_valid_max - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - END FUNCTION cxios_is_defined_fieldgroup_valid_max - - - SUBROUTINE cxios_set_fieldgroup_valid_min(fieldgroup_hdl, valid_min) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - REAL (KIND=C_DOUBLE) , VALUE :: valid_min - END SUBROUTINE cxios_set_fieldgroup_valid_min - - SUBROUTINE cxios_get_fieldgroup_valid_min(fieldgroup_hdl, valid_min) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - REAL (KIND=C_DOUBLE) :: valid_min - END SUBROUTINE cxios_get_fieldgroup_valid_min - - FUNCTION cxios_is_defined_fieldgroup_valid_min(fieldgroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_fieldgroup_valid_min - INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl - END FUNCTION cxios_is_defined_fieldgroup_valid_min - - END INTERFACE - -END MODULE fieldgroup_interface_attr diff --git a/xios_2311_src/trunk/.svn/pristine/54/5401a615b9ced48732d2bcae863e0c66676181ad.svn-base b/xios_2311_src/trunk/.svn/pristine/54/5401a615b9ced48732d2bcae863e0c66676181ad.svn-base deleted file mode 100644 index 3e5dd3f1ce26ab35689c3fe1f90b3defcec498f4..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/54/5401a615b9ced48732d2bcae863e0c66676181ad.svn-base +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "Domain": ["lmdz"], - "NumberServers": [2, 4], - "AxisMask": ["false"], - "DomMask": ["false"] - } -] diff --git a/xios_2311_src/trunk/.svn/pristine/54/541a40580e7c7097be01915ad026ba339f2af256.svn-base b/xios_2311_src/trunk/.svn/pristine/54/541a40580e7c7097be01915ad026ba339f2af256.svn-base deleted file mode 100644 index df1a9d2cf4fdde433cfff9fbd816660567c90c7f..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/54/541a40580e7c7097be01915ad026ba339f2af256.svn-base +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef __XIOS_MEM_CHECKER_HPP__ -#define __XIOS_MEM_CHECKER_HPP__ - -#include -#include - -namespace xios -{ - class CMemChecker - { - public: - CMemChecker(const std::string& name); - void suspend(void); - void resume(void); - void reset(void); - double getCumulatedMem(void); - static double getMem(void); - static CMemChecker& get(std::string name); - static std::string getAllCumulatedMem(void) ; - static void disable(void) { enabled_=false ;} - static void enable(void) {enabled_=true ;} - static void release(void) {allMemChecker_.clear();} - private: - static void check(void) ; - double cumulatedMem_; - double lastMem_; - bool suspended_; - std::string name_; - - static std::map allMemChecker_; - static CMemChecker dummy_ ; - static bool first_ ; - static bool enabled_ ; - }; -} - - - -#endif diff --git a/xios_2311_src/trunk/.svn/pristine/54/542931d0e119766d0762dd92d4f679cb16082f98.svn-base b/xios_2311_src/trunk/.svn/pristine/54/542931d0e119766d0762dd92d4f679cb16082f98.svn-base deleted file mode 100644 index 296d04dd62c17f1630b4c355d3cc995d13f95d2e..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/54/542931d0e119766d0762dd92d4f679cb16082f98.svn-base +++ /dev/null @@ -1,59 +0,0 @@ -/*! - \file generic_algorithm_transformation.hpp - \author Ha NGUYEN - \since 14 May 2015 - \date 29 June 2015 - - \brief Interface for all transformation algorithms. - */ -#ifndef __XIOS_GENERIC_ALGORITHM_TRANSFORMATION_HPP__ -#define __XIOS_GENERIC_ALGORITHM_TRANSFORMATION_HPP__ - -#include -#include -#include "array_new.hpp" -#include "client_client_dht_template.hpp" -#include "local_view.hpp" -#include "transform_connector.hpp" -#include "weight_transform_connector.hpp" - -namespace xios -{ - class CGrid; - class CDomain; - class CAxis; - class CScalar; - class CGridAlgorithm ; - class CTransformFilter ; - class CGarbageCollector ; - - /*! - \class CGenericAlgorithmTransformation - This class defines the interface for all other inherited algorithms class - */ -class CGenericAlgorithmTransformation : public std::enable_shared_from_this -{ - public : - CGenericAlgorithmTransformation(bool isSource) ; - virtual shared_ptr createGridAlgorithm(CGrid* gridSrc, CGrid* newGrid, int pos) ; - virtual CTransformFilter* createTransformFilter(CGarbageCollector& gc, shared_ptr algo, bool detectMissingValues, double defaultValue) ; - virtual void apply(int dimBefore, int dimAfter, const CArray& dataIn, CArray& dataOut) { abort() ;} //=0 - virtual void apply(int dimBefore, int dimAfter, const CArray& dataIn, const vector>& auxData, CArray& dataOut) { abort() ;} //=0 - virtual bool isGenerateTransformation(void) { return false ;} - virtual StdString getAlgoName() { return "\\nGeneric algorithm transformation";} - virtual bool transformAuxField(int pos) { return true ;} - virtual vector getAuxFieldId(void) ; - protected : - typedef std::unordered_map > TransformationIndexMap; - typedef std::unordered_map > TransformationWeightMap; - - shared_ptr recvElement_ ; - bool isSource_ ; - - public: - shared_ptr getRecvElement(void) { return recvElement_ ;} - -}; - -} -#endif // __XIOS_GENERIC_ALGORITHM_TRANSFORMATION_HPP__ diff --git a/xios_2311_src/trunk/.svn/pristine/54/543e926e201e444006a7a067a4aafb892a743813.svn-base b/xios_2311_src/trunk/.svn/pristine/54/543e926e201e444006a7a067a4aafb892a743813.svn-base deleted file mode 100644 index 650c3f91009350c7c6b98f735e6e7d3d9e07a840..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/54/543e926e201e444006a7a067a4aafb892a743813.svn-base +++ /dev/null @@ -1,569 +0,0 @@ -! * ************************************************************************** * -! * Interface auto generated - do not modify * -! * ************************************************************************** * -#include "../fortran/xios_fortran_prefix.hpp" - -MODULE axis_interface_attr - USE, INTRINSIC :: ISO_C_BINDING - - INTERFACE - ! Do not call directly / interface FORTRAN 2003 <-> C99 - - SUBROUTINE cxios_set_axis_axis_ref(axis_hdl, axis_ref, axis_ref_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: axis_ref - INTEGER (kind = C_INT) , VALUE :: axis_ref_size - END SUBROUTINE cxios_set_axis_axis_ref - - SUBROUTINE cxios_get_axis_axis_ref(axis_hdl, axis_ref, axis_ref_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: axis_ref - INTEGER (kind = C_INT) , VALUE :: axis_ref_size - END SUBROUTINE cxios_get_axis_axis_ref - - FUNCTION cxios_is_defined_axis_axis_ref(axis_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_axis_axis_ref - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - END FUNCTION cxios_is_defined_axis_axis_ref - - - SUBROUTINE cxios_set_axis_axis_type(axis_hdl, axis_type, axis_type_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: axis_type - INTEGER (kind = C_INT) , VALUE :: axis_type_size - END SUBROUTINE cxios_set_axis_axis_type - - SUBROUTINE cxios_get_axis_axis_type(axis_hdl, axis_type, axis_type_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: axis_type - INTEGER (kind = C_INT) , VALUE :: axis_type_size - END SUBROUTINE cxios_get_axis_axis_type - - FUNCTION cxios_is_defined_axis_axis_type(axis_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_axis_axis_type - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - END FUNCTION cxios_is_defined_axis_axis_type - - - SUBROUTINE cxios_set_axis_begin(axis_hdl, begin) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - INTEGER (KIND=C_INT) , VALUE :: begin - END SUBROUTINE cxios_set_axis_begin - - SUBROUTINE cxios_get_axis_begin(axis_hdl, begin) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - INTEGER (KIND=C_INT) :: begin - END SUBROUTINE cxios_get_axis_begin - - FUNCTION cxios_is_defined_axis_begin(axis_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_axis_begin - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - END FUNCTION cxios_is_defined_axis_begin - - - SUBROUTINE cxios_set_axis_bounds(axis_hdl, bounds, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - REAL (KIND=C_DOUBLE) , DIMENSION(*) :: bounds - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_set_axis_bounds - - SUBROUTINE cxios_get_axis_bounds(axis_hdl, bounds, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - REAL (KIND=C_DOUBLE) , DIMENSION(*) :: bounds - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_get_axis_bounds - - FUNCTION cxios_is_defined_axis_bounds(axis_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_axis_bounds - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - END FUNCTION cxios_is_defined_axis_bounds - - - SUBROUTINE cxios_set_axis_bounds_name(axis_hdl, bounds_name, bounds_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: bounds_name - INTEGER (kind = C_INT) , VALUE :: bounds_name_size - END SUBROUTINE cxios_set_axis_bounds_name - - SUBROUTINE cxios_get_axis_bounds_name(axis_hdl, bounds_name, bounds_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: bounds_name - INTEGER (kind = C_INT) , VALUE :: bounds_name_size - END SUBROUTINE cxios_get_axis_bounds_name - - FUNCTION cxios_is_defined_axis_bounds_name(axis_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_axis_bounds_name - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - END FUNCTION cxios_is_defined_axis_bounds_name - - - SUBROUTINE cxios_set_axis_comment(axis_hdl, comment, comment_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: comment - INTEGER (kind = C_INT) , VALUE :: comment_size - END SUBROUTINE cxios_set_axis_comment - - SUBROUTINE cxios_get_axis_comment(axis_hdl, comment, comment_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: comment - INTEGER (kind = C_INT) , VALUE :: comment_size - END SUBROUTINE cxios_get_axis_comment - - FUNCTION cxios_is_defined_axis_comment(axis_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_axis_comment - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - END FUNCTION cxios_is_defined_axis_comment - - - SUBROUTINE cxios_set_axis_data_begin(axis_hdl, data_begin) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - INTEGER (KIND=C_INT) , VALUE :: data_begin - END SUBROUTINE cxios_set_axis_data_begin - - SUBROUTINE cxios_get_axis_data_begin(axis_hdl, data_begin) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - INTEGER (KIND=C_INT) :: data_begin - END SUBROUTINE cxios_get_axis_data_begin - - FUNCTION cxios_is_defined_axis_data_begin(axis_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_axis_data_begin - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - END FUNCTION cxios_is_defined_axis_data_begin - - - SUBROUTINE cxios_set_axis_data_index(axis_hdl, data_index, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - INTEGER (KIND=C_INT) , DIMENSION(*) :: data_index - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_set_axis_data_index - - SUBROUTINE cxios_get_axis_data_index(axis_hdl, data_index, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - INTEGER (KIND=C_INT) , DIMENSION(*) :: data_index - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_get_axis_data_index - - FUNCTION cxios_is_defined_axis_data_index(axis_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_axis_data_index - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - END FUNCTION cxios_is_defined_axis_data_index - - - SUBROUTINE cxios_set_axis_data_n(axis_hdl, data_n) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - INTEGER (KIND=C_INT) , VALUE :: data_n - END SUBROUTINE cxios_set_axis_data_n - - SUBROUTINE cxios_get_axis_data_n(axis_hdl, data_n) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - INTEGER (KIND=C_INT) :: data_n - END SUBROUTINE cxios_get_axis_data_n - - FUNCTION cxios_is_defined_axis_data_n(axis_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_axis_data_n - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - END FUNCTION cxios_is_defined_axis_data_n - - - SUBROUTINE cxios_set_axis_dim_name(axis_hdl, dim_name, dim_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: dim_name - INTEGER (kind = C_INT) , VALUE :: dim_name_size - END SUBROUTINE cxios_set_axis_dim_name - - SUBROUTINE cxios_get_axis_dim_name(axis_hdl, dim_name, dim_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: dim_name - INTEGER (kind = C_INT) , VALUE :: dim_name_size - END SUBROUTINE cxios_get_axis_dim_name - - FUNCTION cxios_is_defined_axis_dim_name(axis_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_axis_dim_name - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - END FUNCTION cxios_is_defined_axis_dim_name - - - SUBROUTINE cxios_set_axis_formula(axis_hdl, formula, formula_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: formula - INTEGER (kind = C_INT) , VALUE :: formula_size - END SUBROUTINE cxios_set_axis_formula - - SUBROUTINE cxios_get_axis_formula(axis_hdl, formula, formula_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: formula - INTEGER (kind = C_INT) , VALUE :: formula_size - END SUBROUTINE cxios_get_axis_formula - - FUNCTION cxios_is_defined_axis_formula(axis_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_axis_formula - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - END FUNCTION cxios_is_defined_axis_formula - - - SUBROUTINE cxios_set_axis_formula_bounds(axis_hdl, formula_bounds, formula_bounds_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: formula_bounds - INTEGER (kind = C_INT) , VALUE :: formula_bounds_size - END SUBROUTINE cxios_set_axis_formula_bounds - - SUBROUTINE cxios_get_axis_formula_bounds(axis_hdl, formula_bounds, formula_bounds_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: formula_bounds - INTEGER (kind = C_INT) , VALUE :: formula_bounds_size - END SUBROUTINE cxios_get_axis_formula_bounds - - FUNCTION cxios_is_defined_axis_formula_bounds(axis_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_axis_formula_bounds - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - END FUNCTION cxios_is_defined_axis_formula_bounds - - - SUBROUTINE cxios_set_axis_formula_term(axis_hdl, formula_term, formula_term_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: formula_term - INTEGER (kind = C_INT) , VALUE :: formula_term_size - END SUBROUTINE cxios_set_axis_formula_term - - SUBROUTINE cxios_get_axis_formula_term(axis_hdl, formula_term, formula_term_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: formula_term - INTEGER (kind = C_INT) , VALUE :: formula_term_size - END SUBROUTINE cxios_get_axis_formula_term - - FUNCTION cxios_is_defined_axis_formula_term(axis_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_axis_formula_term - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - END FUNCTION cxios_is_defined_axis_formula_term - - - SUBROUTINE cxios_set_axis_formula_term_bounds(axis_hdl, formula_term_bounds, formula_term_bounds_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: formula_term_bounds - INTEGER (kind = C_INT) , VALUE :: formula_term_bounds_size - END SUBROUTINE cxios_set_axis_formula_term_bounds - - SUBROUTINE cxios_get_axis_formula_term_bounds(axis_hdl, formula_term_bounds, formula_term_bounds_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: formula_term_bounds - INTEGER (kind = C_INT) , VALUE :: formula_term_bounds_size - END SUBROUTINE cxios_get_axis_formula_term_bounds - - FUNCTION cxios_is_defined_axis_formula_term_bounds(axis_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_axis_formula_term_bounds - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - END FUNCTION cxios_is_defined_axis_formula_term_bounds - - - SUBROUTINE cxios_set_axis_index(axis_hdl, index, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - INTEGER (KIND=C_INT) , DIMENSION(*) :: index - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_set_axis_index - - SUBROUTINE cxios_get_axis_index(axis_hdl, index, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - INTEGER (KIND=C_INT) , DIMENSION(*) :: index - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_get_axis_index - - FUNCTION cxios_is_defined_axis_index(axis_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_axis_index - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - END FUNCTION cxios_is_defined_axis_index - - - SUBROUTINE cxios_set_axis_label(axis_hdl, label, str_len, str_size, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - CHARACTER (KIND=C_CHAR), DIMENSION(*) :: label - INTEGER (kind = C_INT), VALUE :: str_len - INTEGER (kind = C_INT), DIMENSION(*) :: str_size - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_set_axis_label - - SUBROUTINE cxios_get_axis_label(axis_hdl, label, str_size, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - CHARACTER (KIND=C_CHAR), DIMENSION(*) :: label - INTEGER (kind = C_INT), VALUE :: str_size - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_get_axis_label - - FUNCTION cxios_is_defined_axis_label(axis_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_axis_label - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - END FUNCTION cxios_is_defined_axis_label - - - SUBROUTINE cxios_set_axis_long_name(axis_hdl, long_name, long_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: long_name - INTEGER (kind = C_INT) , VALUE :: long_name_size - END SUBROUTINE cxios_set_axis_long_name - - SUBROUTINE cxios_get_axis_long_name(axis_hdl, long_name, long_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: long_name - INTEGER (kind = C_INT) , VALUE :: long_name_size - END SUBROUTINE cxios_get_axis_long_name - - FUNCTION cxios_is_defined_axis_long_name(axis_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_axis_long_name - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - END FUNCTION cxios_is_defined_axis_long_name - - - SUBROUTINE cxios_set_axis_mask(axis_hdl, mask, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - LOGICAL (KIND=C_BOOL) , DIMENSION(*) :: mask - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_set_axis_mask - - SUBROUTINE cxios_get_axis_mask(axis_hdl, mask, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - LOGICAL (KIND=C_BOOL) , DIMENSION(*) :: mask - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_get_axis_mask - - FUNCTION cxios_is_defined_axis_mask(axis_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_axis_mask - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - END FUNCTION cxios_is_defined_axis_mask - - - SUBROUTINE cxios_set_axis_n(axis_hdl, n) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - INTEGER (KIND=C_INT) , VALUE :: n - END SUBROUTINE cxios_set_axis_n - - SUBROUTINE cxios_get_axis_n(axis_hdl, n) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - INTEGER (KIND=C_INT) :: n - END SUBROUTINE cxios_get_axis_n - - FUNCTION cxios_is_defined_axis_n(axis_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_axis_n - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - END FUNCTION cxios_is_defined_axis_n - - - SUBROUTINE cxios_set_axis_n_distributed_partition(axis_hdl, n_distributed_partition) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - INTEGER (KIND=C_INT) , VALUE :: n_distributed_partition - END SUBROUTINE cxios_set_axis_n_distributed_partition - - SUBROUTINE cxios_get_axis_n_distributed_partition(axis_hdl, n_distributed_partition) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - INTEGER (KIND=C_INT) :: n_distributed_partition - END SUBROUTINE cxios_get_axis_n_distributed_partition - - FUNCTION cxios_is_defined_axis_n_distributed_partition(axis_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_axis_n_distributed_partition - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - END FUNCTION cxios_is_defined_axis_n_distributed_partition - - - SUBROUTINE cxios_set_axis_n_glo(axis_hdl, n_glo) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - INTEGER (KIND=C_INT) , VALUE :: n_glo - END SUBROUTINE cxios_set_axis_n_glo - - SUBROUTINE cxios_get_axis_n_glo(axis_hdl, n_glo) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - INTEGER (KIND=C_INT) :: n_glo - END SUBROUTINE cxios_get_axis_n_glo - - FUNCTION cxios_is_defined_axis_n_glo(axis_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_axis_n_glo - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - END FUNCTION cxios_is_defined_axis_n_glo - - - SUBROUTINE cxios_set_axis_name(axis_hdl, name, name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: name - INTEGER (kind = C_INT) , VALUE :: name_size - END SUBROUTINE cxios_set_axis_name - - SUBROUTINE cxios_get_axis_name(axis_hdl, name, name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: name - INTEGER (kind = C_INT) , VALUE :: name_size - END SUBROUTINE cxios_get_axis_name - - FUNCTION cxios_is_defined_axis_name(axis_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_axis_name - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - END FUNCTION cxios_is_defined_axis_name - - - SUBROUTINE cxios_set_axis_positive(axis_hdl, positive, positive_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: positive - INTEGER (kind = C_INT) , VALUE :: positive_size - END SUBROUTINE cxios_set_axis_positive - - SUBROUTINE cxios_get_axis_positive(axis_hdl, positive, positive_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: positive - INTEGER (kind = C_INT) , VALUE :: positive_size - END SUBROUTINE cxios_get_axis_positive - - FUNCTION cxios_is_defined_axis_positive(axis_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_axis_positive - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - END FUNCTION cxios_is_defined_axis_positive - - - SUBROUTINE cxios_set_axis_prec(axis_hdl, prec) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - INTEGER (KIND=C_INT) , VALUE :: prec - END SUBROUTINE cxios_set_axis_prec - - SUBROUTINE cxios_get_axis_prec(axis_hdl, prec) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - INTEGER (KIND=C_INT) :: prec - END SUBROUTINE cxios_get_axis_prec - - FUNCTION cxios_is_defined_axis_prec(axis_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_axis_prec - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - END FUNCTION cxios_is_defined_axis_prec - - - SUBROUTINE cxios_set_axis_standard_name(axis_hdl, standard_name, standard_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: standard_name - INTEGER (kind = C_INT) , VALUE :: standard_name_size - END SUBROUTINE cxios_set_axis_standard_name - - SUBROUTINE cxios_get_axis_standard_name(axis_hdl, standard_name, standard_name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: standard_name - INTEGER (kind = C_INT) , VALUE :: standard_name_size - END SUBROUTINE cxios_get_axis_standard_name - - FUNCTION cxios_is_defined_axis_standard_name(axis_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_axis_standard_name - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - END FUNCTION cxios_is_defined_axis_standard_name - - - SUBROUTINE cxios_set_axis_unit(axis_hdl, unit, unit_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: unit - INTEGER (kind = C_INT) , VALUE :: unit_size - END SUBROUTINE cxios_set_axis_unit - - SUBROUTINE cxios_get_axis_unit(axis_hdl, unit, unit_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: unit - INTEGER (kind = C_INT) , VALUE :: unit_size - END SUBROUTINE cxios_get_axis_unit - - FUNCTION cxios_is_defined_axis_unit(axis_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_axis_unit - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - END FUNCTION cxios_is_defined_axis_unit - - - SUBROUTINE cxios_set_axis_value(axis_hdl, value, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - REAL (KIND=C_DOUBLE) , DIMENSION(*) :: value - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_set_axis_value - - SUBROUTINE cxios_get_axis_value(axis_hdl, value, extent) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - REAL (KIND=C_DOUBLE) , DIMENSION(*) :: value - INTEGER (kind = C_INT), DIMENSION(*) :: extent - END SUBROUTINE cxios_get_axis_value - - FUNCTION cxios_is_defined_axis_value(axis_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_axis_value - INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl - END FUNCTION cxios_is_defined_axis_value - - END INTERFACE - -END MODULE axis_interface_attr diff --git a/xios_2311_src/trunk/.svn/pristine/54/547c94e578a4fc3c67754ee2376a907ba869b8fc.svn-base b/xios_2311_src/trunk/.svn/pristine/54/547c94e578a4fc3c67754ee2376a907ba869b8fc.svn-base deleted file mode 100644 index 2e02a5cb9982cdc2013663db275e37e5b8120baf..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/54/547c94e578a4fc3c67754ee2376a907ba869b8fc.svn-base +++ /dev/null @@ -1,187 +0,0 @@ -/*! \file -Functions for netCDF-4 features. - -Copyright 2010 University Corporation for Atmospheric -Research/Unidata. See \ref COPYRIGHT file for more info. */ - -#include "ncdispatch.h" - -/** \defgroup user_types User-Defined Types - -User defined types allow for more complex data structures. - -NetCDF-4 has added support for four different user defined data -types. User defined type may only be used in files created with the -::NC_NETCDF4 and without ::NC_CLASSIC_MODEL. -- compound type: like a C struct, a compound type is a collection of -types, including other user defined types, in one package. -- variable length array type: used to store ragged arrays. -- opaque type: This type has only a size per element, and no other - type information. -- enum type: Like an enumeration in C, this type lets you assign text - values to integer values, and store the integer values. - -Users may construct user defined type with the various nc_def_* -functions described in this section. They may learn about user defined -types by using the nc_inq_ functions defined in this section. - -Once types are constructed, define variables of the new type with -nc_def_var (see nc_def_var). Write to them with nc_put_var1, -nc_put_var, nc_put_vara, or nc_put_vars. Read data of user-defined -type with nc_get_var1, nc_get_var, nc_get_vara, or nc_get_vars (see -\ref variables). - -Create attributes of the new type with nc_put_att (see nc_put_att_ -type). Read attributes of the new type with nc_get_att (see -\ref attributes). -*/ -/** \{ */ - -/** \} */ - -/** \defgroup groups Groups - -NetCDF-4 added support for hierarchical groups within netCDF datasets. - -Groups are identified with a ncid, which identifies both the open -file, and the group within that file. When a file is opened with -nc_open or nc_create, the ncid for the root group of that file is -provided. Using that as a starting point, users can add new groups, or -list and navigate existing groups. - -All netCDF calls take a ncid which determines where the call will take -its action. For example, the nc_def_var function takes a ncid as its -first parameter. It will create a variable in whichever group its ncid -refers to. Use the root ncid provided by nc_create or nc_open to -create a variable in the root group. Or use nc_def_grp to create a -group and use its ncid to define a variable in the new group. - -Variable are only visible in the group in which they are defined. The -same applies to attributes. “Global†attributes are associated with -the group whose ncid is used. - -Dimensions are visible in their groups, and all child groups. - -Group operations are only permitted on netCDF-4 files - that is, files -created with the HDF5 flag in nc_create(). Groups are not compatible -with the netCDF classic data model, so files created with the -::NC_CLASSIC_MODEL file cannot contain groups (except the root group). - - */ -/** \{ */ -int -nc_inq_ncid(int ncid, const char *name, int *grp_ncid) -{ - NC* ncp; - int stat = NC_check_id(ncid,&ncp); - if(stat != NC_NOERR) return stat; - return ncp->dispatch->inq_ncid(ncid,name,grp_ncid); -} - -int -nc_inq_grps(int ncid, int *numgrps, int *ncids) -{ - NC* ncp; - int stat = NC_check_id(ncid,&ncp); - if(stat != NC_NOERR) return stat; - return ncp->dispatch->inq_grps(ncid,numgrps,ncids); -} - -int -nc_inq_grpname(int ncid, char *name) -{ - NC* ncp; - int stat = NC_check_id(ncid,&ncp); - if(stat != NC_NOERR) return stat; - return ncp->dispatch->inq_grpname(ncid,name); -} - -int -nc_inq_grpname_full(int ncid, size_t *lenp, char *full_name) -{ - NC* ncp; - int stat = NC_check_id(ncid,&ncp); - if(stat != NC_NOERR) return stat; - return ncp->dispatch->inq_grpname_full(ncid,lenp,full_name); -} - -int -nc_inq_grpname_len(int ncid, size_t *lenp) -{ - int stat = nc_inq_grpname_full(ncid,lenp,NULL); - return stat; -} - -int -nc_inq_grp_parent(int ncid, int *parent_ncid) -{ - NC* ncp; - int stat = NC_check_id(ncid,&ncp); - if(stat != NC_NOERR) return stat; - return ncp->dispatch->inq_grp_parent(ncid,parent_ncid); -} - -/* This has same semantics as nc_inq_ncid */ -int -nc_inq_grp_ncid(int ncid, const char *grp_name, int *grp_ncid) -{ - return nc_inq_ncid(ncid,grp_name,grp_ncid); -} - -int -nc_inq_grp_full_ncid(int ncid, const char *full_name, int *grp_ncid) -{ - NC* ncp; - int stat = NC_check_id(ncid,&ncp); - if(stat != NC_NOERR) return stat; - return ncp->dispatch->inq_grp_full_ncid(ncid,full_name,grp_ncid); -} - -int -nc_inq_varids(int ncid, int *nvars, int *varids) -{ - NC* ncp; - int stat = NC_check_id(ncid,&ncp); - if(stat != NC_NOERR) return stat; - return ncp->dispatch->inq_varids(ncid,nvars,varids); -} - -int -nc_inq_dimids(int ncid, int *ndims, int *dimids, int include_parents) -{ - NC* ncp; - int stat = NC_check_id(ncid,&ncp); - if(stat != NC_NOERR) return stat; - return ncp->dispatch->inq_dimids(ncid,ndims,dimids,include_parents); -} - -int -nc_inq_typeids(int ncid, int *ntypes, int *typeids) -{ - NC* ncp; - int stat = NC_check_id(ncid,&ncp); - if(stat != NC_NOERR) return stat; - return ncp->dispatch->inq_typeids(ncid,ntypes,typeids); -} - -int -nc_def_grp(int parent_ncid, const char *name, int *new_ncid) -{ - NC* ncp; - int stat = NC_check_id(parent_ncid,&ncp); - if(stat != NC_NOERR) return stat; - return ncp->dispatch->def_grp(parent_ncid,name,new_ncid); -} - - - -int -nc_show_metadata(int ncid) -{ - NC* ncp; - int stat = NC_check_id(ncid,&ncp); - if(stat != NC_NOERR) return stat; - return ncp->dispatch->show_metadata(ncid); -} - -/** \} */ diff --git a/xios_2311_src/trunk/.svn/pristine/54/549b29c35d5c9f1f69a08e3b7271ecba8732145d.svn-base b/xios_2311_src/trunk/.svn/pristine/54/549b29c35d5c9f1f69a08e3b7271ecba8732145d.svn-base deleted file mode 100644 index 877f165b74c87714224b2e98a88c5e2131d97b70..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/54/549b29c35d5c9f1f69a08e3b7271ecba8732145d.svn-base +++ /dev/null @@ -1,128 +0,0 @@ -/*! - \file scalar_algorithm_reduce_scalar.cpp - \author Ha NGUYEN - \since 23 June 2016 - \date 23 June 2016 - - \brief Algorithm for reduce an axis to a scalar - */ -#include "scalar_algorithm_reduce_axis.hpp" -#include "axis.hpp" -#include "scalar.hpp" -#include "reduce_axis_to_scalar.hpp" -#include "grid.hpp" -#include "grid_transformation_factory_impl.hpp" -#include "reduction.hpp" - -#include "reduction.hpp" - -namespace xios { -shared_ptr CScalarAlgorithmReduceAxis::create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) -TRY -{ - std::vector scalarListDestP = gridDst->getScalars(); - std::vector axisListSrcP = gridSrc->getAxis(); - - CReduceAxisToScalar* reduceAxis = dynamic_cast (transformation); - int scalarDstIndex = elementPositionInGridDst2ScalarPosition[elementPositionInGrid]; - int axisSrcIndex = elementPositionInGridSrc2AxisPosition[elementPositionInGrid]; - - return make_shared(isSource, scalarListDestP[scalarDstIndex], axisListSrcP[axisSrcIndex], reduceAxis); -} -CATCH - -bool CScalarAlgorithmReduceAxis::dummyRegistered_ = CScalarAlgorithmReduceAxis::registerTrans(); -bool CScalarAlgorithmReduceAxis::registerTrans() -TRY -{ - return CGridTransformationFactory::registerTransformation(TRANS_REDUCE_AXIS_TO_SCALAR, create); -} -CATCH - -CScalarAlgorithmReduceAxis::CScalarAlgorithmReduceAxis(bool isSource, CScalar* scalarDestination, CAxis* axisSource, CReduceAxisToScalar* algo) - : CAlgorithmTransformationReduce(isSource) -TRY -{ - if (algo->operation.isEmpty()) - ERROR("CScalarAlgorithmReduceAxis::CScalarAlgorithmReduceAxis(CAxis* axisDestination, CAxis* axisSource, CReduceAxisToScalar* algo)", - << "Operation must be defined." - << "Axis source " <getId() << std::endl - << "Scalar destination " << scalarDestination->getId()); - StdString op; - switch (algo->operation) - { - case CReduceAxisToScalar::operation_attr::sum: - operator_ = EReduction::sum; - break; - case CReduceAxisToScalar::operation_attr::min: - operator_ = EReduction::min; - break; - case CReduceAxisToScalar::operation_attr::max: - operator_ = EReduction::max; - break; - case CReduceAxisToScalar::operation_attr::average: - operator_ = EReduction::average; - break; - default: - ERROR("CScalarAlgorithmReduceAxis::CScalarAlgorithmReduceAxis(CScalar* scalarDestination, CAxis* axisSource, CReduceAxisToScalar* algo)", - << "Operation is wrongly defined. Supported operations: sum, min, max, average." << std::endl - << "Domain source " <getId() << std::endl - << "Scalar destination " << scalarDestination->getId()); - - } - - bool local=false ; - if (!algo->local.isEmpty()) local=algo->local ; - - auto& transMap = this->transformationMapping_; - - if (local) - { - scalarDestination->n=1 ; // no mask - scalarDestination->mask.reset() ; - - CArray srcGlobalIndex ; - axisSource->getLocalView(CElementView::WORKFLOW)->getGlobalIndexView(srcGlobalIndex) ; - size_t nbIdx = srcGlobalIndex.numElements(); - if (nbIdx==0) scalarDestination->n=0 ; - scalarDestination->checkAttributes() ; - - for (size_t idx = 0; idx < nbIdx; ++idx) - { - size_t globalIdx = srcGlobalIndex(idx); - transformationMapping_[0].push_back(globalIdx); - } - - } - else - { - scalarDestination->checkAttributes() ; - - int globalIndexSize = axisSource->getLocalView(CElementView::WORKFLOW)->getGlobalSize(); - CArray dstGlobalIndex ; - scalarDestination->getLocalView(CElementView::WORKFLOW)->getGlobalIndexView(dstGlobalIndex) ; - if (dstGlobalIndex.numElements()!=0) - for (int idx = 0; idx < globalIndexSize; ++idx) transformationMapping_[0].push_back(idx); - } - - this->computeAlgorithm(axisSource->getLocalView(CElementView::WORKFLOW), scalarDestination->getLocalView(CElementView::WORKFLOW)) ; - -} -CATCH - - -CScalarAlgorithmReduceAxis::~CScalarAlgorithmReduceAxis() -TRY -{ -} -CATCH - -} diff --git a/xios_2311_src/trunk/.svn/pristine/54/54c1eef2ecf9efbcc55c78e12707ed84d6412799.svn-base b/xios_2311_src/trunk/.svn/pristine/54/54c1eef2ecf9efbcc55c78e12707ed84d6412799.svn-base deleted file mode 100644 index 0050a1f4d26b894eb6c79bdd23a09f50d165578a..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/54/54c1eef2ecf9efbcc55c78e12707ed84d6412799.svn-base +++ /dev/null @@ -1,1343 +0,0 @@ -! * ************************************************************************** * -! * Interface auto generated - do not modify * -! * ************************************************************************** * -#include "xios_fortran_prefix.hpp" - -MODULE idomain_attr - USE, INTRINSIC :: ISO_C_BINDING - USE idomain - USE domain_interface_attr - -CONTAINS - - SUBROUTINE xios(set_domain_attr) & - ( domain_id, area, bounds_lat_1d, bounds_lat_2d, bounds_lat_name, bounds_lon_1d, bounds_lon_2d & - , bounds_lon_name, comment, data_dim, data_i_index, data_ibegin, data_j_index, data_jbegin, data_ni & - , data_nj, dim_i_name, dim_j_name, domain_ref, i_index, ibegin, j_index, jbegin, lat_name, latvalue_1d & - , latvalue_2d, lon_name, long_name, lonvalue_1d, lonvalue_2d, mask_1d, mask_2d, name, ni, ni_glo & - , nj, nj_glo, nvertex, prec, radius, standard_name, type ) - - IMPLICIT NONE - TYPE(txios(domain)) :: domain_hdl - CHARACTER(LEN=*), INTENT(IN) ::domain_id - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: area(:,:) - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: bounds_lat_1d(:,:) - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: bounds_lat_2d(:,:,:) - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: bounds_lat_name - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: bounds_lon_1d(:,:) - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: bounds_lon_2d(:,:,:) - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: bounds_lon_name - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: comment - INTEGER , OPTIONAL, INTENT(IN) :: data_dim - INTEGER , OPTIONAL, INTENT(IN) :: data_i_index(:) - INTEGER , OPTIONAL, INTENT(IN) :: data_ibegin - INTEGER , OPTIONAL, INTENT(IN) :: data_j_index(:) - INTEGER , OPTIONAL, INTENT(IN) :: data_jbegin - INTEGER , OPTIONAL, INTENT(IN) :: data_ni - INTEGER , OPTIONAL, INTENT(IN) :: data_nj - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: dim_i_name - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: dim_j_name - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: domain_ref - INTEGER , OPTIONAL, INTENT(IN) :: i_index(:) - INTEGER , OPTIONAL, INTENT(IN) :: ibegin - INTEGER , OPTIONAL, INTENT(IN) :: j_index(:) - INTEGER , OPTIONAL, INTENT(IN) :: jbegin - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: lat_name - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: latvalue_1d(:) - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: latvalue_2d(:,:) - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: lon_name - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: long_name - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: lonvalue_1d(:) - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: lonvalue_2d(:,:) - LOGICAL , OPTIONAL, INTENT(IN) :: mask_1d(:) - LOGICAL (KIND=C_BOOL) , ALLOCATABLE :: mask_1d_tmp(:) - LOGICAL , OPTIONAL, INTENT(IN) :: mask_2d(:,:) - LOGICAL (KIND=C_BOOL) , ALLOCATABLE :: mask_2d_tmp(:,:) - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name - INTEGER , OPTIONAL, INTENT(IN) :: ni - INTEGER , OPTIONAL, INTENT(IN) :: ni_glo - INTEGER , OPTIONAL, INTENT(IN) :: nj - INTEGER , OPTIONAL, INTENT(IN) :: nj_glo - INTEGER , OPTIONAL, INTENT(IN) :: nvertex - INTEGER , OPTIONAL, INTENT(IN) :: prec - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: radius - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: standard_name - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type - - CALL xios(get_domain_handle) & - (domain_id,domain_hdl) - CALL xios(set_domain_attr_hdl_) & - ( domain_hdl, area, bounds_lat_1d, bounds_lat_2d, bounds_lat_name, bounds_lon_1d, bounds_lon_2d & - , bounds_lon_name, comment, data_dim, data_i_index, data_ibegin, data_j_index, data_jbegin, data_ni & - , data_nj, dim_i_name, dim_j_name, domain_ref, i_index, ibegin, j_index, jbegin, lat_name, latvalue_1d & - , latvalue_2d, lon_name, long_name, lonvalue_1d, lonvalue_2d, mask_1d, mask_2d, name, ni, ni_glo & - , nj, nj_glo, nvertex, prec, radius, standard_name, type ) - - END SUBROUTINE xios(set_domain_attr) - - SUBROUTINE xios(set_domain_attr_hdl) & - ( domain_hdl, area, bounds_lat_1d, bounds_lat_2d, bounds_lat_name, bounds_lon_1d, bounds_lon_2d & - , bounds_lon_name, comment, data_dim, data_i_index, data_ibegin, data_j_index, data_jbegin, data_ni & - , data_nj, dim_i_name, dim_j_name, domain_ref, i_index, ibegin, j_index, jbegin, lat_name, latvalue_1d & - , latvalue_2d, lon_name, long_name, lonvalue_1d, lonvalue_2d, mask_1d, mask_2d, name, ni, ni_glo & - , nj, nj_glo, nvertex, prec, radius, standard_name, type ) - - IMPLICIT NONE - TYPE(txios(domain)) , INTENT(IN) :: domain_hdl - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: area(:,:) - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: bounds_lat_1d(:,:) - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: bounds_lat_2d(:,:,:) - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: bounds_lat_name - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: bounds_lon_1d(:,:) - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: bounds_lon_2d(:,:,:) - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: bounds_lon_name - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: comment - INTEGER , OPTIONAL, INTENT(IN) :: data_dim - INTEGER , OPTIONAL, INTENT(IN) :: data_i_index(:) - INTEGER , OPTIONAL, INTENT(IN) :: data_ibegin - INTEGER , OPTIONAL, INTENT(IN) :: data_j_index(:) - INTEGER , OPTIONAL, INTENT(IN) :: data_jbegin - INTEGER , OPTIONAL, INTENT(IN) :: data_ni - INTEGER , OPTIONAL, INTENT(IN) :: data_nj - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: dim_i_name - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: dim_j_name - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: domain_ref - INTEGER , OPTIONAL, INTENT(IN) :: i_index(:) - INTEGER , OPTIONAL, INTENT(IN) :: ibegin - INTEGER , OPTIONAL, INTENT(IN) :: j_index(:) - INTEGER , OPTIONAL, INTENT(IN) :: jbegin - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: lat_name - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: latvalue_1d(:) - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: latvalue_2d(:,:) - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: lon_name - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: long_name - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: lonvalue_1d(:) - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: lonvalue_2d(:,:) - LOGICAL , OPTIONAL, INTENT(IN) :: mask_1d(:) - LOGICAL (KIND=C_BOOL) , ALLOCATABLE :: mask_1d_tmp(:) - LOGICAL , OPTIONAL, INTENT(IN) :: mask_2d(:,:) - LOGICAL (KIND=C_BOOL) , ALLOCATABLE :: mask_2d_tmp(:,:) - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name - INTEGER , OPTIONAL, INTENT(IN) :: ni - INTEGER , OPTIONAL, INTENT(IN) :: ni_glo - INTEGER , OPTIONAL, INTENT(IN) :: nj - INTEGER , OPTIONAL, INTENT(IN) :: nj_glo - INTEGER , OPTIONAL, INTENT(IN) :: nvertex - INTEGER , OPTIONAL, INTENT(IN) :: prec - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: radius - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: standard_name - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type - - CALL xios(set_domain_attr_hdl_) & - ( domain_hdl, area, bounds_lat_1d, bounds_lat_2d, bounds_lat_name, bounds_lon_1d, bounds_lon_2d & - , bounds_lon_name, comment, data_dim, data_i_index, data_ibegin, data_j_index, data_jbegin, data_ni & - , data_nj, dim_i_name, dim_j_name, domain_ref, i_index, ibegin, j_index, jbegin, lat_name, latvalue_1d & - , latvalue_2d, lon_name, long_name, lonvalue_1d, lonvalue_2d, mask_1d, mask_2d, name, ni, ni_glo & - , nj, nj_glo, nvertex, prec, radius, standard_name, type ) - - END SUBROUTINE xios(set_domain_attr_hdl) - - SUBROUTINE xios(set_domain_attr_hdl_) & - ( domain_hdl, area_, bounds_lat_1d_, bounds_lat_2d_, bounds_lat_name_, bounds_lon_1d_, bounds_lon_2d_ & - , bounds_lon_name_, comment_, data_dim_, data_i_index_, data_ibegin_, data_j_index_, data_jbegin_ & - , data_ni_, data_nj_, dim_i_name_, dim_j_name_, domain_ref_, i_index_, ibegin_, j_index_, jbegin_ & - , lat_name_, latvalue_1d_, latvalue_2d_, lon_name_, long_name_, lonvalue_1d_, lonvalue_2d_, mask_1d_ & - , mask_2d_, name_, ni_, ni_glo_, nj_, nj_glo_, nvertex_, prec_, radius_, standard_name_, type_ & - ) - - IMPLICIT NONE - TYPE(txios(domain)) , INTENT(IN) :: domain_hdl - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: area_(:,:) - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: bounds_lat_1d_(:,:) - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: bounds_lat_2d_(:,:,:) - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: bounds_lat_name_ - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: bounds_lon_1d_(:,:) - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: bounds_lon_2d_(:,:,:) - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: bounds_lon_name_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: comment_ - INTEGER , OPTIONAL, INTENT(IN) :: data_dim_ - INTEGER , OPTIONAL, INTENT(IN) :: data_i_index_(:) - INTEGER , OPTIONAL, INTENT(IN) :: data_ibegin_ - INTEGER , OPTIONAL, INTENT(IN) :: data_j_index_(:) - INTEGER , OPTIONAL, INTENT(IN) :: data_jbegin_ - INTEGER , OPTIONAL, INTENT(IN) :: data_ni_ - INTEGER , OPTIONAL, INTENT(IN) :: data_nj_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: dim_i_name_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: dim_j_name_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: domain_ref_ - INTEGER , OPTIONAL, INTENT(IN) :: i_index_(:) - INTEGER , OPTIONAL, INTENT(IN) :: ibegin_ - INTEGER , OPTIONAL, INTENT(IN) :: j_index_(:) - INTEGER , OPTIONAL, INTENT(IN) :: jbegin_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: lat_name_ - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: latvalue_1d_(:) - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: latvalue_2d_(:,:) - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: lon_name_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: long_name_ - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: lonvalue_1d_(:) - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: lonvalue_2d_(:,:) - LOGICAL , OPTIONAL, INTENT(IN) :: mask_1d_(:) - LOGICAL (KIND=C_BOOL) , ALLOCATABLE :: mask_1d__tmp(:) - LOGICAL , OPTIONAL, INTENT(IN) :: mask_2d_(:,:) - LOGICAL (KIND=C_BOOL) , ALLOCATABLE :: mask_2d__tmp(:,:) - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name_ - INTEGER , OPTIONAL, INTENT(IN) :: ni_ - INTEGER , OPTIONAL, INTENT(IN) :: ni_glo_ - INTEGER , OPTIONAL, INTENT(IN) :: nj_ - INTEGER , OPTIONAL, INTENT(IN) :: nj_glo_ - INTEGER , OPTIONAL, INTENT(IN) :: nvertex_ - INTEGER , OPTIONAL, INTENT(IN) :: prec_ - REAL (KIND=8) , OPTIONAL, INTENT(IN) :: radius_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: standard_name_ - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type_ - - IF (PRESENT(area_)) THEN - CALL cxios_set_domain_area & - (domain_hdl%daddr, area_, SHAPE(area_)) - ENDIF - - IF (PRESENT(bounds_lat_1d_)) THEN - CALL cxios_set_domain_bounds_lat_1d & - (domain_hdl%daddr, bounds_lat_1d_, SHAPE(bounds_lat_1d_)) - ENDIF - - IF (PRESENT(bounds_lat_2d_)) THEN - CALL cxios_set_domain_bounds_lat_2d & - (domain_hdl%daddr, bounds_lat_2d_, SHAPE(bounds_lat_2d_)) - ENDIF - - IF (PRESENT(bounds_lat_name_)) THEN - CALL cxios_set_domain_bounds_lat_name & - (domain_hdl%daddr, bounds_lat_name_, len(bounds_lat_name_)) - ENDIF - - IF (PRESENT(bounds_lon_1d_)) THEN - CALL cxios_set_domain_bounds_lon_1d & - (domain_hdl%daddr, bounds_lon_1d_, SHAPE(bounds_lon_1d_)) - ENDIF - - IF (PRESENT(bounds_lon_2d_)) THEN - CALL cxios_set_domain_bounds_lon_2d & - (domain_hdl%daddr, bounds_lon_2d_, SHAPE(bounds_lon_2d_)) - ENDIF - - IF (PRESENT(bounds_lon_name_)) THEN - CALL cxios_set_domain_bounds_lon_name & - (domain_hdl%daddr, bounds_lon_name_, len(bounds_lon_name_)) - ENDIF - - IF (PRESENT(comment_)) THEN - CALL cxios_set_domain_comment & - (domain_hdl%daddr, comment_, len(comment_)) - ENDIF - - IF (PRESENT(data_dim_)) THEN - CALL cxios_set_domain_data_dim & - (domain_hdl%daddr, data_dim_) - ENDIF - - IF (PRESENT(data_i_index_)) THEN - CALL cxios_set_domain_data_i_index & - (domain_hdl%daddr, data_i_index_, SHAPE(data_i_index_)) - ENDIF - - IF (PRESENT(data_ibegin_)) THEN - CALL cxios_set_domain_data_ibegin & - (domain_hdl%daddr, data_ibegin_) - ENDIF - - IF (PRESENT(data_j_index_)) THEN - CALL cxios_set_domain_data_j_index & - (domain_hdl%daddr, data_j_index_, SHAPE(data_j_index_)) - ENDIF - - IF (PRESENT(data_jbegin_)) THEN - CALL cxios_set_domain_data_jbegin & - (domain_hdl%daddr, data_jbegin_) - ENDIF - - IF (PRESENT(data_ni_)) THEN - CALL cxios_set_domain_data_ni & - (domain_hdl%daddr, data_ni_) - ENDIF - - IF (PRESENT(data_nj_)) THEN - CALL cxios_set_domain_data_nj & - (domain_hdl%daddr, data_nj_) - ENDIF - - IF (PRESENT(dim_i_name_)) THEN - CALL cxios_set_domain_dim_i_name & - (domain_hdl%daddr, dim_i_name_, len(dim_i_name_)) - ENDIF - - IF (PRESENT(dim_j_name_)) THEN - CALL cxios_set_domain_dim_j_name & - (domain_hdl%daddr, dim_j_name_, len(dim_j_name_)) - ENDIF - - IF (PRESENT(domain_ref_)) THEN - CALL cxios_set_domain_domain_ref & - (domain_hdl%daddr, domain_ref_, len(domain_ref_)) - ENDIF - - IF (PRESENT(i_index_)) THEN - CALL cxios_set_domain_i_index & - (domain_hdl%daddr, i_index_, SHAPE(i_index_)) - ENDIF - - IF (PRESENT(ibegin_)) THEN - CALL cxios_set_domain_ibegin & - (domain_hdl%daddr, ibegin_) - ENDIF - - IF (PRESENT(j_index_)) THEN - CALL cxios_set_domain_j_index & - (domain_hdl%daddr, j_index_, SHAPE(j_index_)) - ENDIF - - IF (PRESENT(jbegin_)) THEN - CALL cxios_set_domain_jbegin & - (domain_hdl%daddr, jbegin_) - ENDIF - - IF (PRESENT(lat_name_)) THEN - CALL cxios_set_domain_lat_name & - (domain_hdl%daddr, lat_name_, len(lat_name_)) - ENDIF - - IF (PRESENT(latvalue_1d_)) THEN - CALL cxios_set_domain_latvalue_1d & - (domain_hdl%daddr, latvalue_1d_, SHAPE(latvalue_1d_)) - ENDIF - - IF (PRESENT(latvalue_2d_)) THEN - CALL cxios_set_domain_latvalue_2d & - (domain_hdl%daddr, latvalue_2d_, SHAPE(latvalue_2d_)) - ENDIF - - IF (PRESENT(lon_name_)) THEN - CALL cxios_set_domain_lon_name & - (domain_hdl%daddr, lon_name_, len(lon_name_)) - ENDIF - - IF (PRESENT(long_name_)) THEN - CALL cxios_set_domain_long_name & - (domain_hdl%daddr, long_name_, len(long_name_)) - ENDIF - - IF (PRESENT(lonvalue_1d_)) THEN - CALL cxios_set_domain_lonvalue_1d & - (domain_hdl%daddr, lonvalue_1d_, SHAPE(lonvalue_1d_)) - ENDIF - - IF (PRESENT(lonvalue_2d_)) THEN - CALL cxios_set_domain_lonvalue_2d & - (domain_hdl%daddr, lonvalue_2d_, SHAPE(lonvalue_2d_)) - ENDIF - - IF (PRESENT(mask_1d_)) THEN - ALLOCATE(mask_1d__tmp(SIZE(mask_1d_,1))) - mask_1d__tmp = mask_1d_ - CALL cxios_set_domain_mask_1d & - (domain_hdl%daddr, mask_1d__tmp, SHAPE(mask_1d_)) - ENDIF - - IF (PRESENT(mask_2d_)) THEN - ALLOCATE(mask_2d__tmp(SIZE(mask_2d_,1), SIZE(mask_2d_,2))) - mask_2d__tmp = mask_2d_ - CALL cxios_set_domain_mask_2d & - (domain_hdl%daddr, mask_2d__tmp, SHAPE(mask_2d_)) - ENDIF - - IF (PRESENT(name_)) THEN - CALL cxios_set_domain_name & - (domain_hdl%daddr, name_, len(name_)) - ENDIF - - IF (PRESENT(ni_)) THEN - CALL cxios_set_domain_ni & - (domain_hdl%daddr, ni_) - ENDIF - - IF (PRESENT(ni_glo_)) THEN - CALL cxios_set_domain_ni_glo & - (domain_hdl%daddr, ni_glo_) - ENDIF - - IF (PRESENT(nj_)) THEN - CALL cxios_set_domain_nj & - (domain_hdl%daddr, nj_) - ENDIF - - IF (PRESENT(nj_glo_)) THEN - CALL cxios_set_domain_nj_glo & - (domain_hdl%daddr, nj_glo_) - ENDIF - - IF (PRESENT(nvertex_)) THEN - CALL cxios_set_domain_nvertex & - (domain_hdl%daddr, nvertex_) - ENDIF - - IF (PRESENT(prec_)) THEN - CALL cxios_set_domain_prec & - (domain_hdl%daddr, prec_) - ENDIF - - IF (PRESENT(radius_)) THEN - CALL cxios_set_domain_radius & - (domain_hdl%daddr, radius_) - ENDIF - - IF (PRESENT(standard_name_)) THEN - CALL cxios_set_domain_standard_name & - (domain_hdl%daddr, standard_name_, len(standard_name_)) - ENDIF - - IF (PRESENT(type_)) THEN - CALL cxios_set_domain_type & - (domain_hdl%daddr, type_, len(type_)) - ENDIF - - END SUBROUTINE xios(set_domain_attr_hdl_) - - SUBROUTINE xios(get_domain_attr) & - ( domain_id, area, bounds_lat_1d, bounds_lat_2d, bounds_lat_name, bounds_lon_1d, bounds_lon_2d & - , bounds_lon_name, comment, data_dim, data_i_index, data_ibegin, data_j_index, data_jbegin, data_ni & - , data_nj, dim_i_name, dim_j_name, domain_ref, i_index, ibegin, j_index, jbegin, lat_name, latvalue_1d & - , latvalue_2d, lon_name, long_name, lonvalue_1d, lonvalue_2d, mask_1d, mask_2d, name, ni, ni_glo & - , nj, nj_glo, nvertex, prec, radius, standard_name, type ) - - IMPLICIT NONE - TYPE(txios(domain)) :: domain_hdl - CHARACTER(LEN=*), INTENT(IN) ::domain_id - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: area(:,:) - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: bounds_lat_1d(:,:) - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: bounds_lat_2d(:,:,:) - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: bounds_lat_name - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: bounds_lon_1d(:,:) - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: bounds_lon_2d(:,:,:) - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: bounds_lon_name - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: comment - INTEGER , OPTIONAL, INTENT(OUT) :: data_dim - INTEGER , OPTIONAL, INTENT(OUT) :: data_i_index(:) - INTEGER , OPTIONAL, INTENT(OUT) :: data_ibegin - INTEGER , OPTIONAL, INTENT(OUT) :: data_j_index(:) - INTEGER , OPTIONAL, INTENT(OUT) :: data_jbegin - INTEGER , OPTIONAL, INTENT(OUT) :: data_ni - INTEGER , OPTIONAL, INTENT(OUT) :: data_nj - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: dim_i_name - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: dim_j_name - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: domain_ref - INTEGER , OPTIONAL, INTENT(OUT) :: i_index(:) - INTEGER , OPTIONAL, INTENT(OUT) :: ibegin - INTEGER , OPTIONAL, INTENT(OUT) :: j_index(:) - INTEGER , OPTIONAL, INTENT(OUT) :: jbegin - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: lat_name - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: latvalue_1d(:) - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: latvalue_2d(:,:) - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: lon_name - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: long_name - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: lonvalue_1d(:) - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: lonvalue_2d(:,:) - LOGICAL , OPTIONAL, INTENT(OUT) :: mask_1d(:) - LOGICAL (KIND=C_BOOL) , ALLOCATABLE :: mask_1d_tmp(:) - LOGICAL , OPTIONAL, INTENT(OUT) :: mask_2d(:,:) - LOGICAL (KIND=C_BOOL) , ALLOCATABLE :: mask_2d_tmp(:,:) - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name - INTEGER , OPTIONAL, INTENT(OUT) :: ni - INTEGER , OPTIONAL, INTENT(OUT) :: ni_glo - INTEGER , OPTIONAL, INTENT(OUT) :: nj - INTEGER , OPTIONAL, INTENT(OUT) :: nj_glo - INTEGER , OPTIONAL, INTENT(OUT) :: nvertex - INTEGER , OPTIONAL, INTENT(OUT) :: prec - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: radius - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: standard_name - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type - - CALL xios(get_domain_handle) & - (domain_id,domain_hdl) - CALL xios(get_domain_attr_hdl_) & - ( domain_hdl, area, bounds_lat_1d, bounds_lat_2d, bounds_lat_name, bounds_lon_1d, bounds_lon_2d & - , bounds_lon_name, comment, data_dim, data_i_index, data_ibegin, data_j_index, data_jbegin, data_ni & - , data_nj, dim_i_name, dim_j_name, domain_ref, i_index, ibegin, j_index, jbegin, lat_name, latvalue_1d & - , latvalue_2d, lon_name, long_name, lonvalue_1d, lonvalue_2d, mask_1d, mask_2d, name, ni, ni_glo & - , nj, nj_glo, nvertex, prec, radius, standard_name, type ) - - END SUBROUTINE xios(get_domain_attr) - - SUBROUTINE xios(get_domain_attr_hdl) & - ( domain_hdl, area, bounds_lat_1d, bounds_lat_2d, bounds_lat_name, bounds_lon_1d, bounds_lon_2d & - , bounds_lon_name, comment, data_dim, data_i_index, data_ibegin, data_j_index, data_jbegin, data_ni & - , data_nj, dim_i_name, dim_j_name, domain_ref, i_index, ibegin, j_index, jbegin, lat_name, latvalue_1d & - , latvalue_2d, lon_name, long_name, lonvalue_1d, lonvalue_2d, mask_1d, mask_2d, name, ni, ni_glo & - , nj, nj_glo, nvertex, prec, radius, standard_name, type ) - - IMPLICIT NONE - TYPE(txios(domain)) , INTENT(IN) :: domain_hdl - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: area(:,:) - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: bounds_lat_1d(:,:) - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: bounds_lat_2d(:,:,:) - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: bounds_lat_name - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: bounds_lon_1d(:,:) - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: bounds_lon_2d(:,:,:) - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: bounds_lon_name - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: comment - INTEGER , OPTIONAL, INTENT(OUT) :: data_dim - INTEGER , OPTIONAL, INTENT(OUT) :: data_i_index(:) - INTEGER , OPTIONAL, INTENT(OUT) :: data_ibegin - INTEGER , OPTIONAL, INTENT(OUT) :: data_j_index(:) - INTEGER , OPTIONAL, INTENT(OUT) :: data_jbegin - INTEGER , OPTIONAL, INTENT(OUT) :: data_ni - INTEGER , OPTIONAL, INTENT(OUT) :: data_nj - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: dim_i_name - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: dim_j_name - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: domain_ref - INTEGER , OPTIONAL, INTENT(OUT) :: i_index(:) - INTEGER , OPTIONAL, INTENT(OUT) :: ibegin - INTEGER , OPTIONAL, INTENT(OUT) :: j_index(:) - INTEGER , OPTIONAL, INTENT(OUT) :: jbegin - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: lat_name - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: latvalue_1d(:) - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: latvalue_2d(:,:) - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: lon_name - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: long_name - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: lonvalue_1d(:) - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: lonvalue_2d(:,:) - LOGICAL , OPTIONAL, INTENT(OUT) :: mask_1d(:) - LOGICAL (KIND=C_BOOL) , ALLOCATABLE :: mask_1d_tmp(:) - LOGICAL , OPTIONAL, INTENT(OUT) :: mask_2d(:,:) - LOGICAL (KIND=C_BOOL) , ALLOCATABLE :: mask_2d_tmp(:,:) - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name - INTEGER , OPTIONAL, INTENT(OUT) :: ni - INTEGER , OPTIONAL, INTENT(OUT) :: ni_glo - INTEGER , OPTIONAL, INTENT(OUT) :: nj - INTEGER , OPTIONAL, INTENT(OUT) :: nj_glo - INTEGER , OPTIONAL, INTENT(OUT) :: nvertex - INTEGER , OPTIONAL, INTENT(OUT) :: prec - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: radius - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: standard_name - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type - - CALL xios(get_domain_attr_hdl_) & - ( domain_hdl, area, bounds_lat_1d, bounds_lat_2d, bounds_lat_name, bounds_lon_1d, bounds_lon_2d & - , bounds_lon_name, comment, data_dim, data_i_index, data_ibegin, data_j_index, data_jbegin, data_ni & - , data_nj, dim_i_name, dim_j_name, domain_ref, i_index, ibegin, j_index, jbegin, lat_name, latvalue_1d & - , latvalue_2d, lon_name, long_name, lonvalue_1d, lonvalue_2d, mask_1d, mask_2d, name, ni, ni_glo & - , nj, nj_glo, nvertex, prec, radius, standard_name, type ) - - END SUBROUTINE xios(get_domain_attr_hdl) - - SUBROUTINE xios(get_domain_attr_hdl_) & - ( domain_hdl, area_, bounds_lat_1d_, bounds_lat_2d_, bounds_lat_name_, bounds_lon_1d_, bounds_lon_2d_ & - , bounds_lon_name_, comment_, data_dim_, data_i_index_, data_ibegin_, data_j_index_, data_jbegin_ & - , data_ni_, data_nj_, dim_i_name_, dim_j_name_, domain_ref_, i_index_, ibegin_, j_index_, jbegin_ & - , lat_name_, latvalue_1d_, latvalue_2d_, lon_name_, long_name_, lonvalue_1d_, lonvalue_2d_, mask_1d_ & - , mask_2d_, name_, ni_, ni_glo_, nj_, nj_glo_, nvertex_, prec_, radius_, standard_name_, type_ & - ) - - IMPLICIT NONE - TYPE(txios(domain)) , INTENT(IN) :: domain_hdl - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: area_(:,:) - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: bounds_lat_1d_(:,:) - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: bounds_lat_2d_(:,:,:) - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: bounds_lat_name_ - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: bounds_lon_1d_(:,:) - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: bounds_lon_2d_(:,:,:) - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: bounds_lon_name_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: comment_ - INTEGER , OPTIONAL, INTENT(OUT) :: data_dim_ - INTEGER , OPTIONAL, INTENT(OUT) :: data_i_index_(:) - INTEGER , OPTIONAL, INTENT(OUT) :: data_ibegin_ - INTEGER , OPTIONAL, INTENT(OUT) :: data_j_index_(:) - INTEGER , OPTIONAL, INTENT(OUT) :: data_jbegin_ - INTEGER , OPTIONAL, INTENT(OUT) :: data_ni_ - INTEGER , OPTIONAL, INTENT(OUT) :: data_nj_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: dim_i_name_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: dim_j_name_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: domain_ref_ - INTEGER , OPTIONAL, INTENT(OUT) :: i_index_(:) - INTEGER , OPTIONAL, INTENT(OUT) :: ibegin_ - INTEGER , OPTIONAL, INTENT(OUT) :: j_index_(:) - INTEGER , OPTIONAL, INTENT(OUT) :: jbegin_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: lat_name_ - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: latvalue_1d_(:) - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: latvalue_2d_(:,:) - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: lon_name_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: long_name_ - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: lonvalue_1d_(:) - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: lonvalue_2d_(:,:) - LOGICAL , OPTIONAL, INTENT(OUT) :: mask_1d_(:) - LOGICAL (KIND=C_BOOL) , ALLOCATABLE :: mask_1d__tmp(:) - LOGICAL , OPTIONAL, INTENT(OUT) :: mask_2d_(:,:) - LOGICAL (KIND=C_BOOL) , ALLOCATABLE :: mask_2d__tmp(:,:) - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name_ - INTEGER , OPTIONAL, INTENT(OUT) :: ni_ - INTEGER , OPTIONAL, INTENT(OUT) :: ni_glo_ - INTEGER , OPTIONAL, INTENT(OUT) :: nj_ - INTEGER , OPTIONAL, INTENT(OUT) :: nj_glo_ - INTEGER , OPTIONAL, INTENT(OUT) :: nvertex_ - INTEGER , OPTIONAL, INTENT(OUT) :: prec_ - REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: radius_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: standard_name_ - CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type_ - - IF (PRESENT(area_)) THEN - CALL cxios_get_domain_area & - (domain_hdl%daddr, area_, SHAPE(area_)) - ENDIF - - IF (PRESENT(bounds_lat_1d_)) THEN - CALL cxios_get_domain_bounds_lat_1d & - (domain_hdl%daddr, bounds_lat_1d_, SHAPE(bounds_lat_1d_)) - ENDIF - - IF (PRESENT(bounds_lat_2d_)) THEN - CALL cxios_get_domain_bounds_lat_2d & - (domain_hdl%daddr, bounds_lat_2d_, SHAPE(bounds_lat_2d_)) - ENDIF - - IF (PRESENT(bounds_lat_name_)) THEN - CALL cxios_get_domain_bounds_lat_name & - (domain_hdl%daddr, bounds_lat_name_, len(bounds_lat_name_)) - ENDIF - - IF (PRESENT(bounds_lon_1d_)) THEN - CALL cxios_get_domain_bounds_lon_1d & - (domain_hdl%daddr, bounds_lon_1d_, SHAPE(bounds_lon_1d_)) - ENDIF - - IF (PRESENT(bounds_lon_2d_)) THEN - CALL cxios_get_domain_bounds_lon_2d & - (domain_hdl%daddr, bounds_lon_2d_, SHAPE(bounds_lon_2d_)) - ENDIF - - IF (PRESENT(bounds_lon_name_)) THEN - CALL cxios_get_domain_bounds_lon_name & - (domain_hdl%daddr, bounds_lon_name_, len(bounds_lon_name_)) - ENDIF - - IF (PRESENT(comment_)) THEN - CALL cxios_get_domain_comment & - (domain_hdl%daddr, comment_, len(comment_)) - ENDIF - - IF (PRESENT(data_dim_)) THEN - CALL cxios_get_domain_data_dim & - (domain_hdl%daddr, data_dim_) - ENDIF - - IF (PRESENT(data_i_index_)) THEN - CALL cxios_get_domain_data_i_index & - (domain_hdl%daddr, data_i_index_, SHAPE(data_i_index_)) - ENDIF - - IF (PRESENT(data_ibegin_)) THEN - CALL cxios_get_domain_data_ibegin & - (domain_hdl%daddr, data_ibegin_) - ENDIF - - IF (PRESENT(data_j_index_)) THEN - CALL cxios_get_domain_data_j_index & - (domain_hdl%daddr, data_j_index_, SHAPE(data_j_index_)) - ENDIF - - IF (PRESENT(data_jbegin_)) THEN - CALL cxios_get_domain_data_jbegin & - (domain_hdl%daddr, data_jbegin_) - ENDIF - - IF (PRESENT(data_ni_)) THEN - CALL cxios_get_domain_data_ni & - (domain_hdl%daddr, data_ni_) - ENDIF - - IF (PRESENT(data_nj_)) THEN - CALL cxios_get_domain_data_nj & - (domain_hdl%daddr, data_nj_) - ENDIF - - IF (PRESENT(dim_i_name_)) THEN - CALL cxios_get_domain_dim_i_name & - (domain_hdl%daddr, dim_i_name_, len(dim_i_name_)) - ENDIF - - IF (PRESENT(dim_j_name_)) THEN - CALL cxios_get_domain_dim_j_name & - (domain_hdl%daddr, dim_j_name_, len(dim_j_name_)) - ENDIF - - IF (PRESENT(domain_ref_)) THEN - CALL cxios_get_domain_domain_ref & - (domain_hdl%daddr, domain_ref_, len(domain_ref_)) - ENDIF - - IF (PRESENT(i_index_)) THEN - CALL cxios_get_domain_i_index & - (domain_hdl%daddr, i_index_, SHAPE(i_index_)) - ENDIF - - IF (PRESENT(ibegin_)) THEN - CALL cxios_get_domain_ibegin & - (domain_hdl%daddr, ibegin_) - ENDIF - - IF (PRESENT(j_index_)) THEN - CALL cxios_get_domain_j_index & - (domain_hdl%daddr, j_index_, SHAPE(j_index_)) - ENDIF - - IF (PRESENT(jbegin_)) THEN - CALL cxios_get_domain_jbegin & - (domain_hdl%daddr, jbegin_) - ENDIF - - IF (PRESENT(lat_name_)) THEN - CALL cxios_get_domain_lat_name & - (domain_hdl%daddr, lat_name_, len(lat_name_)) - ENDIF - - IF (PRESENT(latvalue_1d_)) THEN - CALL cxios_get_domain_latvalue_1d & - (domain_hdl%daddr, latvalue_1d_, SHAPE(latvalue_1d_)) - ENDIF - - IF (PRESENT(latvalue_2d_)) THEN - CALL cxios_get_domain_latvalue_2d & - (domain_hdl%daddr, latvalue_2d_, SHAPE(latvalue_2d_)) - ENDIF - - IF (PRESENT(lon_name_)) THEN - CALL cxios_get_domain_lon_name & - (domain_hdl%daddr, lon_name_, len(lon_name_)) - ENDIF - - IF (PRESENT(long_name_)) THEN - CALL cxios_get_domain_long_name & - (domain_hdl%daddr, long_name_, len(long_name_)) - ENDIF - - IF (PRESENT(lonvalue_1d_)) THEN - CALL cxios_get_domain_lonvalue_1d & - (domain_hdl%daddr, lonvalue_1d_, SHAPE(lonvalue_1d_)) - ENDIF - - IF (PRESENT(lonvalue_2d_)) THEN - CALL cxios_get_domain_lonvalue_2d & - (domain_hdl%daddr, lonvalue_2d_, SHAPE(lonvalue_2d_)) - ENDIF - - IF (PRESENT(mask_1d_)) THEN - ALLOCATE(mask_1d__tmp(SIZE(mask_1d_,1))) - CALL cxios_get_domain_mask_1d & - (domain_hdl%daddr, mask_1d__tmp, SHAPE(mask_1d_)) - mask_1d_ = mask_1d__tmp - ENDIF - - IF (PRESENT(mask_2d_)) THEN - ALLOCATE(mask_2d__tmp(SIZE(mask_2d_,1), SIZE(mask_2d_,2))) - CALL cxios_get_domain_mask_2d & - (domain_hdl%daddr, mask_2d__tmp, SHAPE(mask_2d_)) - mask_2d_ = mask_2d__tmp - ENDIF - - IF (PRESENT(name_)) THEN - CALL cxios_get_domain_name & - (domain_hdl%daddr, name_, len(name_)) - ENDIF - - IF (PRESENT(ni_)) THEN - CALL cxios_get_domain_ni & - (domain_hdl%daddr, ni_) - ENDIF - - IF (PRESENT(ni_glo_)) THEN - CALL cxios_get_domain_ni_glo & - (domain_hdl%daddr, ni_glo_) - ENDIF - - IF (PRESENT(nj_)) THEN - CALL cxios_get_domain_nj & - (domain_hdl%daddr, nj_) - ENDIF - - IF (PRESENT(nj_glo_)) THEN - CALL cxios_get_domain_nj_glo & - (domain_hdl%daddr, nj_glo_) - ENDIF - - IF (PRESENT(nvertex_)) THEN - CALL cxios_get_domain_nvertex & - (domain_hdl%daddr, nvertex_) - ENDIF - - IF (PRESENT(prec_)) THEN - CALL cxios_get_domain_prec & - (domain_hdl%daddr, prec_) - ENDIF - - IF (PRESENT(radius_)) THEN - CALL cxios_get_domain_radius & - (domain_hdl%daddr, radius_) - ENDIF - - IF (PRESENT(standard_name_)) THEN - CALL cxios_get_domain_standard_name & - (domain_hdl%daddr, standard_name_, len(standard_name_)) - ENDIF - - IF (PRESENT(type_)) THEN - CALL cxios_get_domain_type & - (domain_hdl%daddr, type_, len(type_)) - ENDIF - - END SUBROUTINE xios(get_domain_attr_hdl_) - - SUBROUTINE xios(is_defined_domain_attr) & - ( domain_id, area, bounds_lat_1d, bounds_lat_2d, bounds_lat_name, bounds_lon_1d, bounds_lon_2d & - , bounds_lon_name, comment, data_dim, data_i_index, data_ibegin, data_j_index, data_jbegin, data_ni & - , data_nj, dim_i_name, dim_j_name, domain_ref, i_index, ibegin, j_index, jbegin, lat_name, latvalue_1d & - , latvalue_2d, lon_name, long_name, lonvalue_1d, lonvalue_2d, mask_1d, mask_2d, name, ni, ni_glo & - , nj, nj_glo, nvertex, prec, radius, standard_name, type ) - - IMPLICIT NONE - TYPE(txios(domain)) :: domain_hdl - CHARACTER(LEN=*), INTENT(IN) ::domain_id - LOGICAL, OPTIONAL, INTENT(OUT) :: area - LOGICAL(KIND=C_BOOL) :: area_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: bounds_lat_1d - LOGICAL(KIND=C_BOOL) :: bounds_lat_1d_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: bounds_lat_2d - LOGICAL(KIND=C_BOOL) :: bounds_lat_2d_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: bounds_lat_name - LOGICAL(KIND=C_BOOL) :: bounds_lat_name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: bounds_lon_1d - LOGICAL(KIND=C_BOOL) :: bounds_lon_1d_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: bounds_lon_2d - LOGICAL(KIND=C_BOOL) :: bounds_lon_2d_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: bounds_lon_name - LOGICAL(KIND=C_BOOL) :: bounds_lon_name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: comment - LOGICAL(KIND=C_BOOL) :: comment_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: data_dim - LOGICAL(KIND=C_BOOL) :: data_dim_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: data_i_index - LOGICAL(KIND=C_BOOL) :: data_i_index_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: data_ibegin - LOGICAL(KIND=C_BOOL) :: data_ibegin_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: data_j_index - LOGICAL(KIND=C_BOOL) :: data_j_index_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: data_jbegin - LOGICAL(KIND=C_BOOL) :: data_jbegin_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: data_ni - LOGICAL(KIND=C_BOOL) :: data_ni_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: data_nj - LOGICAL(KIND=C_BOOL) :: data_nj_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: dim_i_name - LOGICAL(KIND=C_BOOL) :: dim_i_name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: dim_j_name - LOGICAL(KIND=C_BOOL) :: dim_j_name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: domain_ref - LOGICAL(KIND=C_BOOL) :: domain_ref_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: i_index - LOGICAL(KIND=C_BOOL) :: i_index_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: ibegin - LOGICAL(KIND=C_BOOL) :: ibegin_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: j_index - LOGICAL(KIND=C_BOOL) :: j_index_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: jbegin - LOGICAL(KIND=C_BOOL) :: jbegin_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: lat_name - LOGICAL(KIND=C_BOOL) :: lat_name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: latvalue_1d - LOGICAL(KIND=C_BOOL) :: latvalue_1d_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: latvalue_2d - LOGICAL(KIND=C_BOOL) :: latvalue_2d_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: lon_name - LOGICAL(KIND=C_BOOL) :: lon_name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: long_name - LOGICAL(KIND=C_BOOL) :: long_name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: lonvalue_1d - LOGICAL(KIND=C_BOOL) :: lonvalue_1d_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: lonvalue_2d - LOGICAL(KIND=C_BOOL) :: lonvalue_2d_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: mask_1d - LOGICAL(KIND=C_BOOL) :: mask_1d_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: mask_2d - LOGICAL(KIND=C_BOOL) :: mask_2d_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: name - LOGICAL(KIND=C_BOOL) :: name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: ni - LOGICAL(KIND=C_BOOL) :: ni_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: ni_glo - LOGICAL(KIND=C_BOOL) :: ni_glo_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: nj - LOGICAL(KIND=C_BOOL) :: nj_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: nj_glo - LOGICAL(KIND=C_BOOL) :: nj_glo_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: nvertex - LOGICAL(KIND=C_BOOL) :: nvertex_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: prec - LOGICAL(KIND=C_BOOL) :: prec_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: radius - LOGICAL(KIND=C_BOOL) :: radius_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: standard_name - LOGICAL(KIND=C_BOOL) :: standard_name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: type - LOGICAL(KIND=C_BOOL) :: type_tmp - - CALL xios(get_domain_handle) & - (domain_id,domain_hdl) - CALL xios(is_defined_domain_attr_hdl_) & - ( domain_hdl, area, bounds_lat_1d, bounds_lat_2d, bounds_lat_name, bounds_lon_1d, bounds_lon_2d & - , bounds_lon_name, comment, data_dim, data_i_index, data_ibegin, data_j_index, data_jbegin, data_ni & - , data_nj, dim_i_name, dim_j_name, domain_ref, i_index, ibegin, j_index, jbegin, lat_name, latvalue_1d & - , latvalue_2d, lon_name, long_name, lonvalue_1d, lonvalue_2d, mask_1d, mask_2d, name, ni, ni_glo & - , nj, nj_glo, nvertex, prec, radius, standard_name, type ) - - END SUBROUTINE xios(is_defined_domain_attr) - - SUBROUTINE xios(is_defined_domain_attr_hdl) & - ( domain_hdl, area, bounds_lat_1d, bounds_lat_2d, bounds_lat_name, bounds_lon_1d, bounds_lon_2d & - , bounds_lon_name, comment, data_dim, data_i_index, data_ibegin, data_j_index, data_jbegin, data_ni & - , data_nj, dim_i_name, dim_j_name, domain_ref, i_index, ibegin, j_index, jbegin, lat_name, latvalue_1d & - , latvalue_2d, lon_name, long_name, lonvalue_1d, lonvalue_2d, mask_1d, mask_2d, name, ni, ni_glo & - , nj, nj_glo, nvertex, prec, radius, standard_name, type ) - - IMPLICIT NONE - TYPE(txios(domain)) , INTENT(IN) :: domain_hdl - LOGICAL, OPTIONAL, INTENT(OUT) :: area - LOGICAL(KIND=C_BOOL) :: area_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: bounds_lat_1d - LOGICAL(KIND=C_BOOL) :: bounds_lat_1d_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: bounds_lat_2d - LOGICAL(KIND=C_BOOL) :: bounds_lat_2d_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: bounds_lat_name - LOGICAL(KIND=C_BOOL) :: bounds_lat_name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: bounds_lon_1d - LOGICAL(KIND=C_BOOL) :: bounds_lon_1d_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: bounds_lon_2d - LOGICAL(KIND=C_BOOL) :: bounds_lon_2d_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: bounds_lon_name - LOGICAL(KIND=C_BOOL) :: bounds_lon_name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: comment - LOGICAL(KIND=C_BOOL) :: comment_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: data_dim - LOGICAL(KIND=C_BOOL) :: data_dim_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: data_i_index - LOGICAL(KIND=C_BOOL) :: data_i_index_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: data_ibegin - LOGICAL(KIND=C_BOOL) :: data_ibegin_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: data_j_index - LOGICAL(KIND=C_BOOL) :: data_j_index_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: data_jbegin - LOGICAL(KIND=C_BOOL) :: data_jbegin_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: data_ni - LOGICAL(KIND=C_BOOL) :: data_ni_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: data_nj - LOGICAL(KIND=C_BOOL) :: data_nj_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: dim_i_name - LOGICAL(KIND=C_BOOL) :: dim_i_name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: dim_j_name - LOGICAL(KIND=C_BOOL) :: dim_j_name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: domain_ref - LOGICAL(KIND=C_BOOL) :: domain_ref_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: i_index - LOGICAL(KIND=C_BOOL) :: i_index_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: ibegin - LOGICAL(KIND=C_BOOL) :: ibegin_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: j_index - LOGICAL(KIND=C_BOOL) :: j_index_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: jbegin - LOGICAL(KIND=C_BOOL) :: jbegin_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: lat_name - LOGICAL(KIND=C_BOOL) :: lat_name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: latvalue_1d - LOGICAL(KIND=C_BOOL) :: latvalue_1d_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: latvalue_2d - LOGICAL(KIND=C_BOOL) :: latvalue_2d_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: lon_name - LOGICAL(KIND=C_BOOL) :: lon_name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: long_name - LOGICAL(KIND=C_BOOL) :: long_name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: lonvalue_1d - LOGICAL(KIND=C_BOOL) :: lonvalue_1d_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: lonvalue_2d - LOGICAL(KIND=C_BOOL) :: lonvalue_2d_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: mask_1d - LOGICAL(KIND=C_BOOL) :: mask_1d_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: mask_2d - LOGICAL(KIND=C_BOOL) :: mask_2d_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: name - LOGICAL(KIND=C_BOOL) :: name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: ni - LOGICAL(KIND=C_BOOL) :: ni_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: ni_glo - LOGICAL(KIND=C_BOOL) :: ni_glo_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: nj - LOGICAL(KIND=C_BOOL) :: nj_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: nj_glo - LOGICAL(KIND=C_BOOL) :: nj_glo_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: nvertex - LOGICAL(KIND=C_BOOL) :: nvertex_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: prec - LOGICAL(KIND=C_BOOL) :: prec_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: radius - LOGICAL(KIND=C_BOOL) :: radius_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: standard_name - LOGICAL(KIND=C_BOOL) :: standard_name_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: type - LOGICAL(KIND=C_BOOL) :: type_tmp - - CALL xios(is_defined_domain_attr_hdl_) & - ( domain_hdl, area, bounds_lat_1d, bounds_lat_2d, bounds_lat_name, bounds_lon_1d, bounds_lon_2d & - , bounds_lon_name, comment, data_dim, data_i_index, data_ibegin, data_j_index, data_jbegin, data_ni & - , data_nj, dim_i_name, dim_j_name, domain_ref, i_index, ibegin, j_index, jbegin, lat_name, latvalue_1d & - , latvalue_2d, lon_name, long_name, lonvalue_1d, lonvalue_2d, mask_1d, mask_2d, name, ni, ni_glo & - , nj, nj_glo, nvertex, prec, radius, standard_name, type ) - - END SUBROUTINE xios(is_defined_domain_attr_hdl) - - SUBROUTINE xios(is_defined_domain_attr_hdl_) & - ( domain_hdl, area_, bounds_lat_1d_, bounds_lat_2d_, bounds_lat_name_, bounds_lon_1d_, bounds_lon_2d_ & - , bounds_lon_name_, comment_, data_dim_, data_i_index_, data_ibegin_, data_j_index_, data_jbegin_ & - , data_ni_, data_nj_, dim_i_name_, dim_j_name_, domain_ref_, i_index_, ibegin_, j_index_, jbegin_ & - , lat_name_, latvalue_1d_, latvalue_2d_, lon_name_, long_name_, lonvalue_1d_, lonvalue_2d_, mask_1d_ & - , mask_2d_, name_, ni_, ni_glo_, nj_, nj_glo_, nvertex_, prec_, radius_, standard_name_, type_ & - ) - - IMPLICIT NONE - TYPE(txios(domain)) , INTENT(IN) :: domain_hdl - LOGICAL, OPTIONAL, INTENT(OUT) :: area_ - LOGICAL(KIND=C_BOOL) :: area__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: bounds_lat_1d_ - LOGICAL(KIND=C_BOOL) :: bounds_lat_1d__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: bounds_lat_2d_ - LOGICAL(KIND=C_BOOL) :: bounds_lat_2d__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: bounds_lat_name_ - LOGICAL(KIND=C_BOOL) :: bounds_lat_name__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: bounds_lon_1d_ - LOGICAL(KIND=C_BOOL) :: bounds_lon_1d__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: bounds_lon_2d_ - LOGICAL(KIND=C_BOOL) :: bounds_lon_2d__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: bounds_lon_name_ - LOGICAL(KIND=C_BOOL) :: bounds_lon_name__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: comment_ - LOGICAL(KIND=C_BOOL) :: comment__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: data_dim_ - LOGICAL(KIND=C_BOOL) :: data_dim__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: data_i_index_ - LOGICAL(KIND=C_BOOL) :: data_i_index__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: data_ibegin_ - LOGICAL(KIND=C_BOOL) :: data_ibegin__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: data_j_index_ - LOGICAL(KIND=C_BOOL) :: data_j_index__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: data_jbegin_ - LOGICAL(KIND=C_BOOL) :: data_jbegin__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: data_ni_ - LOGICAL(KIND=C_BOOL) :: data_ni__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: data_nj_ - LOGICAL(KIND=C_BOOL) :: data_nj__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: dim_i_name_ - LOGICAL(KIND=C_BOOL) :: dim_i_name__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: dim_j_name_ - LOGICAL(KIND=C_BOOL) :: dim_j_name__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: domain_ref_ - LOGICAL(KIND=C_BOOL) :: domain_ref__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: i_index_ - LOGICAL(KIND=C_BOOL) :: i_index__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: ibegin_ - LOGICAL(KIND=C_BOOL) :: ibegin__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: j_index_ - LOGICAL(KIND=C_BOOL) :: j_index__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: jbegin_ - LOGICAL(KIND=C_BOOL) :: jbegin__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: lat_name_ - LOGICAL(KIND=C_BOOL) :: lat_name__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: latvalue_1d_ - LOGICAL(KIND=C_BOOL) :: latvalue_1d__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: latvalue_2d_ - LOGICAL(KIND=C_BOOL) :: latvalue_2d__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: lon_name_ - LOGICAL(KIND=C_BOOL) :: lon_name__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: long_name_ - LOGICAL(KIND=C_BOOL) :: long_name__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: lonvalue_1d_ - LOGICAL(KIND=C_BOOL) :: lonvalue_1d__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: lonvalue_2d_ - LOGICAL(KIND=C_BOOL) :: lonvalue_2d__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: mask_1d_ - LOGICAL(KIND=C_BOOL) :: mask_1d__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: mask_2d_ - LOGICAL(KIND=C_BOOL) :: mask_2d__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: name_ - LOGICAL(KIND=C_BOOL) :: name__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: ni_ - LOGICAL(KIND=C_BOOL) :: ni__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: ni_glo_ - LOGICAL(KIND=C_BOOL) :: ni_glo__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: nj_ - LOGICAL(KIND=C_BOOL) :: nj__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: nj_glo_ - LOGICAL(KIND=C_BOOL) :: nj_glo__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: nvertex_ - LOGICAL(KIND=C_BOOL) :: nvertex__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: prec_ - LOGICAL(KIND=C_BOOL) :: prec__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: radius_ - LOGICAL(KIND=C_BOOL) :: radius__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: standard_name_ - LOGICAL(KIND=C_BOOL) :: standard_name__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: type_ - LOGICAL(KIND=C_BOOL) :: type__tmp - - IF (PRESENT(area_)) THEN - area__tmp = cxios_is_defined_domain_area & - (domain_hdl%daddr) - area_ = area__tmp - ENDIF - - IF (PRESENT(bounds_lat_1d_)) THEN - bounds_lat_1d__tmp = cxios_is_defined_domain_bounds_lat_1d & - (domain_hdl%daddr) - bounds_lat_1d_ = bounds_lat_1d__tmp - ENDIF - - IF (PRESENT(bounds_lat_2d_)) THEN - bounds_lat_2d__tmp = cxios_is_defined_domain_bounds_lat_2d & - (domain_hdl%daddr) - bounds_lat_2d_ = bounds_lat_2d__tmp - ENDIF - - IF (PRESENT(bounds_lat_name_)) THEN - bounds_lat_name__tmp = cxios_is_defined_domain_bounds_lat_name & - (domain_hdl%daddr) - bounds_lat_name_ = bounds_lat_name__tmp - ENDIF - - IF (PRESENT(bounds_lon_1d_)) THEN - bounds_lon_1d__tmp = cxios_is_defined_domain_bounds_lon_1d & - (domain_hdl%daddr) - bounds_lon_1d_ = bounds_lon_1d__tmp - ENDIF - - IF (PRESENT(bounds_lon_2d_)) THEN - bounds_lon_2d__tmp = cxios_is_defined_domain_bounds_lon_2d & - (domain_hdl%daddr) - bounds_lon_2d_ = bounds_lon_2d__tmp - ENDIF - - IF (PRESENT(bounds_lon_name_)) THEN - bounds_lon_name__tmp = cxios_is_defined_domain_bounds_lon_name & - (domain_hdl%daddr) - bounds_lon_name_ = bounds_lon_name__tmp - ENDIF - - IF (PRESENT(comment_)) THEN - comment__tmp = cxios_is_defined_domain_comment & - (domain_hdl%daddr) - comment_ = comment__tmp - ENDIF - - IF (PRESENT(data_dim_)) THEN - data_dim__tmp = cxios_is_defined_domain_data_dim & - (domain_hdl%daddr) - data_dim_ = data_dim__tmp - ENDIF - - IF (PRESENT(data_i_index_)) THEN - data_i_index__tmp = cxios_is_defined_domain_data_i_index & - (domain_hdl%daddr) - data_i_index_ = data_i_index__tmp - ENDIF - - IF (PRESENT(data_ibegin_)) THEN - data_ibegin__tmp = cxios_is_defined_domain_data_ibegin & - (domain_hdl%daddr) - data_ibegin_ = data_ibegin__tmp - ENDIF - - IF (PRESENT(data_j_index_)) THEN - data_j_index__tmp = cxios_is_defined_domain_data_j_index & - (domain_hdl%daddr) - data_j_index_ = data_j_index__tmp - ENDIF - - IF (PRESENT(data_jbegin_)) THEN - data_jbegin__tmp = cxios_is_defined_domain_data_jbegin & - (domain_hdl%daddr) - data_jbegin_ = data_jbegin__tmp - ENDIF - - IF (PRESENT(data_ni_)) THEN - data_ni__tmp = cxios_is_defined_domain_data_ni & - (domain_hdl%daddr) - data_ni_ = data_ni__tmp - ENDIF - - IF (PRESENT(data_nj_)) THEN - data_nj__tmp = cxios_is_defined_domain_data_nj & - (domain_hdl%daddr) - data_nj_ = data_nj__tmp - ENDIF - - IF (PRESENT(dim_i_name_)) THEN - dim_i_name__tmp = cxios_is_defined_domain_dim_i_name & - (domain_hdl%daddr) - dim_i_name_ = dim_i_name__tmp - ENDIF - - IF (PRESENT(dim_j_name_)) THEN - dim_j_name__tmp = cxios_is_defined_domain_dim_j_name & - (domain_hdl%daddr) - dim_j_name_ = dim_j_name__tmp - ENDIF - - IF (PRESENT(domain_ref_)) THEN - domain_ref__tmp = cxios_is_defined_domain_domain_ref & - (domain_hdl%daddr) - domain_ref_ = domain_ref__tmp - ENDIF - - IF (PRESENT(i_index_)) THEN - i_index__tmp = cxios_is_defined_domain_i_index & - (domain_hdl%daddr) - i_index_ = i_index__tmp - ENDIF - - IF (PRESENT(ibegin_)) THEN - ibegin__tmp = cxios_is_defined_domain_ibegin & - (domain_hdl%daddr) - ibegin_ = ibegin__tmp - ENDIF - - IF (PRESENT(j_index_)) THEN - j_index__tmp = cxios_is_defined_domain_j_index & - (domain_hdl%daddr) - j_index_ = j_index__tmp - ENDIF - - IF (PRESENT(jbegin_)) THEN - jbegin__tmp = cxios_is_defined_domain_jbegin & - (domain_hdl%daddr) - jbegin_ = jbegin__tmp - ENDIF - - IF (PRESENT(lat_name_)) THEN - lat_name__tmp = cxios_is_defined_domain_lat_name & - (domain_hdl%daddr) - lat_name_ = lat_name__tmp - ENDIF - - IF (PRESENT(latvalue_1d_)) THEN - latvalue_1d__tmp = cxios_is_defined_domain_latvalue_1d & - (domain_hdl%daddr) - latvalue_1d_ = latvalue_1d__tmp - ENDIF - - IF (PRESENT(latvalue_2d_)) THEN - latvalue_2d__tmp = cxios_is_defined_domain_latvalue_2d & - (domain_hdl%daddr) - latvalue_2d_ = latvalue_2d__tmp - ENDIF - - IF (PRESENT(lon_name_)) THEN - lon_name__tmp = cxios_is_defined_domain_lon_name & - (domain_hdl%daddr) - lon_name_ = lon_name__tmp - ENDIF - - IF (PRESENT(long_name_)) THEN - long_name__tmp = cxios_is_defined_domain_long_name & - (domain_hdl%daddr) - long_name_ = long_name__tmp - ENDIF - - IF (PRESENT(lonvalue_1d_)) THEN - lonvalue_1d__tmp = cxios_is_defined_domain_lonvalue_1d & - (domain_hdl%daddr) - lonvalue_1d_ = lonvalue_1d__tmp - ENDIF - - IF (PRESENT(lonvalue_2d_)) THEN - lonvalue_2d__tmp = cxios_is_defined_domain_lonvalue_2d & - (domain_hdl%daddr) - lonvalue_2d_ = lonvalue_2d__tmp - ENDIF - - IF (PRESENT(mask_1d_)) THEN - mask_1d__tmp = cxios_is_defined_domain_mask_1d & - (domain_hdl%daddr) - mask_1d_ = mask_1d__tmp - ENDIF - - IF (PRESENT(mask_2d_)) THEN - mask_2d__tmp = cxios_is_defined_domain_mask_2d & - (domain_hdl%daddr) - mask_2d_ = mask_2d__tmp - ENDIF - - IF (PRESENT(name_)) THEN - name__tmp = cxios_is_defined_domain_name & - (domain_hdl%daddr) - name_ = name__tmp - ENDIF - - IF (PRESENT(ni_)) THEN - ni__tmp = cxios_is_defined_domain_ni & - (domain_hdl%daddr) - ni_ = ni__tmp - ENDIF - - IF (PRESENT(ni_glo_)) THEN - ni_glo__tmp = cxios_is_defined_domain_ni_glo & - (domain_hdl%daddr) - ni_glo_ = ni_glo__tmp - ENDIF - - IF (PRESENT(nj_)) THEN - nj__tmp = cxios_is_defined_domain_nj & - (domain_hdl%daddr) - nj_ = nj__tmp - ENDIF - - IF (PRESENT(nj_glo_)) THEN - nj_glo__tmp = cxios_is_defined_domain_nj_glo & - (domain_hdl%daddr) - nj_glo_ = nj_glo__tmp - ENDIF - - IF (PRESENT(nvertex_)) THEN - nvertex__tmp = cxios_is_defined_domain_nvertex & - (domain_hdl%daddr) - nvertex_ = nvertex__tmp - ENDIF - - IF (PRESENT(prec_)) THEN - prec__tmp = cxios_is_defined_domain_prec & - (domain_hdl%daddr) - prec_ = prec__tmp - ENDIF - - IF (PRESENT(radius_)) THEN - radius__tmp = cxios_is_defined_domain_radius & - (domain_hdl%daddr) - radius_ = radius__tmp - ENDIF - - IF (PRESENT(standard_name_)) THEN - standard_name__tmp = cxios_is_defined_domain_standard_name & - (domain_hdl%daddr) - standard_name_ = standard_name__tmp - ENDIF - - IF (PRESENT(type_)) THEN - type__tmp = cxios_is_defined_domain_type & - (domain_hdl%daddr) - type_ = type__tmp - ENDIF - - END SUBROUTINE xios(is_defined_domain_attr_hdl_) - -END MODULE idomain_attr diff --git a/xios_2311_src/trunk/.svn/pristine/54/54dfe3664b652e30064132f19204cb76c0afd249.svn-base b/xios_2311_src/trunk/.svn/pristine/54/54dfe3664b652e30064132f19204cb76c0afd249.svn-base deleted file mode 100644 index 58eb403f651bf4f0e7a01b3646f069754be78a67..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/54/54dfe3664b652e30064132f19204cb76c0afd249.svn-base +++ /dev/null @@ -1,2 +0,0 @@ -DECLARE_ENUM4(operation, min, max, sum, average) -DECLARE_ATTRIBUTE(bool, local) diff --git a/xios_2311_src/trunk/.svn/pristine/55/550a2a31b92b17ac611899e03f7b03f8b85af0a4.svn-base b/xios_2311_src/trunk/.svn/pristine/55/550a2a31b92b17ac611899e03f7b03f8b85af0a4.svn-base deleted file mode 100644 index d476f7a43d678dba7c0cd25d32529f67bf6556a8..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/55/550a2a31b92b17ac611899e03f7b03f8b85af0a4.svn-base +++ /dev/null @@ -1,154 +0,0 @@ -%{ -#include "filter_expr_node.hpp" -#include -#include -#include "exception.hpp" - -using namespace std; -using namespace xios; - -extern "C" -{ - int yyparse(void); - int yylex(void); - int yyerror(const char *s); -} - - IFilterExprNode* parsed; - std::string globalInputText; - size_t globalReadOffset = 0; - - int readInputForLexer(char* buffer, size_t* numBytesRead, size_t maxBytesToRead) - { - size_t numBytesToRead = maxBytesToRead; - size_t bytesRemaining = globalInputText.length()-globalReadOffset; - size_t i; - if (numBytesToRead > bytesRemaining) numBytesToRead = bytesRemaining; - for (i = 0; i < numBytesToRead; i++) buffer[i] = globalInputText.c_str()[globalReadOffset + i]; - *numBytesRead = numBytesToRead; - globalReadOffset += numBytesToRead; - return 0; - } -%} - -%union -{ - std::string* str; /* symbol table index */ - xios::IScalarExprNode* scalarNode; - xios::IFilterExprNode* filterNode; -}; - -%token NUMBER -%token VAR ID AVERAGE -%token PLUS MINUS TIMES DIVIDE POWER -%token EQ LT GT LE GE NE -%token LEFT_PARENTHESIS RIGHT_PARENTHESIS -%token QUESTION_MARK COLON -%token END - -%nonassoc QUESTION_MARK COLON -%left EQ LT GT LE GE NE -%left PLUS MINUS -%left TIMES DIVIDE -%nonassoc NEG -%right POWER - -%type Expression -%type Line Field_expr -%start Line -%% - - -Line: - END { /* Nothing to do */ } - | Field_expr END { parsed = $1; } - ; - -Expression: - NUMBER { $$ = new CScalarValExprNode(*$1); delete $1; } - | VAR { $$ = new CScalarVarExprNode(*$1); delete $1; } - | Expression PLUS Expression { $$ = new CScalarBinaryOpExprNode($1, "add", $3); } - | Expression MINUS Expression { $$ = new CScalarBinaryOpExprNode($1, "minus", $3); } - | Expression TIMES Expression { $$ = new CScalarBinaryOpExprNode($1, "mult", $3); } - | Expression DIVIDE Expression { $$ = new CScalarBinaryOpExprNode($1, "div", $3); } - | MINUS Expression %prec NEG { $$ = new CScalarUnaryOpExprNode("neg", $2); } - | Expression POWER Expression { $$ = new CScalarBinaryOpExprNode($1, "pow", $3); } - | Expression EQ Expression { $$ = new CScalarBinaryOpExprNode($1, "eq", $3); } - | Expression LT Expression { $$ = new CScalarBinaryOpExprNode($1, "lt", $3); } - | Expression GT Expression { $$ = new CScalarBinaryOpExprNode($1, "gt", $3); } - | Expression LE Expression { $$ = new CScalarBinaryOpExprNode($1, "le", $3); } - | Expression GE Expression { $$ = new CScalarBinaryOpExprNode($1, "ge", $3); } - | Expression NE Expression { $$ = new CScalarBinaryOpExprNode($1, "ne", $3); } - | Expression QUESTION_MARK Expression COLON Expression {$$ = new CScalarTernaryOpExprNode($1, "cond", $3, $5);} - | LEFT_PARENTHESIS Expression RIGHT_PARENTHESIS { $$ = $2; } - | ID LEFT_PARENTHESIS Expression RIGHT_PARENTHESIS { $$ = new CScalarUnaryOpExprNode(*$1, $3); delete $1; } - ; - -Field_expr: - ID { $$ = new CFilterFieldExprNode(*$1); delete $1; } - | AVERAGE { $$ = new CFilterTemporalFieldExprNode(*$1); delete $1; } - | Field_expr PLUS Field_expr { $$ = new CFilterFieldFieldOpExprNode($1, "add", $3); } - | Field_expr MINUS Field_expr { $$ = new CFilterFieldFieldOpExprNode($1, "minus", $3); } - | Field_expr TIMES Field_expr { $$ = new CFilterFieldFieldOpExprNode($1, "mult", $3); } - | Field_expr DIVIDE Field_expr { $$ = new CFilterFieldFieldOpExprNode($1, "div", $3); } - | MINUS Field_expr %prec NEG { $$ = new CFilterUnaryOpExprNode("neg", $2); } - | Field_expr POWER Field_expr { $$ = new CFilterFieldFieldOpExprNode($1, "pow", $3); } - | Field_expr EQ Field_expr { $$ = new CFilterFieldFieldOpExprNode($1, "eq", $3); } - | Field_expr LT Field_expr { $$ = new CFilterFieldFieldOpExprNode($1, "lt", $3); } - | Field_expr GT Field_expr { $$ = new CFilterFieldFieldOpExprNode($1, "gt", $3); } - | Field_expr LE Field_expr { $$ = new CFilterFieldFieldOpExprNode($1, "le", $3); } - | Field_expr GE Field_expr { $$ = new CFilterFieldFieldOpExprNode($1, "ge", $3); } - | Field_expr NE Field_expr { $$ = new CFilterFieldFieldOpExprNode($1, "ne", $3); } - | LEFT_PARENTHESIS Field_expr RIGHT_PARENTHESIS { $$ = $2; } - | Expression QUESTION_MARK Expression COLON Field_expr {$$ = new CFilterScalarScalarFieldOpExprNode($1, "cond",$3, $5);} - | Expression QUESTION_MARK Field_expr COLON Expression {$$ = new CFilterScalarFieldScalarOpExprNode($1, "cond",$3, $5);} - | Expression QUESTION_MARK Field_expr COLON Field_expr {$$ = new CFilterScalarFieldFieldOpExprNode($1, "cond",$3, $5);} - | Field_expr QUESTION_MARK Expression COLON Expression {$$ = new CFilterFieldScalarScalarOpExprNode($1, "cond",$3, $5);} - | Field_expr QUESTION_MARK Expression COLON Field_expr {$$ = new CFilterFieldScalarFieldOpExprNode($1, "cond",$3, $5);} - | Field_expr QUESTION_MARK Field_expr COLON Expression {$$ = new CFilterFieldFieldScalarOpExprNode($1, "cond",$3, $5);} - | Field_expr QUESTION_MARK Field_expr COLON Field_expr {$$ = new CFilterFieldFieldFieldOpExprNode($1, "cond",$3, $5);} - | Field_expr PLUS Expression { $$ = new CFilterFieldScalarOpExprNode($1, "add", $3); } - | Expression PLUS Field_expr { $$ = new CFilterScalarFieldOpExprNode($1, "add", $3); } - | Field_expr MINUS Expression { $$ = new CFilterFieldScalarOpExprNode($1, "minus", $3); } - | Expression MINUS Field_expr { $$ = new CFilterScalarFieldOpExprNode($1, "minus", $3); } - | Field_expr TIMES Expression { $$ = new CFilterFieldScalarOpExprNode($1, "mult", $3); } - | Expression TIMES Field_expr { $$ = new CFilterScalarFieldOpExprNode($1, "mult", $3); } - | Field_expr DIVIDE Expression { $$ = new CFilterFieldScalarOpExprNode($1, "div", $3); } - | Expression DIVIDE Field_expr { $$ = new CFilterScalarFieldOpExprNode($1, "div", $3); } - | Field_expr POWER Expression { $$ = new CFilterFieldScalarOpExprNode($1, "pow", $3); } - | Field_expr EQ Expression { $$ = new CFilterFieldScalarOpExprNode($1, "eq", $3); } - | Expression EQ Field_expr { $$ = new CFilterScalarFieldOpExprNode($1, "eq", $3); } - | Field_expr LT Expression { $$ = new CFilterFieldScalarOpExprNode($1, "lt", $3); } - | Expression LT Field_expr { $$ = new CFilterScalarFieldOpExprNode($1, "lt", $3); } - | Field_expr GT Expression { $$ = new CFilterFieldScalarOpExprNode($1, "gt", $3); } - | Expression GT Field_expr { $$ = new CFilterScalarFieldOpExprNode($1, "gt", $3); } - | Field_expr LE Expression { $$ = new CFilterFieldScalarOpExprNode($1, "le", $3); } - | Expression LE Field_expr { $$ = new CFilterScalarFieldOpExprNode($1, "le", $3); } - | Field_expr GE Expression { $$ = new CFilterFieldScalarOpExprNode($1, "ge", $3); } - | Expression GE Field_expr { $$ = new CFilterScalarFieldOpExprNode($1, "ge", $3); } - | Field_expr NE Expression { $$ = new CFilterFieldScalarOpExprNode($1, "ne", $3); } - | Expression NE Field_expr { $$ = new CFilterScalarFieldOpExprNode($1, "ne", $3); } - | ID LEFT_PARENTHESIS Field_expr RIGHT_PARENTHESIS { $$ = new CFilterUnaryOpExprNode(*$1, $3); delete $1; } - ; -%% - -extern "C" -{ - int yyerror(const char *s) - { - ERROR("int yyerror(const char *s)", << "Parsing error: " << s << endl); - } -} - -namespace xios -{ - IFilterExprNode* parseExpr(const string& strExpr) - { - globalInputText = strExpr; - globalReadOffset = 0; - yyparse(); - return parsed; - } -} - - diff --git a/xios_2311_src/trunk/.svn/pristine/55/550a3fd371074d946855006582ccfa1300f0136c.svn-base b/xios_2311_src/trunk/.svn/pristine/55/550a3fd371074d946855006582ccfa1300f0136c.svn-base deleted file mode 100644 index 1f1cf95adb07faad99d6167fc1892ac274e76110..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/55/550a3fd371074d946855006582ccfa1300f0136c.svn-base +++ /dev/null @@ -1,22 +0,0 @@ -MODULE GRID_INTERFACE - USE, INTRINSIC :: ISO_C_BINDING - - INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99 - - SUBROUTINE cxios_grid_handle_create(ret, idt, idt_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_grid_handle_create - - SUBROUTINE cxios_grid_valid_id(ret, idt, idt_size) BIND(C) - USE ISO_C_BINDING - LOGICAL (kind = C_BOOL) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_grid_valid_id - - END INTERFACE - -END MODULE GRID_INTERFACE diff --git a/xios_2311_src/trunk/.svn/pristine/55/55a422eebf4b8312ff7ace4596177de8053f73be.svn-base b/xios_2311_src/trunk/.svn/pristine/55/55a422eebf4b8312ff7ace4596177de8053f73be.svn-base deleted file mode 100644 index 6cff58b32742d08663a1f6bd6681098ca323bfae..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/55/55a422eebf4b8312ff7ace4596177de8053f73be.svn-base +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef __OASIS_CINTERFACE__ -#define __OASIS_CINTERFACE__ -#include -#include "mpi.hpp" - -extern "C" -{ - - void fxios_oasis_init(const char* server_id,int str_len) ; - void fxios_oasis_enddef(void) ; - void fxios_oasis_finalize(void) ; - void fxios_oasis_get_localcomm(MPI_Fint* f_comm) ; - void fxios_oasis_get_intracomm(MPI_Fint* f_comm_client_server,const char* client_id,int str_len) ; - void fxios_oasis_get_intercomm(MPI_Fint* f_comm_client_server,const char* client_id,int str_len) ; -} - -namespace xios -{ - void oasis_init(const std::string& server_id) ; - void oasis_enddef(void) ; - void oasis_finalize(void) ; - void oasis_get_localcomm(MPI_Comm& comm) ; - void oasis_get_intracomm(MPI_Comm& comm_client_server,const std::string& server_id) ; - void oasis_get_intercomm(MPI_Comm& comm_client_server,const std::string& server_id) ; -} -#endif diff --git a/xios_2311_src/trunk/.svn/pristine/55/55bbdbee58f2b75944c7e553151be609fc565649.svn-base b/xios_2311_src/trunk/.svn/pristine/55/55bbdbee58f2b75944c7e553151be609fc565649.svn-base deleted file mode 100644 index f50ee41985f19b9e6a12880814904bb46cdf17ae..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/55/55bbdbee58f2b75944c7e553151be609fc565649.svn-base +++ /dev/null @@ -1,25 +0,0 @@ -module load subversion 2>&1 -module load cmake 2>&1 -module load python3/3.7.5 2>&1 -module load cdo/1.9.5 2>&1 - -CHMOD() { chmod --quiet ug+rwX,o+rX "$@" ;} -export -f CHMOD - -export xios_full_machine_name="Irene" -export xios_test_suite_repository=/ccc/work/cont003/gen0826/gen0826/XIOS_TEST_SUITE_REPOSITORY # DEPRECATED ? -#export xios_thredds_dir=/ccc/work/cont003/thredds/p86yann/XIOS_TEST_SUITE -export xios_thredds_dir=/ccc/work/cont003/thredds/thredds/gen0826/XIOS_TEST_SUITE_REPOSITORY/XIOS_COUPLING -export xios_reference_dir=/ccc/work/cont003/gen0826/gen0826/XIOS_TEST_SUITE_REPOSITORY # DEPRECATED ? -#export ref_location=/ccc/cont003/home/gencmip6/wangyush/automation_XIOS/reference/XIOS_COUPLING -#export ref_location=/ccc/cont003/home/gencmip6/wangyush/reference_dir -#export ref_location=/ccc/work/cont003/gen0826/derouilj/XIOS_Unit_Tests/reference/XIOS_COUPLING -export ref_location=/ccc/work/cont003/gen0826/gen0826/XIOS_Unit_Tests/reference/XIOS_COUPLING -export ref_file=reference.tar.gz - -export PYTHON=python3 -export user_account=gen0826 -#export user_account=devcmip6 # used when no more cpu hours available on gen0826 - -mkdir -p $xios_test_suite_repository ; CHMOD $xios_test_suite_repository -mkdir -p $xios_thredds_dir ; CHMOD $xios_thredds_dir diff --git a/xios_2311_src/trunk/.svn/pristine/55/55c3a0ca91ddc5af2f67fca4016b7a579f19946d.svn-base b/xios_2311_src/trunk/.svn/pristine/55/55c3a0ca91ddc5af2f67fca4016b7a579f19946d.svn-base deleted file mode 100644 index f30d7a7c80a67996a14e84aa2e9b887cb5efc097..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/55/55c3a0ca91ddc5af2f67fca4016b7a579f19946d.svn-base +++ /dev/null @@ -1,800 +0,0 @@ -/********************************************************************* - * Copyright 1993, UCAR/Unidata - * See netcdf/COPYRIGHT file for copying and redistribution conditions. - *********************************************************************/ - -#include "ncdap3.h" -#include "nc3dispatch.h" -#include "ncd3dispatch.h" -#include "dapalign.h" -#include "dapdump.h" -#include "oc.h" - -#define getncid(drno) (((NC*)drno)->ext_ncid) - -/*Forward*/ -static NCerror getseqdimsize(NCDAPCOMMON*, CDFnode* seq, size_t* sizep); -static int fieldindex(CDFnode* parent, CDFnode* child); -static NCerror countsequence(NCDAPCOMMON*, CDFnode* node, size_t*); -static NCerror makeseqdim(NCDAPCOMMON*, CDFnode* node, size_t, CDFnode**); -static NCerror computeseqcountconstraints3(NCDAPCOMMON*,CDFnode*,NCbytes*); -static void computeseqcountconstraints3r(NCDAPCOMMON*, CDFnode*, CDFnode**); - -void -freegetvara(Getvara* vara) -{ - if(vara == NULL) return; - dcefree((DCEnode*)vara->varaprojection); - nullfree(vara); -} - -NCerror -freeNCDAPCOMMON(NCDAPCOMMON* dapcomm) -{ - /* abort the metadata file */ - (void)nc_abort(getncid(dapcomm)); - freenccache(dapcomm,dapcomm->cdf.cache); - nclistfree(dapcomm->cdf.varnodes); - nclistfree(dapcomm->cdf.seqnodes); - nclistfree(dapcomm->cdf.gridnodes); - nclistfree(dapcomm->cdf.usertypes); - nullfree(dapcomm->cdf.recorddimname); - - /* free the trees */ - freecdfroot34(dapcomm->cdf.ddsroot); - dapcomm->cdf.ddsroot = NULL; - freecdfroot34(dapcomm->cdf.fullddsroot); - dapcomm->cdf.fullddsroot = NULL; - if(dapcomm->oc.ocdasroot != NULL) - oc_root_free(dapcomm->oc.conn,dapcomm->oc.ocdasroot); - dapcomm->oc.ocdasroot = NULL; - oc_close(dapcomm->oc.conn); /* also reclaims remaining OC trees */ - nc_urifree(dapcomm->oc.url); - nullfree(dapcomm->oc.urltext); - nullfree(dapcomm->oc.rawurltext); - - dcefree((DCEnode*)dapcomm->oc.dapconstraint); - dapcomm->oc.dapconstraint = NULL; - - free(dapcomm); - - return NC_NOERR; -} - -NCerror -addstringdims(NCDAPCOMMON* dapcomm) -{ - /* for all variables of string type, we will need another dimension - to represent the string; Accumulate the needed sizes and create - the dimensions with a specific name: either as specified - in DODS{...} attribute set or defaulting to the variable name. - All such dimensions are global. - */ - int i; - NClist* varnodes = dapcomm->cdf.varnodes; - CDFnode* globalsdim = NULL; - char dimname[4096]; - size_t dimsize; - - /* Start by creating the global string dimension */ - snprintf(dimname,sizeof(dimname),"maxStrlen%lu", - (unsigned long)dapcomm->cdf.defaultstringlength); - globalsdim = makecdfnode34(dapcomm, dimname, OC_Dimension, OCNULL, - dapcomm->cdf.ddsroot); - nclistpush(dapcomm->cdf.ddsroot->tree->nodes,(ncelem)globalsdim); - DIMFLAGSET(globalsdim,CDFDIMSTRING); - globalsdim->dim.declsize = dapcomm->cdf.defaultstringlength; - globalsdim->dim.declsize0 = globalsdim->dim.declsize; - globalsdim->dim.array = dapcomm->cdf.ddsroot; - globalsdim->ncbasename = cdflegalname3(dimname); - globalsdim->ncfullname = nulldup(globalsdim->ncbasename); - dapcomm->cdf.globalstringdim = globalsdim; - - for(i=0;ietype != NC_STRING && var->etype != NC_URL) continue; - - dimsize = 0; - if(var->dodsspecial.maxstrlen > 0) - dimsize = var->dodsspecial.maxstrlen; - else - dimsize = var->maxstringlength; - - /* check is a variable-specific string length was specified */ - if(dimsize == 0) - sdim = dapcomm->cdf.globalstringdim; /* use default */ - else { - /* create a psuedo dimension for the charification of the string*/ - if(var->dodsspecial.dimname != NULL) - strncpy(dimname,var->dodsspecial.dimname,sizeof(dimname)); - else - snprintf(dimname,sizeof(dimname),"maxStrlen%lu", - (unsigned long)dimsize); - sdim = makecdfnode34(dapcomm, dimname, OC_Dimension, OCNULL, - dapcomm->cdf.ddsroot); - if(sdim == NULL) return THROW(NC_ENOMEM); - nclistpush(dapcomm->cdf.ddsroot->tree->nodes,(ncelem)sdim); - DIMFLAGSET(sdim,CDFDIMSTRING); - sdim->dim.declsize = dimsize; - sdim->dim.declsize0 = dimsize; - sdim->dim.array = var; - sdim->ncbasename = cdflegalname3(sdim->ocname); - sdim->ncfullname = nulldup(sdim->ncbasename); - } - /* tag the variable with its string dimension*/ - var->array.stringdim = sdim; - } - return NC_NOERR; -} - -NCerror -defrecorddim3(NCDAPCOMMON* dapcomm) -{ - unsigned int i; - NCerror ncstat = NC_NOERR; - NClist* basedims; - - if(dapcomm->cdf.recorddimname == NULL) return NC_NOERR; /* ignore */ - /* Locate the base dimension matching the record dim */ - basedims = dapcomm->cdf.dimnodes; - for(i=0;iocname,dapcomm->cdf.recorddimname) != 0) continue; - DIMFLAGSET(dim,CDFDIMRECORD); - dapcomm->cdf.recorddim = dim; - break; - } - - return ncstat; -} - -NCerror -defseqdims(NCDAPCOMMON* dapcomm) -{ - unsigned int i; - NCerror ncstat = NC_NOERR; - int seqdims = 1; /* default is to compute seq dims counts */ - - /* Does the user want to compute actual sequence sizes? */ - if(paramvalue34(dapcomm,"noseqdims")) seqdims = 0; - - /* - Compute and define pseudo dimensions for sequences - meeting the following qualifications: - 1. all parents (transitively) of the sequence must - be either a dataset or a scalar structure. - 2. it must be possible to find a usable sequence constraint. - All other sequences will be ignored. - */ - - for(i=0;icdf.seqnodes);i++) { - CDFnode* seq = (CDFnode*)nclistget(dapcomm->cdf.seqnodes,i); - size_t seqsize; - CDFnode* sqdim = NULL; - CDFnode* container; - /* Does this sequence match the requirements for use ? */ - seq->usesequence = 1; /* assume */ - for(container=seq->container;container != NULL;container=container->container) { - if(container->nctype == NC_Dataset) break; - if(container->nctype != NC_Structure - || nclistlength(container->array.dimset0) > 0) - {seq->usesequence = 0; break;}/* no good */ - } - /* Does the user want us to compute the actual sequence dim size? */ - if(seq->usesequence && seqdims) { - ncstat = getseqdimsize(dapcomm,seq,&seqsize); - if(ncstat != NC_NOERR) { - /* Cannot read sequence; mark as unusable */ - seq->usesequence = 0; - } - } else { /* !seqdims default to size = 1 */ - seqsize = 1; - } - if(seq->usesequence) { - /* Note: we are making the dimension in the dds root tree */ - ncstat = makeseqdim(dapcomm,seq,seqsize,&sqdim); - if(ncstat) goto fail; - seq->array.seqdim = sqdim; - } else - seq->array.seqdim = NULL; - } - -fail: - return ncstat; -} - -static NCerror -getseqdimsize(NCDAPCOMMON* dapcomm, CDFnode* seq, size_t* sizep) -{ - NCerror ncstat = NC_NOERR; - OCerror ocstat = OC_NOERR; - OCconnection conn = dapcomm->oc.conn; - OCdata rootcontent = OCNULL; - OCobject ocroot; - CDFnode* dxdroot; - CDFnode* xseq; - NCbytes* seqcountconstraints = ncbytesnew(); - size_t seqsize; - - /* Read the minimal amount of data in order to get the count */ - /* If the url is unconstrainable, then get the whole thing */ - computeseqcountconstraints3(dapcomm,seq,seqcountconstraints); -#ifdef DEBUG -fprintf(stderr,"seqcountconstraints: %s\n",ncbytescontents(seqcountconstraints)); -#endif - - /* Fetch the minimal data */ - if(FLAGSET(dapcomm->controls,NCF_UNCONSTRAINABLE)) - ocstat = dap_fetch(dapcomm,conn,NULL,OCDATADDS,&ocroot); - else - ocstat = dap_fetch(dapcomm,conn,ncbytescontents(seqcountconstraints),OCDATADDS,&ocroot); - if(ocstat) goto fail; - - ncstat = buildcdftree34(dapcomm,ocroot,OCDATA,&dxdroot); - if(ncstat) goto fail; - /* attach DATADDS to DDS */ - ncstat = attach34(dxdroot,seq); - if(ncstat) goto fail; - - /* WARNING: we are now switching to datadds tree */ - xseq = seq->attachment; - ncstat = countsequence(dapcomm,xseq,&seqsize); - if(ncstat) goto fail; - -#ifdef DEBUG -fprintf(stderr,"sequencesize: %s = %lu\n",seq->ocname,(unsigned long)seqsize); -#endif - - /* throw away the fetch'd trees */ - unattach34(dapcomm->cdf.ddsroot); - freecdfroot34(dxdroot); - if(ncstat != NC_NOERR) { - /* Cannot get DATADDDS*/ - char* code; - char* msg; - long httperr; - oc_svcerrordata(dapcomm->oc.conn,&code,&msg,&httperr); - if(code != NULL) { - nclog(NCLOGERR,"oc_fetch_datadds failed: %s %s %l", - code,msg,httperr); - } - ocstat = OC_NOERR; - } - if(sizep) *sizep = seqsize; - -fail: - ncbytesfree(seqcountconstraints); - oc_data_free(conn,rootcontent); - if(ocstat) ncstat = ocerrtoncerr(ocstat); - return ncstat; -} - -static NCerror -makeseqdim(NCDAPCOMMON* dapcomm, CDFnode* seq, size_t count, CDFnode** sqdimp) -{ - CDFnode* sqdim; - CDFnode* root = seq->root; - CDFtree* tree = root->tree; - - /* build the dimension with given size; keep the dimension anonymous */ - sqdim = makecdfnode34(dapcomm,seq->ocname,OC_Dimension,OCNULL,root); - if(sqdim == NULL) return THROW(NC_ENOMEM); - nclistpush(tree->nodes,(ncelem)sqdim); - /* Assign a name to the sequence node */ - sqdim->ncbasename = cdflegalname3(seq->ocname); - sqdim->ncfullname = nulldup(sqdim->ncbasename); - DIMFLAGSET(sqdim,CDFDIMSEQ); - sqdim->dim.declsize = count; - sqdim->dim.declsize0 = count; - sqdim->dim.array = seq; - if(sqdimp) *sqdimp = sqdim; - return NC_NOERR; -} - -static NCerror -countsequence(NCDAPCOMMON* dapcomm, CDFnode* xseq, size_t* sizep) -{ - unsigned int i; - NClist* path = nclistnew(); - int index; - OCerror ocstat = OC_NOERR; - NCerror ncstat = NC_NOERR; - OCconnection conn = dapcomm->oc.conn; - size_t recordcount; - CDFnode* xroot; - CDFnode* current; - OCdata datacontainer = OCNULL; - OCmode mode; - - ASSERT((xseq->nctype == NC_Sequence)); - - /* collect the path to the sequence node */ - collectnodepath3(xseq,path,WITHDATASET); - - /* Get tree root */ - xroot = xseq->root; - datacontainer = oc_data_new(conn); - ocstat = oc_data_root(conn,xroot->tree->ocroot,datacontainer); - if(ocstat) goto fail; - - /* walk to the sequence object; control the movement to the next node - based on mode */ - current = (CDFnode*)nclistget(path,0); - for(i=0;;) { - OCdata child = OCNULL; - CDFnode* next = NULL; - ocstat = oc_data_mode(conn,datacontainer,&mode); - if(ocstat != OC_NOERR) goto fail; - switch (mode) { - case OCFIELDMODE: - i++; - next = (CDFnode*)nclistget(path,i); - index = fieldindex(current,next); - break; - case OCARRAYMODE: - index = 0; - break; - case OCSEQUENCEMODE: - goto exitloop; - default: - PANIC("unexpected mode"); - return NC_EINVAL; - } - child = oc_data_new(conn); - ocstat = oc_data_ith(conn,datacontainer,index,child); - if(ocstat) goto fail; - /* move to the next node only if it is defined */ - if(next != NULL) - current = next; - oc_data_free(conn,datacontainer); - datacontainer = child; - } -exitloop: - ASSERT(current == xseq && mode == OCSEQUENCEMODE); - oc_data_count(conn,datacontainer,&recordcount); - if(sizep) *sizep = recordcount; - -fail: - oc_data_free(conn,datacontainer); - nclistfree(path); - if(ocstat) ncstat = ocerrtoncerr(ocstat); - return THROW(ncstat); -} - -static int -fieldindex(CDFnode* parent, CDFnode* child) -{ - unsigned int i; - for(i=0;isubnodes);i++) { - CDFnode* node = (CDFnode*)nclistget(parent->subnodes,i); - if(node == child) return i; - } - return -1; -} - -NCerror -showprojection3(NCDAPCOMMON* dapcomm, CDFnode* var) -{ - int i,rank; - NCerror ncstat = NC_NOERR; - NCbytes* projection = ncbytesnew(); - NClist* path = nclistnew(); - NC* drno = dapcomm->controller; - - /* Collect the set of DDS node name forming the xpath */ - collectnodepath3(var,path,WITHOUTDATASET); - for(i=0;i 0) ncbytescat(projection,"."); - ncbytescat(projection,node->ocname); - } - /* Now, add the dimension info */ - rank = nclistlength(var->array.dimset0); - for(i=0;iarray.dimset0,i); - char tmp[32]; - ncbytescat(projection,"["); - snprintf(tmp,sizeof(tmp),"%lu",(unsigned long)dim->dim.declsize); - ncbytescat(projection,tmp); - ncbytescat(projection,"]"); - } - /* Define the attribute */ - ncstat = nc_put_att_text(getncid(drno),var->ncid, - "_projection", - ncbyteslength(projection), - ncbytescontents(projection)); - return ncstat; -} - -/* -This is more complex than one might think. We want to find -a path to a variable inside the given node so that we can -ask for a single instance of that variable to minimize the -amount of data we retrieve. However, we want to avoid passing -through any nested sequence. This is possible because of the way -that sequencecheck() works. -TODO: some servers will not accept an unconstrained fetch, so -make sure we always have a constraint. -*/ - -static NCerror -computeseqcountconstraints3(NCDAPCOMMON* dapcomm, CDFnode* seq, NCbytes* seqcountconstraints) -{ - int i,j; - NClist* path = NULL; - CDFnode* var = NULL; - - ASSERT(seq->nctype == NC_Sequence); - computeseqcountconstraints3r(dapcomm,seq,&var); - - ASSERT((var != NULL)); - - /* Compute var path */ - path = nclistnew(); - collectnodepath3(var,path,WITHOUTDATASET); - - /* construct the projection path using minimal index values */ - for(i=0;i 0) ncbytescat(seqcountconstraints,"."); - ncbytescat(seqcountconstraints,node->ocname); - if(node == seq) { - /* Use the limit */ - if(node->sequencelimit > 0) { - char tmp[64]; - snprintf(tmp,sizeof(tmp),"[0:%lu]", - (unsigned long)(node->sequencelimit - 1)); - ncbytescat(seqcountconstraints,tmp); - } - } else if(nclistlength(node->array.dimset0) > 0) { - int ndims = nclistlength(node->array.dimset0); - for(j=0;jarray.dimset0,j); - if(DIMFLAG(dim,CDFDIMSTRING)) { - ASSERT((j == (ndims - 1))); - break; - } - ncbytescat(seqcountconstraints,"[0]"); - } - } - } - /* Finally, add in any selection from the original URL */ - if(dapcomm->oc.url->selection != NULL) - ncbytescat(seqcountconstraints,dapcomm->oc.url->selection); - nclistfree(path); - return NC_NOERR; -} - - -/* Given an existing candidate, see if we prefer newchoice */ -static CDFnode* -prefer(CDFnode* candidate, CDFnode* newchoice) -{ - nc_type newtyp; - nc_type cantyp; - int newisstring; - int canisstring; - int newisscalar; - int canisscalar; - - /* always choose !null over null */ - if(newchoice == NULL) - return candidate; - if(candidate == NULL) - return newchoice; - - newtyp = newchoice->etype; - cantyp = candidate->etype; - newisstring = (newtyp == NC_STRING || newtyp == NC_URL); - canisstring = (cantyp == NC_STRING || cantyp == NC_URL); - newisscalar = (nclistlength(newchoice->array.dimset0) == 0); - canisscalar = (nclistlength(candidate->array.dimset0) == 0); - - ASSERT(candidate->nctype == NC_Primitive && newchoice->nctype == NC_Primitive); - - /* choose non-string over string */ - if(canisstring && !newisstring) - return newchoice; - if(!canisstring && newisstring) - return candidate; - - /* choose scalar over array */ - if(canisscalar && !newisscalar) - return candidate; - if(!canisscalar && newisscalar) - return candidate; - - /* otherwise choose existing candidate */ - return candidate; -} - -/* computeseqcountconstraints3 recursive helper function */ -static void -computeseqcountconstraints3r(NCDAPCOMMON* dapcomm, CDFnode* node, CDFnode** candidatep) -{ - CDFnode* candidate; - CDFnode* compound; - unsigned int i; - - candidate = NULL; - compound = NULL; - - for(i=0;isubnodes);i++){ - CDFnode* subnode = (CDFnode*)nclistget(node->subnodes,i); - if(subnode->nctype == NC_Structure || subnode->nctype == NC_Grid) - compound = subnode; /* save for later recursion */ - else if(subnode->nctype == NC_Primitive) { - candidate = prefer(candidate,subnode); - } - } - if(candidate == NULL && compound == NULL) { - PANIC("cannot find candidate for seqcountconstraints for a sequence"); - } else if(candidate != NULL && candidatep != NULL) { - *candidatep = candidate; - } else { /* compound != NULL by construction */ - /* recurse on a nested grids or strucures */ - computeseqcountconstraints3r(dapcomm,compound,candidatep); - } -} - - -static unsigned long -cdftotalsize3(NClist* dimensions) -{ - unsigned int i; - unsigned long total = 1; - if(dimensions != NULL) { - for(i=0;idim.declsize; - } - } - return total; -} - -/* Estimate variables sizes and then resort the variable list - by that size -*/ -void -estimatevarsizes3(NCDAPCOMMON* dapcomm) -{ - int ivar; - unsigned int rank; - size_t totalsize = 0; - - for(ivar=0;ivarcdf.varnodes);ivar++) { - CDFnode* var = (CDFnode*)nclistget(dapcomm->cdf.varnodes,ivar); - NClist* ncdims = var->array.dimset0; - rank = nclistlength(ncdims); - if(rank == 0) { /* use instance size of the type */ - var->estimatedsize = nctypesizeof(var->etype); -#ifdef DEBUG1 -fprintf(stderr,"scalar %s.estimatedsize = %lu\n", - makecdfpathstring3(var,"."),var->estimatedsize); -#endif - } else { - unsigned long size = cdftotalsize3(ncdims); - size *= nctypesizeof(var->etype); -#ifdef DEBUG1 -fprintf(stderr,"array %s(%u).estimatedsize = %lu\n", - makecdfpathstring3(var,"."),rank,size); -#endif - var->estimatedsize = size; - } - totalsize += var->estimatedsize; - } -#ifdef DEBUG1 -fprintf(stderr,"total estimatedsize = %lu\n",totalsize); -#endif - dapcomm->cdf.totalestimatedsize = totalsize; -} - -NCerror -fetchtemplatemetadata3(NCDAPCOMMON* dapcomm) -{ - NCerror ncstat = NC_NOERR; - OCerror ocstat = OC_NOERR; - OCobject ocroot = OCNULL; - CDFnode* ddsroot = NULL; - char* ce = NULL; - - /* Temporary hack: we need to get the selection string - from the url - */ - /* Get (almost) unconstrained DDS; In order to handle functions - correctly, those selections must always be included - */ - if(FLAGSET(dapcomm->controls,NCF_UNCONSTRAINABLE)) - ce = NULL; - else - ce = nulldup(dapcomm->oc.url->selection); - - /* Get selection constrained DDS */ - ocstat = dap_fetch(dapcomm,dapcomm->oc.conn,ce,OCDDS,&ocroot); - if(ocstat != OC_NOERR) { - /* Special Hack. If the protocol is file, then see if - we can get the dds from the .dods file - */ - if(strcmp(dapcomm->oc.url->protocol,"file") != 0) { - THROWCHK(ocstat); goto done; - } - /* Fetch the data dds */ - ocstat = dap_fetch(dapcomm,dapcomm->oc.conn,ce,OCDATADDS,&ocroot); - if(ocstat != OC_NOERR) { - THROWCHK(ocstat); goto done; - } - /* Note what we did */ - nclog(NCLOGWARN,"Cannot locate .dds file, using .dods file"); - } - - /* Get selection constrained DAS */ - ocstat = dap_fetch(dapcomm,dapcomm->oc.conn,ce,OCDAS,&dapcomm->oc.ocdasroot); - if(ocstat != OC_NOERR) { - /* Ignore but complain */ - nclog(NCLOGWARN,"Could not read DAS; ignored"); - dapcomm->oc.ocdasroot = OCNULL; - ocstat = OC_NOERR; - } - - /* Construct our parallel dds tree */ - ncstat = buildcdftree34(dapcomm,ocroot,OCDDS,&ddsroot); - if(ncstat != NC_NOERR) {THROWCHK(ncstat); goto done;} - dapcomm->cdf.fullddsroot = ddsroot; - -done: - nullfree(ce); - if(ocstat != OC_NOERR) ncstat = ocerrtoncerr(ocstat); - return ncstat; -} - -NCerror -fetchconstrainedmetadata3(NCDAPCOMMON* dapcomm) -{ - NCerror ncstat = NC_NOERR; - OCerror ocstat = OC_NOERR; - OCobject ocroot; - CDFnode* ddsroot; /* constrained */ - char* ce = NULL; - - if(FLAGSET(dapcomm->controls,NCF_UNCONSTRAINABLE)) - ce = NULL; - else - ce = buildconstraintstring3(dapcomm->oc.dapconstraint); - - { - ocstat = dap_fetch(dapcomm,dapcomm->oc.conn,ce,OCDDS,&ocroot); - if(ocstat != OC_NOERR) {THROWCHK(ocstat); goto fail;} - - /* Construct our parallel dds tree; including attributes*/ - ncstat = buildcdftree34(dapcomm,ocroot,OCDDS,&ddsroot); - if(ncstat) goto fail; - - dapcomm->cdf.ddsroot = ddsroot; - - if(!FLAGSET(dapcomm->controls,NCF_UNCONSTRAINABLE)) { - /* fix DAP server problem by adding back any missing grid structure nodes */ - ncstat = regrid3(ddsroot,dapcomm->cdf.fullddsroot,dapcomm->oc.dapconstraint->projections); - if(ncstat) goto fail; - } - -#ifdef DEBUG -fprintf(stderr,"constrained:\n%s",dumptree(ddsroot)); -#endif - - /* Combine DDS and DAS */ - if(dapcomm->oc.ocdasroot != NULL) { - ncstat = dapmerge3(dapcomm,ddsroot,dapcomm->oc.ocdasroot); - if(ncstat != NC_NOERR) {THROWCHK(ncstat); goto fail;} - } - - /* map the constrained DDS to the unconstrained DDS */ - ncstat = mapnodes3(ddsroot,dapcomm->cdf.fullddsroot); - if(ncstat) goto fail; - - } - -fail: - nullfree(ce); - if(ocstat != OC_NOERR) ncstat = ocerrtoncerr(ocstat); - return ncstat; -} - -/* Suppress variables not in usable sequences*/ -NCerror -suppressunusablevars3(NCDAPCOMMON* dapcomm) -{ - int i,j; - int found = 1; - NClist* path = nclistnew(); - - while(found) { - found = 0; - /* Walk backwards to aid removal semantics */ - for(i=nclistlength(dapcomm->cdf.varnodes)-1;i>=0;i--) { - CDFnode* var = (CDFnode*)nclistget(dapcomm->cdf.varnodes,i); - /* See if this var is under an unusable sequence */ - nclistclear(path); - collectnodepath3(var,path,WITHOUTDATASET); - for(j=0;jnctype == NC_Sequence - && !node->usesequence) { -#ifdef DEBUG -fprintf(stderr,"suppressing var in unusable sequence: %s.%s\n",node->ncfullname,var->ncbasename); -#endif - found = 1; - break; - } - } - if(found) break; - } - if(found) nclistremove(dapcomm->cdf.varnodes,i); - } - nclistfree(path); - return NC_NOERR; -} - - -/* -For variables which have a zero size dimension, -make them invisible. -*/ -NCerror -fixzerodims3(NCDAPCOMMON* dapcomm) -{ - int i,j; - for(i=0;icdf.varnodes);i++) { - CDFnode* var = (CDFnode*)nclistget(dapcomm->cdf.varnodes,i); - NClist* ncdims = var->array.dimsetplus; - if(nclistlength(ncdims) == 0) continue; - for(j=0;jdim.declsize == 0) { - /* make node invisible */ - var->visible = 0; - var->zerodim = 1; - } - } - } - return NC_NOERR; -} - -void -applyclientparamcontrols3(NCDAPCOMMON* dapcomm) -{ - /* clear the flags */ - CLRFLAG(dapcomm->controls,NCF_CACHE); - CLRFLAG(dapcomm->controls,NCF_PREFETCH); - CLRFLAG(dapcomm->controls,NCF_SHOWFETCH); - CLRFLAG(dapcomm->controls,NCF_NC3); - CLRFLAG(dapcomm->controls,NCF_NCDAP); - - /* Turn on any default on flags */ - SETFLAG(dapcomm->controls,DFALT_ON_FLAGS); - SETFLAG(dapcomm->controls,(NCF_NC3|NCF_NCDAP)); - - /* enable/disable caching */ - if(paramcheck34(dapcomm,"cache",NULL)) - SETFLAG(dapcomm->controls,NCF_CACHE); - else if(paramcheck34(dapcomm,"nocache",NULL)) - CLRFLAG(dapcomm->controls,NCF_CACHE); - - /* enable/disable cache prefetch */ - if(paramcheck34(dapcomm,"prefetch",NULL)) - SETFLAG(dapcomm->controls,NCF_PREFETCH); - else if(paramcheck34(dapcomm,"noprefetch",NULL)) - CLRFLAG(dapcomm->controls,NCF_PREFETCH); - - - if(FLAGSET(dapcomm->controls,NCF_UNCONSTRAINABLE)) - SETFLAG(dapcomm->controls,NCF_CACHE); - - if(paramcheck34(dapcomm,"show","fetch")) - SETFLAG(dapcomm->controls,NCF_SHOWFETCH); - - nclog(NCLOGNOTE,"Caching=%d",FLAGSET(dapcomm->controls,NCF_CACHE)); - -} diff --git a/xios_2311_src/trunk/.svn/pristine/55/55d72a1ccf7b07d557cdc75051a2b6e0b106615b.svn-base b/xios_2311_src/trunk/.svn/pristine/55/55d72a1ccf7b07d557cdc75051a2b6e0b106615b.svn-base deleted file mode 100644 index 9a5979ed673644244030b850169bf8374420f336..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/55/55d72a1ccf7b07d557cdc75051a2b6e0b106615b.svn-base +++ /dev/null @@ -1,51 +0,0 @@ -#include "maximum.hpp" -#include "array_new.hpp" -#include "utils.hpp" - -namespace xios -{ - namespace func - { - /// ////////////////////// Définitions ////////////////////// /// - - CMaximum::CMaximum(CArray& doutput) - : SuperClass(StdString("maximum"), doutput) - { /* Ne rien faire de plus */ } - - CMaximum::CMaximum(CArray& doutput, double missingValue) - : SuperClass(StdString("maximum"), doutput, missingValue) - { /* Ne rien faire de plus */ } - - CMaximum::~CMaximum(void) - { /* Ne rien faire de plus */ } - - //--------------------------------------------------------------- - - void CMaximum::apply(const CArray& _dinput, - CArray& _doutput) - { - const double * it1 = _dinput.dataFirst(), - * end1 = _dinput.dataFirst() + _dinput.numElements(); - double * it = _doutput.dataFirst(); - if (this->nbcall == 1) for (; it1 != end1; it1++, it++) *it = *it1; - else - { - if (hasMissingValue) - { - for (; it1 != end1; it1++, it++) - if (!NumTraits::isNan(*it1)) - { - if (!NumTraits::isNan(*it)) *it = std::max(*it1, *it); - else *it=*it1 ; - } - } - else for (; it1 != end1; it1++, it++) *it = std::max(*it1, *it); - } - - - } - - //--------------------------------------------------------------- - - } // namespace func -} // namespace xios diff --git a/xios_2311_src/trunk/.svn/pristine/55/55ef1792544305a7f16848655293757c1ea230b0.svn-base b/xios_2311_src/trunk/.svn/pristine/55/55ef1792544305a7f16848655293757c1ea230b0.svn-base deleted file mode 100644 index dcea514448dfac764e3ce6f135131eb6ea1785bf..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/55/55ef1792544305a7f16848655293757c1ea230b0.svn-base +++ /dev/null @@ -1,213 +0,0 @@ -#include "ncdispatch.h" -#include "nc_uri.h" - -extern int NCSUBSTRATE_intialize(void); - -/* Define vectors of zeros and ones for use with various nc_get_varX function*/ -size_t nc_sizevector0[NC_MAX_DIMS]; -size_t nc_sizevector1[NC_MAX_DIMS]; -ptrdiff_t nc_ptrdiffvector1[NC_MAX_DIMS]; - -/* Define the known protocols and their manipulations */ -static struct NCPROTOCOLLIST { - char* protocol; - char* substitute; - int modelflags; -} ncprotolist[] = { - {"http",NULL,0}, - {"https",NULL,0}, - {"file",NULL,NC_DISPATCH_NCD}, - {"dods","http",NC_DISPATCH_NCD}, - {"dodss","https",NC_DISPATCH_NCD}, - {"cdmr","http",NC_DISPATCH_NCR|NC_DISPATCH_NC4}, - {"cdmrs","https",NC_DISPATCH_NCR|NC_DISPATCH_NC4}, - {"cdmremote","http",NC_DISPATCH_NCR|NC_DISPATCH_NC4}, - {"cdmremotes","https",NC_DISPATCH_NCR|NC_DISPATCH_NC4}, - {NULL,NULL,0} /* Terminate search */ -}; - -/* Define the server to ping in order; - make the order attempt to optimize - against future changes. -*/ -static const char* servers[] = { -"http://motherlode.ucar.edu:8081", /* try this first */ -"http://remotetest.unidata.ucar.edu", -"http://remotetest.ucar.edu", -"http://motherlode.ucar.edu:8080", -"http://motherlode.ucar.edu", -"http://remotetests.unidata.ucar.edu", -"http://remotetests.ucar.edu", -NULL -}; - -/* -static nc_type longtype = (sizeof(long) == sizeof(int)?NC_INT:NC_INT64); -static nc_type ulongtype = (sizeof(unsigned long) == sizeof(unsigned int)?NC_UINT:NC_UINT64); -*/ - -/* Allow dispatch to do initialization */ -int -NCDISPATCH_initialize(void) -{ - extern int NCSUBSTRATE_initialize(void); - int i; - NCSUBSTRATE_initialize(); - for(i=0;iprotocol;protolist++) { - if(strcmp(tmpurl->protocol,protolist->protocol) == 0) { - isurl=1; - break; - } - } - nc_urifree(tmpurl); - return isurl; - } - return 0; -} - -/* -Return the OR of some of the NC_DISPATCH flags -Assumes that the path is known to be a url -*/ - -int -NC_urlmodel(const char* path) -{ - int model = 0; - NC_URI* tmpurl = NULL; - struct NCPROTOCOLLIST* protolist; - - if(!nc_uriparse(path,&tmpurl)) goto done; - - /* Look at any prefixed parameters */ - if(nc_urilookup(tmpurl,"netcdf4",NULL) - || nc_urilookup(tmpurl,"netcdf-4",NULL)) { - model = (NC_DISPATCH_NC4|NC_DISPATCH_NCD); - } else if(nc_urilookup(tmpurl,"netcdf3",NULL) - || nc_urilookup(tmpurl,"netcdf-3",NULL)) { - model = (NC_DISPATCH_NC3|NC_DISPATCH_NCD); - } else if(nc_urilookup(tmpurl,"cdmremote",NULL) - || nc_urilookup(tmpurl,"cdmr",NULL)) { - model = (NC_DISPATCH_NCR|NC_DISPATCH_NC4); - } - - if(model == 0) { - /* Now look at the protocol */ - for(protolist=ncprotolist;protolist->protocol;protolist++) { - if(strcmp(tmpurl->protocol,protolist->protocol) == 0) { - model |= protolist->modelflags; - if(protolist->substitute) { - if(tmpurl->protocol) free(tmpurl->protocol); - tmpurl->protocol = strdup(protolist->substitute); - } - break; - } - } - } - - /* Force NC_DISPATCH_NC3 if necessary */ - if((model & NC_DISPATCH_NC4) == 0) - model |= (NC_DISPATCH_NC3 | NC_DISPATCH_NCD); - -done: - nc_urifree(tmpurl); - return model; -} - -/* Override dispatch table management */ -static NC_Dispatch* NC_dispatch_override = NULL; - -/* Override dispatch table management */ -NC_Dispatch* -NC_get_dispatch_override(void) { - return NC_dispatch_override; -} - -void NC_set_dispatch_override(NC_Dispatch* d) -{ - NC_dispatch_override = d; -} - -/* Overlay by treating the tables as arrays of void*. - Overlay rules are: - overlay base merge - ------- ---- ----- - null null null - null y y - x null x - x y x -*/ - -int -NC_dispatch_overlay(const NC_Dispatch* overlay, const NC_Dispatch* base, NC_Dispatch* merge) -{ - void** voverlay = (void**)overlay; - void** vmerge; - int i, count = sizeof(NC_Dispatch) / sizeof(void*); - /* dispatch table must be exact multiple of sizeof(void*) */ - assert(count * sizeof(void*) == sizeof(NC_Dispatch)); - *merge = *base; - vmerge = (void**)merge; - for(i=0;imodel = overlay->model; - return NC_NOERR; -} diff --git a/xios_2311_src/trunk/.svn/pristine/56/563840d6f79d42f68a0211567cfbc6adc052f9c7.svn-base b/xios_2311_src/trunk/.svn/pristine/56/563840d6f79d42f68a0211567cfbc6adc052f9c7.svn-base deleted file mode 100644 index 3846d4f24d5d59e2bf9e70852e92c90cbf395ef9..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/56/563840d6f79d42f68a0211567cfbc6adc052f9c7.svn-base +++ /dev/null @@ -1,22 +0,0 @@ -MODULE INTERPOLATE_AXIS_INTERFACE - USE, INTRINSIC :: ISO_C_BINDING - - INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99 - - SUBROUTINE cxios_interpolate_axis_handle_create(ret, idt, idt_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_interpolate_axis_handle_create - - SUBROUTINE cxios_interpolate_axis_valid_id(ret, idt, idt_size) BIND(C) - USE ISO_C_BINDING - LOGICAL (kind = C_BOOL) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_interpolate_axis_valid_id - - END INTERFACE - -END MODULE INTERPOLATE_AXIS_INTERFACE diff --git a/xios_2311_src/trunk/.svn/pristine/56/5655a9593dcb4a90fe5e668dea41121ef869b368.svn-base b/xios_2311_src/trunk/.svn/pristine/56/5655a9593dcb4a90fe5e668dea41121ef869b368.svn-base deleted file mode 100644 index a25cbccf8c735f45dfdfad2d10d344dcf5607f8d..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/56/5655a9593dcb4a90fe5e668dea41121ef869b368.svn-base +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -#set -x - -export revision=$(svn info --show-item revision .. 2>&1) - -python config_compile.py - -ccc_msub -E "--wait" job_compile_irene.sh - -if [ "$COPY_TO_SERVER" = true ] -then - build_dir=${xios_test_suite_repository}/BUILD - mkdir -p $build_dir ; CHMOD $build_dir - mkdir -p ${build_dir}/build_${xios_machine_name} - - - allreports=`ls ./build_${revision}_*.txt` - for report in $allreports - do - ll=$(wc -l $report | awk '{print $1}') - if [[ $(($ll)) > 4 ]] ; then - echo "$report need to be copied" - cp $report ${build_dir}/build_${xios_machine_name} - fi - done - - CHMOD -R ${build_dir}/build_${xios_machine_name} -fi diff --git a/xios_2311_src/trunk/.svn/pristine/56/5694146684ec56398fd1614df98c102fb16aae74.svn-base b/xios_2311_src/trunk/.svn/pristine/56/5694146684ec56398fd1614df98c102fb16aae74.svn-base deleted file mode 100644 index b68a0cc9c1730a4fc3fb8818036e2bd7583e70fc..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/56/5694146684ec56398fd1614df98c102fb16aae74.svn-base +++ /dev/null @@ -1,66 +0,0 @@ -/* ************************************************************************** * - * Interface auto generated - do not modify * - * ************************************************************************** */ - -#include -#include "xios.hpp" -#include "attribute_template.hpp" -#include "object_template.hpp" -#include "group_template.hpp" -#include "icutil.hpp" -#include "icdate.hpp" -#include "timer.hpp" -#include "node_type.hpp" - -extern "C" -{ - typedef xios::CExtractDomainToAxis* extract_domain_to_axis_Ptr; - - void cxios_set_extract_domain_to_axis_direction(extract_domain_to_axis_Ptr extract_domain_to_axis_hdl, const char * direction, int direction_size) - { - std::string direction_str; - if (!cstr2string(direction, direction_size, direction_str)) return; - CTimer::get("XIOS").resume(); - extract_domain_to_axis_hdl->direction.fromString(direction_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_extract_domain_to_axis_direction(extract_domain_to_axis_Ptr extract_domain_to_axis_hdl, char * direction, int direction_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(extract_domain_to_axis_hdl->direction.getInheritedStringValue(), direction, direction_size)) - ERROR("void cxios_get_extract_domain_to_axis_direction(extract_domain_to_axis_Ptr extract_domain_to_axis_hdl, char * direction, int direction_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_extract_domain_to_axis_direction(extract_domain_to_axis_Ptr extract_domain_to_axis_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = extract_domain_to_axis_hdl->direction.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_extract_domain_to_axis_position(extract_domain_to_axis_Ptr extract_domain_to_axis_hdl, int position) - { - CTimer::get("XIOS").resume(); - extract_domain_to_axis_hdl->position.setValue(position); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_extract_domain_to_axis_position(extract_domain_to_axis_Ptr extract_domain_to_axis_hdl, int* position) - { - CTimer::get("XIOS").resume(); - *position = extract_domain_to_axis_hdl->position.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_extract_domain_to_axis_position(extract_domain_to_axis_Ptr extract_domain_to_axis_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = extract_domain_to_axis_hdl->position.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } -} diff --git a/xios_2311_src/trunk/.svn/pristine/56/56b49933424b57cac4f7be3414537c5d06a1c5be.svn-base b/xios_2311_src/trunk/.svn/pristine/56/56b49933424b57cac4f7be3414537c5d06a1c5be.svn-base deleted file mode 100644 index f00d26ad8b968489b744542bb1d14010fe3b8a76..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/56/56b49933424b57cac4f7be3414537c5d06a1c5be.svn-base +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef __XIOS_NODE_ENUM__ -#define __XIOS_NODE_ENUM__ - -//#define DECLARE_NODE(Name_, name_) ,e##Name_, g##Name_ -//#define DECLARE_NODE_PAR(Name_, name_) ,e##Name_, g##Name_ - -namespace xios -{ - /// ////////////////////// Définitions ////////////////////// /// - typedef enum _node_type - { - Unknown = 0, - eAxis,gAxis, - eDomain,gDomain, - eField,gField, - eFile,gFile, - eCouplerIn,gCouplerIn, - eCouplerOut,gCouplerOut, - eGrid,gGrid, - eVariable,gVariable, - eContext,gContext, - eCalendarWrapper, - eTransformation, - eInverseAxis, - eZoomAxis, - eInterpolateAxis, - eExtractAxis, - eZoomDomain, - eInterpolateDomain, - eGenerateRectilinearDomain, - eScalar, - eReduceAxisToScalar, - eReduceDomainToAxis, - eReduceAxisToAxis, - eExtractDomainToAxis, - eComputeConnectivityDomain, - eExpandDomain, - eExtractAxisToScalar, - eReduceDomainToScalar, - eTemporalSplitting, - eDuplicateScalarToAxis, - eReduceScalarToScalar, - eReorderDomain, - eExtractDomain - } ENodeType; - -} // namespace xios - -#endif // __XIOS_NODE_ENUM__ diff --git a/xios_2311_src/trunk/.svn/pristine/56/56d515a255694c5b8be1c7d75c6591a7c7c9a86d.svn-base b/xios_2311_src/trunk/.svn/pristine/56/56d515a255694c5b8be1c7d75c6591a7c7c9a86d.svn-base deleted file mode 100644 index 16794bb76d5e280cbf794bedcf515007ba56bdef..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/56/56d515a255694c5b8be1c7d75c6591a7c7c9a86d.svn-base +++ /dev/null @@ -1,154 +0,0 @@ -#include "xml_parser.hpp" - -#include "context.hpp" - -#include "attribute_template.hpp" -#include "object_template.hpp" -#include "group_template.hpp" - -namespace xios -{ - namespace xml - { - /// ////////////////////// Définitions ////////////////////// /// - - void CXMLParser::ParseFile(const StdString & filename, const std::set& parseContextList) - TRY - { - StdIFStream ifs ( filename.c_str() , StdIFStream::in ); - if ( (ifs.rdstate() & std::ifstream::failbit ) != 0 ) - ERROR("void CXMLParser::ParseFile(const StdString & filename)", - < file" ); - - CXMLParser::ParseStream(ifs, filename, parseContextList); - } - CATCH - - void CXMLParser::ParseString(const StdString & xmlContent) - { - StdIStringStream iss ( xmlContent /*, StdIStringStream::in*/ ); - std::set contxtList; - CXMLParser::ParseStream(iss,"string", contxtList); - } - - void CXMLParser::ParseStream(StdIStream & stream, const string& fluxId, const std::set& parseContextList) - { - if (!stream.good()) - ERROR("CXMLParser::ParseStream(const StdIStream & stream)", - << "Bad xml stream !"); - StdOStringStream oss; - while(!stream.eof() && !stream.fail ()) oss.put(stream.get()); - const StdString xmlcontent( oss.str(), 0, oss.str().size()-1 ); - try - { - rapidxml::xml_document doc; - doc.parse<0>(const_cast(xmlcontent.c_str())); - - CXMLNode node(doc.first_node()); - THashAttributes attributes; - - if (node.getElementName().compare(CXMLNode::GetRootName()) != 0) - ERROR("CXMLParser::ParseStream(StdIStream & stream)", - << "Root element should be named simulation (actual = \'" - << node.getElementName() << "\')!"); - - std::set::iterator it; - std::set::const_iterator itE = parseContextList.end(); - bool isParseAll = (parseContextList.empty()); - try - { - if (node.goToChildElement()) - { - do - { - CContextGroup* group_context = CContext::getRoot() ; - - attributes = node.getAttributes(); - - if (attributes.end() == attributes.find("id")) - { - DEBUG("The context will not be processed because it is not identified (missing id)"); - continue; - } - - CContext::setCurrent(attributes["id"]) ; - - if (isParseAll) - { - CContext* context = CContext::create(attributes["id"]); - context->parse(node); - - attributes.clear(); - } - else - { - it = parseContextList.find(attributes["id"]); - if (itE != it) - { - CContext* context = CContext::create(*it); - context->parse(node); - - attributes.clear(); - } - } - } while (node.goToNextElement()); - } - } - catch(CException& e) - { - CException::StackInfo stk; - stk.info.append("Exception occurred while parsing XML file \""); - stk.info.append(attributes["src"]); - stk.info.append("\".\n"); - stk.file = FILE_NAME; - stk.function = FUNCTION_NAME; - stk.line = __LINE__; - e.stack.push_back(stk); - if (CXios::xiosStack) - throw; - else - throw 0; - } - catch(...) - { - CException exc; - CException::StackInfo stk; - stk.info.append("Exception occurred while parsing XML file \""); - stk.info.append(attributes["src"]); - stk.info.append("\".\n"); - stk.file = FILE_NAME; - stk.function = FUNCTION_NAME; - stk.line = __LINE__; - exc.stack.push_back(stk); - if (CXios::xiosStack) - throw exc; - else - throw 0; - } - - } - catch (rapidxml::parse_error & exc) - { - const char* ptr = exc.where() ; - const char* begin = xmlcontent.c_str() ; - const char* content=oss.str().c_str() ; - size_t pos=ptr-begin ; - int lineNumber = 1 ; - int columnNumber = 0 ; - const char* line; - const char* endLine; - - for(const char* i=content;i at character "<< pos<<" line "< and it should be used (not on Ultrix). - */ -#define HAVE_ALLOCA_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_CTYPE_H 1 - -/* Is CURLOPT_KEYPASSWD defined */ -#define HAVE_CURLOPT_KEYPASSWD 1 - -/* Define to 1 if you have the declaration of `isfinite', and to 0 if you - don't. */ -#define HAVE_DECL_ISFINITE 1 - -/* Define to 1 if you have the declaration of `isinf', and to 0 if you don't. - */ -#define HAVE_DECL_ISINF 1 - -/* Define to 1 if you have the declaration of `isnan', and to 0 if you don't. - */ -#define HAVE_DECL_ISNAN 1 - -/* Define to 1 if you have the declaration of `signbit', and to 0 if you - don't. */ -#define HAVE_DECL_SIGNBIT 1 - -/* Define to 1 if you have the header file, and it defines `DIR'. - */ -#define HAVE_DIRENT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_DLFCN_H 1 - -/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ -/* #undef HAVE_DOPRNT */ - -/* Define to 1 if you have the header file. */ -#define HAVE_ERRNO_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_FCNTL_H 1 - -/* Define to 1 if you have the `fsync' function. */ -#define HAVE_FSYNC 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_GETOPT_H 1 - -/* Define to 1 if you have the `getpagesize' function. */ -#define HAVE_GETPAGESIZE 1 - -/* Define to 1 if you have the `getrlimit' function. */ -#define HAVE_GETRLIMIT 1 - -/* Define to 1 if you have the `gettimeofday' function. */ -#define HAVE_GETTIMEOFDAY 1 - -/* Define to 1 if you have the `H5Pget_fapl_mpio' function. */ -#define HAVE_H5PGET_FAPL_MPIO 1 - -/* Define to 1 if you have the `H5Pget_fapl_mpiposix' function. */ -#define HAVE_H5PGET_FAPL_MPIPOSIX 1 - -/* Define to 1 if you have the `H5Pset_deflate' function. */ -#define HAVE_H5PSET_DEFLATE 1 - -/* Define to 1 if you have the `H5Z_SZIP' function. */ -/* #undef HAVE_H5Z_SZIP */ - -/* Define to 1 if you have the header file. */ -#define HAVE_HDF5_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the `df' library (-ldf). */ -/* #undef HAVE_LIBDF */ - -/* Define to 1 if you have the `m' library (-lm). */ -#define HAVE_LIBM 1 - -/* Define to 1 if you have the `mfhdf' library (-lmfhdf). */ -/* #undef HAVE_LIBMFHDF */ - -/* Define to 1 if you have the `pnetcdf' library (-lpnetcdf). */ -/* #undef HAVE_LIBPNETCDF */ - -/* Define to 1 if you have the header file. */ -#define HAVE_LOCALE_H 1 - -/* Define to 1 if the system has the type `longlong'. */ -/* #undef HAVE_LONGLONG */ - -/* Define to 1 if the system has the type `long long int'. */ -#define HAVE_LONG_LONG_INT 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MALLOC_H 1 - -/* Define to 1 if you have the `memmove' function. */ -#define HAVE_MEMMOVE 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_MFHDF_H */ - -/* Define to 1 if you have the `mkstemp' function. */ -#define HAVE_MKSTEMP 1 - -/* Define to 1 if you have a working `mmap' system call. */ -#define HAVE_MMAP 1 - -/* Define to 1 if you have the `MPI_Comm_f2c' function. */ -#define HAVE_MPI_COMM_F2C 1 - -/* Define to 1 if you have the `mremap' function. */ -#define HAVE_MREMAP 1 - -/* Define to 1 if you have the header file, and it defines `DIR'. */ -/* #undef HAVE_NDIR_H */ - -/* Define to 1 if the system has the type `ptrdiff_t'. */ -#define HAVE_PTRDIFF_T 1 - -/* Define to 1 if you have the `rand' function. */ -#define HAVE_RAND 1 - -/* Define to 1 if you have the `snprintf' function. */ -#define HAVE_SNPRINTF 1 - -/* Define to 1 if the system has the type `ssize_t'. */ -#define HAVE_SSIZE_T 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDARG_H 1 - -/* Define to 1 if stdbool.h conforms to C99. */ -#define HAVE_STDBOOL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDIO_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the `strcasecmp' function. */ -#define HAVE_STRCASECMP 1 - -/* Define to 1 if you have the `strcat' function. */ -#define HAVE_STRCAT 1 - -/* Define to 1 if you have the `strchr' function. */ -#define HAVE_STRCHR 1 - -/* Define to 1 if you have the `strcpy' function. */ -#define HAVE_STRCPY 1 - -/* Define to 1 if you have the `strdup' function. */ -#define HAVE_STRDUP 1 - -/* Define to 1 if you have the `strerror' function. */ -#define HAVE_STRERROR 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the `strlcat' function. */ -/* #undef HAVE_STRLCAT */ - -/* Define to 1 if you have the `strrchr' function. */ -#define HAVE_STRRCHR 1 - -/* Define to 1 if you have the `strstr' function. */ -#define HAVE_STRSTR 1 - -/* Define to 1 if you have the `strtod' function. */ -#define HAVE_STRTOD 1 - -/* Define to 1 if you have the `strtoll' function. */ -#define HAVE_STRTOLL 1 - -/* Define to 1 if you have the `strtoull' function. */ -#define HAVE_STRTOULL 1 - -/* Define to 1 if `st_blksize' is member of `struct stat'. */ -#define HAVE_STRUCT_STAT_ST_BLKSIZE 1 - -/* Define to 1 if your `struct stat' has `st_blksize'. Deprecated, use - `HAVE_STRUCT_STAT_ST_BLKSIZE' instead. */ -#define HAVE_ST_BLKSIZE 1 - -/* Define to 1 if you have the `sysconf' function. */ -#define HAVE_SYSCONF 1 - -/* Define to 1 if you have the header file, and it defines `DIR'. - */ -/* #undef HAVE_SYS_DIR_H */ - -/* Define to 1 if you have the header file, and it defines `DIR'. - */ -/* #undef HAVE_SYS_NDIR_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_PARAM_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_RESOURCE_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TIME_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have that is POSIX.1 compatible. */ -#define HAVE_SYS_WAIT_H 1 - -/* Define to 1 if the system has the type `uchar'. */ -/* #undef HAVE_UCHAR */ - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to 1 if the system has the type `unsigned long long int'. */ -#define HAVE_UNSIGNED_LONG_LONG_INT 1 - -/* Define to 1 if you have the `vprintf' function. */ -#define HAVE_VPRINTF 1 - -/* Define to 1 if the system has the type `_Bool'. */ -#define HAVE__BOOL 1 - -/* do large file tests */ -/* #undef LARGE_FILE_TESTS */ - -/* If true, turn on logging. */ -/* #undef LOGGING */ - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#define LT_OBJDIR ".libs/" - -/* max size of the default per-var chunk cache. */ -#define MAX_DEFAULT_CACHE_SIZE 67108864 - -/* min blocksize for posixio. */ -#define NCIO_MINBLOCKSIZE 256 - -/* no IEEE float on this platform */ -/* #undef NO_IEEE_FLOAT */ - -/* Define to 1 if your C compiler doesn't accept -c and -o together. */ -/* #undef NO_MINUS_C_MINUS_O */ - -/* do not build the netCDF version 2 API */ -/* #undef NO_NETCDF_2 */ - -/* no stdlib.h */ -/* #undef NO_STDLIB_H */ - -/* no sys_types.h */ -/* #undef NO_SYS_TYPES_H */ - -/* Name of package */ -#define PACKAGE "netcdf" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "support-netcdf@unidata.ucar.edu" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "netCDF" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "netCDF 4.2.1.1" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "netcdf" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "4.2.1.1" - -/* The size of `double', as computed by sizeof. */ -#define SIZEOF_DOUBLE 8 - -/* The size of `float', as computed by sizeof. */ -#define SIZEOF_FLOAT 4 - -/* The size of `int', as computed by sizeof. */ -#define SIZEOF_INT 4 - -/* The size of `long', as computed by sizeof. */ -#define SIZEOF_LONG 8 - -/* The size of `long long', as computed by sizeof. */ -#define SIZEOF_LONG_LONG 8 - -/* The size of `off_t', as computed by sizeof. */ -#define SIZEOF_OFF_T 8 - -/* The size of `short', as computed by sizeof. */ -#define SIZEOF_SHORT 2 - -/* The size of `size_t', as computed by sizeof. */ -#define SIZEOF_SIZE_T 8 - -/* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at runtime. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown */ -/* #undef STACK_DIRECTION */ - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Place to put very large netCDF test files. */ -#define TEMP_LARGE "." - -/* Define to 1 if you can safely include both and . */ -#define TIME_WITH_SYS_TIME 1 - -/* if true, build CDMREMOTE Client */ -/* #undef USE_CDMREMOTE */ - -/* if true, build DAP Client */ -#define USE_DAP 1 - -/* if true, include NC_DISKLESS code */ -#define USE_DISKLESS 1 - -/* set this to use extreme numbers in tests */ -#define USE_EXTREME_NUMBERS 1 - -/* if true, use ffio instead of posixio */ -/* #undef USE_FFIO */ - -/* if true, include experimental fsync code */ -#define USE_FSYNC 1 - -/* if true, use HDF4 too */ -/* #undef USE_HDF4 */ - -/* If true, use use wget to fetch some sample HDF4 data, and then test against - it. */ -/* #undef USE_HDF4_FILE_TESTS */ - -/* if true, use mmap for in-memory files */ -/* #undef USE_MMAP */ - -/* if true, build netCDF-4 */ -#define USE_NETCDF4 1 - -/* if true, parallel netCDF-4 is in use */ -#define USE_PARALLEL 1 - -/* if true, compile in parallel netCDF-4 based on MPI/IO */ -#define USE_PARALLEL_MPIO 1 - -/* if true, compile in parallel netCDF-4 based on MPI/POSIX */ -#define USE_PARALLEL_POSIX 1 - -/* if true, parallel netCDF is used */ -/* #undef USE_PNETCDF */ - -/* if true, compile in szip compression in netCDF-4 variables */ -/* #undef USE_SZIP */ - -/* if true, compile in zlib compression in netCDF-4 variables */ -#define USE_ZLIB 1 - -/* Version number of package */ -#define VERSION "4.2.1.1" - -/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most - significant byte first (like Motorola and SPARC, unlike Intel). */ -#if defined AC_APPLE_UNIVERSAL_BUILD -# if defined __BIG_ENDIAN__ -# define WORDS_BIGENDIAN 1 -# endif -#else -# ifndef WORDS_BIGENDIAN -/* # undef WORDS_BIGENDIAN */ -# endif -#endif - -/* Number of bits in a file offset, on hosts where this is settable. */ -/* #undef _FILE_OFFSET_BITS */ - -/* Define for large files, on AIX-style hosts. */ -/* #undef _LARGE_FILES */ - -/* Define to 1 if type `char' is unsigned and you are not using gcc. */ -#ifndef __CHAR_UNSIGNED__ -/* # undef __CHAR_UNSIGNED__ */ -#endif - -/* Define to empty if `const' does not conform to ANSI C. */ -/* #undef const */ - -/* Define to `long int' if does not define. */ -/* #undef off_t */ - -/* Define to `unsigned int' if does not define. */ -/* #undef size_t */ - -#include "ncconfigure.h" diff --git a/xios_2311_src/trunk/.svn/pristine/57/5737db4a83be210f1ca4915f7feaa7a75b59d94c.svn-base b/xios_2311_src/trunk/.svn/pristine/57/5737db4a83be210f1ca4915f7feaa7a75b59d94c.svn-base deleted file mode 100644 index d2a3c3d9a850d363f7790dfc0eeafac03afc7b8f..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/57/5737db4a83be210f1ca4915f7feaa7a75b59d94c.svn-base +++ /dev/null @@ -1,298 +0,0 @@ -/* - * $Header$ - * $Locker$ - - Copyright (c) 2010-2012, Rogue Wave Software, Inc. - - Permission is hereby granted, free of charge, to any person obtaining a copy - of the tv_data_display.h and tv_data_display.c files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies - of the Software, and to permit persons to whom the Software is furnished to do - so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, - INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A - PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - * Update log - * - * Feb 1 2012 NYP: Updated Copyright - * Apr 18 2011 SJT: TVT-13122, comment cleanup. - * Sep 27 2010 ANB: lots of changes as part of totalview/12314. - * Reworked to reduce the dependencies on outside - * entities, both at compile and also at runtime. - * Adjusted the naming scheme. - * Jan 28 2010 SJT: Bug 12100, bump base size to 16K and recognize if it is - * resized further. - * Sep 24 2009 SJT: Remove pre/post callback to reduce function call overhead. - * Jul 1 2009 SJT: Created. - * - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "tv_data_display.h" - -#include -#include /* for size_t */ - -#define DATA_FORMAT_BUFFER_SIZE 16384 -#define TV_FORMAT_INACTIVE 0 -#define TV_FORMAT_FIRST_CALL 1 -#define TV_FORMAT_APPEND_CALL 2 - -volatile int TV_ttf_data_format_control = TV_FORMAT_INACTIVE; -int TV_ttf_data_display_api_version = TV_TTF_DATA_DISPLAY_API_VERSION; - -/* TV_ttf_data_format_buffer should not be static for icc 11, and others */ -char TV_ttf_data_format_buffer[DATA_FORMAT_BUFFER_SIZE]; -static char *TV_ttf_data_buffer_ptr = TV_ttf_data_format_buffer; - -static const char digits [] = "0123456789abcdefghijklmnopqrstuvwxyz"; -static const size_t base_bound = sizeof ( digits ); - -/* ************************************************************************ */ - -int -TV_ttf_is_format_result_ok ( TV_ttf_format_result fr ) -{ - int ret_val; - - switch ( fr ) - { - case TV_ttf_format_ok: - case TV_ttf_format_ok_elide: - ret_val = 1; - break; - default: - ret_val = 0; - break; - } - return ret_val; -} /* TV_ttf_is_format_result_ok */ - -/* ************************************************************************ */ - -static -void * -my_zeroit ( void *s, size_t n ) -{ - char *cp = (char *) s; - - /* not the most efficient of solutions. What we should do is */ - /* do the assugnments in units of int or long. The problem */ - /* with that is ensuring that the alignments of the assignments */ - /* are correct. The difficulty with that is doing arithmetic */ - /* on pointers in a portable manner. */ - while ( n > 0 ) - { - *cp++ = 0; - n--; - } - - return s; -} /* my_zeroit */ - -static -char * -my_strpbrk ( const char *str, const char *accept ) -{ - char *ret_val = NULL; - char *s, *t; - - for ( s = (char *) str; (*s) && (! ret_val); s++ ) - { - for ( t = (char *) accept; (*t) && (! ret_val); t++ ) - { - if ( *s == *t ) - ret_val = s; - } - } - - return ret_val; -} /* my_strpbrk */ - -static -int -marshal_string ( char *buffer, size_t len, const char *s, - char **nbuffer, size_t *nlen ) -{ - int ret_val = 0; - char *cursor = buffer; - - while ( *s ) - { - ret_val++; - if ( len > 1 ) - { - *cursor++ = *s++; - len--; - } - } - if ( len > 0 ) - *cursor = '\0'; - - if ( nbuffer ) - *nbuffer = cursor; - if ( nlen ) - *nlen = len; - - return ret_val; -} /* marshal_string */ - -static -int -marshal_unsigned_body ( char *buffer, size_t len, size_t val, int base, - char **nbuffer, size_t *nlen ) -{ - - int ret_val = 0; - size_t q, r; - char digit [ 2 ]; - char *my_buffer = buffer; - size_t my_len = len; - - if ( val < base ) - { - r = val; - } - else - { - q = val / base; - r = val - (q * base); - ret_val += marshal_unsigned_body ( buffer, len, q, base, - &my_buffer, &my_len ); - } - digit [ 0 ] = digits [ r ]; - digit [ 1 ] = '\0'; - ret_val += marshal_string ( my_buffer, my_len, digit, nbuffer, nlen ); - - return ret_val; -} /* marshal_unsigned_body */ - -static -int -marshal_unsigned ( char *buffer, size_t len, size_t val, int base, - char **nbuffer, size_t *nlen ) -{ - int ret_val = 0; - - if ( 0 == base ) - base = 10; - if ( base < base_bound ) - ret_val = marshal_unsigned_body ( buffer, len, val, base, nbuffer, nlen ); - else - ret_val = -1; - - return ret_val; -} /* marshal_unsigned */ - -static -int -marshal_hex ( char *buffer, size_t len, size_t hex_val, - char **nbuffer, size_t *nlen ) -{ - int ret_val = 0; - char *my_buffer; - size_t my_len; - - ret_val += marshal_string ( buffer, len, "0x", &my_buffer, &my_len ); - ret_val += marshal_unsigned ( my_buffer, my_len, hex_val, 16, nbuffer, nlen ); - - return ret_val; -} /* marshal_hex */ - -static -int -marshal_row ( char *buffer, size_t len, const char *field_name, - const char *type_name, - const void *value, - char **nbuffer, - size_t *nlen ) -{ - int ret_val = 0; - char *my_buffer; - size_t my_len; - - ret_val += marshal_string ( buffer, len, field_name, &my_buffer, &my_len ); - ret_val += marshal_string ( my_buffer, my_len, "\t", &my_buffer, &my_len ); - ret_val += marshal_string ( my_buffer, my_len, type_name, &my_buffer, &my_len ); - ret_val += marshal_string ( my_buffer, my_len, "\t", &my_buffer, &my_len ); - ret_val += marshal_hex ( my_buffer, my_len, (size_t) value, &my_buffer, &my_len ); - ret_val += marshal_string ( my_buffer, my_len, "\n", nbuffer, nlen ); - - return ret_val; -} /* marshal_row */ - -int TV_ttf_add_row(const char *field_name, - const char *type_name, - const void *value) -{ - size_t remaining; - int out; - - /* - printf ( "TV_ttf_add_row: on entry TV_ttf_data_format_control == %d\n", TV_ttf_data_format_control ); - */ - - /* Called at the wrong time */ - if (TV_ttf_data_format_control == TV_FORMAT_INACTIVE) - return TV_ttf_ec_not_active; - - if (my_strpbrk(field_name, "\n\t") != NULL) - return TV_ttf_ec_invalid_characters; - - if (my_strpbrk(type_name, "\n\t") != NULL) - return TV_ttf_ec_invalid_characters; - - if (TV_ttf_data_format_control == TV_FORMAT_FIRST_CALL) - { - /* Zero out the buffer to avoid confusion, and set the write point - to the top of the buffer. */ - - my_zeroit(TV_ttf_data_format_buffer, sizeof (TV_ttf_data_format_buffer)); - TV_ttf_data_buffer_ptr = TV_ttf_data_format_buffer; - TV_ttf_data_format_control = TV_FORMAT_APPEND_CALL; - } - - remaining = TV_ttf_data_buffer_ptr + - DATA_FORMAT_BUFFER_SIZE - TV_ttf_data_format_buffer; - -/* - out = snprintf(TV_ttf_data_buffer_ptr, - remaining, "%s\t%s\t%p\n", - field_name, type_name, value); -*/ - out = marshal_row ( TV_ttf_data_buffer_ptr, remaining, - field_name, type_name, value, 0, 0 ); - - if (out < 1) - return TV_ttf_ec_buffer_exhausted; - - TV_ttf_data_buffer_ptr += out; - - return 0; -} /* TV_ttf_add_row */ - -void TV_ttf_pre_display_callback(void) -{ - TV_ttf_data_format_control = TV_FORMAT_FIRST_CALL; -} - -void TV_ttf_post_display_callback(void) -{ - TV_ttf_data_format_control = TV_FORMAT_INACTIVE; -} - -#ifdef __cplusplus -} -#endif diff --git a/xios_2311_src/trunk/.svn/pristine/57/57590b844633d9fe1f2f5660a10f3e8d840c5a7c.svn-base b/xios_2311_src/trunk/.svn/pristine/57/57590b844633d9fe1f2f5660a10f3e8d840c5a7c.svn-base deleted file mode 100644 index ce3e7efe8e1617e18ca20693e930e94c36e552e9..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/57/57590b844633d9fe1f2f5660a10f3e8d840c5a7c.svn-base +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef __XIOS_CGregorianCalendar__ -#define __XIOS_CGregorianCalendar__ - -/// XIOS headers /// -#include "xios_spl.hpp" -#include "calendar.hpp" - -namespace xios -{ - /// ////////////////////// Déclarations ////////////////////// /// - class CGregorianCalendar : public CCalendar - { - /// Typedef /// - typedef CCalendar SuperClass; - - public : - - /// Constructeur /// -// CGregorianCalendar(void); // Not implemented yet. - CGregorianCalendar(const CDate& startDate); - CGregorianCalendar(const CDate& startDate, const CDate& timeOrigin); - CGregorianCalendar(int yr = 0, int mth = 1, int d = 1, - int hr = 0, int min = 0, int sec = 0); - CGregorianCalendar(const CGregorianCalendar& calendar); // Not implemented yet. - CGregorianCalendar(const CGregorianCalendar* calendar); // Not implemented yet. - - /// Accesseurs /// - virtual int getYearTotalLength(const CDate & date) const; - virtual int getMonthLength(const CDate & date) const; - virtual StdString getType(void) const; - - virtual bool hasLeapYear() const; - - /// Destructeur /// - virtual ~CGregorianCalendar(void); - - }; // class CGregorianCalendar - -} // namespace xios - -#endif // __XIOS_CGregorianCalendar__ diff --git a/xios_2311_src/trunk/.svn/pristine/57/5799ca54fa4b910fe48f258f5c9518ae059d2cfd.svn-base b/xios_2311_src/trunk/.svn/pristine/57/5799ca54fa4b910fe48f258f5c9518ae059d2cfd.svn-base deleted file mode 100644 index ee04626348354284888207f27ef23d52c318625c..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/57/5799ca54fa4b910fe48f258f5c9518ae059d2cfd.svn-base +++ /dev/null @@ -1,2137 +0,0 @@ -/*! - \file mesh.cpp - \author Olga Abramkina - \brief Definition of class CMesh. -*/ - -#include "mesh.hpp" -#include -//#include - -namespace xios { - -/// ////////////////////// Définitions ////////////////////// /// - - CMesh::CMesh(void) : nbNodesGlo(0), nbEdgesGlo(0) - , node_start(0), node_count(0) - , edge_start(0), edge_count(0) - , nbFaces_(0), nbNodes_(0), nbEdges_(0) - , nodesAreWritten(false), edgesAreWritten(false), facesAreWritten(false) - , node_lon(), node_lat() - , edge_lon(), edge_lat(), edge_nodes() - , face_lon(), face_lat() - , face_nodes() - , pNodeGlobalIndex(NULL), pEdgeGlobalIndex(NULL) - { - } - - - CMesh::~CMesh(void) - { - if (pNodeGlobalIndex != NULL) delete pNodeGlobalIndex; - if (pEdgeGlobalIndex != NULL) delete pEdgeGlobalIndex; - } - - std::map CMesh::meshList = std::map (); - std::map > CMesh::domainList = std::map >(); - -///--------------------------------------------------------------- -/*! - * \fn bool CMesh::getMesh (StdString meshName) - * Returns a pointer to a mesh. If a mesh has not been created, creates it and adds its name to the list of meshes meshList. - * \param [in] meshName The name of a mesh ("name" attribute of a domain). - * \param [in] nvertex Number of verteces (1 for nodes, 2 for edges, 3 and up for faces). - */ - CMesh* CMesh::getMesh (StdString meshName, int nvertex) - { - CMesh::domainList[meshName].push_back(nvertex); - - if ( CMesh::meshList.begin() != CMesh::meshList.end() ) - { - for (std::map::iterator it=CMesh::meshList.begin(); it!=CMesh::meshList.end(); ++it) - { - if (it->first == meshName) - return &meshList[meshName]; - else - { - CMesh newMesh; - CMesh::meshList.insert( make_pair(meshName, newMesh) ); - return &meshList[meshName]; - } - } - } - else - { - CMesh newMesh; - CMesh::meshList.insert( make_pair(meshName, newMesh) ); - return &meshList[meshName]; - } - - MISSING_RETURN( "CMesh* CMesh::getMesh (StdString meshName, int nvertex)" ); - return nullptr; - } - -///---------------------------------------------------------------- - size_t hashPair(size_t first, size_t second) - { - HashXIOS sizetHash; - size_t seed = sizetHash(first) + 0x9e3779b9 ; - seed ^= sizetHash(second) + 0x9e3779b9 + (seed << 6) + (seed >> 2); - return seed ; - } - -///---------------------------------------------------------------- - size_t hashPairOrdered(size_t first, size_t second) - { - size_t seed; - HashXIOS sizetHash; - if (first < second) - { - seed = sizetHash(first) + 0x9e3779b9 ; - seed ^= sizetHash(second) + 0x9e3779b9 + (seed << 6) + (seed >> 2); - } - else - { - seed = sizetHash(second) + 0x9e3779b9 ; - seed ^= sizetHash(first) + 0x9e3779b9 + (seed << 6) + (seed >> 2); - } - return seed ; - } - -///---------------------------------------------------------------- -/*! - * \fn size_t generateNodeIndex(vector& valList, int rank) - * Generates a node index. - * If the same node is generated by two processes, each process will have its own node index. - * \param [in] valList Vector storing four node hashes. - * \param [in] rank MPI process rank. - */ - size_t generateNodeIndex(vector& valList, int rank) - { - // Sort is needed to avoid problems for nodes with lon = 0 generated by faces in east and west semisphere - vector vec = valList; - sort (vec.begin(), vec.end()); - size_t seed = rank ; - int it = 0; - for(; it != vec.size(); ++it) - { - seed = hashPair(seed, vec[it]); - } - return seed ; - } - - ///---------------------------------------------------------------- - /*! - * \fn size_t generateNodeIndex(vector& valList) - * Generates a node index unique for all processes. - * \param [in] valList Vector storing four node hashes. - */ - size_t generateNodeIndex(vector& valList) - { - // Sort is needed to avoid problems for nodes with lon = 0 generated by faces in east and west semisphere - vector vec = valList; - sort (vec.begin(), vec.end()); - size_t seed = vec[0] ; - int it = 1; - for(; it != vec.size(); ++it) - { - seed = hashPair(seed, vec[it]); - } - return seed ; - } - -///---------------------------------------------------------------- -/*! - * \fn CArray& CMesh::createHashes (const double longitude, const double latitude) - * Creates two hash values for each dimension, longitude and latitude. - * \param [in] longitude Node longitude in degrees. - * \param [in] latitude Node latitude in degrees ranged from 0 to 360. - */ - - vector CMesh::createHashes (const double longitude, const double latitude) - { - double minBoundLon = 0. ; - double maxBoundLon = 360. ; - double minBoundLat = -90. ; - double maxBoundLat = 90. ; - double prec=1e-11 ; - double precLon=prec ; - double precLat=prec ; - double lon = longitude; - double lat = latitude; - - if (lon > (360.- prec)) lon = 0.; - - size_t maxsize_t=numeric_limits::max() ; - if ( (maxBoundLon-minBoundLon)/maxsize_t > precLon) precLon=(maxBoundLon-minBoundLon)/maxsize_t ; - if ( (maxBoundLat-minBoundLat)/maxsize_t > precLat) precLat=(maxBoundLat-minBoundLat)/maxsize_t ; - - size_t iMinLon=0 ; - size_t iMaxLon=(maxBoundLon-minBoundLon)/precLon ; - size_t iMinLat=0 ; - size_t iMaxLat=(maxBoundLat-minBoundLat)/precLat ; - - vector hash(4); - size_t lon0,lon1,lat0,lat1 ; - - lon0=(lon-minBoundLon)/precLon ; - if ( ((lon0+1)*precLon + lon0*precLon)/2 > lon-minBoundLon) - { - if (lon0==iMinLon) lon1=iMaxLon ; - else lon1=lon0-1 ; - } - else - { - if (lon0==iMaxLon) lon1=iMinLon ; - else lon1=lon0+1 ; - } - - lat0=(lat-minBoundLat)/precLat ; - if ( ((lat0+1)*precLat + lat0*precLat)/2 > lat-minBoundLat) - { - if (lat0==iMinLat) lat1=lat0 ; - else lat1=lat0-1 ; - } - else - { - if (lat0==iMaxLat) lat1=lat0 ; - else lat1=lat0+1 ; - } - - hash[0] = hashPair(lon0,lat0) ; - hash[1] = hashPair(lon0,lat1) ; - hash[2] = hashPair(lon1,lat0) ; - hash[3] = hashPair(lon1,lat1) ; - - return hash; - - } // createHashes - -///---------------------------------------------------------------- - std::pair make_ordered_pair(int a, int b) - { - if ( a < b ) - return std::pair(a,b); - else - return std::pair(b,a); - } - -///---------------------------------------------------------------- -/*! - * \fn void CMesh::createMesh(const CArray& lonvalue, const CArray& latvalue, - const CArray& bounds_lon, const CArray& bounds_lat) - * Creates or updates a mesh for the three types of mesh elements: nodes, edges, and faces. - * \param [in] lonvalue Array of longitudes. - * \param [in] latvalue Array of latitudes. - * \param [in] bounds_lon Array of boundary longitudes. Its size depends on the element type. - * \param [in] bounds_lat Array of boundary latitudes. Its size depends on the element type. - */ -// void CMesh::createMesh(const CArray& lonvalue, const CArray& latvalue, -// const CArray& bounds_lon, const CArray& bounds_lat) -// { -// int nvertex = (bounds_lon.numElements() == 0) ? 1 : bounds_lon.rows(); -// -// if (nvertex == 1) -// { -// nbNodes_ = lonvalue.numElements(); -// node_lon.resizeAndPreserve(nbNodes_); -// node_lat.resizeAndPreserve(nbNodes_); -// for (int nn = 0; nn < nbNodes_; ++nn) -// { -// if (map_nodes.find(make_pair (lonvalue(nn), latvalue(nn))) == map_nodes.end()) -// { -// map_nodes[make_pair (lonvalue(nn), latvalue(nn))] = nn ; -// node_lon(nn) = lonvalue(nn); -// node_lat(nn) = latvalue(nn); -// } -// } -// } -// else if (nvertex == 2) -// { -// nbEdges_ = bounds_lon.shape()[1]; -// -// // Create nodes and edge_node connectivity -// node_lon.resizeAndPreserve(nbEdges_*nvertex); // Max possible number of nodes -// node_lat.resizeAndPreserve(nbEdges_*nvertex); -// edge_nodes.resizeAndPreserve(nvertex, nbEdges_); -// -// for (int ne = 0; ne < nbEdges_; ++ne) -// { -// for (int nv = 0; nv < nvertex; ++nv) -// { -// if (map_nodes.find(make_pair (bounds_lon(nv, ne), bounds_lat(nv ,ne))) == map_nodes.end()) -// { -// map_nodes[make_pair (bounds_lon(nv, ne), bounds_lat(nv, ne))] = nbNodes_ ; -// edge_nodes(nv,ne) = nbNodes_ ; -// node_lon(nbNodes_) = bounds_lon(nv, ne); -// node_lat(nbNodes_) = bounds_lat(nv, ne); -// ++nbNodes_ ; -// } -// else -// edge_nodes(nv,ne) = map_nodes[make_pair (bounds_lon(nv, ne), bounds_lat(nv ,ne))]; -// } -// } -// node_lon.resizeAndPreserve(nbNodes_); -// node_lat.resizeAndPreserve(nbNodes_); -// -// // Create edges -// edge_lon.resizeAndPreserve(nbEdges_); -// edge_lat.resizeAndPreserve(nbEdges_); -// -// for (int ne = 0; ne < nbEdges_; ++ne) -// { -// if (map_edges.find(make_ordered_pair (edge_nodes(0,ne), edge_nodes(1,ne))) == map_edges.end()) -// { -// map_edges[make_ordered_pair ( edge_nodes(0,ne), edge_nodes(1,ne) )] = ne ; -// edge_lon(ne) = lonvalue(ne); -// edge_lat(ne) = latvalue(ne); -// } -// -// } -// edgesAreWritten = true; -// } -// else -// { -// nbFaces_ = bounds_lon.shape()[1]; -// -// // Create nodes and face_node connectivity -// node_lon.resizeAndPreserve(nbFaces_*nvertex); // Max possible number of nodes -// node_lat.resizeAndPreserve(nbFaces_*nvertex); -// face_nodes.resize(nvertex, nbFaces_); -// -// for (int nf = 0; nf < nbFaces_; ++nf) -// { -// for (int nv = 0; nv < nvertex; ++nv) -// { -// if (map_nodes.find(make_pair (bounds_lon(nv, nf), bounds_lat(nv ,nf))) == map_nodes.end()) -// { -// map_nodes[make_pair (bounds_lon(nv, nf), bounds_lat(nv, nf))] = nbNodes_ ; -// face_nodes(nv,nf) = nbNodes_ ; -// node_lon(nbNodes_) = bounds_lon(nv, nf); -// node_lat(nbNodes_) = bounds_lat(nv ,nf); -// ++nbNodes_ ; -// } -// else -// { -// face_nodes(nv,nf) = map_nodes[make_pair (bounds_lon(nv, nf), bounds_lat(nv ,nf))]; -// } -// } -// } -// node_lon.resizeAndPreserve(nbNodes_); -// node_lat.resizeAndPreserve(nbNodes_); -// -// // Create edges and edge_nodes connectivity -// edge_lon.resizeAndPreserve(nbFaces_*nvertex); // Max possible number of edges -// edge_lat.resizeAndPreserve(nbFaces_*nvertex); -// edge_nodes.resizeAndPreserve(2, nbFaces_*nvertex); -// edge_faces.resize(2, nbFaces_*nvertex); -// face_edges.resize(nvertex, nbFaces_); -// face_faces.resize(nvertex, nbFaces_); -// -// vector countEdges(nbFaces_*nvertex); // needed in case if edges have been already generated -// vector countFaces(nbFaces_); -// countEdges.assign(nbFaces_*nvertex, 0); -// countFaces.assign(nbFaces_, 0); -// int edge; -// for (int nf = 0; nf < nbFaces_; ++nf) -// { -// for (int nv1 = 0; nv1 < nvertex; ++nv1) -// { -// int nv = 0; -// int nv2 = (nv1 < nvertex -1 ) ? (nv1 + 1) : (nv1 + 1 - nvertex); // cyclic rotation -// if (map_edges.find(make_ordered_pair (face_nodes(nv1,nf), face_nodes(nv2,nf))) == map_edges.end()) -// { -// map_edges[make_ordered_pair (face_nodes(nv1,nf), face_nodes(nv2,nf))] = nbEdges_ ; -// face_edges(nv1,nf) = map_edges[make_ordered_pair (face_nodes(nv1,nf), face_nodes(nv2,nf))]; -// edge_faces(0,nbEdges_) = nf; -// edge_faces(1,nbEdges_) = -999; -// face_faces(nv1,nf) = 999999; -// edge_nodes(Range::all(),nbEdges_) = face_nodes(nv1,nf), face_nodes(nv2,nf); -// edge_lon(nbEdges_) = ( abs( node_lon(face_nodes(nv1,nf)) - node_lon(face_nodes(nv2,nf))) < 180.) ? -// (( node_lon(face_nodes(nv1,nf)) + node_lon(face_nodes(nv2,nf))) * 0.5) : -// (( node_lon(face_nodes(nv1,nf)) + node_lon(face_nodes(nv2,nf))) * 0.5 -180.); -// edge_lat(nbEdges_) = ( node_lat(face_nodes(nv1,nf)) + node_lat(face_nodes(nv2,nf)) ) * 0.5; -// ++nbEdges_; -// } -// else -// { -// edge = map_edges[make_ordered_pair (face_nodes(nv1,nf), face_nodes(nv2,nf))]; -// face_edges(nv1,nf) = edge; -// if (edgesAreWritten) -// { -// edge_faces(countEdges[edge], edge) = nf; -// if (countEdges[edge]==0) -// { -// face_faces(nv1,nf) = 999999; -// } -// else -// { -// int face1 = nf; // = edge_faces(1,edge) -// int face2 = edge_faces(0,edge); -// face_faces(countFaces[face1], face1) = face2; -// face_faces(countFaces[face2], face2) = face1; -// ++(countFaces[face1]); -// ++(countFaces[face2]); -// } -// } -// else -// { -// edge_faces(1,edge) = nf; -// int face1 = nf; // = edge_faces(1,edge) -// int face2 = edge_faces(0,edge); -// face_faces(countFaces[face1], face1) = face2; -// face_faces(countFaces[face2], face2) = face1; -// ++(countFaces[face1]); -// ++(countFaces[face2]); -// } -// ++(countEdges[edge]); -// } -// } -// } -// edge_nodes.resizeAndPreserve(2, nbEdges_); -// edge_faces.resizeAndPreserve(2, nbEdges_); -// edge_lon.resizeAndPreserve(nbEdges_); -// edge_lat.resizeAndPreserve(nbEdges_); -// -// // Create faces -// face_lon.resize(nbFaces_); -// face_lat.resize(nbFaces_); -// face_lon = lonvalue; -// face_lat = latvalue; -// facesAreWritten = true; -// -// } // nvertex > 2 -// -// } // createMesh() - -///---------------------------------------------------------------- -/*! - * \fn void CMesh::createMeshEpsilon(const CArray& lonvalue, const CArray& latvalue, - const CArray& bounds_lon, const CArray& bounds_lat) - * Creates or updates a mesh for the three types of mesh elements: nodes, edges, and faces. - * Precision check is implemented with two hash values for each dimension, longitude and latitude. - * \param [in] comm - * \param [in] lonvalue Array of longitudes. - * \param [in] latvalue Array of latitudes. - * \param [in] bounds_lon Array of boundary longitudes. Its size depends on the element type. - * \param [in] bounds_lat Array of boundary latitudes. Its size depends on the element type. - */ - void CMesh::createMeshEpsilon(const MPI_Comm& comm, - const CArray& lonvalue, const CArray& latvalue, - const CArray& bounds_lon, const CArray& bounds_lat) - { - - int nvertex = (bounds_lon.numElements() == 0) ? 1 : bounds_lon.rows(); - int mpiRank, mpiSize; - MPI_Comm_rank(comm, &mpiRank); - MPI_Comm_size(comm, &mpiSize); - double prec = 1e-11; // used in calculations of edge_lon/lat - - if (nvertex == 1) - { - nbNodes_ = lonvalue.numElements(); - node_lon.resize(nbNodes_); - node_lat.resize(nbNodes_); - node_lon = lonvalue; - node_lat = latvalue; - - // Global node indexes - vector hashValues(4); - CClientClientDHTSizet::Index2VectorInfoTypeMap nodeHash2IdxGlo; - for (size_t nn = 0; nn < nbNodes_; ++nn) - { - hashValues = CMesh::createHashes(lonvalue(nn), latvalue(nn)); - for (size_t nh = 0; nh < 4; ++nh) - { - nodeHash2IdxGlo[hashValues[nh]].push_back(mpiRank*nbNodes_ + nn); - } - } - pNodeGlobalIndex = new CClientClientDHTSizet (nodeHash2IdxGlo, comm); - nodesAreWritten = true; - } - - else if (nvertex == 2) - { - nbEdges_ = bounds_lon.shape()[1]; - edge_lon.resize(nbEdges_); - edge_lat.resize(nbEdges_); - edge_lon = lonvalue; - edge_lat = latvalue; - edge_nodes.resize(nvertex, nbEdges_); - - // For determining the global edge index - unsigned long nbEdgesOnProc = nbEdges_; - unsigned long nbEdgesAccum; - MPI_Scan(&nbEdgesOnProc, &nbEdgesAccum, 1, MPI_UNSIGNED_LONG, MPI_SUM, comm); - nbEdgesAccum -= nbEdges_; - - CClientClientDHTSizet::Index2VectorInfoTypeMap edgeHash2IdxGlo; - CClientClientDHTSizet::Index2VectorInfoTypeMap edgeHash2Idx; - - // Case (1): node indexes have been generated by domain "nodes" - if (nodesAreWritten) - { - vector hashValues(4); - CArray nodeHashList(nbEdges_*nvertex*4); - for (int ne = 0; ne < nbEdges_; ++ne) // size_t doesn't work with CArray - { - for (int nv = 0; nv < nvertex; ++nv) - { - hashValues = CMesh::createHashes(bounds_lon(nv, ne), bounds_lat(nv, ne)); - for (int nh = 0; nh < 4; ++nh) - { - nodeHashList((ne*nvertex + nv)*4 + nh) = hashValues[nh]; - } - } - } - - // Recuperating the node global indexing and writing edge_nodes - // Creating map edgeHash2IdxGlo - pNodeGlobalIndex->computeIndexInfoMapping(nodeHashList); - CClientClientDHTSizet::Index2VectorInfoTypeMap& nodeHash2IdxGlo = pNodeGlobalIndex->getInfoIndexMap(); - CClientClientDHTSizet::Index2VectorInfoTypeMap::iterator it; - size_t nodeIdxGlo1, nodeIdxGlo2; - for (int ne = 0; ne < nbEdges_; ++ne) - { - for (int nv = 0; nv < nvertex; ++nv) - { - int nh = 0; - it = nodeHash2IdxGlo.find(nodeHashList((ne*nvertex + nv)*4 + nh)); - // The loop below is needed in case if a hash generated by domain "edges" differs - // from that generated by domain "nodes" because of possible precision issues - while (it == nodeHash2IdxGlo.end()) - { - ++nh; - it = nodeHash2IdxGlo.find(nodeHashList((ne*nvertex + nv)*4 + nh)); - } - edge_nodes(nv,ne) = it->second[0]; - if (nv ==0) - nodeIdxGlo1 = it->second[0]; - else - nodeIdxGlo2 = it->second[0]; - } - size_t edgeIdxGlo = nbEdgesAccum + ne; - edgeHash2IdxGlo[ hashPairOrdered(nodeIdxGlo1, nodeIdxGlo2) ].push_back(edgeIdxGlo); - } - } // nodesAreWritten - - - // Case (2): node indexes have not been generated previously - else - { - // (2.1) Creating a list of hashes for each node and a map nodeHash2Idx > - vector hashValues(4); - CClientClientDHTSizet::Index2VectorInfoTypeMap nodeHash2Idx; - CArray nodeHashList(nbEdges_*nvertex*4); - int nbHash = 0; - for (int ne = 0; ne < nbEdges_; ++ne) - { - for (int nv = 0; nv < nvertex; ++nv) - { - hashValues = CMesh::createHashes(bounds_lon(nv, ne), bounds_lat(nv, ne)); - for (int nh = 0; nh < 4; ++nh) - { - if (nodeHash2Idx[hashValues[nh]].size() == 0) - { - nodeHash2Idx[hashValues[nh]].push_back(generateNodeIndex(hashValues)); - nodeHash2Idx[hashValues[nh]].push_back(mpiRank); - nodeHashList(nbHash) = hashValues[nh]; - ++nbHash; - } - } - } - } - if (nbHash==0) nodeHashList.resize(nbHash); - else nodeHashList.resizeAndPreserve(nbHash); - - // (2.2) Generating global node indexes - // The ownership criterion: priority of the process of smaller index - // Maps generated in this step are: - // Maps generated in this step are: - // nodeHash2Info = - // nodeIdx2Idx = > - - CClientClientDHTSizet dhtNodeHash(nodeHash2Idx, comm); - dhtNodeHash.computeIndexInfoMapping(nodeHashList); - CClientClientDHTSizet::Index2VectorInfoTypeMap& nodeHash2Info = dhtNodeHash.getInfoIndexMap(); - - - CClientClientDHTSizet::Index2VectorInfoTypeMap nodeIdx2Idx; - CArray nodeIdxList(nbEdges_*nvertex*4); - size_t nIdx = 0; - - for (CClientClientDHTSizet::Index2VectorInfoTypeMap::iterator it = nodeHash2Info.begin(); it != nodeHash2Info.end(); ++it) - { - size_t rankMin = (it->second)[1]; - size_t idx = (it->second)[0]; - for (int i = 2; i < (it->second).size();) - { - if ( (it->second)[i+1] < rankMin) - { - idx = (it->second)[i]; - rankMin = (it->second)[i+1]; - (it->second)[i+1] = (it->second)[i-1]; - } - i += 2; - } - if (nodeIdx2Idx.count(idx) == 0) - { - if (mpiRank == rankMin) - { - nodeIdx2Idx[idx].push_back(rankMin); - nodeIdx2Idx[idx].push_back(idx); - } - nodeIdxList(nIdx) = idx; - ++nIdx; - } - } - nodeIdxList.resizeAndPreserve(nIdx); - - // CDHTAutoIndexing will not give consistent node numbering for varying number of procs. => - // Solution: global node indexing by hand. - // Maps modified in this step: - // nodeIdx2Idx = - unsigned long nodeCount = nodeIdx2Idx.size(); - unsigned long nodeStart, nbNodes; - MPI_Scan(&nodeCount, &nodeStart, 1, MPI_UNSIGNED_LONG, MPI_SUM, comm); - int nNodes = nodeStart; - MPI_Bcast(&nNodes, 1, MPI_UNSIGNED_LONG, mpiSize-1, comm); - nbNodesGlo = nNodes; - - nodeStart -= nodeCount; - node_start = nodeStart; - node_count = nodeCount; - CClientClientDHTSizet::Index2VectorInfoTypeMap dummyMap; // just a dummy map used to ensure that each node is numbered only once - size_t count = 0; - - for (int ne = 0; ne < nbEdges_; ++ne) - { - for (int nv = 0; nv < nvertex; ++nv) - { - vector hashValues = CMesh::createHashes(bounds_lon(nv, ne), bounds_lat(nv, ne)); - size_t nodeIdx = generateNodeIndex(hashValues); - CClientClientDHTSizet::Index2VectorInfoTypeMap::iterator it = nodeIdx2Idx.find(nodeIdx); - if (it != nodeIdx2Idx.end()) - { - if (dummyMap.count(nodeIdx) == 0) - { - dummyMap[nodeIdx].push_back(nodeIdx); - (it->second)[1] = node_start + count; - ++count; - } - } - } - } - - CClientClientDHTSizet dhtNodeIdx(nodeIdx2Idx, comm); - dhtNodeIdx.computeIndexInfoMapping(nodeIdxList); - CClientClientDHTSizet::Index2VectorInfoTypeMap& nodeIdx2IdxGlo = dhtNodeIdx.getInfoIndexMap(); - - // (2.3) Saving variables: node_lon, node_lat, edge_nodes - // Creating map nodeHash2IdxGlo - // Creating map edgeHash2IdxGlo -// nbNodesGlo = dhtNodeIdxGlo.getNbIndexesGlobal(); -// node_count = dhtNodeIdxGlo.getIndexCount(); -// node_start = dhtNodeIdxGlo.getIndexStart(); - CClientClientDHTSizet::Index2VectorInfoTypeMap nodeHash2IdxGlo; - node_lon.resize(node_count); - node_lat.resize(node_count); - vector edgeNodes; - size_t idxGlo = 0; - - for (int ne = 0; ne < nbEdges_; ++ne) - { - for (int nv = 0; nv < nvertex; ++nv) - { - hashValues = CMesh::createHashes(bounds_lon(nv, ne), bounds_lat(nv, ne)); - size_t myIdx = generateNodeIndex(hashValues); - CClientClientDHTSizet::Index2VectorInfoTypeMap::iterator itIdx = nodeIdx2IdxGlo.find(myIdx); - idxGlo = (itIdx->second)[1]; - - if (mpiRank == (itIdx->second)[0]) - { -// node_lon(idxGlo - node_start) = (bounds_lon(nv, ne) == 360.) ? (0.) : (bounds_lon(nv, ne)); - node_lon(idxGlo - node_start) = bounds_lon(nv, ne); - node_lat(idxGlo - node_start) = bounds_lat(nv, ne); - } - edge_nodes(nv,ne) = idxGlo; - for (int nh = 0; nh < 4; ++nh) - nodeHash2IdxGlo[hashValues[nh]].push_back(idxGlo); - edgeNodes.push_back(idxGlo); - } - if (edgeNodes[0] != edgeNodes[1]) - { - size_t edgeIdxGlo = nbEdgesAccum + ne; - edgeHash2IdxGlo[ hashPairOrdered(edgeNodes[0], edgeNodes[1]) ].push_back(edgeIdxGlo); - } - edgeNodes.clear(); - } - pNodeGlobalIndex = new CClientClientDHTSizet (nodeHash2IdxGlo, comm); - } // !nodesAreWritten - - pEdgeGlobalIndex = new CClientClientDHTSizet (edgeHash2IdxGlo, comm); - edgesAreWritten = true; - } //nvertex = 2 - - else - { - nbFaces_ = bounds_lon.shape()[1]; - face_lon.resize(nbFaces_); - face_lat.resize(nbFaces_); - face_lon = lonvalue; - face_lat = latvalue; - face_nodes.resize(nvertex, nbFaces_); - face_edges.resize(nvertex, nbFaces_); - - // For determining the global face index - unsigned long nbFacesOnProc = nbFaces_; - unsigned long nbFacesAccum; - MPI_Scan(&nbFacesOnProc, &nbFacesAccum, 1, MPI_UNSIGNED_LONG, MPI_SUM, comm); - nbFacesAccum -= nbFaces_; - - // Case (1): edges have been previously generated - if (edgesAreWritten) - { - // (1.1) Recuperating node global indexing and saving face_nodes - vector hashValues(4); - CArray nodeHashList(nbFaces_*nvertex*4); - for (int nf = 0; nf < nbFaces_; ++nf) - { - for (int nv = 0; nv < nvertex; ++nv) - { - hashValues = CMesh::createHashes(bounds_lon(nv, nf), bounds_lat(nv, nf)); - for (int nh = 0; nh < 4; ++nh) - nodeHashList((nf*nvertex + nv)*4 + nh) = hashValues[nh]; - } - } - pNodeGlobalIndex->computeIndexInfoMapping(nodeHashList); - CClientClientDHTSizet::Index2VectorInfoTypeMap& nodeHash2IdxGlo = pNodeGlobalIndex->getInfoIndexMap(); - CClientClientDHTSizet::Index2VectorInfoTypeMap::iterator it1, it2; - CArray edgeHashList(nbFaces_*nvertex); - size_t nEdge = 0; - for (int nf = 0; nf < nbFaces_; ++nf) - { - for (int nv1 = 0; nv1 < nvertex; ++nv1) - { - int nh1 = 0; - int nv2 = (nv1 < nvertex -1 ) ? (nv1 + 1) : (nv1 + 1 - nvertex); // cyclic rotation - it1 = nodeHash2IdxGlo.find(nodeHashList((nf*nvertex + nv1)*4 + nh1)); - while (it1 == nodeHash2IdxGlo.end()) - { - ++nh1; - it1 = nodeHash2IdxGlo.find(nodeHashList((nf*nvertex + nv1)*4 + nh1)); - } - int nh2 = 0; - it2 = nodeHash2IdxGlo.find(nodeHashList((nf*nvertex + nv2)*4 + nh2)); - while (it2 == nodeHash2IdxGlo.end()) - { - ++nh2; - it2 = nodeHash2IdxGlo.find(nodeHashList((nf*nvertex + nv1)*4 + nh2)); - } - face_nodes(nv1,nf) = it1->second[0]; - if (it1->second[0] != it2->second[0]) - { - edgeHashList(nEdge) = hashPairOrdered(it1->second[0], it2->second[0]); - ++nEdge; - } - } - } - edgeHashList.resizeAndPreserve(nEdge); - - // (1.2) Recuperating edge global indexing and saving face_edges - pEdgeGlobalIndex->computeIndexInfoMapping(edgeHashList); - CClientClientDHTSizet::Index2VectorInfoTypeMap& edgeHash2IdxGlo = pEdgeGlobalIndex->getInfoIndexMap(); - CClientClientDHTSizet::Index2VectorInfoTypeMap::iterator itEdgeHash; - CClientClientDHTSizet::Index2VectorInfoTypeMap edgeHash2Rank; - CClientClientDHTSizet::Index2VectorInfoTypeMap edgeIdxGlo2Face; - CArray edgeIdxList(nbFaces_*nvertex); - size_t iIdx = 0; - - for (int nf = 0; nf < nbFaces_; ++nf) - { - for (int nv1 = 0; nv1 < nvertex; ++nv1) - { - int nh1 = 0; - int nv2 = (nv1 < nvertex -1 ) ? (nv1 + 1) : (nv1 + 1 - nvertex); // cyclic rotation - it1 = nodeHash2IdxGlo.find(nodeHashList((nf*nvertex + nv1)*4 + nh1)); - while (it1 == nodeHash2IdxGlo.end()) - { - ++nh1; - it1 = nodeHash2IdxGlo.find(nodeHashList((nf*nvertex + nv1)*4 + nh1)); - } - int nh2 = 0; - it2 = nodeHash2IdxGlo.find(nodeHashList((nf*nvertex + nv2)*4 + nh2)); - while (it2 == nodeHash2IdxGlo.end()) - { - ++nh2; - it2 = nodeHash2IdxGlo.find(nodeHashList((nf*nvertex + nv1)*4 + nh2)); - } - if (it1->second[0] != it2->second[0]) - { - size_t faceIdxGlo = nbFacesAccum + nf; - size_t edgeHash = hashPairOrdered(it1->second[0], it2->second[0]); - itEdgeHash = edgeHash2IdxGlo.find(edgeHash); - size_t edgeIdxGlo = itEdgeHash->second[0]; - face_edges(nv1,nf) = edgeIdxGlo; - if (edgeIdxGlo2Face.count(edgeIdxGlo) == 0) - { - edgeIdxList(iIdx) = edgeIdxGlo; - ++iIdx; - } - edgeIdxGlo2Face[edgeIdxGlo].push_back(faceIdxGlo); - edgeHash2Rank[edgeHash].push_back(mpiRank); - edgeHash2Rank[edgeHash].push_back(itEdgeHash->second[0]); - } - else - { - face_edges(nv1,nf) = 999999; - } - } - } - edgeIdxList.resizeAndPreserve(iIdx); - - // (1.3) Saving remaining variables edge_faces and face_faces - - // Establishing edge ownership - // The ownership criterion: priority of the process with smaller rank - CClientClientDHTSizet dhtEdgeHash (edgeHash2Rank, comm); - dhtEdgeHash.computeIndexInfoMapping(edgeHashList); - CClientClientDHTSizet::Index2VectorInfoTypeMap& edgeHash2Info = dhtEdgeHash.getInfoIndexMap(); - - // edgeHash2Info = > - int edgeCount = 0; - for (CClientClientDHTSizet::Index2VectorInfoTypeMap::iterator it = edgeHash2Info.begin(); it != edgeHash2Info.end(); ++it) - { - vector edgeInfo = it->second; - if (edgeInfo[0] == mpiRank) - { - ++edgeCount; - } - } - - unsigned long edgeStart, nbEdges; - MPI_Scan(&edgeCount, &edgeStart, 1, MPI_UNSIGNED_LONG, MPI_SUM, comm); - int nEdges = edgeStart; - MPI_Bcast(&nEdges, 1, MPI_UNSIGNED_LONG, mpiSize-1, comm); - nbEdgesGlo = nEdges; - - // edges to be splitted equally between procs - if ( (nbEdgesGlo % mpiSize) == 0) - { - edge_count = nbEdgesGlo/mpiSize; - edge_start = mpiRank*edge_count; - } - else - { - if (mpiRank == (mpiSize - 1) ) - { - edge_count = nbEdgesGlo/mpiSize; - edge_start = mpiRank*(nbEdgesGlo/mpiSize + 1); - } - else - { - edge_count = nbEdgesGlo/mpiSize + 1; - edge_start = mpiRank*edge_count; - } - } - CArray edgeIdxGloList(edge_count); - for (int i = 0; i < edge_count; ++i) - { - edgeIdxGloList(i) = i + edge_start; - } - - CClientClientDHTSizet dhtEdgeIdxGlo2Face (edgeIdxGlo2Face, comm); - CClientClientDHTSizet dhtEdge2Face (edgeIdxGlo2Face, comm); - dhtEdgeIdxGlo2Face.computeIndexInfoMapping(edgeIdxGloList); - CClientClientDHTSizet::Index2VectorInfoTypeMap& edgeIdxGlo2FaceIdx = dhtEdgeIdxGlo2Face.getInfoIndexMap(); - dhtEdge2Face.computeIndexInfoMapping(edgeIdxList); - CClientClientDHTSizet::Index2VectorInfoTypeMap& edgeIdx2FaceIdx = dhtEdge2Face.getInfoIndexMap(); - - - edge_faces.resize(2, edge_count); - for (int i = 0; i < edge_count; ++i) - { - CClientClientDHTSizet::Index2VectorInfoTypeMap::iterator it = edgeIdxGlo2FaceIdx.find(i + edge_start); - int indexGlo = it->first; - vector faces = it->second; - int face1 = faces[0]; - edge_faces(0, indexGlo - edge_start) = face1; - if (faces.size() == 2) - { - int face2 = faces[1]; - edge_faces(1, indexGlo - edge_start) = face2; - } - else - { - edge_faces(1, indexGlo - edge_start) = -999; - } - } - - size_t tmp; - vector tmpVec; - for (CClientClientDHTSizet::Index2VectorInfoTypeMap::iterator it = edgeIdx2FaceIdx.begin(); it != edgeIdx2FaceIdx.end(); it++) - { - tmp = it->first; - tmpVec = it->second; - tmp++; - } - - CClientClientDHTSizet::Index2VectorInfoTypeMap::iterator itFace1, itFace2, itIndex; - face_faces.resize(nvertex, nbFaces_); - for (int nf = 0; nf < nbFaces_; ++nf) - { - for (int nv1 = 0; nv1 < nvertex; ++nv1) - { - int nh1 = 0; - int nv2 = (nv1 < nvertex -1 ) ? (nv1 + 1) : (nv1 + 1 - nvertex); // cyclic rotation - it1 = nodeHash2IdxGlo.find(nodeHashList((nf*nvertex + nv1)*4 + nh1)); - while (it1 == nodeHash2IdxGlo.end()) - { - ++nh1; - it1 = nodeHash2IdxGlo.find(nodeHashList((nf*nvertex + nv1)*4 + nh1)); - } - int nh2 = 0; - it2 = nodeHash2IdxGlo.find(nodeHashList((nf*nvertex + nv2)*4 + nh2)); - while (it2 == nodeHash2IdxGlo.end()) - { - ++nh2; - it2 = nodeHash2IdxGlo.find(nodeHashList((nf*nvertex + nv1)*4 + nh2)); - } - - if (it1->second[0] != it2->second[0]) - { - size_t faceIdxGlo = nbFacesAccum + nf; - size_t edgeHash = hashPairOrdered(it1->second[0], it2->second[0]); - itEdgeHash = edgeHash2Info.find(edgeHash); - int edgeIdxGlo = (itEdgeHash->second)[1]; - - if ( (itEdgeHash->second)[0] == mpiRank) - { - itFace1 = edgeIdx2FaceIdx.find(edgeIdxGlo); - int face1 = itFace1->second[0]; - if (itFace1->second.size() == 1) - { - face_faces(nv1, nf) = 999999; - } - else - { - int face2 = itFace1->second[1]; - face_faces(nv1, nf) = (faceIdxGlo == face1 ? face2 : face1); - } - } // edge owner - else - { - itFace1 = edgeIdx2FaceIdx.find(edgeIdxGlo); - int face1 = itFace1->second[0]; - int face2 = itFace1->second[1]; - face_faces(nv1, nf) = (faceIdxGlo == face1 ? face2 : face1); - } // not an edge owner - } // node1 != node2 - else - { - face_faces(nv1, nf) = 999999; - } - } - } - } // edgesAreWritten - - // Case (2): nodes have been previously generated - else if (nodesAreWritten) - { - // (2.1) Generating nodeHashList - vector hashValues(4); - CArray nodeHashList(nbFaces_*nvertex*4); - for (int nf = 0; nf < nbFaces_; ++nf) - { - for (int nv = 0; nv < nvertex; ++nv) - { - hashValues = CMesh::createHashes(bounds_lon(nv, nf), bounds_lat(nv, nf)); - for (int nh = 0; nh < 4; ++nh) - nodeHashList((nf*nvertex + nv)*4 + nh) = hashValues[nh]; - } - } - - // (2.2) Recuperating node global indexing and saving face_nodes - // Generating edgeHash2Info = > and edgeHashList - pNodeGlobalIndex->computeIndexInfoMapping(nodeHashList); - CClientClientDHTSizet::Index2VectorInfoTypeMap& nodeHash2IdxGlo = pNodeGlobalIndex->getInfoIndexMap(); - CClientClientDHTSizet::Index2VectorInfoTypeMap edgeHash2Idx; - CClientClientDHTSizet::Index2VectorInfoTypeMap::iterator it1, it2; - CArray edgeHashList(nbFaces_*nvertex); - int nEdgeHash = 0; - for (int nf = 0; nf < nbFaces_; ++nf) - { - for (int nv1 = 0; nv1 < nvertex; ++nv1) - { - int nh1 = 0; - int nv2 = (nv1 < nvertex -1 ) ? (nv1 + 1) : (nv1 + 1 - nvertex); // cyclic rotation - it1 = nodeHash2IdxGlo.find(nodeHashList((nf*nvertex + nv1)*4 + nh1)); - while (it1 == nodeHash2IdxGlo.end()) - { - ++nh1; - it1 = nodeHash2IdxGlo.find(nodeHashList((nf*nvertex + nv1)*4 + nh1)); - } - int nh2 = 0; - it2 = nodeHash2IdxGlo.find(nodeHashList((nf*nvertex + nv2)*4 + nh2)); - while (it2 == nodeHash2IdxGlo.end()) - { - ++nh2; - it2 = nodeHash2IdxGlo.find(nodeHashList((nf*nvertex + nv1)*4 + nh2)); - } - face_nodes(nv1,nf) = it1->second[0]; - size_t edgeHash = hashPairOrdered(it1->second[0], it2->second[0]); - if (edgeHash2Idx.count(edgeHash) == 0) - { - edgeHash2Idx[edgeHash].push_back(edgeHash); - edgeHash2Idx[edgeHash].push_back(mpiRank); - edgeHashList(nEdgeHash) = edgeHash; - ++nEdgeHash; - } - } - } - if (nEdgeHash==0) edgeHashList.resize(nEdgeHash); - else edgeHashList.resizeAndPreserve(nEdgeHash); - - // (2.3) Generating global edge indexes - // The ownership criterion: priority of the process with smaller rank - // Maps generated in this step are: - // edgeIdx2Idx = = > - // edgeIdx2IdxGlo = > - - CClientClientDHTSizet dhtEdgeHash(edgeHash2Idx, comm); - dhtEdgeHash.computeIndexInfoMapping(edgeHashList); - CClientClientDHTSizet::Index2VectorInfoTypeMap& edgeHash2Info = dhtEdgeHash.getInfoIndexMap(); - // edgeHash2Info = - - CClientClientDHTSizet::Index2VectorInfoTypeMap edgeIdx2Idx; - - for (CClientClientDHTSizet::Index2VectorInfoTypeMap::iterator it = edgeHash2Info.begin(); it != edgeHash2Info.end(); ++it) - { - size_t rankMin = (it->second)[1]; - size_t idx = (it->second)[0]; - - for (int i = 2; i < (it->second).size();) - { - if ((it->second)[i+1] < rankMin) - { - rankMin = (it->second)[i+1]; - idx = (it->second)[i]; - (it->second)[i+1] = (it->second)[i-1]; - } - i += 2; - } - if (edgeIdx2Idx.count(idx) == 0) - { - if (mpiRank == rankMin) - { - edgeIdx2Idx[idx].push_back(rankMin); - edgeIdx2Idx[idx].push_back(idx); - } - } - } - - unsigned long edgeCount = edgeIdx2Idx.size(); - unsigned long edgeStart, nbEdges; - MPI_Scan(&edgeCount, &edgeStart, 1, MPI_UNSIGNED_LONG, MPI_SUM, comm); - int nEdges = edgeStart; - MPI_Bcast(&nEdges, 1, MPI_UNSIGNED_LONG, mpiSize-1, comm); - nbEdgesGlo = nEdges; - - edgeStart -= edgeCount; - edge_start = edgeStart; - edge_count = edgeCount; - CClientClientDHTSizet::Index2VectorInfoTypeMap dummyEdgeMap; - int count = 0; - - for (int nf = 0; nf < nbFaces_; ++nf) - { - for (int nv1 = 0; nv1 < nvertex; ++nv1) - { - // Getting global indexes of edge's nodes - int nh1 = 0; - int nv2 = (nv1 < nvertex -1 ) ? (nv1 + 1) : (nv1 + 1 - nvertex); // cyclic rotation - it1 = nodeHash2IdxGlo.find(nodeHashList((nf*nvertex + nv1)*4 + nh1)); - while (it1 == nodeHash2IdxGlo.end()) - { - ++nh1; - it1 = nodeHash2IdxGlo.find(nodeHashList((nf*nvertex + nv1)*4 + nh1)); - } - int nh2 = 0; - it2 = nodeHash2IdxGlo.find(nodeHashList((nf*nvertex + nv2)*4 + nh2)); - while (it2 == nodeHash2IdxGlo.end()) - { - ++nh2; - it2 = nodeHash2IdxGlo.find(nodeHashList((nf*nvertex + nv1)*4 + nh2)); - } - size_t nodeIdxGlo1 = it1->second[0]; - size_t nodeIdxGlo2 = it2->second[0]; - - if (nodeIdxGlo1 != nodeIdxGlo2) - { - size_t edgeIdx = hashPairOrdered(nodeIdxGlo1, nodeIdxGlo2); - CClientClientDHTSizet::Index2VectorInfoTypeMap::iterator it = edgeIdx2Idx.find(edgeIdx); - if (it != edgeIdx2Idx.end()) - { - if (dummyEdgeMap.count(edgeIdx) == 0) - { - dummyEdgeMap[edgeIdx].push_back(edgeIdx); - (it->second)[1] = edge_start + count; - ++count; - } - } - } - } - } - - CClientClientDHTSizet dhtEdgeIdx(edgeIdx2Idx, comm); - dhtEdgeIdx.computeIndexInfoMapping(edgeHashList); - CClientClientDHTSizet::Index2VectorInfoTypeMap& edgeIdx2IdxGlo = dhtEdgeIdx.getInfoIndexMap(); - - // (2.4) Saving variables: edge_lon, edge_lat, face_edges - edge_lon.resize(edge_count); - edge_lat.resize(edge_count); - edge_nodes.resize(2, edge_count); - face_edges.resize(nvertex, nbFaces_); - - CClientClientDHTSizet::Index2VectorInfoTypeMap edgeIdxGlo2Face; - CArray edgeIdxGloList(nbFaces_*nvertex); - size_t iIdx = 0; - - for (int nf = 0; nf < nbFaces_; ++nf) - { - for (int nv1 = 0; nv1 < nvertex; ++nv1) - { - // Getting global indexes of edge's nodes - int nh1 = 0; - int nv2 = (nv1 < nvertex -1 ) ? (nv1 + 1) : (nv1 + 1 - nvertex); // cyclic rotation - it1 = nodeHash2IdxGlo.find(nodeHashList((nf*nvertex + nv1)*4 + nh1)); - while (it1 == nodeHash2IdxGlo.end()) - { - ++nh1; - it1 = nodeHash2IdxGlo.find(nodeHashList((nf*nvertex + nv1)*4 + nh1)); - } - int nh2 = 0; - it2 = nodeHash2IdxGlo.find(nodeHashList((nf*nvertex + nv2)*4 + nh2)); - while (it2 == nodeHash2IdxGlo.end()) - { - ++nh2; - it2 = nodeHash2IdxGlo.find(nodeHashList((nf*nvertex + nv1)*4 + nh2)); - } - // Getting edge global index - size_t nodeIdxGlo1 = it1->second[0]; - size_t nodeIdxGlo2 = it2->second[0]; - size_t myIdx = hashPairOrdered(nodeIdxGlo1, nodeIdxGlo2); - if (nodeIdxGlo1 != nodeIdxGlo2) - { - CClientClientDHTSizet::Index2VectorInfoTypeMap::iterator itIdx = edgeIdx2IdxGlo.find(myIdx); - int edgeIdxGlo = (itIdx->second)[1]; - size_t faceIdxGlo = nbFacesAccum + nf; - - if (mpiRank == (itIdx->second)[0]) - { - double edgeLon; - double diffLon = abs(bounds_lon(nv1, nf) - bounds_lon(nv2, nf)); - if (diffLon < (180.- prec)) - edgeLon = ( bounds_lon(nv1, nf) + bounds_lon(nv2, nf)) * 0.5; - else if (diffLon > (180.+ prec)) - edgeLon = (bounds_lon(nv1, nf) + bounds_lon(nv2, nf)) * 0.5 -180.; - else - edgeLon = 0.; - edge_lon(edgeIdxGlo - edge_start) = edgeLon; - edge_lat(edgeIdxGlo - edge_start) = ( bounds_lat(nv1, nf) + bounds_lat(nv2, nf) ) * 0.5; - edge_nodes(0, edgeIdxGlo - edge_start) = nodeIdxGlo1; - edge_nodes(1, edgeIdxGlo - edge_start) = nodeIdxGlo2; - } - face_edges(nv1,nf) = edgeIdxGlo; - if (edgeIdxGlo2Face.count(edgeIdxGlo) == 0) - { - edgeIdxGloList(iIdx) = edgeIdxGlo; - ++iIdx; - } - edgeIdxGlo2Face[edgeIdxGlo].push_back(faceIdxGlo); - } // nodeIdxGlo1 != nodeIdxGlo2 - else - { - face_edges(nv1,nf) = 999999; - } - } - } - edgeIdxGloList.resizeAndPreserve(iIdx); - - // (2.5) Saving remaining variables edge_faces and face_faces - edge_faces.resize(2, edge_count); - face_faces.resize(nvertex, nbFaces_); - - CClientClientDHTSizet dhtEdge2Face (edgeIdxGlo2Face, comm); - dhtEdge2Face.computeIndexInfoMapping(edgeIdxGloList); - CClientClientDHTSizet::Index2VectorInfoTypeMap& edgeIdxGlo2FaceIdx = dhtEdge2Face.getInfoIndexMap(); - CClientClientDHTSizet::Index2VectorInfoTypeMap::iterator itNodeIdxGlo1, itNodeIdxGlo2; - CClientClientDHTSizet::Index2VectorInfoTypeMap::iterator itIdx; - - for (int nf = 0; nf < nbFaces_; ++nf) - { - for (int nv1 = 0; nv1 < nvertex; ++nv1) - { - // Getting global indexes of edge's nodes - int nh1 = 0; - int nv2 = (nv1 < nvertex -1 ) ? (nv1 + 1) : (nv1 + 1 - nvertex); // cyclic rotation - it1 = nodeHash2IdxGlo.find(nodeHashList((nf*nvertex + nv1)*4 + nh1)); - while (it1 == nodeHash2IdxGlo.end()) - { - ++nh1; - it1 = nodeHash2IdxGlo.find(nodeHashList((nf*nvertex + nv1)*4 + nh1)); - } - int nh2 = 0; - it2 = nodeHash2IdxGlo.find(nodeHashList((nf*nvertex + nv2)*4 + nh2)); - while (it2 == nodeHash2IdxGlo.end()) - { - ++nh2; - it2 = nodeHash2IdxGlo.find(nodeHashList((nf*nvertex + nv1)*4 + nh2)); - } - size_t nodeIdxGlo1 = it1->second[0]; - size_t nodeIdxGlo2 = it2->second[0]; - - size_t myIdx = hashPairOrdered(nodeIdxGlo1, nodeIdxGlo2); - itIdx = edgeIdx2IdxGlo.find(myIdx); - size_t faceIdxGlo = nbFacesAccum + nf; - int edgeIdxGlo = (itIdx->second)[1]; - - if (mpiRank == (itIdx->second)[0]) - { - it1 = edgeIdxGlo2FaceIdx.find(edgeIdxGlo); - int face1 = it1->second[0]; - if (it1->second.size() == 1) - { - edge_faces(0, edgeIdxGlo - edge_start) = face1; - edge_faces(1, edgeIdxGlo - edge_start) = -999; - face_faces(nv1, nf) = 999999; - } - else - { - int face2 = it1->second[1]; - edge_faces(0, edgeIdxGlo - edge_start) = face1; - edge_faces(1, edgeIdxGlo - edge_start) = face2; - face_faces(nv1, nf) = (faceIdxGlo == face1 ? face2 : face1); - } - } - else - { - it1 = edgeIdxGlo2FaceIdx.find(edgeIdxGlo); - int face1 = it1->second[0]; - int face2 = it1->second[1]; - face_faces(nv1, nf) = (faceIdxGlo == face1 ? face2 : face1); - } - } - } - } // nodesAreWritten - - // Case (3): Neither nodes nor edges have been previously generated - else - { - // (3.1) Creating a list of hashes for each node and a map nodeHash2Idx > - vector hashValues(4); - CClientClientDHTSizet::Index2VectorInfoTypeMap nodeHash2Idx; - CArray nodeHashList(nbFaces_*nvertex*4); - size_t iHash = 0; - for (int nf = 0; nf < nbFaces_; ++nf) - { - for (int nv = 0; nv < nvertex; ++nv) - { - hashValues = CMesh::createHashes(bounds_lon(nv, nf), bounds_lat(nv, nf)); -// size_t nodeIndex = generateNodeIndex(hashValues, mpiRank); - size_t nodeIndex = generateNodeIndex(hashValues); - for (int nh = 0; nh < 4; ++nh) - { - if (nodeHash2Idx.count(hashValues[nh])==0) - { - nodeHash2Idx[hashValues[nh]].push_back(nodeIndex); - nodeHash2Idx[hashValues[nh]].push_back(mpiRank); - nodeHashList(iHash) = hashValues[nh]; - ++iHash; - } - } - } - } - nodeHashList.resizeAndPreserve(iHash); - - // (3.2) Generating global node indexes - // The ownership criterion: priority of the process with smaller rank. - // With any other criterion it is not possible to have consistent node indexing for different number of procs. - // Maps generated in this step are: - // nodeHash2Info = - // nodeIdx2Idx = > - - CClientClientDHTSizet dhtNodeHash(nodeHash2Idx, comm); - dhtNodeHash.computeIndexInfoMapping(nodeHashList); - CClientClientDHTSizet::Index2VectorInfoTypeMap& nodeHash2Info = dhtNodeHash.getInfoIndexMap(); - - CClientClientDHTSizet::Index2VectorInfoTypeMap nodeIdx2Idx; - CArray nodeIdxList(nbFaces_*nvertex*4); - size_t nIdx = 0; - - for (CClientClientDHTSizet::Index2VectorInfoTypeMap::iterator it = nodeHash2Info.begin(); it != nodeHash2Info.end(); ++it) - { - size_t rankMin = (it->second)[1]; - size_t idx = (it->second)[0]; - for (int i = 2; i < (it->second).size();) - { - if ( (it->second)[i+1] < rankMin) - { - idx = (it->second)[i]; - rankMin = (it->second)[i+1]; - (it->second)[i+1] = (it->second)[i-1]; - } - i += 2; - } - if (nodeIdx2Idx.count(idx) == 0) - { - if (mpiRank == rankMin) - { - nodeIdx2Idx[idx].push_back(rankMin); - nodeIdx2Idx[idx].push_back(idx); - } - nodeIdxList(nIdx) = idx; - ++nIdx; - } - } - -// CDHTAutoIndexing dhtNodeIdxGlo = CDHTAutoIndexing(nodeIdx2Idx, comm); - // CDHTAutoIndexing will not give consistent node numbering for varying number of procs. => - // Solution: global node indexing by hand. - // Maps modified in this step: - // nodeIdx2Idx = - unsigned long nodeCount = nodeIdx2Idx.size(); - unsigned long nodeStart, nbNodes; - MPI_Scan(&nodeCount, &nodeStart, 1, MPI_UNSIGNED_LONG, MPI_SUM, comm); - int nNodes = nodeStart; - MPI_Bcast(&nNodes, 1, MPI_UNSIGNED_LONG, mpiSize-1, comm); - nbNodesGlo = nNodes; - - nodeStart -= nodeCount; - node_start = nodeStart; - node_count = nodeCount; - CClientClientDHTSizet::Index2VectorInfoTypeMap dummyMap; // just a dummy map used to ensure that each node is numbered only once - size_t count = 0; - - for (int nf = 0; nf < nbFaces_; ++nf) - { - for (int nv = 0; nv < nvertex; ++nv) - { - vector hashValues = CMesh::createHashes(bounds_lon(nv, nf), bounds_lat(nv, nf)); - size_t nodeIdx = generateNodeIndex(hashValues); - CClientClientDHTSizet::Index2VectorInfoTypeMap::iterator it = nodeIdx2Idx.find(nodeIdx); - if (it != nodeIdx2Idx.end()) - { - if (dummyMap.count(nodeIdx) == 0) - { - dummyMap[nodeIdx].push_back(nodeIdx); - (it->second)[1] = node_start + count; - ++count; - } - } - } - } - if (nIdx==0) nodeIdxList.resize(nIdx); - else nodeIdxList.resizeAndPreserve(nIdx); - CClientClientDHTSizet dhtNodeIdx(nodeIdx2Idx, comm); - dhtNodeIdx.computeIndexInfoMapping(nodeIdxList); - CClientClientDHTSizet::Index2VectorInfoTypeMap& nodeIdx2IdxGlo = dhtNodeIdx.getInfoIndexMap(); - - // (3.3) Saving node data: node_lon, node_lat, and face_nodes - // Generating edgeHash2Info = > and edgeHashList -// nbNodesGlo = dhtNodeIdxGlo.getNbIndexesGlobal(); -// node_count = dhtNodeIdxGlo.getIndexCount(); -// node_start = dhtNodeIdxGlo.getIndexStart(); - node_lon.resize(node_count); - node_lat.resize(node_count); - size_t nodeIdxGlo1 = 0; - size_t nodeIdxGlo2 = 0; - CClientClientDHTSizet::Index2VectorInfoTypeMap edgeHash2Idx; - CClientClientDHTSizet::Index2VectorInfoTypeMap::iterator itNodeIdxGlo1, itNodeIdxGlo2; - CArray edgeHashList(nbFaces_*nvertex); - size_t nEdgeHash = 0; - - for (int nf = 0; nf < nbFaces_; ++nf) - { - for (int nv1 = 0; nv1 < nvertex; ++nv1) - { - int nv2 = (nv1 < nvertex -1 ) ? (nv1 + 1) : (nv1 + 1 - nvertex); // cyclic rotation - vector hashValues1 = CMesh::createHashes(bounds_lon(nv1, nf), bounds_lat(nv1, nf)); - vector hashValues2 = CMesh::createHashes(bounds_lon(nv2, nf), bounds_lat(nv2, nf)); - size_t nodeIdx1 = generateNodeIndex(hashValues1); - size_t nodeIdx2 = generateNodeIndex(hashValues2); - CClientClientDHTSizet::Index2VectorInfoTypeMap::iterator itNodeIdx1 = nodeIdx2IdxGlo.find(nodeIdx1); - CClientClientDHTSizet::Index2VectorInfoTypeMap::iterator itNodeIdx2 = nodeIdx2IdxGlo.find(nodeIdx2); - size_t ownerRank = (itNodeIdx1->second)[0]; - nodeIdxGlo1 = (itNodeIdx1->second)[1]; - nodeIdxGlo2 = (itNodeIdx2->second)[1]; - - if (mpiRank == ownerRank) - { - node_lon(nodeIdxGlo1 - node_start) = bounds_lon(nv1, nf); - node_lat(nodeIdxGlo1 - node_start) = bounds_lat(nv1, nf); - } - if (nodeIdxGlo1 != nodeIdxGlo2) - { - size_t edgeHash = hashPairOrdered(nodeIdxGlo1, nodeIdxGlo2); - edgeHash2Idx[edgeHash].push_back(edgeHash); - edgeHash2Idx[edgeHash].push_back(mpiRank); - edgeHashList(nEdgeHash) = edgeHash; - ++nEdgeHash; - } - face_nodes(nv1,nf) = nodeIdxGlo1; - } - } - if (nEdgeHash==0) edgeHashList.resize(nEdgeHash); - else edgeHashList.resizeAndPreserve(nEdgeHash); - - // (3.4) Generating global edge indexes - // Maps generated in this step are: - // edgeIdx2Idx = = > - // edgeIdx2IdxGlo = > - - CClientClientDHTSizet dhtEdgeHash(edgeHash2Idx, comm); - dhtEdgeHash.computeIndexInfoMapping(edgeHashList); - CClientClientDHTSizet::Index2VectorInfoTypeMap& edgeHash2Info = dhtEdgeHash.getInfoIndexMap(); - // edgeHash2Info = - - CClientClientDHTSizet::Index2VectorInfoTypeMap edgeIdx2Idx; - - for (CClientClientDHTSizet::Index2VectorInfoTypeMap::iterator it = edgeHash2Info.begin(); it != edgeHash2Info.end(); ++it) - { - size_t rankMin = (it->second)[1]; - size_t idx = (it->second)[0]; - - for (int i = 2; i < (it->second).size();) - { - if ((it->second)[i+1] < rankMin) - { - rankMin = (it->second)[i+1]; - idx = (it->second)[i]; - (it->second)[i+1] = (it->second)[i-1]; - } - i += 2; - } - if (edgeIdx2Idx.count(idx) == 0) - { - if (mpiRank == rankMin) - { - edgeIdx2Idx[idx].push_back(rankMin); - edgeIdx2Idx[idx].push_back(idx); - } - } - } - - unsigned long edgeCount = edgeIdx2Idx.size(); - unsigned long edgeStart, nbEdges; - MPI_Scan(&edgeCount, &edgeStart, 1, MPI_UNSIGNED_LONG, MPI_SUM, comm); - int nEdges = edgeStart; - MPI_Bcast(&nEdges, 1, MPI_UNSIGNED_LONG, mpiSize-1, comm); - nbEdgesGlo = nEdges; - - edgeStart -= edgeCount; - edge_start = edgeStart; - edge_count = edgeCount; - CClientClientDHTSizet::Index2VectorInfoTypeMap dummyEdgeMap; - count = 0; - - for (int nf = 0; nf < nbFaces_; ++nf) - { - for (int nv1 = 0; nv1 < nvertex; ++nv1) - { - int nv2 = (nv1 < nvertex -1 ) ? (nv1 + 1) : (nv1 + 1 - nvertex); // cyclic rotation - vector hashValues1 = CMesh::createHashes(bounds_lon(nv1, nf), bounds_lat(nv1, nf)); - vector hashValues2 = CMesh::createHashes(bounds_lon(nv2, nf), bounds_lat(nv2, nf)); - size_t nodeIdx1 = generateNodeIndex(hashValues1); - size_t nodeIdx2 = generateNodeIndex(hashValues2); - CClientClientDHTSizet::Index2VectorInfoTypeMap::iterator itNodeIdx1 = nodeIdx2IdxGlo.find(nodeIdx1); - CClientClientDHTSizet::Index2VectorInfoTypeMap::iterator itNodeIdx2 = nodeIdx2IdxGlo.find(nodeIdx2); - nodeIdxGlo1 = (itNodeIdx1->second)[1]; - nodeIdxGlo2 = (itNodeIdx2->second)[1]; - - if (nodeIdxGlo1 != nodeIdxGlo2) - { - size_t edgeIdx = hashPairOrdered(nodeIdxGlo1, nodeIdxGlo2); - CClientClientDHTSizet::Index2VectorInfoTypeMap::iterator it = edgeIdx2Idx.find(edgeIdx); - if (it != edgeIdx2Idx.end()) - { - if (dummyEdgeMap.count(edgeIdx) == 0) - { - dummyEdgeMap[edgeIdx].push_back(edgeIdx); - (it->second)[1] = edge_start + count; - ++count; - } - } - } - } - } - CClientClientDHTSizet dhtEdgeIdx(edgeIdx2Idx, comm); - dhtEdgeIdx.computeIndexInfoMapping(edgeHashList); - CClientClientDHTSizet::Index2VectorInfoTypeMap& edgeIdx2IdxGlo = dhtEdgeIdx.getInfoIndexMap(); - - // (3.5) Saving variables: edge_lon, edge_lat, face_edges - // Creating map edgeIdxGlo2Face -// nbEdgesGlo = dhtEdgeIdxGlo.getNbIndexesGlobal(); -// edge_count = dhtEdgeIdxGlo.getIndexCount(); -// edge_start = dhtEdgeIdxGlo.getIndexStart(); - - edge_lon.resize(edge_count); - edge_lat.resize(edge_count); - edge_nodes.resize(2, edge_count); - face_edges.resize(nvertex, nbFaces_); - - CClientClientDHTSizet::Index2VectorInfoTypeMap::iterator it1, it2; - CClientClientDHTSizet::Index2VectorInfoTypeMap edgeIdxGlo2Face; - CArray edgeIdxGloList(nbFaces_*nvertex); - size_t nEdge = 0; - - for (int nf = 0; nf < nbFaces_; ++nf) - { - for (int nv1 = 0; nv1 < nvertex; ++nv1) - { - // Getting global indexes of edge's nodes - int nv2 = (nv1 < nvertex -1 ) ? (nv1 + 1) : (nv1 + 1 - nvertex); // cyclic rotation - vector hashValues1 = CMesh::createHashes(bounds_lon(nv1, nf), bounds_lat(nv1, nf)); - vector hashValues2 = CMesh::createHashes(bounds_lon(nv2, nf), bounds_lat(nv2, nf)); - - size_t nodeIdx1 = generateNodeIndex(hashValues1); - size_t nodeIdx2 = generateNodeIndex(hashValues2); - it1 = nodeIdx2IdxGlo.find(nodeIdx1); - it2 = nodeIdx2IdxGlo.find(nodeIdx2); - size_t nodeIdxGlo1 = (it1->second)[1]; - size_t nodeIdxGlo2 = (it2->second)[1]; - - if (nodeIdxGlo1 != nodeIdxGlo2) - { - size_t myIdx = hashPairOrdered(nodeIdxGlo1, nodeIdxGlo2); - CClientClientDHTSizet::Index2VectorInfoTypeMap::iterator itIdx = edgeIdx2IdxGlo.find(myIdx); - int edgeIdxGlo = (itIdx->second)[1]; - size_t faceIdxGlo = nbFacesAccum + nf; - - if (mpiRank == (itIdx->second)[0]) - { - double edgeLon; - double diffLon = abs(bounds_lon(nv1, nf) - bounds_lon(nv2, nf)); - if (diffLon < (180.- prec)) - edgeLon = ( bounds_lon(nv1, nf) + bounds_lon(nv2, nf)) * 0.5; - else if (diffLon > (180.+ prec)) - edgeLon = (bounds_lon(nv1, nf) + bounds_lon(nv2, nf)) * 0.5 -180.; - else - edgeLon = 0.; - edge_lon(edgeIdxGlo - edge_start) = edgeLon; - edge_lat(edgeIdxGlo-edge_start) = ( bounds_lat(nv1, nf) + bounds_lat(nv2, nf) ) * 0.5; - edge_nodes(0, edgeIdxGlo - edge_start) = nodeIdxGlo1; - edge_nodes(1, edgeIdxGlo - edge_start) = nodeIdxGlo2; - } - face_edges(nv1,nf) = edgeIdxGlo; - if (edgeIdxGlo2Face.count(edgeIdxGlo) == 0) - { - edgeIdxGloList(nEdge) = edgeIdxGlo; - ++nEdge; - } - edgeIdxGlo2Face[edgeIdxGlo].push_back(faceIdxGlo); - } // nodeIdxGlo1 != nodeIdxGlo2 - else - { - face_edges(nv1,nf) = 999999; - } - } - } - edgeIdxGloList.resizeAndPreserve(nEdge); - - // (3.6) Saving remaining variables edge_faces and face_faces - edge_faces.resize(2, edge_count); - face_faces.resize(nvertex, nbFaces_); - - CClientClientDHTSizet dhtEdge2Face (edgeIdxGlo2Face, comm); - dhtEdge2Face.computeIndexInfoMapping(edgeIdxGloList); - CClientClientDHTSizet::Index2VectorInfoTypeMap& edgeIdxGlo2FaceIdx = dhtEdge2Face.getInfoIndexMap(); - - for (int nf = 0; nf < nbFaces_; ++nf) - { - for (int nv1 = 0; nv1 < nvertex; ++nv1) - { - // Getting global indexes of edge's nodes - int nv2 = (nv1 < nvertex -1 ) ? (nv1 + 1) : (nv1 + 1 - nvertex); // cyclic rotation - vector hashValues1 = CMesh::createHashes(bounds_lon(nv1, nf), bounds_lat(nv1, nf)); - vector hashValues2 = CMesh::createHashes(bounds_lon(nv2, nf), bounds_lat(nv2, nf)); - - size_t myNodeIdx1 = generateNodeIndex(hashValues1); - size_t myNodeIdx2 = generateNodeIndex(hashValues2); - if (myNodeIdx1 != myNodeIdx2) - { - it1 = nodeIdx2IdxGlo.find(myNodeIdx1); - it2 = nodeIdx2IdxGlo.find(myNodeIdx2); - size_t nodeIdxGlo1 = (it1->second)[1]; - size_t nodeIdxGlo2 = (it2->second)[1]; - size_t myIdx = hashPairOrdered(nodeIdxGlo1, nodeIdxGlo2); - CClientClientDHTSizet::Index2VectorInfoTypeMap::iterator itIdx = edgeIdx2IdxGlo.find(myIdx); - int edgeIdxGlo = (itIdx->second)[1]; - - size_t faceIdxGlo = nbFacesAccum + nf; - - if (mpiRank == (itIdx->second)[0]) - { - it1 = edgeIdxGlo2FaceIdx.find(edgeIdxGlo); - int face1 = it1->second[0]; - if (it1->second.size() == 1) - { - edge_faces(0, edgeIdxGlo - edge_start) = face1; - edge_faces(1, edgeIdxGlo - edge_start) = -999; - face_faces(nv1, nf) = 999999; - } - else - { - size_t face2 = it1->second[1]; - edge_faces(0, edgeIdxGlo - edge_start) = face1; - edge_faces(1, edgeIdxGlo - edge_start) = face2; - face_faces(nv1, nf) = (faceIdxGlo == face1 ? face2 : face1); - } - } - else - { - it1 = edgeIdxGlo2FaceIdx.find(edgeIdxGlo); - int face1 = it1->second[0]; - int face2 = it1->second[1]; - face_faces(nv1, nf) = (faceIdxGlo == face1 ? face2 : face1); - } - } // myNodeIdx1 != myNodeIdx2 - else - face_faces(nv1, nf) = 999999; - } - } - - } - facesAreWritten = true; - } // nvertex >= 3 - - } // createMeshEpsilon - - ///---------------------------------------------------------------- - /*! - * \fn void CMesh::getGloNghbFacesNodeType(const MPI_Comm& comm, const CArray& face_idx, - const CArray& bounds_lon, const CArray& bounds_lat, - CArray& nghbFaces) - * Finds neighboring cells of a local domain for node-type of neighbors. - * \param [in] comm - * \param [in] face_idx Array with global indexes. - * \param [in] bounds_lon Array of boundary longitudes. - * \param [in] bounds_lat Array of boundary latitudes. - * \param [out] nghbFaces 2D array of storing global indexes of neighboring cells and their owner procs. - */ - - void CMesh::getGloNghbFacesNodeType(const MPI_Comm& comm, const CArray& face_idx, - const CArray& bounds_lon, const CArray& bounds_lat, - CArray& nghbFaces) - { - int nvertex = bounds_lon.rows(); - int nbFaces = bounds_lon.shape()[1]; - nghbFaces.resize(2, nbFaces*10); // some estimate on max number of neighbouring cells - - int mpiRank, mpiSize; - MPI_Comm_rank(comm, &mpiRank); - MPI_Comm_size(comm, &mpiSize); - - // (1) Generating unique node indexes - // (1.1) Creating a list of hashes for each node and a map nodeHash2Idx > - vector hashValues(4); - CClientClientDHTSizet::Index2VectorInfoTypeMap nodeHash2Idx; - CArray nodeHashList(nbFaces*nvertex*4); - size_t iIdx = 0; - for (int nf = 0; nf < nbFaces; ++nf) - { - for (int nv = 0; nv < nvertex; ++nv) - { - hashValues = CMesh::createHashes(bounds_lon(nv, nf), bounds_lat(nv, nf)); - size_t nodeIndex = generateNodeIndex(hashValues, mpiRank); - for (int nh = 0; nh < 4; ++nh) - { - if (nodeHash2Idx.count(hashValues[nh])==0) - { - nodeHash2Idx[hashValues[nh]].push_back(nodeIndex); - nodeHash2Idx[hashValues[nh]].push_back(mpiRank); - nodeHashList(iIdx) = hashValues[nh]; - ++iIdx; - } - } - } - } - nodeHashList.resizeAndPreserve(iIdx); - - // (1.2) Generating node indexes - // The ownership criterion: priority of the process holding the smaller index - // Maps generated in this step are: - // nodeHash2Info = - // nodeIdx2IdxMin = - // idxMin is a unique node identifier - - CClientClientDHTSizet dhtNodeHash(nodeHash2Idx, comm); - dhtNodeHash.computeIndexInfoMapping(nodeHashList); - CClientClientDHTSizet::Index2VectorInfoTypeMap& nodeHash2Info = dhtNodeHash.getInfoIndexMap(); - - CClientClientDHTSizet::Index2VectorInfoTypeMap nodeIdx2IdxMin; - - for (CClientClientDHTSizet::Index2VectorInfoTypeMap::iterator it = nodeHash2Info.begin(); it != nodeHash2Info.end(); ++it) - { - size_t idxMin = (it->second)[0]; - size_t idx = (it->second)[0]; - for (int i = 2; i < (it->second).size();) - { - if (mpiRank == (it->second)[i+1]) - { - idx = (it->second)[i]; - } - if ((it->second)[i] < idxMin) - { - idxMin = (it->second)[i]; - (it->second)[i] = (it->second)[i-2]; - (it->second)[i+1] = (it->second)[i-1]; - } - i += 2; - } - (it->second)[0] = idxMin; - if (nodeIdx2IdxMin.count(idx) == 0) - { - nodeIdx2IdxMin[idx].push_back(idxMin); - } - } - - // (2) Creating maps nodeIdxMin2Face = - CClientClientDHTSizet::Index2VectorInfoTypeMap::iterator it; - CClientClientDHTSizet::Index2VectorInfoTypeMap nodeIdxMin2Face; - CArray nodeIdxMinList(nbFaces*nvertex*4); - - size_t nNode = 0; - - for (int nf = 0; nf < nbFaces; ++nf) - { - for (int nv = 0; nv < nvertex; ++nv) - { - vector hashValues = CMesh::createHashes(bounds_lon(nv, nf), bounds_lat(nv, nf)); - size_t myNodeIdx = generateNodeIndex(hashValues, mpiRank); - it = nodeIdx2IdxMin.find(myNodeIdx); - size_t nodeIdxMin = (it->second)[0]; - size_t faceIdx = face_idx(nf); - if (nodeIdxMin2Face.count(nodeIdxMin) == 0) - { - nodeIdxMinList(nNode) = nodeIdxMin; - ++nNode; - } - nodeIdxMin2Face[nodeIdxMin].push_back(faceIdx); - nodeIdxMin2Face[nodeIdxMin].push_back(mpiRank); - } - } - nodeIdxMinList.resizeAndPreserve(nNode); - - // (3) Face_face connectivity - - // nodeIdxMin2Info = - CClientClientDHTSizet dhtNode2Face (nodeIdxMin2Face, comm); - dhtNode2Face.computeIndexInfoMapping(nodeIdxMinList); - CClientClientDHTSizet::Index2VectorInfoTypeMap& nodeIdxMin2Info = dhtNode2Face.getInfoIndexMap(); - CClientClientDHTSizet::Index2VectorInfoTypeMap mapFaces; // auxiliar map - - int nbNghb = 0; - CClientClientDHTSizet::Index2VectorInfoTypeMap::iterator itNode; - - for (int nf = 0; nf < nbFaces; ++nf) - { - for (int nv = 0; nv < nvertex; ++nv) - { - vector hashValues = CMesh::createHashes(bounds_lon(nv, nf), bounds_lat(nv, nf)); - size_t myNodeIdx = generateNodeIndex(hashValues, mpiRank); - itNode = nodeIdx2IdxMin.find(myNodeIdx); - size_t nodeIdxMin = (itNode->second)[0]; - - itNode = nodeIdxMin2Info.find(nodeIdxMin); - for (int i = 0; i < itNode->second.size();) - { - size_t face = itNode->second[i]; - size_t rank = itNode->second[i+1]; - if (rank != mpiRank) - if (mapFaces.count(face) == 0) - { - nghbFaces(0, nbNghb) = face; - nghbFaces(1, nbNghb) = rank; - ++nbNghb; - mapFaces[face].push_back(face); - } - i += 2; - } - } - } - if (nbNghb==0) nghbFaces.resize(2, nbNghb); - else nghbFaces.resizeAndPreserve(2, nbNghb); - } // getGloNghbFacesNodeType - - ///---------------------------------------------------------------- - /*! - * \fn void CMesh::getGloNghbFacesEdgeType(const MPI_Comm& comm, const CArray& face_idx, - const CArray& bounds_lon, const CArray& bounds_lat, - CArray& nghbFaces) - * Finds neighboring cells of a local domain for edge-type of neighbors. - * \param [in] comm - * \param [in] face_idx Array with global indexes. - * \param [in] bounds_lon Array of boundary longitudes. - * \param [in] bounds_lat Array of boundary latitudes. - * \param [out] nghbFaces 2D array of storing global indexes of neighboring cells and their owner procs. - */ - - void CMesh::getGloNghbFacesEdgeType(const MPI_Comm& comm, const CArray& face_idx, - const CArray& bounds_lon, const CArray& bounds_lat, - CArray& nghbFaces) - { - int nvertex = bounds_lon.rows(); - int nbFaces = bounds_lon.shape()[1]; - nghbFaces.resize(2, nbFaces*10); // estimate of max number of neighbouring cells - - int mpiRank, mpiSize; - MPI_Comm_rank(comm, &mpiRank); - MPI_Comm_size(comm, &mpiSize); - - // (1) Generating unique node indexes - // (1.1) Creating a list of hashes for each node and a map nodeHash2Idx > - vector hashValues(4); - CClientClientDHTSizet::Index2VectorInfoTypeMap nodeHash2Idx; - CArray nodeHashList(nbFaces*nvertex*4); - size_t iIdx = 0; - for (int nf = 0; nf < nbFaces; ++nf) - { - for (int nv = 0; nv < nvertex; ++nv) - { - hashValues = CMesh::createHashes(bounds_lon(nv, nf), bounds_lat(nv, nf)); - size_t nodeIndex = generateNodeIndex(hashValues, mpiRank); - for (int nh = 0; nh < 4; ++nh) - { - if (nodeHash2Idx.count(hashValues[nh])==0) - { - nodeHash2Idx[hashValues[nh]].push_back(nodeIndex); - nodeHash2Idx[hashValues[nh]].push_back(mpiRank); - nodeHashList(iIdx) = hashValues[nh]; - ++iIdx; - } - } - } - } - if (iIdx==0) nodeHashList.resize(iIdx); - else nodeHashList.resizeAndPreserve(iIdx); - - // (1.2) Generating node indexes - // The ownership criterion: priority of the process holding the smaller index - // Maps generated in this step are: - // nodeHash2Info = - // nodeIdx2IdxMin = - // idxMin is a unique node identifier - - CClientClientDHTSizet dhtNodeHash(nodeHash2Idx, comm); - dhtNodeHash.computeIndexInfoMapping(nodeHashList); - CClientClientDHTSizet::Index2VectorInfoTypeMap& nodeHash2Info = dhtNodeHash.getInfoIndexMap(); - - CClientClientDHTSizet::Index2VectorInfoTypeMap nodeIdx2IdxMin; - - for (CClientClientDHTSizet::Index2VectorInfoTypeMap::iterator it = nodeHash2Info.begin(); it != nodeHash2Info.end(); ++it) - { - size_t idxMin = (it->second)[0]; - size_t idx = (it->second)[0]; - for (int i = 2; i < (it->second).size();) - { - if (mpiRank == (it->second)[i+1]) - { - idx = (it->second)[i]; - } - if ((it->second)[i] < idxMin) - { - idxMin = (it->second)[i]; - (it->second)[i] = (it->second)[i-2]; - (it->second)[i+1] = (it->second)[i-1]; - } - i += 2; - } - (it->second)[0] = idxMin; - if (nodeIdx2IdxMin.count(idx) == 0) - { - nodeIdx2IdxMin[idx].push_back(idxMin); - } - } - - // (2) Creating map edgeHash2Face = , where rank1 = rank2 = ... - - CClientClientDHTSizet::Index2VectorInfoTypeMap::iterator it1, it2, it; - CClientClientDHTSizet::Index2VectorInfoTypeMap edgeHash2Face; - CArray edgeHashList(nbFaces*nvertex); - - size_t nEdge = 0; - - for (int nf = 0; nf < nbFaces; ++nf) - { - for (int nv1 = 0; nv1 < nvertex; ++nv1) - { - // Getting indexes of edge's nodes - int nv2 = (nv1 < nvertex -1 ) ? (nv1 + 1) : (nv1 + 1 - nvertex); // cyclic rotation - vector hashValues1 = CMesh::createHashes(bounds_lon(nv1, nf), bounds_lat(nv1, nf)); - vector hashValues2 = CMesh::createHashes(bounds_lon(nv2, nf), bounds_lat(nv2, nf)); - size_t myNodeIdx1 = generateNodeIndex(hashValues1, mpiRank); - size_t myNodeIdx2 = generateNodeIndex(hashValues2, mpiRank); - it1 = nodeIdx2IdxMin.find(myNodeIdx1); - it2 = nodeIdx2IdxMin.find(myNodeIdx2); - size_t nodeIdxMin1 = (it1->second)[0]; - size_t nodeIdxMin2 = (it2->second)[0]; - size_t faceIdx = face_idx(nf); - - if (nodeIdxMin1 != nodeIdxMin2) - { - size_t edgeHash = hashPairOrdered(nodeIdxMin1, nodeIdxMin2); - if (edgeHash2Face.count(edgeHash) == 0) - { - edgeHashList(nEdge) = edgeHash; - ++nEdge; - } - edgeHash2Face[edgeHash].push_back(faceIdx); - edgeHash2Face[edgeHash].push_back(mpiRank); - } // nodeIdxMin1 != nodeIdxMin2 - } - } - edgeHashList.resizeAndPreserve(nEdge); - - // (3) Face_face connectivity - - int nbNghb = 0; - CClientClientDHTSizet::Index2VectorInfoTypeMap::iterator itNode1, itNode2; - - // edgeHash2Info = - CClientClientDHTSizet dhtEdge2Face (edgeHash2Face, comm); - dhtEdge2Face.computeIndexInfoMapping(edgeHashList); - CClientClientDHTSizet::Index2VectorInfoTypeMap& edgeHash2Info = dhtEdge2Face.getInfoIndexMap(); - CClientClientDHTSizet::Index2VectorInfoTypeMap mapFaces; // auxiliar map - - for (int nf = 0; nf < nbFaces; ++nf) - { - for (int nv1 = 0; nv1 < nvertex; ++nv1) - { - // Getting indexes of edge's nodes - int nv2 = (nv1 < nvertex -1 ) ? (nv1 + 1) : (nv1 + 1 - nvertex); // cyclic rotation - vector hashValues1 = CMesh::createHashes(bounds_lon(nv1, nf), bounds_lat(nv1, nf)); - vector hashValues2 = CMesh::createHashes(bounds_lon(nv2, nf), bounds_lat(nv2, nf)); - - size_t myNodeIdx1 = generateNodeIndex(hashValues1, mpiRank); - size_t myNodeIdx2 = generateNodeIndex(hashValues2, mpiRank); - itNode1 = nodeIdx2IdxMin.find(myNodeIdx1); - itNode2 = nodeIdx2IdxMin.find(myNodeIdx2); - size_t nodeIdxMin1 = (itNode1->second)[0]; - size_t nodeIdxMin2 = (itNode2->second)[0]; - - if (nodeIdxMin1 != nodeIdxMin2) - { - size_t edgeHash = hashPairOrdered(nodeIdxMin1, nodeIdxMin2); - it1 = edgeHash2Info.find(edgeHash); - - for (int i = 0; i < it1->second.size();) - { - size_t face = it1->second[i]; - size_t rank = it1->second[i+1]; - if (rank != mpiRank) - if (mapFaces.count(face) == 0) - { - nghbFaces(0, nbNghb) = face; - nghbFaces(1, nbNghb) = rank; - ++nbNghb; - mapFaces[face].push_back(face); - } - i += 2; - } - } // nodeIdxMin1 != nodeIdxMin2 - } - } - if (nbNghb==0) nghbFaces.resize(2, nbNghb); - else nghbFaces.resizeAndPreserve(2, nbNghb); - } // getGloNghbFacesEdgeType - - ///---------------------------------------------------------------- - /*! - * \fn void getGlobalNghbFaces (const int nghbType, const MPI_Comm& comm, const CArray& face_idx, - const CArray& bounds_lon, const CArray& bounds_lat, - CArray& nghbFaces) - * Finds neighboring faces owned by other procs. - * \param [in] nghbType 0 for faces sharing nodes, otherwise for faces sharing edges. - * \param [in] comm - * \param [in] face_idx Array with global indexes. - * \param [in] bounds_lon Array of boundary longitudes. - * \param [in] bounds_lat Array of boundary latitudes. - * \param [out] nghbFaces 2D array containing neighboring faces and owner ranks. - */ - - void CMesh::getGlobalNghbFaces(const int nghbType, const MPI_Comm& comm, - const CArray& face_idx, - const CArray& bounds_lon, const CArray& bounds_lat, - CArray& nghbFaces) - { - if (nghbType == 0) - getGloNghbFacesNodeType(comm, face_idx, bounds_lon, bounds_lat, nghbFaces); - else - getGloNghbFacesEdgeType(comm, face_idx, bounds_lon, bounds_lat, nghbFaces); - } // getGlobalNghbFaces - - ///---------------------------------------------------------------- - /*! - * \fn void getLocalNghbFaces (const int nghbType, - const CArray& bounds_lon, const CArray& bounds_lat, - CArray& nghbFaces) - * \param [in] nghbType 0 for faces sharing nodes, otherwise for faces sharing edges. - * \param [in] bounds_lon Array of boundary longitudes. - * \param [in] bounds_lat Array of boundary latitudes. - * \param [out] nghbFaces 1D array containing neighboring faces. - */ - - void CMesh::getLocalNghbFaces(const int nghbType, const CArray& face_idx, - const CArray& bounds_lon, const CArray& bounds_lat, - CArray& nghbFaces, CArray& nbNghbFaces) - { - if (nghbType == 0) - getLocNghbFacesNodeType(face_idx, bounds_lon, bounds_lat, nghbFaces, nbNghbFaces); - else - getLocNghbFacesEdgeType(face_idx, bounds_lon, bounds_lat, nghbFaces, nbNghbFaces); - } // getLocalNghbFaces - - ///---------------------------------------------------------------- - /*! - * \fn void getLocNghbFacesNodeType (const CArray& bounds_lon, const CArray& bounds_lat, - CArray& nghbFaces) - * \param [in] face_idx Array with local face indexing. - * \param [in] bounds_lon Array of boundary longitudes. - * \param [in] bounds_lat Array of boundary latitudes. - * \param [out] nghbFaces 2D array containing neighboring faces. - * \param [out] nbNghbFaces Array containing number of neighboring faces. - */ - - void CMesh::getLocNghbFacesNodeType (const CArray& face_idx, - const CArray& bounds_lon, const CArray& bounds_lat, - CArray& faceToFaces, CArray& nbNghbFaces) - { - int nvertex = bounds_lon.rows(); - int nbFaces = bounds_lon.shape()[1]; - int nbNodes = 0; - nbNghbFaces.resize(nbFaces); - nbNghbFaces = 0; - - // nodeToFaces connectivity - CClientClientDHTSizet::Index2VectorInfoTypeMap nodeToFaces; - for (int nf = 0; nf < nbFaces; ++nf) - for (int nv = 0; nv < nvertex; ++nv) - { - size_t nodeHash = (CMesh::createHashes(bounds_lon(nv, nf), bounds_lat(nv ,nf)))[0]; - nodeToFaces[nodeHash].push_back(face_idx(nf)); - } - - // faceToFaces connectivity - std::unordered_map mapFaces; // mapFaces = < hash(face1, face2), hash> (the mapped value is irrelevant) - int maxNb = 20; // some assumption on the max possible number of neighboring cells - faceToFaces.resize(maxNb, nbFaces); - CClientClientDHTSizet::Index2VectorInfoTypeMap::iterator it; - for (it = nodeToFaces.begin(); it != nodeToFaces.end(); ++it) - { - int size = it->second.size(); - for (int i = 0; i < (size-1); ++i) - { - int face1 = it->second[i]; - for (int j = i+1; j < size; ++j) - { - int face2 = it->second[j]; - if (face2 != face1) - { - int hashFace = hashPairOrdered(face1, face2); - if (mapFaces.count(hashFace) == 0) - { - faceToFaces(nbNghbFaces(face1), face1) = face2; - faceToFaces(nbNghbFaces(face2), face2) = face1; - ++nbNghbFaces(face1); - ++nbNghbFaces(face2); - mapFaces[hashFace] = hashFace; - } - } - } - } - } - } //getLocNghbFacesNodeType - - - ///---------------------------------------------------------------- - /*! - * \fn void getLocNghbFacesEdgeType (const CArray& face_idx, - * const CArray& bounds_lon, const CArray& bounds_lat, - * CArray& nghbFaces, CArray& nbNghbFaces) - * \param [in] face_idx Array with local face indexing. - * \param [in] bounds_lon Array of boundary longitudes. - * \param [in] bounds_lat Array of boundary latitudes. - * \param [out] nghbFaces 2D array containing neighboring faces. - * \param [out] nbNghbFaces Array containing number of neighboring faces. - */ - - void CMesh::getLocNghbFacesEdgeType (const CArray& face_idx, - const CArray& bounds_lon, const CArray& bounds_lat, - CArray& faceToFaces, CArray& nbNghbFaces) - { - int nvertex = bounds_lon.rows(); - int nbFaces = bounds_lon.shape()[1]; - int nbNodes = 0; - int nbEdges = 0; - nbNghbFaces.resize(nbFaces); - nbNghbFaces = 0; - - // faceToNodes connectivity - CArray faceToNodes (nvertex, nbFaces); - - std::unordered_map > mapNodes; - - for (int nf = 0; nf < nbFaces; ++nf) - for (int nv = 0; nv < nvertex; ++nv) - { - if (mapNodes.find(make_pair (bounds_lon(nv, nf), bounds_lat(nv ,nf))) == mapNodes.end()) - { - mapNodes[make_pair (bounds_lon(nv, nf), bounds_lat(nv, nf))] = nbNodes; - faceToNodes(nv,nf) = nbNodes ; - ++nbNodes ; - } - else - faceToNodes(nv,nf) = mapNodes[make_pair (bounds_lon(nv, nf), bounds_lat(nv ,nf))]; - } - - // faceToFaces connectivity - std::unordered_map > mapEdges; - faceToFaces.resize(nvertex, nbFaces); - CArray edgeToFaces(2, nbFaces*nvertex); // max possible - - for (int nf = 0; nf < nbFaces; ++nf) - { - for (int nv1 = 0; nv1 < nvertex; ++nv1) - { - int nv2 = (nv1 < nvertex -1 ) ? (nv1 + 1) : (nv1 + 1 - nvertex); // cyclic rotation - int face = face_idx(nf); - int node1 = faceToNodes(nv1,face); - int node2 = faceToNodes(nv2,face); - if (node1 != node2) - { - if (mapEdges.find(make_ordered_pair (node1, node2)) == mapEdges.end()) - { - mapEdges[make_ordered_pair (node1, node2)] = nbEdges; - edgeToFaces(0,nbEdges) = face; - ++nbEdges; - } - else - { - int edge = mapEdges[make_ordered_pair (node1, node2)]; - edgeToFaces(1, edge) = face; - int face1 = face; - int face2 = edgeToFaces(0,edge); - faceToFaces(nbNghbFaces(face1), face1) = face2; - faceToFaces(nbNghbFaces(face2), face2) = face1; - ++nbNghbFaces(face1); - ++nbNghbFaces(face2); - } - } // node1 != node2 - } // nv - } // nf - - } //getLocNghbFacesEdgeType - - -} // namespace xios diff --git a/xios_2311_src/trunk/.svn/pristine/57/57ae73b9c47d96a80f523b4a4d97c06ca566d537.svn-base b/xios_2311_src/trunk/.svn/pristine/57/57ae73b9c47d96a80f523b4a4d97c06ca566d537.svn-base deleted file mode 100644 index 78c4976585ac893847c9c7b804561b2dcfb12f77..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/57/57ae73b9c47d96a80f523b4a4d97c06ca566d537.svn-base +++ /dev/null @@ -1,221 +0,0 @@ -#include "xios_fortran_prefix.hpp" -MODULE IDATE - USE, INTRINSIC :: ISO_C_BINDING - USE DATE_INTERFACE - - INTERFACE OPERATOR(+) - MODULE PROCEDURE xios(date_add_duration) - END INTERFACE - - INTERFACE OPERATOR(-) - MODULE PROCEDURE xios(date_sub_duration) - MODULE PROCEDURE xios(date_sub) - END INTERFACE - - INTERFACE OPERATOR(==) - MODULE PROCEDURE xios(date_eq) - END INTERFACE - - INTERFACE OPERATOR(/=) - MODULE PROCEDURE xios(date_neq) - END INTERFACE - - INTERFACE OPERATOR(<) - MODULE PROCEDURE xios(date_lt) - END INTERFACE - - INTERFACE OPERATOR(<=) - MODULE PROCEDURE xios(date_le) - END INTERFACE - - INTERFACE OPERATOR(>) - MODULE PROCEDURE xios(date_gt) - END INTERFACE - - INTERFACE OPERATOR(>=) - MODULE PROCEDURE xios(date_ge) - END INTERFACE - - INTERFACE ASSIGNMENT(=) - MODULE PROCEDURE xios(date_assign_duration) - END INTERFACE - - CONTAINS ! Fonctions disponibles pour les utilisateurs. - - ! Conversion functions - - FUNCTION xios(date_convert_to_seconds)(date) RESULT(res) - USE DATE_INTERFACE, only : txios(date) - IMPLICIT NONE - TYPE(txios(date)), INTENT(IN) :: date - INTEGER(kind = C_LONG_LONG) :: res - - res = cxios_date_convert_to_seconds(date) - END FUNCTION xios(date_convert_to_seconds) - - SUBROUTINE xios(date_convert_to_string)(date, str) - USE DATE_INTERFACE, only : txios(date) - IMPLICIT NONE - TYPE(txios(date)), INTENT(IN) :: date - CHARACTER(len = *), INTENT(OUT) :: str - - CALL cxios_date_convert_to_string(date, str, len(str)) - END SUBROUTINE xios(date_convert_to_string) - - FUNCTION xios(date_convert_from_string)(str) RESULT(res) - USE DATE_INTERFACE, only : txios(date) - IMPLICIT NONE - CHARACTER(len = *), INTENT(IN) :: str - TYPE(txios(date)) :: res - - res = cxios_date_convert_from_string(str, len(str)) - END FUNCTION xios(date_convert_from_string) - - ! Addition: date + duration = date - - FUNCTION xios(date_add_duration)(date, dur) RESULT(res) - USE DATE_INTERFACE, only : txios(date) - USE IDURATION, only : txios(duration) - IMPLICIT NONE - TYPE(txios(date)), INTENT(IN) :: date - TYPE(txios(duration)), INTENT(IN) :: dur - TYPE(txios(date)) :: res - - res = cxios_date_add_duration(date, dur) - END FUNCTION xios(date_add_duration) - - ! Subtraction: date - duration = date - - FUNCTION xios(date_sub_duration)(date, dur) RESULT(res) - USE DATE_INTERFACE, only : txios(date) - USE IDURATION, only : txios(duration) - IMPLICIT NONE - TYPE(txios(date)), INTENT(IN) :: date - TYPE(txios(duration)), INTENT(IN) :: dur - TYPE(txios(date)) :: res - - res = cxios_date_sub_duration(date, dur) - END FUNCTION xios(date_sub_duration) - - ! Subtraction: date - date = duration - - FUNCTION xios(date_sub)(date1, date2) RESULT(res) - USE DATE_INTERFACE, only : txios(date) - USE IDURATION, only : txios(duration) - IMPLICIT NONE - TYPE(txios(date)), INTENT(IN) :: date1, date2 - TYPE(txios(duration)) :: res - - res = cxios_date_sub(date1, date2) - END FUNCTION xios(date_sub) - - FUNCTION xios(date_eq)(date1, date2) RESULT(res) - USE DATE_INTERFACE, only : txios(date) - IMPLICIT NONE - TYPE(txios(date)), INTENT(IN) :: date1, date2 - LOGICAL :: res - - res = cxios_date_eq(date1, date2) - END FUNCTION xios(date_eq) - - FUNCTION xios(date_neq)(date1, date2) RESULT(res) - USE DATE_INTERFACE, only : txios(date) - IMPLICIT NONE - TYPE(txios(date)), INTENT(IN) :: date1, date2 - LOGICAL :: res - - res = cxios_date_neq(date1, date2) - END FUNCTION xios(date_neq) - - FUNCTION xios(date_lt)(date1, date2) RESULT(res) - USE DATE_INTERFACE, only : txios(date) - IMPLICIT NONE - TYPE(txios(date)), INTENT(IN) :: date1, date2 - LOGICAL :: res - - res = cxios_date_lt(date1, date2) - END FUNCTION xios(date_lt) - - FUNCTION xios(date_le)(date1, date2) RESULT(res) - USE DATE_INTERFACE, only : txios(date) - IMPLICIT NONE - TYPE(txios(date)), INTENT(IN) :: date1, date2 - LOGICAL :: res - - res = cxios_date_le(date1, date2) - END FUNCTION xios(date_le) - - FUNCTION xios(date_gt)(date1, date2) RESULT(res) - USE DATE_INTERFACE, only : txios(date) - IMPLICIT NONE - TYPE(txios(date)), INTENT(IN) :: date1, date2 - LOGICAL :: res - - res = cxios_date_gt(date1, date2) - END FUNCTION xios(date_gt) - - FUNCTION xios(date_ge)(date1, date2) RESULT(res) - USE DATE_INTERFACE, only : txios(date) - IMPLICIT NONE - TYPE(txios(date)), INTENT(IN) :: date1, date2 - LOGICAL :: res - - res = cxios_date_ge(date1, date2) - END FUNCTION xios(date_ge) - - SUBROUTINE xios(date_assign_duration)(date, dur) - USE DATE_INTERFACE, only : txios(date) - USE IDURATION, only : txios(duration) - IMPLICIT NONE - TYPE(txios(date)), INTENT(OUT) :: date - TYPE(txios(duration)), INTENT(IN) :: dur - - date = txios(date)(0, 1, 1, 0, 0, 0) + dur - END SUBROUTINE xios(date_assign_duration) - - FUNCTION xios(date_get_second_of_year)(date) RESULT(res) - USE DATE_INTERFACE, only : txios(date) - IMPLICIT NONE - TYPE(txios(date)), INTENT(IN) :: date - INTEGER(kind = C_INT) :: res - - res = cxios_date_get_second_of_year(date) - END FUNCTION xios(date_get_second_of_year) - - FUNCTION xios(date_get_day_of_year)(date) RESULT(res) - USE DATE_INTERFACE, only : txios(date) - IMPLICIT NONE - TYPE(txios(date)), INTENT(IN) :: date - REAL(kind = C_DOUBLE) :: res - - res = cxios_date_get_day_of_year(date) - END FUNCTION xios(date_get_day_of_year) - - FUNCTION xios(date_get_fraction_of_year)(date) RESULT(res) - USE DATE_INTERFACE, only : txios(date) - IMPLICIT NONE - TYPE(txios(date)), INTENT(IN) :: date - REAL(kind = C_DOUBLE) :: res - - res = cxios_date_get_fraction_of_year(date) - END FUNCTION xios(date_get_fraction_of_year) - - FUNCTION xios(date_get_second_of_day)(date) RESULT(res) - USE DATE_INTERFACE, only : txios(date) - IMPLICIT NONE - TYPE(txios(date)), INTENT(IN) :: date - INTEGER(kind = C_INT) :: res - - res = cxios_date_get_second_of_day(date) - END FUNCTION xios(date_get_second_of_day) - - FUNCTION xios(date_get_fraction_of_day)(date) RESULT(res) - USE DATE_INTERFACE, only : txios(date) - IMPLICIT NONE - TYPE(txios(date)), INTENT(IN) :: date - REAL(kind = C_DOUBLE) :: res - - res = cxios_date_get_fraction_of_day(date) - END FUNCTION xios(date_get_fraction_of_day) - -END MODULE IDATE diff --git a/xios_2311_src/trunk/.svn/pristine/58/588aa86eb57179b74c13b812c207997d32605ad3.svn-base b/xios_2311_src/trunk/.svn/pristine/58/588aa86eb57179b74c13b812c207997d32605ad3.svn-base deleted file mode 100644 index 7f5eafc56d74ca72de141c662ef1fa26e5eb82ed..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/58/588aa86eb57179b74c13b812c207997d32605ad3.svn-base +++ /dev/null @@ -1,721 +0,0 @@ -/* ************************************************************************** * - * Interface auto generated - do not modify * - * ************************************************************************** */ - -#include -#include "xios.hpp" -#include "attribute_template.hpp" -#include "object_template.hpp" -#include "group_template.hpp" -#include "icutil.hpp" -#include "icdate.hpp" -#include "timer.hpp" -#include "node_type.hpp" - -extern "C" -{ - typedef xios::CAxisGroup* axisgroup_Ptr; - - void cxios_set_axisgroup_axis_ref(axisgroup_Ptr axisgroup_hdl, const char * axis_ref, int axis_ref_size) - { - std::string axis_ref_str; - if (!cstr2string(axis_ref, axis_ref_size, axis_ref_str)) return; - CTimer::get("XIOS").resume(); - axisgroup_hdl->axis_ref.setValue(axis_ref_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_axisgroup_axis_ref(axisgroup_Ptr axisgroup_hdl, char * axis_ref, int axis_ref_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(axisgroup_hdl->axis_ref.getInheritedValue(), axis_ref, axis_ref_size)) - ERROR("void cxios_get_axisgroup_axis_ref(axisgroup_Ptr axisgroup_hdl, char * axis_ref, int axis_ref_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_axisgroup_axis_ref(axisgroup_Ptr axisgroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = axisgroup_hdl->axis_ref.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_axisgroup_axis_type(axisgroup_Ptr axisgroup_hdl, const char * axis_type, int axis_type_size) - { - std::string axis_type_str; - if (!cstr2string(axis_type, axis_type_size, axis_type_str)) return; - CTimer::get("XIOS").resume(); - axisgroup_hdl->axis_type.fromString(axis_type_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_axisgroup_axis_type(axisgroup_Ptr axisgroup_hdl, char * axis_type, int axis_type_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(axisgroup_hdl->axis_type.getInheritedStringValue(), axis_type, axis_type_size)) - ERROR("void cxios_get_axisgroup_axis_type(axisgroup_Ptr axisgroup_hdl, char * axis_type, int axis_type_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_axisgroup_axis_type(axisgroup_Ptr axisgroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = axisgroup_hdl->axis_type.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_axisgroup_begin(axisgroup_Ptr axisgroup_hdl, int begin) - { - CTimer::get("XIOS").resume(); - axisgroup_hdl->begin.setValue(begin); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_axisgroup_begin(axisgroup_Ptr axisgroup_hdl, int* begin) - { - CTimer::get("XIOS").resume(); - *begin = axisgroup_hdl->begin.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_axisgroup_begin(axisgroup_Ptr axisgroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = axisgroup_hdl->begin.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_axisgroup_bounds(axisgroup_Ptr axisgroup_hdl, double* bounds, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(bounds, shape(extent[0], extent[1]), neverDeleteData); - axisgroup_hdl->bounds.reference(tmp.copy()); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_axisgroup_bounds(axisgroup_Ptr axisgroup_hdl, double* bounds, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(bounds, shape(extent[0], extent[1]), neverDeleteData); - tmp=axisgroup_hdl->bounds.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_axisgroup_bounds(axisgroup_Ptr axisgroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = axisgroup_hdl->bounds.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_axisgroup_bounds_name(axisgroup_Ptr axisgroup_hdl, const char * bounds_name, int bounds_name_size) - { - std::string bounds_name_str; - if (!cstr2string(bounds_name, bounds_name_size, bounds_name_str)) return; - CTimer::get("XIOS").resume(); - axisgroup_hdl->bounds_name.setValue(bounds_name_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_axisgroup_bounds_name(axisgroup_Ptr axisgroup_hdl, char * bounds_name, int bounds_name_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(axisgroup_hdl->bounds_name.getInheritedValue(), bounds_name, bounds_name_size)) - ERROR("void cxios_get_axisgroup_bounds_name(axisgroup_Ptr axisgroup_hdl, char * bounds_name, int bounds_name_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_axisgroup_bounds_name(axisgroup_Ptr axisgroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = axisgroup_hdl->bounds_name.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_axisgroup_comment(axisgroup_Ptr axisgroup_hdl, const char * comment, int comment_size) - { - std::string comment_str; - if (!cstr2string(comment, comment_size, comment_str)) return; - CTimer::get("XIOS").resume(); - axisgroup_hdl->comment.setValue(comment_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_axisgroup_comment(axisgroup_Ptr axisgroup_hdl, char * comment, int comment_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(axisgroup_hdl->comment.getInheritedValue(), comment, comment_size)) - ERROR("void cxios_get_axisgroup_comment(axisgroup_Ptr axisgroup_hdl, char * comment, int comment_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_axisgroup_comment(axisgroup_Ptr axisgroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = axisgroup_hdl->comment.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_axisgroup_data_begin(axisgroup_Ptr axisgroup_hdl, int data_begin) - { - CTimer::get("XIOS").resume(); - axisgroup_hdl->data_begin.setValue(data_begin); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_axisgroup_data_begin(axisgroup_Ptr axisgroup_hdl, int* data_begin) - { - CTimer::get("XIOS").resume(); - *data_begin = axisgroup_hdl->data_begin.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_axisgroup_data_begin(axisgroup_Ptr axisgroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = axisgroup_hdl->data_begin.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_axisgroup_data_index(axisgroup_Ptr axisgroup_hdl, int* data_index, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(data_index, shape(extent[0]), neverDeleteData); - axisgroup_hdl->data_index.reference(tmp.copy()); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_axisgroup_data_index(axisgroup_Ptr axisgroup_hdl, int* data_index, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(data_index, shape(extent[0]), neverDeleteData); - tmp=axisgroup_hdl->data_index.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_axisgroup_data_index(axisgroup_Ptr axisgroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = axisgroup_hdl->data_index.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_axisgroup_data_n(axisgroup_Ptr axisgroup_hdl, int data_n) - { - CTimer::get("XIOS").resume(); - axisgroup_hdl->data_n.setValue(data_n); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_axisgroup_data_n(axisgroup_Ptr axisgroup_hdl, int* data_n) - { - CTimer::get("XIOS").resume(); - *data_n = axisgroup_hdl->data_n.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_axisgroup_data_n(axisgroup_Ptr axisgroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = axisgroup_hdl->data_n.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_axisgroup_dim_name(axisgroup_Ptr axisgroup_hdl, const char * dim_name, int dim_name_size) - { - std::string dim_name_str; - if (!cstr2string(dim_name, dim_name_size, dim_name_str)) return; - CTimer::get("XIOS").resume(); - axisgroup_hdl->dim_name.setValue(dim_name_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_axisgroup_dim_name(axisgroup_Ptr axisgroup_hdl, char * dim_name, int dim_name_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(axisgroup_hdl->dim_name.getInheritedValue(), dim_name, dim_name_size)) - ERROR("void cxios_get_axisgroup_dim_name(axisgroup_Ptr axisgroup_hdl, char * dim_name, int dim_name_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_axisgroup_dim_name(axisgroup_Ptr axisgroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = axisgroup_hdl->dim_name.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_axisgroup_formula(axisgroup_Ptr axisgroup_hdl, const char * formula, int formula_size) - { - std::string formula_str; - if (!cstr2string(formula, formula_size, formula_str)) return; - CTimer::get("XIOS").resume(); - axisgroup_hdl->formula.setValue(formula_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_axisgroup_formula(axisgroup_Ptr axisgroup_hdl, char * formula, int formula_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(axisgroup_hdl->formula.getInheritedValue(), formula, formula_size)) - ERROR("void cxios_get_axisgroup_formula(axisgroup_Ptr axisgroup_hdl, char * formula, int formula_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_axisgroup_formula(axisgroup_Ptr axisgroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = axisgroup_hdl->formula.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_axisgroup_formula_bounds(axisgroup_Ptr axisgroup_hdl, const char * formula_bounds, int formula_bounds_size) - { - std::string formula_bounds_str; - if (!cstr2string(formula_bounds, formula_bounds_size, formula_bounds_str)) return; - CTimer::get("XIOS").resume(); - axisgroup_hdl->formula_bounds.setValue(formula_bounds_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_axisgroup_formula_bounds(axisgroup_Ptr axisgroup_hdl, char * formula_bounds, int formula_bounds_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(axisgroup_hdl->formula_bounds.getInheritedValue(), formula_bounds, formula_bounds_size)) - ERROR("void cxios_get_axisgroup_formula_bounds(axisgroup_Ptr axisgroup_hdl, char * formula_bounds, int formula_bounds_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_axisgroup_formula_bounds(axisgroup_Ptr axisgroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = axisgroup_hdl->formula_bounds.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_axisgroup_formula_term(axisgroup_Ptr axisgroup_hdl, const char * formula_term, int formula_term_size) - { - std::string formula_term_str; - if (!cstr2string(formula_term, formula_term_size, formula_term_str)) return; - CTimer::get("XIOS").resume(); - axisgroup_hdl->formula_term.setValue(formula_term_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_axisgroup_formula_term(axisgroup_Ptr axisgroup_hdl, char * formula_term, int formula_term_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(axisgroup_hdl->formula_term.getInheritedValue(), formula_term, formula_term_size)) - ERROR("void cxios_get_axisgroup_formula_term(axisgroup_Ptr axisgroup_hdl, char * formula_term, int formula_term_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_axisgroup_formula_term(axisgroup_Ptr axisgroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = axisgroup_hdl->formula_term.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_axisgroup_formula_term_bounds(axisgroup_Ptr axisgroup_hdl, const char * formula_term_bounds, int formula_term_bounds_size) - { - std::string formula_term_bounds_str; - if (!cstr2string(formula_term_bounds, formula_term_bounds_size, formula_term_bounds_str)) return; - CTimer::get("XIOS").resume(); - axisgroup_hdl->formula_term_bounds.setValue(formula_term_bounds_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_axisgroup_formula_term_bounds(axisgroup_Ptr axisgroup_hdl, char * formula_term_bounds, int formula_term_bounds_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(axisgroup_hdl->formula_term_bounds.getInheritedValue(), formula_term_bounds, formula_term_bounds_size)) - ERROR("void cxios_get_axisgroup_formula_term_bounds(axisgroup_Ptr axisgroup_hdl, char * formula_term_bounds, int formula_term_bounds_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_axisgroup_formula_term_bounds(axisgroup_Ptr axisgroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = axisgroup_hdl->formula_term_bounds.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_axisgroup_group_ref(axisgroup_Ptr axisgroup_hdl, const char * group_ref, int group_ref_size) - { - std::string group_ref_str; - if (!cstr2string(group_ref, group_ref_size, group_ref_str)) return; - CTimer::get("XIOS").resume(); - axisgroup_hdl->group_ref.setValue(group_ref_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_axisgroup_group_ref(axisgroup_Ptr axisgroup_hdl, char * group_ref, int group_ref_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(axisgroup_hdl->group_ref.getInheritedValue(), group_ref, group_ref_size)) - ERROR("void cxios_get_axisgroup_group_ref(axisgroup_Ptr axisgroup_hdl, char * group_ref, int group_ref_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_axisgroup_group_ref(axisgroup_Ptr axisgroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = axisgroup_hdl->group_ref.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_axisgroup_index(axisgroup_Ptr axisgroup_hdl, int* index, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(index, shape(extent[0]), neverDeleteData); - axisgroup_hdl->index.reference(tmp.copy()); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_axisgroup_index(axisgroup_Ptr axisgroup_hdl, int* index, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(index, shape(extent[0]), neverDeleteData); - tmp=axisgroup_hdl->index.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_axisgroup_index(axisgroup_Ptr axisgroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = axisgroup_hdl->index.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_axisgroup_label(axisgroup_Ptr axisgroup_hdl, char* label, int str_len, int* str_size, int* extent) - { - CTimer::get("XIOS").resume(); - axisgroup_hdl->label.resize(shape(extent[0])); - Array::iterator it, itb=axisgroup_hdl->label.begin(), ite=axisgroup_hdl->label.end() ; - int i, n ; - for(it=itb, i=0, n=0 ; it!=ite ; ++it,n+=str_len,++i) *it=StdString(&label[n],str_size[i]) ; - CTimer::get("XIOS").suspend(); - } - - void cxios_get_axisgroup_label(axisgroup_Ptr axisgroup_hdl, char* label, int str_size, int* extent) - { - CTimer::get("XIOS").resume(); - Array::const_iterator it, itb=axisgroup_hdl->label.getInheritedValue().begin(), ite=axisgroup_hdl->label.getInheritedValue().end() ; - int n ; - for(it=itb, n=0 ; it!=ite ; ++it, n+=str_size) it->copy(&label[n],it->size()) ; - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_axisgroup_label(axisgroup_Ptr axisgroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = axisgroup_hdl->label.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_axisgroup_long_name(axisgroup_Ptr axisgroup_hdl, const char * long_name, int long_name_size) - { - std::string long_name_str; - if (!cstr2string(long_name, long_name_size, long_name_str)) return; - CTimer::get("XIOS").resume(); - axisgroup_hdl->long_name.setValue(long_name_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_axisgroup_long_name(axisgroup_Ptr axisgroup_hdl, char * long_name, int long_name_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(axisgroup_hdl->long_name.getInheritedValue(), long_name, long_name_size)) - ERROR("void cxios_get_axisgroup_long_name(axisgroup_Ptr axisgroup_hdl, char * long_name, int long_name_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_axisgroup_long_name(axisgroup_Ptr axisgroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = axisgroup_hdl->long_name.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_axisgroup_mask(axisgroup_Ptr axisgroup_hdl, bool* mask, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(mask, shape(extent[0]), neverDeleteData); - axisgroup_hdl->mask.reference(tmp.copy()); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_axisgroup_mask(axisgroup_Ptr axisgroup_hdl, bool* mask, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(mask, shape(extent[0]), neverDeleteData); - tmp=axisgroup_hdl->mask.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_axisgroup_mask(axisgroup_Ptr axisgroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = axisgroup_hdl->mask.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_axisgroup_n(axisgroup_Ptr axisgroup_hdl, int n) - { - CTimer::get("XIOS").resume(); - axisgroup_hdl->n.setValue(n); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_axisgroup_n(axisgroup_Ptr axisgroup_hdl, int* n) - { - CTimer::get("XIOS").resume(); - *n = axisgroup_hdl->n.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_axisgroup_n(axisgroup_Ptr axisgroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = axisgroup_hdl->n.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_axisgroup_n_distributed_partition(axisgroup_Ptr axisgroup_hdl, int n_distributed_partition) - { - CTimer::get("XIOS").resume(); - axisgroup_hdl->n_distributed_partition.setValue(n_distributed_partition); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_axisgroup_n_distributed_partition(axisgroup_Ptr axisgroup_hdl, int* n_distributed_partition) - { - CTimer::get("XIOS").resume(); - *n_distributed_partition = axisgroup_hdl->n_distributed_partition.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_axisgroup_n_distributed_partition(axisgroup_Ptr axisgroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = axisgroup_hdl->n_distributed_partition.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_axisgroup_n_glo(axisgroup_Ptr axisgroup_hdl, int n_glo) - { - CTimer::get("XIOS").resume(); - axisgroup_hdl->n_glo.setValue(n_glo); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_axisgroup_n_glo(axisgroup_Ptr axisgroup_hdl, int* n_glo) - { - CTimer::get("XIOS").resume(); - *n_glo = axisgroup_hdl->n_glo.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_axisgroup_n_glo(axisgroup_Ptr axisgroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = axisgroup_hdl->n_glo.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_axisgroup_name(axisgroup_Ptr axisgroup_hdl, const char * name, int name_size) - { - std::string name_str; - if (!cstr2string(name, name_size, name_str)) return; - CTimer::get("XIOS").resume(); - axisgroup_hdl->name.setValue(name_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_axisgroup_name(axisgroup_Ptr axisgroup_hdl, char * name, int name_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(axisgroup_hdl->name.getInheritedValue(), name, name_size)) - ERROR("void cxios_get_axisgroup_name(axisgroup_Ptr axisgroup_hdl, char * name, int name_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_axisgroup_name(axisgroup_Ptr axisgroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = axisgroup_hdl->name.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_axisgroup_positive(axisgroup_Ptr axisgroup_hdl, const char * positive, int positive_size) - { - std::string positive_str; - if (!cstr2string(positive, positive_size, positive_str)) return; - CTimer::get("XIOS").resume(); - axisgroup_hdl->positive.fromString(positive_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_axisgroup_positive(axisgroup_Ptr axisgroup_hdl, char * positive, int positive_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(axisgroup_hdl->positive.getInheritedStringValue(), positive, positive_size)) - ERROR("void cxios_get_axisgroup_positive(axisgroup_Ptr axisgroup_hdl, char * positive, int positive_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_axisgroup_positive(axisgroup_Ptr axisgroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = axisgroup_hdl->positive.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_axisgroup_prec(axisgroup_Ptr axisgroup_hdl, int prec) - { - CTimer::get("XIOS").resume(); - axisgroup_hdl->prec.setValue(prec); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_axisgroup_prec(axisgroup_Ptr axisgroup_hdl, int* prec) - { - CTimer::get("XIOS").resume(); - *prec = axisgroup_hdl->prec.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_axisgroup_prec(axisgroup_Ptr axisgroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = axisgroup_hdl->prec.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_axisgroup_standard_name(axisgroup_Ptr axisgroup_hdl, const char * standard_name, int standard_name_size) - { - std::string standard_name_str; - if (!cstr2string(standard_name, standard_name_size, standard_name_str)) return; - CTimer::get("XIOS").resume(); - axisgroup_hdl->standard_name.setValue(standard_name_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_axisgroup_standard_name(axisgroup_Ptr axisgroup_hdl, char * standard_name, int standard_name_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(axisgroup_hdl->standard_name.getInheritedValue(), standard_name, standard_name_size)) - ERROR("void cxios_get_axisgroup_standard_name(axisgroup_Ptr axisgroup_hdl, char * standard_name, int standard_name_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_axisgroup_standard_name(axisgroup_Ptr axisgroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = axisgroup_hdl->standard_name.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_axisgroup_unit(axisgroup_Ptr axisgroup_hdl, const char * unit, int unit_size) - { - std::string unit_str; - if (!cstr2string(unit, unit_size, unit_str)) return; - CTimer::get("XIOS").resume(); - axisgroup_hdl->unit.setValue(unit_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_axisgroup_unit(axisgroup_Ptr axisgroup_hdl, char * unit, int unit_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(axisgroup_hdl->unit.getInheritedValue(), unit, unit_size)) - ERROR("void cxios_get_axisgroup_unit(axisgroup_Ptr axisgroup_hdl, char * unit, int unit_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_axisgroup_unit(axisgroup_Ptr axisgroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = axisgroup_hdl->unit.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_axisgroup_value(axisgroup_Ptr axisgroup_hdl, double* value, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(value, shape(extent[0]), neverDeleteData); - axisgroup_hdl->value.reference(tmp.copy()); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_axisgroup_value(axisgroup_Ptr axisgroup_hdl, double* value, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(value, shape(extent[0]), neverDeleteData); - tmp=axisgroup_hdl->value.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_axisgroup_value(axisgroup_Ptr axisgroup_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = axisgroup_hdl->value.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } -} diff --git a/xios_2311_src/trunk/.svn/pristine/58/589df8bd8201c7fec58bc8e42fe718fac62571a8.svn-base b/xios_2311_src/trunk/.svn/pristine/58/589df8bd8201c7fec58bc8e42fe718fac62571a8.svn-base deleted file mode 100644 index faf9c741ec5d98e883865cd86ebcb1713e298c55..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/58/589df8bd8201c7fec58bc8e42fe718fac62571a8.svn-base +++ /dev/null @@ -1,58 +0,0 @@ -#ifndef __XIOS_DECLARE_GROUP__ -#define __XIOS_DECLARE_GROUP__ - -/// ///////////////////////////// Macros ///////////////////////////// /// - -#define DECLARE_GROUP(type) \ - class type##Group \ - : public CGroupTemplate \ - { \ - public: \ - typedef type RelChild; \ - typedef type##Group RelGroup; \ - typedef type##Attributes RelAttributes; \ - \ - type##Group(void) \ - : CGroupTemplate () \ - { /* Ne rien faire de plus */ } \ - type##Group(const StdString& _id) \ - : CGroupTemplate (_id) \ - { /* Ne rien faire de plus */ } \ - \ - static ENodeType GetType(void) \ - { return static_cast(RelChild::GetType()+1); } \ - \ - virtual ~type##Group(void) \ - { /* Ne rien faire de plus */ } \ - }; \ - typedef type##Group type##Definition - -#define DECLARE_GROUP_PARSE_REDEF(type) \ - class type##Group \ - : public CGroupTemplate \ - { \ - public: \ - typedef type RelChild; \ - typedef type##Group RelGroup; \ - typedef type##Attributes RelAttributes; \ - typedef CGroupTemplate \ - SuperClass; \ - \ - type##Group(void) \ - : CGroupTemplate () \ - { /* Ne rien faire de plus */ } \ - type##Group(const StdString& _id) \ - : CGroupTemplate (_id) \ - { /* Ne rien faire de plus */ } \ - \ - static ENodeType GetType(void) \ - { return static_cast(RelChild::GetType()+1); } \ - \ - virtual void parse(xml::CXMLNode & node, bool withAttr = true); \ - \ - virtual ~type##Group(void) \ - { /* Ne rien faire de plus */ } \ - }; \ - typedef type##Group type##Definition - -#endif // __XIOS_DECLARE_GROUP__ diff --git a/xios_2311_src/trunk/.svn/pristine/58/589ee09c9844724e938ed52db01937730a2e7cc7.svn-base b/xios_2311_src/trunk/.svn/pristine/58/589ee09c9844724e938ed52db01937730a2e7cc7.svn-base deleted file mode 100644 index 6e708af154afee21833b386fd6cf51e6f449c6ff..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/58/589ee09c9844724e938ed52db01937730a2e7cc7.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -DECLARE_ENUM4(operation, min, max, sum, average) - -/* Direction to apply operation (i, j) */ -DECLARE_ENUM2(direction, iDir, jDir) -DECLARE_ATTRIBUTE(bool, local) diff --git a/xios_2311_src/trunk/.svn/pristine/58/58e2f5206c446e66bc0938e5e9a5d8d45b11d89f.svn-base b/xios_2311_src/trunk/.svn/pristine/58/58e2f5206c446e66bc0938e5e9a5d8d45b11d89f.svn-base deleted file mode 100644 index aca6523b133fecef3e9eed8bb818a181af929564..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/58/58e2f5206c446e66bc0938e5e9a5d8d45b11d89f.svn-base +++ /dev/null @@ -1,497 +0,0 @@ -/* - * Copyright 1996, University Corporation for Atmospheric Research - * See netcdf/COPYRIGHT file for copying and redistribution conditions. - */ -/* $Id: dim.c,v 1.83 2010/05/25 17:54:15 dmh Exp $ */ - -#include "nc.h" -#include -#include -#include -#include "ncx.h" -#include "fbits.h" -#include "utf8proc.h" - -/* - * Free dim - * Formerly -NC_free_dim(dim) - */ -void -free_NC_dim(NC_dim *dimp) -{ - if(dimp == NULL) - return; - free_NC_string(dimp->name); - free(dimp); -} - - -NC_dim * -new_x_NC_dim(NC_string *name) -{ - NC_dim *dimp; - - dimp = (NC_dim *) malloc(sizeof(NC_dim)); - if(dimp == NULL) - return NULL; - - dimp->name = name; - dimp->hash = hash_fast(name->cp, strlen(name->cp)); - dimp->size = 0; - - return(dimp); -} - - -/* - * Formerly -NC_new_dim(const char *uname, long size) - */ -static NC_dim * -new_NC_dim(const char *uname, size_t size) -{ - NC_string *strp; - NC_dim *dimp; - - char *name = (char *)utf8proc_NFC((const unsigned char *)uname); - if(name == NULL) - return NULL; - strp = new_NC_string(strlen(name), name); - free(name); - if(strp == NULL) - return NULL; - - dimp = new_x_NC_dim(strp); - if(dimp == NULL) - { - free_NC_string(strp); - return NULL; - } - - dimp->size = size; - - return(dimp); -} - - -static NC_dim * -dup_NC_dim(const NC_dim *dimp) -{ - return new_NC_dim(dimp->name->cp, dimp->size); -} - -/* - * Step thru NC_DIMENSION array, seeking the UNLIMITED dimension. - * Return dimid or -1 on not found. - * *dimpp is set to the appropriate NC_dim. - * The loop structure is odd. In order to parallelize, - * we moved a clearer 'break' inside the loop body to the loop test. - */ -int -find_NC_Udim(const NC_dimarray *ncap, NC_dim **dimpp) -{ - assert(ncap != NULL); - - if(ncap->nelems == 0) - return -1; - - { - int dimid = 0; - NC_dim **loc = ncap->value; - - for(; (size_t) dimid < ncap->nelems - && (*loc)->size != NC_UNLIMITED; dimid++, loc++) - { - /*EMPTY*/ - } - if(dimid >= ncap->nelems) - return(-1); /* not found */ - /* else, normal return */ - if(dimpp != NULL) - *dimpp = *loc; - return dimid; - } -} - - -/* - * Step thru NC_DIMENSION array, seeking match on uname. - * Return dimid or -1 on not found. - * *dimpp is set to the appropriate NC_dim. - * The loop structure is odd. In order to parallelize, - * we moved a clearer 'break' inside the loop body to the loop test. - */ -static int -NC_finddim(const NC_dimarray *ncap, const char *uname, NC_dim **dimpp) -{ - - int dimid; - uint32_t shash; - NC_dim ** loc; - char *name; - - assert(ncap != NULL); - - if(ncap->nelems == 0) - return -1; - - { - dimid = 0; - loc = (NC_dim **) ncap->value; - /* normalized version of uname */ - name = (char *)utf8proc_NFC((const unsigned char *)uname); - if(name == NULL) - return NC_ENOMEM; - shash = hash_fast(name, strlen(name)); - - for(; (size_t) dimid < ncap->nelems - && ((*loc)->hash != shash - || strncmp((*loc)->name->cp, name, strlen(name)) != 0); - dimid++, loc++) - { - /*EMPTY*/ - } - free(name); - if(dimid >= ncap->nelems) - return(-1); /* not found */ - /* else, normal return */ - if(dimpp != NULL) - *dimpp = *loc; - return(dimid); - } -} - - -/* dimarray */ - - -/* - * Free the stuff "in" (referred to by) an NC_dimarray. - * Leaves the array itself allocated. - */ -void -free_NC_dimarrayV0(NC_dimarray *ncap) -{ - assert(ncap != NULL); - - if(ncap->nelems == 0) - return; - - assert(ncap->value != NULL); - - { - NC_dim **dpp = ncap->value; - NC_dim *const *const end = &dpp[ncap->nelems]; - for( /*NADA*/; dpp < end; dpp++) - { - free_NC_dim(*dpp); - *dpp = NULL; - } - } - ncap->nelems = 0; -} - - -/* - * Free NC_dimarray values. - * formerly -NC_free_array() - */ -void -free_NC_dimarrayV(NC_dimarray *ncap) -{ - assert(ncap != NULL); - - if(ncap->nalloc == 0) - return; - - assert(ncap->value != NULL); - - free_NC_dimarrayV0(ncap); - - free(ncap->value); - ncap->value = NULL; - ncap->nalloc = 0; -} - - -int -dup_NC_dimarrayV(NC_dimarray *ncap, const NC_dimarray *ref) -{ - int status = NC_NOERR; - - assert(ref != NULL); - assert(ncap != NULL); - - if(ref->nelems != 0) - { - const size_t sz = ref->nelems * sizeof(NC_dim *); - ncap->value = (NC_dim **) malloc(sz); - if(ncap->value == NULL) - return NC_ENOMEM; - (void) memset(ncap->value, 0, sz); - ncap->nalloc = ref->nelems; - } - - ncap->nelems = 0; - { - NC_dim **dpp = ncap->value; - const NC_dim **drpp = (const NC_dim **)ref->value; - NC_dim *const *const end = &dpp[ref->nelems]; - for( /*NADA*/; dpp < end; drpp++, dpp++, ncap->nelems++) - { - *dpp = dup_NC_dim(*drpp); - if(*dpp == NULL) - { - status = NC_ENOMEM; - break; - } - } - } - - if(status != NC_NOERR) - { - free_NC_dimarrayV(ncap); - return status; - } - - assert(ncap->nelems == ref->nelems); - - return NC_NOERR; -} - - -/* - * Add a new handle on the end of an array of handles - * Formerly -NC_incr_array(array, tail) - */ -static int -incr_NC_dimarray(NC_dimarray *ncap, NC_dim *newelemp) -{ - NC_dim **vp; - - assert(ncap != NULL); - - if(ncap->nalloc == 0) - { - assert(ncap->nelems == 0); - vp = (NC_dim **) malloc(NC_ARRAY_GROWBY * sizeof(NC_dim *)); - if(vp == NULL) - return NC_ENOMEM; - ncap->value = vp; - ncap->nalloc = NC_ARRAY_GROWBY; - } - else if(ncap->nelems +1 > ncap->nalloc) - { - vp = (NC_dim **) realloc(ncap->value, - (ncap->nalloc + NC_ARRAY_GROWBY) * sizeof(NC_dim *)); - if(vp == NULL) - return NC_ENOMEM; - ncap->value = vp; - ncap->nalloc += NC_ARRAY_GROWBY; - } - - if(newelemp != NULL) - { - ncap->value[ncap->nelems] = newelemp; - ncap->nelems++; - } - return NC_NOERR; -} - - -NC_dim * -elem_NC_dimarray(const NC_dimarray *ncap, size_t elem) -{ - assert(ncap != NULL); - /* cast needed for braindead systems with signed size_t */ - if(ncap->nelems == 0 || (unsigned long) elem >= ncap->nelems) - return NULL; - - assert(ncap->value != NULL); - - return ncap->value[elem]; -} - - -/* Public */ - -int -NC3_def_dim(int ncid, const char *name, size_t size, int *dimidp) -{ - int status; - NC *ncp; - int dimid; - NC_dim *dimp; - - status = NC_check_id(ncid, &ncp); - if(status != NC_NOERR) - return status; - - if(!NC_indef(ncp)) - return NC_ENOTINDEFINE; - - status = NC_check_name(name); - if(status != NC_NOERR) - return status; - - if ((ncp->flags & NC_64BIT_OFFSET) && sizeof(off_t) > 4) { - /* CDF2 format and LFS */ - if(size > X_UINT_MAX - 3) /* "- 3" handles rounded-up size */ - return NC_EDIMSIZE; - } else { - /* CDF1 format */ - if(size > X_INT_MAX - 3) - return NC_EDIMSIZE; - } - - if(size == NC_UNLIMITED) - { - dimid = find_NC_Udim(&ncp->dims, &dimp); - if(dimid != -1) - { - assert(dimid != -1); - return NC_EUNLIMIT; - } - } - - if(ncp->dims.nelems >= NC_MAX_DIMS) - return NC_EMAXDIMS; - - dimid = NC_finddim(&ncp->dims, name, &dimp); - if(dimid != -1) - return NC_ENAMEINUSE; - - dimp = new_NC_dim(name, size); - if(dimp == NULL) - return NC_ENOMEM; - status = incr_NC_dimarray(&ncp->dims, dimp); - if(status != NC_NOERR) - { - free_NC_dim(dimp); - return status; - } - - if(dimidp != NULL) - *dimidp = (int)ncp->dims.nelems -1; - return NC_NOERR; -} - - -int -NC3_inq_dimid(int ncid, const char *name, int *dimid_ptr) -{ - int status; - NC *ncp; - int dimid; - - status = NC_check_id(ncid, &ncp); - if(status != NC_NOERR) - return status; - - dimid = NC_finddim(&ncp->dims, name, NULL); - - if(dimid == -1) - return NC_EBADDIM; - - if (dimid_ptr) - *dimid_ptr = dimid; - return NC_NOERR; -} - -int -NC3_inq_dim(int ncid, int dimid, char *name, size_t *sizep) -{ - int status; - NC *ncp; - NC_dim *dimp; - - status = NC_check_id(ncid, &ncp); - if(status != NC_NOERR) - return status; - - dimp = elem_NC_dimarray(&ncp->dims, (size_t)dimid); - if(dimp == NULL) - return NC_EBADDIM; - - if(name != NULL) - { - (void)strncpy(name, dimp->name->cp, - dimp->name->nchars); - name[dimp->name->nchars] = 0; - } - if(sizep != NULL) - { - if(dimp->size == NC_UNLIMITED) - *sizep = NC_get_numrecs(ncp); - else - *sizep = dimp->size; - } - return NC_NOERR; -} - -int -NC3_rename_dim( int ncid, int dimid, const char *unewname) -{ - int status; - NC *ncp; - int existid; - NC_dim *dimp; - char *newname; /* normalized */ - - status = NC_check_id(ncid, &ncp); - if(status != NC_NOERR) - return status; - - if(NC_readonly(ncp)) - return NC_EPERM; - - status = NC_check_name(unewname); - if(status != NC_NOERR) - return status; - - existid = NC_finddim(&ncp->dims, unewname, &dimp); - if(existid != -1) - return NC_ENAMEINUSE; - - dimp = elem_NC_dimarray(&ncp->dims, (size_t)dimid); - if(dimp == NULL) - return NC_EBADDIM; - - newname = (char *)utf8proc_NFC((const unsigned char *)unewname); - if(newname == NULL) - return NC_ENOMEM; - if(NC_indef(ncp)) - { - NC_string *old = dimp->name; - NC_string *newStr = new_NC_string(strlen(newname), newname); - free(newname); - if(newStr == NULL) - return NC_ENOMEM; - dimp->name = newStr; - dimp->hash = hash_fast(newStr->cp, strlen(newStr->cp)); - free_NC_string(old); - return NC_NOERR; - } - - /* else, not in define mode */ - - status = set_NC_string(dimp->name, newname); - dimp->hash = hash_fast(newname, strlen(newname)); - free(newname); - if(status != NC_NOERR) - return status; - - set_NC_hdirty(ncp); - - if(NC_doHsync(ncp)) - { - status = NC_sync(ncp); - if(status != NC_NOERR) - return status; - } - - return NC_NOERR; -} diff --git a/xios_2311_src/trunk/.svn/pristine/59/59062ecb9583a971e694c0947dc7a1c020b8e04d.svn-base b/xios_2311_src/trunk/.svn/pristine/59/59062ecb9583a971e694c0947dc7a1c020b8e04d.svn-base deleted file mode 100644 index f99753e5d49852ab54b48b3fcf6603e3fd07929f..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/59/59062ecb9583a971e694c0947dc7a1c020b8e04d.svn-base +++ /dev/null @@ -1,397 +0,0 @@ -/* - * Copyright (c) 2006-2007 Jan Behrens, FlexiGuided GmbH, Berlin - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - - -/* - * File name: utf8proc.h - * Version: 1.1.1 - * Last changed: 2007-07-22 - * Changed 2008-05-16 by rkr to add config.h and replacement for stdbool.h - * for pre-C99 compilers that don't support bool. - * Changed 2008-06-05 by rkr to add utf8proc_check(str, options) function for - * for just checking UTF-8 validity - * Description: - * Header files for libutf8proc, which is a mapping tool for UTF-8 strings - * with following features: - * - decomposing and composing of strings - * - replacing compatibility characters with their equivalents - * - stripping of "default ignorable characters" - * like SOFT-HYPHEN or ZERO-WIDTH-SPACE - * - folding of certain characters for string comparison - * (e.g. HYPHEN U+2010 and MINUS U+2212 to ASCII "-") - * (see "LUMP" option) - * - optional rejection of strings containing non-assigned code points - * - stripping of control characters - * - stripping of character marks (accents, etc.) - * - transformation of LF, CRLF, CR and NEL to line-feed (LF) - * or to the unicode chararacters for paragraph separation (PS) - * or line separation (LS). - * - unicode case folding (for case insensitive string comparisons) - * - rejection of illegal UTF-8 data - * (i.e. UTF-8 encoded UTF-16 surrogates) - * - support for korean hangul characters - * Unicode Version 5.0.0 is supported. - */ - - -#ifndef UTF8PROC_H -#define UTF8PROC_H - - -#include "config.h" - -#include -#ifdef HAVE_STDBOOL_H -#include -#else -# if ! HAVE__BOOL -# ifdef __cplusplus -typedef bool _Bool; -# else -typedef unsigned char _Bool; -# endif -# endif -# define bool _Bool -# define false 0 -# define true 1 -# define __bool_true_false_are_defined 1 -#endif -#include -#ifdef HAVE_INTTYPES_H -#include -#else /* HAVE_INTTYPES_H */ -#include -#endif /* HAVE_INTTYPES_H */ -#include - -#ifndef HAVE_SSIZE_T -#define ssize_t int -#endif - -#ifndef SSIZE_MAX -#define SSIZE_MAX (SIZE_MAX/2) -#endif - -#define UTF8PROC_NULLTERM (1<<0) -#define UTF8PROC_STABLE (1<<1) -#define UTF8PROC_COMPAT (1<<2) -#define UTF8PROC_COMPOSE (1<<3) -#define UTF8PROC_DECOMPOSE (1<<4) -#define UTF8PROC_IGNORE (1<<5) -#define UTF8PROC_REJECTNA (1<<6) -#define UTF8PROC_NLF2LS (1<<7) -#define UTF8PROC_NLF2PS (1<<8) -#define UTF8PROC_NLF2LF (UTF8PROC_NLF2LS | UTF8PROC_NLF2PS) -#define UTF8PROC_STRIPCC (1<<9) -#define UTF8PROC_CASEFOLD (1<<10) -#define UTF8PROC_CHARBOUND (1<<11) -#define UTF8PROC_LUMP (1<<12) -#define UTF8PROC_STRIPMARK (1<<13) -/* - * Flags being regarded by several functions in the library: - * NULLTERM: The given UTF-8 input is NULL terminated. - * STABLE: Unicode Versioning Stability has to be respected. - * COMPAT: Compatiblity decomposition - * (i.e. formatting information is lost) - * COMPOSE: Return a result with composed characters. - * DECOMPOSE: Return a result with decomposed characters. - * IGNORE: Strip "default ignorable characters" - * REJECTNA: Return an error, if the input contains unassigned - * code points. - * NLF2LS: Indicating that NLF-sequences (LF, CRLF, CR, NEL) are - * representing a line break, and should be converted to the - * unicode character for line separation (LS). - * NLF2PS: Indicating that NLF-sequences are representing a paragraph - * break, and should be converted to the unicode character for - * paragraph separation (PS). - * NLF2LF: Indicating that the meaning of NLF-sequences is unknown. - * STRIPCC: Strips and/or convers control characters. - * NLF-sequences are transformed into space, except if one of - * the NLF2LS/PS/LF options is given. - * HorizontalTab (HT) and FormFeed (FF) are treated as a - * NLF-sequence in this case. - * All other control characters are simply removed. - * CASEFOLD: Performs unicode case folding, to be able to do a - * case-insensitive string comparison. - * CHARBOUND: Inserts 0xFF bytes at the beginning of each sequence which - * is representing a single grapheme cluster (see UAX#29). - * LUMP: Lumps certain characters together - * (e.g. HYPHEN U+2010 and MINUS U+2212 to ASCII "-"). - * (See lump.txt for details.) - * If NLF2LF is set, this includes a transformation of - * paragraph and line separators to ASCII line-feed (LF). - * STRIPMARK: Strips all character markings - * (non-spacing, spacing and enclosing) (i.e. accents) - * NOTE: this option works only with COMPOSE or DECOMPOSE - */ - -#define UTF8PROC_ERROR_NOMEM -1 -#define UTF8PROC_ERROR_OVERFLOW -2 -#define UTF8PROC_ERROR_INVALIDUTF8 -3 -#define UTF8PROC_ERROR_NOTASSIGNED -4 -#define UTF8PROC_ERROR_INVALIDOPTS -5 -/* - * Error codes being returned by almost all functions: - * ERROR_NOMEM: Memory could not be allocated. - * ERROR_OVERFLOW: The given string is too long to be processed. - * ERROR_INVALIDUTF8: The given string is not a legal UTF-8 string. - * ERROR_NOTASSIGNED: The REJECTNA flag was set, - * and an unassigned code point was found. - * ERROR_INVALIDOPTS: Invalid options have been used. - */ - -typedef int16_t utf8proc_propval_t; -typedef struct utf8proc_property_struct { - utf8proc_propval_t category; - utf8proc_propval_t combining_class; - utf8proc_propval_t bidi_class; - utf8proc_propval_t decomp_type; - const int32_t *decomp_mapping; - unsigned bidi_mirrored:1; - int32_t uppercase_mapping; - int32_t lowercase_mapping; - int32_t titlecase_mapping; - int32_t comb1st_index; - int32_t comb2nd_index; - unsigned comp_exclusion:1; - unsigned ignorable:1; - unsigned control_boundary:1; - unsigned extend:1; - const int32_t *casefold_mapping; -} utf8proc_property_t; - -#define UTF8PROC_CATEGORY_LU 1 -#define UTF8PROC_CATEGORY_LL 2 -#define UTF8PROC_CATEGORY_LT 3 -#define UTF8PROC_CATEGORY_LM 4 -#define UTF8PROC_CATEGORY_LO 5 -#define UTF8PROC_CATEGORY_MN 6 -#define UTF8PROC_CATEGORY_MC 7 -#define UTF8PROC_CATEGORY_ME 8 -#define UTF8PROC_CATEGORY_ND 9 -#define UTF8PROC_CATEGORY_NL 10 -#define UTF8PROC_CATEGORY_NO 11 -#define UTF8PROC_CATEGORY_PC 12 -#define UTF8PROC_CATEGORY_PD 13 -#define UTF8PROC_CATEGORY_PS 14 -#define UTF8PROC_CATEGORY_PE 15 -#define UTF8PROC_CATEGORY_PI 16 -#define UTF8PROC_CATEGORY_PF 17 -#define UTF8PROC_CATEGORY_PO 18 -#define UTF8PROC_CATEGORY_SM 19 -#define UTF8PROC_CATEGORY_SC 20 -#define UTF8PROC_CATEGORY_SK 21 -#define UTF8PROC_CATEGORY_SO 22 -#define UTF8PROC_CATEGORY_ZS 23 -#define UTF8PROC_CATEGORY_ZL 24 -#define UTF8PROC_CATEGORY_ZP 25 -#define UTF8PROC_CATEGORY_CC 26 -#define UTF8PROC_CATEGORY_CF 27 -#define UTF8PROC_CATEGORY_CS 28 -#define UTF8PROC_CATEGORY_CO 29 -#define UTF8PROC_CATEGORY_CN 30 -#define UTF8PROC_BIDI_CLASS_L 1 -#define UTF8PROC_BIDI_CLASS_LRE 2 -#define UTF8PROC_BIDI_CLASS_LRO 3 -#define UTF8PROC_BIDI_CLASS_R 4 -#define UTF8PROC_BIDI_CLASS_AL 5 -#define UTF8PROC_BIDI_CLASS_RLE 6 -#define UTF8PROC_BIDI_CLASS_RLO 7 -#define UTF8PROC_BIDI_CLASS_PDF 8 -#define UTF8PROC_BIDI_CLASS_EN 9 -#define UTF8PROC_BIDI_CLASS_ES 10 -#define UTF8PROC_BIDI_CLASS_ET 11 -#define UTF8PROC_BIDI_CLASS_AN 12 -#define UTF8PROC_BIDI_CLASS_CS 13 -#define UTF8PROC_BIDI_CLASS_NSM 14 -#define UTF8PROC_BIDI_CLASS_BN 15 -#define UTF8PROC_BIDI_CLASS_B 16 -#define UTF8PROC_BIDI_CLASS_S 17 -#define UTF8PROC_BIDI_CLASS_WS 18 -#define UTF8PROC_BIDI_CLASS_ON 19 -#define UTF8PROC_DECOMP_TYPE_FONT 1 -#define UTF8PROC_DECOMP_TYPE_NOBREAK 2 -#define UTF8PROC_DECOMP_TYPE_INITIAL 3 -#define UTF8PROC_DECOMP_TYPE_MEDIAL 4 -#define UTF8PROC_DECOMP_TYPE_FINAL 5 -#define UTF8PROC_DECOMP_TYPE_ISOLATED 6 -#define UTF8PROC_DECOMP_TYPE_CIRCLE 7 -#define UTF8PROC_DECOMP_TYPE_SUPER 8 -#define UTF8PROC_DECOMP_TYPE_SUB 9 -#define UTF8PROC_DECOMP_TYPE_VERTICAL 10 -#define UTF8PROC_DECOMP_TYPE_WIDE 11 -#define UTF8PROC_DECOMP_TYPE_NARROW 12 -#define UTF8PROC_DECOMP_TYPE_SMALL 13 -#define UTF8PROC_DECOMP_TYPE_SQUARE 14 -#define UTF8PROC_DECOMP_TYPE_FRACTION 15 -#define UTF8PROC_DECOMP_TYPE_COMPAT 16 - -extern const int8_t utf8proc_utf8class[256]; - -const char *utf8proc_errmsg(ssize_t errcode); -/* - * Returns a static error string for the given error code. - */ - -ssize_t utf8proc_iterate(const uint8_t *str, ssize_t strlen, int32_t *dst); -/* - * Reads a single char from the UTF-8 sequence being pointed to by 'str'. - * The maximum number of bytes read is 'strlen', unless 'strlen' is - * negative. - * If a valid unicode char could be read, it is stored in the variable - * being pointed to by 'dst', otherwise that variable will be set to -1. - * In case of success the number of bytes read is returned, otherwise a - * negative error code is returned. - */ - -bool utf8proc_codepoint_valid(int32_t uc); -/* - * Returns 1, if the given unicode code-point is valid, otherwise 0. - */ - -ssize_t utf8proc_encode_char(int32_t uc, uint8_t *dst); -/* - * Encodes the unicode char with the code point 'uc' as an UTF-8 string in - * the byte array being pointed to by 'dst'. This array has to be at least - * 4 bytes long. - * In case of success the number of bytes written is returned, - * otherwise 0. - * This function does not check if 'uc' is a valid unicode code point. - */ - -const utf8proc_property_t *utf8proc_get_property(int32_t uc); -/* - * Returns a pointer to a (constant) struct containing information about - * the unicode char with the given code point 'uc'. - * If the character is not existent a pointer to a special struct is - * returned, where 'category' is a NULL pointer. - * WARNING: The parameter 'uc' has to be in the range of 0x0000 to - * 0x10FFFF, otherwise the program might crash! - */ - -ssize_t utf8proc_decompose_char( - int32_t uc, int32_t *dst, ssize_t bufsize, - int options, int *last_boundclass -); -/* - * Writes a decomposition of the unicode char 'uc' into the array being - * pointed to by 'dst'. - * Following flags in the 'options' field are regarded: - * REJECTNA: an unassigned unicode code point leads to an error - * IGNORE: "default ignorable" chars are stripped - * CASEFOLD: unicode casefolding is applied - * COMPAT: replace certain characters with their - * compatibility decomposition - * CHARBOUND: Inserts 0xFF bytes before each grapheme cluster - * LUMP: lumps certain different characters together - * STRIPMARK: removes all character marks - * The pointer 'last_boundclass' has to point to an integer variable which - * is storing the last character boundary class, if the CHARBOUND option - * is used. - * In case of success the number of chars written is returned, - * in case of an error, a negative error code is returned. - * If the number of written chars would be bigger than 'bufsize', - * the buffer (up to 'bufsize') has inpredictable data, and the needed - * buffer size is returned. - * WARNING: The parameter 'uc' has to be in the range of 0x0000 to - * 0x10FFFF, otherwise the program might crash! - */ - -ssize_t utf8proc_decompose( - const uint8_t *str, ssize_t strlen, - int32_t *buffer, ssize_t bufsize, int options -); -/* - * Does the same as 'utf8proc_decompose_char', but acts on a whole UTF-8 - * string, and orders the decomposed sequences correctly. - * If the NULLTERM flag in 'options' is set, processing will be stopped, - * when a NULL byte is encounted, otherwise 'strlen' bytes are processed. - * The result in form of unicode code points is written into the buffer - * being pointed to by 'buffer', having the length of 'bufsize' entries. - * In case of success the number of chars written is returned, - * in case of an error, a negative error code is returned. - * If the number of written chars would be bigger than 'bufsize', - * the buffer (up to 'bufsize') has inpredictable data, and the needed - * buffer size is returned. - */ - -ssize_t utf8proc_reencode(int32_t *buffer, ssize_t length, int options); -/* - * Reencodes the sequence of unicode characters given by the pointer - * 'buffer' and 'length' as UTF-8. - * The result is stored in the same memory area where the data is read. - * Following flags in the 'options' field are regarded: - * NLF2LS: converts LF, CRLF, CR and NEL into LS - * NLF2PS: converts LF, CRLF, CR and NEL into PS - * NLF2LF: converts LF, CRLF, CR and NEL into LF - * STRIPCC: strips or converts all non-affected control characters - * COMPOSE: tries to combine decomposed characters into composite - * characters - * STABLE: prohibits combining characters which would violate - * the unicode versioning stability - * In case of success the length of the resulting UTF-8 string is - * returned, otherwise a negative error code is returned. - * WARNING: The amount of free space being pointed to by 'buffer', has to - * exceed the amount of the input data by one byte, and the - * entries of the array pointed to by 'str' have to be in the - * range of 0x0000 to 0x10FFFF, otherwise the program might - * crash! - */ - -ssize_t utf8proc_map( - const uint8_t *str, ssize_t strlen, uint8_t **dstptr, int options -); -/* - * Maps the given UTF-8 string being pointed to by 'str' to a new UTF-8 - * string, which is allocated dynamically, and afterwards pointed to by - * the pointer being pointed to by 'dstptr'. - * If the NULLTERM flag in the 'options' field is set, the length is - * determined by a NULL terminator, otherwise the parameter 'strlen' is - * evaluated to determine the string length, but in any case the result - * will be NULL terminated (though it might contain NULL characters - * before). Other flags in the 'options' field are passed to the functions - * defined above, and regarded as described. - * In case of success the length of the new string is returned, - * otherwise a negative error code is returned. - * NOTICE: The memory of the new UTF-8 string will have been allocated with - * 'malloc', and has theirfore to be freed with 'free'. - */ - -uint8_t *utf8proc_NFD(const uint8_t *str); -uint8_t *utf8proc_NFC(const uint8_t *str); -uint8_t *utf8proc_NFKD(const uint8_t *str); -uint8_t *utf8proc_NFKC(const uint8_t *str); -/* - * Returns a pointer to newly allocated memory of a NFD, NFC, NFKD or NFKC - * normalized version of the null-terminated string 'str'. - */ - -ssize_t utf8proc_check(const uint8_t *str); -/* - * Just checks UTF-8 string for validity, returns 0 if valid or one of - * the negative UTF8PROC_ERROR_* codes if invalid or memory exhausted - * checking. Assumes null-terminated string str and UTF8PROC_STABLE - * option. - */ - -#endif - diff --git a/xios_2311_src/trunk/.svn/pristine/59/59223bb555037b31161dadbc2deedb89e48a883a.svn-base b/xios_2311_src/trunk/.svn/pristine/59/59223bb555037b31161dadbc2deedb89e48a883a.svn-base deleted file mode 100644 index b8f0e675b301c4dc08d8a3d16cffc5885d2fdf68..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/59/59223bb555037b31161dadbc2deedb89e48a883a.svn-base +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef __XIOS_CInverseAxis__ -#define __XIOS_CInverseAxis__ - -/// xios headers /// -#include "xios_spl.hpp" -#include "attribute_enum.hpp" -#include "attribute_enum_impl.hpp" -#include "attribute_array.hpp" -#include "declare_attribute.hpp" -#include "object_template.hpp" -#include "group_factory.hpp" -#include "declare_group.hpp" -#include "transformation.hpp" - -namespace xios { - /// ////////////////////// Déclarations ////////////////////// /// - class CInverseAxisGroup; - class CInverseAxisAttributes; - class CInverseAxis; - class CAxis; - class CGenericAlgorithmTransformation ; - class CGrid; - ///-------------------------------------------------------------- - - // Declare/Define CFileAttribute - BEGIN_DECLARE_ATTRIBUTE_MAP(CInverseAxis) -#include "inverse_axis_attribute.conf" - END_DECLARE_ATTRIBUTE_MAP(CInverseAxis) - - ///-------------------------------------------------------------- - /*! - \class CInverseAxis - This class describes inverse_axis in xml file. - */ - class CInverseAxis - : public CObjectTemplate - , public CInverseAxisAttributes - , public CTransformation - { - public : - typedef CObjectTemplate SuperClass; - typedef CInverseAxisAttributes SuperClassAttribute; - typedef CInverseAxis MyClass ; - typedef CTransformation SuperTransform ; - - public : - /// Constructeurs /// - CInverseAxis(void); - explicit CInverseAxis(const StdString& id); - - /// Destructeur /// - virtual ~CInverseAxis(void); - - virtual void checkValid(CAxis* axisDest); - - /// Accesseurs statiques /// - static StdString GetName(void); - static StdString GetDefName(void); - static ENodeType GetType(void); - const string& getId(void) { return this->SuperClass::getId();} - ETranformationType getTransformationType(void) { return TRANS_INVERSE_AXIS ;} - static CTransformation* getTransformation(const StdString& id) { return SuperClass::get(id);} - virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} - virtual shared_ptr createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) ; - private: - static bool registerTrans(); - static CTransformation* create(const StdString& id, xml::CXMLNode* node); - static bool _dummyRegistered; - - }; // class CInverseAxis - - DECLARE_GROUP(CInverseAxis); -} // namespace xios - -#endif // __XIOS_CInverseAxis__ diff --git a/xios_2311_src/trunk/.svn/pristine/59/5933f7815ce00274c09d383c0f28852015a71592.svn-base b/xios_2311_src/trunk/.svn/pristine/59/5933f7815ce00274c09d383c0f28852015a71592.svn-base deleted file mode 100644 index c43d610ab2eec02c3d8a96b56e4642f927314964..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/59/5933f7815ce00274c09d383c0f28852015a71592.svn-base +++ /dev/null @@ -1,229 +0,0 @@ -#include "xios_fortran_prefix.hpp" -MODULE ICALENDAR - USE, INTRINSIC :: ISO_C_BINDING - USE CALENDAR_INTERFACE - USE ICALENDAR_WRAPPER - USE IDATE - USE IDURATION - - ! enum XCalendarType - INTEGER(kind = C_INT), PARAMETER :: D360 = 0 , ALLLEAP = 1 , NOLEAP = 2 , JULIAN = 3 , GREGORIAN = 4 - - INTERFACE xios(set_start_date) - MODULE PROCEDURE xios(set_start_date_date), xios(set_start_date_dur) - END INTERFACE xios(set_start_date) - - INTERFACE xios(set_time_origin) - MODULE PROCEDURE xios(set_time_origin_date), xios(set_time_origin_dur) - END INTERFACE xios(set_time_origin) - - CONTAINS ! Fonctions disponibles pour les utilisateurs. - - SUBROUTINE xios(define_calendar)(type, timestep, start_date, time_origin, & - day_length, month_lengths, year_length, & - leap_year_month, leap_year_drift, leap_year_drift_offset) - USE ICALENDAR_WRAPPER, ONLY : txios(calendar_wrapper), xios(get_default_calendar_wrapper_handle) - USE icalendar_wrapper_attr, ONLY : xios(set_calendar_wrapper_attr_hdl) - USE IDURATION, ONLY : txios(duration) - USE IDATE, ONLY : txios(date) - IMPLICIT NONE - CHARACTER(len = *), INTENT(IN) :: type - TYPE(txios(duration)), OPTIONAL, INTENT(IN) :: timestep - TYPE(txios(date)), OPTIONAL, INTENT(IN) :: start_date - TYPE(txios(date)), OPTIONAL, INTENT(IN) :: time_origin - INTEGER, OPTIONAL, INTENT(IN) :: day_length - INTEGER, OPTIONAL, INTENT(IN) :: month_lengths(:) - INTEGER, OPTIONAL, INTENT(IN) :: year_length - REAL (KIND=8), OPTIONAL, INTENT(IN) :: leap_year_drift - REAL (KIND=8), OPTIONAL, INTENT(IN) :: leap_year_drift_offset - INTEGER, OPTIONAL, INTENT(IN) :: leap_year_month - TYPE(txios(calendar_wrapper)) :: calendar_wrapper - - CALL xios(get_default_calendar_wrapper_handle)(calendar_wrapper) - - CALL xios(set_calendar_wrapper_attr_hdl)(calendar_wrapper, type=type) - IF (PRESENT(timestep)) THEN - CALL xios(set_calendar_wrapper_attr_hdl)(calendar_wrapper, timestep=timestep) - END IF - IF (PRESENT(day_length)) THEN - CALL xios(set_calendar_wrapper_attr_hdl)(calendar_wrapper, day_length=day_length) - END IF - IF (PRESENT(month_lengths)) THEN - CALL xios(set_calendar_wrapper_attr_hdl)(calendar_wrapper, month_lengths=month_lengths) - END IF - IF (PRESENT(year_length)) THEN - CALL xios(set_calendar_wrapper_attr_hdl)(calendar_wrapper, year_length=year_length) - END IF - IF (PRESENT(leap_year_month)) THEN - CALL xios(set_calendar_wrapper_attr_hdl)(calendar_wrapper, leap_year_month=leap_year_month) - END IF - IF (PRESENT(leap_year_drift)) THEN - CALL xios(set_calendar_wrapper_attr_hdl)(calendar_wrapper, leap_year_drift=leap_year_drift) - END IF - IF (PRESENT(leap_year_drift_offset)) THEN - CALL xios(set_calendar_wrapper_attr_hdl)(calendar_wrapper, leap_year_drift_offset=leap_year_drift_offset) - END IF - - CALL xios(create_calendar)(calendar_wrapper) - - IF (PRESENT(start_date)) THEN - CALL xios(set_start_date_hdl)(calendar_wrapper, start_date=start_date) - END IF - IF (PRESENT(time_origin)) THEN - CALL xios(set_time_origin_hdl)(calendar_wrapper, time_origin=time_origin) - END IF - END SUBROUTINE xios(define_calendar) - - SUBROUTINE xios(get_calendar_type)(calendar_type) - USE ICALENDAR_WRAPPER, ONLY : txios(calendar_wrapper), xios(get_default_calendar_wrapper_handle) - USE icalendar_wrapper_attr, ONLY : xios(get_calendar_wrapper_attr_hdl) - IMPLICIT NONE - CHARACTER(len = *), INTENT(OUT) :: calendar_type - TYPE(txios(calendar_wrapper)) :: calendar_wrapper - - CALL xios(get_default_calendar_wrapper_handle)(calendar_wrapper) - - CALL xios(get_calendar_wrapper_attr_hdl)(calendar_wrapper, type=calendar_type) - END SUBROUTINE xios(get_calendar_type) - - SUBROUTINE xios(set_timestep)(timestep) - USE ICALENDAR_WRAPPER, ONLY : txios(calendar_wrapper), xios(get_default_calendar_wrapper_handle) - USE icalendar_wrapper_attr, ONLY : xios(set_calendar_wrapper_attr_hdl) - USE IDURATION, ONLY : txios(duration) - IMPLICIT NONE - TYPE(txios(duration)), INTENT(IN) :: timestep - TYPE(txios(calendar_wrapper)) :: calendar_wrapper - - CALL xios(get_default_calendar_wrapper_handle)(calendar_wrapper) - - CALL xios(set_calendar_wrapper_attr_hdl)(calendar_wrapper, timestep=timestep) - - CALL xios(update_calendar_timestep)(calendar_wrapper) - END SUBROUTINE xios(set_timestep) - - SUBROUTINE xios(get_timestep)(timestep) - USE ICALENDAR_WRAPPER, ONLY : txios(calendar_wrapper), xios(get_default_calendar_wrapper_handle) - USE icalendar_wrapper_attr, ONLY : xios(get_calendar_wrapper_attr_hdl) - USE IDURATION, ONLY : txios(duration) - IMPLICIT NONE - TYPE(txios(duration)), INTENT(OUT) :: timestep - TYPE(txios(calendar_wrapper)) :: calendar_wrapper - - CALL xios(get_default_calendar_wrapper_handle)(calendar_wrapper) - - CALL xios(get_calendar_wrapper_attr_hdl)(calendar_wrapper, timestep=timestep) - END SUBROUTINE xios(get_timestep) - - SUBROUTINE xios(set_start_date_date)(start_date) - USE ICALENDAR_WRAPPER, ONLY : txios(calendar_wrapper), xios(get_default_calendar_wrapper_handle) - USE IDATE, ONLY : txios(date) - IMPLICIT NONE - TYPE(txios(date)), INTENT(IN) :: start_date - TYPE(txios(calendar_wrapper)) :: calendar_wrapper - - CALL xios(get_default_calendar_wrapper_handle)(calendar_wrapper) - - CALL xios(set_start_date_hdl)(calendar_wrapper, start_date) - END SUBROUTINE xios(set_start_date_date) - - SUBROUTINE xios(set_start_date_dur)(start_date) - USE ICALENDAR_WRAPPER, ONLY : txios(calendar_wrapper), xios(get_default_calendar_wrapper_handle) - USE IDURATION, ONLY : txios(duration) - USE IDATE, ONLY : txios(date) - IMPLICIT NONE - TYPE(txios(duration)), INTENT(IN) :: start_date - TYPE(txios(calendar_wrapper)) :: calendar_wrapper - TYPE(txios(date)) :: start_date_date - - CALL xios(get_default_calendar_wrapper_handle)(calendar_wrapper) - - start_date_date = start_date - CALL xios(set_start_date_hdl)(calendar_wrapper, start_date_date) - END SUBROUTINE xios(set_start_date_dur) - - SUBROUTINE xios(get_start_date)(start_date) - USE ICALENDAR_WRAPPER, ONLY : txios(calendar_wrapper), xios(get_default_calendar_wrapper_handle) - USE IDATE, ONLY : txios(date) - IMPLICIT NONE - TYPE(txios(date)), INTENT(OUT) :: start_date - TYPE(txios(calendar_wrapper)) :: calendar_wrapper - - CALL xios(get_default_calendar_wrapper_handle)(calendar_wrapper) - - CALL xios(get_start_date_hdl)(calendar_wrapper, start_date) - END SUBROUTINE xios(get_start_date) - - SUBROUTINE xios(set_time_origin_date)(time_origin) - USE ICALENDAR_WRAPPER, ONLY : txios(calendar_wrapper), xios(get_default_calendar_wrapper_handle) - USE IDATE, ONLY : txios(date) - IMPLICIT NONE - TYPE(txios(date)), INTENT(IN) :: time_origin - TYPE(txios(calendar_wrapper)) :: calendar_wrapper - - CALL xios(get_default_calendar_wrapper_handle)(calendar_wrapper) - - CALL xios(set_time_origin_hdl)(calendar_wrapper, time_origin) - END SUBROUTINE xios(set_time_origin_date) - - SUBROUTINE xios(set_time_origin_dur)(time_origin) - USE ICALENDAR_WRAPPER, ONLY : txios(calendar_wrapper), xios(get_default_calendar_wrapper_handle) - USE IDURATION, ONLY : txios(duration) - USE IDATE, ONLY : txios(date) - IMPLICIT NONE - TYPE(txios(duration)), INTENT(IN) :: time_origin - TYPE(txios(calendar_wrapper)) :: calendar_wrapper - TYPE(txios(date)) :: time_origin_date - - CALL xios(get_default_calendar_wrapper_handle)(calendar_wrapper) - - time_origin_date = time_origin - CALL xios(set_time_origin_hdl)(calendar_wrapper, time_origin_date) - END SUBROUTINE xios(set_time_origin_dur) - - SUBROUTINE xios(get_time_origin)(time_origin) - USE ICALENDAR_WRAPPER, ONLY : txios(calendar_wrapper), xios(get_default_calendar_wrapper_handle) - USE IDATE, ONLY : txios(date) - IMPLICIT NONE - TYPE(txios(date)), INTENT(OUT) :: time_origin - TYPE(txios(calendar_wrapper)) :: calendar_wrapper - - CALL xios(get_default_calendar_wrapper_handle)(calendar_wrapper) - - CALL xios(get_time_origin_hdl)(calendar_wrapper, time_origin) - END SUBROUTINE xios(get_time_origin) - - SUBROUTINE xios(update_calendar)(step) - IMPLICIT NONE - INTEGER, INTENT(IN) :: step - - IF (step < 0) THEN - PRINT *, "L'argument 'step' ne peut être négatif" - STOP - END IF - CALL cxios_update_calendar(step) - END SUBROUTINE xios(update_calendar) - - SUBROUTINE xios(get_current_date)(current_date) - USE IDATE, ONLY : txios(date) - IMPLICIT NONE - TYPE(txios(date)), INTENT(OUT) :: current_date - - CALL cxios_get_current_date(current_date) - END SUBROUTINE xios(get_current_date) - - FUNCTION xios(get_year_length_in_seconds)(year) RESULT(res) - IMPLICIT NONE - INTEGER(kind = C_INT), INTENT(IN) :: year - INTEGER(kind = C_INT) :: res - - res = cxios_get_year_length_in_seconds(year) - END FUNCTION xios(get_year_length_in_seconds) - - FUNCTION xios(get_day_length_in_seconds)() RESULT(res) - IMPLICIT NONE - INTEGER(kind = C_INT) :: res - - res = cxios_get_day_length_in_seconds() - END FUNCTION xios(get_day_length_in_seconds) - -END MODULE ICALENDAR diff --git a/xios_2311_src/trunk/.svn/pristine/59/59e60120d54912f3ce08c334fa103786d40c6fc1.svn-base b/xios_2311_src/trunk/.svn/pristine/59/59e60120d54912f3ce08c334fa103786d40c6fc1.svn-base deleted file mode 100644 index 8ccfb0f28392db6d14c600bbc0a4821c04fcb10c..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/59/59e60120d54912f3ce08c334fa103786d40c6fc1.svn-base +++ /dev/null @@ -1,1883 +0,0 @@ -/*! \file - -Main header file for the C API. - -Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 University -Corporation for Atmospheric Research/Unidata. See \ref copyright file -for more info. -*/ - -#ifndef _NETCDF_ -#define _NETCDF_ - -#include /* size_t, ptrdiff_t */ -#include /* netcdf functions sometimes return system errors */ - -/*! The nc_type type is just an int. */ -typedef int nc_type; - -#if defined(__cplusplus) -extern "C" { -#endif - -/* - * The netcdf external data types - */ -#define NC_NAT 0 /**< Not A Type */ -#define NC_BYTE 1 /**< signed 1 byte integer */ -#define NC_CHAR 2 /**< ISO/ASCII character */ -#define NC_SHORT 3 /**< signed 2 byte integer */ -#define NC_INT 4 /**< signed 4 byte integer */ -#define NC_LONG NC_INT /**< deprecated, but required for backward compatibility. */ -#define NC_FLOAT 5 /**< single precision floating point number */ -#define NC_DOUBLE 6 /**< double precision floating point number */ -#define NC_UBYTE 7 /**< unsigned 1 byte int */ -#define NC_USHORT 8 /**< unsigned 2-byte int */ -#define NC_UINT 9 /**< unsigned 4-byte int */ -#define NC_INT64 10 /**< signed 8-byte int */ -#define NC_UINT64 11 /**< unsigned 8-byte int */ -#define NC_STRING 12 /**< string */ - -#define NC_MAX_ATOMIC_TYPE NC_STRING - -/* The following are use internally in support of user-defines - * types. They are also the class returned by nc_inq_user_type. */ -#define NC_VLEN 13 /**< vlen types */ -#define NC_OPAQUE 14 /**< opaque types */ -#define NC_ENUM 15 /**< enum types */ -#define NC_COMPOUND 16 /**< compound types */ - -/* Define the first user defined type id (leave some room) */ -#define NC_FIRSTUSERTYPEID 32 - -/** Default fill value. This is used unless _FillValue attribute - * is set. These values are stuffed into newly allocated space as - * appropriate. The hope is that one might use these to notice that a - * particular datum has not been set. */ -/**@{*/ -#define NC_FILL_BYTE ((signed char)-127) -#define NC_FILL_CHAR ((char)0) -#define NC_FILL_SHORT ((short)-32767) -#define NC_FILL_INT (-2147483647L) -#define NC_FILL_FLOAT (9.9692099683868690e+36f) /* near 15 * 2^119 */ -#define NC_FILL_DOUBLE (9.9692099683868690e+36) -#define NC_FILL_UBYTE (255) -#define NC_FILL_USHORT (65535) -#define NC_FILL_UINT (4294967295U) -#define NC_FILL_INT64 ((long long)-9223372036854775806LL) -#define NC_FILL_UINT64 ((unsigned long long)18446744073709551614ULL) -#define NC_FILL_STRING "" -/**@}*/ - -/*! Max or min values for a type. Nothing greater/smaller can be - * stored in a netCDF file for their associated types. Recall that a C - * compiler may define int to be any length it wants, but a NC_INT is - * *always* a 4 byte signed int. On a platform with 64 bit ints, - * there will be many ints which are outside the range supported by - * NC_INT. But since NC_INT is an external format, it has to mean the - * same thing everywhere. */ -/**@{*/ -#define NC_MAX_BYTE 127 -#define NC_MIN_BYTE (-NC_MAX_BYTE-1) -#define NC_MAX_CHAR 255 -#define NC_MAX_SHORT 32767 -#define NC_MIN_SHORT (-NC_MAX_SHORT - 1) -#define NC_MAX_INT 2147483647 -#define NC_MIN_INT (-NC_MAX_INT - 1) -#define NC_MAX_FLOAT 3.402823466e+38f -#define NC_MIN_FLOAT (-NC_MAX_FLOAT) -#define NC_MAX_DOUBLE 1.7976931348623157e+308 -#define NC_MIN_DOUBLE (-NC_MAX_DOUBLE) -#define NC_MAX_UBYTE NC_MAX_CHAR -#define NC_MAX_USHORT 65535U -#define NC_MAX_UINT 4294967295U -#define NC_MAX_INT64 (9223372036854775807LL) -#define NC_MIN_INT64 (-9223372036854775807LL-1) -#define NC_MAX_UINT64 (18446744073709551615ULL) -#define X_INT64_MAX (9223372036854775807LL) -#define X_INT64_MIN (-X_INT64_MAX - 1) -#define X_UINT64_MAX (18446744073709551615ULL) -/**@}*/ - -/** Name of fill value attribute. If you wish a variable to use a - * different value than the above defaults, create an attribute with - * the same type as the variable and this reserved name. The value you - * give the attribute will be used as the fill value for that - * variable. */ -#define _FillValue "_FillValue" -#define NC_FILL 0 /**< Argument to nc_set_fill() to clear NC_NOFILL */ -#define NC_NOFILL 0x100 /**< Argument to nc_set_fill() to turn off filling of data. */ - -/* Define the ioflags bits for nc_create and nc_open. - currently unused: 0x0010,0x0020,0x0040,0x0080 - and the whole upper 16 bits -*/ - -#define NC_NOWRITE 0x0000 /**< Set read-only access for nc_open(). */ -#define NC_WRITE 0x0001 /**< Set read-write access for nc_open(). */ -/* unused: 0x0002 */ -#define NC_CLOBBER 0x0000 /**< Destroy existing file. Mode flag for nc_create(). */ -#define NC_NOCLOBBER 0x0004 /**< Don't destroy existing file. Mode flag for nc_create(). */ - -#define NC_DISKLESS 0x0008 /**< Use diskless file. Mode flag for nc_open() or nc_create(). */ -#define NC_MMAP 0x0010 /**< Use diskless file with mmap. Mode flag for nc_open() or nc_create(). */ - -#define NC_CLASSIC_MODEL 0x0100 /**< Enforce classic model. Mode flag for nc_create(). */ -#define NC_64BIT_OFFSET 0x0200 /**< Use large (64-bit) file offsets. Mode flag for nc_create(). */ - -/** \deprecated The following flag currently is ignored, but use in - * nc_open() or nc_create() may someday support use of advisory - * locking to prevent multiple writers from clobbering a file - */ -#define NC_LOCK 0x0400 - -/** Share updates, limit cacheing. -Use this in mode flags for both nc_create() and nc_open(). */ -#define NC_SHARE 0x0800 - -#define NC_NETCDF4 0x1000 /**< Use netCDF-4/HDF5 format. Mode flag for nc_create(). */ - -/** Turn on MPI I/O. -Use this in mode flags for both nc_create() and nc_open(). */ -#define NC_MPIIO 0x2000 -/** Turn on MPI POSIX I/O. -Use this in mode flags for both nc_create() and nc_open(). */ -#define NC_MPIPOSIX 0x4000 -#define NC_PNETCDF 0x8000 /**< Use parallel-netcdf library. Mode flag for nc_open(). */ - -/** Format specifier for nc_set_default_format(). Starting with - * version 3.6, there are different format netCDF files. 4.0 - * introduces the third one. \see netcdf_format - */ -/**@{*/ -#define NC_FORMAT_CLASSIC (1) -#define NC_FORMAT_64BIT (2) -#define NC_FORMAT_NETCDF4 (3) -#define NC_FORMAT_NETCDF4_CLASSIC (4) -/**@}*/ - -/** Let nc__create() or nc__open() figure out as suitable chunk - * size. */ -#define NC_SIZEHINT_DEFAULT 0 - -/** In nc__enddef(), align to the chunk size. */ -#define NC_ALIGN_CHUNK ((size_t)(-1)) - -/** Size argument to nc_def_dim() for an unlimited dimension. */ -#define NC_UNLIMITED 0L - -/** Attribute id to put/get a global attribute. */ -#define NC_GLOBAL -1 - -/** -Maximum for classic library. - -In the classic netCDF model there are maximum values for the number of -dimensions in the file (\ref NC_MAX_DIMS), the number of global or per -variable attributes (\ref NC_MAX_ATTRS), the number of variables in -the file (\ref NC_MAX_VARS), and the length of a name (\ref -NC_MAX_NAME). - -This maximum is enforced by the interface, to facilitate writing -applications and utilities. However, nothing is statically allocated -to this size internally. - -This maximum is not used for netCDF-4/HDF5 files unless they were -created with the ::NC_CLASSIC_MODEL flag. - -As a rule, NC_MAX_VAR_DIMS <= NC_MAX_DIMS. -*/ -/**@{*/ -#define NC_MAX_DIMS 1024 -#define NC_MAX_ATTRS 8192 -#define NC_MAX_VARS 8192 -#define NC_MAX_NAME 256 -#define NC_MAX_VAR_DIMS 1024 /**< max per variable dimensions */ -/**@}*/ - -/** This is the max size of an SD dataset name in HDF4 (from HDF4 documentation).*/ -#define NC_MAX_HDF4_NAME 64 - -/** In HDF5 files you can set the endianness of variables with - nc_def_var_endian(). This define is used there. */ -/**@{*/ -#define NC_ENDIAN_NATIVE 0 -#define NC_ENDIAN_LITTLE 1 -#define NC_ENDIAN_BIG 2 -/**@}*/ - -/** In HDF5 files you can set storage for each variable to be either - * contiguous or chunked, with nc_def_var_chunking(). This define is - * used there. */ -/**@{*/ -#define NC_CHUNKED 0 -#define NC_CONTIGUOUS 1 -/**@}*/ - -/** In HDF5 files you can set check-summing for each variable. -Currently the only checksum available is Fletcher-32, which can be set -with the function nc_def_var_fletcher32. These defines are used -there. */ -/**@{*/ -#define NC_NOCHECKSUM 0 -#define NC_FLETCHER32 1 -/**@}*/ - -/**@{*/ -/** Control the HDF5 shuffle filter. In HDF5 files you can specify - * that a shuffle filter should be used on each chunk of a variable to - * improve compression for that variable. This per-variable shuffle - * property can be set with the function nc_def_var_deflate(). */ -#define NC_NOSHUFFLE 0 -#define NC_SHUFFLE 1 -/**@}*/ - -/** The netcdf version 3 functions all return integer error status. - * These are the possible values, in addition to certain values from - * the system errno.h. - */ -#define NC_ISSYSERR(err) ((err) > 0) - -#define NC_NOERR 0 /**< No Error */ -#define NC2_ERR (-1) /**< Returned for all errors in the v2 API. */ - -/** Not a netcdf id. - -The specified netCDF ID does not refer to an -open netCDF dataset. */ -#define NC_EBADID (-33) -#define NC_ENFILE (-34) /**< Too many netcdfs open */ -#define NC_EEXIST (-35) /**< netcdf file exists && NC_NOCLOBBER */ -#define NC_EINVAL (-36) /**< Invalid Argument */ -#define NC_EPERM (-37) /**< Write to read only */ - -/** Operation not allowed in data mode. This is returned for netCDF -classic or 64-bit offset files, or for netCDF-4 files, when they were -been created with ::NC_CLASSIC_MODEL flag in nc_create(). */ -#define NC_ENOTINDEFINE (-38) - -/** Operation not allowed in define mode. - -The specified netCDF is in define mode rather than data mode. - -With netCDF-4/HDF5 files, this error will not occur, unless -::NC_CLASSIC_MODEL was used in nc_create(). - */ -#define NC_EINDEFINE (-39) - -/** Index exceeds dimension bound. - -The specified corner indices were out of range for the rank of the -specified variable. For example, a negative index or an index that is -larger than the corresponding dimension length will cause an error. */ -#define NC_EINVALCOORDS (-40) -#define NC_EMAXDIMS (-41) /**< NC_MAX_DIMS exceeded */ -#define NC_ENAMEINUSE (-42) /**< String match to name in use */ -#define NC_ENOTATT (-43) /**< Attribute not found */ -#define NC_EMAXATTS (-44) /**< NC_MAX_ATTRS exceeded */ -#define NC_EBADTYPE (-45) /**< Not a netcdf data type */ -#define NC_EBADDIM (-46) /**< Invalid dimension id or name */ -#define NC_EUNLIMPOS (-47) /**< NC_UNLIMITED in the wrong index */ - -/** NC_MAX_VARS exceeded. Max number of variables exceeded in a -classic or 64-bit offset file, or an netCDF-4 file with -::NC_CLASSIC_MODEL on. */ -#define NC_EMAXVARS (-48) - -/** Variable not found. - -The variable ID is invalid for the specified netCDF dataset. */ -#define NC_ENOTVAR (-49) -#define NC_EGLOBAL (-50) /**< Action prohibited on NC_GLOBAL varid */ -#define NC_ENOTNC (-51) /**< Not a netcdf file */ -#define NC_ESTS (-52) /**< In Fortran, string too short */ -#define NC_EMAXNAME (-53) /**< NC_MAX_NAME exceeded */ -#define NC_EUNLIMIT (-54) /**< NC_UNLIMITED size already in use */ -#define NC_ENORECVARS (-55) /**< nc_rec op when there are no record vars */ -#define NC_ECHAR (-56) /**< Attempt to convert between text & numbers */ - -/** Start+count exceeds dimension bound. - -The specified edge lengths added to the specified corner would have -referenced data out of range for the rank of the specified -variable. For example, an edge length that is larger than the -corresponding dimension length minus the corner index will cause an -error. */ -#define NC_EEDGE (-57) -#define NC_ESTRIDE (-58) /**< Illegal stride */ -#define NC_EBADNAME (-59) /**< Attribute or variable name contains illegal characters */ -/* N.B. following must match value in ncx.h */ - -/** Math result not representable. - -One or more of the values are out of the range of values representable -by the desired type. */ -#define NC_ERANGE (-60) -#define NC_ENOMEM (-61) /**< Memory allocation (malloc) failure */ -#define NC_EVARSIZE (-62) /**< One or more variable sizes violate format constraints */ -#define NC_EDIMSIZE (-63) /**< Invalid dimension size */ -#define NC_ETRUNC (-64) /**< File likely truncated or possibly corrupted */ -#define NC_EAXISTYPE (-65) /**< Unknown axis type. */ - -/* Following errors are added for DAP */ -#define NC_EDAP (-66) /**< Generic DAP error */ -#define NC_ECURL (-67) /**< Generic libcurl error */ -#define NC_EIO (-68) /**< Generic IO error */ -#define NC_ENODATA (-69) /**< Attempt to access variable with no data */ -#define NC_EDAPSVC (-70) /**< DAP server error */ -#define NC_EDAS (-71) /**< Malformed or inaccessible DAS */ -#define NC_EDDS (-72) /**< Malformed or inaccessible DDS */ -#define NC_EDATADDS (-73) /**< Malformed or inaccessible DATADDS */ -#define NC_EDAPURL (-74) /**< Malformed DAP URL */ -#define NC_EDAPCONSTRAINT (-75) /**< Malformed DAP Constraint*/ -#define NC_ETRANSLATION (-76) /**< Untranslatable construct */ - -/* The following was added in support of netcdf-4. Make all netcdf-4 - error codes < -100 so that errors can be added to netcdf-3 if - needed. */ -#define NC4_FIRST_ERROR (-100) - -/** Error at HDF5 layer. */ -#define NC_EHDFERR (-101) -#define NC_ECANTREAD (-102) /**< Can't read. */ -#define NC_ECANTWRITE (-103) /**< Can't write. */ -#define NC_ECANTCREATE (-104) /**< Can't create. */ -#define NC_EFILEMETA (-105) /**< Problem with file metadata. */ -#define NC_EDIMMETA (-106) /**< Problem with dimension metadata. */ -#define NC_EATTMETA (-107) /**< Problem with attribute metadata. */ -#define NC_EVARMETA (-108) /**< Problem with variable metadata. */ -#define NC_ENOCOMPOUND (-109) /**< Not a compound type. */ -#define NC_EATTEXISTS (-110) /**< Attribute already exists. */ -#define NC_ENOTNC4 (-111) /**< Attempting netcdf-4 operation on netcdf-3 file. */ - -/** Attempting netcdf-4 operation on strict nc3 netcdf-4 file. */ -#define NC_ESTRICTNC3 (-112) -#define NC_ENOTNC3 (-113) /**< Attempting netcdf-3 operation on netcdf-4 file. */ -#define NC_ENOPAR (-114) /**< Parallel operation on file opened for non-parallel access. */ -#define NC_EPARINIT (-115) /**< Error initializing for parallel access. */ -#define NC_EBADGRPID (-116) /**< Bad group ID. */ -#define NC_EBADTYPID (-117) /**< Bad type ID. */ -#define NC_ETYPDEFINED (-118) /**< Type has already been defined and may not be edited. */ -#define NC_EBADFIELD (-119) /**< Bad field ID. */ -#define NC_EBADCLASS (-120) /**< Bad class. */ -#define NC_EMAPTYPE (-121) /**< Mapped access for atomic types only. */ -#define NC_ELATEFILL (-122) /**< Attempt to define fill value when data already exists. */ -#define NC_ELATEDEF (-123) /**< Attempt to define var properties, like deflate, after enddef. */ -#define NC_EDIMSCALE (-124) /**< Probem with HDF5 dimscales. */ -#define NC_ENOGRP (-125) /**< No group found. */ -#define NC_ESTORAGE (-126) /**< Can't specify both contiguous and chunking. */ -#define NC_EBADCHUNK (-127) /**< Bad chunksize. */ -#define NC_ENOTBUILT (-128) /**< Attempt to use feature that was not turned on when netCDF was built. */ -#define NC_EDISKLESS (-129) /**< Error in using diskless access. */ - -#define NC4_LAST_ERROR (-129) - -/* This is used in netCDF-4 files for dimensions without coordinate - * vars. */ -#define DIM_WITHOUT_VARIABLE "This is a netCDF dimension but not a netCDF variable." - -/* This is here at the request of the NCO team to support our - * mistake of having chunksizes be first ints, then size_t. Doh! */ -#define NC_HAVE_NEW_CHUNKING_API 1 - - -/*Errors for all remote access methods(e.g. DAP and CDMREMOTE)*/ -#define NC_EURL (NC_EDAPURL) /* Malformed URL */ -#define NC_ECONSTRAINT (NC_EDAPCONSTRAINT) /* Malformed Constraint*/ - - -/* - * The Interface - */ - -/* Declaration modifiers for DLL support (MSC et al) */ - -#if defined(DLL_NETCDF) /* define when library is a DLL */ -# if defined(DLL_EXPORT) /* define when building the library */ -# define MSC_EXTRA __declspec(dllexport) -# else -# define MSC_EXTRA __declspec(dllimport) -# endif -#include -/*#define lseek _lseeki64 - #define off_t __int64*/ -#else -#define MSC_EXTRA -#endif /* defined(DLL_NETCDF) */ - -# define EXTERNL MSC_EXTRA extern - -#if defined(DLL_NETCDF) /* define when library is a DLL */ -EXTERNL int ncerr; -EXTERNL int ncopts; -#endif - -EXTERNL const char * -nc_inq_libvers(void); - -EXTERNL const char * -nc_strerror(int ncerr); - -EXTERNL int -nc__create(const char *path, int cmode, size_t initialsz, - size_t *chunksizehintp, int *ncidp); - -EXTERNL int -nc_create(const char *path, int cmode, int *ncidp); - -EXTERNL int -nc__open(const char *path, int mode, - size_t *chunksizehintp, int *ncidp); - -EXTERNL int -nc_open(const char *path, int mode, int *ncidp); - -/* Learn the path used to open/create the file. */ -EXTERNL int -nc_inq_path(int ncid, size_t *pathlen, char *path); - -/* Use these with nc_var_par_access(). */ -#define NC_INDEPENDENT 0 -#define NC_COLLECTIVE 1 - -/* Set parallel access for a variable to independent (the default) or - * collective. */ -EXTERNL int -nc_var_par_access(int ncid, int varid, int par_access); - -/* Given an ncid and group name (NULL gets root group), return - * locid. */ -EXTERNL int -nc_inq_ncid(int ncid, const char *name, int *grp_ncid); - -/* Given a location id, return the number of groups it contains, and - * an array of their locids. */ -EXTERNL int -nc_inq_grps(int ncid, int *numgrps, int *ncids); - -/* Given locid, find name of group. (Root group is named "/".) */ -EXTERNL int -nc_inq_grpname(int ncid, char *name); - -/* Given ncid, find full name and len of full name. (Root group is - * named "/", with length 1.) */ -EXTERNL int -nc_inq_grpname_full(int ncid, size_t *lenp, char *full_name); - -/* Given ncid, find len of full name. */ -EXTERNL int -nc_inq_grpname_len(int ncid, size_t *lenp); - -/* Given an ncid, find the ncid of its parent group. */ -EXTERNL int -nc_inq_grp_parent(int ncid, int *parent_ncid); - -/* Given a name and parent ncid, find group ncid. */ -EXTERNL int -nc_inq_grp_ncid(int ncid, const char *grp_name, int *grp_ncid); - -/* Given a full name and ncid, find group ncid. */ -EXTERNL int -nc_inq_grp_full_ncid(int ncid, const char *full_name, int *grp_ncid); - -/* Get a list of ids for all the variables in a group. */ -EXTERNL int -nc_inq_varids(int ncid, int *nvars, int *varids); - -/* Find all dimids for a location. This finds all dimensions in a - * group, or any of its parents. */ -EXTERNL int -nc_inq_dimids(int ncid, int *ndims, int *dimids, int include_parents); - -/* Find all user-defined types for a location. This finds all - * user-defined types in a group. */ -EXTERNL int -nc_inq_typeids(int ncid, int *ntypes, int *typeids); - -/* Are two types equal? */ -EXTERNL int -nc_inq_type_equal(int ncid1, nc_type typeid1, int ncid2, - nc_type typeid2, int *equal); - -/* Create a group. its ncid is returned in the new_ncid pointer. */ -EXTERNL int -nc_def_grp(int parent_ncid, const char *name, int *new_ncid); - -/* Here are functions for dealing with compound types. */ - -/* Create a compound type. */ -EXTERNL int -nc_def_compound(int ncid, size_t size, const char *name, nc_type *typeidp); - -/* Insert a named field into a compound type. */ -EXTERNL int -nc_insert_compound(int ncid, nc_type xtype, const char *name, - size_t offset, nc_type field_typeid); - -/* Insert a named array into a compound type. */ -EXTERNL int -nc_insert_array_compound(int ncid, nc_type xtype, const char *name, - size_t offset, nc_type field_typeid, - int ndims, const int *dim_sizes); - -/* Get the name and size of a type. */ -EXTERNL int -nc_inq_type(int ncid, nc_type xtype, char *name, size_t *size); - -/* Get the id of a type from the name. */ -EXTERNL int -nc_inq_typeid(int ncid, const char *name, nc_type *typeidp); - -/* Get the name, size, and number of fields in a compound type. */ -EXTERNL int -nc_inq_compound(int ncid, nc_type xtype, char *name, size_t *sizep, - size_t *nfieldsp); - -/* Get the name of a compound type. */ -EXTERNL int -nc_inq_compound_name(int ncid, nc_type xtype, char *name); - -/* Get the size of a compound type. */ -EXTERNL int -nc_inq_compound_size(int ncid, nc_type xtype, size_t *sizep); - -/* Get the number of fields in this compound type. */ -EXTERNL int -nc_inq_compound_nfields(int ncid, nc_type xtype, size_t *nfieldsp); - -/* Given the xtype and the fieldid, get all info about it. */ -EXTERNL int -nc_inq_compound_field(int ncid, nc_type xtype, int fieldid, char *name, - size_t *offsetp, nc_type *field_typeidp, int *ndimsp, - int *dim_sizesp); - -/* Given the typeid and the fieldid, get the name. */ -EXTERNL int -nc_inq_compound_fieldname(int ncid, nc_type xtype, int fieldid, - char *name); - -/* Given the xtype and the name, get the fieldid. */ -EXTERNL int -nc_inq_compound_fieldindex(int ncid, nc_type xtype, const char *name, - int *fieldidp); - -/* Given the xtype and fieldid, get the offset. */ -EXTERNL int -nc_inq_compound_fieldoffset(int ncid, nc_type xtype, int fieldid, - size_t *offsetp); - -/* Given the xtype and the fieldid, get the type of that field. */ -EXTERNL int -nc_inq_compound_fieldtype(int ncid, nc_type xtype, int fieldid, - nc_type *field_typeidp); - -/* Given the xtype and the fieldid, get the number of dimensions for - * that field (scalars are 0). */ -EXTERNL int -nc_inq_compound_fieldndims(int ncid, nc_type xtype, int fieldid, - int *ndimsp); - -/* Given the xtype and the fieldid, get the sizes of dimensions for - * that field. User must have allocated storage for the dim_sizes. */ -EXTERNL int -nc_inq_compound_fielddim_sizes(int ncid, nc_type xtype, int fieldid, - int *dim_sizes); - -/** This is the type of arrays of vlens. */ -typedef struct { - size_t len; /**< Length of VL data (in base type units) */ - void *p; /**< Pointer to VL data */ -} nc_vlen_t; - -/** Calculate an offset for creating a compound type. This calls a - * mysterious C macro which was found carved into one of the blocks of - * the Newgrange passage tomb in County Meath, Ireland. This code has - * been carbon dated to 3200 B.C.E. */ -#define NC_COMPOUND_OFFSET(S,M) (offsetof(S,M)) - -/* Create a variable length type. */ -EXTERNL int -nc_def_vlen(int ncid, const char *name, nc_type base_typeid, nc_type *xtypep); - -/* Find out about a vlen. */ -EXTERNL int -nc_inq_vlen(int ncid, nc_type xtype, char *name, size_t *datum_sizep, - nc_type *base_nc_typep); - -/* When you read VLEN type the library will actually allocate the - * storage space for the data. This storage space must be freed, so - * pass the pointer back to this function, when you're done with the - * data, and it will free the vlen memory. */ -EXTERNL int -nc_free_vlen(nc_vlen_t *vl); - -EXTERNL int -nc_free_vlens(size_t len, nc_vlen_t vlens[]); - -/* Put or get one element in a vlen array. */ -EXTERNL int -nc_put_vlen_element(int ncid, int typeid1, void *vlen_element, - size_t len, const void *data); - -EXTERNL int -nc_get_vlen_element(int ncid, int typeid1, const void *vlen_element, - size_t *len, void *data); - -/* When you read the string type the library will allocate the storage - * space for the data. This storage space must be freed, so pass the - * pointer back to this function, when you're done with the data, and - * it will free the string memory. */ -EXTERNL int -nc_free_string(size_t len, char **data); - -/* Find out about a user defined type. */ -EXTERNL int -nc_inq_user_type(int ncid, nc_type xtype, char *name, size_t *size, - nc_type *base_nc_typep, size_t *nfieldsp, int *classp); - -/* Write an attribute of any type. */ -EXTERNL int -nc_put_att(int ncid, int varid, const char *name, nc_type xtype, - size_t len, const void *op); - -/* Read an attribute of any type. */ -EXTERNL int -nc_get_att(int ncid, int varid, const char *name, void *ip); - -/* Enum type. */ - -/* Create an enum type. Provide a base type and a name. At the moment - * only ints are accepted as base types. */ -EXTERNL int -nc_def_enum(int ncid, nc_type base_typeid, const char *name, - nc_type *typeidp); - -/* Insert a named value into an enum type. The value must fit within - * the size of the enum type, the name size must be <= NC_MAX_NAME. */ -EXTERNL int -nc_insert_enum(int ncid, nc_type xtype, const char *name, - const void *value); - -/* Get information about an enum type: its name, base type and the - * number of members defined. */ -EXTERNL int -nc_inq_enum(int ncid, nc_type xtype, char *name, nc_type *base_nc_typep, - size_t *base_sizep, size_t *num_membersp); - -/* Get information about an enum member: a name and value. Name size - * will be <= NC_MAX_NAME. */ -EXTERNL int -nc_inq_enum_member(int ncid, nc_type xtype, int idx, char *name, - void *value); - - -/* Get enum name from enum value. Name size will be <= NC_MAX_NAME. */ -EXTERNL int -nc_inq_enum_ident(int ncid, nc_type xtype, long long value, char *identifier); - -/* Opaque type. */ - -/* Create an opaque type. Provide a size and a name. */ -EXTERNL int -nc_def_opaque(int ncid, size_t size, const char *name, nc_type *xtypep); - -/* Get information about an opaque type. */ -EXTERNL int -nc_inq_opaque(int ncid, nc_type xtype, char *name, size_t *sizep); - -/* Write entire var of any type. */ -EXTERNL int -nc_put_var(int ncid, int varid, const void *op); - -/* Read entire var of any type. */ -EXTERNL int -nc_get_var(int ncid, int varid, void *ip); - -/* Write one value. */ -EXTERNL int -nc_put_var1(int ncid, int varid, const size_t *indexp, - const void *op); - -/* Read one value. */ -EXTERNL int -nc_get_var1(int ncid, int varid, const size_t *indexp, void *ip); - -/* Write an array of values. */ -EXTERNL int -nc_put_vara(int ncid, int varid, const size_t *startp, - const size_t *countp, const void *op); - -/* Read an array of values. */ -EXTERNL int -nc_get_vara(int ncid, int varid, const size_t *startp, - const size_t *countp, void *ip); - -/* Write slices of an array of values. */ -EXTERNL int -nc_put_vars(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - const void *op); - -/* Read slices of an array of values. */ -EXTERNL int -nc_get_vars(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - void *ip); - -/* Write mapped slices of an array of values. */ -EXTERNL int -nc_put_varm(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - const ptrdiff_t *imapp, const void *op); - -/* Read mapped slices of an array of values. */ -EXTERNL int -nc_get_varm(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - const ptrdiff_t *imapp, void *ip); - -/* Extra netcdf-4 stuff. */ - -/* Set compression settings for a variable. Lower is faster, higher is - * better. Must be called after nc_def_var and before nc_enddef. */ -EXTERNL int -nc_def_var_deflate(int ncid, int varid, int shuffle, int deflate, - int deflate_level); - -/* Find out compression settings of a var. */ -EXTERNL int -nc_inq_var_deflate(int ncid, int varid, int *shufflep, - int *deflatep, int *deflate_levelp); - -/* Find out szip settings of a var. */ -EXTERNL int -nc_inq_var_szip(int ncid, int varid, int *options_maskp, int *pixels_per_blockp); - -/* Set fletcher32 checksum for a var. This must be done after nc_def_var - and before nc_enddef. */ -EXTERNL int -nc_def_var_fletcher32(int ncid, int varid, int fletcher32); - -/* Inquire about fletcher32 checksum for a var. */ -EXTERNL int -nc_inq_var_fletcher32(int ncid, int varid, int *fletcher32p); - -/* Define chunking for a variable. This must be done after nc_def_var - and before nc_enddef. */ -EXTERNL int -nc_def_var_chunking(int ncid, int varid, int storage, const size_t *chunksizesp); - -/* Inq chunking stuff for a var. */ -EXTERNL int -nc_inq_var_chunking(int ncid, int varid, int *storagep, size_t *chunksizesp); - -/* Define fill value behavior for a variable. This must be done after - nc_def_var and before nc_enddef. */ -EXTERNL int -nc_def_var_fill(int ncid, int varid, int no_fill, const void *fill_value); - -/* Inq fill value setting for a var. */ -EXTERNL int -nc_inq_var_fill(int ncid, int varid, int *no_fill, void *fill_valuep); - -/* Define the endianness of a variable. */ -EXTERNL int -nc_def_var_endian(int ncid, int varid, int endian); - -/* Learn about the endianness of a variable. */ -EXTERNL int -nc_inq_var_endian(int ncid, int varid, int *endianp); - -/* Set the fill mode (classic or 64-bit offset files only). */ -EXTERNL int -nc_set_fill(int ncid, int fillmode, int *old_modep); - -/* Set the default nc_create format to NC_FORMAT_CLASSIC, - * NC_FORMAT_64BIT, NC_FORMAT_NETCDF4, NC_FORMAT_NETCDF4_CLASSIC. */ -EXTERNL int -nc_set_default_format(int format, int *old_formatp); - -/* Set the cache size, nelems, and preemption policy. */ -EXTERNL int -nc_set_chunk_cache(size_t size, size_t nelems, float preemption); - -/* Get the cache size, nelems, and preemption policy. */ -EXTERNL int -nc_get_chunk_cache(size_t *sizep, size_t *nelemsp, float *preemptionp); - -/* Set the per-variable cache size, nelems, and preemption policy. */ -EXTERNL int -nc_set_var_chunk_cache(int ncid, int varid, size_t size, size_t nelems, - float preemption); - -/* Set the per-variable cache size, nelems, and preemption policy. */ -EXTERNL int -nc_get_var_chunk_cache(int ncid, int varid, size_t *sizep, size_t *nelemsp, - float *preemptionp); - -EXTERNL int -nc_redef(int ncid); - -EXTERNL int -nc__enddef(int ncid, size_t h_minfree, size_t v_align, - size_t v_minfree, size_t r_align); - -EXTERNL int -nc_enddef(int ncid); - -EXTERNL int -nc_sync(int ncid); - -EXTERNL int -nc_abort(int ncid); - -EXTERNL int -nc_close(int ncid); - -EXTERNL int -nc_inq(int ncid, int *ndimsp, int *nvarsp, int *nattsp, int *unlimdimidp); - -EXTERNL int -nc_inq_ndims(int ncid, int *ndimsp); - -EXTERNL int -nc_inq_nvars(int ncid, int *nvarsp); - -EXTERNL int -nc_inq_natts(int ncid, int *nattsp); - -EXTERNL int -nc_inq_unlimdim(int ncid, int *unlimdimidp); - -/* The next function is for NetCDF-4 only */ -EXTERNL int -nc_inq_unlimdims(int ncid, int *nunlimdimsp, int *unlimdimidsp); - -/* Added in 3.6.1 to return format of netCDF file. */ -EXTERNL int -nc_inq_format(int ncid, int *formatp); - -/* Begin _dim */ - -EXTERNL int -nc_def_dim(int ncid, const char *name, size_t len, int *idp); - -EXTERNL int -nc_inq_dimid(int ncid, const char *name, int *idp); - -EXTERNL int -nc_inq_dim(int ncid, int dimid, char *name, size_t *lenp); - -EXTERNL int -nc_inq_dimname(int ncid, int dimid, char *name); - -EXTERNL int -nc_inq_dimlen(int ncid, int dimid, size_t *lenp); - -EXTERNL int -nc_rename_dim(int ncid, int dimid, const char *name); - -/* End _dim */ -/* Begin _att */ - -EXTERNL int -nc_inq_att(int ncid, int varid, const char *name, - nc_type *xtypep, size_t *lenp); - -EXTERNL int -nc_inq_attid(int ncid, int varid, const char *name, int *idp); - -EXTERNL int -nc_inq_atttype(int ncid, int varid, const char *name, nc_type *xtypep); - -EXTERNL int -nc_inq_attlen(int ncid, int varid, const char *name, size_t *lenp); - -EXTERNL int -nc_inq_attname(int ncid, int varid, int attnum, char *name); - -EXTERNL int -nc_copy_att(int ncid_in, int varid_in, const char *name, int ncid_out, int varid_out); - -EXTERNL int -nc_rename_att(int ncid, int varid, const char *name, const char *newname); - -EXTERNL int -nc_del_att(int ncid, int varid, const char *name); - -/* End _att */ -/* Begin {put,get}_att */ - -EXTERNL int -nc_put_att_text(int ncid, int varid, const char *name, - size_t len, const char *op); - -EXTERNL int -nc_get_att_text(int ncid, int varid, const char *name, char *ip); - -EXTERNL int -nc_put_att_uchar(int ncid, int varid, const char *name, nc_type xtype, - size_t len, const unsigned char *op); - -EXTERNL int -nc_get_att_uchar(int ncid, int varid, const char *name, unsigned char *ip); - -EXTERNL int -nc_put_att_schar(int ncid, int varid, const char *name, nc_type xtype, - size_t len, const signed char *op); - -EXTERNL int -nc_get_att_schar(int ncid, int varid, const char *name, signed char *ip); - -EXTERNL int -nc_put_att_short(int ncid, int varid, const char *name, nc_type xtype, - size_t len, const short *op); - -EXTERNL int -nc_get_att_short(int ncid, int varid, const char *name, short *ip); - -EXTERNL int -nc_put_att_int(int ncid, int varid, const char *name, nc_type xtype, - size_t len, const int *op); - -EXTERNL int -nc_get_att_int(int ncid, int varid, const char *name, int *ip); - -EXTERNL int -nc_put_att_long(int ncid, int varid, const char *name, nc_type xtype, - size_t len, const long *op); - -EXTERNL int -nc_get_att_long(int ncid, int varid, const char *name, long *ip); - -EXTERNL int -nc_put_att_float(int ncid, int varid, const char *name, nc_type xtype, - size_t len, const float *op); - -EXTERNL int -nc_get_att_float(int ncid, int varid, const char *name, float *ip); - -EXTERNL int -nc_put_att_double(int ncid, int varid, const char *name, nc_type xtype, - size_t len, const double *op); - -EXTERNL int -nc_get_att_double(int ncid, int varid, const char *name, double *ip); - -EXTERNL int -nc_put_att_ushort(int ncid, int varid, const char *name, nc_type xtype, - size_t len, const unsigned short *op); - -EXTERNL int -nc_get_att_ushort(int ncid, int varid, const char *name, unsigned short *ip); - -EXTERNL int -nc_put_att_uint(int ncid, int varid, const char *name, nc_type xtype, - size_t len, const unsigned int *op); - -EXTERNL int -nc_get_att_uint(int ncid, int varid, const char *name, unsigned int *ip); - -EXTERNL int -nc_put_att_longlong(int ncid, int varid, const char *name, nc_type xtype, - size_t len, const long long *op); - -EXTERNL int -nc_get_att_longlong(int ncid, int varid, const char *name, long long *ip); - -EXTERNL int -nc_put_att_ulonglong(int ncid, int varid, const char *name, nc_type xtype, - size_t len, const unsigned long long *op); - -EXTERNL int -nc_get_att_ulonglong(int ncid, int varid, const char *name, - unsigned long long *ip); - -EXTERNL int -nc_put_att_string(int ncid, int varid, const char *name, - size_t len, const char **op); - -EXTERNL int -nc_get_att_string(int ncid, int varid, const char *name, char **ip); - -/* End {put,get}_att */ -/* Begin _var */ - -EXTERNL int -nc_def_var(int ncid, const char *name, nc_type xtype, int ndims, - const int *dimidsp, int *varidp); - -EXTERNL int -nc_inq_var(int ncid, int varid, char *name, nc_type *xtypep, - int *ndimsp, int *dimidsp, int *nattsp); - -EXTERNL int -nc_inq_varid(int ncid, const char *name, int *varidp); - -EXTERNL int -nc_inq_varname(int ncid, int varid, char *name); - -EXTERNL int -nc_inq_vartype(int ncid, int varid, nc_type *xtypep); - -EXTERNL int -nc_inq_varndims(int ncid, int varid, int *ndimsp); - -EXTERNL int -nc_inq_vardimid(int ncid, int varid, int *dimidsp); - -EXTERNL int -nc_inq_varnatts(int ncid, int varid, int *nattsp); - -EXTERNL int -nc_rename_var(int ncid, int varid, const char *name); - -EXTERNL int -nc_copy_var(int ncid_in, int varid, int ncid_out); - -#ifndef ncvarcpy -/* support the old name for now */ -#define ncvarcpy(ncid_in, varid, ncid_out) ncvarcopy((ncid_in), (varid), (ncid_out)) -#endif - -/* End _var */ -/* Begin {put,get}_var1 */ - -EXTERNL int -nc_put_var1_text(int ncid, int varid, const size_t *indexp, const char *op); - -EXTERNL int -nc_get_var1_text(int ncid, int varid, const size_t *indexp, char *ip); - -EXTERNL int -nc_put_var1_uchar(int ncid, int varid, const size_t *indexp, - const unsigned char *op); - -EXTERNL int -nc_get_var1_uchar(int ncid, int varid, const size_t *indexp, - unsigned char *ip); - -EXTERNL int -nc_put_var1_schar(int ncid, int varid, const size_t *indexp, - const signed char *op); - -EXTERNL int -nc_get_var1_schar(int ncid, int varid, const size_t *indexp, - signed char *ip); - -EXTERNL int -nc_put_var1_short(int ncid, int varid, const size_t *indexp, - const short *op); - -EXTERNL int -nc_get_var1_short(int ncid, int varid, const size_t *indexp, - short *ip); - -EXTERNL int -nc_put_var1_int(int ncid, int varid, const size_t *indexp, const int *op); - -EXTERNL int -nc_get_var1_int(int ncid, int varid, const size_t *indexp, int *ip); - -EXTERNL int -nc_put_var1_long(int ncid, int varid, const size_t *indexp, const long *op); - -EXTERNL int -nc_get_var1_long(int ncid, int varid, const size_t *indexp, long *ip); - -EXTERNL int -nc_put_var1_float(int ncid, int varid, const size_t *indexp, const float *op); - -EXTERNL int -nc_get_var1_float(int ncid, int varid, const size_t *indexp, float *ip); - -EXTERNL int -nc_put_var1_double(int ncid, int varid, const size_t *indexp, const double *op); - -EXTERNL int -nc_get_var1_double(int ncid, int varid, const size_t *indexp, double *ip); - -EXTERNL int -nc_put_var1_ushort(int ncid, int varid, const size_t *indexp, - const unsigned short *op); - -EXTERNL int -nc_get_var1_ushort(int ncid, int varid, const size_t *indexp, - unsigned short *ip); - -EXTERNL int -nc_put_var1_uint(int ncid, int varid, const size_t *indexp, - const unsigned int *op); - -EXTERNL int -nc_get_var1_uint(int ncid, int varid, const size_t *indexp, - unsigned int *ip); - -EXTERNL int -nc_put_var1_longlong(int ncid, int varid, const size_t *indexp, - const long long *op); - -EXTERNL int -nc_get_var1_longlong(int ncid, int varid, const size_t *indexp, - long long *ip); - -EXTERNL int -nc_put_var1_ulonglong(int ncid, int varid, const size_t *indexp, - const unsigned long long *op); - -EXTERNL int -nc_get_var1_ulonglong(int ncid, int varid, const size_t *indexp, - unsigned long long *ip); - -EXTERNL int -nc_put_var1_string(int ncid, int varid, const size_t *indexp, - const char **op); - -EXTERNL int -nc_get_var1_string(int ncid, int varid, const size_t *indexp, - char **ip); - -/* End {put,get}_var1 */ -/* Begin {put,get}_vara */ - -EXTERNL int -nc_put_vara_text(int ncid, int varid, const size_t *startp, - const size_t *countp, const char *op); - -EXTERNL int -nc_get_vara_text(int ncid, int varid, const size_t *startp, - const size_t *countp, char *ip); - -EXTERNL int -nc_put_vara_uchar(int ncid, int varid, const size_t *startp, - const size_t *countp, const unsigned char *op); - -EXTERNL int -nc_get_vara_uchar(int ncid, int varid, const size_t *startp, - const size_t *countp, unsigned char *ip); - -EXTERNL int -nc_put_vara_schar(int ncid, int varid, const size_t *startp, - const size_t *countp, const signed char *op); - -EXTERNL int -nc_get_vara_schar(int ncid, int varid, const size_t *startp, - const size_t *countp, signed char *ip); - -EXTERNL int -nc_put_vara_short(int ncid, int varid, const size_t *startp, - const size_t *countp, const short *op); - -EXTERNL int -nc_get_vara_short(int ncid, int varid, const size_t *startp, - const size_t *countp, short *ip); - -EXTERNL int -nc_put_vara_int(int ncid, int varid, const size_t *startp, - const size_t *countp, const int *op); - -EXTERNL int -nc_get_vara_int(int ncid, int varid, const size_t *startp, - const size_t *countp, int *ip); - -EXTERNL int -nc_put_vara_long(int ncid, int varid, const size_t *startp, - const size_t *countp, const long *op); - -EXTERNL int -nc_get_vara_long(int ncid, int varid, - const size_t *startp, const size_t *countp, long *ip); - -EXTERNL int -nc_put_vara_float(int ncid, int varid, - const size_t *startp, const size_t *countp, const float *op); - -EXTERNL int -nc_get_vara_float(int ncid, int varid, - const size_t *startp, const size_t *countp, float *ip); - -EXTERNL int -nc_put_vara_double(int ncid, int varid, const size_t *startp, - const size_t *countp, const double *op); - -EXTERNL int -nc_get_vara_double(int ncid, int varid, const size_t *startp, - const size_t *countp, double *ip); - -EXTERNL int -nc_put_vara_ushort(int ncid, int varid, const size_t *startp, - const size_t *countp, const unsigned short *op); - -EXTERNL int -nc_get_vara_ushort(int ncid, int varid, const size_t *startp, - const size_t *countp, unsigned short *ip); - -EXTERNL int -nc_put_vara_uint(int ncid, int varid, const size_t *startp, - const size_t *countp, const unsigned int *op); - -EXTERNL int -nc_get_vara_uint(int ncid, int varid, const size_t *startp, - const size_t *countp, unsigned int *ip); - -EXTERNL int -nc_put_vara_longlong(int ncid, int varid, const size_t *startp, - const size_t *countp, const long long *op); - -EXTERNL int -nc_get_vara_longlong(int ncid, int varid, const size_t *startp, - const size_t *countp, long long *ip); - -EXTERNL int -nc_put_vara_ulonglong(int ncid, int varid, const size_t *startp, - const size_t *countp, const unsigned long long *op); - -EXTERNL int -nc_get_vara_ulonglong(int ncid, int varid, const size_t *startp, - const size_t *countp, unsigned long long *ip); - -EXTERNL int -nc_put_vara_string(int ncid, int varid, const size_t *startp, - const size_t *countp, const char **op); - -EXTERNL int -nc_get_vara_string(int ncid, int varid, const size_t *startp, - const size_t *countp, char **ip); - -/* End {put,get}_vara */ -/* Begin {put,get}_vars */ - -EXTERNL int -nc_put_vars_text(int ncid, int varid, - const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, - const char *op); - -EXTERNL int -nc_get_vars_text(int ncid, int varid, - const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, - char *ip); - -EXTERNL int -nc_put_vars_uchar(int ncid, int varid, - const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, - const unsigned char *op); - -EXTERNL int -nc_get_vars_uchar(int ncid, int varid, - const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, - unsigned char *ip); - -EXTERNL int -nc_put_vars_schar(int ncid, int varid, - const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, - const signed char *op); - -EXTERNL int -nc_get_vars_schar(int ncid, int varid, - const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, - signed char *ip); - -EXTERNL int -nc_put_vars_short(int ncid, int varid, - const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, - const short *op); - -EXTERNL int -nc_get_vars_short(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - short *ip); - -EXTERNL int -nc_put_vars_int(int ncid, int varid, - const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, - const int *op); - -EXTERNL int -nc_get_vars_int(int ncid, int varid, - const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, - int *ip); - -EXTERNL int -nc_put_vars_long(int ncid, int varid, - const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, - const long *op); - -EXTERNL int -nc_get_vars_long(int ncid, int varid, - const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, - long *ip); - -EXTERNL int -nc_put_vars_float(int ncid, int varid, - const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, - const float *op); - -EXTERNL int -nc_get_vars_float(int ncid, int varid, - const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, - float *ip); - -EXTERNL int -nc_put_vars_double(int ncid, int varid, - const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, - const double *op); - -EXTERNL int -nc_get_vars_double(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - double *ip); - -EXTERNL int -nc_put_vars_ushort(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - const unsigned short *op); - -EXTERNL int -nc_get_vars_ushort(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - unsigned short *ip); - -EXTERNL int -nc_put_vars_uint(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - const unsigned int *op); - -EXTERNL int -nc_get_vars_uint(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - unsigned int *ip); - -EXTERNL int -nc_put_vars_longlong(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - const long long *op); - -EXTERNL int -nc_get_vars_longlong(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - long long *ip); - -EXTERNL int -nc_put_vars_ulonglong(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - const unsigned long long *op); - -EXTERNL int -nc_get_vars_ulonglong(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - unsigned long long *ip); - -EXTERNL int -nc_put_vars_string(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - const char **op); - -EXTERNL int -nc_get_vars_string(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - char **ip); - -/* End {put,get}_vars */ -/* Begin {put,get}_varm */ - -EXTERNL int -nc_put_varm_text(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - const ptrdiff_t *imapp, const char *op); - -EXTERNL int -nc_get_varm_text(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - const ptrdiff_t *imapp, char *ip); - -EXTERNL int -nc_put_varm_uchar(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - const ptrdiff_t *imapp, const unsigned char *op); - -EXTERNL int -nc_get_varm_uchar(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - const ptrdiff_t *imapp, unsigned char *ip); - -EXTERNL int -nc_put_varm_schar(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - const ptrdiff_t *imapp, const signed char *op); - -EXTERNL int -nc_get_varm_schar(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - const ptrdiff_t *imapp, signed char *ip); - -EXTERNL int -nc_put_varm_short(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - const ptrdiff_t *imapp, const short *op); - -EXTERNL int -nc_get_varm_short(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - const ptrdiff_t *imapp, short *ip); - -EXTERNL int -nc_put_varm_int(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - const ptrdiff_t *imapp, const int *op); - -EXTERNL int -nc_get_varm_int(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - const ptrdiff_t *imapp, int *ip); - -EXTERNL int -nc_put_varm_long(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - const ptrdiff_t *imapp, const long *op); - -EXTERNL int -nc_get_varm_long(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - const ptrdiff_t *imapp, long *ip); - -EXTERNL int -nc_put_varm_float(int ncid, int varid,const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - const ptrdiff_t *imapp, const float *op); - -EXTERNL int -nc_get_varm_float(int ncid, int varid,const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - const ptrdiff_t *imapp, float *ip); - -EXTERNL int -nc_put_varm_double(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - const ptrdiff_t *imapp, const double *op); - -EXTERNL int -nc_get_varm_double(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - const ptrdiff_t * imapp, double *ip); - -EXTERNL int -nc_put_varm_ushort(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - const ptrdiff_t * imapp, const unsigned short *op); - -EXTERNL int -nc_get_varm_ushort(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - const ptrdiff_t * imapp, unsigned short *ip); - -EXTERNL int -nc_put_varm_uint(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - const ptrdiff_t * imapp, const unsigned int *op); - -EXTERNL int -nc_get_varm_uint(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - const ptrdiff_t * imapp, unsigned int *ip); - -EXTERNL int -nc_put_varm_longlong(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - const ptrdiff_t * imapp, const long long *op); - -EXTERNL int -nc_get_varm_longlong(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - const ptrdiff_t * imapp, long long *ip); - -EXTERNL int -nc_put_varm_ulonglong(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - const ptrdiff_t * imapp, const unsigned long long *op); - -EXTERNL int -nc_get_varm_ulonglong(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - const ptrdiff_t * imapp, unsigned long long *ip); - -EXTERNL int -nc_put_varm_string(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - const ptrdiff_t * imapp, const char **op); - -EXTERNL int -nc_get_varm_string(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - const ptrdiff_t * imapp, char **ip); - -/* End {put,get}_varm */ -/* Begin {put,get}_var */ - -EXTERNL int -nc_put_var_text(int ncid, int varid, const char *op); - -EXTERNL int -nc_get_var_text(int ncid, int varid, char *ip); - -EXTERNL int -nc_put_var_uchar(int ncid, int varid, const unsigned char *op); - -EXTERNL int -nc_get_var_uchar(int ncid, int varid, unsigned char *ip); - -EXTERNL int -nc_put_var_schar(int ncid, int varid, const signed char *op); - -EXTERNL int -nc_get_var_schar(int ncid, int varid, signed char *ip); - -EXTERNL int -nc_put_var_short(int ncid, int varid, const short *op); - -EXTERNL int -nc_get_var_short(int ncid, int varid, short *ip); - -EXTERNL int -nc_put_var_int(int ncid, int varid, const int *op); - -EXTERNL int -nc_get_var_int(int ncid, int varid, int *ip); - -EXTERNL int -nc_put_var_long(int ncid, int varid, const long *op); - -EXTERNL int -nc_get_var_long(int ncid, int varid, long *ip); - -EXTERNL int -nc_put_var_float(int ncid, int varid, const float *op); - -EXTERNL int -nc_get_var_float(int ncid, int varid, float *ip); - -EXTERNL int -nc_put_var_double(int ncid, int varid, const double *op); - -EXTERNL int -nc_get_var_double(int ncid, int varid, double *ip); - -EXTERNL int -nc_put_var_ushort(int ncid, int varid, const unsigned short *op); - -EXTERNL int -nc_get_var_ushort(int ncid, int varid, unsigned short *ip); - -EXTERNL int -nc_put_var_uint(int ncid, int varid, const unsigned int *op); - -EXTERNL int -nc_get_var_uint(int ncid, int varid, unsigned int *ip); - -EXTERNL int -nc_put_var_longlong(int ncid, int varid, const long long *op); - -EXTERNL int -nc_get_var_longlong(int ncid, int varid, long long *ip); - -EXTERNL int -nc_put_var_ulonglong(int ncid, int varid, const unsigned long long *op); - -EXTERNL int -nc_get_var_ulonglong(int ncid, int varid, unsigned long long *ip); - -EXTERNL int -nc_put_var_string(int ncid, int varid, const char **op); - -EXTERNL int -nc_get_var_string(int ncid, int varid, char **ip); - -/* Begin Deprecated, same as functions with "_ubyte" replaced by "_uchar" */ -EXTERNL int -nc_put_att_ubyte(int ncid, int varid, const char *name, nc_type xtype, - size_t len, const unsigned char *op); -EXTERNL int -nc_get_att_ubyte(int ncid, int varid, const char *name, - unsigned char *ip); -EXTERNL int -nc_put_var1_ubyte(int ncid, int varid, const size_t *indexp, - const unsigned char *op); -EXTERNL int -nc_get_var1_ubyte(int ncid, int varid, const size_t *indexp, - unsigned char *ip); -EXTERNL int -nc_put_vara_ubyte(int ncid, int varid, const size_t *startp, - const size_t *countp, const unsigned char *op); -EXTERNL int -nc_get_vara_ubyte(int ncid, int varid, const size_t *startp, - const size_t *countp, unsigned char *ip); -EXTERNL int -nc_put_vars_ubyte(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - const unsigned char *op); -EXTERNL int -nc_get_vars_ubyte(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - unsigned char *ip); -EXTERNL int -nc_put_varm_ubyte(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - const ptrdiff_t * imapp, const unsigned char *op); -EXTERNL int -nc_get_varm_ubyte(int ncid, int varid, const size_t *startp, - const size_t *countp, const ptrdiff_t *stridep, - const ptrdiff_t * imapp, unsigned char *ip); -EXTERNL int -nc_put_var_ubyte(int ncid, int varid, const unsigned char *op); -EXTERNL int -nc_get_var_ubyte(int ncid, int varid, unsigned char *ip); -/* End Deprecated */ - -#ifdef LOGGING - -/* Set the log level. 0 shows only errors, 1 only major messages, - * etc., to 5, which shows way too much information. */ -EXTERNL int -nc_set_log_level(int new_level); - -/* Use this to turn off logging by calling - nc_log_level(NC_TURN_OFF_LOGGING) */ -#define NC_TURN_OFF_LOGGING (-1) - -#else /* not LOGGING */ - -#define nc_set_log_level(e) - -#endif /* LOGGING */ - -/* Show the netCDF library's in-memory metadata for a file. */ -EXTERNL int -nc_show_metadata(int ncid); - -/* End {put,get}_var */ - -/* #ifdef _CRAYMPP */ -/* - * Public interfaces to better support - * CRAY multi-processor systems like T3E. - * A tip of the hat to NERSC. - */ -/* - * It turns out we need to declare and define - * these public interfaces on all platforms - * or things get ugly working out the - * FORTRAN interface. On !_CRAYMPP platforms, - * these functions work as advertised, but you - * can only use "processor element" 0. - */ - -EXTERNL int -nc__create_mp(const char *path, int cmode, size_t initialsz, int basepe, - size_t *chunksizehintp, int *ncidp); - -EXTERNL int -nc__open_mp(const char *path, int mode, int basepe, - size_t *chunksizehintp, int *ncidp); - -EXTERNL int -nc_delete(const char *path); - -EXTERNL int -nc_delete_mp(const char *path, int basepe); - -EXTERNL int -nc_set_base_pe(int ncid, int pe); - -EXTERNL int -nc_inq_base_pe(int ncid, int *pe); - -/* #endif _CRAYMPP */ - -/* This v2 function is used in the nc_test program. */ -EXTERNL int -nctypelen(nc_type datatype); - -/* Begin v2.4 backward compatiblity */ -/* - * defining NO_NETCDF_2 to the preprocessor - * turns off backward compatiblity declarations. - */ -#ifndef NO_NETCDF_2 - -/** Backward compatible alias. */ -/**@{*/ -#define FILL_BYTE NC_FILL_BYTE -#define FILL_CHAR NC_FILL_CHAR -#define FILL_SHORT NC_FILL_SHORT -#define FILL_LONG NC_FILL_INT -#define FILL_FLOAT NC_FILL_FLOAT -#define FILL_DOUBLE NC_FILL_DOUBLE - -#define MAX_NC_DIMS NC_MAX_DIMS -#define MAX_NC_ATTRS NC_MAX_ATTRS -#define MAX_NC_VARS NC_MAX_VARS -#define MAX_NC_NAME NC_MAX_NAME -#define MAX_VAR_DIMS NC_MAX_VAR_DIMS -/**@}*/ - - -/* - * Global error status - */ -EXTERNL int ncerr; - -#define NC_ENTOOL NC_EMAXNAME /* Backward compatibility */ -#define NC_EXDR (-32) /* */ -#define NC_SYSERR (-31) - -/* - * Global options variable. - * Used to determine behavior of error handler. - */ -#define NC_FATAL 1 -#define NC_VERBOSE 2 - -EXTERNL int ncopts; /* default is (NC_FATAL | NC_VERBOSE) */ - -EXTERNL void -nc_advise(const char *cdf_routine_name, int err, const char *fmt,...); - -/* - * C data type corresponding to a netCDF NC_LONG argument, - * a signed 32 bit object. - * - * This is the only thing in this file which architecture dependent. - */ -typedef int nclong; - -EXTERNL int -nccreate(const char* path, int cmode); - -EXTERNL int -ncopen(const char* path, int mode); - -EXTERNL int -ncsetfill(int ncid, int fillmode); - -EXTERNL int -ncredef(int ncid); - -EXTERNL int -ncendef(int ncid); - -EXTERNL int -ncsync(int ncid); - -EXTERNL int -ncabort(int ncid); - -EXTERNL int -ncclose(int ncid); - -EXTERNL int -ncinquire(int ncid, int *ndimsp, int *nvarsp, int *nattsp, int *unlimdimp); - -EXTERNL int -ncdimdef(int ncid, const char *name, long len); - -EXTERNL int -ncdimid(int ncid, const char *name); - -EXTERNL int -ncdiminq(int ncid, int dimid, char *name, long *lenp); - -EXTERNL int -ncdimrename(int ncid, int dimid, const char *name); - -EXTERNL int -ncattput(int ncid, int varid, const char *name, nc_type xtype, - int len, const void *op); - -EXTERNL int -ncattinq(int ncid, int varid, const char *name, nc_type *xtypep, int *lenp); - -EXTERNL int -ncattget(int ncid, int varid, const char *name, void *ip); - -EXTERNL int -ncattcopy(int ncid_in, int varid_in, const char *name, int ncid_out, - int varid_out); - -EXTERNL int -ncattname(int ncid, int varid, int attnum, char *name); - -EXTERNL int -ncattrename(int ncid, int varid, const char *name, const char *newname); - -EXTERNL int -ncattdel(int ncid, int varid, const char *name); - -EXTERNL int -ncvardef(int ncid, const char *name, nc_type xtype, - int ndims, const int *dimidsp); - -EXTERNL int -ncvarid(int ncid, const char *name); - -EXTERNL int -ncvarinq(int ncid, int varid, char *name, nc_type *xtypep, - int *ndimsp, int *dimidsp, int *nattsp); - -EXTERNL int -ncvarput1(int ncid, int varid, const long *indexp, const void *op); - -EXTERNL int -ncvarget1(int ncid, int varid, const long *indexp, void *ip); - -EXTERNL int -ncvarput(int ncid, int varid, const long *startp, const long *countp, - const void *op); - -EXTERNL int -ncvarget(int ncid, int varid, const long *startp, const long *countp, - void *ip); - -EXTERNL int -ncvarputs(int ncid, int varid, const long *startp, const long *countp, - const long *stridep, const void *op); - -EXTERNL int -ncvargets(int ncid, int varid, const long *startp, const long *countp, - const long *stridep, void *ip); - -EXTERNL int -ncvarputg(int ncid, int varid, const long *startp, const long *countp, - const long *stridep, const long *imapp, const void *op); - -EXTERNL int -ncvargetg(int ncid, int varid, const long *startp, const long *countp, - const long *stridep, const long *imapp, void *ip); - -EXTERNL int -ncvarrename(int ncid, int varid, const char *name); - -EXTERNL int -ncrecinq(int ncid, int *nrecvarsp, int *recvaridsp, long *recsizesp); - -EXTERNL int -ncrecget(int ncid, long recnum, void **datap); - -EXTERNL int -ncrecput(int ncid, long recnum, void *const *datap); - -/* End v2.4 backward compatiblity */ -#endif /*!NO_NETCDF_2*/ - -#if defined(__cplusplus) -} -#endif - -/* Temporary hack to shut up warnings */ -#ifndef __MINGW32_VERSION -#define END_OF_MAIN() -#endif - -#endif /* _NETCDF_ */ - - - diff --git a/xios_2311_src/trunk/.svn/pristine/59/59ec775999ebf12fb274478e69e29ecb1ba4beee.svn-base b/xios_2311_src/trunk/.svn/pristine/59/59ec775999ebf12fb274478e69e29ecb1ba4beee.svn-base deleted file mode 100644 index 2f06b60b923dcfeb2b48ab4985d38d552ca6eb4a..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/59/59ec775999ebf12fb274478e69e29ecb1ba4beee.svn-base +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef __TRANSFER_TRANSFORM_CONNECTOR_HPP__ -#define __TRANSFER_TRANSFORM_CONNECTOR_HPP__ - -#include "xios_spl.hpp" -#include "array_new.hpp" -#include "local_view.hpp" - - - -namespace xios -{ - - class CTransferTransformConnector - { - - private: - shared_ptr srcView_; - shared_ptr dstView_; - - vector connector_; - vector mask_ ; // sizeof dstSize_ - int srcSize_ ; - int dstSize_ ; - - void computeConnector(unordered_map& indexMap) ; - - public: - - CTransferTransformConnector(shared_ptr srcView, shared_ptr dstView, unordered_map& indexMap) ; - - void transfer(int repeat, int sizeT, const CArray& dataIn, CArray& dataOut) - { - int dstSlice = dstSize_*sizeT ; - int srcSlice = srcSize_*sizeT ; - dataOut.resize(repeat* dstSlice) ; - dataOut=0 ; // what to do about missing value => next step ? - - const double* input = dataIn.dataFirst() ; - double* output = dataOut.dataFirst() ; - - for(int r=0;r& dataIn, CArray& dataOut) - { - transfer(1,sizeT, dataIn, dataOut) ; - } - - void transfer(const CArray& dataIn, CArray& dataOut) - { - transfer(1,1,dataIn, dataOut) ; - } - - - }; - -} - -#endif \ No newline at end of file diff --git a/xios_2311_src/trunk/.svn/pristine/5a/5a4ee7a7aa8168d0226da944e21fea448e88b29a.svn-base b/xios_2311_src/trunk/.svn/pristine/5a/5a4ee7a7aa8168d0226da944e21fea448e88b29a.svn-base deleted file mode 100644 index f0ae683c865ffb432ac6e80964933dc8ce5f1a8d..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/5a/5a4ee7a7aa8168d0226da944e21fea448e88b29a.svn-base +++ /dev/null @@ -1,254 +0,0 @@ -#include "calendar_util.hpp" - -namespace xios -{ - /// ////////////////////// Définitions ////////////////////// /// - - CDuration operator*(const double& scal, const CDuration& ddr) - { return (ddr * scal); } - - CDuration operator-(const CDuration& ddr, const CDuration& dr) - { - CDuration dur(ddr); - dur.year -= dr.year; dur.month -= dr.month; dur.day -= dr.day; - dur.hour -= dr.hour; dur.minute -= dr.minute; dur.second -= dr.second; dur.timestep -= dr.timestep; - return dur; - } - - CDuration operator+(const CDuration& ddr, const CDuration& dr) - { - CDuration dur(ddr); - dur.year += dr.year; dur.month += dr.month; dur.day += dr.day; - dur.hour += dr.hour; dur.minute += dr.minute; dur.second += dr.second; dur.timestep += dr.timestep; - return dur; - } - - CDuration operator*(const CDuration& ddr, const double& scal) - { - CDuration dur(ddr); - dur.year *= scal; dur.month *= scal; dur.day *= scal; - dur.hour *= scal; dur.minute *= scal; dur.second *= scal; dur.timestep *= scal; - return dur; - } - - CDuration operator-(const CDuration& ddr) - { - CDuration dur(ddr); - dur.year = -dur.year; - dur.month = -dur.month; - dur.day = -dur.day; - dur.hour = -dur.hour; - dur.minute = -dur.minute; - dur.second = -dur.second; - dur.timestep = -dur.timestep; - return dur; - } - - //----------------------------------------------------------------- - - CDate operator+(const CDate& dt, const CDuration& dr) - { - CDuration drr(dr); - int year = 0, month = 0, day = 0, hour = 0, minute = 0, second = 0; - const CCalendar& c = dt.getRelCalendar(); - const bool calendarHasMonths = (c.getYearLength() > 0); - - drr.timestep = 0; - if (dr.timestep) - { - if (c.getTimeStep() == NoneDu) - ERROR("operator+(const CDate& dt, const CDuration& dr)", - << "Impossible to use the timestep before it is set."); - drr = drr + dr.timestep * c.getTimeStep(); - } - - // Handle the time part of the date - drr.second += dt.getSecond(); - drr.minute += dt.getMinute(); - drr.hour += dt.getHour(); - - if (!calendarHasMonths) // Handle the day and year immediately if there is no months - { - drr.day += dt.getDay() - 1; - drr.year += dt.getYear(); - } - - drr.resolve(c, true); // Force the time to be positive - - second = drr.second; - minute = drr.minute; - hour = drr.hour; - - if (calendarHasMonths) - { - // Ajustement des mois en fonction des jours. - CDate dtt(dt); - drr.day += dtt.getDay() - 1; - dtt.setDay(1); - - if (drr.day >= 0) - { - for(; c.getMonthLength(dtt) <= drr.day; dtt.addMonth(1)) - { drr.day -= c.getMonthLength(dtt); drr.month += 1; } - - day = drr.day + 1; - } - else - { - dtt.addMonth(-1); - drr.month -= 1; - for(; c.getMonthLength(dtt) < -drr.day; dtt.addMonth(-1)) - { drr.day += c.getMonthLength(dtt); drr.month -= 1; } - day = c.getMonthLength(dtt) + drr.day + 1; - } - - drr.resolve(c); - - // Ajustement des années en fonction des mois. - month += dt.getMonth() + drr.month; - if (month < 0) { drr.year--; month += c.getYearLength(); } - if (month > c.getYearLength()) { drr.year++; month -= c.getYearLength(); } - if (month == 0){ month = c.getYearLength(); drr.year--; } - - year += dt.getYear() + drr.year; - } - else // if (!calendarHasMonths) - { - day = drr.day + 1; - month = 1; - year = drr.year; - } - - return (CDate(c, year, month, day, hour, minute, second)); - } - - CDate operator-(const CDate& dt, const CDuration& dr) { return (dt + (-dr)); } - - //----------------------------------------------------------------- - - CDuration operator-(const CDate& dt0, const CDate& dt1) - { - // TODO :: Vérifier que les deux dates (dt0 et dt1) ont une référence vers le même calendrier. - CDuration dur( dt0.getYear() - dt1.getYear(), dt0.getMonth() - dt1.getMonth() , dt0.getDay() - dt1.getDay(), - dt0.getHour() - dt1.getHour(), dt0.getMinute() - dt1.getMinute(), dt0.getSecond() - dt1.getSecond() ); - return (dur.resolve(dt0.getRelCalendar())); - } - - //----------------------------------------------------------------- - - /// Les opérateurs de comparaison. (Non testés pour le moment) - - bool operator==(const CDuration& ddr, const CDuration& dr) - { - return ((ddr.year == dr.year) && (ddr.month == dr.month) && (dr.day == ddr.day) && - (ddr.hour == dr.hour) && (ddr.minute == dr.minute) && (dr.second == ddr.second) && - (ddr.timestep == dr.timestep)); - } - - bool operator!=(const CDuration& ddr, const CDuration& dr) - { - return !(ddr == dr); - } - - bool operator==(const CDate& dt0, const CDate& dt1) - { - // TODO :: Vérifier que les deux dates (dt0 et dt1) ont une référence vers le même calendrier. - return ((dt0.getYear() == dt1.getYear()) && (dt0.getMonth() == dt1.getMonth()) && (dt1.getDay() == dt0.getDay()) && - (dt0.getHour() == dt1.getHour()) && (dt0.getMinute() == dt1.getMinute()) && (dt1.getSecond() == dt0.getSecond())); - } - - bool operator<(const CDate& dt0, const CDate& dt1) - { - // TODO :: Vérifier que les deux dates (dt0 et dt1) ont une référence vers le même calendrier. - if (dt0.getYear() < dt1.getYear()) - { - return true; - } - else if (dt0.getYear() == dt1.getYear()) - { - if (dt0.getMonth() < dt1.getMonth()) - { - return true; - } - else if (dt0.getMonth() == dt1.getMonth()) - { - if (dt0.getDay() < dt1.getDay()) - { - return true; - } - else if (dt0.getDay() == dt1.getDay()) - { - if (dt0.getHour() < dt1.getHour()) - { - return true; - } - else if (dt0.getHour() == dt1.getHour()) - { - if (dt0.getMinute() < dt1.getMinute()) - { - return true; - } - else if (dt0.getMinute() == dt1.getMinute()) - { - if (dt0.getSecond() < dt1.getSecond()) - return true; - } - } - } - } - } - return false; - } - - //----------------------------------------------------------------- - - bool operator!=(const CDate& dt0, const CDate& dt1) { return !(dt1 == dt0); } - bool operator> (const CDate& dt0, const CDate& dt1) { return (dt1 < dt0); } - bool operator>=(const CDate& dt0, const CDate& dt1) { return (dt0 > dt1 || dt1 == dt0); } - bool operator<=(const CDate& dt0, const CDate& dt1) { return (dt0 < dt1 || dt1 == dt0); } - - ///---------------------------------------------------------------- - - bool DurationFakeLessComparator::operator()(const CDuration& dur1, const CDuration& dur2) const - { - if (dur1.year < dur2.year) - return true; - else if (dur1.year == dur2.year) - { - if (dur1.month < dur2.month) - return true; - else if (dur1.month == dur2.month) - { - if (dur1.day < dur2.day) - return true; - else if (dur1.day == dur2.day) - { - if (dur1.hour < dur2.hour) - return true; - else if (dur1.hour == dur2.hour) - { - if (dur1.minute < dur2.minute) - return true; - else if (dur1.minute == dur2.minute) - { - if (dur1.second < dur2.second) - return true; - else if (dur1.second == dur2.second) - return (dur1.timestep < dur2.timestep); - } - } - } - } - } - return false; - } - - ///---------------------------------------------------------------- - -} // namespace xios - - - - - - diff --git a/xios_2311_src/trunk/.svn/pristine/5a/5aa9f4e8e04bff7d2322e89cbcaa3f3be59fc980.svn-base b/xios_2311_src/trunk/.svn/pristine/5a/5aa9f4e8e04bff7d2322e89cbcaa3f3be59fc980.svn-base deleted file mode 100644 index 592c0688f907763479d175b3a21d881789193b77..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/5a/5aa9f4e8e04bff7d2322e89cbcaa3f3be59fc980.svn-base +++ /dev/null @@ -1,15 +0,0 @@ -# Environment to compile XIOS on ZEUS cluster at CMCC - -NETCDF_INCDIR="-I${NETCDF_DIR}/include -I${PNETCDF_DIR}/include" -NETCDF_LIBDIR="-L${NETCDF_DIR}/lib -L${PNETCDF_DIR}/lib" -NETCDF_LIB="-L${NETCDF_DIR}/lib -lnetcdff -L${NETCDF_DIR}/lib -lnetcdf -L${PNETCDF_DIR}/lib -lpnetcdf" - -HDF5_INCDIR="-I${HDF5_DIR}/include" -HDF5_LIBDIR="-L${HDF5_DIR}/lib" -HDF5_LIB="-L${HDF5_DIR}/lib -lhdf5_hl -L${HDF5_DIR}/lib -lhdf5" - -OASIS_INCDIR="" -OASIS_LIBDIR="" -OASIS_LIB="" - - diff --git a/xios_2311_src/trunk/.svn/pristine/5a/5ac803f861864e43afc4c6208c4dd7aaa097928d.svn-base b/xios_2311_src/trunk/.svn/pristine/5a/5ac803f861864e43afc4c6208c4dd7aaa097928d.svn-base deleted file mode 100644 index 7e9fa6b7932e2bfd8a4627c79cd525e42a36fd07..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/5a/5ac803f861864e43afc4c6208c4dd7aaa097928d.svn-base +++ /dev/null @@ -1,43 +0,0 @@ -/* ************************************************************************** * - * Interface auto generated - do not modify * - * ************************************************************************** */ - -#include -#include "xios.hpp" -#include "attribute_template.hpp" -#include "object_template.hpp" -#include "group_template.hpp" -#include "icutil.hpp" -#include "icdate.hpp" -#include "timer.hpp" -#include "node_type.hpp" - -extern "C" -{ - typedef xios::CReduceAxisToAxis* reduce_axis_to_axis_Ptr; - - void cxios_set_reduce_axis_to_axis_operation(reduce_axis_to_axis_Ptr reduce_axis_to_axis_hdl, const char * operation, int operation_size) - { - std::string operation_str; - if (!cstr2string(operation, operation_size, operation_str)) return; - CTimer::get("XIOS").resume(); - reduce_axis_to_axis_hdl->operation.fromString(operation_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_reduce_axis_to_axis_operation(reduce_axis_to_axis_Ptr reduce_axis_to_axis_hdl, char * operation, int operation_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(reduce_axis_to_axis_hdl->operation.getInheritedStringValue(), operation, operation_size)) - ERROR("void cxios_get_reduce_axis_to_axis_operation(reduce_axis_to_axis_Ptr reduce_axis_to_axis_hdl, char * operation, int operation_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_reduce_axis_to_axis_operation(reduce_axis_to_axis_Ptr reduce_axis_to_axis_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = reduce_axis_to_axis_hdl->operation.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } -} diff --git a/xios_2311_src/trunk/.svn/pristine/5b/5b8c91ec5c4a705657069707bb34813a0304812f.svn-base b/xios_2311_src/trunk/.svn/pristine/5b/5b8c91ec5c4a705657069707bb34813a0304812f.svn-base deleted file mode 100644 index c13428638aa3d2e78ff0f45760d2f77f5ab6aed8..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/5b/5b8c91ec5c4a705657069707bb34813a0304812f.svn-base +++ /dev/null @@ -1,94 +0,0 @@ -#include "zoom_axis.hpp" -#include "axis_algorithm_zoom.hpp" -#include "type.hpp" - -namespace xios { - - /// ////////////////////// Définitions ////////////////////// /// - - CZoomAxis::CZoomAxis(void) - : CObjectTemplate(), CZoomAxisAttributes(), CTransformation() - { /* Ne rien faire de plus */ } - - CZoomAxis::CZoomAxis(const StdString & id) - : CObjectTemplate(id), CZoomAxisAttributes(), CTransformation() - { /* Ne rien faire de plus */ } - - CZoomAxis::~CZoomAxis(void) - {} - - CTransformation* CZoomAxis::create(const StdString& id, xml::CXMLNode* node) - { - CZoomAxis* zoomAxis = CZoomAxisGroup::get("zoom_axis_definition")->createChild(id); - if (node) zoomAxis->parse(*node); - return static_cast*>(zoomAxis); - } - - bool CZoomAxis::registerTrans() - { - return registerTransformation(TRANS_ZOOM_AXIS, {create, getTransformation}); - } - - bool CZoomAxis::_dummyRegistered = CZoomAxis::registerTrans(); - - //---------------------------------------------------------------- - - StdString CZoomAxis::GetName(void) { return StdString("zoom_axis"); } - StdString CZoomAxis::GetDefName(void) { return StdString("zoom_axis"); } - ENodeType CZoomAxis::GetType(void) { return eZoomAxis; } - - void CZoomAxis::checkValid(CAxis* axisDest) - { - int axisIBegin, axisNi, axisGlobalSize; - int begin, end, n; - - axisIBegin = axisDest->begin.getValue(); - axisNi = axisDest->n.getValue(); - axisGlobalSize = axisDest->n_glo.getValue(); - - bool zoomByIndex = !this->index.isEmpty() && (0 != this->index.numElements()); - - if (zoomByIndex) - { - begin = min(this->index); - end = max(this->index); - n = end - begin + 1; - } - else - { - begin = (this->begin.isEmpty()) ? 0 : this->begin.getValue(); - n = (this->n.isEmpty()) ? axisGlobalSize : this->n.getValue(); - end = begin+n-1; - } - - if (begin < 0 || begin > axisGlobalSize - 1 || end < 0 || end > axisGlobalSize - 1 - || n < 1 || n > axisGlobalSize || begin > end) - ERROR("CZoomAxis::checkValid(CAxis* axisDest)", - << "One or more attributes among 'begin' (" << begin << "), 'end' (" << end << "), 'n' (" << n << ") " - << "of axis transformation [ id = '" << axisDest->getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] are not well specified"); - - if (zoomByIndex && (!this->begin.isEmpty() || !this->n.isEmpty())) - ERROR("CZoomAxis::checkValid(CAxis* axisDest)", - << "Only one type of zoom is accepted. Define zoom by index with global_zoom_index or define zoom with begin and n. " - << "Axis transformation [ id = '" << axisDest->getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] are not well specified"); - - this->begin.setValue(begin); - this->n.setValue(n); - - } - - shared_ptr CZoomAxis::createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) - { - return CAxisAlgorithmZoom::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, - elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, - elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition); - } -} diff --git a/xios_2311_src/trunk/.svn/pristine/5c/5c08373073759c8153c678747ff82acfbbd6625d.svn-base b/xios_2311_src/trunk/.svn/pristine/5c/5c08373073759c8153c678747ff82acfbbd6625d.svn-base deleted file mode 100644 index e2527be4b5b17cb148aa2e85f3f73687a9bad9a3..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/5c/5c08373073759c8153c678747ff82acfbbd6625d.svn-base +++ /dev/null @@ -1,206 +0,0 @@ -#ifndef __XIOS_CObjectFactory_impl__ -#define __XIOS_CObjectFactory_impl__ - -#include "object_factory.hpp" - -namespace xios -{ - /// ////////////////////// Définitions ////////////////////// /// - template - int CObjectFactory::GetObjectNum(void) - { - if (CurrContext.size() == 0) - ERROR("CObjectFactory::GetObjectNum(void)", - << "please define current context id !"); - return (U::AllVectObj[CObjectFactory::CurrContext].size()); - } - - template - int CObjectFactory::GetObjectIdNum(void) - { - if (CurrContext.size() == 0) - ERROR("CObjectFactory::GetObjectIdNum(void)", - << "please define current context id !"); - return (U::AllMapObj[CObjectFactory::CurrContext].size()); - } - - template - bool CObjectFactory::HasObject(const StdString & id) - { - if (CurrContext.size() == 0) - ERROR("CObjectFactory::HasObject(const StdString & id)", - << "[ id = " << id << " ] please define current context id !"); - return (U::AllMapObj[CObjectFactory::CurrContext].find(id) != - U::AllMapObj[CObjectFactory::CurrContext].end()); - } - - template - bool CObjectFactory::HasObject(const StdString & context, const StdString & id) - { - if (U::AllMapObj.find(context) == U::AllMapObj.end()) return false ; - else return (U::AllMapObj[context].find(id) != U::AllMapObj[context].end()); - } - - template - std::shared_ptr CObjectFactory::GetObject(const U * const object) - { - if (CurrContext.size() == 0) - ERROR("CObjectFactory::GetObject(const U * const object)", - << "please define current context id !"); - std::vector > & vect = - U::AllVectObj[CObjectFactory::CurrContext]; - - typename std::vector >::const_iterator - it = vect.begin(), end = vect.end(); - - for (; it != end; it++) - { - std::shared_ptr ptr = *it; - if (ptr.get() == object) - return (ptr); - } - - ERROR("CObjectFactory::GetObject(const U * const object)", - << "[type = " << U::GetName() << ", adress = " << object << "] " - << "object was not found."); - return (std::shared_ptr()); // jamais atteint - } - - template - std::shared_ptr CObjectFactory::GetObject(const StdString & id) - { - if (CurrContext.size() == 0) - ERROR("CObjectFactory::GetObject(const StdString & id)", - << "[ id = " << id << " ] please define current context id !"); - if (!CObjectFactory::HasObject(id)) - ERROR("CObjectFactory::GetObject(const StdString & id)", - << "[ id = " << id << ", U = " << U::GetName() << " ] " - << "object was not found."); - return (U::AllMapObj[CObjectFactory::CurrContext][id]); - } - - template - std::shared_ptr CObjectFactory::GetObject(const StdString & context, const StdString & id) - { - if (!CObjectFactory::HasObject(context,id)) - ERROR("CObjectFactory::GetObject(const StdString & id)", - << "[ id = " << id << ", U = " << U::GetName() <<", context = "< - std::shared_ptr CObjectFactory::CreateObject(const StdString& id) - { - if (CurrContext.empty()) - ERROR("CObjectFactory::CreateObject(const StdString& id)", - << "[ id = " << id << " ] please define current context id !"); - - if (CObjectFactory::HasObject(id)) - { - return CObjectFactory::GetObject(id); - } - else - { - std::shared_ptr value(new U(id.empty() ? CObjectFactory::GenUId() : id)); - - U::AllVectObj[CObjectFactory::CurrContext].insert(U::AllVectObj[CObjectFactory::CurrContext].end(), value); - U::AllMapObj[CObjectFactory::CurrContext].insert(std::make_pair(value->getId(), value)); - - return value; - } - } - - template - std::shared_ptr CObjectFactory::CreateAlias(const StdString& id, const StdString& alias) - { - if (CurrContext.empty()) - ERROR("CObjectFactory::CreateAlias(const StdString& id, const StdString& alias)", - << "[ id = " << id << " alias = "<(alias)) - { - return CObjectFactory::GetObject(alias); - } - else - { - if (! CObjectFactory::HasObject(id)) - { - ERROR("CObjectFactory::CreateAlias(const StdString& id, const StdString& alias)", - << "[ id = " << id << " alias = "< value = CObjectFactory::GetObject(id); - U::AllMapObj[CObjectFactory::CurrContext].insert(std::make_pair(alias, value)); - return value; - } - } - } - - template - const std::vector > & - CObjectFactory::GetObjectVector(const StdString & context) - { - return (U::AllVectObj[context]); - } - - template - const StdString CObjectFactory::GetUIdBase(void) - { - StdString base ; -// base = "__"+CObjectFactory::CurrContext + "::" + U::GetName() + "_undef_id_"; - base = CObjectFactory::CurrContext + "__" + U::GetName() + "_undef_id_"; - return base; - } - - template - StdString CObjectFactory::GenUId(void) - { - StdOStringStream oss; - oss << GetUIdBase() << U::GenId[CObjectFactory::CurrContext]++; - return oss.str(); - } - - template - bool CObjectFactory::IsGenUId(const StdString& id) - { - const StdString base = GetUIdBase(); - return (id.size() > base.size() && id.compare(0, base.size(), base) == 0); - } - - template - void CObjectFactory::deleteContext(const StdString & context) - { - for (auto& v : U::AllVectObj[context]) v.reset() ; - U::AllVectObj[context].clear() ; - U::AllVectObj.erase(context) ; - for (auto& m : U::AllMapObj[context]) m.second.reset() ; - U::AllMapObj[context].clear() ; - U::AllMapObj.erase(context) ; - - U::GenId.erase(context) ; - } - - template - void CObjectFactory::deleteAllContexts(void) - { - list contextList ; - for(auto& context : U::AllMapObj) contextList.push_back(context.first) ; - for(auto& context : contextList) deleteContext(context) ; - } - - - template - void CObjectFactory::dumpObjects(void) - { - for (auto& context : U::AllMapObj) - for(auto& m : context.second) - { - info(100)<<"Dump All Object"<& doutput) - : SuperClass(StdString("average"), doutput) - { /* Ne rien faire de plus */ } - - CAverage::CAverage(CArray& doutput, double missingValue) - : SuperClass(StdString("average"), doutput, missingValue) - { /* Ne rien faire de plus */ } - - CAverage::~CAverage(void) - { /* Ne rien faire de plus */ } - - //--------------------------------------------------------------- - - void CAverage::apply(const CArray& _dinput, - CArray& _doutput) - { - if (hasMissingValue) - { - if (nbcalls.numElements()==0) - { - nbcalls.resize(_dinput.numElements()) ; - nbcalls=0 ; - } - } - - if (this->nbcall == 1) - { - _doutput=_dinput ; - if (hasMissingValue) - { - int i, n =_dinput.numElements() ; - const double * in=_dinput.dataFirst() ; - int* nc=nbcalls.dataFirst() ; - for (i=0; i::isNan(*in)) (*nc) ++; - } - } - else - { - if (hasMissingValue) - { - int i, n =_dinput.numElements() ; - const double * in=_dinput.dataFirst() ; - double* out=_doutput.dataFirst(); - int* nc=nbcalls.dataFirst() ; - for (i=0; i::isNan(*in)) - { - if (*nc != 0) (*out) += *in; - else *out = *in ; - (*nc) ++; - } - } - else _doutput+=_dinput ; - } - - } - - void CAverage::final(void) - { - if (hasMissingValue) - { - int i, n = nbcalls.numElements() ; - double* out= doutput.dataFirst(); - int* nc=nbcalls.dataFirst() ; - for (i=0; inbcall; - this->nbcall = 0; - - } - } // namespace func -} // namespace xios diff --git a/xios_2311_src/trunk/.svn/pristine/5c/5c4ccd55b10252e940fe17a2d02b531d7bcf9318.svn-base b/xios_2311_src/trunk/.svn/pristine/5c/5c4ccd55b10252e940fe17a2d02b531d7bcf9318.svn-base deleted file mode 100644 index 0700b753af51dd696a7256db2e1cef60611064b7..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/5c/5c4ccd55b10252e940fe17a2d02b531d7bcf9318.svn-base +++ /dev/null @@ -1,103 +0,0 @@ -#ifndef __XIOS_NC4_DATA_INPUT__ -#define __XIOS_NC4_DATA_INPUT__ - -/// XIOS headers /// -#include "xios_spl.hpp" -#include "data_input.hpp" -#include "inetcdf4.hpp" - -namespace xios -{ - class CDomain; - class CAxis; - class CScalar; - - class CNc4DataInput - : protected CINetCDF4 - , public virtual CDataInput - { - public: - /// Type definitions /// - typedef CINetCDF4 SuperClassWriter; - typedef CDataInput SuperClass; - - /// Constructors /// - CNc4DataInput(const StdString& filename, MPI_Comm comm_file, bool multifile, bool isCollective = true, - bool readMetaDataPar = false, bool ugridConvention = false, const StdString& timeCounterName = "time_counter"); - CNc4DataInput(const CNc4DataInput& dataInput); // Not implemented. - CNc4DataInput(const CNc4DataInput* const dataInput); // Not implemented. - - /// Destructor /// - virtual ~CNc4DataInput(void); - - /// Getters /// - const StdString& getFileName(void) const; - - protected: - // Read methods - virtual StdSize getFieldNbRecords_(CField* field); - virtual void readFieldData_(CField* field, int record, CArray& data); - virtual void readFieldAttributes_(CField* field, bool readAttributeValues); - virtual void closeFile_(void); - - private: - void readDomainAttributesFromFile(CDomain* domain, std::list >& dimSizeMap, - int elementPosition, const StdString& fieldId); - void readDomainAttributeValueFromFile(CDomain* domain, std::list >& dimSizeMap, - int elementPosition, const StdString& fieldId); - - void readAxisAttributesFromFile(CAxis* axis, std::list >& dimSizeMap, - int elementPosition, const StdString& fieldId); - void readAxisAttributeValueFromFile(CAxis* axis, std::list >& dimSizeMap, - int elementPosition, const StdString& fieldId); - - void readScalarAttributesFromFile(CScalar* scalar, std::list >& dimSizeMap, - int elementPosition, const StdString& fieldId); - void readScalarAttributeValueFromFile(CScalar* scalar, std::list >& dimSizeMap, - int elementPosition, const StdString& fieldId); - - template - void readFieldVariableValue(CArray& var, const StdString& varId, - const std::vector& nBegin, - const std::vector& nSize, - bool forceIndependent = false); - - private: - std::set readMetaDataDomains_, readValueDomains_; - std::set readMetaDataAxis_, readValueAxis_; - std::set readMetaDataScalar_, readValueScalar_; - - private: - /// Private attributes /// - MPI_Comm comm_file; - const StdString filename; - bool isCollective; - bool ugridConvention; - }; // class CNc4DataInput - -template -void CNc4DataInput::readFieldVariableValue(CArray& var, const StdString& varId, - const std::vector& nBegin, - const std::vector& nSize, - bool forceIndependent) -{ - if (SuperClass::type==MULTI_FILE || !isCollective) return; - - bool openCollective = isCollective; - if (forceIndependent) openCollective = !isCollective; - switch (SuperClass::type) - { - case MULTI_FILE: - ERROR("CINetCDF4::readFieldVariableValue(...)", - << "Only support attributes reading with one_file mode"); - break; - case ONE_FILE: - { - SuperClassWriter::getData(var, varId, openCollective, 0, &nBegin, &nSize); - break; - } - } -} -} // namespace xios - -#endif //__XIOS_NC4_DATA_INPUT__ diff --git a/xios_2311_src/trunk/.svn/pristine/5c/5c54d34cc73543fc21ccc76eaad2ca113e69ccf4.svn-base b/xios_2311_src/trunk/.svn/pristine/5c/5c54d34cc73543fc21ccc76eaad2ca113e69ccf4.svn-base deleted file mode 100644 index 15b286f733903c8b468c20dd4f97c0dab34938e1..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/5c/5c54d34cc73543fc21ccc76eaad2ca113e69ccf4.svn-base +++ /dev/null @@ -1,299 +0,0 @@ -/* ************************************************************************** * - * Interface auto generated - do not modify * - * ************************************************************************** */ - -#include -#include "xios.hpp" -#include "attribute_template.hpp" -#include "object_template.hpp" -#include "group_template.hpp" -#include "icutil.hpp" -#include "icdate.hpp" -#include "timer.hpp" -#include "node_type.hpp" - -extern "C" -{ - typedef xios::CCalendarWrapper* calendar_wrapper_Ptr; - - void cxios_set_calendar_wrapper_comment(calendar_wrapper_Ptr calendar_wrapper_hdl, const char * comment, int comment_size) - { - std::string comment_str; - if (!cstr2string(comment, comment_size, comment_str)) return; - CTimer::get("XIOS").resume(); - calendar_wrapper_hdl->comment.setValue(comment_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_calendar_wrapper_comment(calendar_wrapper_Ptr calendar_wrapper_hdl, char * comment, int comment_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(calendar_wrapper_hdl->comment.getInheritedValue(), comment, comment_size)) - ERROR("void cxios_get_calendar_wrapper_comment(calendar_wrapper_Ptr calendar_wrapper_hdl, char * comment, int comment_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_calendar_wrapper_comment(calendar_wrapper_Ptr calendar_wrapper_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = calendar_wrapper_hdl->comment.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_calendar_wrapper_day_length(calendar_wrapper_Ptr calendar_wrapper_hdl, int day_length) - { - CTimer::get("XIOS").resume(); - calendar_wrapper_hdl->day_length.setValue(day_length); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_calendar_wrapper_day_length(calendar_wrapper_Ptr calendar_wrapper_hdl, int* day_length) - { - CTimer::get("XIOS").resume(); - *day_length = calendar_wrapper_hdl->day_length.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_calendar_wrapper_day_length(calendar_wrapper_Ptr calendar_wrapper_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = calendar_wrapper_hdl->day_length.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_calendar_wrapper_leap_year_drift(calendar_wrapper_Ptr calendar_wrapper_hdl, double leap_year_drift) - { - CTimer::get("XIOS").resume(); - calendar_wrapper_hdl->leap_year_drift.setValue(leap_year_drift); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_calendar_wrapper_leap_year_drift(calendar_wrapper_Ptr calendar_wrapper_hdl, double* leap_year_drift) - { - CTimer::get("XIOS").resume(); - *leap_year_drift = calendar_wrapper_hdl->leap_year_drift.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_calendar_wrapper_leap_year_drift(calendar_wrapper_Ptr calendar_wrapper_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = calendar_wrapper_hdl->leap_year_drift.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_calendar_wrapper_leap_year_drift_offset(calendar_wrapper_Ptr calendar_wrapper_hdl, double leap_year_drift_offset) - { - CTimer::get("XIOS").resume(); - calendar_wrapper_hdl->leap_year_drift_offset.setValue(leap_year_drift_offset); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_calendar_wrapper_leap_year_drift_offset(calendar_wrapper_Ptr calendar_wrapper_hdl, double* leap_year_drift_offset) - { - CTimer::get("XIOS").resume(); - *leap_year_drift_offset = calendar_wrapper_hdl->leap_year_drift_offset.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_calendar_wrapper_leap_year_drift_offset(calendar_wrapper_Ptr calendar_wrapper_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = calendar_wrapper_hdl->leap_year_drift_offset.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_calendar_wrapper_leap_year_month(calendar_wrapper_Ptr calendar_wrapper_hdl, int leap_year_month) - { - CTimer::get("XIOS").resume(); - calendar_wrapper_hdl->leap_year_month.setValue(leap_year_month); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_calendar_wrapper_leap_year_month(calendar_wrapper_Ptr calendar_wrapper_hdl, int* leap_year_month) - { - CTimer::get("XIOS").resume(); - *leap_year_month = calendar_wrapper_hdl->leap_year_month.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_calendar_wrapper_leap_year_month(calendar_wrapper_Ptr calendar_wrapper_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = calendar_wrapper_hdl->leap_year_month.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_calendar_wrapper_month_lengths(calendar_wrapper_Ptr calendar_wrapper_hdl, int* month_lengths, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(month_lengths, shape(extent[0]), neverDeleteData); - calendar_wrapper_hdl->month_lengths.reference(tmp.copy()); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_calendar_wrapper_month_lengths(calendar_wrapper_Ptr calendar_wrapper_hdl, int* month_lengths, int* extent) - { - CTimer::get("XIOS").resume(); - CArray tmp(month_lengths, shape(extent[0]), neverDeleteData); - tmp=calendar_wrapper_hdl->month_lengths.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_calendar_wrapper_month_lengths(calendar_wrapper_Ptr calendar_wrapper_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = calendar_wrapper_hdl->month_lengths.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_calendar_wrapper_start_date(calendar_wrapper_Ptr calendar_wrapper_hdl, const char * start_date, int start_date_size) - { - std::string start_date_str; - if (!cstr2string(start_date, start_date_size, start_date_str)) return; - CTimer::get("XIOS").resume(); - calendar_wrapper_hdl->start_date.setValue(start_date_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_calendar_wrapper_start_date(calendar_wrapper_Ptr calendar_wrapper_hdl, char * start_date, int start_date_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(calendar_wrapper_hdl->start_date.getInheritedValue(), start_date, start_date_size)) - ERROR("void cxios_get_calendar_wrapper_start_date(calendar_wrapper_Ptr calendar_wrapper_hdl, char * start_date, int start_date_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_calendar_wrapper_start_date(calendar_wrapper_Ptr calendar_wrapper_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = calendar_wrapper_hdl->start_date.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_calendar_wrapper_time_origin(calendar_wrapper_Ptr calendar_wrapper_hdl, const char * time_origin, int time_origin_size) - { - std::string time_origin_str; - if (!cstr2string(time_origin, time_origin_size, time_origin_str)) return; - CTimer::get("XIOS").resume(); - calendar_wrapper_hdl->time_origin.setValue(time_origin_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_calendar_wrapper_time_origin(calendar_wrapper_Ptr calendar_wrapper_hdl, char * time_origin, int time_origin_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(calendar_wrapper_hdl->time_origin.getInheritedValue(), time_origin, time_origin_size)) - ERROR("void cxios_get_calendar_wrapper_time_origin(calendar_wrapper_Ptr calendar_wrapper_hdl, char * time_origin, int time_origin_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_calendar_wrapper_time_origin(calendar_wrapper_Ptr calendar_wrapper_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = calendar_wrapper_hdl->time_origin.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_calendar_wrapper_timestep(calendar_wrapper_Ptr calendar_wrapper_hdl, cxios_duration timestep_c) - { - CTimer::get("XIOS").resume(); - calendar_wrapper_hdl->timestep.allocate(); - CDuration& timestep = calendar_wrapper_hdl->timestep.get(); - timestep.year = timestep_c.year; - timestep.month = timestep_c.month; - timestep.day = timestep_c.day; - timestep.hour = timestep_c.hour; - timestep.minute = timestep_c.minute; - timestep.second = timestep_c.second; - timestep.timestep = timestep_c.timestep; - CTimer::get("XIOS").suspend(); - } - - void cxios_get_calendar_wrapper_timestep(calendar_wrapper_Ptr calendar_wrapper_hdl, cxios_duration* timestep_c) - { - CTimer::get("XIOS").resume(); - CDuration timestep = calendar_wrapper_hdl->timestep.getInheritedValue(); - timestep_c->year = timestep.year; - timestep_c->month = timestep.month; - timestep_c->day = timestep.day; - timestep_c->hour = timestep.hour; - timestep_c->minute = timestep.minute; - timestep_c->second = timestep.second; - timestep_c->timestep = timestep.timestep; - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_calendar_wrapper_timestep(calendar_wrapper_Ptr calendar_wrapper_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = calendar_wrapper_hdl->timestep.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_calendar_wrapper_type(calendar_wrapper_Ptr calendar_wrapper_hdl, const char * type, int type_size) - { - std::string type_str; - if (!cstr2string(type, type_size, type_str)) return; - CTimer::get("XIOS").resume(); - calendar_wrapper_hdl->type.fromString(type_str); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_calendar_wrapper_type(calendar_wrapper_Ptr calendar_wrapper_hdl, char * type, int type_size) - { - CTimer::get("XIOS").resume(); - if (!string_copy(calendar_wrapper_hdl->type.getInheritedStringValue(), type, type_size)) - ERROR("void cxios_get_calendar_wrapper_type(calendar_wrapper_Ptr calendar_wrapper_hdl, char * type, int type_size)", << "Input string is too short"); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_calendar_wrapper_type(calendar_wrapper_Ptr calendar_wrapper_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = calendar_wrapper_hdl->type.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } - - - void cxios_set_calendar_wrapper_year_length(calendar_wrapper_Ptr calendar_wrapper_hdl, int year_length) - { - CTimer::get("XIOS").resume(); - calendar_wrapper_hdl->year_length.setValue(year_length); - CTimer::get("XIOS").suspend(); - } - - void cxios_get_calendar_wrapper_year_length(calendar_wrapper_Ptr calendar_wrapper_hdl, int* year_length) - { - CTimer::get("XIOS").resume(); - *year_length = calendar_wrapper_hdl->year_length.getInheritedValue(); - CTimer::get("XIOS").suspend(); - } - - bool cxios_is_defined_calendar_wrapper_year_length(calendar_wrapper_Ptr calendar_wrapper_hdl) - { - CTimer::get("XIOS").resume(); - bool isDefined = calendar_wrapper_hdl->year_length.hasInheritedValue(); - CTimer::get("XIOS").suspend(); - return isDefined; - } -} diff --git a/xios_2311_src/trunk/.svn/pristine/5c/5c6d997d36bc1d7612348eb8dcd646e6a42efd9b.svn-base b/xios_2311_src/trunk/.svn/pristine/5c/5c6d997d36bc1d7612348eb8dcd646e6a42efd9b.svn-base deleted file mode 100644 index 9fcbfbe2c2c11c1f42f77b958ab2e16034c51290..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/5c/5c6d997d36bc1d7612348eb8dcd646e6a42efd9b.svn-base +++ /dev/null @@ -1,107 +0,0 @@ -#ifndef __XIOS_CGroupTemplate__ -#define __XIOS_CGroupTemplate__ - -#include "xios_spl.hpp" -#include "declare_attribute.hpp" -#include "event_server.hpp" -#include "object_template.hpp" -#include "context_client.hpp" - -namespace xios -{ - - /// ////////////////////// Déclarations ////////////////////// /// - template - class CGroupTemplate - : public CObjectTemplate, public virtual W - { - /// Friend /// - friend class CGroupFactory; - - /// Typedef /// - typedef U Child; - typedef V Derived, Group; - typedef W SuperClassAttribute; - typedef CObjectTemplate SuperClass; - - public : - - enum EEventId - { - EVENT_ID_CREATE_CHILD=200, EVENT_ID_CREATE_CHILD_GROUP - } ; - - /// Spécifique /// - DECLARE_ATTRIBUTE(StdString, group_ref) - - /// Accesseurs /// - const xios_map& getGroupMap(void) const; - const vector& getChildList(void) const; - - void getAllChildren(vector & allc) const; - vector getAllChildren(void) const; - - /// Autres /// - virtual StdString toString(void) const; - virtual void fromString(const StdString & str); - -// virtual void toBinary (StdOStream & os) const; -// virtual void fromBinary(StdIStream & is); - - virtual void parse(xml::CXMLNode & node); - virtual void parse(xml::CXMLNode & node, bool withAttr); - virtual void parseChild(xml::CXMLNode & node); - - /// Test /// - virtual bool hasChild(void) const; - - /// Accesseurs statiques /// - static StdString GetName(void); - static StdString GetDefName(void); - - /// Traitements /// - virtual void solveDescInheritance(bool apply, const CAttributeMap * const parent = 0); - void solveRefInheritance(void); -// static bool has(const string & id); -// static std::shared_ptr get(const string& id) ; -// static std::shared_ptr create(const string& id=string("")) ; - U* createChild(const string& id="") ; - - void addChild(U* child) ; - V* createChildGroup(const string& id="") ; - void addChildGroup(V* childGroup) ; - static bool dispatchEvent(CEventServer& event) ; - void sendCreateChild(const string& id, CContextClient* client, const string& objectId="") ; - void sendCreateChildGroup(const string& id, CContextClient* client, const string& objectId="") ; - static void recvCreateChild(CEventServer& event) ; - void recvCreateChild(CBufferIn& buffer) ; - static void recvCreateChildGroup(CEventServer& event) ; - void recvCreateChildGroup(CBufferIn& buffer) ; - - /// Destructeur /// - virtual ~CGroupTemplate(void); - - protected : - - /// Constructeurs /// - CGroupTemplate(void); - CGroupTemplate(const StdString & id); - CGroupTemplate(const CGroupTemplate & group, - bool withAttrList = true, bool withId = true); // Not implemented yet. - CGroupTemplate(const CGroupTemplate * const group); // Not implemented yet. - - private : - - /// Propriétés /// - xios_map childMap; - vector childList; - - xios_map groupMap; - vector groupList; - - }; // class CGroupTemplate -} // namespace xios - -//#include "group_template_impl.hpp" - -#endif // __XIOS_CGroupTemplate__ diff --git a/xios_2311_src/trunk/.svn/pristine/5c/5cbae77cba683bf63dd58b4675601c28eb00caa7.svn-base b/xios_2311_src/trunk/.svn/pristine/5c/5cbae77cba683bf63dd58b4675601c28eb00caa7.svn-base deleted file mode 100644 index fb7062e8ef44862f0bf722e362499866e9ae5952..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/5c/5cbae77cba683bf63dd58b4675601c28eb00caa7.svn-base +++ /dev/null @@ -1,22 +0,0 @@ -MODULE INTERPOLATE_DOMAIN_INTERFACE - USE, INTRINSIC :: ISO_C_BINDING - - INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99 - - SUBROUTINE cxios_interpolate_domain_handle_create(ret, idt, idt_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_interpolate_domain_handle_create - - SUBROUTINE cxios_interpolate_domain_valid_id(ret, idt, idt_size) BIND(C) - USE ISO_C_BINDING - LOGICAL (kind = C_BOOL) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_interpolate_domain_valid_id - - END INTERFACE - -END MODULE INTERPOLATE_DOMAIN_INTERFACE diff --git a/xios_2311_src/trunk/.svn/pristine/5c/5cfaf33f3e58b172ff5dc033bff11e8eee0a17ab.svn-base b/xios_2311_src/trunk/.svn/pristine/5c/5cfaf33f3e58b172ff5dc033bff11e8eee0a17ab.svn-base deleted file mode 100644 index 2747ebdc46da117f3c093e40d499085f3a743498..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/5c/5cfaf33f3e58b172ff5dc033bff11e8eee0a17ab.svn-base +++ /dev/null @@ -1,1464 +0,0 @@ -#include "xios_fortran_prefix.hpp" - -MODULE IDATA - USE, INTRINSIC :: ISO_C_BINDING - USE ICONTEXT - USE IFIELD - - INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99 - - SUBROUTINE cxios_init_server() BIND(C) - END SUBROUTINE cxios_init_server - - SUBROUTINE cxios_init_client(client_id, len_client_id, f_local_comm, f_return_comm) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: client_id - INTEGER (kind = C_INT) , VALUE :: len_client_id - INTEGER (kind = C_INT) :: f_local_comm - INTEGER (kind = C_INT) :: f_return_comm - END SUBROUTINE cxios_init_client - - SUBROUTINE cxios_context_initialize(context_id,len_context_id,f_comm) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: context_id - INTEGER (kind = C_INT) , VALUE :: len_context_id - INTEGER (kind = C_INT) :: f_comm - END SUBROUTINE cxios_context_initialize - - SUBROUTINE cxios_context_is_initialized(context_id,len_context_id,initialized) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: context_id - INTEGER (kind = C_INT) , VALUE :: len_context_id - LOGICAL (kind = C_BOOL) :: initialized - END SUBROUTINE cxios_context_is_initialized - - - SUBROUTINE cxios_context_close_definition() BIND(C) - USE ISO_C_BINDING - END SUBROUTINE cxios_context_close_definition - - - SUBROUTINE cxios_context_finalize() BIND(C) - USE ISO_C_BINDING - END SUBROUTINE cxios_context_finalize - - SUBROUTINE cxios_oasis_enddef() BIND(C) - USE ISO_C_BINDING - END SUBROUTINE cxios_oasis_enddef - - SUBROUTINE cxios_finalize() BIND(C) - END SUBROUTINE cxios_finalize - - SUBROUTINE cxios_solve_inheritance() BIND(C) - END SUBROUTINE cxios_solve_inheritance - - SUBROUTINE cxios_write_data_k80_hdl(field_hdl, data_k8, data_Xsize) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (kind = C_DOUBLE) :: data_k8 - INTEGER (kind = C_INT) , VALUE :: data_Xsize - END SUBROUTINE cxios_write_data_k80_hdl - - SUBROUTINE cxios_write_data_k80(fieldid, fieldid_size, data_k8, data_Xsize) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid - REAL (kind = C_DOUBLE) :: data_k8 - INTEGER (kind = C_INT) , VALUE :: fieldid_size - INTEGER (kind = C_INT) , VALUE :: data_Xsize - END SUBROUTINE cxios_write_data_k80 - - SUBROUTINE cxios_write_data_k81_hdl(field_hdl, data_k8, data_Xsize) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 - INTEGER (kind = C_INT) , VALUE :: data_Xsize - END SUBROUTINE cxios_write_data_k81_hdl - - SUBROUTINE cxios_write_data_k81(fieldid, fieldid_size, data_k8, data_Xsize) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid - REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 - INTEGER (kind = C_INT) , VALUE :: fieldid_size - INTEGER (kind = C_INT) , VALUE :: data_Xsize - END SUBROUTINE cxios_write_data_k81 - - SUBROUTINE cxios_write_data_k82_hdl(field_hdl, data_k8, data_Xsize, data_Ysize) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 - INTEGER (kind = C_INT) , VALUE :: data_Xsize, data_Ysize - END SUBROUTINE cxios_write_data_k82_hdl - - SUBROUTINE cxios_write_data_k82(fieldid, fieldid_size, data_k8, data_Xsize, data_Ysize) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid - REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 - INTEGER (kind = C_INT) , VALUE :: fieldid_size - INTEGER (kind = C_INT) , VALUE :: data_Xsize, data_Ysize - END SUBROUTINE cxios_write_data_k82 - - SUBROUTINE cxios_write_data_k83_hdl(field_hdl, data_k8, data_Xsize, data_Ysize, data_Zsize) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 - INTEGER (kind = C_INT) , VALUE :: data_Xsize, data_Ysize, data_Zsize - END SUBROUTINE cxios_write_data_k83_hdl - - SUBROUTINE cxios_write_data_k83(fieldid, fieldid_size, data_k8, data_Xsize, data_Ysize, data_Zsize) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid - REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 - INTEGER (kind = C_INT) , VALUE :: fieldid_size - INTEGER (kind = C_INT) , VALUE :: data_Xsize, data_Ysize, data_Zsize - END SUBROUTINE cxios_write_data_k83 - - SUBROUTINE cxios_write_data_k84_hdl(field_hdl, data_k8, & - data_0size, data_1size, data_2size, & - data_3size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 - INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size - INTEGER (kind = C_INT) , VALUE :: data_3size - END SUBROUTINE cxios_write_data_k84_hdl - - SUBROUTINE cxios_write_data_k84(fieldid, fieldid_size, data_k8, & - data_0size, data_1size, data_2size, & - data_3size) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid - REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 - INTEGER (kind = C_INT) , VALUE :: fieldid_size - INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size - INTEGER (kind = C_INT) , VALUE :: data_3size - END SUBROUTINE cxios_write_data_k84 - - SUBROUTINE cxios_write_data_k85_hdl(field_hdl, data_k8, & - data_0size, data_1size, data_2size, & - data_3size, data_4size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 - INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size - INTEGER (kind = C_INT) , VALUE :: data_3size, data_4size - END SUBROUTINE cxios_write_data_k85_hdl - - SUBROUTINE cxios_write_data_k85(fieldid, fieldid_size, data_k8, & - data_0size, data_1size, data_2size, & - data_3size, data_4size) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid - REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 - INTEGER (kind = C_INT) , VALUE :: fieldid_size - INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size - INTEGER (kind = C_INT) , VALUE :: data_3size, data_4size - END SUBROUTINE cxios_write_data_k85 - - SUBROUTINE cxios_write_data_k86_hdl(field_hdl, data_k8, & - data_0size, data_1size, data_2size, & - data_3size, data_4size, data_5size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 - INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size - INTEGER (kind = C_INT) , VALUE :: data_3size, data_4size, data_5size - END SUBROUTINE cxios_write_data_k86_hdl - - SUBROUTINE cxios_write_data_k86(fieldid, fieldid_size, data_k8, & - data_0size, data_1size, data_2size, & - data_3size, data_4size, data_5size) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid - REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 - INTEGER (kind = C_INT) , VALUE :: fieldid_size - INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size - INTEGER (kind = C_INT) , VALUE :: data_3size, data_4size, data_5size - END SUBROUTINE cxios_write_data_k86 - - SUBROUTINE cxios_write_data_k87_hdl(field_hdl, data_k8, & - data_0size, data_1size, data_2size, & - data_3size, data_4size, data_5size, & - data_6size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 - INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size - INTEGER (kind = C_INT) , VALUE :: data_3size, data_4size, data_5size - INTEGER (kind = C_INT) , VALUE :: data_6size - END SUBROUTINE cxios_write_data_k87_hdl - - SUBROUTINE cxios_write_data_k87(fieldid, fieldid_size, data_k8, & - data_0size, data_1size, data_2size, & - data_3size, data_4size, data_5size, & - data_6size) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid - REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 - INTEGER (kind = C_INT) , VALUE :: fieldid_size - INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size - INTEGER (kind = C_INT) , VALUE :: data_3size, data_4size, data_5size - INTEGER (kind = C_INT) , VALUE :: data_6size - END SUBROUTINE cxios_write_data_k87 - - SUBROUTINE cxios_write_data_k40_hdl(field_hdl, data_k4, data_Xsize) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (kind = C_FLOAT) :: data_k4 - INTEGER (kind = C_INT) , VALUE :: data_Xsize - END SUBROUTINE cxios_write_data_k40_hdl - - SUBROUTINE cxios_write_data_k40(fieldid, fieldid_size, data_k4, data_Xsize) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid - REAL (kind = C_FLOAT) :: data_k4 - INTEGER (kind = C_INT) , VALUE :: fieldid_size - INTEGER (kind = C_INT) , VALUE :: data_Xsize - END SUBROUTINE cxios_write_data_k40 - - SUBROUTINE cxios_write_data_k41_hdl(field_hdl, data_k4, data_Xsize) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 - INTEGER (kind = C_INT) , VALUE :: data_Xsize - END SUBROUTINE cxios_write_data_k41_hdl - - SUBROUTINE cxios_write_data_k41(fieldid, fieldid_size, data_k4, data_Xsize) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid - REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 - INTEGER (kind = C_INT) , VALUE :: fieldid_size - INTEGER (kind = C_INT) , VALUE :: data_Xsize - END SUBROUTINE cxios_write_data_k41 - - SUBROUTINE cxios_write_data_k42_hdl(field_hdl, data_k4, data_Xsize, data_Ysize) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 - INTEGER (kind = C_INT) , VALUE :: data_Xsize, data_Ysize - END SUBROUTINE cxios_write_data_k42_hdl - - SUBROUTINE cxios_write_data_k42(fieldid, fieldid_size, data_k4, data_Xsize, data_Ysize) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid - REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 - INTEGER (kind = C_INT) , VALUE :: fieldid_size - INTEGER (kind = C_INT) , VALUE :: data_Xsize, data_Ysize - END SUBROUTINE cxios_write_data_k42 - - SUBROUTINE cxios_write_data_k43_hdl(field_hdl, data_k4, data_Xsize, data_Ysize, data_Zsize) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 - INTEGER (kind = C_INT) , VALUE :: data_Xsize, data_Ysize, data_Zsize - END SUBROUTINE cxios_write_data_k43_hdl - - SUBROUTINE cxios_write_data_k43(fieldid, fieldid_size, data_k4, data_Xsize, data_Ysize, data_Zsize) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid - REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 - INTEGER (kind = C_INT) , VALUE :: fieldid_size - INTEGER (kind = C_INT) , VALUE :: data_Xsize, data_Ysize, data_Zsize - END SUBROUTINE cxios_write_data_k43 - - SUBROUTINE cxios_write_data_k44_hdl(field_hdl, data_k4, & - data_0size, data_1size, data_2size, & - data_3size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 - INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size - INTEGER (kind = C_INT) , VALUE :: data_3size - END SUBROUTINE cxios_write_data_k44_hdl - - SUBROUTINE cxios_write_data_k44(fieldid, fieldid_size, data_k4, & - data_0size, data_1size, data_2size, & - data_3size) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid - REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 - INTEGER (kind = C_INT) , VALUE :: fieldid_size - INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size - INTEGER (kind = C_INT) , VALUE :: data_3size - END SUBROUTINE cxios_write_data_k44 - - SUBROUTINE cxios_write_data_k45_hdl(field_hdl, data_k4, & - data_0size, data_1size, data_2size, & - data_3size, data_4size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 - INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size - INTEGER (kind = C_INT) , VALUE :: data_3size, data_4size - END SUBROUTINE cxios_write_data_k45_hdl - - SUBROUTINE cxios_write_data_k45(fieldid, fieldid_size, data_k4, & - data_0size, data_1size, data_2size, & - data_3size, data_4size) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid - REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 - INTEGER (kind = C_INT) , VALUE :: fieldid_size - INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size - INTEGER (kind = C_INT) , VALUE :: data_3size, data_4size - END SUBROUTINE cxios_write_data_k45 - - SUBROUTINE cxios_write_data_k46_hdl(field_hdl, data_k4, & - data_0size, data_1size, data_2size, & - data_3size, data_4size, data_5size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 - INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size - INTEGER (kind = C_INT) , VALUE :: data_3size, data_4size, data_5size - END SUBROUTINE cxios_write_data_k46_hdl - - SUBROUTINE cxios_write_data_k46(fieldid, fieldid_size, data_k4, & - data_0size, data_1size, data_2size, & - data_3size, data_4size, data_5size) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid - REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 - INTEGER (kind = C_INT) , VALUE :: fieldid_size - INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size - INTEGER (kind = C_INT) , VALUE :: data_3size, data_4size, data_5size - END SUBROUTINE cxios_write_data_k46 - - SUBROUTINE cxios_write_data_k47_hdl(field_hdl, data_k4, & - data_0size, data_1size, data_2size, & - data_3size, data_4size, data_5size, & - data_6size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 - INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size - INTEGER (kind = C_INT) , VALUE :: data_3size, data_4size, data_5size - INTEGER (kind = C_INT) , VALUE :: data_6size - END SUBROUTINE cxios_write_data_k47_hdl - - SUBROUTINE cxios_write_data_k47(fieldid, fieldid_size, data_k4, & - data_0size, data_1size, data_2size, & - data_3size, data_4size, data_5size, & - data_6size) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid - REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 - INTEGER (kind = C_INT) , VALUE :: fieldid_size - INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size - INTEGER (kind = C_INT) , VALUE :: data_3size, data_4size, data_5size - INTEGER (kind = C_INT) , VALUE :: data_6size - END SUBROUTINE cxios_write_data_k47 - - - ! Read data - SUBROUTINE cxios_read_data_k80_hdl(field_hdl, data_k8, data_Xsize) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (kind = C_DOUBLE) :: data_k8 - INTEGER (kind = C_INT) , VALUE :: data_Xsize - END SUBROUTINE cxios_read_data_k80_hdl - - SUBROUTINE cxios_read_data_k80(fieldid, fieldid_size, data_k8, data_Xsize) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid - REAL (kind = C_DOUBLE) :: data_k8 - INTEGER (kind = C_INT) , VALUE :: fieldid_size - INTEGER (kind = C_INT) , VALUE :: data_Xsize - END SUBROUTINE cxios_read_data_k80 - - SUBROUTINE cxios_read_data_k81_hdl(field_hdl, data_k8, data_Xsize) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 - INTEGER (kind = C_INT) , VALUE :: data_Xsize - END SUBROUTINE cxios_read_data_k81_hdl - - SUBROUTINE cxios_read_data_k81(fieldid, fieldid_size, data_k8, data_Xsize) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid - REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 - INTEGER (kind = C_INT) , VALUE :: fieldid_size - INTEGER (kind = C_INT) , VALUE :: data_Xsize - END SUBROUTINE cxios_read_data_k81 - - SUBROUTINE cxios_read_data_k82_hdl(field_hdl, data_k8, data_Xsize, data_Ysize) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 - INTEGER (kind = C_INT) , VALUE :: data_Xsize, data_Ysize - END SUBROUTINE cxios_read_data_k82_hdl - - SUBROUTINE cxios_read_data_k82(fieldid, fieldid_size, data_k8, data_Xsize, data_Ysize) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid - REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 - INTEGER (kind = C_INT) , VALUE :: fieldid_size - INTEGER (kind = C_INT) , VALUE :: data_Xsize, data_Ysize - END SUBROUTINE cxios_read_data_k82 - - SUBROUTINE cxios_read_data_k83_hdl(field_hdl, data_k8, data_Xsize, data_Ysize, data_Zsize) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 - INTEGER (kind = C_INT) , VALUE :: data_Xsize, data_Ysize, data_Zsize - END SUBROUTINE cxios_read_data_k83_hdl - - SUBROUTINE cxios_read_data_k83(fieldid, fieldid_size, data_k8, data_Xsize, data_Ysize, data_Zsize) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid - REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 - INTEGER (kind = C_INT) , VALUE :: fieldid_size - INTEGER (kind = C_INT) , VALUE :: data_Xsize, data_Ysize, data_Zsize - END SUBROUTINE cxios_read_data_k83 - - SUBROUTINE cxios_read_data_k84_hdl(field_hdl, data_k8, & - data_0size, data_1size, data_2size, & - data_3size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 - INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size - INTEGER (kind = C_INT) , VALUE :: data_3size - END SUBROUTINE cxios_read_data_k84_hdl - - SUBROUTINE cxios_read_data_k84(fieldid, fieldid_size, data_k8, & - data_0size, data_1size, data_2size, & - data_3size) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid - REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 - INTEGER (kind = C_INT) , VALUE :: fieldid_size - INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size - INTEGER (kind = C_INT) , VALUE :: data_3size - END SUBROUTINE cxios_read_data_k84 - - SUBROUTINE cxios_read_data_k85_hdl(field_hdl, data_k8, & - data_0size, data_1size, data_2size, & - data_3size, data_4size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 - INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size - INTEGER (kind = C_INT) , VALUE :: data_3size, data_4size - END SUBROUTINE cxios_read_data_k85_hdl - - SUBROUTINE cxios_read_data_k85(fieldid, fieldid_size, data_k8, & - data_0size, data_1size, data_2size, & - data_3size, data_4size) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid - REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 - INTEGER (kind = C_INT) , VALUE :: fieldid_size - INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size - INTEGER (kind = C_INT) , VALUE :: data_3size, data_4size - END SUBROUTINE cxios_read_data_k85 - - SUBROUTINE cxios_read_data_k86_hdl(field_hdl, data_k8, & - data_0size, data_1size, data_2size, & - data_3size, data_4size, data_5size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 - INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size - INTEGER (kind = C_INT) , VALUE :: data_3size, data_4size, data_5size - END SUBROUTINE cxios_read_data_k86_hdl - - SUBROUTINE cxios_read_data_k86(fieldid, fieldid_size, data_k8, & - data_0size, data_1size, data_2size, & - data_3size, data_4size, data_5size) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid - REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 - INTEGER (kind = C_INT) , VALUE :: fieldid_size - INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size - INTEGER (kind = C_INT) , VALUE :: data_3size, data_4size, data_5size - END SUBROUTINE cxios_read_data_k86 - - SUBROUTINE cxios_read_data_k87_hdl(field_hdl, data_k8, & - data_0size, data_1size, data_2size, & - data_3size, data_4size, data_5size, & - data_6size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 - INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size - INTEGER (kind = C_INT) , VALUE :: data_3size, data_4size, data_5size - INTEGER (kind = C_INT) , VALUE :: data_6size - END SUBROUTINE cxios_read_data_k87_hdl - - SUBROUTINE cxios_read_data_k87(fieldid, fieldid_size, data_k8, & - data_0size, data_1size, data_2size, & - data_3size, data_4size, data_5size, & - data_6size) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid - REAL (kind = C_DOUBLE), DIMENSION(*) :: data_k8 - INTEGER (kind = C_INT) , VALUE :: fieldid_size - INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size - INTEGER (kind = C_INT) , VALUE :: data_3size, data_4size, data_5size - INTEGER (kind = C_INT) , VALUE :: data_6size - END SUBROUTINE cxios_read_data_k87 - - SUBROUTINE cxios_read_data_k40_hdl(field_hdl, data_k4, data_Xsize) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (kind = C_FLOAT) :: data_k4 - INTEGER (kind = C_INT) , VALUE :: data_Xsize - END SUBROUTINE cxios_read_data_k40_hdl - - SUBROUTINE cxios_read_data_k40(fieldid, fieldid_size, data_k4, data_Xsize) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid - REAL (kind = C_FLOAT) :: data_k4 - INTEGER (kind = C_INT) , VALUE :: fieldid_size - INTEGER (kind = C_INT) , VALUE :: data_Xsize - END SUBROUTINE cxios_read_data_k40 - - SUBROUTINE cxios_read_data_k41_hdl(field_hdl, data_k4, data_Xsize) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 - INTEGER (kind = C_INT) , VALUE :: data_Xsize - END SUBROUTINE cxios_read_data_k41_hdl - - SUBROUTINE cxios_read_data_k41(fieldid, fieldid_size, data_k4, data_Xsize) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid - REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 - INTEGER (kind = C_INT) , VALUE :: fieldid_size - INTEGER (kind = C_INT) , VALUE :: data_Xsize - END SUBROUTINE cxios_read_data_k41 - - SUBROUTINE cxios_read_data_k42_hdl(field_hdl, data_k4, data_Xsize, data_Ysize) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 - INTEGER (kind = C_INT) , VALUE :: data_Xsize, data_Ysize - END SUBROUTINE cxios_read_data_k42_hdl - - SUBROUTINE cxios_read_data_k42(fieldid, fieldid_size, data_k4, data_Xsize, data_Ysize) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid - REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 - INTEGER (kind = C_INT) , VALUE :: fieldid_size - INTEGER (kind = C_INT) , VALUE :: data_Xsize, data_Ysize - END SUBROUTINE cxios_read_data_k42 - - SUBROUTINE cxios_read_data_k43_hdl(field_hdl, data_k4, data_Xsize, data_Ysize, data_Zsize) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 - INTEGER (kind = C_INT) , VALUE :: data_Xsize, data_Ysize, data_Zsize - END SUBROUTINE cxios_read_data_k43_hdl - - SUBROUTINE cxios_read_data_k43(fieldid, fieldid_size, data_k4, data_Xsize, data_Ysize, data_Zsize) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid - REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 - INTEGER (kind = C_INT) , VALUE :: fieldid_size - INTEGER (kind = C_INT) , VALUE :: data_Xsize, data_Ysize, data_Zsize - END SUBROUTINE cxios_read_data_k43 - - SUBROUTINE cxios_read_data_k44_hdl(field_hdl, data_k4, & - data_0size, data_1size, data_2size, & - data_3size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 - INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size - INTEGER (kind = C_INT) , VALUE :: data_3size - END SUBROUTINE cxios_read_data_k44_hdl - - SUBROUTINE cxios_read_data_k44(fieldid, fieldid_size, data_k4, & - data_0size, data_1size, data_2size, & - data_3size) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid - REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 - INTEGER (kind = C_INT) , VALUE :: fieldid_size - INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size - INTEGER (kind = C_INT) , VALUE :: data_3size - END SUBROUTINE cxios_read_data_k44 - - SUBROUTINE cxios_read_data_k45_hdl(field_hdl, data_k4, & - data_0size, data_1size, data_2size, & - data_3size, data_4size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 - INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size - INTEGER (kind = C_INT) , VALUE :: data_3size, data_4size - END SUBROUTINE cxios_read_data_k45_hdl - - SUBROUTINE cxios_read_data_k45(fieldid, fieldid_size, data_k4, & - data_0size, data_1size, data_2size, & - data_3size, data_4size) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid - REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 - INTEGER (kind = C_INT) , VALUE :: fieldid_size - INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size - INTEGER (kind = C_INT) , VALUE :: data_3size, data_4size - END SUBROUTINE cxios_read_data_k45 - - SUBROUTINE cxios_read_data_k46_hdl(field_hdl, data_k4, & - data_0size, data_1size, data_2size, & - data_3size, data_4size, data_5size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 - INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size - INTEGER (kind = C_INT) , VALUE :: data_3size, data_4size, data_5size - END SUBROUTINE cxios_read_data_k46_hdl - - SUBROUTINE cxios_read_data_k46(fieldid, fieldid_size, data_k4, & - data_0size, data_1size, data_2size, & - data_3size, data_4size, data_5size) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid - REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 - INTEGER (kind = C_INT) , VALUE :: fieldid_size - INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size - INTEGER (kind = C_INT) , VALUE :: data_3size, data_4size, data_5size - END SUBROUTINE cxios_read_data_k46 - - SUBROUTINE cxios_read_data_k47_hdl(field_hdl, data_k4, & - data_0size, data_1size, data_2size, & - data_3size, data_4size, data_5size, & - data_6size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl - REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 - INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size - INTEGER (kind = C_INT) , VALUE :: data_3size, data_4size, data_5size - INTEGER (kind = C_INT) , VALUE :: data_6size - END SUBROUTINE cxios_read_data_k47_hdl - - SUBROUTINE cxios_read_data_k47(fieldid, fieldid_size, data_k4, & - data_0size, data_1size, data_2size, & - data_3size, data_4size, data_5size, & - data_6size) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: fieldid - REAL (kind = C_FLOAT) , DIMENSION(*) :: data_k4 - INTEGER (kind = C_INT) , VALUE :: fieldid_size - INTEGER (kind = C_INT) , VALUE :: data_0size, data_1size, data_2size - INTEGER (kind = C_INT) , VALUE :: data_3size, data_4size, data_5size - INTEGER (kind = C_INT) , VALUE :: data_6size - END SUBROUTINE cxios_read_data_k47 - - ! Binding C and Fortran interface of get_variable (icdata.cpp) - SUBROUTINE cxios_get_variable_data_k8(vardid, varid_size, data_k8, is_var_existed) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: vardid - INTEGER (kind = C_INT) , VALUE :: varid_size - REAL (kind = C_DOUBLE) :: data_k8 - LOGICAL (kind = C_BOOL) :: is_var_existed - END SUBROUTINE cxios_get_variable_data_k8 - - SUBROUTINE cxios_get_variable_data_k4(vardid, varid_size, data_k4, is_var_existed) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: vardid - INTEGER (kind = C_INT) , VALUE :: varid_size - REAL (kind = C_FLOAT) :: data_k4 - LOGICAL (kind = C_BOOL) :: is_var_existed - END SUBROUTINE cxios_get_variable_data_k4 - - SUBROUTINE cxios_get_variable_data_int(vardid, varid_size, data_int, is_var_existed) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: vardid - INTEGER (kind = C_INT) , VALUE :: varid_size - INTEGER (kind = C_INT) :: data_int - LOGICAL (kind = C_BOOL) :: is_var_existed - END SUBROUTINE cxios_get_variable_data_int - - SUBROUTINE cxios_get_variable_data_logic(vardid, varid_size, data_logic, is_var_existed) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: vardid - INTEGER (kind = C_INT) , VALUE :: varid_size - LOGICAL (kind = C_BOOL) :: data_logic - LOGICAL (kind = C_BOOL) :: is_var_existed - END SUBROUTINE cxios_get_variable_data_logic - - SUBROUTINE cxios_get_variable_data_char(vardid, varid_size, data_char, data_size_in, is_var_existed) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: vardid - INTEGER (kind = C_INT) , VALUE :: varid_size - INTEGER (kind = C_INT) , VALUE :: data_size_in - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: data_char - LOGICAL (kind = C_BOOL) :: is_var_existed - END SUBROUTINE cxios_get_variable_data_char - - ! Binding C and Fortran interface of set_variable (icdata.cpp) - SUBROUTINE cxios_set_variable_data_k8(vardid, varid_size, data_k8, is_var_existed) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: vardid - INTEGER (kind = C_INT) , VALUE :: varid_size - REAL (kind = C_DOUBLE), VALUE :: data_k8 - LOGICAL (kind = C_BOOL) :: is_var_existed - END SUBROUTINE cxios_set_variable_data_k8 - - SUBROUTINE cxios_set_variable_data_k4(vardid, varid_size, data_k4, is_var_existed) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: vardid - INTEGER (kind = C_INT) , VALUE :: varid_size - REAL (kind = C_FLOAT) , VALUE :: data_k4 - LOGICAL (kind = C_BOOL) :: is_var_existed - END SUBROUTINE cxios_set_variable_data_k4 - - SUBROUTINE cxios_set_variable_data_int(vardid, varid_size, data_int, is_var_existed) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: vardid - INTEGER (kind = C_INT) , VALUE :: varid_size - INTEGER (kind = C_INT) , VALUE :: data_int - LOGICAL (kind = C_BOOL) :: is_var_existed - END SUBROUTINE cxios_set_variable_data_int - - SUBROUTINE cxios_set_variable_data_logic(vardid, varid_size, data_logic, is_var_existed) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: vardid - INTEGER (kind = C_INT) , VALUE :: varid_size - LOGICAL (kind = C_BOOL) , VALUE :: data_logic - LOGICAL (kind = C_BOOL) :: is_var_existed - END SUBROUTINE cxios_set_variable_data_logic - - SUBROUTINE cxios_set_variable_data_char(vardid, varid_size, data_char, data_size_in, is_var_existed) BIND(C) - USE ISO_C_BINDING - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: vardid - INTEGER (kind = C_INT) , VALUE :: varid_size - INTEGER (kind = C_INT) , VALUE :: data_size_in - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: data_char - LOGICAL (kind = C_BOOL) :: is_var_existed - END SUBROUTINE cxios_set_variable_data_char - - END INTERFACE - - - CONTAINS ! Fonctions disponibles pour les utilisateurs. - - SUBROUTINE xios(init_server)() - IMPLICIT NONE - CALL cxios_init_server() - END SUBROUTINE xios(init_server) - - SUBROUTINE xios(initialize)(client_id, local_comm, return_comm) - IMPLICIT NONE - INCLUDE 'mpif.h' - CHARACTER(LEN=*),INTENT(IN) :: client_id - INTEGER,INTENT(IN),OPTIONAL :: local_comm - INTEGER,INTENT(OUT),OPTIONAL :: return_comm - INTEGER :: f_local_comm - INTEGER :: f_return_comm - - IF (PRESENT(local_comm)) THEN - f_local_comm=local_comm - ELSE - f_local_comm = MPI_COMM_NULL - ENDIF - - CALL cxios_init_client(client_id,LEN(client_id),f_local_comm,f_return_comm) - - IF (PRESENT(return_comm)) return_comm=f_return_comm - - END SUBROUTINE xios(initialize) - - - SUBROUTINE xios(context_initialize)(context_id,comm) - IMPLICIT NONE - CHARACTER(LEN=*),INTENT(IN) :: context_id - INTEGER, INTENT(IN) :: comm - - CALL cxios_context_initialize(context_id,LEN(context_id),comm) - - END SUBROUTINE xios(context_initialize) - - - LOGICAL FUNCTION xios(context_is_initialized)(context_id) - USE ISO_C_BINDING - IMPLICIT NONE - CHARACTER(LEN=*),INTENT(IN) :: context_id - LOGICAL(KIND=C_BOOL) :: is_init - - CALL cxios_context_is_initialized(context_id, LEN(context_id), is_init) - xios(context_is_initialized) = is_init - - END FUNCTION xios(context_is_initialized) - - - SUBROUTINE xios(finalize) - IMPLICIT NONE - - CALL cxios_finalize - - END SUBROUTINE xios(finalize) - - SUBROUTINE xios(oasis_enddef) - IMPLICIT NONE - - CALL cxios_oasis_enddef - - END SUBROUTINE xios(oasis_enddef) - - SUBROUTINE xios(close_context_definition)() - IMPLICIT NONE - CALL cxios_context_close_definition() - END SUBROUTINE xios(close_context_definition) - - - SUBROUTINE xios(context_finalize)() - IMPLICIT NONE - CALL cxios_context_finalize() - END SUBROUTINE xios(context_finalize) - - SUBROUTINE xios(solve_inheritance)() - IMPLICIT NONE - CALL cxios_solve_inheritance() - END SUBROUTINE xios(solve_inheritance) - - ! Send field functions - SUBROUTINE xios(send_field_r8_0d_hdl)(field_hdl, data_k8) - IMPLICIT NONE - TYPE(txios(field)) :: field_hdl - REAL (kind = 8), INTENT(IN) :: data_k8 - CALL cxios_write_data_k80_hdl(field_hdl%daddr, data_k8, 1) - END SUBROUTINE xios(send_field_r8_0d_hdl) - - SUBROUTINE xios(send_field_r8_0d)(fieldid, data_k8) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: fieldid - REAL (kind = 8), INTENT(IN) :: data_k8 - CALL cxios_write_data_k80(fieldid, len(fieldid), data_k8, 1) - END SUBROUTINE xios(send_field_r8_0d) - - SUBROUTINE xios(send_field_r8_1d_hdl)(field_hdl, data1d_k8) - IMPLICIT NONE - TYPE(txios(field)) :: field_hdl - REAL (kind = 8), DIMENSION(*), INTENT(IN) :: data1d_k8(:) - CALL cxios_write_data_k81_hdl(field_hdl%daddr, data1d_k8, size(data1d_k8, 1)) - END SUBROUTINE xios(send_field_r8_1d_hdl) - - SUBROUTINE xios(send_field_r8_1d)(fieldid, data1d_k8) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: fieldid - REAL (kind = 8), DIMENSION(*), INTENT(IN) :: data1d_k8(:) - CALL cxios_write_data_k81(fieldid, len(fieldid), data1d_k8, size(data1d_k8, 1)) - END SUBROUTINE xios(send_field_r8_1d) - - SUBROUTINE xios(send_field_r8_2d_hdl)(field_hdl, data2d_k8) - IMPLICIT NONE - TYPE(txios(field)) :: field_hdl - REAL (kind = 8), DIMENSION(*), INTENT(IN) :: data2d_k8(:,:) - CALL cxios_write_data_k82_hdl(field_hdl%daddr, data2d_k8, size(data2d_k8, 1), size(data2d_k8, 2)) - END SUBROUTINE xios(send_field_r8_2d_hdl) - - SUBROUTINE xios(send_field_r8_2d)(fieldid, data2d_k8) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: fieldid - REAL (kind = 8), DIMENSION(*), INTENT(IN) :: data2d_k8(:,:) - CALL cxios_write_data_k82(fieldid, len(fieldid), data2d_k8, size(data2d_k8, 1), size(data2d_k8, 2)) - END SUBROUTINE xios(send_field_r8_2d) - - SUBROUTINE xios(send_field_r8_3d_hdl)(field_hdl, data3d_k8) - IMPLICIT NONE - TYPE(txios(field)) :: field_hdl - REAL (kind = 8), DIMENSION(*), INTENT(IN) :: data3d_k8(:,:,:) - CALL cxios_write_data_k83_hdl(field_hdl%daddr, data3d_k8, size(data3d_k8, 1), size(data3d_k8, 2), size(data3d_k8, 3)) - END SUBROUTINE xios(send_field_r8_3d_hdl) - - SUBROUTINE xios(send_field_r8_3d)(fieldid, data3d_k8) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: fieldid - REAL (kind = 8), DIMENSION(*), INTENT(IN) :: data3d_k8(:,:,:) - CALL cxios_write_data_k83(fieldid, len(fieldid), data3d_k8, size(data3d_k8, 1), size(data3d_k8, 2), size(data3d_k8, 3)) - END SUBROUTINE xios(send_field_r8_3d) - - SUBROUTINE xios(send_field_r8_4d_hdl)(field_hdl, data4d_k8) - IMPLICIT NONE - TYPE(txios(field)) :: field_hdl - REAL (kind = 8), DIMENSION(*), INTENT(IN) :: data4d_k8(:,:,:,:) - CALL cxios_write_data_k84_hdl(field_hdl%daddr, data4d_k8, & - size(data4d_k8, 1), size(data4d_k8, 2), size(data4d_k8, 3), & - size(data4d_k8, 4)) - END SUBROUTINE xios(send_field_r8_4d_hdl) - - SUBROUTINE xios(send_field_r8_4d)(fieldid, data4d_k8) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: fieldid - REAL (kind = 8), DIMENSION(*), INTENT(IN) :: data4d_k8(:,:,:,:) - CALL cxios_write_data_k84(fieldid, len(fieldid), data4d_k8, & - size(data4d_k8, 1), size(data4d_k8, 2), size(data4d_k8, 3), & - size(data4d_k8, 4)) - END SUBROUTINE xios(send_field_r8_4d) - - SUBROUTINE xios(send_field_r8_5d_hdl)(field_hdl, data5d_k8) - IMPLICIT NONE - TYPE(txios(field)) :: field_hdl - REAL (kind = 8), DIMENSION(*), INTENT(IN) :: data5d_k8(:,:,:,:,:) - CALL cxios_write_data_k85_hdl(field_hdl%daddr, data5d_k8, & - size(data5d_k8, 1), size(data5d_k8, 2), size(data5d_k8, 3), & - size(data5d_k8, 4), size(data5d_k8, 5)) - END SUBROUTINE xios(send_field_r8_5d_hdl) - - SUBROUTINE xios(send_field_r8_5d)(fieldid, data5d_k8) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: fieldid - REAL (kind = 8), DIMENSION(*), INTENT(IN) :: data5d_k8(:,:,:,:,:) - CALL cxios_write_data_k85(fieldid, len(fieldid), data5d_k8, & - size(data5d_k8, 1), size(data5d_k8, 2), size(data5d_k8, 3), & - size(data5d_k8, 4), size(data5d_k8, 5)) - END SUBROUTINE xios(send_field_r8_5d) - - SUBROUTINE xios(send_field_r8_6d_hdl)(field_hdl, data6d_k8) - IMPLICIT NONE - TYPE(txios(field)) :: field_hdl - REAL (kind = 8), DIMENSION(*), INTENT(IN) :: data6d_k8(:,:,:,:,:,:) - CALL cxios_write_data_k86_hdl(field_hdl%daddr, data6d_k8, & - size(data6d_k8, 1), size(data6d_k8, 2), size(data6d_k8, 3), & - size(data6d_k8, 4), size(data6d_k8, 5), size(data6d_k8, 6)) - END SUBROUTINE xios(send_field_r8_6d_hdl) - - SUBROUTINE xios(send_field_r8_6d)(fieldid, data6d_k8) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: fieldid - REAL (kind = 8), DIMENSION(*), INTENT(IN) :: data6d_k8(:,:,:,:,:,:) - CALL cxios_write_data_k86(fieldid, len(fieldid), data6d_k8, & - size(data6d_k8, 1), size(data6d_k8, 2), size(data6d_k8, 3), & - size(data6d_k8, 4), size(data6d_k8, 5), size(data6d_k8, 6)) - END SUBROUTINE xios(send_field_r8_6d) - - SUBROUTINE xios(send_field_r8_7d_hdl)(field_hdl, data7d_k8) - IMPLICIT NONE - TYPE(txios(field)) :: field_hdl - REAL (kind = 8), DIMENSION(*), INTENT(IN) :: data7d_k8(:,:,:,:,:,:,:) - CALL cxios_write_data_k87_hdl(field_hdl%daddr, data7d_k8, & - size(data7d_k8, 1), size(data7d_k8, 2), size(data7d_k8, 3), & - size(data7d_k8, 4), size(data7d_k8, 5), size(data7d_k8, 6), & - size(data7d_k8, 7)) - END SUBROUTINE xios(send_field_r8_7d_hdl) - - SUBROUTINE xios(send_field_r8_7d)(fieldid, data7d_k8) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: fieldid - REAL (kind = 8), DIMENSION(*), INTENT(IN) :: data7d_k8(:,:,:,:,:,:,:) - CALL cxios_write_data_k87(fieldid, len(fieldid), data7d_k8, & - size(data7d_k8, 1), size(data7d_k8, 2), size(data7d_k8, 3), & - size(data7d_k8, 4), size(data7d_k8, 5), size(data7d_k8, 6), & - size(data7d_k8, 7)) - END SUBROUTINE xios(send_field_r8_7d) - - SUBROUTINE xios(send_field_r4_0d_hdl)(field_hdl, data_k4) - IMPLICIT NONE - TYPE(txios(field)) :: field_hdl - REAL (kind = 4), INTENT(IN) :: data_k4 - CALL cxios_write_data_k40_hdl(field_hdl%daddr, data_k4, 1) - END SUBROUTINE xios(send_field_r4_0d_hdl) - - SUBROUTINE xios(send_field_r4_0d)(fieldid, data_k4) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: fieldid - REAL (kind = 4), INTENT(IN) :: data_k4 - CALL cxios_write_data_k40(fieldid, len(fieldid), data_k4, 1) - END SUBROUTINE xios(send_field_r4_0d) - - SUBROUTINE xios(send_field_r4_1d_hdl)(field_hdl, data1d_k4) - IMPLICIT NONE - TYPE(txios(field)) :: field_hdl - REAL (kind = 4), DIMENSION(*), INTENT(IN) :: data1d_k4(:) - CALL cxios_write_data_k41_hdl(field_hdl%daddr, data1d_k4, size(data1d_k4, 1)) - END SUBROUTINE xios(send_field_r4_1d_hdl) - - SUBROUTINE xios(send_field_r4_1d)(fieldid, data1d_k4) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: fieldid - REAL (kind = 4), DIMENSION(*), INTENT(IN) :: data1d_k4(:) - CALL cxios_write_data_k41(fieldid, len(fieldid), data1d_k4, size(data1d_k4, 1)) - END SUBROUTINE xios(send_field_r4_1d) - - SUBROUTINE xios(send_field_r4_2d_hdl)(field_hdl, data2d_k4) - IMPLICIT NONE - TYPE(txios(field)) :: field_hdl - REAL (kind = 4), DIMENSION(*), INTENT(IN) :: data2d_k4(:,:) - CALL cxios_write_data_k42_hdl(field_hdl%daddr, data2d_k4, size(data2d_k4, 1), size(data2d_k4, 2)) - END SUBROUTINE xios(send_field_r4_2d_hdl) - - SUBROUTINE xios(send_field_r4_2d)(fieldid, data2d_k4) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: fieldid - REAL (kind = 4), DIMENSION(*), INTENT(IN) :: data2d_k4(:,:) - CALL cxios_write_data_k42(fieldid, len(fieldid), data2d_k4, size(data2d_k4, 1), size(data2d_k4, 2)) - END SUBROUTINE xios(send_field_r4_2d) - - SUBROUTINE xios(send_field_r4_3d_hdl)(field_hdl, data3d_k4) - IMPLICIT NONE - TYPE(txios(field)) :: field_hdl - REAL (kind = 4), DIMENSION(*), INTENT(IN) :: data3d_k4(:,:,:) - CALL cxios_write_data_k43_hdl(field_hdl%daddr, data3d_k4, size(data3d_k4, 1), size(data3d_k4, 2), size(data3d_k4, 3)) - END SUBROUTINE xios(send_field_r4_3d_hdl) - - SUBROUTINE xios(send_field_r4_3d)(fieldid, data3d_k4) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: fieldid - REAL (kind = 4), DIMENSION(*), INTENT(IN) :: data3d_k4(:,:,:) - CALL cxios_write_data_k43(fieldid, len(fieldid), data3d_k4, size(data3d_k4, 1), size(data3d_k4, 2), size(data3d_k4, 3)) - END SUBROUTINE xios(send_field_r4_3d) - - SUBROUTINE xios(send_field_r4_4d_hdl)(field_hdl, data4d_k4) - IMPLICIT NONE - TYPE(txios(field)) :: field_hdl - REAL (kind = 4), DIMENSION(*), INTENT(IN) :: data4d_k4(:,:,:,:) - CALL cxios_write_data_k44_hdl(field_hdl%daddr, data4d_k4, & - size(data4d_k4, 1), size(data4d_k4, 2), size(data4d_k4, 3), & - size(data4d_k4, 4)) - END SUBROUTINE xios(send_field_r4_4d_hdl) - - SUBROUTINE xios(send_field_r4_4d)(fieldid, data4d_k4) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: fieldid - REAL (kind = 4), DIMENSION(*), INTENT(IN) :: data4d_k4(:,:,:,:) - CALL cxios_write_data_k44(fieldid, len(fieldid), data4d_k4, & - size(data4d_k4, 1), size(data4d_k4, 2), size(data4d_k4, 3), & - size(data4d_k4, 4)) - END SUBROUTINE xios(send_field_r4_4d) - - SUBROUTINE xios(send_field_r4_5d_hdl)(field_hdl, data5d_k4) - IMPLICIT NONE - TYPE(txios(field)) :: field_hdl - REAL (kind = 4), DIMENSION(*), INTENT(IN) :: data5d_k4(:,:,:,:,:) - CALL cxios_write_data_k45_hdl(field_hdl%daddr, data5d_k4, & - size(data5d_k4, 1), size(data5d_k4, 2), size(data5d_k4, 3), & - size(data5d_k4, 4), size(data5d_k4, 5)) - END SUBROUTINE xios(send_field_r4_5d_hdl) - - SUBROUTINE xios(send_field_r4_5d)(fieldid, data5d_k4) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: fieldid - REAL (kind = 4), DIMENSION(*), INTENT(IN) :: data5d_k4(:,:,:,:,:) - CALL cxios_write_data_k45(fieldid, len(fieldid), data5d_k4, & - size(data5d_k4, 1), size(data5d_k4, 2), size(data5d_k4, 3), & - size(data5d_k4, 4), size(data5d_k4, 5)) - END SUBROUTINE xios(send_field_r4_5d) - - SUBROUTINE xios(send_field_r4_6d_hdl)(field_hdl, data6d_k4) - IMPLICIT NONE - TYPE(txios(field)) :: field_hdl - REAL (kind = 4), DIMENSION(*), INTENT(IN) :: data6d_k4(:,:,:,:,:,:) - CALL cxios_write_data_k46_hdl(field_hdl%daddr, data6d_k4, & - size(data6d_k4, 1), size(data6d_k4, 2), size(data6d_k4, 3), & - size(data6d_k4, 4), size(data6d_k4, 5), size(data6d_k4, 6)) - END SUBROUTINE xios(send_field_r4_6d_hdl) - - SUBROUTINE xios(send_field_r4_6d)(fieldid, data6d_k4) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: fieldid - REAL (kind = 4), DIMENSION(*), INTENT(IN) :: data6d_k4(:,:,:,:,:,:) - CALL cxios_write_data_k46(fieldid, len(fieldid), data6d_k4, & - size(data6d_k4, 1), size(data6d_k4, 2), size(data6d_k4, 3), & - size(data6d_k4, 4), size(data6d_k4, 5), size(data6d_k4, 6)) - END SUBROUTINE xios(send_field_r4_6d) - - SUBROUTINE xios(send_field_r4_7d_hdl)(field_hdl, data7d_k4) - IMPLICIT NONE - TYPE(txios(field)) :: field_hdl - REAL (kind = 4), DIMENSION(*), INTENT(IN) :: data7d_k4(:,:,:,:,:,:,:) - CALL cxios_write_data_k47_hdl(field_hdl%daddr, data7d_k4, & - size(data7d_k4, 1), size(data7d_k4, 2), size(data7d_k4, 3), & - size(data7d_k4, 4), size(data7d_k4, 5), size(data7d_k4, 6), & - size(data7d_k4, 7)) - END SUBROUTINE xios(send_field_r4_7d_hdl) - - SUBROUTINE xios(send_field_r4_7d)(fieldid, data7d_k4) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: fieldid - REAL (kind = 4), DIMENSION(*), INTENT(IN) :: data7d_k4(:,:,:,:,:,:,:) - CALL cxios_write_data_k47(fieldid, len(fieldid), data7d_k4, & - size(data7d_k4, 1), size(data7d_k4, 2), size(data7d_k4, 3), & - size(data7d_k4, 4), size(data7d_k4, 5), size(data7d_k4, 6), & - size(data7d_k4, 7)) - END SUBROUTINE xios(send_field_r4_7d) - - ! Receive field functions - SUBROUTINE xios(recv_field_r8_0d_hdl)(field_hdl, data0d_k8) - IMPLICIT NONE - TYPE(txios(field)) :: field_hdl - REAL (kind = 8) , INTENT(OUT):: data0d_k8 - CALL cxios_read_data_k80_hdl(field_hdl%daddr, data0d_k8, 1) - END SUBROUTINE xios(recv_field_r8_0d_hdl) - - SUBROUTINE xios(recv_field_r8_0d)(fieldid, data0d_k8) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: fieldid - REAL (kind = 8) , INTENT(OUT):: data0d_k8 - CALL cxios_read_data_k80(fieldid, len(fieldid), data0d_k8, 1) - END SUBROUTINE xios(recv_field_r8_0d) - - SUBROUTINE xios(recv_field_r8_1d_hdl)(field_hdl, data1d_k8) - IMPLICIT NONE - TYPE(txios(field)) :: field_hdl - REAL (kind = 8), DIMENSION(*), INTENT(OUT) :: data1d_k8(:) - CALL cxios_read_data_k81_hdl(field_hdl%daddr, data1d_k8, size(data1d_k8, 1)) - END SUBROUTINE xios(recv_field_r8_1d_hdl) - - SUBROUTINE xios(recv_field_r8_1d)(fieldid, data1d_k8) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: fieldid - REAL (kind = 8), DIMENSION(*), INTENT(OUT) :: data1d_k8(:) - CALL cxios_read_data_k81(fieldid, len(fieldid), data1d_k8, size(data1d_k8, 1)) - END SUBROUTINE xios(recv_field_r8_1d) - - SUBROUTINE xios(recv_field_r8_2d_hdl)(field_hdl, data2d_k8) - IMPLICIT NONE - TYPE(txios(field)) :: field_hdl - REAL (kind = 8), DIMENSION(*), INTENT(OUT) :: data2d_k8(:,:) - CALL cxios_read_data_k82_hdl(field_hdl%daddr, data2d_k8, size(data2d_k8, 1), size(data2d_k8, 2)) - END SUBROUTINE xios(recv_field_r8_2d_hdl) - - SUBROUTINE xios(recv_field_r8_2d)(fieldid, data2d_k8) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: fieldid - REAL (kind = 8), DIMENSION(*), INTENT(OUT) :: data2d_k8(:,:) - CALL cxios_read_data_k82(fieldid, len(fieldid), data2d_k8, size(data2d_k8, 1), size(data2d_k8, 2)) - END SUBROUTINE xios(recv_field_r8_2d) - - SUBROUTINE xios(recv_field_r8_3d_hdl)(field_hdl, data3d_k8) - IMPLICIT NONE - TYPE(txios(field)) :: field_hdl - REAL (kind = 8), DIMENSION(*), INTENT(OUT) :: data3d_k8(:,:,:) - CALL cxios_read_data_k83_hdl(field_hdl%daddr, data3d_k8, size(data3d_k8, 1), size(data3d_k8, 2), size(data3d_k8, 3)) - END SUBROUTINE xios(recv_field_r8_3d_hdl) - - SUBROUTINE xios(recv_field_r8_3d)(fieldid, data3d_k8) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: fieldid - REAL (kind = 8), DIMENSION(*), INTENT(OUT) :: data3d_k8(:,:,:) - CALL cxios_read_data_k83(fieldid, len(fieldid), data3d_k8, size(data3d_k8, 1), size(data3d_k8, 2), size(data3d_k8, 3)) - END SUBROUTINE xios(recv_field_r8_3d) - - SUBROUTINE xios(recv_field_r8_4d_hdl)(field_hdl, data4d_k8) - IMPLICIT NONE - TYPE(txios(field)) :: field_hdl - REAL (kind = 8), DIMENSION(*), INTENT(OUT) :: data4d_k8(:,:,:,:) - CALL cxios_read_data_k84_hdl(field_hdl%daddr, data4d_k8, & - size(data4d_k8, 1), size(data4d_k8, 2), size(data4d_k8, 3), & - size(data4d_k8, 4)) - END SUBROUTINE xios(recv_field_r8_4d_hdl) - - SUBROUTINE xios(recv_field_r8_4d)(fieldid, data4d_k8) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: fieldid - REAL (kind = 8), DIMENSION(*), INTENT(OUT) :: data4d_k8(:,:,:,:) - CALL cxios_read_data_k84(fieldid, len(fieldid), data4d_k8, & - size(data4d_k8, 1), size(data4d_k8, 2), size(data4d_k8, 3), & - size(data4d_k8, 4)) - END SUBROUTINE xios(recv_field_r8_4d) - - SUBROUTINE xios(recv_field_r8_5d_hdl)(field_hdl, data5d_k8) - IMPLICIT NONE - TYPE(txios(field)) :: field_hdl - REAL (kind = 8), DIMENSION(*), INTENT(OUT) :: data5d_k8(:,:,:,:,:) - CALL cxios_read_data_k85_hdl(field_hdl%daddr, data5d_k8, & - size(data5d_k8, 1), size(data5d_k8, 2), size(data5d_k8, 3), & - size(data5d_k8, 4), size(data5d_k8, 5)) - END SUBROUTINE xios(recv_field_r8_5d_hdl) - - SUBROUTINE xios(recv_field_r8_5d)(fieldid, data5d_k8) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: fieldid - REAL (kind = 8), DIMENSION(*), INTENT(OUT) :: data5d_k8(:,:,:,:,:) - CALL cxios_read_data_k85(fieldid, len(fieldid), data5d_k8, & - size(data5d_k8, 1), size(data5d_k8, 2), size(data5d_k8, 3), & - size(data5d_k8, 4), size(data5d_k8, 5)) - END SUBROUTINE xios(recv_field_r8_5d) - - SUBROUTINE xios(recv_field_r8_6d_hdl)(field_hdl, data6d_k8) - IMPLICIT NONE - TYPE(txios(field)) :: field_hdl - REAL (kind = 8), DIMENSION(*), INTENT(OUT) :: data6d_k8(:,:,:,:,:,:) - CALL cxios_read_data_k86_hdl(field_hdl%daddr, data6d_k8, & - size(data6d_k8, 1), size(data6d_k8, 2), size(data6d_k8, 3), & - size(data6d_k8, 4), size(data6d_k8, 5), size(data6d_k8, 6)) - END SUBROUTINE xios(recv_field_r8_6d_hdl) - - SUBROUTINE xios(recv_field_r8_6d)(fieldid, data6d_k8) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: fieldid - REAL (kind = 8), DIMENSION(*), INTENT(OUT) :: data6d_k8(:,:,:,:,:,:) - CALL cxios_read_data_k86(fieldid, len(fieldid), data6d_k8, & - size(data6d_k8, 1), size(data6d_k8, 2), size(data6d_k8, 3), & - size(data6d_k8, 4), size(data6d_k8, 5), size(data6d_k8, 6)) - END SUBROUTINE xios(recv_field_r8_6d) - - SUBROUTINE xios(recv_field_r8_7d_hdl)(field_hdl, data7d_k8) - IMPLICIT NONE - TYPE(txios(field)) :: field_hdl - REAL (kind = 8), DIMENSION(*), INTENT(OUT) :: data7d_k8(:,:,:,:,:,:,:) - CALL cxios_read_data_k87_hdl(field_hdl%daddr, data7d_k8, & - size(data7d_k8, 1), size(data7d_k8, 2), size(data7d_k8, 3), & - size(data7d_k8, 4), size(data7d_k8, 5), size(data7d_k8, 6), & - size(data7d_k8, 7)) - END SUBROUTINE xios(recv_field_r8_7d_hdl) - - SUBROUTINE xios(recv_field_r8_7d)(fieldid, data7d_k8) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: fieldid - REAL (kind = 8), DIMENSION(*), INTENT(OUT) :: data7d_k8(:,:,:,:,:,:,:) - CALL cxios_read_data_k87(fieldid, len(fieldid), data7d_k8, & - size(data7d_k8, 1), size(data7d_k8, 2), size(data7d_k8, 3), & - size(data7d_k8, 4), size(data7d_k8, 5), size(data7d_k8, 6), & - size(data7d_k8, 7)) - END SUBROUTINE xios(recv_field_r8_7d) - - SUBROUTINE xios(recv_field_r4_0d_hdl)(field_hdl, data0d_k4) - IMPLICIT NONE - TYPE(txios(field)) :: field_hdl - REAL (kind = 4) , INTENT(OUT):: data0d_k4 - CALL cxios_read_data_k40_hdl(field_hdl%daddr, data0d_k4, 1) - END SUBROUTINE xios(recv_field_r4_0d_hdl) - - SUBROUTINE xios(recv_field_r4_0d)(fieldid, data0d_k4) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: fieldid - REAL (kind = 4) , INTENT(OUT):: data0d_k4 - CALL cxios_read_data_k40(fieldid, len(fieldid), data0d_k4, 1) - END SUBROUTINE xios(recv_field_r4_0d) - - SUBROUTINE xios(recv_field_r4_1d_hdl)(field_hdl, data1d_k4) - IMPLICIT NONE - TYPE(txios(field)) :: field_hdl - REAL (kind = 4), DIMENSION(*), INTENT(OUT) :: data1d_k4(:) - CALL cxios_read_data_k41_hdl(field_hdl%daddr, data1d_k4, size(data1d_k4, 1)) - END SUBROUTINE xios(recv_field_r4_1d_hdl) - - SUBROUTINE xios(recv_field_r4_1d)(fieldid, data1d_k4) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: fieldid - REAL (kind = 4), DIMENSION(*), INTENT(OUT) :: data1d_k4(:) - CALL cxios_read_data_k41(fieldid, len(fieldid), data1d_k4, size(data1d_k4, 1)) - END SUBROUTINE xios(recv_field_r4_1d) - - SUBROUTINE xios(recv_field_r4_2d_hdl)(field_hdl, data2d_k4) - IMPLICIT NONE - TYPE(txios(field)) :: field_hdl - REAL (kind = 4), DIMENSION(*), INTENT(OUT) :: data2d_k4(:,:) - CALL cxios_read_data_k42_hdl(field_hdl%daddr, data2d_k4, size(data2d_k4, 1), size(data2d_k4, 2)) - END SUBROUTINE xios(recv_field_r4_2d_hdl) - - SUBROUTINE xios(recv_field_r4_2d)(fieldid, data2d_k4) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: fieldid - REAL (kind = 4), DIMENSION(*), INTENT(OUT) :: data2d_k4(:,:) - CALL cxios_read_data_k42(fieldid, len(fieldid), data2d_k4, size(data2d_k4, 1), size(data2d_k4, 2)) - END SUBROUTINE xios(recv_field_r4_2d) - - SUBROUTINE xios(recv_field_r4_3d_hdl)(field_hdl, data3d_k4) - IMPLICIT NONE - TYPE(txios(field)) :: field_hdl - REAL (kind = 4), DIMENSION(*), INTENT(OUT) :: data3d_k4(:,:,:) - CALL cxios_read_data_k43_hdl(field_hdl%daddr, data3d_k4, size(data3d_k4, 1), size(data3d_k4, 2), size(data3d_k4, 3)) - END SUBROUTINE xios(recv_field_r4_3d_hdl) - - SUBROUTINE xios(recv_field_r4_3d)(fieldid, data3d_k4) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: fieldid - REAL (kind = 4), DIMENSION(*), INTENT(OUT) :: data3d_k4(:,:,:) - CALL cxios_read_data_k43(fieldid, len(fieldid), data3d_k4, size(data3d_k4, 1), size(data3d_k4, 2), size(data3d_k4, 3)) - END SUBROUTINE xios(recv_field_r4_3d) - - SUBROUTINE xios(recv_field_r4_4d_hdl)(field_hdl, data4d_k4) - IMPLICIT NONE - TYPE(txios(field)) :: field_hdl - REAL (kind = 4), DIMENSION(*), INTENT(OUT) :: data4d_k4(:,:,:,:) - CALL cxios_read_data_k44_hdl(field_hdl%daddr, data4d_k4, & - size(data4d_k4, 1), size(data4d_k4, 2), size(data4d_k4, 3), & - size(data4d_k4, 4)) - END SUBROUTINE xios(recv_field_r4_4d_hdl) - - SUBROUTINE xios(recv_field_r4_4d)(fieldid, data4d_k4) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: fieldid - REAL (kind = 4), DIMENSION(*), INTENT(OUT) :: data4d_k4(:,:,:,:) - CALL cxios_read_data_k44(fieldid, len(fieldid), data4d_k4, & - size(data4d_k4, 1), size(data4d_k4, 2), size(data4d_k4, 3), & - size(data4d_k4, 4)) - END SUBROUTINE xios(recv_field_r4_4d) - - SUBROUTINE xios(recv_field_r4_5d_hdl)(field_hdl, data5d_k4) - IMPLICIT NONE - TYPE(txios(field)) :: field_hdl - REAL (kind = 4), DIMENSION(*), INTENT(OUT) :: data5d_k4(:,:,:,:,:) - CALL cxios_read_data_k45_hdl(field_hdl%daddr, data5d_k4, & - size(data5d_k4, 1), size(data5d_k4, 2), size(data5d_k4, 3), & - size(data5d_k4, 4), size(data5d_k4, 5)) - END SUBROUTINE xios(recv_field_r4_5d_hdl) - - SUBROUTINE xios(recv_field_r4_5d)(fieldid, data5d_k4) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: fieldid - REAL (kind = 4), DIMENSION(*), INTENT(OUT) :: data5d_k4(:,:,:,:,:) - CALL cxios_read_data_k45(fieldid, len(fieldid), data5d_k4, & - size(data5d_k4, 1), size(data5d_k4, 2), size(data5d_k4, 3), & - size(data5d_k4, 4), size(data5d_k4, 5)) - END SUBROUTINE xios(recv_field_r4_5d) - - SUBROUTINE xios(recv_field_r4_6d_hdl)(field_hdl, data6d_k4) - IMPLICIT NONE - TYPE(txios(field)) :: field_hdl - REAL (kind = 4), DIMENSION(*), INTENT(OUT) :: data6d_k4(:,:,:,:,:,:) - CALL cxios_read_data_k46_hdl(field_hdl%daddr, data6d_k4, & - size(data6d_k4, 1), size(data6d_k4, 2), size(data6d_k4, 3), & - size(data6d_k4, 4), size(data6d_k4, 5), size(data6d_k4, 6)) - END SUBROUTINE xios(recv_field_r4_6d_hdl) - - SUBROUTINE xios(recv_field_r4_6d)(fieldid, data6d_k4) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: fieldid - REAL (kind = 4), DIMENSION(*), INTENT(OUT) :: data6d_k4(:,:,:,:,:,:) - CALL cxios_read_data_k46(fieldid, len(fieldid), data6d_k4, & - size(data6d_k4, 1), size(data6d_k4, 2), size(data6d_k4, 3), & - size(data6d_k4, 4), size(data6d_k4, 5), size(data6d_k4, 6)) - END SUBROUTINE xios(recv_field_r4_6d) - - SUBROUTINE xios(recv_field_r4_7d_hdl)(field_hdl, data7d_k4) - IMPLICIT NONE - TYPE(txios(field)) :: field_hdl - REAL (kind = 4), DIMENSION(*), INTENT(OUT) :: data7d_k4(:,:,:,:,:,:,:) - CALL cxios_read_data_k47_hdl(field_hdl%daddr, data7d_k4, & - size(data7d_k4, 1), size(data7d_k4, 2), size(data7d_k4, 3), & - size(data7d_k4, 4), size(data7d_k4, 5), size(data7d_k4, 6), & - size(data7d_k4, 7)) - END SUBROUTINE xios(recv_field_r4_7d_hdl) - - SUBROUTINE xios(recv_field_r4_7d)(fieldid, data7d_k4) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: fieldid - REAL (kind = 4), DIMENSION(*), INTENT(OUT) :: data7d_k4(:,:,:,:,:,:,:) - CALL cxios_read_data_k47(fieldid, len(fieldid), data7d_k4, & - size(data7d_k4, 1), size(data7d_k4, 2), size(data7d_k4, 3), & - size(data7d_k4, 4), size(data7d_k4, 5), size(data7d_k4, 6), & - size(data7d_k4, 7)) - END SUBROUTINE xios(recv_field_r4_7d) - - ! Get variable functions - LOGICAL FUNCTION xios(getVar_k8)(varId, data_k8) - USE ISO_C_BINDING - IMPLICIT NONE - LOGICAL (kind = C_BOOL) :: val - CHARACTER(len = *) , INTENT(IN) :: varId - REAL (kind = 8) , INTENT(OUT):: data_k8 - - CALL cxios_get_variable_data_k8(varId, len(varId), data_k8, val) - - xios(getVar_k8) = val - END FUNCTION xios(getVar_k8) - - LOGICAL FUNCTION xios(getVar_k4)(varId, data_k4) - USE ISO_C_BINDING - IMPLICIT NONE - LOGICAL (kind = C_BOOL) :: val - CHARACTER(len = *) , INTENT(IN) :: varId - REAL (kind = 4) , INTENT(OUT):: data_k4 - - CALL cxios_get_variable_data_k4(varId, len(varId), data_k4, val) - - xios(getVar_k4) = val - END FUNCTION xios(getVar_k4) - - LOGICAL FUNCTION xios(getVar_int)(varId, data_int) - USE ISO_C_BINDING - IMPLICIT NONE - LOGICAL (kind = C_BOOL) :: val - CHARACTER(len = *) , INTENT(IN) :: varId - INTEGER , INTENT(OUT):: data_int - - CALL cxios_get_variable_data_int(varId, len(varId), data_int, val) - - xios(getVar_int) = val - END FUNCTION xios(getVar_int) - - LOGICAL FUNCTION xios(getVar_logic)(varId, data_logic) - USE ISO_C_BINDING - IMPLICIT NONE - LOGICAL (kind = C_BOOL) :: val - CHARACTER(len = *) , INTENT(IN) :: varId - LOGICAL ,INTENT(OUT) :: data_logic - LOGICAL (C_BOOL) :: data_tmp - - CALL cxios_get_variable_data_logic(varId, len(varId), data_tmp, val) - xios(getVar_logic) = val - IF (val) data_logic = data_tmp - END FUNCTION xios(getVar_logic) - - LOGICAL FUNCTION xios(getVar_char)(varId, data_char) - USE ISO_C_BINDING - IMPLICIT NONE - LOGICAL (kind = C_BOOL) :: val - CHARACTER(len = *) , INTENT(IN) :: varId - CHARACTER(len = *) , INTENT(OUT):: data_char - - CALL cxios_get_variable_data_char(varId, len(varId), data_char, len(data_char), val) - - xios(getVar_char) = val - END FUNCTION xios(getVar_char) - - ! Set variable functions - LOGICAL FUNCTION xios(setVar_k8)(varId, data_k8) - USE ISO_C_BINDING - IMPLICIT NONE - LOGICAL (kind = C_BOOL) :: val - CHARACTER(len = *) , INTENT(IN) :: varId - REAL (kind = 8) , INTENT(IN) :: data_k8 - - CALL cxios_set_variable_data_k8(varId, len(varId), data_k8, val) - - xios(setVar_k8) = val - END FUNCTION xios(setVar_k8) - - LOGICAL FUNCTION xios(setVar_k4)(varId, data_k4) - USE ISO_C_BINDING - IMPLICIT NONE - LOGICAL (kind = C_BOOL) :: val - CHARACTER(len = *) , INTENT(IN) :: varId - REAL (kind = 4) , INTENT(IN) :: data_k4 - - CALL cxios_set_variable_data_k4(varId, len(varId), data_k4, val) - - xios(setVar_k4) = val - END FUNCTION xios(setVar_k4) - - LOGICAL FUNCTION xios(setVar_int)(varId, data_int) - USE ISO_C_BINDING - IMPLICIT NONE - LOGICAL (kind = C_BOOL) :: val - CHARACTER(len = *) , INTENT(IN) :: varId - INTEGER , INTENT(IN) :: data_int - - CALL cxios_set_variable_data_int(varId, len(varId), data_int, val) - - xios(setVar_int) = val - END FUNCTION xios(setVar_int) - - LOGICAL FUNCTION xios(setVar_logic)(varId, data_logic) - USE ISO_C_BINDING - IMPLICIT NONE - LOGICAL(kind = C_BOOL) :: val - CHARACTER(len = *) , INTENT(IN) :: varId - LOGICAL , INTENT(IN) :: data_logic - LOGICAL (kind = C_BOOL) :: data_tmp - - data_tmp = data_logic - CALL cxios_set_variable_data_logic(varId, len(varId), data_tmp, val) - - xios(setVar_logic) = val - END FUNCTION xios(setVar_logic) - - LOGICAL FUNCTION xios(setVar_char)(varId, data_char) - USE ISO_C_BINDING - IMPLICIT NONE - LOGICAL (kind = C_BOOL) :: val - CHARACTER(len = *) , INTENT(IN) :: varId - CHARACTER(len = *) , INTENT(IN) :: data_char - - CALL cxios_set_variable_data_char(varId, len(varId), data_char, len(data_char), val) - - xios(setVar_char) = val - END FUNCTION xios(setVar_char) - -END MODULE IDATA diff --git a/xios_2311_src/trunk/.svn/pristine/5d/5d14d9db836869623347ef7c51f90b2c198b74be.svn-base b/xios_2311_src/trunk/.svn/pristine/5d/5d14d9db836869623347ef7c51f90b2c198b74be.svn-base deleted file mode 100644 index 1dbb554b7ead81549ec23c451c69b769e98c93de..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/5d/5d14d9db836869623347ef7c51f90b2c198b74be.svn-base +++ /dev/null @@ -1,2895 +0,0 @@ -#include "nc4_data_output.hpp" - -#include "attribute_template.hpp" -#include "group_template.hpp" - -#include "file.hpp" -#include "calendar.hpp" -#include "context.hpp" -#include "context_server.hpp" -#include "netCdfException.hpp" -#include "exception.hpp" -#include "timer.hpp" -#include "uuid.hpp" -namespace xios -{ - /// ////////////////////// Dfinitions ////////////////////// /// - CNc4DataOutput::CNc4DataOutput - (CFile* file, const StdString & filename, bool exist) - : SuperClass() - , SuperClassWriter(filename, exist) - , filename(filename) - , file(file),hasTimeInstant(false),hasTimeCentered(false), timeCounterType(none) - { - SuperClass::type = MULTI_FILE; - compressionLevel= file->compression_level.isEmpty() ? 0 :file->compression_level ; - } - - CNc4DataOutput::CNc4DataOutput - (CFile* file, const StdString & filename, bool exist, bool useClassicFormat, bool useCFConvention, - MPI_Comm comm_file, bool multifile, bool isCollective, const StdString& timeCounterName) - : SuperClass() - , SuperClassWriter(filename, exist, useClassicFormat, useCFConvention, &comm_file, multifile, timeCounterName) - , comm_file(comm_file) - , filename(filename) - , isCollective(isCollective) - , file(file),hasTimeInstant(false),hasTimeCentered(false), timeCounterType(none) - { - SuperClass::type = (multifile) ? MULTI_FILE : ONE_FILE; - if (file==NULL) compressionLevel = 0 ; - else compressionLevel= file->compression_level.isEmpty() ? 0 :file->compression_level ; - } - - CNc4DataOutput::~CNc4DataOutput(void) - { /* Ne rien faire de plus */ } - - ///-------------------------------------------------------------- - - const StdString & CNc4DataOutput::getFileName(void) const - { - return (this->filename); - } - - //--------------------------------------------------------------- - - void CNc4DataOutput::writeDomain_(CDomain* domain) - TRY - { - StdString lonName,latName ; - - if (domain->type == CDomain::type_attr::unstructured) - { - if (SuperClassWriter::useCFConvention) - writeUnstructuredDomain(domain) ; - else - writeUnstructuredDomainUgrid(domain) ; - return ; - } - - CContext* context = CContext::getCurrent() ; - - if (domain->IsWritten(this->filename)) return; - domain->checkAttributes(); - - if (domain->isEmpty()) - if (SuperClass::type==MULTI_FILE) return; - - std::vector dim0, dim1; - StdString domid = domain->getDomainOutputName(); - StdString appendDomid = (singleDomain) ? "" : "_"+domid ; - if (isWrittenDomain(domid)) return ; - else setWrittenDomain(domid); - - int nvertex = (domain->nvertex.isEmpty()) ? 0 : domain->nvertex; - - - StdString dimXid, dimYid ; - - nc_type typePrec ; - if (domain->prec.isEmpty()) typePrec = NC_FLOAT ; - else if (domain->prec==4) typePrec = NC_FLOAT ; - else if (domain->prec==8) typePrec = NC_DOUBLE ; - - bool isRegularDomain = (domain->type == CDomain::type_attr::rectilinear); - switch (domain->type) - { - case CDomain::type_attr::curvilinear : - - if (domain->lon_name.isEmpty()) lonName = "nav_lon"; - else lonName = domain->lon_name; - - if (domain->lat_name.isEmpty()) latName = "nav_lat"; - else latName = domain->lat_name; - - if (domain->dim_i_name.isEmpty()) dimXid=StdString("x").append(appendDomid); - else dimXid=domain->dim_i_name.getValue() + appendDomid; - - if (domain->dim_j_name.isEmpty()) dimYid=StdString("y").append(appendDomid); - else dimYid=domain->dim_j_name.getValue() + appendDomid; - - break ; - - case CDomain::type_attr::rectilinear : - - if (domain->lon_name.isEmpty()) - { - if (domain->dim_i_name.isEmpty()) - lonName = "lon"; - else - lonName = domain->dim_i_name.getValue(); - } - else lonName = domain->lon_name; - - if (domain->lat_name.isEmpty()) - { - if (domain->dim_j_name.isEmpty()) - latName = "lat"; - else - latName = domain->dim_j_name.getValue(); - } - else latName = domain->lat_name; - - if (domain->dim_i_name.isEmpty()) dimXid = lonName+appendDomid; - else dimXid = domain->dim_i_name.getValue()+appendDomid; - - if (domain->dim_j_name.isEmpty()) dimYid = latName+appendDomid; - else dimYid = domain->dim_j_name.getValue()+appendDomid; - break; - } - - StdString dimVertId = StdString("nvertex").append(appendDomid); - - string lonid,latid,bounds_lonid,bounds_latid ; - string areaId = "area" + appendDomid; - - try - { - switch (SuperClass::type) - { - case (MULTI_FILE) : - { - switch (domain->type) - { - case CDomain::type_attr::curvilinear : - dim0.push_back(dimYid); dim0.push_back(dimXid); - lonid = lonName+appendDomid; - latid = latName+appendDomid; - break ; - case CDomain::type_attr::rectilinear : - lonid = lonName+appendDomid; - latid = latName+appendDomid; - dim0.push_back(dimYid); - dim1.push_back(dimXid); - break; - } - if (!domain->bounds_lon_name.isEmpty()) bounds_lonid = domain->bounds_lon_name; - else bounds_lonid = "bounds_"+lonName+appendDomid; - if (!domain->bounds_lat_name.isEmpty()) bounds_latid = domain->bounds_lat_name; - else bounds_latid = "bounds_"+latName+appendDomid; - - SuperClassWriter::addDimension(dimXid, domain->ni); - SuperClassWriter::addDimension(dimYid, domain->nj); - - if (domain->hasBounds) - SuperClassWriter::addDimension(dimVertId, domain->nvertex); - - if (context->intraCommSize_ > 1) - { - this->writeLocalAttributes(domain->ibegin, - domain->ni, - domain->jbegin, - domain->nj, - appendDomid); - - if (singleDomain) - this->writeLocalAttributes_IOIPSL(dimXid, dimYid, - domain->ibegin, - domain->ni, - domain->jbegin, - domain->nj, - domain->ni_glo,domain->nj_glo, - context->intraCommRank_,context->intraCommSize_); - } - - if (domain->hasLonLat) - { - switch (domain->type) - { - case CDomain::type_attr::curvilinear : - SuperClassWriter::addVariable(latid, typePrec, dim0, compressionLevel); - SuperClassWriter::addVariable(lonid, typePrec, dim0, compressionLevel); - break ; - case CDomain::type_attr::rectilinear : - SuperClassWriter::addVariable(latid, typePrec, dim0, compressionLevel); - SuperClassWriter::addVariable(lonid, typePrec, dim1, compressionLevel); - break ; - } - - this->writeAxisAttributes(lonid, isRegularDomain ? "X" : "", "longitude", "Longitude", "degrees_east", domid); - this->writeAxisAttributes(latid, isRegularDomain ? "Y" : "", "latitude", "Latitude", "degrees_north", domid); - - if (domain->hasBounds) - { - SuperClassWriter::addAttribute("bounds", bounds_lonid, &lonid); - SuperClassWriter::addAttribute("bounds", bounds_latid, &latid); - - dim0.clear(); - dim0.push_back(dimYid); - dim0.push_back(dimXid); - dim0.push_back(dimVertId); - SuperClassWriter::addVariable(bounds_lonid, typePrec, dim0, compressionLevel); - SuperClassWriter::addVariable(bounds_latid, typePrec, dim0, compressionLevel); - } - } - - dim0.clear(); - dim0.push_back(dimYid); - dim0.push_back(dimXid); - - if (domain->hasArea) - { - SuperClassWriter::addVariable(areaId, typePrec, dim0, compressionLevel); - SuperClassWriter::addAttribute("standard_name", StdString("cell_area"), &areaId); - SuperClassWriter::addAttribute("units", StdString("m2"), &areaId); - } - - SuperClassWriter::definition_end(); - - if (domain->hasLonLat) - { - switch (domain->type) - { - case CDomain::type_attr::curvilinear : - SuperClassWriter::writeData(domain->latvalue, latid, isCollective, 0); - SuperClassWriter::writeData(domain->lonvalue, lonid, isCollective, 0); - break; - case CDomain::type_attr::rectilinear : - CArray lat = domain->latvalue(Range(fromStart,toEnd,domain->ni)) ; - SuperClassWriter::writeData(CArray(lat.copy()), latid, isCollective, 0); - CArray lon = domain->lonvalue(Range(0,domain->ni-1)) ; - SuperClassWriter::writeData(CArray(lon.copy()), lonid, isCollective, 0); - break; - } - - if (domain->hasBounds) - { - SuperClassWriter::writeData(domain->bounds_lonvalue, bounds_lonid, isCollective, 0); - SuperClassWriter::writeData(domain->bounds_latvalue, bounds_latid, isCollective, 0); - } - } - - if (domain->hasArea) - { - SuperClassWriter::writeData(domain->areavalue, areaId, isCollective, 0); - } - - SuperClassWriter::definition_start(); - - break; - } - case (ONE_FILE) : - { - SuperClassWriter::addDimension(dimXid, domain->ni_glo); - SuperClassWriter::addDimension(dimYid, domain->nj_glo); - - if (domain->hasBounds) - SuperClassWriter::addDimension(dimVertId, domain->nvertex); - - if (domain->hasLonLat) - { - switch (domain->type) - { - case CDomain::type_attr::curvilinear : - dim0.push_back(dimYid); dim0.push_back(dimXid); - lonid = lonName+appendDomid; - latid = latName+appendDomid; - SuperClassWriter::addVariable(latid, typePrec, dim0, compressionLevel); - SuperClassWriter::addVariable(lonid, typePrec, dim0, compressionLevel); - break; - - case CDomain::type_attr::rectilinear : - dim0.push_back(dimYid); - dim1.push_back(dimXid); - lonid = lonName+appendDomid; - latid = latName+appendDomid; - SuperClassWriter::addVariable(latid, typePrec, dim0, compressionLevel); - SuperClassWriter::addVariable(lonid, typePrec, dim1, compressionLevel); - break; - } - if (!domain->bounds_lon_name.isEmpty()) bounds_lonid = domain->bounds_lon_name; - else bounds_lonid = "bounds_"+lonName+appendDomid; - if (!domain->bounds_lat_name.isEmpty()) bounds_latid = domain->bounds_lat_name; - else bounds_latid = "bounds_"+latName+appendDomid; - - this->writeAxisAttributes - (lonid, isRegularDomain ? "X" : "", "longitude", "Longitude", "degrees_east", domid); - this->writeAxisAttributes - (latid, isRegularDomain ? "Y" : "", "latitude", "Latitude", "degrees_north", domid); - - if (domain->hasBounds) - { - SuperClassWriter::addAttribute("bounds", bounds_lonid, &lonid); - SuperClassWriter::addAttribute("bounds", bounds_latid, &latid); - - dim0.clear(); - dim0.push_back(dimYid); - dim0.push_back(dimXid); - dim0.push_back(dimVertId); - SuperClassWriter::addVariable(bounds_lonid, typePrec, dim0, compressionLevel); - SuperClassWriter::addVariable(bounds_latid, typePrec, dim0, compressionLevel); - } - } - - if (domain->hasArea) - { - dim0.clear(); - dim0.push_back(dimYid); dim0.push_back(dimXid); - SuperClassWriter::addVariable(areaId, typePrec, dim0, compressionLevel); - SuperClassWriter::addAttribute("standard_name", StdString("cell_area"), &areaId); - SuperClassWriter::addAttribute("units", StdString("m2"), &areaId); - dim0.clear(); - } - - SuperClassWriter::definition_end(); - - switch (domain->type) - { - case CDomain::type_attr::curvilinear : - { - std::vector start(2) ; - std::vector count(2) ; - start[1]=domain->ibegin; - start[0]=domain->jbegin; - count[1]=domain->ni ; count[0]=domain->nj ; - - if (domain->hasLonLat) - { - SuperClassWriter::writeData(domain->latvalue, latid, isCollective, 0,&start,&count); - SuperClassWriter::writeData(domain->lonvalue, lonid, isCollective, 0,&start,&count); - } - break; - } - case CDomain::type_attr::rectilinear : - { - if (domain->hasLonLat) - { - std::vector start(1) ; - std::vector count(1) ; - - start[0]=domain->jbegin; - count[0]=domain->nj; - CArray lat = domain->latvalue(Range(fromStart,toEnd,domain->ni)); - SuperClassWriter::writeData(CArray(lat.copy()), latid, isCollective, 0,&start,&count); - - start[0]=domain->ibegin; - count[0]=domain->ni; - CArray lon = domain->lonvalue(Range(0,domain->ni-1)); - SuperClassWriter::writeData(CArray(lon.copy()), lonid, isCollective, 0,&start,&count); - } - break; - } - } - - if (domain->hasBounds) - { - std::vector start(3); - std::vector count(3); - if (domain->isEmpty()) - { - start[2] = start[1] = start[0] = 0; - count[2] = count[1] = count[0] = 0; - } - else - { - start[2] = 0; - start[1] = domain->ibegin; - start[0] = domain->jbegin; - count[2] = domain->nvertex; - count[1] = domain->ni; - count[0] = domain->nj; - } - - SuperClassWriter::writeData(domain->bounds_lonvalue, bounds_lonid, isCollective, 0, &start, &count); // will probably not working for rectilinear - SuperClassWriter::writeData(domain->bounds_latvalue, bounds_latid, isCollective, 0, &start, &count); - } - - if (domain->hasArea) - { - std::vector start(2); - std::vector count(2); - - start[1] = domain->ibegin; - start[0] = domain->jbegin; - count[1] = domain->ni; - count[0] = domain->nj; - - SuperClassWriter::writeData(domain->areavalue, areaId, isCollective, 0, &start, &count); - } - - SuperClassWriter::definition_start(); - break; - } - default : - ERROR("CNc4DataOutput::writeDomain(domain)", - << "[ type = " << SuperClass::type << "]" - << " not implemented yet !"); - } - } - catch (CNetCdfException& e) - { - StdString msg("On writing the domain : "); - msg.append(domid); msg.append("\n"); - msg.append("In the context : "); - msg.append(context->getId()); msg.append("\n"); - msg.append(e.what()); - ERROR("CNc4DataOutput::writeDomain_(CDomain* domain)", << msg); - } - - domain->addRelFile(this->filename); - } - CATCH - - //-------------------------------------------------------------- - - void CNc4DataOutput::writeUnstructuredDomainUgrid(CDomain* domain) - { - CContext* context = CContext::getCurrent() ; - - if (domain->IsWritten(this->filename)) return; - - StdString domid = domain->getDomainOutputName(); - - // The first domain for the same mesh that will be written is that with the highest value of nvertex. - // Thus the entire mesh connectivity will be generated at once. - if (isWrittenDomain(domid)) return ; - else setWrittenDomain(domid); - - domain->checkAttributes(); - if (domain->isEmpty()) - if (SuperClass::type==MULTI_FILE) return ; - - nc_type typePrec ; - if (domain->prec.isEmpty()) typePrec = NC_FLOAT ; - else if (domain->prec==4) typePrec = NC_FLOAT ; - else if (domain->prec==8) typePrec = NC_DOUBLE ; - - std::vector dim0; - StdString domainName = domain->name; - domain->assignMesh(domainName, domain->nvertex); - domain->mesh->createMeshEpsilon(context->intraComm_, domain->lonvalue, domain->latvalue, domain->bounds_lonvalue, domain->bounds_latvalue); - - StdString node_x = domainName + "_node_x"; - StdString node_y = domainName + "_node_y"; - - StdString edge_x = domainName + "_edge_x"; - StdString edge_y = domainName + "_edge_y"; - StdString edge_nodes = domainName + "_edge_nodes"; - - StdString face_x = domainName + "_face_x"; - StdString face_y = domainName + "_face_y"; - StdString face_nodes = domainName + "_face_nodes"; - StdString face_edges = domainName + "_face_edges"; - StdString edge_faces = domainName + "_edge_face_links"; - StdString face_faces = domainName + "_face_links"; - - StdString dimNode = "n" + domainName + "_node"; - StdString dimEdge = "n" + domainName + "_edge"; - StdString dimFace = "n" + domainName + "_face"; - StdString dimVertex = "n" + domainName + "_vertex"; - StdString dimTwo = "Two"; - - if (!SuperClassWriter::dimExist(dimTwo)) SuperClassWriter::addDimension(dimTwo, 2); - dim0.clear(); - SuperClassWriter::addVariable(domainName, NC_INT, dim0, compressionLevel); - SuperClassWriter::addAttribute("cf_role", StdString("mesh_topology"), &domainName); - SuperClassWriter::addAttribute("long_name", StdString("Topology data of 2D unstructured mesh"), &domainName); - SuperClassWriter::addAttribute("topology_dimension", 2, &domainName); - SuperClassWriter::addAttribute("node_coordinates", node_x + " " + node_y, &domainName); - - try - { - switch (SuperClass::type) - { - case (ONE_FILE) : - { - // Adding nodes - if (domain->nvertex == 1) - { - if (!SuperClassWriter::varExist(node_x) || !SuperClassWriter::varExist(node_y)) - { - SuperClassWriter::addDimension(dimNode, domain->ni_glo); - dim0.clear(); - dim0.push_back(dimNode); - SuperClassWriter::addVariable(node_x, typePrec, dim0, compressionLevel); - SuperClassWriter::addAttribute("standard_name", StdString("longitude"), &node_x); - SuperClassWriter::addAttribute("long_name", StdString("Longitude of mesh nodes."), &node_x); - SuperClassWriter::addAttribute("units", StdString("degrees_east"), &node_x); - SuperClassWriter::addVariable(node_y, typePrec, dim0, compressionLevel); - SuperClassWriter::addAttribute("standard_name", StdString("latitude"), &node_y); - SuperClassWriter::addAttribute("long_name", StdString("Latitude of mesh nodes."), &node_y); - SuperClassWriter::addAttribute("units", StdString("degrees_north"), &node_y); - } - } // domain->nvertex == 1 - - // Adding edges and nodes, if nodes have not been defined previously - if (domain->nvertex == 2) - { - if (!SuperClassWriter::varExist(node_x) || !SuperClassWriter::varExist(node_y)) - { - SuperClassWriter::addDimension(dimNode, domain->mesh->nbNodesGlo); - dim0.clear(); - dim0.push_back(dimNode); - SuperClassWriter::addVariable(node_x, typePrec, dim0, compressionLevel); - SuperClassWriter::addAttribute("standard_name", StdString("longitude"), &node_x); - SuperClassWriter::addAttribute("long_name", StdString("Longitude of mesh nodes."), &node_x); - SuperClassWriter::addAttribute("units", StdString("degrees_east"), &node_x); - SuperClassWriter::addVariable(node_y, typePrec, dim0, compressionLevel); - SuperClassWriter::addAttribute("standard_name", StdString("latitude"), &node_y); - SuperClassWriter::addAttribute("long_name", StdString("Latitude of mesh nodes."), &node_y); - SuperClassWriter::addAttribute("units", StdString("degrees_north"), &node_y); - } - SuperClassWriter::addAttribute("edge_node_connectivity", edge_nodes, &domainName); - SuperClassWriter::addAttribute("edge_coordinates", edge_x + " " + edge_y, &domainName); - SuperClassWriter::addDimension(dimEdge, domain->ni_glo); - dim0.clear(); - dim0.push_back(dimEdge); - SuperClassWriter::addVariable(edge_x, typePrec, dim0, compressionLevel); - SuperClassWriter::addAttribute("standard_name", StdString("longitude"), &edge_x); - SuperClassWriter::addAttribute("long_name", StdString("Characteristic longitude of mesh edges."), &edge_x); - SuperClassWriter::addAttribute("units", StdString("degrees_east"), &edge_x); - SuperClassWriter::addVariable(edge_y, typePrec, dim0, compressionLevel); - SuperClassWriter::addAttribute("standard_name", StdString("latitude"), &edge_y); - SuperClassWriter::addAttribute("long_name", StdString("Characteristic latitude of mesh edges."), &edge_y); - SuperClassWriter::addAttribute("units", StdString("degrees_north"), &edge_y); - dim0.clear(); - dim0.push_back(dimEdge); - dim0.push_back(dimTwo); - SuperClassWriter::addVariable(edge_nodes, NC_INT, dim0, compressionLevel); - SuperClassWriter::addAttribute("cf_role", StdString("edge_node_connectivity"), &edge_nodes); - SuperClassWriter::addAttribute("long_name", StdString("Maps every edge/link to two nodes that it connects."), &edge_nodes); - SuperClassWriter::addAttribute("start_index", 0, &edge_nodes); - } // domain->nvertex == 2 - - // Adding faces, edges, and nodes, if edges and nodes have not been defined previously - if (domain->nvertex > 2) - { - // Nodes - if (!SuperClassWriter::varExist(node_x) || !SuperClassWriter::varExist(node_y)) - { - SuperClassWriter::addDimension(dimNode, domain->mesh->nbNodesGlo); - dim0.clear(); - dim0.push_back(dimNode); - SuperClassWriter::addVariable(node_x, typePrec, dim0, compressionLevel); - SuperClassWriter::addAttribute("standard_name", StdString("longitude"), &node_x); - SuperClassWriter::addAttribute("long_name", StdString("Longitude of mesh nodes."), &node_x); - SuperClassWriter::addAttribute("units", StdString("degrees_east"), &node_x); - SuperClassWriter::addVariable(node_y, typePrec, dim0, compressionLevel); - SuperClassWriter::addAttribute("standard_name", StdString("latitude"), &node_y); - SuperClassWriter::addAttribute("long_name", StdString("Latitude of mesh nodes."), &node_y); - SuperClassWriter::addAttribute("units", StdString("degrees_north"), &node_y); - } - if (!SuperClassWriter::varExist(edge_x) || !SuperClassWriter::varExist(edge_y)) - { - SuperClassWriter::addAttribute("edge_coordinates", edge_x + " " + edge_y, &domainName); - SuperClassWriter::addAttribute("edge_node_connectivity", edge_nodes, &domainName); - SuperClassWriter::addDimension(dimEdge, domain->mesh->nbEdgesGlo); - dim0.clear(); - dim0.push_back(dimEdge); - SuperClassWriter::addVariable(edge_x, typePrec, dim0, compressionLevel); - SuperClassWriter::addAttribute("standard_name", StdString("longitude"), &edge_x); - SuperClassWriter::addAttribute("long_name", StdString("Characteristic longitude of mesh edges."), &edge_x); - SuperClassWriter::addAttribute("units", StdString("degrees_east"), &edge_x); - SuperClassWriter::addVariable(edge_y, typePrec, dim0, compressionLevel); - SuperClassWriter::addAttribute("standard_name", StdString("latitude"), &edge_y); - SuperClassWriter::addAttribute("long_name", StdString("Characteristic latitude of mesh edges."), &edge_y); - SuperClassWriter::addAttribute("units", StdString("degrees_north"), &edge_y); - dim0.clear(); - dim0.push_back(dimEdge); - dim0.push_back(dimTwo); - SuperClassWriter::addVariable(edge_nodes, NC_INT, dim0, compressionLevel); - SuperClassWriter::addAttribute("cf_role", StdString("edge_node_connectivity"), &edge_nodes); - SuperClassWriter::addAttribute("long_name", StdString("Maps every edge/link to two nodes that it connects."), &edge_nodes); - SuperClassWriter::addAttribute("start_index", 0, &edge_nodes); - } - SuperClassWriter::addAttribute("face_coordinates", face_x + " " + face_y, &domainName); - SuperClassWriter::addAttribute("face_node_connectivity", face_nodes, &domainName); - SuperClassWriter::addDimension(dimFace, domain->ni_glo); - SuperClassWriter::addDimension(dimVertex, domain->nvertex); - dim0.clear(); - dim0.push_back(dimFace); - SuperClassWriter::addVariable(face_x, typePrec, dim0, compressionLevel); - SuperClassWriter::addAttribute("standard_name", StdString("longitude"), &face_x); - SuperClassWriter::addAttribute("long_name", StdString("Characteristic longitude of mesh faces."), &face_x); - SuperClassWriter::addAttribute("units", StdString("degrees_east"), &face_x); - SuperClassWriter::addVariable(face_y, typePrec, dim0, compressionLevel); - SuperClassWriter::addAttribute("standard_name", StdString("latitude"), &face_y); - SuperClassWriter::addAttribute("long_name", StdString("Characteristic latitude of mesh faces."), &face_y); - SuperClassWriter::addAttribute("units", StdString("degrees_north"), &face_y); - dim0.clear(); - dim0.push_back(dimFace); - dim0.push_back(dimVertex); - SuperClassWriter::addVariable(face_nodes, NC_INT, dim0, compressionLevel); - SuperClassWriter::addAttribute("cf_role", StdString("face_node_connectivity"), &face_nodes); - SuperClassWriter::addAttribute("long_name", StdString("Maps every face to its corner nodes."), &face_nodes); - SuperClassWriter::addAttribute("start_index", 0, &face_nodes); - dim0.clear(); - dim0.push_back(dimFace); - dim0.push_back(dimVertex); - SuperClassWriter::addVariable(face_edges, NC_INT, dim0, compressionLevel); - SuperClassWriter::addAttribute("cf_role", StdString("face_edge_connectivity"), &face_edges); - SuperClassWriter::addAttribute("long_name", StdString("Maps every face to its edges."), &face_edges); - SuperClassWriter::addAttribute("start_index", 0, &face_edges); - SuperClassWriter::addAttribute("_FillValue", 999999, &face_edges); - dim0.clear(); - dim0.push_back(dimEdge); - dim0.push_back(dimTwo); - SuperClassWriter::addVariable(edge_faces, NC_INT, dim0, compressionLevel); - SuperClassWriter::addAttribute("cf_role", StdString("edge_face connectivity"), &edge_faces); - SuperClassWriter::addAttribute("long_name", StdString("neighbor faces for edges"), &edge_faces); - SuperClassWriter::addAttribute("start_index", 0, &edge_faces); - SuperClassWriter::addAttribute("_FillValue", -999, &edge_faces); - SuperClassWriter::addAttribute("comment", StdString("missing neighbor faces are indicated using _FillValue"), &edge_faces); - dim0.clear(); - dim0.push_back(dimFace); - dim0.push_back(dimVertex); - SuperClassWriter::addVariable(face_faces, NC_INT, dim0, compressionLevel); - SuperClassWriter::addAttribute("cf_role", StdString("face_face connectivity"), &face_faces); - SuperClassWriter::addAttribute("long_name", StdString("Indicates which other faces neighbor each face"), &face_faces); - SuperClassWriter::addAttribute("start_index", 0, &face_faces); - SuperClassWriter::addAttribute("_FillValue", 999999, &face_faces); - SuperClassWriter::addAttribute("flag_values", -1, &face_faces); - SuperClassWriter::addAttribute("flag_meanings", StdString("out_of_mesh"), &face_faces); - } // domain->nvertex > 2 - - SuperClassWriter::definition_end(); - - std::vector startEdges(1) ; - std::vector countEdges(1) ; - std::vector startNodes(1) ; - std::vector countNodes(1) ; - std::vector startFaces(1) ; - std::vector countFaces(1) ; - std::vector startEdgeNodes(2) ; - std::vector countEdgeNodes(2) ; - std::vector startEdgeFaces(2) ; - std::vector countEdgeFaces(2) ; - std::vector startFaceConctv(2) ; - std::vector countFaceConctv(2) ; - - if (domain->nvertex == 1) - { - if (domain->isEmpty()) - { - startNodes[0]=0 ; - countNodes[0]=0 ; - } - else - { - startNodes[0] = domain->ibegin; - countNodes[0] = domain->ni ; - } - - SuperClassWriter::writeData(domain->mesh->node_lat, node_y, isCollective, 0, &startNodes, &countNodes); - SuperClassWriter::writeData(domain->mesh->node_lon, node_x, isCollective, 0, &startNodes, &countNodes); - } - else if (domain->nvertex == 2) - { - if (domain->isEmpty()) - { - startEdges[0]=0 ; - countEdges[0]=0 ; - startNodes[0]=0 ; - countNodes[0]=0 ; - startEdgeNodes[0]=0; - startEdgeNodes[1]=0; - countEdgeNodes[0]=0; - countEdgeNodes[1]=0; - - } - else - { - startEdges[0] = domain->ibegin; - countEdges[0] = domain->ni; - startNodes[0] = domain->mesh->node_start; - countNodes[0] = domain->mesh->node_count; - startEdgeNodes[0] = domain->ibegin; - startEdgeNodes[1] = 0; - countEdgeNodes[0] = domain->ni; - countEdgeNodes[1] = 2; - } - SuperClassWriter::writeData(domain->mesh->node_lat, node_y, isCollective, 0, &startNodes, &countNodes); - SuperClassWriter::writeData(domain->mesh->node_lon, node_x, isCollective, 0, &startNodes, &countNodes); - SuperClassWriter::writeData(domain->mesh->edge_lat, edge_y, isCollective, 0, &startEdges, &countEdges); - SuperClassWriter::writeData(domain->mesh->edge_lon, edge_x, isCollective, 0, &startEdges, &countEdges); - SuperClassWriter::writeData(domain->mesh->edge_nodes, edge_nodes, isCollective, 0, &startEdgeNodes, &countEdgeNodes); - } - else - { - if (domain->isEmpty()) - { - startFaces[0] = 0 ; - countFaces[0] = 0 ; - startNodes[0] = 0; - countNodes[0] = 0; - startEdges[0] = 0; - countEdges[0] = 0; - startEdgeFaces[0] = 0; - startEdgeFaces[1] = 0; - countEdgeFaces[0] = 0; - countEdgeFaces[1] = 0; - startFaceConctv[0] = 0; - startFaceConctv[1] = 0; - countFaceConctv[0] = 0; - countFaceConctv[1] = 0; - } - else - { - startFaces[0] = domain->ibegin; - countFaces[0] = domain->ni ; - startNodes[0] = domain->mesh->node_start; - countNodes[0] = domain->mesh->node_count; - startEdges[0] = domain->mesh->edge_start; - countEdges[0] = domain->mesh->edge_count; - startEdgeNodes[0] = domain->mesh->edge_start; - startEdgeNodes[1] = 0; - countEdgeNodes[0] = domain->mesh->edge_count; - countEdgeNodes[1]= 2; - startEdgeFaces[0] = domain->mesh->edge_start; - startEdgeFaces[1]= 0; - countEdgeFaces[0] = domain->mesh->edge_count; - countEdgeFaces[1]= 2; - startFaceConctv[0] = domain->ibegin; - startFaceConctv[1] = 0; - countFaceConctv[0] = domain->ni; - countFaceConctv[1] = domain->nvertex; - } - SuperClassWriter::writeData(domain->mesh->node_lat, node_y, isCollective, 0, &startNodes, &countNodes); - SuperClassWriter::writeData(domain->mesh->node_lon, node_x, isCollective, 0, &startNodes, &countNodes); - SuperClassWriter::writeData(domain->mesh->edge_lat, edge_y, isCollective, 0, &startEdges, &countEdges); - SuperClassWriter::writeData(domain->mesh->edge_lon, edge_x, isCollective, 0, &startEdges, &countEdges); - SuperClassWriter::writeData(domain->mesh->edge_nodes, edge_nodes, isCollective, 0, &startEdgeNodes, &countEdgeNodes); - SuperClassWriter::writeData(domain->mesh->face_lat, face_y, isCollective, 0, &startFaces, &countFaces); - SuperClassWriter::writeData(domain->mesh->face_lon, face_x, isCollective, 0, &startFaces, &countFaces); - SuperClassWriter::writeData(domain->mesh->face_nodes, face_nodes, isCollective, 0, &startFaceConctv, &countFaceConctv); - SuperClassWriter::writeData(domain->mesh->face_edges, face_edges, isCollective, 0, &startFaceConctv, &countFaceConctv); - SuperClassWriter::writeData(domain->mesh->edge_faces, edge_faces, isCollective, 0, &startEdgeFaces, &countEdgeFaces); - SuperClassWriter::writeData(domain->mesh->face_faces, face_faces, isCollective, 0, &startFaceConctv, &countFaceConctv); - } - SuperClassWriter::definition_start(); - - break; - } // ONE_FILE - - case (MULTI_FILE) : - { - ERROR("CNc4DataOutput::writeDomain(domain)", - << "[ type = multiple_file ]" - << " is not yet implemented for UGRID files !"); - break; - } - - default : - ERROR("CNc4DataOutput::writeDomain(domain)", - << "[ type = " << SuperClass::type << "]" - << " not implemented yet !"); - } // switch - } // try - - catch (CNetCdfException& e) - { - StdString msg("On writing the domain : "); - msg.append(domid); msg.append("\n"); - msg.append("In the context : "); - msg.append(context->getId()); msg.append("\n"); - msg.append(e.what()); - ERROR("CNc4DataOutput::writeUnstructuredDomainUgrid(CDomain* domain)", << msg); - } - - domain->addRelFile(this->filename); - } - - //-------------------------------------------------------------- - - void CNc4DataOutput::writeUnstructuredDomain(CDomain* domain) - { - CContext* context = CContext::getCurrent() ; - - if (domain->IsWritten(this->filename)) return; - domain->checkAttributes(); - - if (domain->isEmpty()) - if (SuperClass::type==MULTI_FILE) return ; - - std::vector dim0, dim1; - StdString domid = domain->getDomainOutputName(); - if (isWrittenDomain(domid)) return ; - else setWrittenDomain(domid); - - StdString appendDomid = (singleDomain) ? "" : "_"+domid ; - - StdString lonName,latName, cellName ; - if (domain->lon_name.isEmpty()) lonName = "lon"; - else lonName = domain->lon_name; - - if (domain->lat_name.isEmpty()) latName = "lat"; - else latName = domain->lat_name; - - if (!domain->dim_i_name.isEmpty()) cellName=domain->dim_i_name; - else cellName="cell"; - StdString dimXid = cellName+appendDomid; - StdString dimVertId = StdString("nvertex").append(appendDomid); - - string lonid,latid,bounds_lonid,bounds_latid ; - string areaId = "area" + appendDomid; - - nc_type typePrec ; - if (domain->prec.isEmpty()) typePrec = NC_FLOAT ; - else if (domain->prec==4) typePrec = NC_FLOAT ; - else if (domain->prec==8) typePrec = NC_DOUBLE ; - - int nvertex = (domain->nvertex.isEmpty()) ? 0 : domain->nvertex; - - try - { - switch (SuperClass::type) - { - case (MULTI_FILE) : - { - dim0.push_back(dimXid); - SuperClassWriter::addDimension(dimXid, domain->ni); - - lonid = lonName+appendDomid; - latid = latName+appendDomid; - if (!domain->bounds_lon_name.isEmpty()) bounds_lonid = domain->bounds_lon_name; - else bounds_lonid = "bounds_"+lonName+appendDomid; - if (!domain->bounds_lat_name.isEmpty()) bounds_latid = domain->bounds_lat_name; - else bounds_latid = "bounds_"+latName+appendDomid; - - if (domain->hasLonLat) - { - SuperClassWriter::addVariable(latid, typePrec, dim0, compressionLevel); - SuperClassWriter::addVariable(lonid, typePrec, dim0, compressionLevel); - this->writeAxisAttributes(lonid, "", "longitude", "Longitude", "degrees_east", domid); - if (domain->hasBounds) SuperClassWriter::addAttribute("bounds",bounds_lonid, &lonid); - this->writeAxisAttributes(latid, "", "latitude", "Latitude", "degrees_north", domid); - if (domain->hasBounds) SuperClassWriter::addAttribute("bounds",bounds_latid, &latid); - if (domain->hasBounds) SuperClassWriter::addDimension(dimVertId, domain->nvertex); - } - dim0.clear(); - if (domain->hasBounds) - { - dim0.push_back(dimXid); - dim0.push_back(dimVertId); - SuperClassWriter::addVariable(bounds_lonid, typePrec, dim0, compressionLevel); - SuperClassWriter::addVariable(bounds_latid, typePrec, dim0, compressionLevel); - } - - dim0.clear(); - dim0.push_back(dimXid); - if (domain->hasArea) - { - SuperClassWriter::addVariable(areaId, typePrec, dim0, compressionLevel); - SuperClassWriter::addAttribute("standard_name", StdString("cell_area"), &areaId); - SuperClassWriter::addAttribute("units", StdString("m2"), &areaId); - } - - SuperClassWriter::definition_end(); - - if (domain->hasLonLat) - { - SuperClassWriter::writeData(domain->latvalue, latid, isCollective, 0); - SuperClassWriter::writeData(domain->lonvalue, lonid, isCollective, 0); - if (domain->hasBounds) - { - SuperClassWriter::writeData(domain->bounds_lonvalue, bounds_lonid, isCollective, 0); - SuperClassWriter::writeData(domain->bounds_latvalue, bounds_latid, isCollective, 0); - } - } - - if (domain->hasArea) - SuperClassWriter::writeData(domain->areavalue, areaId, isCollective, 0); - - SuperClassWriter::definition_start(); - break ; - } - - case (ONE_FILE) : - { - lonid = lonName+appendDomid; - latid = latName+appendDomid; - if (!domain->bounds_lon_name.isEmpty()) bounds_lonid = domain->bounds_lon_name; - else bounds_lonid = "bounds_"+lonName+appendDomid; - if (!domain->bounds_lat_name.isEmpty()) bounds_latid = domain->bounds_lat_name; - else bounds_latid = "bounds_"+latName+appendDomid; - - dim0.push_back(dimXid); - SuperClassWriter::addDimension(dimXid, domain->ni_glo); - if (domain->hasLonLat) - { - SuperClassWriter::addVariable(latid, typePrec, dim0, compressionLevel); - SuperClassWriter::addVariable(lonid, typePrec, dim0, compressionLevel); - - this->writeAxisAttributes(lonid, "", "longitude", "Longitude", "degrees_east", domid); - if (domain->hasBounds) SuperClassWriter::addAttribute("bounds",bounds_lonid, &lonid); - this->writeAxisAttributes(latid, "", "latitude", "Latitude", "degrees_north", domid); - if (domain->hasBounds) SuperClassWriter::addAttribute("bounds",bounds_latid, &latid); - if (domain->hasBounds) SuperClassWriter::addDimension(dimVertId, nvertex); - } - dim0.clear(); - - if (domain->hasBounds) - { - dim0.push_back(dimXid); - dim0.push_back(dimVertId); - SuperClassWriter::addVariable(bounds_lonid, typePrec, dim0, compressionLevel); - SuperClassWriter::addVariable(bounds_latid, typePrec, dim0, compressionLevel); - } - - if (domain->hasArea) - { - dim0.clear(); - dim0.push_back(dimXid); - SuperClassWriter::addVariable(areaId, typePrec, dim0, compressionLevel); - SuperClassWriter::addAttribute("standard_name", StdString("cell_area"), &areaId); - SuperClassWriter::addAttribute("units", StdString("m2"), &areaId); - } - - SuperClassWriter::definition_end(); - - std::vector start(1), startBounds(2) ; - std::vector count(1), countBounds(2) ; - if (domain->isEmpty()) - { - start[0]=0 ; - count[0]=0 ; - startBounds[1]=0 ; - countBounds[1]=nvertex ; - startBounds[0]=0 ; - countBounds[0]=0 ; - } - else - { - start[0]=domain->ibegin; - count[0]=domain->ni; - startBounds[0]=domain->ibegin; - startBounds[1]=0 ; - countBounds[0]=domain->ni; - countBounds[1]=nvertex ; - } - - if (domain->hasLonLat) - { - SuperClassWriter::writeData(domain->latvalue, latid, isCollective, 0,&start,&count); - SuperClassWriter::writeData(domain->lonvalue, lonid, isCollective, 0,&start,&count); - if (domain->hasBounds) - { - SuperClassWriter::writeData(domain->bounds_lonvalue, bounds_lonid, isCollective, 0,&startBounds,&countBounds); - SuperClassWriter::writeData(domain->bounds_latvalue, bounds_latid, isCollective, 0,&startBounds,&countBounds); - } - } - - if (domain->hasArea) - SuperClassWriter::writeData(domain->areavalue, areaId, isCollective, 0, &start, &count); - - SuperClassWriter::definition_start(); - - break; - } - default : - ERROR("CNc4DataOutput::writeDomain(domain)", - << "[ type = " << SuperClass::type << "]" - << " not implemented yet !"); - } - } - catch (CNetCdfException& e) - { - StdString msg("On writing the domain : "); - msg.append(domid); msg.append("\n"); - msg.append("In the context : "); - msg.append(context->getId()); msg.append("\n"); - msg.append(e.what()); - ERROR("CNc4DataOutput::writeUnstructuredDomain(CDomain* domain)", << msg); - } - domain->addRelFile(this->filename); - } - //-------------------------------------------------------------- - - void CNc4DataOutput::writeAxis_(CAxis* axis) - { - if (axis->IsWritten(this->filename)) return; - axis->checkAttributes(); - - int size = (MULTI_FILE == SuperClass::type) ? axis->n.getValue() - : axis->n_glo.getValue(); - - if ((0 == axis->n) && (MULTI_FILE == SuperClass::type)) return; - - std::vector dims; - StdString axisid = axis->getAxisOutputName(); - StdString axisDim, axisBoundsId; - if (isWrittenAxis(axisid)) return ; - else setWrittenAxis(axisid); - - nc_type typePrec ; - if (axis->prec.isEmpty()) typePrec = NC_FLOAT ; - else if (axis->prec==4) typePrec = NC_FLOAT ; - else if (axis->prec==8) typePrec = NC_DOUBLE ; - - if (!axis->label.isEmpty()) typePrec = NC_CHAR ; - string strId="str_len" ; - try - { - if (axis->dim_name.isEmpty()) axisDim = axisid; - else axisDim=axis->dim_name.getValue(); - SuperClassWriter::addDimension(axisDim, size); - dims.push_back(axisDim); - - if (!axis->label.isEmpty() && !SuperClassWriter::dimExist(strId)) SuperClassWriter::addDimension(strId, stringArrayLen); - - if (axis->hasValue || !axis->label.isEmpty()) - { - if (!axis->label.isEmpty()) dims.push_back(strId); - - SuperClassWriter::addVariable(axisid, typePrec, dims, compressionLevel); - - if (!axis->name.isEmpty()) - SuperClassWriter::addAttribute("name", axis->name.getValue(), &axisid); - - if (!axis->standard_name.isEmpty()) - SuperClassWriter::addAttribute("standard_name", axis->standard_name.getValue(), &axisid); - - if (!axis->long_name.isEmpty()) - SuperClassWriter::addAttribute("long_name", axis->long_name.getValue(), &axisid); - - if (!axis->unit.isEmpty()) - SuperClassWriter::addAttribute("units", axis->unit.getValue(), &axisid); - - if (!axis->axis_type.isEmpty()) - { - switch(axis->axis_type) - { - case CAxis::axis_type_attr::X : - SuperClassWriter::addAttribute("axis", string("X"), &axisid); - break; - case CAxis::axis_type_attr::Y : - SuperClassWriter::addAttribute("axis", string("Y"), &axisid); - break; - case CAxis::axis_type_attr::Z : - SuperClassWriter::addAttribute("axis", string("Z"), &axisid); - break; - case CAxis::axis_type_attr::T : - SuperClassWriter::addAttribute("axis", string("T"), &axisid); - break; - } - } - - if (!axis->positive.isEmpty()) - { - SuperClassWriter::addAttribute("positive", - (axis->positive == CAxis::positive_attr::up) ? string("up") : string("down"), - &axisid); - } - - if (!axis->formula.isEmpty()) - SuperClassWriter::addAttribute("formula", axis->formula.getValue(), &axisid); - - if (!axis->formula_term.isEmpty()) - SuperClassWriter::addAttribute("formula_term", axis->formula_term.getValue(), &axisid); - - axisBoundsId = (axis->bounds_name.isEmpty()) ? axisid + "_bounds" : axis->bounds_name; - if (!axis->bounds.isEmpty() && axis->label.isEmpty()) - { - dims.push_back("axis_nbounds"); - SuperClassWriter::addVariable(axisBoundsId, typePrec, dims, compressionLevel); - SuperClassWriter::addAttribute("bounds", axisBoundsId, &axisid); - - if (!axis->standard_name.isEmpty()) - SuperClassWriter::addAttribute("standard_name", axis->standard_name.getValue(), &axisBoundsId); - - if (!axis->unit.isEmpty()) - SuperClassWriter::addAttribute("units", axis->unit.getValue(), &axisBoundsId); - - if (!axis->formula_bounds.isEmpty()) - SuperClassWriter::addAttribute("formula", axis->formula_bounds.getValue(), &axisBoundsId); - - if (!axis->formula_term_bounds.isEmpty()) - SuperClassWriter::addAttribute("formula_term", axis->formula_term_bounds.getValue(), &axisBoundsId); - } - } - - SuperClassWriter::definition_end(); - - switch (SuperClass::type) - { - case MULTI_FILE: - { - if (axis->label.isEmpty()) - { - if (!axis->value.isEmpty()) - SuperClassWriter::writeData(axis->value, axisid, isCollective, 0); - - if (!axis->bounds.isEmpty()) - SuperClassWriter::writeData(axis->bounds, axisBoundsId, isCollective, 0); - } - else - SuperClassWriter::writeData(axis->label, axisid, isCollective, 0); - - SuperClassWriter::definition_start(); - break; - } - case ONE_FILE: - { - std::vector start(1), startBounds(2) ; - std::vector count(1), countBounds(2) ; - start[0] = startBounds[0] = axis->begin; - count[0] = countBounds[0] = axis->n; - startBounds[1] = 0; - countBounds[1] = 2; - - if (axis->label.isEmpty()) - { - if (!axis->value.isEmpty()) - SuperClassWriter::writeData(axis->value, axisid, isCollective, 0, &start, &count); - - if (!axis->bounds.isEmpty()) - SuperClassWriter::writeData(axis->bounds, axisBoundsId, isCollective, 0, &startBounds, &countBounds); - } - else - { - std::vector startLabel(2), countLabel(2); - startLabel[0] = start[0]; startLabel[1] = 0; - countLabel[0] = count[0]; countLabel[1] = stringArrayLen; - SuperClassWriter::writeData(axis->label, axisid, isCollective, 0, &startLabel, &countLabel); - } - - SuperClassWriter::definition_start(); - - break; - } - default : - ERROR("CNc4DataOutput::writeAxis_(CAxis* axis)", - << "[ type = " << SuperClass::type << "]" - << " not implemented yet !"); - } - } - catch (CNetCdfException& e) - { - StdString msg("On writing the axis : "); - msg.append(axisid); msg.append("\n"); - msg.append("In the context : "); - CContext* context = CContext::getCurrent() ; - msg.append(context->getId()); msg.append("\n"); - msg.append(e.what()); - ERROR("CNc4DataOutput::writeAxis_(CAxis* axis)", << msg); - } - axis->addRelFile(this->filename); - } - - void CNc4DataOutput::writeScalar_(CScalar* scalar) - { - if (scalar->IsWritten(this->filename)) return; - scalar->checkAttributes(); - int scalarSize = 1; - - StdString scalaId = scalar->getScalarOutputName(); - StdString boundsId; - if (isWrittenAxis(scalaId)) return ; - else setWrittenAxis(scalaId); - - nc_type typePrec ; - if (scalar->prec.isEmpty()) typePrec = NC_FLOAT ; - else if (scalar->prec==4) typePrec = NC_FLOAT ; - else if (scalar->prec==8) typePrec = NC_DOUBLE ; - - if (!scalar->label.isEmpty()) typePrec = NC_CHAR ; - string strId="str_len" ; - - try - { - if (!scalar->label.isEmpty() && !SuperClassWriter::dimExist(strId)) SuperClassWriter::addDimension(strId, stringArrayLen); - - if (!scalar->value.isEmpty() || !scalar->label.isEmpty()) - { - std::vector dims; - StdString scalarDim = scalaId; - - if (!scalar->label.isEmpty()) dims.push_back(strId); - - SuperClassWriter::addVariable(scalaId, typePrec, dims); - - if (!scalar->name.isEmpty()) - SuperClassWriter::addAttribute("name", scalar->name.getValue(), &scalaId); - - if (!scalar->standard_name.isEmpty()) - SuperClassWriter::addAttribute("standard_name", scalar->standard_name.getValue(), &scalaId); - - if (!scalar->long_name.isEmpty()) - SuperClassWriter::addAttribute("long_name", scalar->long_name.getValue(), &scalaId); - - if (!scalar->unit.isEmpty()) - SuperClassWriter::addAttribute("units", scalar->unit.getValue(), &scalaId); - - if (!scalar->axis_type.isEmpty()) - { - switch(scalar->axis_type) - { - case CScalar::axis_type_attr::X : - SuperClassWriter::addAttribute("axis", string("X"), &scalaId); - break; - case CScalar::axis_type_attr::Y : - SuperClassWriter::addAttribute("axis", string("Y"), &scalaId); - break; - case CScalar::axis_type_attr::Z : - SuperClassWriter::addAttribute("axis", string("Z"), &scalaId); - break; - case CScalar::axis_type_attr::T : - SuperClassWriter::addAttribute("axis", string("T"), &scalaId); - break; - } - } - - if (!scalar->positive.isEmpty()) - { - SuperClassWriter::addAttribute("positive", - (scalar->positive == CScalar::positive_attr::up) ? string("up") : string("down"), - &scalaId); - } - - if (!scalar->bounds.isEmpty() && scalar->label.isEmpty()) - { - dims.clear(); - dims.push_back("axis_nbounds"); - boundsId = (scalar->bounds_name.isEmpty()) ? (scalaId + "_bounds") : scalar->bounds_name.getValue(); - SuperClassWriter::addVariable(boundsId, typePrec, dims); - SuperClassWriter::addAttribute("bounds", boundsId, &scalaId); - } - - SuperClassWriter::definition_end(); - - switch (SuperClass::type) - { - case MULTI_FILE: - { - CArray scalarValue(scalarSize); - CArray scalarLabel(scalarSize); - CArray scalarBounds(scalarSize*2); - - if (!scalar->value.isEmpty() && scalar->label.isEmpty()) - { - scalarValue(0) = scalar->value; - SuperClassWriter::writeData(scalarValue, scalaId, isCollective, 0); - } - - if (!scalar->bounds.isEmpty() && scalar->label.isEmpty()) - { - scalarBounds(0) = scalar->bounds(0); - scalarBounds(1) = scalar->bounds(1); - SuperClassWriter::writeData(scalarBounds, boundsId, isCollective, 0); - } - - if (!scalar->label.isEmpty()) - { - scalarLabel(0) = scalar->label; - SuperClassWriter::writeData(scalarLabel, scalaId, isCollective, 0); - } - - SuperClassWriter::definition_start(); - - break; - } - case ONE_FILE: - { - CArray scalarValue(scalarSize); - CArray scalarLabel(scalarSize); - CArray scalarBounds(scalarSize*2); - - std::vector start(1); - std::vector count(1); - start[0] = 0; - count[0] = 1; - if (!scalar->value.isEmpty() && scalar->label.isEmpty()) - { - scalarValue(0) = scalar->value; - SuperClassWriter::writeData(scalarValue, scalaId, isCollective, 0, &start, &count); - } - if (!scalar->bounds.isEmpty() && scalar->label.isEmpty()) - { - scalarBounds(0) = scalar->bounds(0); - scalarBounds(1) = scalar->bounds(1); - count[0] = 2; - SuperClassWriter::writeData(scalarBounds, boundsId, isCollective, 0, &start, &count); - } - if (!scalar->label.isEmpty()) - { - scalarLabel(0) = scalar->label; - count[0] = stringArrayLen; - SuperClassWriter::writeData(scalarLabel, scalaId, isCollective, 0, &start, &count); - } - - SuperClassWriter::definition_start(); - - break; - } - default : - ERROR("CNc4DataOutput::writeAxis_(CAxis* scalar)", - << "[ type = " << SuperClass::type << "]" - << " not implemented yet !"); - } - } - } - catch (CNetCdfException& e) - { - StdString msg("On writing the scalar : "); - msg.append(scalaId); msg.append("\n"); - msg.append("In the context : "); - CContext* context = CContext::getCurrent() ; - msg.append(context->getId()); msg.append("\n"); - msg.append(e.what()); - ERROR("CNc4DataOutput::writeScalar_(CScalar* scalar)", << msg); - } - scalar->addRelFile(this->filename); - } - - //-------------------------------------------------------------- - - void CNc4DataOutput::writeGridCompressed_(CGrid* grid) - { - if (grid->isScalarGrid() || grid->isWrittenCompressed(this->filename)) return; - - // NOTA : The cuurent algorithm to write compress elements of the grid - // will work pretting well when on server side you dont't get - // partial overlap on elements between differents participating process - // So the element must be totally distributed or non distributed - // If an element is partially overlaping betwwen process then the - // total compressed part will apear artificially greater than expected - // For the current implementation of writer which is decomposed only on - // one element, it will work as expected, but for future, it must be - // reconsidered again. - try - { - CArray axisDomainOrder = grid->axis_domain_order; - std::vector domainList = grid->getDomainList(); - std::vector axisList = grid->getAxisList(); - std::vector scalarList = grid->getScalarList(); - int numElement = axisDomainOrder.numElements(), idxDomain = 0, idxAxis = 0, idxScalar = 0; - int commRank ; - MPI_Comm_rank(comm_file,&commRank) ; - - std::vector dims; - - for (int i = 0; i < numElement; ++i) - { - StdString varId, compress; - CArray indexes; - bool isDistributed; - size_t nbIndexes, totalNbIndexes, offset; - size_t firstGlobalIndex; - - if (2 == axisDomainOrder(i)) - { - CDomain* domain = CDomain::get(domainList[idxDomain]); - StdString domId = domain->getDomainOutputName(); - - if (!domain->isCompressible() - || domain->type == CDomain::type_attr::unstructured - || domain->isWrittenCompressed(this->filename) - || isWrittenCompressedDomain(domId)) - continue; - - // unstructured grid seems not be taken into account why ? - - string lonName,latName ; - - if (domain->lon_name.isEmpty()) - { - if (domain->type==CDomain::type_attr::curvilinear) lonName = "nav_lon"; - else lonName = "lon"; - } - else lonName = domain->lon_name; - - if (domain->lat_name.isEmpty()) - { - if (domain->type==CDomain::type_attr::curvilinear) latName = "nav_lat"; - else latName = "lat"; - } - else latName = domain->lat_name; - - StdString appendDomId = singleDomain ? "" : "_" + domId; - - varId = domId + "_points"; - compress = latName + appendDomId + " " + lonName + appendDomId; - - shared_ptr workflowView = domain->getLocalView(CElementView::WORKFLOW) ; - workflowView->getGlobalIndexView(indexes) ; - nbIndexes = workflowView->getSize() ; - isDistributed = domain->isDistributed(); - if (isDistributed) - { - MPI_Exscan(&nbIndexes, &offset, 1, MPI_SIZE_T, MPI_SUM, comm_file) ; - if (commRank==0) offset=0 ; - MPI_Allreduce(&nbIndexes,&totalNbIndexes,1 , MPI_SIZE_T, MPI_SUM, comm_file) ; - } - else - { - offset=0 ; - totalNbIndexes = nbIndexes ; - } - - firstGlobalIndex = domain->ibegin + domain->jbegin * domain->ni_glo; - - domain->addRelFileCompressed(this->filename); - setWrittenCompressedDomain(domId); - ++idxDomain; - } - else if (1 == axisDomainOrder(i)) - { - CAxis* axis = CAxis::get(axisList[idxAxis]); - StdString axisId = axis->getAxisOutputName(); - - if (!axis->isCompressible() - || axis->isWrittenCompressed(this->filename) - || isWrittenCompressedAxis(axisId)) - continue; - - varId = axisId + "_points"; - compress = axisId; - - shared_ptr workflowView = axis->getLocalView(CElementView::WORKFLOW) ; - workflowView->getGlobalIndexView(indexes) ; - nbIndexes = workflowView->getSize() ; - isDistributed = axis->isDistributed(); - if (isDistributed) - { - MPI_Exscan(&nbIndexes, &offset, 1, MPI_SIZE_T, MPI_SUM, comm_file) ; - if (commRank==0) offset=0 ; - MPI_Allreduce(&nbIndexes,&totalNbIndexes,1 , MPI_SIZE_T, MPI_SUM, comm_file) ; - } - else - { - offset=0 ; - totalNbIndexes = nbIndexes ; - } - firstGlobalIndex = axis->begin; - - axis->addRelFileCompressed(this->filename); - setWrittenCompressedAxis(axisId); - ++idxAxis; - } - else - { - //for scalar - } - - if (!varId.empty()) - { - SuperClassWriter::addDimension(varId, (SuperClass::type == MULTI_FILE) ? nbIndexes : totalNbIndexes); - - dims.clear(); - dims.push_back(varId); - SuperClassWriter::addVariable(varId, NC_UINT64, dims); - - SuperClassWriter::addAttribute("compress", compress, &varId); - - switch (SuperClass::type) - { - case (MULTI_FILE): - { - indexes -= firstGlobalIndex; - SuperClassWriter::writeData(indexes, varId, isCollective, 0); - break; - } - case (ONE_FILE): - { - std::vector start, count; - start.push_back(offset); - count.push_back(nbIndexes); - - SuperClassWriter::writeData(indexes, varId, isCollective, 0, &start, &count); - break; - } - } - } - } - - grid->addRelFileCompressed(this->filename); - } - catch (CNetCdfException& e) - { - StdString msg("On writing compressed grid : "); - msg.append(grid->getId()); msg.append("\n"); - msg.append("In the context : "); - CContext* context = CContext::getCurrent(); - msg.append(context->getId()); msg.append("\n"); - msg.append(e.what()); - ERROR("CNc4DataOutput::writeGridCompressed_(CGrid* grid)", << msg); - } - } - - //-------------------------------------------------------------- - - void CNc4DataOutput::writeTimeDimension_(void) - { - try - { - SuperClassWriter::addDimension(getTimeCounterName()); - } - catch (CNetCdfException& e) - { - StdString msg("On writing time dimension : time_couter\n"); - msg.append("In the context : "); - CContext* context = CContext::getCurrent() ; - msg.append(context->getId()); msg.append("\n"); - msg.append(e.what()); - ERROR("CNc4DataOutput::writeTimeDimension_(void)", << msg); - } - } - - //-------------------------------------------------------------- - - void CNc4DataOutput::writeField_(CField* field) - { - CContext* context = CContext::getCurrent() ; - - std::vector dims, coodinates; - CGrid* grid = field->getGrid(); - if (!grid->doGridHaveDataToWrite()) - if (SuperClass::type==MULTI_FILE) return ; - - CArray axisDomainOrder = grid->axis_domain_order; - int numElement = axisDomainOrder.numElements(), idxDomain = 0, idxAxis = 0, idxScalar = 0; - std::vector domainList = grid->getDomainList(); - std::vector axisList = grid->getAxisList(); - std::vector scalarList = grid->getScalarList(); - - StdString timeid = getTimeCounterName(); - StdString dimXid,dimYid; - std::deque dimIdList, dimCoordList; - bool hasArea = false; - StdString cellMeasures = "area:"; - bool compressedOutput = !field->indexed_output.isEmpty() && field->indexed_output; - - for (int i = 0; i < numElement; ++i) - { - if (2 == axisDomainOrder(i)) - { - CDomain* domain = CDomain::get(domainList[idxDomain]); - StdString domId = domain->getDomainOutputName(); - StdString appendDomId = singleDomain ? "" : "_" + domId ; - StdString lonName,latName ; - StdString dimIname,dimJname ; - - if (domain->lon_name.isEmpty()) - { - if (domain->type==CDomain::type_attr::curvilinear) lonName = "nav_lon"; - else lonName = "lon"; - } - else lonName = domain->lon_name; - - if (domain->lat_name.isEmpty()) - { - if (domain->type==CDomain::type_attr::curvilinear) latName = "nav_lat"; - else latName = "lat"; - } - else latName = domain->lat_name; - - if (domain->dim_i_name.isEmpty()) - { - if (domain->type==CDomain::type_attr::curvilinear) dimIname = "x"; - else if (domain->type==CDomain::type_attr::unstructured) dimIname = "cell"; - else dimIname = lonName; - } - else dimIname = domain->dim_i_name; - - if (domain->dim_j_name.isEmpty()) - { - if (domain->type==CDomain::type_attr::curvilinear) dimJname = "y"; - else dimJname = latName; - } - else dimJname = domain->dim_j_name; - - if (compressedOutput && domain->isCompressible() && domain->type != CDomain::type_attr::unstructured) - { - dimIdList.push_back(domId + "_points"); - field->setUseCompressedOutput(); - } - - switch (domain->type) - { - case CDomain::type_attr::curvilinear: - if (!compressedOutput || !domain->isCompressible()) - { - dimXid=dimIname+appendDomId; - dimYid=dimJname+appendDomId; - dimIdList.push_back(dimXid); - dimIdList.push_back(dimYid); - } - dimCoordList.push_back(lonName+appendDomId); - dimCoordList.push_back(latName+appendDomId); - break ; - case CDomain::type_attr::rectilinear: - if (!compressedOutput || !domain->isCompressible()) - { - dimXid = dimIname+appendDomId; - dimYid = dimJname+appendDomId; - dimIdList.push_back(dimXid); - dimIdList.push_back(dimYid); - } - if (lonName != dimIname) dimCoordList.push_back(lonName+appendDomId); - if (latName != dimJname) dimCoordList.push_back(latName+appendDomId); - - break ; - case CDomain::type_attr::unstructured: - { - if (SuperClassWriter::useCFConvention) - { - dimXid = dimIname + appendDomId; - dimIdList.push_back(dimXid); - dimCoordList.push_back(lonName+appendDomId); - dimCoordList.push_back(latName+appendDomId); - } - else - { - StdString domainName = domain->name; - if (domain->nvertex == 1) - { - dimXid = "n" + domainName + "_node"; - dimIdList.push_back(dimXid); - dimCoordList.push_back(StdString(domainName + "_node_x")); - dimCoordList.push_back(StdString(domainName + "_node_y")); - } - else if (domain->nvertex == 2) - { - dimXid = "n" + domainName + "_edge"; - dimIdList.push_back(dimXid); - dimCoordList.push_back(StdString(domainName + "_edge_x")); - dimCoordList.push_back(StdString(domainName + "_edge_y")); - } - else - { - dimXid = "n" + domainName + "_face"; - dimIdList.push_back(dimXid); - dimCoordList.push_back(StdString(domainName + "_face_x")); - dimCoordList.push_back(StdString(domainName + "_face_y")); - } - } // ugrid convention - } // case unstructured domain - } - - if (domain->hasArea) - { - hasArea = true; - cellMeasures += " area" + appendDomId; - } - ++idxDomain; - } - else if (1 == axisDomainOrder(i)) - { - CAxis* axis = CAxis::get(axisList[idxAxis]); - StdString axisId = axis->getAxisOutputName(); - StdString axisDim; - - if (axis->dim_name.isEmpty()) axisDim = axisId; - else axisDim=axis->dim_name.getValue(); - - if (compressedOutput && axis->isCompressible()) - { - dimIdList.push_back(axisDim + "_points"); - field->setUseCompressedOutput(); - } - else - dimIdList.push_back(axisDim); - - if (axisDim != axisId) dimCoordList.push_back(axisId); - ++idxAxis; - } - else - { - CScalar* scalar = CScalar::get(scalarList[idxScalar]); - StdString scalarId = scalar->getScalarOutputName(); - if (!scalar->value.isEmpty() || !scalar->label.isEmpty()) - dimCoordList.push_back(scalarId); - ++idxScalar; - } - } - - StdString fieldid = field->getFieldOutputName(); - - nc_type type ; - if (field->prec.isEmpty()) type = NC_FLOAT ; - else - { - if (field->prec==2) type = NC_SHORT ; - else if (field->prec==4) type = NC_FLOAT ; - else if (field->prec==8) type = NC_DOUBLE ; - } - - bool wtime = !(!field->operation.isEmpty() && field->getOperationTimeType() == func::CFunctor::once); - - if (wtime) - { - if (field->hasTimeInstant && hasTimeInstant) coodinates.push_back(string("time_instant")); - else if (field->hasTimeCentered && hasTimeCentered) coodinates.push_back(string("time_centered")); - dims.push_back(timeid); - } - - while (!dimIdList.empty()) - { - dims.push_back(dimIdList.back()); - dimIdList.pop_back(); - } - - while (!dimCoordList.empty()) - { - coodinates.push_back(dimCoordList.back()); - dimCoordList.pop_back(); - } - - try - { - SuperClassWriter::addVariable(fieldid, type, dims); - - if (!field->standard_name.isEmpty()) - SuperClassWriter::addAttribute - ("standard_name", field->standard_name.getValue(), &fieldid); - - if (!field->long_name.isEmpty()) - SuperClassWriter::addAttribute - ("long_name", field->long_name.getValue(), &fieldid); - - if (!field->unit.isEmpty()) - SuperClassWriter::addAttribute - ("units", field->unit.getValue(), &fieldid); - - // Ugrid field attributes "mesh" and "location" - if (!SuperClassWriter::useCFConvention) - { - if (!domainList.empty()) - { - CDomain* domain = CDomain::get(domainList[0]); // Suppose that we have only domain - StdString mesh = domain->name; - SuperClassWriter::addAttribute("mesh", mesh, &fieldid); - StdString location; - if (domain->nvertex == 1) - location = "node"; - else if (domain->nvertex == 2) - location = "edge"; - else if (domain->nvertex > 2) - location = "face"; - SuperClassWriter::addAttribute("location", location, &fieldid); - } - - } - - if (!field->valid_min.isEmpty()) - SuperClassWriter::addAttribute - ("valid_min", field->valid_min.getValue(), &fieldid); - - if (!field->valid_max.isEmpty()) - SuperClassWriter::addAttribute - ("valid_max", field->valid_max.getValue(), &fieldid); - - if (!field->scale_factor.isEmpty()) - SuperClassWriter::addAttribute - ("scale_factor", field->scale_factor.getValue(), &fieldid); - - if (!field->add_offset.isEmpty()) - SuperClassWriter::addAttribute - ("add_offset", field->add_offset.getValue(), &fieldid); - - SuperClassWriter::addAttribute - ("online_operation", field->operation.getValue(), &fieldid); - - // write child variables as attributes - - - bool alreadyAddCellMethod = false; - StdString cellMethodsPrefix(""), cellMethodsSuffix(""); - if (!field->cell_methods.isEmpty()) - { - StdString cellMethodString = field->cell_methods; - if (field->cell_methods_mode.isEmpty() || - (CField::cell_methods_mode_attr::overwrite == field->cell_methods_mode)) - { - SuperClassWriter::addAttribute("cell_methods", cellMethodString, &fieldid); - alreadyAddCellMethod = true; - } - else - { - switch (field->cell_methods_mode) - { - case (CField::cell_methods_mode_attr::prefix): - cellMethodsPrefix = cellMethodString; - cellMethodsPrefix += " "; - break; - case (CField::cell_methods_mode_attr::suffix): - cellMethodsSuffix = " "; - cellMethodsSuffix += cellMethodString; - break; - case (CField::cell_methods_mode_attr::none): - break; - default: - break; - } - } - } - - - if (wtime) - { - CDuration freqOp = field->freq_op.getValue(); - freqOp.solveTimeStep(*context->calendar); - StdString freqOpStr = freqOp.toStringUDUnits(); - SuperClassWriter::addAttribute("interval_operation", freqOpStr, &fieldid); - - CDuration freqOut = field->getRelFile()->output_freq.getValue(); - freqOut.solveTimeStep(*context->calendar); - SuperClassWriter::addAttribute("interval_write", freqOut.toStringUDUnits(), &fieldid); - - StdString cellMethods(cellMethodsPrefix + "time: "); - if (field->operation.getValue() == "instant") cellMethods += "point"; - else if (field->operation.getValue() == "average") cellMethods += "mean"; - else if (field->operation.getValue() == "accumulate") cellMethods += "sum"; - else cellMethods += field->operation; - if (freqOp.resolve(*context->calendar) != freqOut.resolve(*context->calendar)) - cellMethods += " (interval: " + freqOpStr + ")"; - cellMethods += cellMethodsSuffix; - if (!alreadyAddCellMethod) - SuperClassWriter::addAttribute("cell_methods", cellMethods, &fieldid); - } - - if (hasArea) - SuperClassWriter::addAttribute("cell_measures", cellMeasures, &fieldid); - - if (!field->default_value.isEmpty()) - { - double default_value = field->default_value.getValue(); - if (type == NC_DOUBLE) - { - SuperClassWriter::setDefaultValue(fieldid, &default_value); - } - else if (type == NC_SHORT) - { - short sdefault_value = (short)default_value; - SuperClassWriter::setDefaultValue(fieldid, &sdefault_value); - } - else - { - float fdefault_value = (float)default_value; - SuperClassWriter::setDefaultValue(fieldid, &fdefault_value); - } - } - else - SuperClassWriter::setDefaultValue(fieldid, (double*)NULL); - - if (field->compression_level.isEmpty()) - field->compression_level = field->getRelFile()->compression_level.isEmpty() ? 0 : field->getRelFile()->compression_level; - SuperClassWriter::setCompressionLevel(fieldid, field->compression_level); - - { // Ecriture des coordonnes - - StdString coordstr; //boost::algorithm::join(coodinates, " ") - std::vector::iterator - itc = coodinates.begin(), endc = coodinates.end(); - - for (; itc!= endc; itc++) - { - StdString & coord = *itc; - if (itc+1 != endc) - coordstr.append(coord).append(" "); - else coordstr.append(coord); - } - - SuperClassWriter::addAttribute("coordinates", coordstr, &fieldid); - - } - - vector listVars = field->getAllVariables() ; - for (vector::iterator it = listVars.begin() ;it != listVars.end(); it++) writeAttribute_(*it, fieldid) ; - - } - catch (CNetCdfException& e) - { - StdString msg("On writing field : "); - msg.append(fieldid); msg.append("\n"); - msg.append("In the context : "); - msg.append(context->getId()); msg.append("\n"); - msg.append(e.what()); - ERROR("CNc4DataOutput::writeField_(CField* field)", << msg); - } - } // writeField_() - - //-------------------------------------------------------------- - - void CNc4DataOutput::writeFile_ (CFile* file) - { - StdString filename = file->getFileOutputName(); - StdString description = (!file->description.isEmpty()) - ? file->description.getValue() - : StdString("Created by xios"); - - singleDomain = (file->nbDomains == 1); - - StdString conv_str ; - if (file->convention_str.isEmpty()) - { - if (SuperClassWriter::useCFConvention) conv_str="CF-1.6" ; - else conv_str="UGRID" ; - } - else conv_str=file->convention_str ; - - try - { - if (!appendMode) this->writeFileAttributes(filename, description, - conv_str, - StdString("An IPSL model"), - this->getTimeStamp()); - - if (!appendMode) - SuperClassWriter::addDimension("axis_nbounds", 2); - } - catch (CNetCdfException& e) - { - StdString msg("On writing file : "); - msg.append(filename); msg.append("\n"); - msg.append("In the context : "); - CContext* context = CContext::getCurrent() ; - msg.append(context->getId()); msg.append("\n"); - msg.append(e.what()); - ERROR("CNc4DataOutput::writeFile_ (CFile* file)", << msg); - } - } - - void CNc4DataOutput::writeAttribute_ (CVariable* var, const string& fieldId) - { - StdString name = var->getVariableOutputName(); - - try - { - if (var->type.getValue() == CVariable::type_attr::t_int || var->type.getValue() == CVariable::type_attr::t_int32) - addAttribute(name, var->getData(), &fieldId); - else if (var->type.getValue() == CVariable::type_attr::t_int16) - addAttribute(name, var->getData(), &fieldId); - else if (var->type.getValue() == CVariable::type_attr::t_float) - addAttribute(name, var->getData(), &fieldId); - else if (var->type.getValue() == CVariable::type_attr::t_double) - addAttribute(name, var->getData(), &fieldId); - else if (var->type.getValue() == CVariable::type_attr::t_string) - addAttribute(name, var->getData(), &fieldId); - else - ERROR("CNc4DataOutput::writeAttribute_ (CVariable* var, const string& fieldId)", - << "Unsupported variable of type " << var->type.getStringValue()); - } - catch (CNetCdfException& e) - { - StdString msg("On writing attributes of variable with name : "); - msg.append(name); msg.append("in the field "); msg.append(fieldId); msg.append("\n"); - msg.append("In the context : "); - CContext* context = CContext::getCurrent() ; - msg.append(context->getId()); msg.append("\n"); - msg.append(e.what()); - ERROR("CNc4DataOutput::writeAttribute_ (CVariable* var, const string& fieldId)", << msg); - } - } - - void CNc4DataOutput::writeAttribute_ (CVariable* var) - { - StdString name = var->getVariableOutputName(); - - try - { - if (var->type.getValue() == CVariable::type_attr::t_int || var->type.getValue() == CVariable::type_attr::t_int32) - addAttribute(name, var->getData()); - else if (var->type.getValue() == CVariable::type_attr::t_int16) - addAttribute(name, var->getData()); - else if (var->type.getValue() == CVariable::type_attr::t_float) - addAttribute(name, var->getData()); - else if (var->type.getValue() == CVariable::type_attr::t_double) - addAttribute(name, var->getData()); - else if (var->type.getValue() == CVariable::type_attr::t_string) - addAttribute(name, var->getData()); - else - ERROR("CNc4DataOutput::writeAttribute_ (CVariable* var)", - << "Unsupported variable of type " << var->type.getStringValue()); - } - catch (CNetCdfException& e) - { - StdString msg("On writing attributes of variable with name : "); - msg.append(name); msg.append("\n"); - msg.append("In the context : "); - CContext* context = CContext::getCurrent() ; - msg.append(context->getId()); msg.append("\n"); - msg.append(e.what()); - ERROR("CNc4DataOutput::writeAttribute_ (CVariable* var)", << msg); - } - } - - void CNc4DataOutput::syncFile_ (void) - { - try - { - SuperClassWriter::sync() ; - } - catch (CNetCdfException& e) - { - StdString msg("On synchronizing the write among processes"); - msg.append("In the context : "); - CContext* context = CContext::getCurrent() ; - msg.append(context->getId()); msg.append("\n"); - msg.append(e.what()); - ERROR("CNc4DataOutput::syncFile_ (void)", << msg); - } - } - - void CNc4DataOutput::closeFile_ (void) - { - try - { - SuperClassWriter::close() ; - } - catch (CNetCdfException& e) - { - StdString msg("On closing file"); - msg.append("In the context : "); - CContext* context = CContext::getCurrent() ; - msg.append(context->getId()); msg.append("\n"); - msg.append(e.what()); - ERROR("CNc4DataOutput::syncFile_ (void)", << msg); - } - - } - - //--------------------------------------------------------------- - - StdString CNc4DataOutput::getTimeStamp(void) const - { - const int buffer_size = 100; - time_t rawtime; - struct tm * timeinfo = NULL; - char buffer [buffer_size]; - StdString formatStr; - if (file->time_stamp_format.isEmpty()) formatStr="%Y-%b-%d %H:%M:%S %Z" ; - else formatStr=file->time_stamp_format; - -// time ( &rawtime ); -// timeinfo = localtime ( &rawtime ); - time ( &rawtime ); - timeinfo = gmtime ( &rawtime ); - strftime (buffer, buffer_size, formatStr.c_str(), timeinfo); - - return (StdString(buffer)); - } - - //--------------------------------------------------------------- - - int CNc4DataOutput::writeFieldData_ (CField* field, const CArray& data, const CDate& lastWrite, - const CDate& currentWrite, int nstep) - { - CContext* context = CContext::getCurrent(); - CGrid* grid = field->getGrid(); - - if (nstep<1) - { - return nstep; - } - - if (!grid->doGridHaveDataToWrite()) - if (SuperClass::type == MULTI_FILE || !isCollective) - { - return nstep; - } - - StdString fieldid = field->getFieldOutputName(); - - StdOStringStream oss; - string timeAxisId; - if (field->hasTimeInstant) timeAxisId = "time_instant"; - else if (field->hasTimeCentered) timeAxisId = "time_centered"; - - StdString timeBoundId = getTimeCounterName() + "_bounds"; - - StdString timeAxisBoundId; - if (field->hasTimeInstant) timeAxisBoundId = "time_instant_bounds"; - else if (field->hasTimeCentered) timeAxisBoundId = "time_centered_bounds"; - - if (!field->wasWritten()) - { - if (appendMode && field->getRelFile()->record_offset.isEmpty() && - field->getOperationTimeType() != func::CFunctor::once) - { - double factorUnit; - if (!field->getRelFile()->time_units.isEmpty() && field->getRelFile()->time_units==CFile::time_units_attr::days) - factorUnit=context->getCalendar()->getDayLengthInSeconds() ; - else factorUnit=1 ; - nstep = getRecordFromTime(currentWrite,factorUnit) + 1; - } - - field->setWritten(); - } - - - CArray time_data(1); - CArray time_data_bound(2); - CArray time_counter(1); - CArray time_counter_bound(2); - - bool wtime = (field->getOperationTimeType() != func::CFunctor::once); - bool wtimeCounter =false ; - bool wtimeData =false ; - - - if (wtime) - { - - if (field->hasTimeInstant) - { - time_data(0) = time_data_bound(1) = (Time) lastWrite; - time_data_bound(0) = time_data_bound(1) = (Time) currentWrite; - if (timeCounterType==instant) - { - time_counter(0) = time_data(0); - time_counter_bound(0) = time_data_bound(0); - time_counter_bound(1) = time_data_bound(1); - wtimeCounter=true ; - } - if (hasTimeInstant) wtimeData=true ; - } - else if (field->hasTimeCentered) - { - time_data(0) = ((Time)currentWrite + (Time)lastWrite) / 2; - time_data_bound(0) = (Time)lastWrite; - time_data_bound(1) = (Time)currentWrite; - if (timeCounterType==centered) - { - time_counter(0) = time_data(0) ; - time_counter_bound(0) = time_data_bound(0) ; - time_counter_bound(1) = time_data_bound(1) ; - wtimeCounter=true ; - } - if (hasTimeCentered) wtimeData=true ; - } - - if (timeCounterType==record) - { - time_counter(0) = nstep - 1; - time_counter_bound(0) = time_counter_bound(1) = nstep - 1; - wtimeCounter=true ; - } - - if (!field->getRelFile()->time_units.isEmpty() && field->getRelFile()->time_units==CFile::time_units_attr::days) - { - double secByDay=context->getCalendar()->getDayLengthInSeconds() ; - time_data/=secByDay; - time_data_bound/=secByDay; - time_counter/=secByDay; - time_counter_bound/=secByDay; - } - } - - bool isRoot = (context->intraCommRank_ == 0); - - try - { - switch (SuperClass::type) - { - case (MULTI_FILE) : - { - CTimer::get("Files : writing data").resume(); - SuperClassWriter::writeData(data, fieldid, isCollective, nstep - 1); - CTimer::get("Files : writing data").suspend(); - if (wtime) - { - CTimer::get("Files : writing time axis").resume(); - if ( wtimeData) - { - SuperClassWriter::writeTimeAxisData(time_data, timeAxisId, isCollective, nstep - 1, isRoot); - SuperClassWriter::writeTimeAxisDataBounds(time_data_bound, timeAxisBoundId, isCollective, nstep - 1, isRoot); - } - if (wtimeCounter) - { - SuperClassWriter::writeTimeAxisData(time_counter, getTimeCounterName(), isCollective, nstep - 1,isRoot); - if (timeCounterType!=record) SuperClassWriter::writeTimeAxisDataBounds(time_counter_bound, timeBoundId, isCollective, nstep - 1, isRoot); - } - CTimer::get("Files : writing time axis").suspend(); - } - break; - } - case (ONE_FILE) : - { - - std::vector start, count; - - if (field->getUseCompressedOutput()) - { - CArray axisDomainOrder = grid->axis_domain_order; - std::vector domainList = grid->getDomainList(); - std::vector axisList = grid->getAxisList(); - int numElement = axisDomainOrder.numElements(); - int idxDomain = domainList.size() - 1, idxAxis = axisList.size() - 1; - int idx = domainList.size() * 2 + axisList.size() - 1; - int commRank ; - - MPI_Comm_rank(comm_file,&commRank) ; - - start.reserve(idx+1); - count.reserve(idx+1); - - for (int i = numElement - 1; i >= 0; --i) - { - if (2 == axisDomainOrder(i)) - { - CDomain* domain = CDomain::get(domainList[idxDomain]); - - if (domain->isCompressible()) - { - size_t offset ; - size_t nbIndexes = domain->getLocalView(CElementView::WORKFLOW)->getSize() ; - if (domain->isDistributed()) - { - MPI_Exscan(&nbIndexes, &offset, 1, MPI_SIZE_T, MPI_SUM, comm_file) ; - if (commRank==0) offset=0 ; - } - else offset=0 ; - - start.push_back(offset); - count.push_back(nbIndexes); - idx -= 2; - } - else - { - if ((domain->type) != CDomain::type_attr::unstructured) - { - start.push_back(domain->jbegin); - count.push_back(domain->nj); - } - --idx; - start.push_back(domain->ibegin); - count.push_back(domain->ni); - --idx; - } - --idxDomain; - } - else if (1 == axisDomainOrder(i)) - { - CAxis* axis = CAxis::get(axisList[idxAxis]); - - if (axis->isCompressible()) - { - size_t offset ; - size_t nbIndexes = axis->getLocalView(CElementView::WORKFLOW)->getSize() ; - if (axis->isDistributed()) - { - MPI_Exscan(&nbIndexes, &offset, 1, MPI_SIZE_T, MPI_SUM, comm_file) ; - if (commRank==0) offset=0 ; - } - else offset=0 ; - - start.push_back(offset); - count.push_back(nbIndexes); - } - else - { - start.push_back(axis->begin); - count.push_back(axis->n); - } - --idxAxis; - --idx; - } - } - } - else - { - CArray axisDomainOrder = grid->axis_domain_order; - std::vector domainList = grid->getDomainList(); - std::vector axisList = grid->getAxisList(); - std::vector scalarList = grid->getScalarList() ; - int numElement = axisDomainOrder.numElements(); - int idxDomain = domainList.size() - 1, idxAxis = axisList.size() - 1; - int idx = domainList.size() * 2 + axisList.size() - 1; - - start.reserve(idx+1); - count.reserve(idx+1); - - for (int i = numElement - 1; i >= 0; --i) - { - if (2 == axisDomainOrder(i)) - { - CDomain* domain = CDomain::get(domainList[idxDomain]); - if ((domain->type) != CDomain::type_attr::unstructured) - { - start.push_back(domain->jbegin); - count.push_back(domain->nj); - } - --idx ; - - start.push_back(domain->ibegin); - count.push_back(domain->ni); - --idx ; - --idxDomain; - } - else if (1 == axisDomainOrder(i)) - { - CAxis* axis = CAxis::get(axisList[idxAxis]); - start.push_back(axis->begin); - count.push_back(axis->n); - --idx; - --idxAxis; - } - else - { - if (1 == axisDomainOrder.numElements()) - { - CScalar* scalar = CScalar::get(scalarList[scalarList.size()-1]); - start.push_back(0); - count.push_back(scalar->n); - } - --idx; - } - } - } - - - CTimer::get("Files : writing data").resume(); - SuperClassWriter::writeData(data, fieldid, isCollective, nstep - 1, &start, &count); - CTimer::get("Files : writing data").suspend(); - - if (wtime) - { - CTimer::get("Files : writing time axis").resume(); - if ( wtimeData) - { - SuperClassWriter::writeTimeAxisData(time_data, timeAxisId, isCollective, nstep - 1, isRoot); - SuperClassWriter::writeTimeAxisDataBounds(time_data_bound, timeAxisBoundId, isCollective, nstep - 1, isRoot); - } - if (wtimeCounter) - { - SuperClassWriter::writeTimeAxisData(time_counter, getTimeCounterName(), isCollective, nstep - 1,isRoot); - if (timeCounterType!=record) SuperClassWriter::writeTimeAxisDataBounds(time_counter_bound, timeBoundId, isCollective, nstep - 1, isRoot); - - } - CTimer::get("Files : writing time axis").suspend(); - } - - break; - } - } - return nstep ; - } - catch (CNetCdfException& e) - { - StdString msg("On writing field data: "); - msg.append(fieldid); msg.append("\n"); - msg.append("In the context : "); - msg.append(context->getId()); msg.append("\n"); - msg.append(e.what()); - ERROR("CNc4DataOutput::writeFieldData_ (CField* field)", << msg); - } - } - - //--------------------------------------------------------------- - - void CNc4DataOutput::writeTimeAxis_ - (CField* field, - const std::shared_ptr cal) - { - StdOStringStream oss; - bool createInstantAxis=false ; - bool createCenteredAxis=false ; - bool createTimeCounterAxis=false ; - - if (field->getOperationTimeType() == func::CFunctor::once) return ; - - - StdString axisId ; - StdString axisBoundId; - StdString timeid(getTimeCounterName()); - StdString timeBoundId("axis_nbounds"); - - StdString strTimeUnits ; - if (!field->getRelFile()->time_units.isEmpty() && field->getRelFile()->time_units==CFile::time_units_attr::days) strTimeUnits="days since " ; - else strTimeUnits="seconds since " ; - - if (field->getOperationTimeType() == func::CFunctor::instant) field->hasTimeInstant = true; - if (field->getOperationTimeType() == func::CFunctor::centered) field->hasTimeCentered = true; - - - if (field->getRelFile()->time_counter.isEmpty()) - { - if (timeCounterType==none) createTimeCounterAxis=true ; - if (field->hasTimeCentered) - { - timeCounterType=centered ; - if (!hasTimeCentered) createCenteredAxis=true ; - } - if (field->hasTimeInstant) - { - if (timeCounterType==none) timeCounterType=instant ; - if (!hasTimeInstant) createInstantAxis=true ; - } - } - else if (field->getRelFile()->time_counter==CFile::time_counter_attr::instant) - { - if (field->hasTimeCentered) - { - if (!hasTimeCentered) createCenteredAxis=true ; - } - if (field->hasTimeInstant) - { - if (timeCounterType==none) createTimeCounterAxis=true ; - timeCounterType=instant ; - if (!hasTimeInstant) createInstantAxis=true ; - } - } - else if (field->getRelFile()->time_counter==CFile::time_counter_attr::centered) - { - if (field->hasTimeCentered) - { - if (timeCounterType==none) createTimeCounterAxis=true ; - timeCounterType=centered ; - if (!hasTimeCentered) createCenteredAxis=true ; - } - if (field->hasTimeInstant) - { - if (!hasTimeInstant) createInstantAxis=true ; - } - } - else if (field->getRelFile()->time_counter==CFile::time_counter_attr::instant_exclusive) - { - if (field->hasTimeCentered) - { - if (!hasTimeCentered) createCenteredAxis=true ; - } - if (field->hasTimeInstant) - { - if (timeCounterType==none) createTimeCounterAxis=true ; - timeCounterType=instant ; - } - } - else if (field->getRelFile()->time_counter==CFile::time_counter_attr::centered_exclusive) - { - if (field->hasTimeCentered) - { - if (timeCounterType==none) createTimeCounterAxis=true ; - timeCounterType=centered ; - } - if (field->hasTimeInstant) - { - if (!hasTimeInstant) createInstantAxis=true ; - } - } - else if (field->getRelFile()->time_counter==CFile::time_counter_attr::exclusive) - { - if (field->hasTimeCentered) - { - if (timeCounterType==none) createTimeCounterAxis=true ; - if (timeCounterType==instant) createInstantAxis=true ; - timeCounterType=centered ; - } - if (field->hasTimeInstant) - { - if (timeCounterType==none) - { - createTimeCounterAxis=true ; - timeCounterType=instant ; - } - if (timeCounterType==centered) - { - if (!hasTimeInstant) createInstantAxis=true ; - } - } - } - else if (field->getRelFile()->time_counter==CFile::time_counter_attr::none) - { - if (field->hasTimeCentered) - { - if (!hasTimeCentered) createCenteredAxis=true ; - } - if (field->hasTimeInstant) - { - if (!hasTimeInstant) createInstantAxis=true ; - } - } - else if (field->getRelFile()->time_counter==CFile::time_counter_attr::record) - { - if (timeCounterType==none) createTimeCounterAxis=true ; - timeCounterType=record ; - if (field->hasTimeCentered) - { - if (!hasTimeCentered) createCenteredAxis=true ; - } - if (field->hasTimeInstant) - { - if (!hasTimeInstant) createInstantAxis=true ; - } - } - - if (createInstantAxis) - { - axisId="time_instant" ; - axisBoundId="time_instant_bounds"; - hasTimeInstant=true ; - } - - if (createCenteredAxis) - { - axisId="time_centered" ; - axisBoundId="time_centered_bounds"; - hasTimeCentered=true ; - } - - - try - { - std::vector dims; - - if (createInstantAxis || createCenteredAxis) - { - // Adding time_instant or time_centered - dims.push_back(timeid); - if (!SuperClassWriter::varExist(axisId)) - { - SuperClassWriter::addVariable(axisId, NC_DOUBLE, dims); - - CDate timeOrigin=cal->getTimeOrigin() ; - StdOStringStream oss2; - StdString strInitdate=oss2.str() ; - StdString strTimeOrigin=timeOrigin.toString() ; - this->writeTimeAxisAttributes(axisId, cal->getType(),strTimeUnits+strTimeOrigin, - strTimeOrigin, axisBoundId); - } - - // Adding time_instant_bounds or time_centered_bounds variables - if (!SuperClassWriter::varExist(axisBoundId)) - { - dims.clear() ; - dims.push_back(timeid); - dims.push_back(timeBoundId); - SuperClassWriter::addVariable(axisBoundId, NC_DOUBLE, dims); - } - } - - if (createTimeCounterAxis) - { - // Adding time_counter - axisId = getTimeCounterName(); - axisBoundId = getTimeCounterName() + "_bounds"; - dims.clear(); - dims.push_back(timeid); - if (!SuperClassWriter::varExist(axisId)) - { - SuperClassWriter::addVariable(axisId, NC_DOUBLE, dims); - SuperClassWriter::addAttribute("axis", string("T"), &axisId); - - if (field->getRelFile()->time_counter.isEmpty() || - (field->getRelFile()->time_counter != CFile::time_counter_attr::record)) - { - CDate timeOrigin = cal->getTimeOrigin(); - StdString strTimeOrigin = timeOrigin.toString(); - - this->writeTimeAxisAttributes(axisId, cal->getType(), - strTimeUnits+strTimeOrigin, - strTimeOrigin, axisBoundId); - } - } - - // Adding time_counter_bound dimension - if (field->getRelFile()->time_counter.isEmpty() || (field->getRelFile()->time_counter != CFile::time_counter_attr::record)) - { - if (!SuperClassWriter::varExist(axisBoundId)) - { - dims.clear(); - dims.push_back(timeid); - dims.push_back(timeBoundId); - SuperClassWriter::addVariable(axisBoundId, NC_DOUBLE, dims); - } - } - } - } - catch (CNetCdfException& e) - { - StdString msg("On writing time axis data: "); - msg.append("In the context : "); - CContext* context = CContext::getCurrent() ; - msg.append(context->getId()); msg.append("\n"); - msg.append(e.what()); - ERROR("CNc4DataOutput::writeTimeAxis_ (CField* field, \ - const std::shared_ptr cal)", << msg); - } - } - - //--------------------------------------------------------------- - - void CNc4DataOutput::writeTimeAxisAttributes(const StdString & axis_name, - const StdString & calendar, - const StdString & units, - const StdString & time_origin, - const StdString & time_bounds, - const StdString & standard_name, - const StdString & long_name) - { - try - { - SuperClassWriter::addAttribute("standard_name", standard_name, &axis_name); - SuperClassWriter::addAttribute("long_name", long_name , &axis_name); - SuperClassWriter::addAttribute("calendar", calendar , &axis_name); - SuperClassWriter::addAttribute("units", units , &axis_name); - SuperClassWriter::addAttribute("time_origin", time_origin , &axis_name); - SuperClassWriter::addAttribute("bounds", time_bounds , &axis_name); - } - catch (CNetCdfException& e) - { - StdString msg("On writing time axis Attribute: "); - msg.append("In the context : "); - CContext* context = CContext::getCurrent() ; - msg.append(context->getId()); msg.append("\n"); - msg.append(e.what()); - ERROR("CNc4DataOutput::writeTimeAxisAttributes(const StdString & axis_name, \ - const StdString & calendar,\ - const StdString & units, \ - const StdString & time_origin, \ - const StdString & time_bounds, \ - const StdString & standard_name, \ - const StdString & long_name)", << msg); - } - } - - //--------------------------------------------------------------- - - void CNc4DataOutput::writeAxisAttributes(const StdString & axis_name, - const StdString & axis, - const StdString & standard_name, - const StdString & long_name, - const StdString & units, - const StdString & nav_model) - { - try - { - if (!axis.empty()) - SuperClassWriter::addAttribute("axis" , axis , &axis_name); - - SuperClassWriter::addAttribute("standard_name", standard_name, &axis_name); - SuperClassWriter::addAttribute("long_name" , long_name , &axis_name); - SuperClassWriter::addAttribute("units" , units , &axis_name); -// SuperClassWriter::addAttribute("nav_model" , nav_model , &axis_name); - } - catch (CNetCdfException& e) - { - StdString msg("On writing Axis Attribute: "); - msg.append("In the context : "); - CContext* context = CContext::getCurrent() ; - msg.append(context->getId()); msg.append("\n"); - msg.append(e.what()); - ERROR("CNc4DataOutput::writeAxisAttributes(const StdString & axis_name, \ - const StdString & axis, \ - const StdString & standard_name, \ - const StdString & long_name, \ - const StdString & units, \ - const StdString & nav_model)", << msg); - } - } - - //--------------------------------------------------------------- - - void CNc4DataOutput::writeLocalAttributes - (int ibegin, int ni, int jbegin, int nj, StdString domid) - { - try - { - SuperClassWriter::addAttribute(StdString("ibegin").append(domid), ibegin); - SuperClassWriter::addAttribute(StdString("ni" ).append(domid), ni); - SuperClassWriter::addAttribute(StdString("jbegin").append(domid), jbegin); - SuperClassWriter::addAttribute(StdString("nj" ).append(domid), nj); - } - catch (CNetCdfException& e) - { - StdString msg("On writing Local Attributes: "); - msg.append("In the context : "); - CContext* context = CContext::getCurrent() ; - msg.append(context->getId()); msg.append("\n"); - msg.append(e.what()); - ERROR("CNc4DataOutput::writeLocalAttributes \ - (int ibegin, int ni, int jbegin, int nj, StdString domid)", << msg); - } - - } - - void CNc4DataOutput::writeLocalAttributes_IOIPSL(const StdString& dimXid, const StdString& dimYid, - int ibegin, int ni, int jbegin, int nj, int ni_glo, int nj_glo, int rank, int size) - { - CArray array(2) ; - - try - { - SuperClassWriter::addAttribute("DOMAIN_number_total",size ) ; - SuperClassWriter::addAttribute("DOMAIN_number", rank) ; - array = SuperClassWriter::getDimension(dimXid) + 1, SuperClassWriter::getDimension(dimYid) + 1; - SuperClassWriter::addAttribute("DOMAIN_dimensions_ids",array) ; - array=ni_glo,nj_glo ; - SuperClassWriter::addAttribute("DOMAIN_size_global", array) ; - array=ni,nj ; - SuperClassWriter::addAttribute("DOMAIN_size_local", array) ; - array=ibegin+1,jbegin+1 ; - SuperClassWriter::addAttribute("DOMAIN_position_first", array) ; - array=ibegin+ni-1+1,jbegin+nj-1+1 ; - SuperClassWriter::addAttribute("DOMAIN_position_last",array) ; - array=0,0 ; - SuperClassWriter::addAttribute("DOMAIN_halo_size_start", array) ; - SuperClassWriter::addAttribute("DOMAIN_halo_size_end", array); - SuperClassWriter::addAttribute("DOMAIN_type",string("box")) ; - /* - SuperClassWriter::addAttribute("DOMAIN_DIM_N001",string("x")) ; - SuperClassWriter::addAttribute("DOMAIN_DIM_N002",string("y")) ; - SuperClassWriter::addAttribute("DOMAIN_DIM_N003",string("axis_A")) ; - SuperClassWriter::addAttribute("DOMAIN_DIM_N004",string("time_counter")) ; - */ - } - catch (CNetCdfException& e) - { - StdString msg("On writing Local Attributes IOIPSL \n"); - msg.append("In the context : "); - CContext* context = CContext::getCurrent() ; - msg.append(context->getId()); msg.append("\n"); - msg.append(e.what()); - ERROR("CNc4DataOutput::writeLocalAttributes_IOIPSL \ - (int ibegin, int ni, int jbegin, int nj, int ni_glo, int nj_glo, int rank, int size)", << msg); - } - } - //--------------------------------------------------------------- - - void CNc4DataOutput:: writeFileAttributes(const StdString & name, - const StdString & description, - const StdString & conventions, - const StdString & production, - const StdString & timeStamp) - { - try - { - SuperClassWriter::addAttribute("name" , name); - SuperClassWriter::addAttribute("description", description); - SuperClassWriter::addAttribute("title" , description); - SuperClassWriter::addAttribute("Conventions", conventions); - // SuperClassWriter::addAttribute("production" , production); - - StdString timeStampStr ; - if (file->time_stamp_name.isEmpty()) timeStampStr="timeStamp" ; - else timeStampStr=file->time_stamp_name ; - SuperClassWriter::addAttribute(timeStampStr, timeStamp); - - StdString uuidName ; - if (file->uuid_name.isEmpty()) uuidName="uuid" ; - else uuidName=file->uuid_name ; - - if (file->uuid_format.isEmpty()) SuperClassWriter::addAttribute(uuidName, getUuidStr()); - else SuperClassWriter::addAttribute(uuidName, getUuidStr(file->uuid_format)); - - } - catch (CNetCdfException& e) - { - StdString msg("On writing File Attributes \n "); - msg.append("In the context : "); - CContext* context = CContext::getCurrent() ; - msg.append(context->getId()); msg.append("\n"); - msg.append(e.what()); - ERROR("CNc4DataOutput:: writeFileAttributes(const StdString & name, \ - const StdString & description, \ - const StdString & conventions, \ - const StdString & production, \ - const StdString & timeStamp)", << msg); - } - } - - //--------------------------------------------------------------- - - void CNc4DataOutput::writeMaskAttributes(const StdString & mask_name, - int data_dim, - int data_ni, - int data_nj, - int data_ibegin, - int data_jbegin) - { - try - { - SuperClassWriter::addAttribute("data_dim" , data_dim , &mask_name); - SuperClassWriter::addAttribute("data_ni" , data_ni , &mask_name); - SuperClassWriter::addAttribute("data_nj" , data_nj , &mask_name); - SuperClassWriter::addAttribute("data_ibegin", data_ibegin, &mask_name); - SuperClassWriter::addAttribute("data_jbegin", data_jbegin, &mask_name); - } - catch (CNetCdfException& e) - { - StdString msg("On writing Mask Attributes \n "); - msg.append("In the context : "); - CContext* context = CContext::getCurrent() ; - msg.append(context->getId()); msg.append("\n"); - msg.append(e.what()); - ERROR("CNc4DataOutput::writeMaskAttributes(const StdString & mask_name, \ - int data_dim, \ - int data_ni, \ - int data_nj, \ - int data_ibegin, \ - int data_jbegin)", << msg); - } - } - - ///-------------------------------------------------------------- - - StdSize CNc4DataOutput::getRecordFromTime(Time time, double factorUnit) - { - std::map::const_iterator it = timeToRecordCache.find(time); - if (it == timeToRecordCache.end()) - { - StdString timeAxisBoundsId(getTimeCounterName() + "_bounds"); - if (!SuperClassWriter::varExist(timeAxisBoundsId)) timeAxisBoundsId = "time_centered_bounds"; - if (!SuperClassWriter::varExist(timeAxisBoundsId)) timeAxisBoundsId = "time_instant_bounds"; - - CArray timeAxisBounds; - std::vector dimSize(SuperClassWriter::getDimensions(timeAxisBoundsId)) ; - - StdSize record = 0; - double dtime(time); - for (int n = dimSize[0] - 1; n >= 0; n--) - { - SuperClassWriter::getTimeAxisBounds(timeAxisBounds, timeAxisBoundsId, isCollective, n); - timeAxisBounds*=factorUnit ; - if (timeAxisBounds(1, 0) < dtime) - { - record = n + 1; - break; - } - } - it = timeToRecordCache.insert(std::make_pair(time, record)).first; - } - return it->second; - } - - ///-------------------------------------------------------------- - - bool CNc4DataOutput::isWrittenDomain(const std::string& domainName) const - { - return (this->writtenDomains.find(domainName) != this->writtenDomains.end()); - } - - bool CNc4DataOutput::isWrittenCompressedDomain(const std::string& domainName) const - { - return (this->writtenCompressedDomains.find(domainName) != this->writtenCompressedDomains.end()); - } - - bool CNc4DataOutput::isWrittenAxis(const std::string& axisName) const - { - return (this->writtenAxis.find(axisName) != this->writtenAxis.end()); - } - - bool CNc4DataOutput::isWrittenCompressedAxis(const std::string& axisName) const - { - return (this->writtenCompressedAxis.find(axisName) != this->writtenCompressedAxis.end()); - } - - bool CNc4DataOutput::isWrittenScalar(const std::string& scalarName) const - { - return (this->writtenScalar.find(scalarName) != this->writtenScalar.end()); - } - - void CNc4DataOutput::setWrittenDomain(const std::string& domainName) - { - this->writtenDomains.insert(domainName); - } - - void CNc4DataOutput::setWrittenCompressedDomain(const std::string& domainName) - { - this->writtenCompressedDomains.insert(domainName); - } - - void CNc4DataOutput::setWrittenAxis(const std::string& axisName) - { - this->writtenAxis.insert(axisName); - } - - void CNc4DataOutput::setWrittenCompressedAxis(const std::string& axisName) - { - this->writtenCompressedAxis.insert(axisName); - } - - void CNc4DataOutput::setWrittenScalar(const std::string& scalarName) - { - this->writtenScalar.insert(scalarName); - } -} // namespace xios diff --git a/xios_2311_src/trunk/.svn/pristine/5d/5d27fc93a81261791f380dda193764a8efb1b5fa.svn-base b/xios_2311_src/trunk/.svn/pristine/5d/5d27fc93a81261791f380dda193764a8efb1b5fa.svn-base deleted file mode 100644 index cc0e6f306a9b48421c3f7b04ebf9aefc91e7b484..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/5d/5d27fc93a81261791f380dda193764a8efb1b5fa.svn-base +++ /dev/null @@ -1,46 +0,0 @@ -#include "d360.hpp" - -namespace xios -{ - /// ////////////////////// Définitions ////////////////////// /// - - CD360Calendar::CD360Calendar(const CDate& startDate) - : CCalendar("D360", startDate) - { - // This will check that the dates are conform with the calendar. - // We cannot call this from the parent constructor because we - // want the methods of this class to be used - initializeDate(); - } - - CD360Calendar::CD360Calendar(const CDate& startDate, const CDate& timeOrigin) - : CCalendar("D360", startDate, timeOrigin) - { - // This will check that the dates are conform with the calendar. - // We cannot call this from the parent constructor because we - // want the methods of this class to be used - initializeDate(); - } - - CD360Calendar::CD360Calendar(int yr, int mth, int d, - int hr, int min, int sec) - : CCalendar("D360") - { initializeDate(yr, mth, d, hr, min, sec) ; } - - CD360Calendar::~CD360Calendar(void) - { /* Ne rien faire de plus */ } - - ///-------------------------------------------------------------- - - int CD360Calendar::getYearTotalLength(const CDate & date) const - { return (360 * 86400); } - - int CD360Calendar::getMonthLength(const CDate & date) const - { return (30); } - - StdString CD360Calendar::getType(void) const - { return (StdString("360_day")); } - - ///-------------------------------------------------------------- -} // namespace xios - diff --git a/xios_2311_src/trunk/.svn/pristine/5d/5d5369e0a95306cc0da013724f5e99d6be4e631b.svn-base b/xios_2311_src/trunk/.svn/pristine/5d/5d5369e0a95306cc0da013724f5e99d6be4e631b.svn-base deleted file mode 100644 index d7370a8c140fcad462cfb9121fca3c62625c1168..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/5d/5d5369e0a95306cc0da013724f5e99d6be4e631b.svn-base +++ /dev/null @@ -1,199 +0,0 @@ -body -{ - font-family: Helvetica, sans-serif; -} - -nav -{ - width:300px; - vertical-align: top; -} - -section -{ - clear: both; - margin-top:50px; - vertical-align: top; -} - -a -{ - display:block; -} - -caption -{ - font-size: 1.4em; - font-weight: bold; - caption-side: top; - margin-bottom: 20px; - text-align: left; -} - - -footer -{ - background-color: rgb(189, 184, 184); - border-width: medium; - border-style: dashed; - border-radius: 10px; - position: fixed; - bottom: 10px; - right: 10px; -} - - -h1, h2 -{ - text-align: left; -} - -.dropbtn { - background-color:transparent; - border: none; -} - -.dropdown { - position: relative; - display: inline-block; -} - -.dropdown-content { - display: none; - position: absolute; - background-color: white; - min-width: 320px; - box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); - z-index: 1; - font-size: 1em; -} - -.dropdown-content a { - color: black; - padding: 5px 5px; - text-decoration: none; - display: block; -} - -.dropdown-content a:hover -{ - background-color: #2e86c1; -} - -.dropdown:hover .dropbtn -{ - background-color:#2e86c1; -} - -.showit -{ - display: block; -} - -.compile_table -{ - margin-left: 60px; - margin-bottom: 30px; - margin-top: 30px; - /* border-collapse: collapse; */ - /* border: solid 1px black; */ -} - -.compile_table td -{ - margin-left: 20px; - margin-bottom: 10px; - border: solid 2px white; - min-width: 150px; - text-align: center; -} - -.compile_sub_table td -{ - border: solid 1px white; -} - -.compile_sub_table -{ - border-collapse: collapse; - margin-top: 10px; - margin-bottom: 10px; - margin-left: 10px; - margin-right: 10px; - -} - -.test_table -{ - margin-left: 60px; - margin-bottom: 30px; - margin-top: 30px; - /* border-collapse: collapse; */ -} - -.test_table td -{ - margin-left: 20px; - margin-bottom: 10px; - border: solid 2px white; - text-align: center; -} - - -.test_sub_table -{ - border-collapse: collapse; - margin-bottom: 10px; - margin-top: 10px; - margin-left: 10px; - margin-right: 10px; -} - -.test_sub_table td -{ - border: solid 1px white; - text-align: left; -} - -.test_sub_table .build_level -{ - background-color: #96cdff; -} - - -.test_sub_table .algo_level -{ - background-color: #a1d3ff; -} - -.test_sub_table .config_level -{ - background-color: #b3dafd; -} - -.test_sub_table .file_level -{ - background-color: #c2e1fd; -} - - - -.compile_table_row.hide -{ - display: none; -} - -.compile_table_row.show -{ - display: "table-row"; -} - -.test_table_row.hide -{ - display: none; -} - -.test_table_row.show -{ - display: "table-row"; -} diff --git a/xios_2311_src/trunk/.svn/pristine/5d/5d5580afb5970051aaccb632e4ce2545b2f37516.svn-base b/xios_2311_src/trunk/.svn/pristine/5d/5d5580afb5970051aaccb632e4ce2545b2f37516.svn-base deleted file mode 100644 index 85ce74b8a0c6bd2a5292094ae434a2bcabad87a5..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/5d/5d5580afb5970051aaccb632e4ce2545b2f37516.svn-base +++ /dev/null @@ -1,100 +0,0 @@ -/* - -This file is part of netcdf-4, a netCDF-like interface for HDF5, or a -HDF5 backend for netCDF, depending on your point of view. - -This file handles the nc_ calls, calling the appropriate nc3 or nc4 -function, depending on ncid. - -Copyright 2003, University Corporation for Atmospheric Research. See -netcdf-4/docs/COPYRIGHT file for copying and redistribution -conditions. -*/ - -#include "nc4internal.h" -#include "nc3dispatch.h" - -#ifdef IGNORE -/* Keep a linked list of file info objects. */ -extern NC_FILE_INFO_T *nc_file; -#endif - -#ifdef IGNORE -/* This function deletes a member of parliment. Be careful! Last time - * this function was used, Labor got in! This function only does - * anything for netcdf-3 files. */ - -int -nc_delete(const char *path) -{ - return NC3_delete_mp(path, 0); -} - -int -nc_delete_mp(const char *path, int basepe) -{ - return NC3_delete_mp(path, basepe); -} -#endif - -/* This will return the length of a netcdf data type in bytes. Since - we haven't added any new types, I just call the v3 function. - Ed Hartnett 10/43/03 -*/ - -/* This function only does anything for netcdf-3 files. */ -int -NC4_set_base_pe(int ncid, int pe) -{ - NC_FILE_INFO_T *nc; - if (!(nc = nc4_find_nc_file(ncid))) - return NC_EBADID; - if (nc->nc4_info) - return NC_ENOTNC3; - return NC3_set_base_pe(nc->int_ncid, pe); -} - -/* This function only does anything for netcdf-3 files. */ -int -NC4_inq_base_pe(int ncid, int *pe) -{ - NC_FILE_INFO_T *nc; - if (!(nc = nc4_find_nc_file(ncid))) - return NC_EBADID; - if (nc->nc4_info) - return NC_ENOTNC3; - return NC3_inq_base_pe(nc->int_ncid, pe); -} - -/* Get the format (i.e. classic, 64-bit-offset, or netcdf-4) of an - * open file. */ -int -NC4_inq_format(int ncid, int *formatp) -{ - NC_FILE_INFO_T *nc; - - LOG((2, "nc_inq_format: ncid 0x%x", ncid)); - - if (!formatp) - return NC_NOERR; - - /* Find the file metadata. */ - if (!(nc = nc4_find_nc_file(ncid))) - return NC_EBADID; - - /* If this isn't a netcdf-4 file, pass this call on to the netcdf-3 - * library. */ - if (!nc->nc4_info) - return NC3_inq_format(nc->int_ncid, formatp); - - /* Otherwise, this is a netcdf-4 file. Check if classic NC3 rules - * are in effect for this file. */ - if (nc->nc4_info->cmode & NC_CLASSIC_MODEL) - *formatp = NC_FORMAT_NETCDF4_CLASSIC; - else - *formatp = NC_FORMAT_NETCDF4; - - return NC_NOERR; -} - - diff --git a/xios_2311_src/trunk/.svn/pristine/5e/5e171f6c0d568408fa60d760915158cb462de6ea.svn-base b/xios_2311_src/trunk/.svn/pristine/5e/5e171f6c0d568408fa60d760915158cb462de6ea.svn-base deleted file mode 100644 index 6413dc9b2d795b70cda44ce1a8099044ffba556a..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/5e/5e171f6c0d568408fa60d760915158cb462de6ea.svn-base +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -export COPY_TO_SERVER=false -if [[ $1 == "--copy" ]] -then - export COPY_TO_SERVER=$2 - echo "copy to server =" ${COPY_TO_SERVER} -fi -source ./load_env -./launch_compile $1 $2 -if [[ -n $(find BUILD/ -name generic_testcase.exe) ]] -then - ./launch_test_suite $1 $2 -else - echo "All compilation test failed" -fi diff --git a/xios_2311_src/trunk/.svn/pristine/5e/5e898eef186cb1d269c3507c38920179fce24d6b.svn-base b/xios_2311_src/trunk/.svn/pristine/5e/5e898eef186cb1d269c3507c38920179fce24d6b.svn-base deleted file mode 100644 index 642edc9a06d899bf0b6d274676b5a7892c0e3c89..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/5e/5e898eef186cb1d269c3507c38920179fce24d6b.svn-base +++ /dev/null @@ -1,30 +0,0 @@ -#include "xios_fortran_prefix.hpp" - -MODULE IREORDER_DOMAIN - USE, INTRINSIC :: ISO_C_BINDING - USE REORDER_DOMAIN_INTERFACE - - TYPE txios(reorder_domain) - INTEGER(kind = C_INTPTR_T) :: daddr - END TYPE txios(reorder_domain) - - CONTAINS ! Fonctions disponibles pour les utilisateurs. - - SUBROUTINE xios(get_reorder_domain_handle)(idt,ret) - IMPLICIT NONE - CHARACTER(len = *), INTENT(IN) :: idt - TYPE(txios(reorder_domain)) , INTENT(OUT):: ret - CALL cxios_reorder_domain_handle_create(ret%daddr, idt, len(idt)) - END SUBROUTINE xios(get_reorder_domain_handle) - - LOGICAL FUNCTION xios(is_valid_reorder_domain)(idt) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: idt - LOGICAL (kind = 1) :: val - - CALL cxios_reorder_domain_valid_id(val, idt, len(idt)) - xios(is_valid_reorder_domain) = val - - END FUNCTION xios(is_valid_reorder_domain) - -END MODULE IREORDER_DOMAIN diff --git a/xios_2311_src/trunk/.svn/pristine/5e/5e9d8d839ca3650fb670df8b2e2c798a3987df62.svn-base b/xios_2311_src/trunk/.svn/pristine/5e/5e9d8d839ca3650fb670df8b2e2c798a3987df62.svn-base deleted file mode 100644 index 6ea91926b63ced505572fad1f1731b4eee468f35..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/5e/5e9d8d839ca3650fb670df8b2e2c798a3987df62.svn-base +++ /dev/null @@ -1,140 +0,0 @@ -! * ************************************************************************** * -! * Interface auto generated - do not modify * -! * ************************************************************************** * -#include "xios_fortran_prefix.hpp" - -MODULE iextract_axis_to_scalar_attr - USE, INTRINSIC :: ISO_C_BINDING - USE iextract_axis_to_scalar - USE extract_axis_to_scalar_interface_attr - -CONTAINS - - SUBROUTINE xios(set_extract_axis_to_scalar_attr) & - ( extract_axis_to_scalar_id, position ) - - IMPLICIT NONE - TYPE(txios(extract_axis_to_scalar)) :: extract_axis_to_scalar_hdl - CHARACTER(LEN=*), INTENT(IN) ::extract_axis_to_scalar_id - INTEGER , OPTIONAL, INTENT(IN) :: position - - CALL xios(get_extract_axis_to_scalar_handle) & - (extract_axis_to_scalar_id,extract_axis_to_scalar_hdl) - CALL xios(set_extract_axis_to_scalar_attr_hdl_) & - ( extract_axis_to_scalar_hdl, position ) - - END SUBROUTINE xios(set_extract_axis_to_scalar_attr) - - SUBROUTINE xios(set_extract_axis_to_scalar_attr_hdl) & - ( extract_axis_to_scalar_hdl, position ) - - IMPLICIT NONE - TYPE(txios(extract_axis_to_scalar)) , INTENT(IN) :: extract_axis_to_scalar_hdl - INTEGER , OPTIONAL, INTENT(IN) :: position - - CALL xios(set_extract_axis_to_scalar_attr_hdl_) & - ( extract_axis_to_scalar_hdl, position ) - - END SUBROUTINE xios(set_extract_axis_to_scalar_attr_hdl) - - SUBROUTINE xios(set_extract_axis_to_scalar_attr_hdl_) & - ( extract_axis_to_scalar_hdl, position_ ) - - IMPLICIT NONE - TYPE(txios(extract_axis_to_scalar)) , INTENT(IN) :: extract_axis_to_scalar_hdl - INTEGER , OPTIONAL, INTENT(IN) :: position_ - - IF (PRESENT(position_)) THEN - CALL cxios_set_extract_axis_to_scalar_position & - (extract_axis_to_scalar_hdl%daddr, position_) - ENDIF - - END SUBROUTINE xios(set_extract_axis_to_scalar_attr_hdl_) - - SUBROUTINE xios(get_extract_axis_to_scalar_attr) & - ( extract_axis_to_scalar_id, position ) - - IMPLICIT NONE - TYPE(txios(extract_axis_to_scalar)) :: extract_axis_to_scalar_hdl - CHARACTER(LEN=*), INTENT(IN) ::extract_axis_to_scalar_id - INTEGER , OPTIONAL, INTENT(OUT) :: position - - CALL xios(get_extract_axis_to_scalar_handle) & - (extract_axis_to_scalar_id,extract_axis_to_scalar_hdl) - CALL xios(get_extract_axis_to_scalar_attr_hdl_) & - ( extract_axis_to_scalar_hdl, position ) - - END SUBROUTINE xios(get_extract_axis_to_scalar_attr) - - SUBROUTINE xios(get_extract_axis_to_scalar_attr_hdl) & - ( extract_axis_to_scalar_hdl, position ) - - IMPLICIT NONE - TYPE(txios(extract_axis_to_scalar)) , INTENT(IN) :: extract_axis_to_scalar_hdl - INTEGER , OPTIONAL, INTENT(OUT) :: position - - CALL xios(get_extract_axis_to_scalar_attr_hdl_) & - ( extract_axis_to_scalar_hdl, position ) - - END SUBROUTINE xios(get_extract_axis_to_scalar_attr_hdl) - - SUBROUTINE xios(get_extract_axis_to_scalar_attr_hdl_) & - ( extract_axis_to_scalar_hdl, position_ ) - - IMPLICIT NONE - TYPE(txios(extract_axis_to_scalar)) , INTENT(IN) :: extract_axis_to_scalar_hdl - INTEGER , OPTIONAL, INTENT(OUT) :: position_ - - IF (PRESENT(position_)) THEN - CALL cxios_get_extract_axis_to_scalar_position & - (extract_axis_to_scalar_hdl%daddr, position_) - ENDIF - - END SUBROUTINE xios(get_extract_axis_to_scalar_attr_hdl_) - - SUBROUTINE xios(is_defined_extract_axis_to_scalar_attr) & - ( extract_axis_to_scalar_id, position ) - - IMPLICIT NONE - TYPE(txios(extract_axis_to_scalar)) :: extract_axis_to_scalar_hdl - CHARACTER(LEN=*), INTENT(IN) ::extract_axis_to_scalar_id - LOGICAL, OPTIONAL, INTENT(OUT) :: position - LOGICAL(KIND=C_BOOL) :: position_tmp - - CALL xios(get_extract_axis_to_scalar_handle) & - (extract_axis_to_scalar_id,extract_axis_to_scalar_hdl) - CALL xios(is_defined_extract_axis_to_scalar_attr_hdl_) & - ( extract_axis_to_scalar_hdl, position ) - - END SUBROUTINE xios(is_defined_extract_axis_to_scalar_attr) - - SUBROUTINE xios(is_defined_extract_axis_to_scalar_attr_hdl) & - ( extract_axis_to_scalar_hdl, position ) - - IMPLICIT NONE - TYPE(txios(extract_axis_to_scalar)) , INTENT(IN) :: extract_axis_to_scalar_hdl - LOGICAL, OPTIONAL, INTENT(OUT) :: position - LOGICAL(KIND=C_BOOL) :: position_tmp - - CALL xios(is_defined_extract_axis_to_scalar_attr_hdl_) & - ( extract_axis_to_scalar_hdl, position ) - - END SUBROUTINE xios(is_defined_extract_axis_to_scalar_attr_hdl) - - SUBROUTINE xios(is_defined_extract_axis_to_scalar_attr_hdl_) & - ( extract_axis_to_scalar_hdl, position_ ) - - IMPLICIT NONE - TYPE(txios(extract_axis_to_scalar)) , INTENT(IN) :: extract_axis_to_scalar_hdl - LOGICAL, OPTIONAL, INTENT(OUT) :: position_ - LOGICAL(KIND=C_BOOL) :: position__tmp - - IF (PRESENT(position_)) THEN - position__tmp = cxios_is_defined_extract_axis_to_scalar_position & - (extract_axis_to_scalar_hdl%daddr) - position_ = position__tmp - ENDIF - - END SUBROUTINE xios(is_defined_extract_axis_to_scalar_attr_hdl_) - -END MODULE iextract_axis_to_scalar_attr diff --git a/xios_2311_src/trunk/.svn/pristine/5e/5ef3dd07127a48c22d797778799e9d9be83233d5.svn-base b/xios_2311_src/trunk/.svn/pristine/5e/5ef3dd07127a48c22d797778799e9d9be83233d5.svn-base deleted file mode 100644 index 531d3d85054c3492d90ee6f5cd78d4aaff2dabd3..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/5e/5ef3dd07127a48c22d797778799e9d9be83233d5.svn-base +++ /dev/null @@ -1,22 +0,0 @@ -MODULE VARIABLE_INTERFACE - USE, INTRINSIC :: ISO_C_BINDING - - INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99 - - SUBROUTINE cxios_variable_handle_create(ret, idt, idt_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_variable_handle_create - - SUBROUTINE cxios_variable_valid_id(ret, idt, idt_size) BIND(C) - USE ISO_C_BINDING - LOGICAL (kind = C_BOOL) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_variable_valid_id - - END INTERFACE - -END MODULE VARIABLE_INTERFACE diff --git a/xios_2311_src/trunk/.svn/pristine/5f/5f4bf697b02018f90f93909cc638dd14a0168b5e.svn-base b/xios_2311_src/trunk/.svn/pristine/5f/5f4bf697b02018f90f93909cc638dd14a0168b5e.svn-base deleted file mode 100644 index e84ef428a04a1da897fbc42ce9ee2281b9fe0985..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/5f/5f4bf697b02018f90f93909cc638dd14a0168b5e.svn-base +++ /dev/null @@ -1,191 +0,0 @@ -#include "xios_fortran_prefix.hpp" - -MODULE IDURATION - USE, INTRINSIC :: ISO_C_BINDING - USE DURATION_INTERFACE - - TYPE(txios(duration)), PARAMETER :: xios(year) = txios(duration)(1, 0, 0, 0, 0, 0, 0) - TYPE(txios(duration)), PARAMETER :: xios(month) = txios(duration)(0, 1, 0, 0, 0, 0, 0) - TYPE(txios(duration)), PARAMETER :: xios(day) = txios(duration)(0, 0, 1, 0, 0, 0, 0) - TYPE(txios(duration)), PARAMETER :: xios(hour) = txios(duration)(0, 0, 0, 1, 0, 0, 0) - TYPE(txios(duration)), PARAMETER :: xios(minute) = txios(duration)(0, 0, 0, 0, 1, 0, 0) - TYPE(txios(duration)), PARAMETER :: xios(second) = txios(duration)(0, 0, 0, 0, 0, 1, 0) - TYPE(txios(duration)), PARAMETER :: xios(timestep) = txios(duration)(0, 0, 0, 0, 0, 0, 1) - - INTERFACE OPERATOR(+) - MODULE PROCEDURE xios(duration_add) - END INTERFACE - - INTERFACE OPERATOR(-) - MODULE PROCEDURE xios(duration_sub) - MODULE PROCEDURE xios(duration_neg) - END INTERFACE - - INTERFACE OPERATOR(*) - MODULE PROCEDURE xios(real4_duration_mult) - MODULE PROCEDURE xios(duration_real4_mult) - MODULE PROCEDURE xios(real8_duration_mult) - MODULE PROCEDURE xios(duration_real8_mult) - MODULE PROCEDURE xios(int_duration_mult) - MODULE PROCEDURE xios(duration_int_mult) - END INTERFACE - - INTERFACE xios(duration_mult) - MODULE PROCEDURE xios(real4_duration_mult) - MODULE PROCEDURE xios(duration_real4_mult) - MODULE PROCEDURE xios(real8_duration_mult) - MODULE PROCEDURE xios(duration_real8_mult) - MODULE PROCEDURE xios(int_duration_mult) - MODULE PROCEDURE xios(duration_int_mult) - END INTERFACE - - INTERFACE OPERATOR(==) - MODULE PROCEDURE xios(duration_eq) - END INTERFACE - - INTERFACE OPERATOR(/=) - MODULE PROCEDURE xios(duration_neq) - END INTERFACE - - CONTAINS - - ! Conversion function - - SUBROUTINE xios(duration_convert_to_string)(dur, str) - USE DURATION_INTERFACE, only : txios(duration) - IMPLICIT NONE - TYPE(txios(duration)), INTENT(IN) :: dur - CHARACTER(len = *), INTENT(OUT) :: str - - CALL cxios_duration_convert_to_string(dur, str, len(str)) - END SUBROUTINE xios(duration_convert_to_string) - - FUNCTION xios(duration_convert_from_string)(str) RESULT(res) - USE DURATION_INTERFACE, only : txios(duration) - IMPLICIT NONE - CHARACTER(len = *), INTENT(IN) :: str - TYPE(txios(duration)) :: res - - res = cxios_duration_convert_from_string(str, len(str)) - END FUNCTION xios(duration_convert_from_string) - - ! Addition - - FUNCTION xios(duration_add)(dur1, dur2) RESULT(res) - USE DURATION_INTERFACE, only : txios(duration) - IMPLICIT NONE - TYPE(txios(duration)), INTENT(IN) :: dur1, dur2 - TYPE(txios(duration)) :: res - - res = cxios_duration_add(dur1, dur2) - END FUNCTION xios(duration_add) - - ! Subtraction - - FUNCTION xios(duration_sub)(dur1, dur2) RESULT(res) - USE DURATION_INTERFACE, only : txios(duration) - IMPLICIT NONE - TYPE(txios(duration)), INTENT(IN) :: dur1, dur2 - TYPE(txios(duration)) :: res - - res = cxios_duration_sub(dur1, dur2) - END FUNCTION xios(duration_sub) - - ! Multiplication by a scalar - - FUNCTION xios(real4_duration_mult)(val, dur) RESULT(res) - USE ISO_C_BINDING - USE DURATION_INTERFACE, only : txios(duration) - IMPLICIT NONE - REAL(kind = C_FLOAT), INTENT(IN) :: val - TYPE(txios(duration)), INTENT(IN) :: dur - TYPE(txios(duration)) :: res - - res = cxios_duration_mult(REAL(val, C_DOUBLE), dur) - END FUNCTION xios(real4_duration_mult) - - FUNCTION xios(duration_real4_mult)(dur, val2) RESULT(res) - USE ISO_C_BINDING - USE DURATION_INTERFACE, only : txios(duration) - IMPLICIT NONE - TYPE(txios(duration)), INTENT(IN) :: dur - REAL(kind = C_FLOAT), INTENT(IN) :: val2 - TYPE(txios(duration)) :: res - - res = cxios_duration_mult(REAL(val2, C_DOUBLE), dur) - END FUNCTION xios(duration_real4_mult) - - FUNCTION xios(real8_duration_mult)(val, dur) RESULT(res) - USE ISO_C_BINDING - USE DURATION_INTERFACE, only : txios(duration) - IMPLICIT NONE - REAL(kind = C_DOUBLE), INTENT(IN) :: val - TYPE(txios(duration)), INTENT(IN) :: dur - TYPE(txios(duration)) :: res - - res = cxios_duration_mult(val, dur) - END FUNCTION xios(real8_duration_mult) - - FUNCTION xios(duration_real8_mult)(dur, val2) RESULT(res) - USE ISO_C_BINDING - USE DURATION_INTERFACE, only : txios(duration) - IMPLICIT NONE - TYPE(txios(duration)), INTENT(IN) :: dur - REAL(kind = C_DOUBLE), INTENT(IN) :: val2 - TYPE(txios(duration)) :: res - - res = cxios_duration_mult(val2, dur) - END FUNCTION xios(duration_real8_mult) - - FUNCTION xios(int_duration_mult)(val, dur) RESULT(res) - USE ISO_C_BINDING - USE DURATION_INTERFACE, only : txios(duration) - IMPLICIT NONE - INTEGER, INTENT(IN) :: val - TYPE(txios(duration)), INTENT(IN) :: dur - TYPE(txios(duration)) :: res - - res = cxios_duration_mult(REAL(val, C_DOUBLE), dur) - END FUNCTION xios(int_duration_mult) - - FUNCTION xios(duration_int_mult)(dur, val2) RESULT(res) - USE ISO_C_BINDING - USE DURATION_INTERFACE, only : txios(duration) - IMPLICIT NONE - TYPE(txios(duration)), INTENT(IN) :: dur - INTEGER, INTENT(IN) :: val2 - TYPE(txios(duration)) :: res - - res = cxios_duration_mult(REAL(val2, C_DOUBLE), dur) - END FUNCTION xios(duration_int_mult) - - ! Negation - - FUNCTION xios(duration_neg)(dur) RESULT(res) - USE DURATION_INTERFACE, only : txios(duration) - IMPLICIT NONE - TYPE(txios(duration)), INTENT(IN) :: dur - TYPE(txios(duration)) :: res - - res = cxios_duration_neg(dur) - END FUNCTION xios(duration_neg) - - FUNCTION xios(duration_eq)(dur1, dur2) RESULT(res) - USE duration_INTERFACE, only : txios(duration) - IMPLICIT NONE - TYPE(txios(duration)), INTENT(IN) :: dur1, dur2 - LOGICAL :: res - - res = cxios_duration_eq(dur1, dur2) - END FUNCTION xios(duration_eq) - - FUNCTION xios(duration_neq)(dur1, dur2) RESULT(res) - USE duration_INTERFACE, only : txios(duration) - IMPLICIT NONE - TYPE(txios(duration)), INTENT(IN) :: dur1, dur2 - LOGICAL :: res - - res = cxios_duration_neq(dur1, dur2) - END FUNCTION xios(duration_neq) - -END MODULE IDURATION diff --git a/xios_2311_src/trunk/.svn/pristine/5f/5f576f1d1c0b6047f4243e7e7c6b1562252bb08f.svn-base b/xios_2311_src/trunk/.svn/pristine/5f/5f576f1d1c0b6047f4243e7e7c6b1562252bb08f.svn-base deleted file mode 100644 index e8143f30feaeebf7053228688ab2c819f43af042..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/5f/5f576f1d1c0b6047f4243e7e7c6b1562252bb08f.svn-base +++ /dev/null @@ -1,957 +0,0 @@ -/* Copyright 2009, UCAR/Unidata and OPeNDAP, Inc. - See the COPYRIGHT file for more information. */ - -#include "config.h" -#include -#include -#include - -#include "oc.h" -#include "ocinternal.h" -#include "occontent.h" -#include "ocdebug.h" -#include "ocdump.h" -#include "oclog.h" -#include "occlientparams.h" -#include "ochttp.h" - -#undef TRACK - -/**************************************************/ - -static int ocinitialized = 0; - -/**************************************************/ -/* Track legal ids */ - -#ifdef OC_FASTCONSISTENCY - -#define ocverify(object) ((object) != NULL && (*(object) == OCMAGIC)?1:0) - -#define ocassign(object) ((OCobject)(object)) -#define ocassignall(list) - -#else /*!OC_FASTCONSISTENCY*/ - -static OClist* ocmap = NULL; - -static int -ocverify(unsigned long object) -{ - unsigned int i; - void** map = (void**)oclistcontents(ocmap); - unsigned int len = oclistlength(ocmap); -#ifdef TRACK -fprintf(stderr,"verify: %lu\n",object); fflush(stderr); -#endif - if(object > 0) { - for(i=0;iroot; - if(root == NULL) return 0; - nodes = root->tree->nodes; - nobjects = oclistlength(nodes); - return nobjects; -} - -/* Return all the OCobjects associated with a tree with specified root */ -OCobject* -oc_inq_objects(OCconnection conn, OCobject root0) -{ - unsigned int i; - OCnode* root; - OClist* nodes; - OCobject* objects = NULL; - unsigned int nobjects; - OCVERIFYX(OCnode*,root,root0,OCNULL); - OCDEREF(OCnode*,root,root0); - - if(root == NULL) return NULL; - root = root->root; - if(root == NULL) return NULL; - nodes = root->tree->nodes; - nobjects = oclistlength(nodes); - if(nodes != NULL && nobjects > 0) { - size_t len = sizeof(OCobject)*(1+nobjects); - objects = (OCobject*)ocmalloc(len); - for(i=0;iroot; - if(root == NULL) return NULL; - return root->tree->text; -} - -OCerror -oc_inq_object(OCconnection conn, - OCobject node0, - char** namep, - OCtype* objecttypep, - OCtype* primitivetypep, /* if objecttype == OC_Primitive */ - OCobject* containerp, - unsigned int* rankp, - unsigned int* subnodesp, - unsigned int* nattrp) -{ - OCnode* node; - OCVERIFY(OCnode*,node,node0); - OCDEREF(OCnode*,node,node0); - - if(namep) *namep = nulldup(node->name); - if(objecttypep) *objecttypep = node->octype; - if(primitivetypep) *primitivetypep = node->etype; - if(rankp) *rankp = node->array.rank; - if(containerp) *containerp = (OCobject)node->container; - if(subnodesp) *subnodesp = oclistlength(node->subnodes); - if(nattrp) { - if(node->octype == OC_Attribute) { - *nattrp = oclistlength(node->att.values); - } else { - *nattrp = oclistlength(node->attributes); - } - } - return OC_NOERR; -} - -/* Useful accessor functions */ -OCerror -oc_inq_name(OCconnection conn, OCobject node0, char** namep) -{ - OCstate* state; - OCnode* node; - OCVERIFY(OCstate*,state,conn); - OCDEREF(OCstate*,state,conn); - OCVERIFY(OCnode*,node,node0); - OCDEREF(OCnode*,node,node0); - - if(state == NULL || node == NULL) return OC_EINVAL; - if(namep) *namep = nulldup(node->name); - return OC_NOERR; -} - -OCerror -oc_inq_nsubnodes(OCconnection conn, OCobject node0, unsigned int* nsubnodesp) -{ - OCnode* node; - OCVERIFY(OCnode*,node,node0); - OCDEREF(OCnode*,node,node0); - - if(nsubnodesp) *nsubnodesp = oclistlength(node->subnodes); - return OC_NOERR; -} - -OCerror -oc_inq_primtype(OCconnection conn, OCobject node0, OCtype* typep) -{ - OCnode* node; - OCVERIFY(OCnode*,node,node0); - OCDEREF(OCnode*,node,node0); - - if(typep) *typep = node->etype; - return OC_NOERR; -} - -/* Alias for oc_inq_class */ -OCerror -oc_inq_type(OCconnection conn, OCobject node0, OCtype* typep) -{ - return oc_inq_class(conn,node0,typep); -} - -OCerror -oc_inq_class(OCconnection conn, OCobject node0, OCtype* typep) -{ - OCnode* node; - OCVERIFY(OCnode*,node,node0); - OCDEREF(OCnode*,node,node0); - - if(typep) *typep = node->octype; - return OC_NOERR; -} - -OCerror -oc_inq_rank(OCconnection conn, OCobject node0, unsigned int* rankp) -{ - OCnode* node; - OCVERIFY(OCnode*,node,node0); - OCDEREF(OCnode*,node,node0); - - if(rankp) *rankp = node->array.rank; - return OC_NOERR; -} - -OCerror -oc_inq_nattr(OCconnection conn, OCobject node0, unsigned int* nattrp) -{ - OCnode* node; - OCVERIFY(OCnode*,node,node0); - OCDEREF(OCnode*,node,node0); - - if(nattrp) { - if(node->octype == OC_Attribute) { - *nattrp = oclistlength(node->att.values); - } else { - *nattrp = oclistlength(node->attributes); - } - } - return OC_NOERR; -} - -OCerror -oc_inq_root(OCconnection conn, OCobject node0, OCobject* rootp) -{ - OCnode* node; - OCVERIFY(OCnode*,node,node0); - OCDEREF(OCnode*,node,node0); - - if(rootp) *rootp = (OCobject)node->root; - return OC_NOERR; -} - -OCerror -oc_inq_container(OCconnection conn, OCobject node0, OCobject* containerp) -{ - OCnode* node; - OCVERIFY(OCnode*,node,node0); - OCDEREF(OCnode*,node,node0); - - if(containerp) *containerp = (OCobject)node->container; - return OC_NOERR; -} - -/* Return the subnode objects, if any, for a given object */ -/* Caller must free returned list */ -OCerror -oc_inq_subnodes(OCconnection conn, OCobject node0, OCobject** subnodesp) -{ - OCnode* node; - OCobject* subnodes = NULL; - unsigned int len; - OCVERIFY(OCnode*,node,node0); - OCDEREF(OCnode*,node,node0); - - len = oclistlength(node->subnodes); - if(len > 0) { - unsigned int i; - subnodes = (OCobject*)occalloc(sizeof(OCobject),len+1); - for(i=0;isubnodes,i); - subnodes[i] = (OCobject)ocnode; - } - subnodes[len] = OCNULL; /* NULL terminate */ - } - if(subnodesp) *subnodesp = subnodes; - return OC_NOERR; -} - -OCerror -oc_inq_ith(OCconnection conn, - OCobject node0, unsigned int index, OCobject* subnodeidp) -{ - OCnode* node; - OCobject subnodeid = OCNULL; - unsigned int nsubnodes; - OCVERIFY(OCnode*,node,node0); - OCDEREF(OCnode*,node,node0); - - nsubnodes = oclistlength(node->subnodes); - if(nsubnodes > 0 && index < nsubnodes) { - subnodeid = (OCobject)oclistget(node->subnodes,index); - } else - return OC_EINVAL; - if(subnodeidp) *subnodeidp = subnodeid; - return OC_NOERR; -} - -/* Return the dimension objects, if any, for a given object */ -/* Caller must free returned dimids */ -OCerror -oc_inq_dimset(OCconnection conn, OCobject node0, OCobject** dimids) -{ - OCnode* node; - OCobject* dims = NULL; - OCVERIFY(OCnode*,node,node0); - OCDEREF(OCnode*,node,node0); - - if(node->array.rank > 0) { - unsigned int i; - dims = (OCobject*)occalloc(sizeof(OCobject),node->array.rank+1); - for(i=0;iarray.rank;i++) { - OCnode* dim = (OCnode*)oclistget(node->array.dimensions,i); - dims[i] = (OCobject)dim; - } - dims[node->array.rank] = OCNULL; - } - if(dimids) *dimids = dims; - return OC_NOERR; -} - - -OCerror -oc_inq_ithdim(OCconnection conn, OCobject node0, unsigned int index, OCobject* dimidp) -{ - OCnode* node; - OCobject dimid = OCNULL; - OCVERIFY(OCnode*,node,node0); - OCDEREF(OCnode*,node,node0); - - if(node->array.rank > 0 && index < node->array.rank) { - dimid = (OCobject)oclistget(node->array.dimensions,index); - } else - return OC_EINVAL; - if(dimidp) *dimidp = dimid; - return OC_NOERR; -} - -OCerror -oc_inq_dim(OCconnection conn, OCobject node0, size_t* sizep, char** namep) -{ - OCnode* dim; - OCVERIFY(OCnode*,dim,node0); - OCDEREF(OCnode*,dim,node0); - - if(dim->octype != OC_Dimension) return OC_EINVAL; - if(sizep) *sizep = dim->dim.declsize; - if(namep) *namep = nulldup(dim->name); - return OC_NOERR; -} - -/* Obtain info about the ith attribute attached to a given DDS node*/ - -/* This procedure returns the value as the original DAS string */ -OCerror -oc_inq_attrstrings(OCconnection conn, OCobject node0, unsigned int i, - char** namep, OCtype* octypep, - unsigned int* nvaluesp, char*** stringsp) -{ - OCnode* node; - OCattribute* attr; - unsigned int nattrs; - OCVERIFY(OCnode*,node,node0); - OCDEREF(OCnode*,node,node0); - - nattrs = oclistlength(node->attributes); - if(i >= nattrs) return OC_EINVAL; - attr = (OCattribute*)oclistget(node->attributes,i); - if(namep) *namep = strdup(attr->name); - if(octypep) *octypep = attr->etype; - if(nvaluesp) *nvaluesp = attr->nvalues; - if(stringsp) { - if(attr->nvalues > 0) { - size_t space = attr->nvalues * sizeof(char*); - char** strings = ocmalloc(space); - for(i=0;invalues;i++) - strings[i] = nulldup(attr->values[i]); - *stringsp = strings; - } else - *stringsp = NULL; - } - return OC_NOERR; -} - -/* This procedure returns the value as the default binary value - corresponding to the string value -*/ - -OCerror -oc_inq_attr(OCconnection conn, OCobject node0, unsigned int i, - char** namep, OCtype* octypep, unsigned int* nvaluesp, void** valuesp) -{ - OCnode* node; - OCattribute* attr; - unsigned int nattrs; - OCVERIFY(OCnode*,node,node0); - OCDEREF(OCnode*,node,node0); - - nattrs = oclistlength(node->attributes); - if(i >= nattrs) return OC_EINVAL; - attr = (OCattribute*)oclistget(node->attributes,i); - if(namep) *namep = strdup(attr->name); - if(octypep) *octypep = attr->etype; - if(nvaluesp) *nvaluesp = attr->nvalues; - if(valuesp && attr->nvalues > 0) { - void* memory = NULL; - memory = oclinearize(attr->etype,attr->nvalues,attr->values); - *valuesp = memory; - } - return OC_NOERR; -} - -/* Convenience function */ -void -oc_attr_reclaim(OCtype etype, unsigned int nvalues, void* values) -{ - if(nvalues == 0 || values == NULL) return; - if(etype == OC_String || etype == OC_URL) { - unsigned int i; - char** strings = (char**)values; - for(i=0;ioctype != OC_Attribute) return OC_EINVAL; - if(nvaluesp) *nvaluesp = oclistlength(attr->att.values); - return OC_NOERR; -} - -OCerror -oc_inq_dasattr(OCconnection conn, OCobject node0, unsigned int i, - OCtype* primtypep, char** valuep) -{ - OCnode* attr; - unsigned int nvalues; - OCVERIFY(OCnode*,attr,node0); - OCDEREF(OCnode*,attr,node0); - - if(attr->octype != OC_Attribute) return OC_EINVAL; - nvalues = oclistlength(attr->att.values); - if(i >= nvalues) return OC_EINVAL; - if(valuep) *valuep = nulldup((char*)oclistget(attr->att.values,i)); - if(primtypep) *primtypep = attr->etype; - return OC_NOERR; -} - -/**************************************************/ -/* Fetch and parse a given class of DXD the server specified - at open time, and using a specified set of constraints. - Return the root node of the parsed tree of objects. -*/ -OCerror oc_fetch(OCconnection conn, const char* constraint, - OCdxd dxdkind, OCobject* rootp) -{ - return oc_fetchf(conn,constraint,dxdkind,0,rootp); -} - -OCerror oc_fetchf(OCconnection conn, const char* constraint, - OCdxd dxdkind, OCflags flags, OCobject* rootp) -{ - OCstate* state; - OCerror ocerr = OC_NOERR; - OCnode* root; - OCVERIFY(OCstate*,state,conn); - OCDEREF(OCstate*,state,conn); - - ocerr = ocfetchf(state,constraint,dxdkind,flags,&root); - if(ocerr) return ocerr; - - ocassignall(root->tree->nodes); - if(rootp) *rootp = (OCobject)ocassign(root); - return ocerr; -} - - -OCerror -oc_data_root(OCconnection conn, OCobject root0, OCdata content0) -{ - OCstate* state; - OCnode* root; - OCcontent* content; - OCerror ocerr = OC_NOERR; - OCVERIFY(OCstate*,state,conn); - OCDEREF(OCstate*,state,conn); - OCVERIFY(OCnode*,root,root0); - OCDEREF(OCnode*,root,root0); - OCVERIFY(OCcontent*,content,content0); - OCDEREF(OCcontent*,content,content0); - - if(root->tree == NULL) {OCTHROWCHK((ocerr=OC_EINVAL)); goto fail;} - ocerr = ocrootdata(state,root,content); - -fail: - return ocerr; -} - -OCdata -oc_data_new(OCconnection conn) -{ - OCstate* state; - OCVERIFYX(OCstate*,state,conn,OCNULL); - OCDEREF(OCstate*,state,conn); - - return (OCdata)ocassign(ocnewcontent(state)); -} - -OCerror -oc_data_free(OCconnection conn, OCdata content0) -{ - OCstate* state; - OCcontent* content; - if(content0 == OCNULL) return OC_NOERR; - OCVERIFY(OCstate*,state,conn); - OCDEREF(OCstate*,state,conn); - OCVERIFY(OCcontent*,content,content0); - OCDEREF(OCcontent*,content,content0); - - ocfreecontent(state,content); - return OC_NOERR; -} - -OCerror -oc_data_ith(OCconnection conn, OCdata parentdata, size_t index, OCdata subdata) -{ - OCstate* state; - OCcontent* parent; - OCcontent* child; - OCerror ocerr = OC_NOERR; - OCVERIFY(OCstate*,state,conn); - OCDEREF(OCstate*,state,conn); - OCVERIFY(OCcontent*,parent,parentdata); - OCDEREF(OCcontent*,parent,parentdata); - OCVERIFY(OCcontent*,child,subdata); - OCDEREF(OCcontent*,child,subdata); - ocerr = ocdataith(state,parent,index,child); - return ocerr; -} - -OCerror -oc_data_get(OCconnection conn, OCdata currentcontent, - void* memory, size_t memsize, size_t start, size_t count) -{ - OCstate* state; - OCcontent* current; - OCerror ocerr = OC_NOERR; - OCVERIFY(OCstate*,state,conn); - OCDEREF(OCstate*,state,conn); - OCVERIFY(OCcontent*,current,currentcontent); - OCDEREF(OCcontent*,current,currentcontent); - - ocerr = ocgetcontent(state,current,memory,memsize,start,count); - - if(ocerr == OC_EDATADDS) ocdataddsmsg(state,current->tree); - - return ocerr; -} - -OCerror -oc_data_count(OCconnection conn, OCdata content0, size_t* sizep) -{ - OCstate* state; - OCcontent* current; - OCerror ocerr = OC_NOERR; - OCVERIFY(OCstate*,state,conn); - OCDEREF(OCstate*,state,conn); - OCVERIFY(OCcontent*,current,content0); - OCDEREF(OCcontent*,current,content0); - ocerr = ocdatacount(state, current, sizep); - return ocerr; -} - -OCerror -oc_data_index(OCconnection conn, OCdata content0, size_t* sizep) -{ - OCcontent* current; - OCerror ocerr = OC_NOERR; - OCVERIFY(OCcontent*,current,content0); - OCDEREF(OCcontent*,current,content0); - - if(sizep) - *sizep = (current->cache.valid ? current->cache.index : 0); - return ocerr; -} - -OCerror -oc_data_object(OCconnection conn, OCdata content0, OCobject* op) -{ - OCcontent* current; - OCerror ocerr = OC_NOERR; - OCVERIFY(OCcontent*,current,content0); - OCDEREF(OCcontent*,current,content0); - - if(op) *op = (OCobject)current->node; - return ocerr; -} - -OCerror -oc_data_mode(OCconnection conn, OCdata content0, OCmode* modep) -{ - OCcontent* current; - OCerror ocerr = OC_NOERR; - OCVERIFY(OCcontent*,current,content0); - OCDEREF(OCcontent*,current,content0); - - if(modep) *modep = current->mode; - return ocerr; -} - -/**************************************************/ -/* OCtype management */ -size_t oc_typesize(OCtype etype) -{ - return octypesize(etype); -} - -const char* -oc_typetostring(OCtype octype) -{ - return octypetoddsstring(octype); -} - -OCerror -oc_typeprint(OCtype etype, char* buf, size_t bufsize, void* value) -{ - return octypeprint(etype,buf,bufsize,value); -} - -/**************************************************/ -/* The oc_logXXX procedures are define in oclog.c */ - -/**************************************************/ -/* Miscellaneous */ - -const char* -oc_errstring(int err) -{ - return ocerrstring(err); -} - -/* Get clientparameters from the URL */ -const char* -oc_clientparam_get(OCconnection conn, const char* param) -{ - OCstate* state; - OCVERIFYX(OCstate*,state,conn,NULL); - OCDEREF(OCstate*,state,conn); - - return ocparamlookup(state,param); -} - -#ifdef OCIGNORE -/* Delete client parameter - return value: - OC_NOERR => defined; deletion performed - OC_EINVAL => not already defined -*/ -OCerror -oc_clientparam_delete(OCconnection conn, const char* param) -{ - OCstate* state; - OCVERIFY(OCstate*,state,conn); - OCDEREF(OCstate*,state,conn); - - return ocparamdelete(state->clientparams,param); -} - -/* Insert client parameter - return value: - OC_NOERR => not already define; insertion performed - OC_EINVAL => already defined -*/ -OCerror -oc_clientparam_insert(OCconnection conn, const char* param, const char* value) -{ - OCstate* state; - OCVERIFY(OCstate*,state,conn); - OCDEREF(OCstate*,state,conn); - - state->clientparams = dapparaminsert(state->clientparams,param,value); - return OC_NOERR; -} - -/* Replace client parameter - return value: - OC_NOERR => already define; replacement performed - OC_EINVAL => not already defined -*/ -OCerror -oc_clientparam_replace(OCconnection conn, const char* param, const char* value) -{ - OCstate* state; - OCVERIFY(OCstate*,state,conn); - OCDEREF(OCstate*,state,conn); - - return dapparamreplace(state->clientparams,param,value); -} -#endif - -OCerror -oc_dd(OCconnection conn, OCobject root0, int level) -{ - OCstate* state; - OCnode* root; - OCVERIFY(OCstate*,state,conn); - OCDEREF(OCstate*,state,conn); - OCVERIFY(OCnode*,root,root0); - OCDEREF(OCnode*,root,root0); - - ocdd(state,root,1,level); - return OC_NOERR; -} - -OCerror -oc_ddnode(OCconnection conn, OCobject root0) -{ - OCnode* root; - OCVERIFY(OCnode*,root,root0); - OCDEREF(OCnode*,root,root0); - - ocdumpnode(root); - return OC_NOERR; -} - -/* Merge a specified DAS into a specified DDS or DATADDS */ -OCerror -oc_attach_das(OCconnection conn, OCobject dasroot, OCobject ddsroot) -{ - OCstate* state; - OCnode* das; - OCnode* dds; - OCVERIFY(OCstate*,state,conn); - OCDEREF(OCstate*,state,conn); - OCVERIFY(OCnode*,das,dasroot); - OCDEREF(OCnode*,das,dasroot); - OCVERIFY(OCnode*,dds,ddsroot); - OCDEREF(OCnode*,dds,ddsroot); - - return ocddsdasmerge(state,das,dds); -} - -#if 0 -/* -I suppressed this operation because I realized that it -appears to be impossible to implement correctly in general. -It also exposes a flaw in the protocol. -If I have a dds with two identical Grids, G1 and G2, -and I ask for the projection ?G1.temp,G2.temp, -then I get back a DATADDS with duplicated temp fields, -which means the DATADDS is illegal. The problem is that -the protocol throws away important scoping information -about the fact that each temp field is part of a different -grid. -*/ -/* Connect a specified DATADDS tree to a specified DDS tree */ -OCerror -oc_attach_datadds(OCconnection conn, OCobject dataddsroot, OCobject ddsroot) -{ - OCstate* state; - OCnode* dxd; - OCnode* dds; - OCVERIFY(OCstate*,state,conn); - OCDEREF(OCstate*,state,conn); - OCVERIFY(OCnode*,dxd,dataddsroot); - OCDEREF(OCnode*,dxd,dataddsroot); - OCVERIFY(OCnode*,dds,ddsroot); - OCDEREF(OCnode*,dds,ddsroot); - - /* get the true roots */ - dds = dds->root; - dxd = dxd->root; - if(dds == NULL || dxd == NULL) return OC_EBADID; - /* correlate the DATADDS to the DDS */ - return occorrelate(dxd,dds); -} - -/* Return the attached DATADDS object for a given DDS object */ -OCerror oc_inq_datadds(OCconnection conn, OCobject dds0, OCobject* dataddsp) -{ - OCstate* state; - OCnode* dds; - OCVERIFY(OCstate*,state,conn); - OCDEREF(OCstate*,state,conn); - OCVERIFY(OCnode*,dds,dds0); - OCDEREF(OCnode*,dds,dds0); - - if(dataddsp) *dataddsp = (OCobject)dds->datadds; - return OC_NOERR; -} -#endif - -/**************************************************/ - -OCerror -oc_svcerrordata(OCconnection conn, char** codep, - char** msgp, long* httpp) -{ - OCstate* state; - OCVERIFY(OCstate*,state,conn); - OCDEREF(OCstate*,state,conn); - return ocsvcerrordata(state,codep,msgp,httpp); -} - - -/**************************************************/ -/* Experimental: this is useful for the netcdf - DRNO project. -*/ - -/* New 10/31/2009: return the size (in bytes) - of the fetched datadds. -*/ - -OCerror -oc_raw_xdrsize(OCconnection conn, OCobject root0, size_t* sizep) -{ - OCnode* root; - OCerror ocerr = OC_NOERR; - OCVERIFY(OCnode*,root,root0); - OCDEREF(OCnode*,root,root0); - - if(sizep == NULL) goto done; - if(root->tree == NULL || root->tree->dxdclass != OCDATADDS) - {OCTHROWCHK((ocerr=OC_EINVAL)); goto done;} - if(sizep) *sizep = root->tree->data.datasize; - -done: - return ocerr; -} - -/* Resend a url as a head request to check the Last-Modified time */ -OCerror -oc_update_lastmodified_data(OCconnection conn) -{ - OCstate* state; - OCVERIFY(OCstate*,state,conn); - OCDEREF(OCstate*,state,conn); - return ocupdatelastmodifieddata(state); -} - -long -oc_get_lastmodified_data(OCconnection conn) -{ - OCstate* state; - OCVERIFY(OCstate*,state,conn); - OCDEREF(OCstate*,state,conn); - return state->datalastmodified; -} - -int -oc_dumpnode(OCconnection conn, OCobject root0) -{ - OCnode* root; - OCerror ocerr = OC_NOERR; - OCVERIFY(OCnode*,root,root0); - OCDEREF(OCnode*,root,root0); - ocdumpnode(root); - return ocerr; -} - -OCerror -oc_ping(const char* url) -{ - return ocping(url); -} - diff --git a/xios_2311_src/trunk/.svn/pristine/5f/5f6d2a536e26c2cda6c0db1156c221c43cbb178f.svn-base b/xios_2311_src/trunk/.svn/pristine/5f/5f6d2a536e26c2cda6c0db1156c221c43cbb178f.svn-base deleted file mode 100644 index b68cc6e7f0dbcc520045463742bd340763fc29e7..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/5f/5f6d2a536e26c2cda6c0db1156c221c43cbb178f.svn-base +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef __XIOS_CExtractAxisToScalar__ -#define __XIOS_CExtractAxisToScalar__ - -/// xios headers /// -#include "xios_spl.hpp" -#include "attribute_enum.hpp" -#include "attribute_enum_impl.hpp" -#include "attribute_array.hpp" -#include "declare_attribute.hpp" -#include "object_template.hpp" -#include "group_factory.hpp" -#include "declare_group.hpp" -#include "transformation.hpp" - -namespace xios { - /// ////////////////////// Déclarations ////////////////////// /// - class CExtractAxisToScalarGroup; - class CExtractAxisToScalarAttributes; - class CExtractAxisToScalar; - class CAxis; - class CScalar; - class CGenericAlgorithmTransformation ; - class CGrid; - ///-------------------------------------------------------------- - - // Declare/Define CFileAttribute - BEGIN_DECLARE_ATTRIBUTE_MAP(CExtractAxisToScalar) -#include "extract_axis_to_scalar_attribute.conf" - END_DECLARE_ATTRIBUTE_MAP(CExtractAxisToScalar) - - ///-------------------------------------------------------------- - /*! - \class CExtractAxisToScalar - This class describes reduce_domain in xml file. - */ - class CExtractAxisToScalar - : public CObjectTemplate - , public CExtractAxisToScalarAttributes - , public CTransformation - { - public : - typedef CObjectTemplate SuperClass; - typedef CExtractAxisToScalarAttributes SuperClassAttribute; - typedef CExtractAxisToScalar MyClass ; - typedef CTransformation SuperTransform ; - - public : - /// Constructeurs /// - CExtractAxisToScalar(void); - explicit CExtractAxisToScalar(const StdString& id); - - /// Destructeur /// - virtual ~CExtractAxisToScalar(void); - - virtual void checkValid(CScalar* scalarDst, CAxis* axisSrc); - - /// Accesseurs statiques /// - static StdString GetName(void); - static StdString GetDefName(void); - static ENodeType GetType(void); - const string& getId(void) { return this->SuperClass::getId();} - ETranformationType getTransformationType(void) { return TRANS_EXTRACT_AXIS_TO_SCALAR ;} - static CTransformation* getTransformation(const StdString& id) { return SuperClass::get(id);} - virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} - virtual shared_ptr createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) ; - private: - static bool registerTrans(); - static CTransformation* create(const StdString& id, xml::CXMLNode* node); - static bool _dummyRegistered; - }; // class CExtractAxisToScalar - - DECLARE_GROUP(CExtractAxisToScalar); -} // namespace xios - -#endif // __XIOS_CExtractAxisToScalar__ diff --git a/xios_2311_src/trunk/.svn/pristine/5f/5f83b68c5e8fb952828c6dbd94593b9163a2a842.svn-base b/xios_2311_src/trunk/.svn/pristine/5f/5f83b68c5e8fb952828c6dbd94593b9163a2a842.svn-base deleted file mode 100644 index 03e82c763889f5bbe865128b5f7e48c3252fd7bd..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/5f/5f83b68c5e8fb952828c6dbd94593b9163a2a842.svn-base +++ /dev/null @@ -1,32 +0,0 @@ -! * ************************************************************************** * -! * Interface auto generated - do not modify * -! * ************************************************************************** * -#include "../fortran/xios_fortran_prefix.hpp" - -MODULE extract_axis_to_scalar_interface_attr - USE, INTRINSIC :: ISO_C_BINDING - - INTERFACE - ! Do not call directly / interface FORTRAN 2003 <-> C99 - - SUBROUTINE cxios_set_extract_axis_to_scalar_position(extract_axis_to_scalar_hdl, position) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: extract_axis_to_scalar_hdl - INTEGER (KIND=C_INT) , VALUE :: position - END SUBROUTINE cxios_set_extract_axis_to_scalar_position - - SUBROUTINE cxios_get_extract_axis_to_scalar_position(extract_axis_to_scalar_hdl, position) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: extract_axis_to_scalar_hdl - INTEGER (KIND=C_INT) :: position - END SUBROUTINE cxios_get_extract_axis_to_scalar_position - - FUNCTION cxios_is_defined_extract_axis_to_scalar_position(extract_axis_to_scalar_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_extract_axis_to_scalar_position - INTEGER (kind = C_INTPTR_T), VALUE :: extract_axis_to_scalar_hdl - END FUNCTION cxios_is_defined_extract_axis_to_scalar_position - - END INTERFACE - -END MODULE extract_axis_to_scalar_interface_attr diff --git a/xios_2311_src/trunk/.svn/pristine/5f/5ffd51ae8254474ac5cb2ba9b5c7e702b80395f3.svn-base b/xios_2311_src/trunk/.svn/pristine/5f/5ffd51ae8254474ac5cb2ba9b5c7e702b80395f3.svn-base deleted file mode 100644 index 909a0ad5adb7355eb5bfa1d64c26054537f7b990..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/5f/5ffd51ae8254474ac5cb2ba9b5c7e702b80395f3.svn-base +++ /dev/null @@ -1,3 +0,0 @@ -atm_output_scalar_transformation_reduce_axis.nc -atm_output_scalar_transformation_reduce_domain.nc -atm_output_scalar_transformation_extract.nc diff --git a/xios_2311_src/trunk/.svn/pristine/60/60690ba551523fa25a7c0a7a083d4d8ef14f6128.svn-base b/xios_2311_src/trunk/.svn/pristine/60/60690ba551523fa25a7c0a7a083d4d8ef14f6128.svn-base deleted file mode 100644 index d34c508e44eba6b099bad6c0e35a3a984a84942f..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/60/60690ba551523fa25a7c0a7a083d4d8ef14f6128.svn-base +++ /dev/null @@ -1,61 +0,0 @@ -/* Copyright 2009, UCAR/Unidata and OPeNDAP, Inc. - See the COPYRIGHT file for more information. */ - -#ifndef OCDATATYPES_H -#define OCDATATYPES_H - -/* Define some useful info about the supported - primitive datatypes*/ - -#define DCHAR char -#define DBYTE signed char -#define DUBYTE unsigned char -#define DINT16 short -#define DUINT16 unsigned short -#define DINT32 int -#define DUINT32 unsigned int -#define DINT64 int -#define DUINT64 unsigned int -#define DFLOAT32 float -#define DFLOAT64 double - -#define OC_CHAR_MIN ((char)0x00) -#define OC_CHAR_MAX ((char)0xff) -#define OC_BYTE_MIN -128 -#define OC_BYTE_MAX 127 -#define OC_UBYTE_MIN 0 -#define OC_UBYTE_MAX 255U -#define OC_INT16_MIN -32768 -#define OC_INT16_MAX 32767 -#define OC_UINT16_MIN 0 -#define OC_UINT16_MAX 65535U -#define OC_INT32_MIN (-2147483647 - 1) -#define OC_INT32_MAX 2147483647 -#define OC_UINT32_MIN 0 -#define OC_UINT32_MAX 4294967295U -#define OC_INT64_MIN (-9223372036854775807LL-1) -#define OC_INT64_MAX (9223372036854775807LL) -#define OC_UINT64_MIN 0LL -#define OC_UINT64_MAX (18446744073709551615ULL) -#define OC_FLOAT32_MAX 3.402823466E+38F /* max decimal value of a "float" */ -#define OC_FLOAT32_MIN (-OC_FLOAT_MAX) -#define OC_FLOAT64_MAX 1.7976931348623157E+308 /* max decimal value of a double */ -#define OC_FLOAT64_MIN (-OC_FLOAT64_MAX) - -/* Similar to netcdf*/ -#define OC_FILL_CHAR ((char)0) -#define OC_FILL_BYTE ((signed char)-127) -#define OC_FILL_UBYTE (255) -#define OC_FILL_INT16 ((short)-32767) -#define OC_FILL_UINT16 (65535) -#define OC_FILL_INT32 (-2147483647L) -#define OC_FILL_UINT32 (4294967295U) -#define OC_FILL_INT64 ((long long)-9223372036854775806LL) -#define OC_FILL_UINT64 ((unsigned long long)18446744073709551614ULL) -#define OC_FILL_FLOAT32 (9.9692099683868690e+36f) /* near 15 * 2^119 */ -#define OC_FILL_FLOAT64 (9.9692099683868690e+36) -#define OC_FILL_STRING "" -#define OC_FILL_URL "" - - -#endif /*OCDATATYPES_H*/ diff --git a/xios_2311_src/trunk/.svn/pristine/60/6084ae026097eb5f9885c44f7143abc6712652bc.svn-base b/xios_2311_src/trunk/.svn/pristine/60/6084ae026097eb5f9885c44f7143abc6712652bc.svn-base deleted file mode 100644 index 9dd1295786995831021dae0fbd3a6ed789a905e9..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/60/6084ae026097eb5f9885c44f7143abc6712652bc.svn-base +++ /dev/null @@ -1,105 +0,0 @@ -/*! - \file domain_algorithm_compute_connectivity.cpp - \author Ha NGUYEN - \since 15 Jul 2016 - \date 15 Jul 2016 - - \brief Algorithm for compute_connectivity on an domain. - */ -#include "domain_algorithm_compute_connectivity.hpp" -#include "compute_connectivity_domain.hpp" -#include "mesh.hpp" -#include "domain.hpp" -#include "grid.hpp" -#include "grid_transformation_factory_impl.hpp" - -namespace xios { -shared_ptr CDomainAlgorithmComputeConnectivity::create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) -TRY -{ - std::vector domainListDestP = gridDst->getDomains(); - std::vector domainListSrcP = gridSrc->getDomains(); - - CComputeConnectivityDomain* compute_connectivityDomain = dynamic_cast (transformation); - int domainDstIndex = elementPositionInGridDst2DomainPosition[elementPositionInGrid]; - int domainSrcIndex = elementPositionInGridSrc2DomainPosition[elementPositionInGrid]; - - return make_shared(isSource, domainListDestP[domainDstIndex], domainListSrcP[domainSrcIndex], compute_connectivityDomain); -} -CATCH - -bool CDomainAlgorithmComputeConnectivity::dummyRegistered_ = CDomainAlgorithmComputeConnectivity::registerTrans(); - -bool CDomainAlgorithmComputeConnectivity::registerTrans() -TRY -{ - return CGridTransformationFactory::registerTransformation(TRANS_COMPUTE_CONNECTIVITY_DOMAIN, create); -} -CATCH - -CDomainAlgorithmComputeConnectivity::CDomainAlgorithmComputeConnectivity(bool isSource, CDomain* domainDestination, CDomain* domainSource, - CComputeConnectivityDomain* compute_connectivityDomain) -: CAlgorithmTransformationNoDataModification(isSource) -TRY -{ - compute_connectivityDomain->checkValid(domainDestination); - int& nbNeighborMax = compute_connectivityDomain->n_neighbor_max; - CArray& nbNeighbor = compute_connectivityDomain->n_neighbor; - CArray& localNeighbors = compute_connectivityDomain->local_neighbor; - int type = 1; // Edge type - switch (compute_connectivityDomain->type) - { - case CComputeConnectivityDomain::type_attr::node : - type = 0; - break; - case CComputeConnectivityDomain::type_attr::edge : - type = 1; - break; - default: - break; - } - - computeLocalConnectivity(type, domainDestination, nbNeighborMax, nbNeighbor, localNeighbors); -} -CATCH - -/*! - * Compute local connectivity of a domain - * \param[in] type type of connectivity (node or edge) - * \param[in] domain domain on which we calculate local connectivity - * \param[in/out] nbConnectivityMax maximum number of neighbor a cell of domain has - * \param[in/out] nbConnectivity number of neighbor a cell has - * \param[in/out] localConnectivity localConnectivity local index of neighbor of a cell - */ -void CDomainAlgorithmComputeConnectivity::computeLocalConnectivity(int type, - CDomain* domain, - int& nbConnectivityMax, - CArray& nbConnectivity, - CArray& localConnectivity) -TRY -{ - - CMesh mesh; - - CArray& bounds_lon = domain->bounds_lon_1d; - CArray& bounds_lat = domain->bounds_lat_1d; - int ncell = bounds_lon.shape()[1]; - CArray localIndex(ncell); - for (int idx = 0; idx no unnecessary array copying in memory - src_lon = src.variables[srctype["lon_name"]] - src_lat = src.variables[srctype["lat_name"]] - -if "reader" in dsttype: - dst_lon, dst_lat = dsttype["reader"](dstfile) -else: - dst = nc.Dataset(dstfile) - dst_lon = dst.variables[dsttype["lon_name"]] - dst_lat = dst.variables[dsttype["lat_name"]] - -src_ncell, src_nvert = src_lon.shape -dst_ncell, dst_nvert = dst_lon.shape - -def compute_distribution(ncell): - "Returns the local number and starting position in global array." - if rank < ncell % size: - return ncell//size + 1, \ - (ncell//size + 1)*rank - else: - return ncell//size, \ - (ncell//size + 1)*(ncell%size) + (ncell//size)*(rank - ncell%size) - -src_ncell_loc, src_loc_start = compute_distribution(src_ncell) -dst_ncell_loc, dst_loc_start = compute_distribution(dst_ncell) - -print "src", src_ncell_loc, src_loc_start -print "dst", dst_ncell_loc, dst_loc_start - -c_src_lon = (ct.c_double * (src_ncell_loc*src_nvert))() -c_src_lat = (ct.c_double * (src_ncell_loc*src_nvert))() -c_dst_lon = (ct.c_double * (dst_ncell_loc*dst_nvert))() -c_dst_lat = (ct.c_double * (dst_ncell_loc*dst_nvert))() - -c_src_lon[:] = nc.numpy.reshape(src_lon[src_loc_start:src_loc_start+src_ncell_loc,:], (len(c_src_lon),1)) -c_src_lat[:] = nc.numpy.reshape(src_lat[src_loc_start:src_loc_start+src_ncell_loc,:], (len(c_src_lon),1)) -c_dst_lon[:] = nc.numpy.reshape(dst_lon[dst_loc_start:dst_loc_start+dst_ncell_loc,:], (len(c_dst_lon),1)) -c_dst_lat[:] = nc.numpy.reshape(dst_lat[dst_loc_start:dst_loc_start+dst_ncell_loc,:], (len(c_dst_lon),1)) - - -print "Calling remap library to compute weights." -srcpole = (ct.c_double * (3))() -dstpole = (ct.c_double * (3))() -srcpole[:] = srctype["pole"] -dstpole[:] = dsttype["pole"] - -c_src_ncell = ct.c_int(src_ncell_loc) -c_src_nvert = ct.c_int(src_nvert) -c_dst_ncell = ct.c_int(dst_ncell_loc) -c_dst_nvert = ct.c_int(dst_nvert) -order = ct.c_int(interp_types[interp]) - -c_nweight = ct.c_int() - -print "src:", src_ncell, src_nvert -print "dst:", dst_ncell, dst_nvert - -remap.remap_get_num_weights(c_src_lon, c_src_lat, c_src_nvert, c_src_ncell, srcpole, - c_dst_lon, c_dst_lat, c_dst_nvert, c_dst_ncell, dstpole, - order, ct.byref(c_nweight)) - -nwgt = c_nweight.value - -c_weights = (ct.c_double * nwgt)() -c_dst_idx = (ct.c_int * nwgt)() -c_src_idx = (ct.c_int * nwgt)() - -remap.remap_get_weights(c_weights, c_src_idx, c_dst_idx) - -wgt_glo = MPI.COMM_WORLD.gather(c_weights[:]) -src_idx_glo = MPI.COMM_WORLD.gather(c_src_idx[:]) -dst_idx_glo = MPI.COMM_WORLD.gather(c_dst_idx[:]) - - -if rank == 0 and mode == 'weights': - nwgt_glo = sum(len(wgt) for wgt in wgt_glo) - - print "Writing", nwgt_glo, "weights to netCDF-file '" + outfile + "'." - f = nc.Dataset(outfile,'w') - f.createDimension('n_src', src_ncell) - f.createDimension('n_dst', dst_ncell) - f.createDimension('n_weight', nwgt_glo) - - var = f.createVariable('src_idx', 'i', ('n_weight')) - var[:] = np.hstack(src_idx_glo) + 1 # make indices start from 1 - var = f.createVariable('dst_idx', 'i', ('n_weight')) - var[:] = np.hstack(dst_idx_glo) + 1 # make indices start from 1 - var = f.createVariable('weight', 'd', ('n_weight')) - var[:] = np.hstack(wgt_glo) - f.close() - -def test_fun(x, y, z): - return (1-x**2)*(1-y**2)*z - -def test_fun_ll(lat, lon): - #return np.cos(lat*math.pi/180)*np.cos(lon*math.pi/180) - return 2.0 + np.cos(lat*math.pi/180.)**2 * np.cos(2*lon*math.pi/180.); - -#UNUSED -#def sphe2cart(lat, lon): -# phi = math.pi/180*lon[:] -# theta = math.pi/2 - math.pi/180*lat[:] -# return np.sin(theta)*np.cos(phi), np.sin(theta)*np.sin(phi), np.cos(theta) - -if mode == 'remap': - c_centre_lon = (ct.c_double * src_ncell_loc)() - c_centre_lat = (ct.c_double * src_ncell_loc)() - c_areas = (ct.c_double * src_ncell_loc)() - remap.remap_get_barycentres_and_areas(c_src_lon, c_src_lat, c_src_nvert, c_src_ncell, srcpole, - c_centre_lon, c_centre_lat, c_areas) - src_val_loc = test_fun_ll(np.array(c_centre_lat[:]), np.array(c_centre_lon[:])) - src_val_glo = MPI.COMM_WORLD.gather(src_val_loc) - - c_centre_lon = (ct.c_double * dst_ncell_loc)() - c_centre_lat = (ct.c_double * dst_ncell_loc)() - c_areas = (ct.c_double * dst_ncell_loc)() - remap.remap_get_barycentres_and_areas(c_dst_lon, c_dst_lat, c_dst_nvert, c_dst_ncell, dstpole, - c_centre_lon, c_centre_lat, c_areas) - dst_val_loc = test_fun_ll(np.array(c_centre_lat[:]), np.array(c_centre_lon[:])) - - dst_val_glo = MPI.COMM_WORLD.gather(dst_val_loc) - dst_areas_glo = MPI.COMM_WORLD.gather(np.array(c_areas[:])) - dst_centre_lon_glo = MPI.COMM_WORLD.gather(np.array(c_centre_lon[:])) - dst_centre_lat_glo = MPI.COMM_WORLD.gather(np.array(c_centre_lat[:])) - - -if rank == 0 and mode == 'remap': - from scipy import sparse - A = sparse.csr_matrix(sparse.coo_matrix((np.hstack(wgt_glo),(np.hstack(dst_idx_glo),np.hstack(src_idx_glo))))) - - src_val = np.hstack(src_val_glo) - dst_ref = np.hstack(dst_val_glo) - dst_areas = np.hstack(dst_areas_glo) - dst_centre_lon = np.hstack(dst_centre_lon_glo) - dst_centre_lat = np.hstack(dst_centre_lat_glo) - - print "source:", src_val.shape - print "destin:", dst_ref.shape - dst_val = A*src_val - err = dst_val - dst_ref - print "absolute maximum error, maximum value:", np.max(np.abs(err)), np.max(np.abs(dst_ref)) - print "relative maximum error, normalized L2 error, average target cell size (edgelength of same-area square):" - print np.max(np.abs(err))/np.max(np.abs(dst_ref)), np.linalg.norm(err)/np.linalg.norm(dst_ref), np.mean(np.sqrt(dst_areas)) - - f = nc.Dataset(outfile,'w') - f.createDimension('n_vert', dst_nvert) - f.createDimension('n_cell', dst_ncell) - - var = f.createVariable('lat', 'd', ('n_cell')) - var.setncattr("long_name", "latitude") - var.setncattr("units", "degrees_north") - var.setncattr("bounds", "bounds_lat") - var[:] = dst_centre_lat - var = f.createVariable('lon', 'd', ('n_cell')) - var.setncattr("long_name", "longitude") - var.setncattr("units", "degrees_east") - var.setncattr("bounds", "bounds_lon") - var[:] = dst_centre_lon - - var = f.createVariable('bounds_lon', 'd', ('n_cell','n_vert')) - var[:] = dst_lon - var = f.createVariable('bounds_lat', 'd', ('n_cell','n_vert')) - var[:] = dst_lat - var = f.createVariable('val', 'd', ('n_cell')) - var.setncattr("coordinates", "lon lat") - var[:] = dst_val - var = f.createVariable('val_ref', 'd', ('n_cell')) - var.setncattr("coordinates", "lon lat") - var[:] = dst_ref - var = f.createVariable('err', 'd', ('n_cell')) - var.setncattr("coordinates", "lon lat") - var[:] = err - var = f.createVariable('area', 'd', ('n_cell')) - var.setncattr("coordinates", "lon lat") - var[:] = dst_areas[:] # dest - f.close() - -if not "reader" in srctype: - src.close() -if not "reader" in dsttype: - dst.close() - diff --git a/xios_2311_src/trunk/.svn/pristine/60/60c55e31073581011d2cce35684c4f64ebb29c36.svn-base b/xios_2311_src/trunk/.svn/pristine/60/60c55e31073581011d2cce35684c4f64ebb29c36.svn-base deleted file mode 100644 index 3f39acfd0bcf099c8d2e7ed5bbf4ecc7820cb263..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/60/60c55e31073581011d2cce35684c4f64ebb29c36.svn-base +++ /dev/null @@ -1,51 +0,0 @@ -/* ************************************************************************** * - * Copyright © IPSL/LSCE, xios, Avril 2010 - Octobre 2011 * - * ************************************************************************** */ - -#include - -#include - -#include "xios.hpp" - -#include "object_template.hpp" -#include "group_template.hpp" -#include "attribute_template.hpp" - -#include "icutil.hpp" -#include "timer.hpp" -#include "reorder_domain.hpp" - -extern "C" -{ -// /////////////////////////////// Définitions ////////////////////////////// // - - // ----------------------- Redéfinition de types ---------------------------- - - typedef xios::CReorderDomain * XReorderDomainPtr; - - // ------------------------ Création des handle ----------------------------- - void cxios_reorder_domain_handle_create(XReorderDomainPtr * _ret, const char * _id, int _id_len) - TRY - { - std::string id; - if (!cstr2string(_id, _id_len, id)) return; - CTimer::get("XIOS").resume() ; - *_ret = xios::CReorderDomain::get(id); - CTimer::get("XIOS").suspend() ; - } - CATCH_DUMP_STACK - - // -------------------- Vérification des identifiants ----------------------- - void cxios_reorder_domain_valid_id(bool * _ret, const char * _id, int _id_len) - TRY - { - std::string id; - if (!cstr2string(_id, _id_len, id)) return; - - CTimer::get("XIOS").resume() ; - *_ret = xios::CReorderDomain::has(id); - CTimer::get("XIOS").suspend() ; - } - CATCH_DUMP_STACK -} // extern "C" diff --git a/xios_2311_src/trunk/.svn/pristine/61/6109863ee051d4ab60fa2c51192c1a76c963e891.svn-base b/xios_2311_src/trunk/.svn/pristine/61/6109863ee051d4ab60fa2c51192c1a76c963e891.svn-base deleted file mode 100644 index 61b49f509c08b4703cc9c01e2efe4a44b77dc1eb..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/61/6109863ee051d4ab60fa2c51192c1a76c963e891.svn-base +++ /dev/null @@ -1,121 +0,0 @@ -/*! - \file axis_algorithm_reduce_axis.cpp - \author Ha NGUYEN - \since 23 June 2016 - \date 23 June 2016 - - \brief Algorithm for reduce a axis to an axis - */ -#include "axis_algorithm_reduce_axis.hpp" -#include "reduce_axis_to_axis.hpp" -#include "axis.hpp" -#include "grid.hpp" -#include "grid_transformation_factory_impl.hpp" -#include "grid_algorithm_reduce.hpp" - - -namespace xios { -shared_ptr CAxisAlgorithmReduceAxis::create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) -TRY -{ - std::vector axisListDestP = gridDst->getAxis(); - std::vector axisListSrcP = gridSrc->getAxis(); - - CReduceAxisToAxis* reduceAxis = dynamic_cast (transformation); - int axisDstIndex = elementPositionInGridDst2AxisPosition[elementPositionInGrid]; - int axisSrcIndex = elementPositionInGridSrc2AxisPosition[elementPositionInGrid]; - - return make_shared(isSource, axisListDestP[axisDstIndex], axisListSrcP[axisSrcIndex], reduceAxis); -} -CATCH - -bool CAxisAlgorithmReduceAxis::dummyRegistered_ = CAxisAlgorithmReduceAxis::registerTrans(); -bool CAxisAlgorithmReduceAxis::registerTrans() -TRY -{ - return CGridTransformationFactory::registerTransformation(TRANS_REDUCE_AXIS_TO_AXIS, create); -} -CATCH - - -CAxisAlgorithmReduceAxis::CAxisAlgorithmReduceAxis(bool isSource, CAxis* axisDestination, CAxis* axisSource, CReduceAxisToAxis* algo) - : CAlgorithmTransformationReduce(isSource) -TRY -{ - if (!axisDestination->checkGeometricAttributes(false)) - { - axisDestination->resetGeometricAttributes(); - axisDestination->setGeometricAttributes(*axisSource) ; - } - axisDestination->checkAttributes() ; - algo->checkValid(axisDestination, axisSource); - - - switch (algo->operation) - { - case CReduceAxisToAxis::operation_attr::sum: - operator_ = EReduction::sum; - break; - case CReduceAxisToAxis::operation_attr::min: - operator_ = EReduction::min; - break; - case CReduceAxisToAxis::operation_attr::max: - operator_ = EReduction::max; - break; - case CReduceAxisToAxis::operation_attr::average: - operator_ = EReduction::average; - break; - default: - ERROR("CAxisAlgorithmReduceAxis::CAxisAlgorithmReduceAxis(CAxis* axisDestination, CAxis* axisSource, CReduceAxisToAxis* algo)", - << "Operation is wrongly defined. Supported operations: sum, min, max, average." << std::endl - << "Axis source " <getId() << std::endl - << "Axis destination " << axisDestination->getId()); - } - - //TransformationIndexMap& transMap = this->transformationMapping_; - //CArray& axisDstIndex = axisDestination->index; - //int nbAxisIdx = axisDstIndex.numElements(); - - - - auto& transMap = this->transformationMapping_; - - CArray dstGlobalIndex ; - axisDestination->getLocalView(CElementView::WORKFLOW)->getGlobalIndexView(dstGlobalIndex) ; - size_t nbIdx = dstGlobalIndex.numElements(); - - for (size_t idx = 0; idx < nbIdx; ++idx) - { - size_t globalIdx = dstGlobalIndex(idx); - transMap[globalIdx].resize(1); - transMap[globalIdx][0]=globalIdx ; - } - - this->computeAlgorithm(axisSource->getLocalView(CElementView::WORKFLOW), axisDestination->getLocalView(CElementView::WORKFLOW)) ; -} -CATCH - -shared_ptr CAxisAlgorithmReduceAxis::createGridAlgorithm(CGrid* gridSrc, CGrid* gridDst, int pos) -{ - auto algo=make_shared(gridSrc, gridDst, pos, shared_from_this(), operator_) ; - algo->computeAlgorithm(false) ; - return algo ; -} - -CAxisAlgorithmReduceAxis::~CAxisAlgorithmReduceAxis() -TRY -{ - -} -CATCH - - -} diff --git a/xios_2311_src/trunk/.svn/pristine/61/61169398f65b5b313a21e9876916d5bdbbcebea1.svn-base b/xios_2311_src/trunk/.svn/pristine/61/61169398f65b5b313a21e9876916d5bdbbcebea1.svn-base deleted file mode 100644 index e73f991ce56c267c20f906fea41ce69b7cde9d05..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/61/61169398f65b5b313a21e9876916d5bdbbcebea1.svn-base +++ /dev/null @@ -1,101 +0,0 @@ -PROGRAM test_diurnal_cycle - - USE xios - USE mod_wait - IMPLICIT NONE - INCLUDE "mpif.h" - INTEGER :: rank - INTEGER :: size - INTEGER :: ierr - - CHARACTER(len=*),PARAMETER :: id="client" - INTEGER :: comm - TYPE(xios_duration) :: dtime - TYPE(xios_context) :: ctx_hdl - INTEGER,PARAMETER :: llm=10 - DOUBLE PRECISION :: value_glo(0:llm-1) - DOUBLE PRECISION,ALLOCATABLE :: axisValue(:) - DOUBLE PRECISION,ALLOCATABLE :: field_A(:,:) - INTEGER :: i,j,l,ts,nl,begin - -!!! MPI Initialization - - CALL MPI_INIT(ierr) - CALL MPI_COMM_RANK(MPI_COMM_WORLD,rank,ierr) - - IF (rank>3) THEN - CALL xios_init_server - ELSE - - CALL init_wait - -!!! XIOS Initialization (get the local communicator) - - CALL xios_initialize(id,return_comm=comm) - - CALL MPI_COMM_RANK(comm,rank,ierr) - CALL MPI_COMM_SIZE(comm,size,ierr) - - CALL xios_context_initialize("test",comm) - CALL xios_get_handle("test",ctx_hdl) - CALL xios_set_current_context(ctx_hdl) - - nl=llm/size - - IF (rank& nBegin, - const std::vector& nSize, - const std::vector& nBeginGlobal, - const std::vector& nGlobal) - : CDistribution(rank, nGlobal.size()), nGlobal_(nGlobal), nBeginGlobal_(nBeginGlobal), - nSize_(nSize), nBegin_(nBegin), globalLocalIndexMap_() -{ - createGlobalIndex(); -} - -CDistributionServer::CDistributionServer(int rank, - const std::vector >& globalIndexElements, - const CArray& elementOrder, - const std::vector& nBegin, - const std::vector& nSize, - const std::vector& nBeginGlobal, - const std::vector& nGlobal) - : CDistribution(rank, nGlobal.size()), nGlobal_(nGlobal), nBeginGlobal_(nBeginGlobal), - nSize_(nSize), nBegin_(nBegin), globalLocalIndexMap_() -{ - createGlobalIndex(globalIndexElements, elementOrder); -} - -CDistributionServer::~CDistributionServer() -{ -} - -/*! - Create global index on server side - Like the similar function on client side, this function serves on creating global index -for data written by the server. The global index is used to calculating local index of data -written on each server -*/ -void CDistributionServer::createGlobalIndex() -{ - size_t idx = 0, ssize = 1; - for (int i = 0; i < nSize_.size(); ++i) ssize *= nSize_[i]; - - this->globalIndex_.resize(ssize); - std::vector idxLoop(this->getDims(),0); - std::vector currentIndex(this->getDims()); - int innerLoopSize = nSize_[0]; - - globalLocalIndexMap_.rehash(std::ceil(ssize/globalLocalIndexMap_.max_load_factor())); - while (idxdims_-1; ++i) - { - if (idxLoop[i] == nSize_[i]) - { - idxLoop[i] = 0; - ++idxLoop[i+1]; - } - } - - for (int i = 1; i < this->dims_; ++i) currentIndex[i] = idxLoop[i] + nBegin_[i]; - - size_t mulDim, globalIndex; - for (int i = 0; i < innerLoopSize; ++i) - { - mulDim = 1; - globalIndex = i + nBegin_[0]; - - for (int k = 1; k < this->dims_; ++k) - { - mulDim *= nGlobal_[k-1]; - globalIndex += (currentIndex[k])*mulDim; - } - globalLocalIndexMap_[globalIndex] = idx; - this->globalIndex_(idx) = globalIndex; - - ++idx; - } - idxLoop[0] += innerLoopSize; - } -} - -/*! - Create global index on server side - Like the similar function on client side, this function serves on creating global index -for data written by the server. The global index is used to calculating local index of data -written on each server - \param[in] globalIndexElement global index on server side of each element of grid (scalar, axis, domain) - \param[in] elementOrder the order of elements of grid (e.x: domain->axis or domain->scalar) -*/ -void CDistributionServer::createGlobalIndex(const std::vector >& globalIndexElements, - const CArray& elementOrder) -{ - int numElement = elementOrder.numElements(), elementIdx = 0; - std::vector indexMap(numElement); - for (int i = 0; i < numElement; ++i) - { - indexMap[i] = elementIdx; - if (2 == elementOrder(i)) - { - elementIdx += 2; - } - else - ++elementIdx; - } - - std::vector elementGlobalSize(numElement); - size_t globalSize = 1; - for (int i = 0; i < numElement; ++i) - { - int elementType = elementOrder(i); - elementGlobalSize[i] = globalSize; - if (2 == elementType) // domain - { - globalSize *= nGlobal_[indexMap[i]+1] * nGlobal_[indexMap[i]]; - } - else // axis or scalar - { - globalSize *= nGlobal_[indexMap[i]]; - } - } - - size_t ssize = 1; - for (int i = 0; i < globalIndexElements.size(); ++i) ssize *= globalIndexElements[i].numElements(); - this->globalIndex_.resize(ssize); - globalLocalIndexMap_.rehash(std::ceil(ssize/globalLocalIndexMap_.max_load_factor())); - - std::vector idxLoop(numElement,0); - std::vector currentIndex(numElement); - int innerLoopSize = globalIndexElements[0].numElements(); - - size_t idx = 0; - while (idxglobalIndex_(idx) = globalIndex; - ++idx; - } - idxLoop[0] += innerLoopSize; - } -} - -/*! - Compute local index for writing data on server - \param [in] globalIndex Global index received from client -*/ -void CDistributionServer::computeLocalIndex(CArray& globalIndex) -{ - size_t ssize = globalIndex.numElements(); - size_t localIndexSize = std::min(globalIndex_.numElements(), ssize); - CArray localIndex(localIndexSize); - GlobalLocalMap::const_iterator ite = globalLocalIndexMap_.end(), it; - int i = 0; - for (size_t idx = 0; idx < ssize; ++idx) - { - it = globalLocalIndexMap_.find(globalIndex(idx)); - if (ite != it) - { - localIndex(i) = it->second; - ++i; - } - } - - globalIndex.reference(localIndex); -} - -/*! - Transforms local indexes owned by the server into global indexes - \param [in/out] indexes on input, local indexes of the server, - on output, the corresponding global indexes -*/ -void CDistributionServer::computeGlobalIndex(CArray& indexes) const -{ - for (int i = 0; i < indexes.numElements(); ++i) - { - indexes(i) = globalIndex_(indexes(i)); - } -} - -/*! - Get the size of grid index in server (e.x: sizeGrid *= size of each dimensiion) -*/ -int CDistributionServer::getGridSize() const -{ - return globalLocalIndexMap_.size(); -} - -void CDistributionServer::partialClear(void) -{ - GlobalLocalMap void1 ; - globalLocalIndexMap_.swap(void1) ; -} - -} // namespace xios diff --git a/xios_2311_src/trunk/.svn/pristine/61/612e06edfe263fb13e5c5b636be1a6a34414b5d4.svn-base b/xios_2311_src/trunk/.svn/pristine/61/612e06edfe263fb13e5c5b636be1a6a34414b5d4.svn-base deleted file mode 100644 index 87c0cec5923fd5fc8a62f0509f9965567b54f042..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/61/612e06edfe263fb13e5c5b636be1a6a34414b5d4.svn-base +++ /dev/null @@ -1,363 +0,0 @@ -#include "workflow_graph.hpp" -#include "cxios.hpp" - -namespace xios -{ - - std::vector *CWorkflowGraph::vectorOfNodes_ = 0; - std::vector *CWorkflowGraph::vectorOfEdges_ = 0; - std::vector *CWorkflowGraph::vectorOfContexts_ = 0; - - std::vector *CWorkflowGraph::vectorOfNodes_srv_ = 0; - std::vector *CWorkflowGraph::vectorOfEdges_srv_ = 0; - std::vector *CWorkflowGraph::vectorOfContexts_srv_ = 0; - - bool CWorkflowGraph::clientGraphBuilt = false; - bool CWorkflowGraph::serverGraphBuilt = false; - bool CWorkflowGraph::build_begin = false; - - std::unordered_map *CWorkflowGraph::mapHashFilterID_ = 0; - std::unordered_map *CWorkflowGraph::mapHashFilterID_srv_ = 0; - - - CWorkflowGraph::CWorkflowGraph() - { } - - -//****************************************************** - - void CWorkflowGraph::outputWorkflowGraph_client_stdout() - { - std::cout<<"\n\nbuild workflow graph ..."<size(); i++) - { - std::cout<<"Node["<size(); i++) - { - std::cout<<"Edge["<size(); i++) - { - info(100)<<"Node["<size(); i++) - { - info(100)<<"Edge["<; - std::string currentContextId = CContext::getCurrent()->getId(); - - graph_edge_object edge_obj; - edge_obj.from = from; - edge_obj.to = to; - edge_obj.date = packet->date; - edge_obj.timestamp = packet->timestamp; - edge_obj.field = packet->graphPackage->currentField; - edge_obj.show = true; - - if(vectorOfNodes_->at(from).filter_class == 2) // from pass through filter - { - edge_obj.label_info = vectorOfNodes_->at(from).label_field_id; - } - - if(vectorOfNodes_->at(to).filter_class == 3) // to temporal filter - { - vectorOfNodes_->at(to).expected_entry_nb++; - } - - for(int i=0; isize(); i++) - { - if(vectorOfContexts_->at(i) == currentContextId) - { - edge_obj.context = i; - edge_obj.context_id = currentContextId; - break; - } - } - edge_obj.attributes = packet->graphPackage->currentField->recordXiosAttributes(); - - vectorOfEdges_->push_back(edge_obj); - //info(100)<<"****************** Add Edge from "<at(from).filter_filled = true; - } - else - { - if(!vectorOfEdges_srv_) vectorOfEdges_srv_ = new std::vector; - std::string currentContextId = CContext::getCurrent()->getId(); - - graph_edge_object edge_obj; - edge_obj.from = from; - edge_obj.to = to; - edge_obj.date = packet->date; - edge_obj.timestamp = packet->timestamp; - edge_obj.field = packet->graphPackage->currentField; - edge_obj.show = true; - for(int i=0; isize(); i++) - { - if(vectorOfContexts_srv_->at(i) == currentContextId) - { - edge_obj.context = i; - edge_obj.context_id = currentContextId; - break; - } - } - edge_obj.attributes = packet->graphPackage->currentField->recordXiosAttributes(); - - vectorOfEdges_srv_->push_back(edge_obj); - //info(100)<<"****************** Server side : Add Edge from "<at(from).filter_filled = true; - - } - } - CATCH - - - void CWorkflowGraph::addNode(StdString filterName, int filterClass, bool filterFilled, int entryNb, CDataPacketPtr packet) - TRY - { - if(CXios::isClient) - { - //if(vectorOfEdges_&&vectorOfNodes_) outputWorkflowGraph_client_stdout(); - // std::cout<<"Trying to add a node naming "<; - if(!vectorOfContexts_) vectorOfContexts_ = new std::vector; - if(!mapHashFilterID_) mapHashFilterID_ = new std::unordered_map ; - - std::string currentContextId = CContext::getCurrent()->getId(); - if ( std::find(vectorOfContexts_->begin(), vectorOfContexts_->end(), currentContextId) == vectorOfContexts_->end() ) - vectorOfContexts_->push_back(currentContextId); - - - graph_node_object node_obj; - node_obj.filter_name = filterName; - node_obj.filter_class = filterClass; - node_obj.filter_filled = filterFilled; - node_obj.expected_entry_nb = entryNb; - node_obj.date = packet->date; - node_obj.timestamp = packet->timestamp; - - for(int i=0; isize(); i++) - { - if(vectorOfContexts_->at(i) == currentContextId) - { - node_obj.context = i; - node_obj.context_id = currentContextId; - break; - } - } - - node_obj.attributes = packet->graphPackage->currentField->recordXiosAttributes(); - - vectorOfNodes_->push_back(node_obj); - } - else - { - if(!vectorOfNodes_srv_) vectorOfNodes_srv_ = new std::vector; - if(!vectorOfContexts_srv_) vectorOfContexts_srv_ = new std::vector; - if(!mapHashFilterID_srv_) mapHashFilterID_srv_ = new std::unordered_map ; - - std::string currentContextId = CContext::getCurrent()->getId(); - if ( std::find(vectorOfContexts_srv_->begin(), vectorOfContexts_srv_->end(), currentContextId) == vectorOfContexts_srv_->end() ) - vectorOfContexts_srv_->push_back(currentContextId); - - graph_node_object node_obj; - node_obj.filter_name = filterName; - node_obj.filter_class = filterClass; - node_obj.filter_filled = filterFilled; - node_obj.expected_entry_nb = entryNb; - node_obj.date = packet->date; - node_obj.timestamp = packet->timestamp; - for(int i=0; isize(); i++) - { - if(vectorOfContexts_srv_->at(i) == currentContextId) - { - node_obj.context = i; - node_obj.context_id = currentContextId; - break; - } - } - node_obj.attributes = packet->graphPackage->currentField->recordXiosAttributes(); - - vectorOfNodes_srv_->push_back(node_obj); - } - - } - CATCH - - int CWorkflowGraph::getNodeSize() - TRY - { - if(CXios::isClient) - { - return !vectorOfNodes_? 0 : vectorOfNodes_->size(); - } - else - { - return !vectorOfNodes_srv_? 0 : vectorOfNodes_srv_->size(); - } - } - CATCH - - - - void CWorkflowGraph::outputWorkflowGraph_client() - { - int graph_rank; - MPI_Comm_rank(MPI_COMM_WORLD, &graph_rank); - std::ofstream *outfiles; - - outfiles = new std::ofstream[vectorOfContexts_->size()]; - - for(int ctx=0; ctxsize(); ctx++) - { - StdString graphFileName="graph_data_"+vectorOfContexts_->at(ctx)+"_client_"+to_string(graph_rank)+".json"; - outfiles[ctx].open(graphFileName); - - outfiles[ctx] << "{\"nodes\":["<size(); i++) - { - int ctx = vectorOfNodes_->at(i).context; - if(i!=0) outfiles[ctx] << ","; - outfiles[ctx] << "{\"id\":"<at(i).filter_name<<"\","<at(i).filter_class<<","<at(i).filter_filled)<<","<at(i).context_id<<"\","<at(i).expected_entry_nb<<"\","<at(i).attributes<<"\","<size(); ctx++) - { - outfiles[ctx] << std::endl<<"],"<size(); i++) - { - int ctx = vectorOfEdges_->at(i).context; - if(i!=0) outfiles[ctx] << ","; - outfiles[ctx] << "{\"id\":"<at(i).from<<","<at(i).to<<","<at(i).label_info != "none") - { - if(vectorOfEdges_->at(i).show) outfiles[ctx] << "\"label\":"<<"\""<at(i).label_info<<"\\n"<at(i).date<<"\","<at(i).date<<"\","<at(i).show) outfiles[ctx] << "\"label\":"<<"\""<at(i).field->getId()<<"\\n"<at(i).date<<"\","<at(i).date<<"\","<at(i).context_id<<"\","<at(i).attributes<<"\","<at(i).date<<"\"}"<size(); ctx++) - { - outfiles[ctx] << std::endl<<"]}"<size()]; - - for(int ctx=0; ctxsize(); ctx++) - { - StdString graphFileName="graph_data_"+vectorOfContexts_srv_->at(ctx)+"_client_"+to_string(graph_rank)+".json"; - outfiles[ctx].open(graphFileName); - - outfiles[ctx] << "{\"nodes\":["<size(); i++) - { - int ctx = vectorOfNodes_srv_->at(i).context; - if(i!=0) outfiles[ctx] << ","; - outfiles[ctx] << "{\"id\":"<at(i).filter_name<<"\","<at(i).filter_class<<","<at(i).filter_filled)<<","<at(i).context_id<<"\","<at(i).expected_entry_nb<<"\","<at(i).attributes<<"\","<size(); ctx++) - { - outfiles[ctx] << std::endl<<"],"<size(); i++) - { - int ctx = vectorOfEdges_srv_->at(i).context; - if(i!=0) outfiles[ctx] << ","; - outfiles[ctx] << "{\"id\":"<at(i).from<<","<at(i).to<<","<at(i).show) outfiles[ctx] << "\"label\":"<<"\""<at(i).field->getId()<<"\\n"<at(i).date<<"\","<at(i).date<<"\","<at(i).context_id<<"\","<at(i).attributes<<"\","<at(i).date<<"\"}"<size(); ctx++) - { - outfiles[ctx] << std::endl<<"]}"< - -namespace xios -{ - - - class CDaemonsManager - { - public: - - CDaemonsManager(bool isXiosServer) ; - ~CDaemonsManager() ; - - bool eventLoop(void) ; - bool servicesEventLoop(void) ; - - void scheduleContext(size_t hashId) { scheduledContext_=hashId ;} //!< for attached mode, give the hand to the associated context server - bool isScheduledContext(size_t hashId) { return scheduledContext_==hashId ;} //!< for attached mode, return true if context server is sceduled - void unscheduleContext(void) { scheduledContext_=0 ;} //!< for attached mode : unschedule context - bool finalize(void) ; - private: - bool isServer_ ; - size_t scheduledContext_ = 0 ; //!< Hash id of the next scehduled context for attached mode - bool isFinalized_=false ; - } ; -} - -#endif \ No newline at end of file diff --git a/xios_2311_src/trunk/.svn/pristine/61/61e5dcb7f4488bb3fedfd32141994c0e11b89433.svn-base b/xios_2311_src/trunk/.svn/pristine/61/61e5dcb7f4488bb3fedfd32141994c0e11b89433.svn-base deleted file mode 100644 index e66c049cd96c4558f0b3304d6bb0c8fd602a53eb..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/61/61e5dcb7f4488bb3fedfd32141994c0e11b89433.svn-base +++ /dev/null @@ -1,11 +0,0 @@ -export HDF5_INC_DIR="" -export HDF5_LIB_DIR="" - -export NETCDF_INC_DIR="" -export NETCDF_LIB_DIR="" - -export BOOST_INC_DIR="" -export BOOST_LIB_DIR="" - -export BLITZ_INC_DIR="" -export BLITZ_LIB_DIR="" diff --git a/xios_2311_src/trunk/.svn/pristine/62/62680ecf4de8849fcc9537c1efaaadb0c0836274.svn-base b/xios_2311_src/trunk/.svn/pristine/62/62680ecf4de8849fcc9537c1efaaadb0c0836274.svn-base deleted file mode 100644 index f5341cfc5a56f3e148b9f184925577bea6d7ca53..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/62/62680ecf4de8849fcc9537c1efaaadb0c0836274.svn-base +++ /dev/null @@ -1,80 +0,0 @@ -/* A Bison parser, made by GNU Bison 2.4.3. */ - -/* Skeleton interface for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2009, 2010 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - SCAN_ALIAS = 258, - SCAN_ARRAY = 259, - SCAN_ATTR = 260, - SCAN_BYTE = 261, - SCAN_CODE = 262, - SCAN_DATASET = 263, - SCAN_DATA = 264, - SCAN_ERROR = 265, - SCAN_FLOAT32 = 266, - SCAN_FLOAT64 = 267, - SCAN_GRID = 268, - SCAN_INT16 = 269, - SCAN_INT32 = 270, - SCAN_MAPS = 271, - SCAN_MESSAGE = 272, - SCAN_SEQUENCE = 273, - SCAN_STRING = 274, - SCAN_STRUCTURE = 275, - SCAN_UINT16 = 276, - SCAN_UINT32 = 277, - SCAN_URL = 278, - SCAN_PTYPE = 279, - SCAN_PROG = 280, - WORD_WORD = 281, - WORD_STRING = 282 - }; -#endif - - - -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef int YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -#endif - - - - diff --git a/xios_2311_src/trunk/.svn/pristine/62/628c5835ca11dcaa470a4823f11e4fef420a509e.svn-base b/xios_2311_src/trunk/.svn/pristine/62/628c5835ca11dcaa470a4823f11e4fef420a509e.svn-base deleted file mode 100644 index 17d28053fcfd4cab2a2a935c6655a326e2f3c4d3..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/62/628c5835ca11dcaa470a4823f11e4fef420a509e.svn-base +++ /dev/null @@ -1,19 +0,0 @@ -/* - * rc.h - * - * Created on: Mar 5, 2009 - * Author: rikki - */ - -#ifndef _CURLFUNCTION_H_ -#define _CURLFUNCTION_H_ - -extern int ocset_curl_flags(OCstate*); -extern int ocset_user_password(OCstate*); -extern int ocset_proxy(OCstate*); -extern int ocset_ssl(OCstate*); - -#endif /*_CURLFUNCTION_H_*/ - - - diff --git a/xios_2311_src/trunk/.svn/pristine/62/628e817831ef197f8a33d70b8c41ad3dd3707f32.svn-base b/xios_2311_src/trunk/.svn/pristine/62/628e817831ef197f8a33d70b8c41ad3dd3707f32.svn-base deleted file mode 100644 index 765dfa622876bf4d7a0db4d25a892a78a5b9f856..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/62/628e817831ef197f8a33d70b8c41ad3dd3707f32.svn-base +++ /dev/null @@ -1,97 +0,0 @@ -! * ************************************************************************** * -! * Interface auto generated - do not modify * -! * ************************************************************************** * -#include "../fortran/xios_fortran_prefix.hpp" - -MODULE variablegroup_interface_attr - USE, INTRINSIC :: ISO_C_BINDING - - INTERFACE - ! Do not call directly / interface FORTRAN 2003 <-> C99 - - SUBROUTINE cxios_set_variablegroup_group_ref(variablegroup_hdl, group_ref, group_ref_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: variablegroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: group_ref - INTEGER (kind = C_INT) , VALUE :: group_ref_size - END SUBROUTINE cxios_set_variablegroup_group_ref - - SUBROUTINE cxios_get_variablegroup_group_ref(variablegroup_hdl, group_ref, group_ref_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: variablegroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: group_ref - INTEGER (kind = C_INT) , VALUE :: group_ref_size - END SUBROUTINE cxios_get_variablegroup_group_ref - - FUNCTION cxios_is_defined_variablegroup_group_ref(variablegroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_variablegroup_group_ref - INTEGER (kind = C_INTPTR_T), VALUE :: variablegroup_hdl - END FUNCTION cxios_is_defined_variablegroup_group_ref - - - SUBROUTINE cxios_set_variablegroup_name(variablegroup_hdl, name, name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: variablegroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: name - INTEGER (kind = C_INT) , VALUE :: name_size - END SUBROUTINE cxios_set_variablegroup_name - - SUBROUTINE cxios_get_variablegroup_name(variablegroup_hdl, name, name_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: variablegroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: name - INTEGER (kind = C_INT) , VALUE :: name_size - END SUBROUTINE cxios_get_variablegroup_name - - FUNCTION cxios_is_defined_variablegroup_name(variablegroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_variablegroup_name - INTEGER (kind = C_INTPTR_T), VALUE :: variablegroup_hdl - END FUNCTION cxios_is_defined_variablegroup_name - - - SUBROUTINE cxios_set_variablegroup_ts_target(variablegroup_hdl, ts_target, ts_target_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: variablegroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: ts_target - INTEGER (kind = C_INT) , VALUE :: ts_target_size - END SUBROUTINE cxios_set_variablegroup_ts_target - - SUBROUTINE cxios_get_variablegroup_ts_target(variablegroup_hdl, ts_target, ts_target_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: variablegroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: ts_target - INTEGER (kind = C_INT) , VALUE :: ts_target_size - END SUBROUTINE cxios_get_variablegroup_ts_target - - FUNCTION cxios_is_defined_variablegroup_ts_target(variablegroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_variablegroup_ts_target - INTEGER (kind = C_INTPTR_T), VALUE :: variablegroup_hdl - END FUNCTION cxios_is_defined_variablegroup_ts_target - - - SUBROUTINE cxios_set_variablegroup_type(variablegroup_hdl, type, type_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: variablegroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: type - INTEGER (kind = C_INT) , VALUE :: type_size - END SUBROUTINE cxios_set_variablegroup_type - - SUBROUTINE cxios_get_variablegroup_type(variablegroup_hdl, type, type_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T), VALUE :: variablegroup_hdl - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: type - INTEGER (kind = C_INT) , VALUE :: type_size - END SUBROUTINE cxios_get_variablegroup_type - - FUNCTION cxios_is_defined_variablegroup_type(variablegroup_hdl) BIND(C) - USE ISO_C_BINDING - LOGICAL(kind=C_BOOL) :: cxios_is_defined_variablegroup_type - INTEGER (kind = C_INTPTR_T), VALUE :: variablegroup_hdl - END FUNCTION cxios_is_defined_variablegroup_type - - END INTERFACE - -END MODULE variablegroup_interface_attr diff --git a/xios_2311_src/trunk/.svn/pristine/62/62df2faf9d347064ec40bcc1826f21eb83bdbce3.svn-base b/xios_2311_src/trunk/.svn/pristine/62/62df2faf9d347064ec40bcc1826f21eb83bdbce3.svn-base deleted file mode 100644 index 0e5ba63a2fb47e6297db667bc04f386c594eefcd..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/62/62df2faf9d347064ec40bcc1826f21eb83bdbce3.svn-base +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef __STRING_TOOLS_HPP__ -#define __STRING_TOOLS_HPP__ - -#include -#include -#include - -namespace xios -{ - std::vector splitRegex(const std::string& input, const std::string& regex) ; - - inline std::vector splitRegex(const std::string& input, const std::string& regex) - { - // passing -1 as the submatch index parameter performs splitting - std::regex re(regex); - std::regex_token_iterator - first{input.begin(), input.end(), re, -1}, - last; - return {first, last}; - } - -} -#endif diff --git a/xios_2311_src/trunk/.svn/pristine/62/62e746f8f364fa7febfee49fc8501af67a663871.svn-base b/xios_2311_src/trunk/.svn/pristine/62/62e746f8f364fa7febfee49fc8501af67a663871.svn-base deleted file mode 100644 index ac359e3f67fc5f2d6cc9f6109c36a7e5113bb1b4..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/62/62e746f8f364fa7febfee49fc8501af67a663871.svn-base +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef __XIOS_CObject__ -#define __XIOS_CObject__ - -/// XIOS headers /// -#include "xios_spl.hpp" - -namespace xios -{ - /// ////////////////////// Déclarations ////////////////////// /// - - class CObject - { - public: - /// Destructeur /// - virtual ~CObject(void); - - /// Accesseurs /// - const StdString& getId(void) const; - - virtual StdString dumpClassAttributes(void); - - /// Mutateurs /// - void resetId(void); - void setId(const StdString& id, bool idAutoGenerated = false); - - /// Tests /// - bool hasId(void) const; - bool hasAutoGeneratedId(void) const; - - /// Opérateurs /// - // bool operator==(const CObject& other) const; - // bool operator!=(const CObject& other) const; - - /// Flux /// - friend StdOStream& operator<<(StdOStream& os, const CObject& object); - - /// Autres /// - virtual StdString toString(void) const = 0; - virtual void fromString(const StdString& str) = 0; - - protected: - /// Constructeurs /// - CObject(void); - explicit CObject(const StdString& id, bool idAutoGenerated = false); - CObject(const CObject& object); - CObject(const CObject* const object); // Not implemented. - - private: - /// Propriétés /// - StdString id; // identifiant de l'Object - bool idDefined; // true si l'object est identifié, false sinon. - bool idAutoGenerated; //!< true if and only the id was automatically generated - }; // class CObject -} // namespace xios - -#endif // __XIOS_CObject__ diff --git a/xios_2311_src/trunk/.svn/pristine/63/635092d0bc78efb98b8cf240f57be6f7673a59a9.svn-base b/xios_2311_src/trunk/.svn/pristine/63/635092d0bc78efb98b8cf240f57be6f7673a59a9.svn-base deleted file mode 100644 index 9894aa7bce020de49eae0c43d1122efd85acc917..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/63/635092d0bc78efb98b8cf240f57be6f7673a59a9.svn-base +++ /dev/null @@ -1,41 +0,0 @@ -/*! - \file min.hpp - \author Ha NGUYEN - \since 27 June 2016 - \date 27 June 2016 - - \brief Min reduction - */ -#ifndef __XIOS_REDUCTION_MIN_ALGORITHM_HPP__ -#define __XIOS_REDUCTION_MIN_ALGORITHM_HPP__ - -#include "reduction.hpp" - -namespace xios { - -/*! - \class CMinReductionAlgorithm - Interface for all reduction alogrithms. -*/ -class CMinReductionAlgorithm : public CReductionAlgorithm -{ -public: - CMinReductionAlgorithm(); - - virtual void apply(const std::vector >& localIndex, - const double* dataInput, - CArray& dataOut, - std::vector& flagInitial, - bool ignoreMissingValue, bool firstPass); - - virtual ~CMinReductionAlgorithm() {} - -public: - static bool registerTrans(); - -protected: - static CReductionAlgorithm* create(); -}; - -} -#endif // __XIOS_REDUCTION_MIN_ALGORITHM_HPP__ diff --git a/xios_2311_src/trunk/.svn/pristine/63/636ceed642f366bcca1d411f06d5ff4ab0915a91.svn-base b/xios_2311_src/trunk/.svn/pristine/63/636ceed642f366bcca1d411f06d5ff4ab0915a91.svn-base deleted file mode 100644 index bc081cc84fa73dd4df468e55d2fe1c6adabe640d..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/63/636ceed642f366bcca1d411f06d5ff4ab0915a91.svn-base +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/bash - -echo "running my_run.sh" - -export svnR=$(svn info --show-item revision ../../) -svnurl=$(svn info --show-item url ../../) -PWD=$(pwd) - -fn=report_${svnR}_${arch}_${mode}.txt - -if [ -z ${enable_mem_track+x} ]; then - # initialize the report for the main part of the test (without memory tracking, see step2.py for details) - echo "#revision" ${svnR} > ${fn} - echo "#url" ${svnurl} >> ${fn} - echo "#machine" ${xios_machine_name} >> ${fn} - echo "#build_dir" $(pwd)/build_${arch}_${mode} >> ${fn} - echo "#arch" $arch >> ${fn} - echo "#mode" $mode >> ${fn} -else - if [ ! -f "$fn" ]; then - # initialize the report if it does not exist - echo "#revision" ${svnR} > ${fn} - echo "#url" ${svnurl} >> ${fn} - echo "#machine" ${xios_machine_name} >> ${fn} - echo "#build_dir" $(pwd)/build_${arch}_${mode} >> ${fn} - echo "#arch" $arch >> ${fn} - echo "#mode" $mode >> ${fn} - echo "#memtrack full" >> ${fn} - fi - # else write in the same report -fi - -${PYTHON} step1.py - - -if [[ ${xios_machine_name} == "irene" ]]; then - cmd=$(ccc_msub full_job_${arch}_${mode}.sh) - jobid="${cmd//[!0-9]/}" - - i=0 - output=$(squeue -u $USER | grep ${jobid}) - while [ ! -z "$output" ] - do - echo "job" $jobid "pending/running for about" ${i} seconds - sleep 30 - ((i+=30)) - output=$(squeue -u $USER | grep ${jobid}) - if [[ $i -eq 300 ]]; then - ccc_mdel $jobid - break - fi - done -fi - - - -if [[ ${xios_machine_name} == "jeanzay" ]]; then - cmd=$(sbatch full_job_${arch}_${mode}.sh) - jobid="${cmd//[!0-9]/}" - i=0 - output=$(squeue -u uim55ri | grep ${jobid}) - while [ ! -z "$output" ] - do - echo "job" $jobid "pending/running for about" ${i} seconds - sleep 30 - ((i+=30)) - if [[ $i -eq 300 ]]; then - output=$(squeue -u uim55ri | grep ${jobid}) - scancel $jobid - break - fi - done -fi - - -${PYTHON} step2.py diff --git a/xios_2311_src/trunk/.svn/pristine/63/63f12df0b8972738fdfa61209f1e95477629cf54.svn-base b/xios_2311_src/trunk/.svn/pristine/63/63f12df0b8972738fdfa61209f1e95477629cf54.svn-base deleted file mode 100644 index c2a63962060018fdcb2a56244b94f38c12bfb70e..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/63/63f12df0b8972738fdfa61209f1e95477629cf54.svn-base +++ /dev/null @@ -1,10 +0,0 @@ -export HDF5_INC_DIR=$HOME/hdf5/hdf5/include -export HDF5_LIB_DIR=$HOME/hdf5/hdf5/lib - -export NETCDF_INC_DIR=$HOME/netcdf4/include -export NETCDF_LIB_DIR=$HOME/netcdf4/lib - -export BOOST_INC_DIR=$HOME/boost -export BOOST_LIB_DIR=$HOME/boost - - diff --git a/xios_2311_src/trunk/.svn/pristine/63/63f434bb0c2f855f1e4c7b01562e99f8874edfee.svn-base b/xios_2311_src/trunk/.svn/pristine/63/63f434bb0c2f855f1e4c7b01562e99f8874edfee.svn-base deleted file mode 100644 index 4c22e9475733e080f74a5d15f2d2f7831493c4fa..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/63/63f434bb0c2f855f1e4c7b01562e99f8874edfee.svn-base +++ /dev/null @@ -1,127 +0,0 @@ -#include "../fortran/xios_fortran_prefix.hpp" - -MODULE DATE_INTERFACE - USE, INTRINSIC :: ISO_C_BINDING - USE IDURATION, only : txios(duration) - - TYPE, BIND(C) :: txios(date) - INTEGER(kind = C_INT) :: year, month, day, hour, minute, second - END TYPE txios(date) - - PRIVATE :: txios(duration) - - INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99 - - INTEGER(kind = C_LONG_LONG) FUNCTION cxios_date_convert_to_seconds(date) BIND(C) - USE ISO_C_BINDING - IMPORT :: txios(date) - TYPE(txios(date)), VALUE :: date - END FUNCTION cxios_date_convert_to_seconds - - SUBROUTINE cxios_date_convert_to_string(date, str, str_size) BIND(C) - USE ISO_C_BINDING - IMPORT :: txios(date) - TYPE(txios(date)), VALUE :: date - CHARACTER(kind = C_CHAR), DIMENSION(*) :: str - INTEGER(kind = C_INT), VALUE :: str_size - END SUBROUTINE cxios_date_convert_to_string - - TYPE(txios(date)) FUNCTION cxios_date_convert_from_string(str, str_size) BIND(C) - USE ISO_C_BINDING - IMPORT :: txios(date) - CHARACTER(kind = C_CHAR), DIMENSION(*) :: str - INTEGER(kind = C_INT), VALUE :: str_size - END FUNCTION cxios_date_convert_from_string - - TYPE(txios(date)) FUNCTION cxios_date_add_duration(date, dur) BIND(C) - USE ISO_C_BINDING - IMPORT :: txios(date) - IMPORT :: txios(duration) - TYPE(txios(date)), VALUE :: date - TYPE(txios(duration)), VALUE :: dur - END FUNCTION cxios_date_add_duration - - TYPE(txios(date)) FUNCTION cxios_date_sub_duration(date, dur) BIND(C) - USE ISO_C_BINDING - IMPORT :: txios(date) - IMPORT :: txios(duration) - TYPE(txios(date)), VALUE :: date - TYPE(txios(duration)), VALUE :: dur - END FUNCTION cxios_date_sub_duration - - TYPE(txios(duration)) FUNCTION cxios_date_sub(date1, date2) BIND(C) - USE ISO_C_BINDING - IMPORT :: txios(date) - IMPORT :: txios(duration) - TYPE(txios(date)), VALUE :: date1, date2 - END FUNCTION cxios_date_sub - - LOGICAL(kind = C_BOOL) FUNCTION cxios_date_eq(date1, date2) BIND(C) - USE ISO_C_BINDING - IMPORT :: txios(date) - TYPE(txios(date)), VALUE :: date1, date2 - END FUNCTION cxios_date_eq - - LOGICAL(kind = C_BOOL) FUNCTION cxios_date_neq(date1, date2) BIND(C) - USE ISO_C_BINDING - IMPORT :: txios(date) - TYPE(txios(date)), VALUE :: date1, date2 - END FUNCTION cxios_date_neq - - LOGICAL(kind = C_BOOL) FUNCTION cxios_date_lt(date1, date2) BIND(C) - USE ISO_C_BINDING - IMPORT :: txios(date) - TYPE(txios(date)), VALUE :: date1, date2 - END FUNCTION cxios_date_lt - - LOGICAL(kind = C_BOOL) FUNCTION cxios_date_le(date1, date2) BIND(C) - USE ISO_C_BINDING - IMPORT :: txios(date) - TYPE(txios(date)), VALUE :: date1, date2 - END FUNCTION cxios_date_le - - LOGICAL(kind = C_BOOL) FUNCTION cxios_date_gt(date1, date2) BIND(C) - USE ISO_C_BINDING - IMPORT :: txios(date) - TYPE(txios(date)), VALUE :: date1, date2 - END FUNCTION cxios_date_gt - - LOGICAL(kind = C_BOOL) FUNCTION cxios_date_ge(date1, date2) BIND(C) - USE ISO_C_BINDING - IMPORT :: txios(date) - TYPE(txios(date)), VALUE :: date1, date2 - END FUNCTION cxios_date_ge - - INTEGER(kind = C_INT) FUNCTION cxios_date_get_second_of_year(date) BIND(C) - USE ISO_C_BINDING - IMPORT :: txios(date) - TYPE(txios(date)), VALUE :: date - END FUNCTION cxios_date_get_second_of_year - - REAL(kind = C_DOUBLE) FUNCTION cxios_date_get_day_of_year(date) BIND(C) - USE ISO_C_BINDING - IMPORT :: txios(date) - TYPE(txios(date)), VALUE :: date - END FUNCTION cxios_date_get_day_of_year - - REAL(kind = C_DOUBLE) FUNCTION cxios_date_get_fraction_of_year(date) BIND(C) - USE ISO_C_BINDING - IMPORT :: txios(date) - TYPE(txios(date)), VALUE :: date - END FUNCTION cxios_date_get_fraction_of_year - - INTEGER(kind = C_INT) FUNCTION cxios_date_get_second_of_day(date) BIND(C) - USE ISO_C_BINDING - IMPORT :: txios(date) - TYPE(txios(date)), VALUE :: date - END FUNCTION cxios_date_get_second_of_day - - REAL(kind = C_DOUBLE) FUNCTION cxios_date_get_fraction_of_day(date) BIND(C) - USE ISO_C_BINDING - IMPORT :: txios(date) - TYPE(txios(date)), VALUE :: date - END FUNCTION cxios_date_get_fraction_of_day - - END INTERFACE - -END MODULE DATE_INTERFACE diff --git a/xios_2311_src/trunk/.svn/pristine/64/6412adb56512f07a9695e3989bd2729f647cccd4.svn-base b/xios_2311_src/trunk/.svn/pristine/64/6412adb56512f07a9695e3989bd2729f647cccd4.svn-base deleted file mode 100644 index 801155a51d5524cd7b049f93a3ae2e4b11b7fc06..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/64/6412adb56512f07a9695e3989bd2729f647cccd4.svn-base +++ /dev/null @@ -1,55 +0,0 @@ -#include "xios_fortran_prefix.hpp" - -MODULE ITIMER - USE, INTRINSIC :: ISO_C_BINDING - USE TIMER_INTERFACE - - CONTAINS ! Fonctions disponibles pour les utilisateurs. - - SUBROUTINE xios(timer_resume)(timer_id, trace) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: timer_id - LOGICAL, OPTIONAL,INTENT(IN) :: trace - LOGICAL (KIND=C_BOOL) :: trace_ - - trace_=.TRUE. - IF (PRESENT(trace)) trace_ = trace - CALL cxios_timer_resume(timer_id, len(timer_id),trace_) - - END SUBROUTINE xios(timer_resume) - - SUBROUTINE xios(timer_suspend)(timer_id, trace) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: timer_id - LOGICAL, OPTIONAL,INTENT(IN) :: trace - LOGICAL (KIND=C_BOOL) :: trace_ - - trace_=.TRUE. - IF (PRESENT(trace)) trace_ = trace - CALL cxios_timer_suspend(timer_id, len(timer_id),trace_) - - END SUBROUTINE xios(timer_suspend) - - SUBROUTINE xios(timer_reset)(timer_id) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: timer_id - - CALL cxios_timer_reset(timer_id, len(timer_id)) - - END SUBROUTINE xios(timer_reset) - - FUNCTION xios(timer_get_time)(timer_id) RESULT(time) - IMPLICIT NONE - CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: timer_id - REAL :: time - REAL(KIND=C_DOUBLE) :: time_ - - IF (PRESENT(timer_id)) THEN - CALL cxios_timer_get_cumulated_time(timer_id, len(timer_id),time_) - ELSE - CALL cxios_timer_get_time(time_) - ENDIF - time=time_ - END FUNCTION xios(timer_get_time) - -END MODULE ITIMER diff --git a/xios_2311_src/trunk/.svn/pristine/64/64180ec1b69c550a2f56b62e5b91003de0ab1ec6.svn-base b/xios_2311_src/trunk/.svn/pristine/64/64180ec1b69c550a2f56b62e5b91003de0ab1ec6.svn-base deleted file mode 100644 index ae24181ea88a25fa4c25884932b1b81ddaa84dc3..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/64/64180ec1b69c550a2f56b62e5b91003de0ab1ec6.svn-base +++ /dev/null @@ -1,146 +0,0 @@ -/* ************************************************************************** * - * Copyright © IPSL/LSCE, xios, Avril 2010 - Octobre 2011 * - * ************************************************************************** */ - -#include - -#include - -#include "xios.hpp" - -#include "attribute_template.hpp" -#include "object_template.hpp" -#include "group_template.hpp" - -#include "icutil.hpp" -#include "icdate.hpp" -#include "timer.hpp" -#include "calendar_wrapper.hpp" - -extern "C" -{ -// /////////////////////////////// Définitions ////////////////////////////// // - - // ----------------------- Redéfinition de type ---------------------------- - - typedef xios::CCalendarWrapper *XCalendarWrapperPtr; - - // ------------------------ Création des handle ----------------------------- - - void cxios_calendar_wrapper_handle_create(XCalendarWrapperPtr* _ret, const char* _id, int _id_len) - TRY - { - std::string id; - if (!cstr2string(_id, _id_len, id)) return; - CTimer::get("XIOS").resume(); - *_ret = CCalendarWrapper::get(id); - CTimer::get("XIOS").suspend(); - } - CATCH_DUMP_STACK - - void cxios_get_current_calendar_wrapper(XCalendarWrapperPtr* _ret) - TRY - { - CTimer::get("XIOS").resume(); - *_ret = CCalendarWrapper::get(CCalendarWrapper::GetDefName()); - CTimer::get("XIOS").suspend(); - } - CATCH_DUMP_STACK - - // -------------------- Vérification des identifiants ----------------------- - - void cxios_calendar_wrapper_valid_id(bool* _ret, const char* _id, int _id_len) - TRY - { - std::string id; - if (!cstr2string(_id, _id_len, id)) return; - CTimer::get("XIOS").resume(); - *_ret = CCalendarWrapper::has(id); - CTimer::get("XIOS").suspend(); - } - CATCH_DUMP_STACK - - // ----------------------- Custom getters and setters ----------------------- - - void cxios_set_calendar_wrapper_date_start_date(XCalendarWrapperPtr calendarWrapper_hdl, cxios_date start_date_c) - TRY - { - CTimer::get("XIOS").resume(); - CDate start_date(*calendarWrapper_hdl->getCalendar(true), - start_date_c.year, - start_date_c.month, - start_date_c.day, - start_date_c.hour, - start_date_c.minute, - start_date_c.second); - calendarWrapper_hdl->setInitDate(start_date); - CTimer::get("XIOS").suspend(); - } - CATCH_DUMP_STACK - - void cxios_get_calendar_wrapper_date_start_date(XCalendarWrapperPtr calendarWrapper_hdl, cxios_date* start_date_c) - TRY - { - CTimer::get("XIOS").resume(); - const CDate& start_date = calendarWrapper_hdl->getInitDate(); - start_date_c->year = start_date.getYear(); - start_date_c->month = start_date.getMonth(); - start_date_c->day = start_date.getDay(); - start_date_c->hour = start_date.getHour(); - start_date_c->minute = start_date.getMinute(); - start_date_c->second = start_date.getSecond(); - CTimer::get("XIOS").suspend(); - } - CATCH_DUMP_STACK - - void cxios_set_calendar_wrapper_date_time_origin(XCalendarWrapperPtr calendarWrapper_hdl, cxios_date time_origin_c) - TRY - { - CTimer::get("XIOS").resume(); - CDate time_origin(*calendarWrapper_hdl->getCalendar(true), - time_origin_c.year, - time_origin_c.month, - time_origin_c.day, - time_origin_c.hour, - time_origin_c.minute, - time_origin_c.second); - calendarWrapper_hdl->setTimeOrigin(time_origin); - CTimer::get("XIOS").suspend(); - } - CATCH_DUMP_STACK - - void cxios_get_calendar_wrapper_date_time_origin(XCalendarWrapperPtr calendarWrapper_hdl, cxios_date* time_origin_c) - TRY - { - CTimer::get("XIOS").resume(); - const CDate& time_origin = calendarWrapper_hdl->getTimeOrigin(); - time_origin_c->year = time_origin.getYear(); - time_origin_c->month = time_origin.getMonth(); - time_origin_c->day = time_origin.getDay(); - time_origin_c->hour = time_origin.getHour(); - time_origin_c->minute = time_origin.getMinute(); - time_origin_c->second = time_origin.getSecond(); - CTimer::get("XIOS").suspend(); - } - CATCH_DUMP_STACK - - // ----------------------- Calendar creation and update ---------------------- - - void cxios_create_calendar(XCalendarWrapperPtr calendarWrapper_hdl) - TRY - { - CTimer::get("XIOS").resume(); - calendarWrapper_hdl->createCalendar(); - CTimer::get("XIOS").suspend(); - } - CATCH_DUMP_STACK - - void cxios_update_calendar_timestep(XCalendarWrapperPtr calendarWrapper_hdl) - TRY - { - CTimer::get("XIOS").resume(); - calendarWrapper_hdl->updateTimestep(); - CTimer::get("XIOS").suspend(); - } - CATCH_DUMP_STACK -} // extern "C" diff --git a/xios_2311_src/trunk/.svn/pristine/64/64570aa4bd37c0d968c19be874dcfc6318df99ea.svn-base b/xios_2311_src/trunk/.svn/pristine/64/64570aa4bd37c0d968c19be874dcfc6318df99ea.svn-base deleted file mode 100644 index aadf941aa3eceef71d7c6262ec5418a23be47a17..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/64/64570aa4bd37c0d968c19be874dcfc6318df99ea.svn-base +++ /dev/null @@ -1,466 +0,0 @@ -/********************************************************************* - * Copyright 2010, UCAR/Unidata - * See netcdf/COPYRIGHT file for copying and redistribution conditions. - * $Header$ - *********************************************************************/ - -#include "config.h" - -#include -#include -#include - -#include "nc_uri.h" - -#define NC_URIDEBUG - -#define LBRACKET '[' -#define RBRACKET ']' - -#ifndef FIX -#define FIX(s) ((s)==NULL?"":(s)) -#endif - -#ifndef NILLEN -#define NILLEN(s) ((s)==NULL?0:strlen(s)) -#endif - - -static char* legalprotocols[] = { -"file:", -"http:", -"https:", -"ftp:", -NULL /* NULL terminate*/ -}; - -static void nc_paramfree(char** params); -static int nc_find(char** params, const char* key); - -/* Do a simple uri parse: return 0 if fail, 1 otherwise*/ -int -nc_uriparse(const char* uri0, NC_URI** nc_urip) -{ - NC_URI* nc_uri = NULL; - char* uri; - char** pp; - char* p; - char* p1; - int c; - - /* accumulate parse points*/ - char* protocol = NULL; - char* params = NULL; - char* host = NULL; - char* port = NULL; - char* constraint = NULL; - char* user = NULL; - char* pwd = NULL; - char* file = NULL; - - nc_uri = (NC_URI*)calloc(1,sizeof(NC_URI)); - if(nc_uri == NULL) return 0; - - /* Temporary hack to remove escape characters inserted by Windows or MinGW */ - if(strchr(uri0,'\\') != NULL) { - char* u = strdup(uri0); - if(u == NULL) return 0; - p = u; - p1 = u; - while((c=*p1++)) {if(c != '\\') *p++ = c;} - uri0 = (const char*)u; - } - - /* make local copy of uri */ - uri = strdup(uri0); - - /* remove all whitespace*/ - p = uri; - p1 = uri; - while((c=*p1++)) {if(c != ' ' && c != '\t') *p++ = c;} - - p = uri; - - /* break up the uri string into pieces*/ - - /* 1. leading bracketed parameters */ - if(*p == LBRACKET) { - params = p+1; - /* find end of the clientparams*/ - for(;*p;p++) {if(p[0] == RBRACKET && p[1] != LBRACKET) break;} - if(*p == 0) goto fail; /* malformed client params*/ - *p = '\0'; /* leave off the trailing rbracket for now */ - p++; /* move past the params*/ - } - - /* verify that the uri starts with an acceptable protocol*/ - for(pp=legalprotocols;*pp;pp++) { - if(strncmp(p,*pp,strlen(*pp))==0) break; - } - if(*pp == NULL) goto fail; /* illegal protocol*/ - /* save the protocol */ - protocol = *pp; - - /* 4. skip protocol */ - p += strlen(protocol); - - /* 5. skip // */ - if(*p != '/' && *(p+1) != '/') - goto fail; - p += 2; - - /* 6. Mark the end of the host section */ - file = strchr(p,'/'); - if(file) { - *file++ = '\0'; /* warning: we just overwrote the leading / */ - } else - goto fail; /* url only has host part, no path */ - - /* 7. extract any user:pwd */ - p1 = strchr(p,'@'); - if(p1) {/* Assume we have user:pwd@ */ - *p1 = '\0'; - user = p; - pwd = strchr(p,':'); - if(!pwd) goto fail; /* malformed */ - *pwd++ = '\0'; - p = pwd+strlen(pwd)+1; - } - - /* 8. extract host and port */ - host = p; - port = strchr(p,':'); - if(port) { - *port++ = '\0'; - } - - /* 9. Look for '?' */ - constraint = strchr(file,'?'); - if(constraint) { - *constraint++ = '\0'; - } - - /* assemble the component pieces*/ - if(uri0 && strlen(uri0) > 0) - nc_uri->uri = strdup(uri0); - if(protocol && strlen(protocol) > 0) { - nc_uri->protocol = strdup(protocol); - /* remove trailing ':' */ - nc_uri->protocol[strlen(protocol)-1] = '\0'; - } - if(user && strlen(user) > 0) - nc_uri->user = strdup(user); - if(pwd && strlen(pwd) > 0) - nc_uri->password = strdup(pwd); - if(host && strlen(host) > 0) - nc_uri->host = strdup(host); - if(port && strlen(port) > 0) - nc_uri->port = strdup(port); - if(file && strlen(file) > 0) { - /* Add back the leading / */ - nc_uri->file = malloc(strlen(file)+2); - strcpy(nc_uri->file,"/"); - strcat(nc_uri->file,file); - } - if(constraint && strlen(constraint) > 0) - nc_uri->constraint = strdup(constraint); - nc_urisetconstraints(nc_uri,constraint); - if(params != NULL && strlen(params) > 0) { - nc_uri->params = (char*)malloc(1+2+strlen(params)); - strcpy(nc_uri->params,"["); - strcat(nc_uri->params,params); - strcat(nc_uri->params,"]"); - } - -#ifdef NC_XDEBUG - { - fprintf(stderr,"nc_uri:"); - fprintf(stderr," params=|%s|",FIX(nc_uri->params)); - fprintf(stderr," protocol=|%s|",FIX(nc_uri->protocol)); - fprintf(stderr," host=|%s|",FIX(nc_uri->host)); - fprintf(stderr," port=|%s|",FIX(nc_uri->port)); - fprintf(stderr," file=|%s|",FIX(nc_uri->file)); - fprintf(stderr," constraint=|%s|",FIX(nc_uri->constraint)); - fprintf(stderr,"\n"); - } -#endif - free(uri); - if(nc_urip != NULL) *nc_urip = nc_uri; - return 1; - -fail: - if(nc_uri) nc_urifree(nc_uri); - if(uri != NULL) free(uri); - return 0; -} - -void -nc_urifree(NC_URI* nc_uri) -{ - if(nc_uri == NULL) return; - if(nc_uri->uri != NULL) {free(nc_uri->uri);} - if(nc_uri->protocol != NULL) {free(nc_uri->protocol);} - if(nc_uri->user != NULL) {free(nc_uri->user);} - if(nc_uri->password != NULL) {free(nc_uri->password);} - if(nc_uri->host != NULL) {free(nc_uri->host);} - if(nc_uri->port != NULL) {free(nc_uri->port);} - if(nc_uri->file != NULL) {free(nc_uri->file);} - if(nc_uri->constraint != NULL) {free(nc_uri->constraint);} - if(nc_uri->projection != NULL) {free(nc_uri->projection);} - if(nc_uri->selection != NULL) {free(nc_uri->selection);} - if(nc_uri->params != NULL) {free(nc_uri->params);} - if(nc_uri->paramlist != NULL) nc_paramfree(nc_uri->paramlist); - free(nc_uri); -} - -/* Replace the constraints */ -void -nc_urisetconstraints(NC_URI* duri,const char* constraints) -{ - char* proj = NULL; - char* select = NULL; - const char* p; - - if(duri->constraint == NULL) free(duri->constraint); - if(duri->projection != NULL) free(duri->projection); - if(duri->selection != NULL) free(duri->selection); - duri->constraint = NULL; - duri->projection = NULL; - duri->selection = NULL; - - if(constraints == NULL || strlen(constraints)==0) return; - - duri->constraint = strdup(constraints); - if(*duri->constraint == '?') - strcpy(duri->constraint,duri->constraint+1); - - p = duri->constraint; - proj = (char*) p; - select = strchr(proj,'&'); - if(select != NULL) { - size_t plen = (select - proj); - if(plen == 0) { - proj = NULL; - } else { - proj = (char*)malloc(plen+1); - memcpy((void*)proj,p,plen); - proj[plen] = '\0'; - } - select = nulldup(select); - } else { - proj = nulldup(proj); - select = NULL; - } - duri->projection = proj; - duri->selection = select; -} - - -/* Construct a complete NC_ URI without the client params - and optionally with the constraints; - caller frees returned string -*/ - -char* -nc_uribuild(NC_URI* duri, const char* prefix, const char* suffix, int pieces) -{ - size_t len = 0; - char* newuri; - int withparams = ((pieces&NC_URIPARAMS) - && duri->params != NULL); - int withuserpwd = ((pieces&NC_URIUSERPWD) - && duri->user != NULL && duri->password != NULL); - int withconstraints = ((pieces&NC_URICONSTRAINTS) - && duri->constraint != NULL); - - if(prefix != NULL) len += NILLEN(prefix); - if(withparams) { - len += NILLEN(duri->params); - } - len += (NILLEN(duri->protocol)+NILLEN("://")); - if(withuserpwd) { - len += (NILLEN(duri->user)+NILLEN(duri->password)+NILLEN(":@")); - } - len += (NILLEN(duri->host)); - if(duri->port != NULL) { - len += (NILLEN(":")+NILLEN(duri->port)); - } - len += (NILLEN(duri->file)); - if(suffix != NULL) len += NILLEN(suffix); - if(withconstraints) { - len += (NILLEN("?")+NILLEN(duri->constraint)); - } - len += 1; /* null terminator */ - - newuri = (char*)malloc(len); - if(!newuri) return NULL; - - newuri[0] = '\0'; - if(prefix != NULL) strcat(newuri,prefix); - if(withparams) { - strcat(newuri,duri->params); - } - strcat(newuri,duri->protocol); - strcat(newuri,"://"); - if(withuserpwd) { - strcat(newuri,duri->user); - strcat(newuri,":"); - strcat(newuri,duri->password); - strcat(newuri,"@"); - } - if(duri->host != NULL) { /* may be null if using file: protocol */ - strcat(newuri,duri->host); - } - if(duri->port != NULL) { - strcat(newuri,":"); - strcat(newuri,duri->port); - } - strcat(newuri,duri->file); - if(suffix != NULL) strcat(newuri,suffix); - if(withconstraints) { - strcat(newuri,"?"); - strcat(newuri,duri->constraint); - } - return newuri; -} - -/**************************************************/ -/* Parameter support */ - -/* -Client parameters are assumed to be -one or more instances of bracketed pairs: -e.g "[...][...]...". -The bracket content in turn is assumed to be a -comma separated list of = pairs. -e.g. x=y,z=,a=b. -If the same parameter is specifed more than once, -then the first occurrence is used; this is so that -is possible to forcibly override user specified -parameters by prefixing. -IMPORTANT: client parameter string is assumed to -have blanks compress out. -Returns 1 if parse suceeded, 0 otherwise; -*/ - -int -nc_uridecodeparams(NC_URI* nc_uri) -{ - char* cp; - char* cq; - int c; - int i; - int nparams; - char* params0; - char* params; - char* params1; - char** plist; - - if(nc_uri == NULL) return 0; - if(nc_uri->params == NULL) return 1; - - params0 = nc_uri->params; - - /* Pass 1 to replace beginning '[' and ending ']' */ - if(params0[0] == '[') - params = strdup(params0+1); - else - params = strdup(params0); - - if(params[strlen(params)-1] == ']') - params[strlen(params)-1] = '\0'; - - /* Pass 2 to replace "][" pairs with ','*/ - params1 = strdup(params); - cp=params; cq = params1; - while((c=*cp++)) { - if(c == RBRACKET && *cp == LBRACKET) {cp++; c = ',';} - *cq++ = c; - } - *cq = '\0'; - free(params); - params = params1; - - /* Pass 3 to break string into pieces and count # of pairs */ - nparams=0; - for(cp=params;(c=*cp);cp++) { - if(c == ',') {*cp = '\0'; nparams++;} - } - nparams++; /* for last one */ - - /* plist is an env style list */ - plist = (char**)calloc(1,sizeof(char*)*(2*nparams+1)); /* +1 for null termination */ - - /* Pass 4 to break up each pass into a (name,value) pair*/ - /* and insert into the param list */ - /* parameters of the form name name= are converted to name=""*/ - cp = params; - for(i=0;iparamlist != NULL) - nc_paramfree(nc_uri->paramlist); - nc_uri->paramlist = plist; - return 1; -} - -int -nc_urilookup(NC_URI* uri, const char* key, const char** resultp) -{ - int i; - char* value = NULL; - if(uri == NULL || key == NULL || uri->params == NULL) return 0; - if(uri->paramlist == NULL) { - i = nc_uridecodeparams(uri); - if(!i) return 0; - } - i = nc_find(uri->paramlist,key); - if(i < 0) return 0; - value = uri->paramlist[(2*i)+1]; - if(resultp) *resultp = value; - return 1; -} - -int -nc_urisetparams(NC_URI* uri, const char* newparams) -{ - if(uri == NULL) return 0; - if(uri->paramlist != NULL) nc_paramfree(uri->paramlist); - uri->paramlist = NULL; - if(uri->params != NULL) free(uri->params); - uri->params = nulldup(newparams); - return 1; -} - -/* Internal version of lookup; returns the paired index of the key */ -static int -nc_find(char** params, const char* key) -{ - int i; - char** p; - for(i=0,p=params;*p;p+=2,i++) { - if(strcmp(key,*p)==0) return i; - } - return -1; -} - -static void -nc_paramfree(char** params) -{ - char** p; - if(params == NULL) return; - for(p=params;*p;p+=2) { - free(*p); - if(p[1] != NULL) free(p[1]); - } - free(params); -} diff --git a/xios_2311_src/trunk/.svn/pristine/64/64fe927edab54a59d6fbf4fdc94a580b98dcee18.svn-base b/xios_2311_src/trunk/.svn/pristine/64/64fe927edab54a59d6fbf4fdc94a580b98dcee18.svn-base deleted file mode 100644 index 5a972e74917f79f5752de24830698661426145ac..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/64/64fe927edab54a59d6fbf4fdc94a580b98dcee18.svn-base +++ /dev/null @@ -1,68 +0,0 @@ -#include "compute_connectivity_domain.hpp" -#include "domain_algorithm_compute_connectivity.hpp" -#include "type.hpp" - -namespace xios { - - /// ////////////////////// Définitions ////////////////////// /// - - CComputeConnectivityDomain::CComputeConnectivityDomain(void) - : CObjectTemplate(), CComputeConnectivityDomainAttributes(), CTransformation() - { /* Ne rien faire de plus */ } - - CComputeConnectivityDomain::CComputeConnectivityDomain(const StdString & id) - : CObjectTemplate(id), CComputeConnectivityDomainAttributes(), CTransformation() - { /* Ne rien faire de plus */ } - - CComputeConnectivityDomain::~CComputeConnectivityDomain(void) - {} - - CTransformation* CComputeConnectivityDomain::create(const StdString& id, xml::CXMLNode* node) - { - CComputeConnectivityDomain* compute_connectivityDomain = CComputeConnectivityDomainGroup::get("compute_connectivity_domain_definition")->createChild(id); - if (node) compute_connectivityDomain->parse(*node); - return static_cast*>(compute_connectivityDomain); - } - - bool CComputeConnectivityDomain::_dummyRegistered = CComputeConnectivityDomain::registerTrans(); - bool CComputeConnectivityDomain::registerTrans() - { - return registerTransformation(TRANS_COMPUTE_CONNECTIVITY_DOMAIN, {create, getTransformation}); - } - - //---------------------------------------------------------------- - - StdString CComputeConnectivityDomain::GetName(void) { return StdString("compute_connectivity_domain"); } - StdString CComputeConnectivityDomain::GetDefName(void) { return StdString("compute_connectivity_domain"); } - ENodeType CComputeConnectivityDomain::GetType(void) { return eComputeConnectivityDomain; } - - void CComputeConnectivityDomain::checkValid(CDomain* domainDst) - { - if (CDomain::type_attr::unstructured != domainDst->type) - { - ERROR("CComputeConnectivityDomain::checkValid(CDomain* domainDst)", - << "Domain connectivity computation is only supported for unstructured" << std::endl - << "Check type of domain destination, id = " << domainDst->getId()); - } - - if (type.isEmpty()) type.setValue(CComputeConnectivityDomain::type_attr::edge); - if (n_neighbor_max.isEmpty()) n_neighbor_max.setValue(0); - if (n_neighbor.isEmpty()) n_neighbor.resize(domainDst->i_index.numElements()); - if (local_neighbor.isEmpty()) local_neighbor.resize(1,1); - } - - shared_ptr CComputeConnectivityDomain::createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) - { - return CDomainAlgorithmComputeConnectivity::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, - elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, - elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition) ; - } -} diff --git a/xios_2311_src/trunk/.svn/pristine/65/6529abfb4e2ef52cc759de7cde8720401ab25a8e.svn-base b/xios_2311_src/trunk/.svn/pristine/65/6529abfb4e2ef52cc759de7cde8720401ab25a8e.svn-base deleted file mode 100644 index 5a3ca41dd3eac7f8bbcd22b29b07f77dca52a552..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/65/6529abfb4e2ef52cc759de7cde8720401ab25a8e.svn-base +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright 2009, UCAR/Unidata and OPeNDAP, Inc. - See the COPYRIGHT file for more information. */ - -#ifndef OCDATA_H -#define OCDATA_H - -typedef struct OCdimcounter { - int rank; - size_t index[OC_MAX_DIMS]; - size_t size[OC_MAX_DIMS]; -} OCdimcounter; - -extern const char StartOfSequence; -extern const char EndOfSequence; - -/*Forward */ -struct OCcontent; - -/* Skip arbitrary dimensioned instance; Handles dimensioning.*/ -extern int ocskip(OCnode* node, XXDR* xdrs); - -extern int occountrecords(OCnode* node, XXDR* xdrs, size_t* nrecordsp); - -extern int ocxdrread(struct OCcontent*, XXDR*, char* memory, size_t, ocindex_t index, ocindex_t count); - -extern int ocskipinstance(OCnode* node, XXDR* xdrs, int state, int* tagp); - -#endif /*OCDATA_H*/ diff --git a/xios_2311_src/trunk/.svn/pristine/65/654a8579875af59be28ed0705ed31dc9f070d48a.svn-base b/xios_2311_src/trunk/.svn/pristine/65/654a8579875af59be28ed0705ed31dc9f070d48a.svn-base deleted file mode 100644 index ecca20248269c4ed36a550548fcd8d257a869f2f..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/65/654a8579875af59be28ed0705ed31dc9f070d48a.svn-base +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -export COPY_TO_SERVER=false -if [[ $1 == "--copy" ]] -then - export COPY_TO_SERVER=$2 - echo "copy to server =" ${COPY_TO_SERVER} -fi -source ./load_env -mkdir -p RUN_TEST_SUITE -cp -r TEST_SUITE/* RUN_TEST_SUITE -(cd RUN_TEST_SUITE && ./run_test_${xios_machine_name}) diff --git a/xios_2311_src/trunk/.svn/pristine/65/657b63cb53600a098f3a16ac600d52d7eedc5e46.svn-base b/xios_2311_src/trunk/.svn/pristine/65/657b63cb53600a098f3a16ac600d52d7eedc5e46.svn-base deleted file mode 100644 index 90ce4304c89da874f4f25193551ade455ee56f6d..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/65/657b63cb53600a098f3a16ac600d52d7eedc5e46.svn-base +++ /dev/null @@ -1,73 +0,0 @@ -#ifndef __XIOS_CObjectFactory__ -#define __XIOS_CObjectFactory__ - -#include - -/// XIOS headers /// -#include "xios_spl.hpp" -#include "exception.hpp" -#include "object_template.hpp" - -namespace xios -{ - /// ////////////////////// Déclarations ////////////////////// /// - class CObjectFactory - { - public : - - /// Mutateurs /// - static void SetCurrentContextId(const StdString & context); - - /// Accesseurs /// - static StdString & GetCurrentContextId(void); - static void clearCurrentContextId(void) {CurrContext.clear(); CurrContext.shrink_to_fit(); } - - template - static std::shared_ptr GetObject(const StdString & id); - - template - static std::shared_ptr GetObject(const StdString& context,const StdString & id); - - template - static std::shared_ptr GetObject(const U * const object); - - template - static int GetObjectNum(void); - template - static int GetObjectIdNum(void); - - template - static const std::vector > & - GetObjectVector(const StdString & context = CObjectFactory::GetCurrentContextId()); - - /// Tests /// - template - static bool HasObject(const StdString & id); - - template - static bool HasObject(const StdString& context,const StdString & id); - - /// Instanciateur /// - template - static std::shared_ptr CreateObject(const StdString & id = StdString("")); - - template - static std::shared_ptr CreateAlias(const StdString& id, const StdString& alias) ; - - template static const StdString GetUIdBase(void); - template static StdString GenUId(void); - template static bool IsGenUId(const StdString& id); - template static void deleteContext(const StdString & context) ; - template static void deleteAllContexts(void) ; - template static void dumpObjects(void) ; - private : - - /// Propriétés statiques /// - static StdString CurrContext; - - }; // class CObjectFactory -} // namespace xios - -//#include "object_factory_impl.hpp" - -#endif // __XIOS_CObjectFactory__ diff --git a/xios_2311_src/trunk/.svn/pristine/65/65a5f725025c3ce1c6a99d822d22a1c8bf14c1a5.svn-base b/xios_2311_src/trunk/.svn/pristine/65/65a5f725025c3ce1c6a99d822d22a1c8bf14c1a5.svn-base deleted file mode 100644 index 35dfc065dc50e44f3977e9f5bee712529f0243c7..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/65/65a5f725025c3ce1c6a99d822d22a1c8bf14c1a5.svn-base +++ /dev/null @@ -1,20 +0,0 @@ -#module unload netcdf-c netcdf-fortran hdf5 flavor perl hdf5 boost blitz mpi gnu -#module load flavor/hdf5/parallel -#module load netcdf-fortran/4.4.4 -#module load hdf5/1.8.20 -#module load gnu -#module load boost -#module load blitz -#module load feature/bridge/heterogenous_mpmd - -module purge -module load flavor/buildcompiler/intel/20 -module load mpi/openmpi/4.0.2 - -module load flavor/hdf5/parallel -module load netcdf-fortran/4.4.4 -module load hdf5/1.8.20 -module load gnu/7.3.0 - -module load totalview -module load perl/5.30.2 diff --git a/xios_2311_src/trunk/.svn/pristine/65/65b5c889c606409b087758f1d6b1fde15575d141.svn-base b/xios_2311_src/trunk/.svn/pristine/65/65b5c889c606409b087758f1d6b1fde15575d141.svn-base deleted file mode 100644 index 72d7a0fad0f8a9aa87d89aa5573bba4b475b8654..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/65/65b5c889c606409b087758f1d6b1fde15575d141.svn-base +++ /dev/null @@ -1,22 +0,0 @@ -MODULE DOMAIN_INTERFACE - USE, INTRINSIC :: ISO_C_BINDING - - INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99 - - SUBROUTINE cxios_domain_handle_create(ret, idt, idt_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_domain_handle_create - - SUBROUTINE cxios_domain_valid_id(ret, idt, idt_size) BIND(C) - USE ISO_C_BINDING - LOGICAL (kind = C_BOOL) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_domain_valid_id - - END INTERFACE - -END MODULE DOMAIN_INTERFACE diff --git a/xios_2311_src/trunk/.svn/pristine/65/65d5ef56e5b842a127eee32622f905eb51e593f5.svn-base b/xios_2311_src/trunk/.svn/pristine/65/65d5ef56e5b842a127eee32622f905eb51e593f5.svn-base deleted file mode 100644 index 06fccaf558f930733df8e2ba1b47ed9d6c2de22f..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/65/65d5ef56e5b842a127eee32622f905eb51e593f5.svn-base +++ /dev/null @@ -1,127 +0,0 @@ -#ifndef __XIOS_GroupParser__ -#define __XIOS_GroupParser__ - -/// boost headers /// -#include - -namespace xios -{ - /// ////////////////////// Définitions ////////////////////// /// - template - void CGroupTemplate::parse(xml::CXMLNode & node, bool withAttr) - { - - StdString name = node.getElementName(); - xml::THashAttributes attributes = node.getAttributes(); - if (withAttr) - { - CGroupTemplate::SuperClass::parse(node); - if (attributes.end() != attributes.find("src")) - { - StdIFStream ifs ( attributes["src"].c_str() , StdIFStream::in ); - if ( (ifs.rdstate() & std::ifstream::failbit ) != 0 ) - ERROR(" void CGroupTemplate::parse(xml::CXMLNode & node, bool withAttr)", - < file" ); - if (!ifs.good()) - ERROR("CGroupTemplate::parse(xml::CXMLNode & node, bool withAttr)", - << "[ filename = " << attributes["src"] << " ] Bad xml stream !"); - xml::CXMLParser::ParseInclude(ifs, attributes["src"].c_str(), *this); - } - } - - // PARSING POUR GESTION DES ENFANTS - V* group_ptr = (this->hasId()) - ? V::get(this->getId()) - : boost::polymorphic_downcast(this); - - if (!(node.goToChildElement())) - { - if (this->hasId()) - { - DEBUG(<< "L'objet de type \'" << V::GetName() - << "\' nommé \'" << this->getId() - << "\' ne contient pas d\'enfant !"); - } - } - else - { - do { // Parcours pour traitement. - - StdString name = node.getElementName(); - attributes.clear(); - attributes = node.getAttributes(); - - if (name.compare(V::GetName()) == 0) - { - if (attributes.end() == attributes.find("id")) - CGroupFactory::CreateGroup(group_ptr->getShared())->parse(node); - else - CGroupFactory::CreateGroup(group_ptr->getShared(), attributes["id"])->parse(node); - continue; - } - - if (name.compare(U::GetName()) == 0) - { - if (attributes.end() == attributes.find("id")) - CGroupFactory::CreateChild(group_ptr->getShared())->parse(node); - else - CGroupFactory::CreateChild(group_ptr->getShared(), attributes["id"])->parse(node); - continue; - } - - DEBUG(<< "Dans le contexte \'" << CContext::getCurrent()->getId() - << "\', un objet de type \'" << V::GetName() - << "\' ne peut contenir qu'un objet de type \'" << V::GetName() - << "\' ou de type \'" << U::GetName() - << "\' (reçu : " << name << ") !"); - - } while (node.goToNextElement()); - node.goToParentElement(); // Retour au parent - } - } - - /// ////////////////////// Définitions ////////////////////// /// - template - void CGroupTemplate::parseChild(xml::CXMLNode & node) - { - - - // PARSING POUR GESTION DES ENFANTS - V* group_ptr = (this->hasId()) - ? V::get(this->getId()) - : boost::polymorphic_downcast(this); - - StdString name = node.getElementName(); - attributes.clear(); - attributes = node.getAttributes(); - - if (name.compare(V::GetName()) == 0) - { - if (attributes.end() == attributes.find("id")) - CGroupFactory::CreateGroup(group_ptr->getShared())->parse(node); - return ; - else - CGroupFactory::CreateGroup(group_ptr->getShared(), attributes["id"])->parse(node); - continue; - } - - if (name.compare(U::GetName()) == 0) - { - if (attributes.end() == attributes.find("id")) - CGroupFactory::CreateChild(group_ptr->getShared())->parse(node); - return ; - else - CGroupFactory::CreateChild(group_ptr->getShared(), attributes["id"])->parse(node); - continue; - } - - DEBUG(<< "Dans le contexte \'" << CContext::getCurrent()->getId() - << "\', un objet de type \'" << V::GetName() - << "\' ne peut contenir qu'un objet de type \'" << V::GetName() - << "\' ou de type \'" << U::GetName() - << "\' (reçu : " << name << ") !"); - - } -} // namespace xios - -#endif // __XIOS_GroupParser__ diff --git a/xios_2311_src/trunk/.svn/pristine/66/668085cc109158c9175a04eaa8695410c90ba0f6.svn-base b/xios_2311_src/trunk/.svn/pristine/66/668085cc109158c9175a04eaa8695410c90ba0f6.svn-base deleted file mode 100644 index e0145d4c5ec6b6f005d01088b51d38ad889515ea..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/66/668085cc109158c9175a04eaa8695410c90ba0f6.svn-base +++ /dev/null @@ -1,224 +0,0 @@ -! * ************************************************************************** * -! * Interface auto generated - do not modify * -! * ************************************************************************** * -#include "xios_fortran_prefix.hpp" - -MODULE izoom_domain_attr - USE, INTRINSIC :: ISO_C_BINDING - USE izoom_domain - USE zoom_domain_interface_attr - -CONTAINS - - SUBROUTINE xios(set_zoom_domain_attr) & - ( zoom_domain_id, ibegin, jbegin, ni, nj ) - - IMPLICIT NONE - TYPE(txios(zoom_domain)) :: zoom_domain_hdl - CHARACTER(LEN=*), INTENT(IN) ::zoom_domain_id - INTEGER , OPTIONAL, INTENT(IN) :: ibegin - INTEGER , OPTIONAL, INTENT(IN) :: jbegin - INTEGER , OPTIONAL, INTENT(IN) :: ni - INTEGER , OPTIONAL, INTENT(IN) :: nj - - CALL xios(get_zoom_domain_handle) & - (zoom_domain_id,zoom_domain_hdl) - CALL xios(set_zoom_domain_attr_hdl_) & - ( zoom_domain_hdl, ibegin, jbegin, ni, nj ) - - END SUBROUTINE xios(set_zoom_domain_attr) - - SUBROUTINE xios(set_zoom_domain_attr_hdl) & - ( zoom_domain_hdl, ibegin, jbegin, ni, nj ) - - IMPLICIT NONE - TYPE(txios(zoom_domain)) , INTENT(IN) :: zoom_domain_hdl - INTEGER , OPTIONAL, INTENT(IN) :: ibegin - INTEGER , OPTIONAL, INTENT(IN) :: jbegin - INTEGER , OPTIONAL, INTENT(IN) :: ni - INTEGER , OPTIONAL, INTENT(IN) :: nj - - CALL xios(set_zoom_domain_attr_hdl_) & - ( zoom_domain_hdl, ibegin, jbegin, ni, nj ) - - END SUBROUTINE xios(set_zoom_domain_attr_hdl) - - SUBROUTINE xios(set_zoom_domain_attr_hdl_) & - ( zoom_domain_hdl, ibegin_, jbegin_, ni_, nj_ ) - - IMPLICIT NONE - TYPE(txios(zoom_domain)) , INTENT(IN) :: zoom_domain_hdl - INTEGER , OPTIONAL, INTENT(IN) :: ibegin_ - INTEGER , OPTIONAL, INTENT(IN) :: jbegin_ - INTEGER , OPTIONAL, INTENT(IN) :: ni_ - INTEGER , OPTIONAL, INTENT(IN) :: nj_ - - IF (PRESENT(ibegin_)) THEN - CALL cxios_set_zoom_domain_ibegin & - (zoom_domain_hdl%daddr, ibegin_) - ENDIF - - IF (PRESENT(jbegin_)) THEN - CALL cxios_set_zoom_domain_jbegin & - (zoom_domain_hdl%daddr, jbegin_) - ENDIF - - IF (PRESENT(ni_)) THEN - CALL cxios_set_zoom_domain_ni & - (zoom_domain_hdl%daddr, ni_) - ENDIF - - IF (PRESENT(nj_)) THEN - CALL cxios_set_zoom_domain_nj & - (zoom_domain_hdl%daddr, nj_) - ENDIF - - END SUBROUTINE xios(set_zoom_domain_attr_hdl_) - - SUBROUTINE xios(get_zoom_domain_attr) & - ( zoom_domain_id, ibegin, jbegin, ni, nj ) - - IMPLICIT NONE - TYPE(txios(zoom_domain)) :: zoom_domain_hdl - CHARACTER(LEN=*), INTENT(IN) ::zoom_domain_id - INTEGER , OPTIONAL, INTENT(OUT) :: ibegin - INTEGER , OPTIONAL, INTENT(OUT) :: jbegin - INTEGER , OPTIONAL, INTENT(OUT) :: ni - INTEGER , OPTIONAL, INTENT(OUT) :: nj - - CALL xios(get_zoom_domain_handle) & - (zoom_domain_id,zoom_domain_hdl) - CALL xios(get_zoom_domain_attr_hdl_) & - ( zoom_domain_hdl, ibegin, jbegin, ni, nj ) - - END SUBROUTINE xios(get_zoom_domain_attr) - - SUBROUTINE xios(get_zoom_domain_attr_hdl) & - ( zoom_domain_hdl, ibegin, jbegin, ni, nj ) - - IMPLICIT NONE - TYPE(txios(zoom_domain)) , INTENT(IN) :: zoom_domain_hdl - INTEGER , OPTIONAL, INTENT(OUT) :: ibegin - INTEGER , OPTIONAL, INTENT(OUT) :: jbegin - INTEGER , OPTIONAL, INTENT(OUT) :: ni - INTEGER , OPTIONAL, INTENT(OUT) :: nj - - CALL xios(get_zoom_domain_attr_hdl_) & - ( zoom_domain_hdl, ibegin, jbegin, ni, nj ) - - END SUBROUTINE xios(get_zoom_domain_attr_hdl) - - SUBROUTINE xios(get_zoom_domain_attr_hdl_) & - ( zoom_domain_hdl, ibegin_, jbegin_, ni_, nj_ ) - - IMPLICIT NONE - TYPE(txios(zoom_domain)) , INTENT(IN) :: zoom_domain_hdl - INTEGER , OPTIONAL, INTENT(OUT) :: ibegin_ - INTEGER , OPTIONAL, INTENT(OUT) :: jbegin_ - INTEGER , OPTIONAL, INTENT(OUT) :: ni_ - INTEGER , OPTIONAL, INTENT(OUT) :: nj_ - - IF (PRESENT(ibegin_)) THEN - CALL cxios_get_zoom_domain_ibegin & - (zoom_domain_hdl%daddr, ibegin_) - ENDIF - - IF (PRESENT(jbegin_)) THEN - CALL cxios_get_zoom_domain_jbegin & - (zoom_domain_hdl%daddr, jbegin_) - ENDIF - - IF (PRESENT(ni_)) THEN - CALL cxios_get_zoom_domain_ni & - (zoom_domain_hdl%daddr, ni_) - ENDIF - - IF (PRESENT(nj_)) THEN - CALL cxios_get_zoom_domain_nj & - (zoom_domain_hdl%daddr, nj_) - ENDIF - - END SUBROUTINE xios(get_zoom_domain_attr_hdl_) - - SUBROUTINE xios(is_defined_zoom_domain_attr) & - ( zoom_domain_id, ibegin, jbegin, ni, nj ) - - IMPLICIT NONE - TYPE(txios(zoom_domain)) :: zoom_domain_hdl - CHARACTER(LEN=*), INTENT(IN) ::zoom_domain_id - LOGICAL, OPTIONAL, INTENT(OUT) :: ibegin - LOGICAL(KIND=C_BOOL) :: ibegin_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: jbegin - LOGICAL(KIND=C_BOOL) :: jbegin_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: ni - LOGICAL(KIND=C_BOOL) :: ni_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: nj - LOGICAL(KIND=C_BOOL) :: nj_tmp - - CALL xios(get_zoom_domain_handle) & - (zoom_domain_id,zoom_domain_hdl) - CALL xios(is_defined_zoom_domain_attr_hdl_) & - ( zoom_domain_hdl, ibegin, jbegin, ni, nj ) - - END SUBROUTINE xios(is_defined_zoom_domain_attr) - - SUBROUTINE xios(is_defined_zoom_domain_attr_hdl) & - ( zoom_domain_hdl, ibegin, jbegin, ni, nj ) - - IMPLICIT NONE - TYPE(txios(zoom_domain)) , INTENT(IN) :: zoom_domain_hdl - LOGICAL, OPTIONAL, INTENT(OUT) :: ibegin - LOGICAL(KIND=C_BOOL) :: ibegin_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: jbegin - LOGICAL(KIND=C_BOOL) :: jbegin_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: ni - LOGICAL(KIND=C_BOOL) :: ni_tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: nj - LOGICAL(KIND=C_BOOL) :: nj_tmp - - CALL xios(is_defined_zoom_domain_attr_hdl_) & - ( zoom_domain_hdl, ibegin, jbegin, ni, nj ) - - END SUBROUTINE xios(is_defined_zoom_domain_attr_hdl) - - SUBROUTINE xios(is_defined_zoom_domain_attr_hdl_) & - ( zoom_domain_hdl, ibegin_, jbegin_, ni_, nj_ ) - - IMPLICIT NONE - TYPE(txios(zoom_domain)) , INTENT(IN) :: zoom_domain_hdl - LOGICAL, OPTIONAL, INTENT(OUT) :: ibegin_ - LOGICAL(KIND=C_BOOL) :: ibegin__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: jbegin_ - LOGICAL(KIND=C_BOOL) :: jbegin__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: ni_ - LOGICAL(KIND=C_BOOL) :: ni__tmp - LOGICAL, OPTIONAL, INTENT(OUT) :: nj_ - LOGICAL(KIND=C_BOOL) :: nj__tmp - - IF (PRESENT(ibegin_)) THEN - ibegin__tmp = cxios_is_defined_zoom_domain_ibegin & - (zoom_domain_hdl%daddr) - ibegin_ = ibegin__tmp - ENDIF - - IF (PRESENT(jbegin_)) THEN - jbegin__tmp = cxios_is_defined_zoom_domain_jbegin & - (zoom_domain_hdl%daddr) - jbegin_ = jbegin__tmp - ENDIF - - IF (PRESENT(ni_)) THEN - ni__tmp = cxios_is_defined_zoom_domain_ni & - (zoom_domain_hdl%daddr) - ni_ = ni__tmp - ENDIF - - IF (PRESENT(nj_)) THEN - nj__tmp = cxios_is_defined_zoom_domain_nj & - (zoom_domain_hdl%daddr) - nj_ = nj__tmp - ENDIF - - END SUBROUTINE xios(is_defined_zoom_domain_attr_hdl_) - -END MODULE izoom_domain_attr diff --git a/xios_2311_src/trunk/.svn/pristine/66/66b4a22c7bd4f072afe370ffb59edb7be08fcff1.svn-base b/xios_2311_src/trunk/.svn/pristine/66/66b4a22c7bd4f072afe370ffb59edb7be08fcff1.svn-base deleted file mode 100644 index 339b1556584f9c4cba5446568c75b1a2f4aea42a..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/66/66b4a22c7bd4f072afe370ffb59edb7be08fcff1.svn-base +++ /dev/null @@ -1,30 +0,0 @@ -#include "xios_fortran_prefix.hpp" - -MODULE IGENERATE_RECTILINEAR_DOMAIN - USE, INTRINSIC :: ISO_C_BINDING - USE GENERATE_RECTILINEAR_DOMAIN_INTERFACE - - TYPE txios(generate_rectilinear_domain) - INTEGER(kind = C_INTPTR_T) :: daddr - END TYPE txios(generate_rectilinear_domain) - - CONTAINS ! Fonctions disponibles pour les utilisateurs. - - SUBROUTINE xios(get_generate_rectilinear_domain_handle)(idt,ret) - IMPLICIT NONE - CHARACTER(len = *), INTENT(IN) :: idt - TYPE(txios(generate_rectilinear_domain)) , INTENT(OUT):: ret - CALL cxios_generate_rectilinear_domain_handle_create(ret%daddr, idt, len(idt)) - END SUBROUTINE xios(get_generate_rectilinear_domain_handle) - - LOGICAL FUNCTION xios(is_valid_generate_rectilinear_domain)(idt) - IMPLICIT NONE - CHARACTER(len = *) , INTENT(IN) :: idt - LOGICAL (kind = 1) :: val - - CALL cxios_generate_rectilinear_domain_valid_id(val, idt, len(idt)) - xios(is_valid_generate_rectilinear_domain) = val - - END FUNCTION xios(is_valid_generate_rectilinear_domain) - -END MODULE IGENERATE_RECTILINEAR_DOMAIN diff --git a/xios_2311_src/trunk/.svn/pristine/67/670cf5fd37d845452daedbbc71d41dae9897efaf.svn-base b/xios_2311_src/trunk/.svn/pristine/67/670cf5fd37d845452daedbbc71d41dae9897efaf.svn-base deleted file mode 100644 index c1acc73c0d2cd47c843fed5a6e4f1e3b5a0d3115..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/67/670cf5fd37d845452daedbbc71d41dae9897efaf.svn-base +++ /dev/null @@ -1,22 +0,0 @@ -MODULE COMPUTE_CONNECTIVITY_DOMAIN_INTERFACE - USE, INTRINSIC :: ISO_C_BINDING - - INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99 - - SUBROUTINE cxios_compute_connectivity_domain_handle_create(ret, idt, idt_size) BIND(C) - USE ISO_C_BINDING - INTEGER (kind = C_INTPTR_T) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_compute_connectivity_domain_handle_create - - SUBROUTINE cxios_compute_connectivity_domain_valid_id(ret, idt, idt_size) BIND(C) - USE ISO_C_BINDING - LOGICAL (kind = C_BOOL) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_compute_connectivity_domain_valid_id - - END INTERFACE - -END MODULE COMPUTE_CONNECTIVITY_DOMAIN_INTERFACE diff --git a/xios_2311_src/trunk/.svn/pristine/67/6715ffda049e631a5d0f0b61c89cf6677406c935.svn-base b/xios_2311_src/trunk/.svn/pristine/67/6715ffda049e631a5d0f0b61c89cf6677406c935.svn-base deleted file mode 100644 index 26af50b2ffbfcd565dfe3d6212d8eb06a6ad7419..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/67/6715ffda049e631a5d0f0b61c89cf6677406c935.svn-base +++ /dev/null @@ -1,60 +0,0 @@ -#include "pass_through_filter.hpp" -#include "workflow_graph.hpp" -#include - -namespace xios -{ - CPassThroughFilter::CPassThroughFilter(CGarbageCollector& gc) - : CFilter(gc, 1, this) - { /* Nothing to do */ } - - CDataPacketPtr CPassThroughFilter::apply(std::vector data) - { - buildWorkflowGraph(data); - return data[0]; - } - - void CPassThroughFilter::buildWorkflowGraph(std::vector data) - { - if(this->graphEnabled) - { - if(data[0]->graphPackage && data[0]->graphPackage->currentField->getId() == this->graphPackage->inFields[0]->getId()) - { - std::cout<<"PASS THROUGH FILTER OMITTED "<graphPackage->filterId = CWorkflowGraph::getNodeSize(); - - if(!data[0]->graphPackage) - { - data[0]->graphPackage = new CGraphDataPackage; - data[0]->graphPackage->fromFilter = -1; - data[0]->graphPackage->currentField = this->graphPackage->inFields[0]; - } - - for(int i=0; igraphPackage->filterId; i++) - { - if(CXios::isClient - && (*CWorkflowGraph::vectorOfNodes_)[i].label_field_id == this->label_field_id - && (*CWorkflowGraph::vectorOfNodes_)[i].timestamp == data[0]->timestamp - && (*CWorkflowGraph::vectorOfNodes_)[i].filter_name == "Pass through filter" ) - { - data[0]->graphPackage->fromFilter = i; - return; - } - } - - CWorkflowGraph::addNode("Pass through filter", 2, false, 1, data[0]); - if(CXios::isClient) (*CWorkflowGraph::vectorOfNodes_)[this->graphPackage->filterId].label_field_id = this->label_field_id; - CWorkflowGraph::addEdge(data[0]->graphPackage->fromFilter, this->graphPackage->filterId, data[0]); - - data[0]->graphPackage->currentField = this->graphPackage->inFields[0]; - std::rotate(this->graphPackage->inFields.begin(), this->graphPackage->inFields.begin() + 1, this->graphPackage->inFields.end()); - - data[0]->graphPackage->fromFilter = this->graphPackage->filterId; - - } - } - - -} // namespace xios diff --git a/xios_2311_src/trunk/.svn/pristine/67/679ace105bb07a54ce22e08301d9522d2979624e.svn-base b/xios_2311_src/trunk/.svn/pristine/67/679ace105bb07a54ce22e08301d9522d2979624e.svn-base deleted file mode 100644 index d00be2929520c20eb0c332ad77be140d3cdd0b5a..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/67/679ace105bb07a54ce22e08301d9522d2979624e.svn-base +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef __MPI_ROUTING_HPP__ -#define __MPI_ROUTING_HPP__ - -#include "mpi.hpp" -#include -#include "mpi_cascade.hpp" - -namespace sphereRemap { - -class CMPIRouting -{ - - MPI_Comm communicator; - int mpiRank; - int mpiSize; - - int nbSource; - int *sourceRank; - std::vector nbSourceElement; - int totalSourceElement; - std::vector sourceElementIndex; - - int nbTarget; - int *targetRank; - std::vector nbTargetElement; - std::vector targetElementIndex; - int totalTargetElement; - - -public: - CMPIRouting(MPI_Comm comm); - ~CMPIRouting(); - template void init(const std::vector& route, CMPICascade *cascade = NULL); - int getTotalSourceElement(void); - - template void transferToTarget(T *targetElement, T *sourceElement); - template void transferToTarget(T *targetElement, T *sourceElement, t_pack pack, t_unpack unpack); - - template void transferFromSource(T *targetElement, T *sourceElement); - template void transferFromSource(T *targetElement, T *sourceElement, t_pack pack, t_unpack unpack); - -}; - -template -void alltoalls_known(const std::vector >& send, std::vector >& recv, - const std::vector& ranks, MPI_Comm communicator); - -template -void alltoalls_unknown(const std::vector >& send, std::vector >& recv, - const std::vector& ranks, MPI_Comm communicator); -} -#endif diff --git a/xios_2311_src/trunk/.svn/pristine/68/681ef83ea7fd9b9f1726bddd0508ae3818a66309.svn-base b/xios_2311_src/trunk/.svn/pristine/68/681ef83ea7fd9b9f1726bddd0508ae3818a66309.svn-base deleted file mode 100644 index 1d5f5b3355e12bdd8d12aaf1681a77e10acc5014..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/68/681ef83ea7fd9b9f1726bddd0508ae3818a66309.svn-base +++ /dev/null @@ -1,105 +0,0 @@ -#include "mem_checker.hpp" -#include "mpi.hpp" -#include -#include -#include -#include -#include - -namespace xios -{ - CMemChecker CMemChecker::dummy_("") ; - std::map CMemChecker::allMemChecker_; - bool CMemChecker::enabled_=true; - bool CMemChecker::first_=true; - - CMemChecker::CMemChecker(const std::string& name) : name_(name) - { - if (first_) check() ; - reset(); - } - - void CMemChecker::check(void) - { - std::ifstream statStream("/proc/self/stat",std::ios_base::in); - enabled_ &= statStream.good() ; - first_=false ; - } - double CMemChecker::getMem(void) - { - if (first_) check() ; - if (!enabled_) return 0; - std::ifstream statStream("/proc/self/stat",std::ios_base::in); - std::string dummy ; - for(int i=1;i<=22;i++) statStream>>dummy ; - unsigned long vsize; - statStream>>vsize ; - return vsize ; - } - - void CMemChecker::suspend(void) - { - if (first_) check() ; - if (!enabled_) return ; - if (!suspended_) cumulatedMem_ += getMem() - lastMem_; - suspended_ = true; - } - - void CMemChecker::resume(void) - { - if (first_) check() ; - if (!enabled_) return ; - if (suspended_) lastMem_ = getMem(); - suspended_ = false; - } - - void CMemChecker::reset(void) - { - if (first_) check() ; - if (!enabled_) return ; - cumulatedMem_ = 0.; - suspended_ = true; - } - - double CMemChecker::getCumulatedMem(void) - { - if (first_) check() ; - if (!enabled_) return 0; - return cumulatedMem_; - } - - CMemChecker& CMemChecker::get(const std::string name) - { - if (first_) check() ; - if (!enabled_) return dummy_ ; - else - { - std::map::iterator it = allMemChecker_.find(name); - if (it == allMemChecker_.end()) - it = allMemChecker_.insert(std::make_pair(name, CMemChecker(name))).first; - return it->second; - } - } - - std::string CMemChecker::getAllCumulatedMem(void) - { - if (first_) check() ; - if (!enabled_) return std::string(" MemChecker : memory consumption report not available") ; - std::ostringstream strOut ; - const double Kb=1024 ; - const double Mb=Kb*1024 ; - const double Gb=Mb*1024 ; - const double Tb=Gb*1024 ; - for(std::map::iterator it=allMemChecker_.begin();it!=allMemChecker_.end();++it) - { - strOut<<"MemChecker : "<first<<" --> consumed memory : " ; - double mem=it->second.getCumulatedMem() ; - if (mem>=Tb) strOut<< mem / Tb<<" Tb"<=Gb) strOut<< mem / Gb<<" Gb"<=Mb) strOut<< mem / Mb<<" Mb"<=Kb) strOut<< mem / Kb<<" Kb"< create(bool isSource, CGrid* gridDst, CGrid* gridSrc, - CTransformation* transformation, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition); - static bool dummyRegistered_; -}; - -} -#endif // __XIOS_SCALAR_ALGORITHM_REDUCE_AXIS_HPP__ diff --git a/xios_2311_src/trunk/.svn/pristine/68/68ea43c9d0ee18fcc1c91e6b453d77171b8984d1.svn-base b/xios_2311_src/trunk/.svn/pristine/68/68ea43c9d0ee18fcc1c91e6b453d77171b8984d1.svn-base deleted file mode 100644 index 076524ee7bba8db16c3098a2175582ff1387611f..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/68/68ea43c9d0ee18fcc1c91e6b453d77171b8984d1.svn-base +++ /dev/null @@ -1,85 +0,0 @@ -#include "interpolate_domain.hpp" -#include "domain_algorithm_interpolate.hpp" -#include "type.hpp" - -namespace xios { - - /// ////////////////////// Définitions ////////////////////// /// - - CInterpolateDomain::CInterpolateDomain(void) - : CObjectTemplate(), CInterpolateDomainAttributes(), CTransformation() - { /* Ne rien faire de plus */ } - - CInterpolateDomain::CInterpolateDomain(const StdString & id) - : CObjectTemplate(id), CInterpolateDomainAttributes(), CTransformation() - { /* Ne rien faire de plus */ } - - CInterpolateDomain::~CInterpolateDomain(void) - {} - - CTransformation* CInterpolateDomain::create(const StdString& id, xml::CXMLNode* node) - { - CInterpolateDomain* interpDomain = CInterpolateDomainGroup::get("interpolate_domain_definition")->createChild(id); - if (node) interpDomain->parse(*node); - return static_cast*>(interpDomain); - } - - bool CInterpolateDomain::_dummyRegistered = CInterpolateDomain::registerTrans(); - bool CInterpolateDomain::registerTrans() - { - return registerTransformation(TRANS_INTERPOLATE_DOMAIN, {create, getTransformation}); - } - - //---------------------------------------------------------------- - - StdString CInterpolateDomain::GetName(void) { return StdString("interpolate_domain"); } - StdString CInterpolateDomain::GetDefName(void) { return StdString("interpolate_domain"); } - ENodeType CInterpolateDomain::GetType(void) { return eInterpolateDomain; } - - void CInterpolateDomain::checkValid(CDomain* domainSrc) - { - int order = 2; - if (!this->order.isEmpty()) order = this->order.getValue(); - else this->order.setValue(order); - if (order < 1) - { - ERROR("void CInterpolateDomain::checkValid(CDomain* domainSrc)", - << "Interpolation order is less than 1, it should be greater than 0." - << "Please define a correct one") ; - } - - bool detect_missing_value=false ; - if (!this->detect_missing_value.isEmpty()) detect_missing_value = this->detect_missing_value.getValue(); - else this->detect_missing_value.setValue(detect_missing_value); - - bool renormalize=false ; - if (!this->renormalize.isEmpty()) renormalize = this->renormalize.getValue(); - else this->renormalize.setValue(renormalize); - - bool quantity=false ; - if (!this->quantity.isEmpty()) quantity = this->quantity.getValue(); - else this->quantity.setValue(quantity); - - if (this->mode.isEmpty()) this->mode.setValue(mode_attr::compute); - if (this->write_weight.isEmpty()) this->write_weight.setValue(false); - - if (this->read_write_convention.isEmpty()) this->read_write_convention.setValue(read_write_convention_attr::fortran); - - - } - - shared_ptr CInterpolateDomain::createAlgorithm(bool isSource, - CGrid* gridDst, CGrid* gridSrc, - int elementPositionInGrid, - std::map& elementPositionInGridSrc2ScalarPosition, - std::map& elementPositionInGridSrc2AxisPosition, - std::map& elementPositionInGridSrc2DomainPosition, - std::map& elementPositionInGridDst2ScalarPosition, - std::map& elementPositionInGridDst2AxisPosition, - std::map& elementPositionInGridDst2DomainPosition) - { - return CDomainAlgorithmInterpolate::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, - elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, - elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition); - } -} diff --git a/xios_2311_src/trunk/.svn/pristine/69/690f11ad3337caaca61f3541a29c7fc7178a6ef9.svn-base b/xios_2311_src/trunk/.svn/pristine/69/690f11ad3337caaca61f3541a29c7fc7178a6ef9.svn-base deleted file mode 100644 index 4e539d421a53ca5231c16643a865bc87a8cd848c..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/69/690f11ad3337caaca61f3541a29c7fc7178a6ef9.svn-base +++ /dev/null @@ -1,36 +0,0 @@ -#include "element_view.hpp" -#include "element.hpp" -#include "distributed_view.hpp" - -namespace xios -{ - - CDistributedView::CDistributedView(shared_ptr parent, CElementView::type, const std::map>& indexView) - : globalIndex_(parent->globalIndex_), globalSize_(parent->globalSize_), localSize_(parent->localSize_) - { - for(auto& index : indexView) - { - index_[index.first].reference(index.second.copy()) ; - size_[index.first] = index.second.numElements() ; - } - } - - CDistributedView::CDistributedView(shared_ptr parent, CElementView::type, const std::map>& maskView) - : globalIndex_(parent->globalIndex_), globalSize_(parent->globalSize_), localSize_(parent->localSize_) - { - for(auto& it : maskView) - { - int rank = it.first ; - auto& mask = it.second ; - int size = mask.numElements() ; - auto& index = index_[rank] ; - index.resize(size) ; - int pos=0 ; - for(int i=0 ; i < size ; i++) - if (mask(i)) { index(pos) = i ; pos++ ; } - if (pos==0) index.resize(pos) ; - else index.resizeAndPreserve(pos) ; - size_[rank] = pos ; - } - } -} \ No newline at end of file diff --git a/xios_2311_src/trunk/.svn/pristine/69/6932187787495bc076e49811700c9863d9ef3613.svn-base b/xios_2311_src/trunk/.svn/pristine/69/6932187787495bc076e49811700c9863d9ef3613.svn-base deleted file mode 100644 index 67049f4957d5548515e1761e65250b76a9ba6b57..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/69/6932187787495bc076e49811700c9863d9ef3613.svn-base +++ /dev/null @@ -1,40 +0,0 @@ -MODULE CONTEXT_INTERFACE - USE, INTRINSIC :: ISO_C_BINDING - - INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99 - - SUBROUTINE cxios_context_handle_create(ret, idt, idt_size) BIND(C) - import C_CHAR, C_INTPTR_T, C_INT - INTEGER (kind = C_INTPTR_T) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_context_handle_create - - SUBROUTINE cxios_context_get_current(context) BIND(C) - import C_INTPTR_T - INTEGER (kind = C_INTPTR_T) :: context - END SUBROUTINE cxios_context_get_current - - SUBROUTINE cxios_context_get_id(context, idt, idt_size) BIND(C) - import C_CHAR, C_INTPTR_T, C_INT - INTEGER (kind = C_INTPTR_T) :: context - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_context_get_id - - SUBROUTINE cxios_context_set_current(context, withswap) BIND(C) - import C_BOOL, C_INT, C_INTPTR_T - INTEGER (kind = C_INTPTR_T), VALUE :: context - LOGICAL (kind = C_BOOL) , VALUE :: withswap - END SUBROUTINE cxios_context_set_current - - SUBROUTINE cxios_context_valid_id(ret, idt, idt_size) BIND(C) - USE ISO_C_BINDING - LOGICAL (kind = C_BOOL) :: ret - CHARACTER(kind = C_CHAR) , DIMENSION(*) :: idt - INTEGER (kind = C_INT) , VALUE :: idt_size - END SUBROUTINE cxios_context_valid_id - - END INTERFACE - -END MODULE CONTEXT_INTERFACE diff --git a/xios_2311_src/trunk/.svn/pristine/69/695978ea36f6252c59f9541cf589c03e915d3f63.svn-base b/xios_2311_src/trunk/.svn/pristine/69/695978ea36f6252c59f9541cf589c03e915d3f63.svn-base deleted file mode 100644 index 4247748384a306850c6b462bc82fac4445b42d1d..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/69/695978ea36f6252c59f9541cf589c03e915d3f63.svn-base +++ /dev/null @@ -1,5362 +0,0 @@ -/* Do not edit this file. It is produced from the corresponding .m4 source */ -/* - * Copyright 1996, University Corporation for Atmospheric Research - * See netcdf/COPYRIGHT file for copying and redistribution conditions. - */ -/* $Id: putget.m4,v 2.79 2010/05/29 22:25:01 russ Exp $ */ - -#include "config.h" -#include -#include -#include - -#include "netcdf.h" -#include "nc.h" -#include "ncx.h" -#include "fbits.h" -#include "onstack.h" -#ifdef LOCKNUMREC -# include /* for SGI/Cray SHMEM routines */ -# ifdef LN_TEST -# include -# endif -#endif -#include "nc3dispatch.h" - - -#undef MIN /* system may define MIN somewhere and complain */ -#define MIN(mm,nn) (((mm) < (nn)) ? (mm) : (nn)) - -static int -readNCv(const NC* ncp, const NC_var* varp, const size_t* start, - const size_t nelems, void* value, const nc_type memtype); -static int -writeNCv(NC* ncp, const NC_var* varp, const size_t* start, - const size_t nelems, const void* value, const nc_type memtype); - - -/* #define ODEBUG 1 */ - -#if ODEBUG -#include -/* - * Print the values of an array of size_t - */ -void -arrayp(const char *label, size_t count, const size_t *array) -{ - (void) fprintf(stderr, "%s", label); - (void) fputc('\t',stderr); - for(; count > 0; count--, array++) - (void) fprintf(stderr," %lu", (unsigned long)*array); - (void) fputc('\n',stderr); -} -#endif /* ODEBUG */ - - -/* Begin fill */ -/* - * This is tunable parameter. - * It essentially controls the tradeoff between the number of times - * memcpy() gets called to copy the external data to fill - * a large buffer vs the number of times its called to - * prepare the external data. - */ -#if _SX -/* NEC SX specific optimization */ -#define NFILL 2048 -#else -#define NFILL 16 -#endif - - - -/* - * Next 6 type specific functions - * Fill a some memory with the default special value. - * Formerly -NC_arrayfill() - */ -static int -NC_fill_schar( - void **xpp, - size_t nelems) /* how many */ -{ - schar fillp[NFILL * sizeof(double)/X_SIZEOF_CHAR]; - - assert(nelems <= sizeof(fillp)/sizeof(fillp[0])); - - { - schar *vp = fillp; /* lower bound of area to be filled */ - const schar *const end = vp + nelems; - while(vp < end) - { - *vp++ = NC_FILL_BYTE; - } - } - return ncx_putn_schar_schar(xpp, nelems, fillp); -} - -static int -NC_fill_char( - void **xpp, - size_t nelems) /* how many */ -{ - char fillp[NFILL * sizeof(double)/X_SIZEOF_CHAR]; - - assert(nelems <= sizeof(fillp)/sizeof(fillp[0])); - - { - char *vp = fillp; /* lower bound of area to be filled */ - const char *const end = vp + nelems; - while(vp < end) - { - *vp++ = NC_FILL_CHAR; - } - } - return ncx_putn_char_char(xpp, nelems, fillp); -} - -static int -NC_fill_short( - void **xpp, - size_t nelems) /* how many */ -{ - short fillp[NFILL * sizeof(double)/X_SIZEOF_SHORT]; - - assert(nelems <= sizeof(fillp)/sizeof(fillp[0])); - - { - short *vp = fillp; /* lower bound of area to be filled */ - const short *const end = vp + nelems; - while(vp < end) - { - *vp++ = NC_FILL_SHORT; - } - } - return ncx_putn_short_short(xpp, nelems, fillp); -} - - -#if (SIZEOF_INT >= X_SIZEOF_INT) -static int -NC_fill_int( - void **xpp, - size_t nelems) /* how many */ -{ - int fillp[NFILL * sizeof(double)/X_SIZEOF_INT]; - - assert(nelems <= sizeof(fillp)/sizeof(fillp[0])); - - { - int *vp = fillp; /* lower bound of area to be filled */ - const int *const end = vp + nelems; - while(vp < end) - { - *vp++ = NC_FILL_INT; - } - } - return ncx_putn_int_int(xpp, nelems, fillp); -} - -#elif SIZEOF_LONG == X_SIZEOF_INT -static int -NC_fill_int( - void **xpp, - size_t nelems) /* how many */ -{ - long fillp[NFILL * sizeof(double)/X_SIZEOF_INT]; - - assert(nelems <= sizeof(fillp)/sizeof(fillp[0])); - - { - long *vp = fillp; /* lower bound of area to be filled */ - const long *const end = vp + nelems; - while(vp < end) - { - *vp++ = NC_FILL_INT; - } - } - return ncx_putn_int_long(xpp, nelems, fillp); -} - -#else -#error "NC_fill_int implementation" -#endif - -static int -NC_fill_float( - void **xpp, - size_t nelems) /* how many */ -{ - float fillp[NFILL * sizeof(double)/X_SIZEOF_FLOAT]; - - assert(nelems <= sizeof(fillp)/sizeof(fillp[0])); - - { - float *vp = fillp; /* lower bound of area to be filled */ - const float *const end = vp + nelems; - while(vp < end) - { - *vp++ = NC_FILL_FLOAT; - } - } - return ncx_putn_float_float(xpp, nelems, fillp); -} - -static int -NC_fill_double( - void **xpp, - size_t nelems) /* how many */ -{ - double fillp[NFILL * sizeof(double)/X_SIZEOF_DOUBLE]; - - assert(nelems <= sizeof(fillp)/sizeof(fillp[0])); - - { - double *vp = fillp; /* lower bound of area to be filled */ - const double *const end = vp + nelems; - while(vp < end) - { - *vp++ = NC_FILL_DOUBLE; - } - } - return ncx_putn_double_double(xpp, nelems, fillp); -} - - - - - -/* - * Fill the external space for variable 'varp' values at 'recno' with - * the appropriate value. If 'varp' is not a record variable, fill the - * whole thing. For the special case when 'varp' is the only record - * variable and it is of type byte, char, or short, varsize should be - * ncp->recsize, otherwise it should be varp->len. - * Formerly -xdr_NC_fill() - */ -int -fill_NC_var(NC *ncp, const NC_var *varp, size_t varsize, size_t recno) -{ - char xfillp[NFILL * X_SIZEOF_DOUBLE]; - const size_t step = varp->xsz; - const size_t nelems = sizeof(xfillp)/step; - const size_t xsz = varp->xsz * nelems; - NC_attr **attrpp = NULL; - off_t offset; - size_t remaining = varsize; - - void *xp; - int status = NC_NOERR; - - /* - * Set up fill value - */ - attrpp = NC_findattr(&varp->attrs, _FillValue); - if( attrpp != NULL ) - { - /* User defined fill value */ - if( (*attrpp)->type != varp->type || (*attrpp)->nelems != 1 ) - { - return NC_EBADTYPE; - } - else - { - /* Use the user defined value */ - char *cp = xfillp; - const char *const end = &xfillp[sizeof(xfillp)]; - - assert(step <= (*attrpp)->xsz); - - for( /*NADA*/; cp < end; cp += step) - { - (void) memcpy(cp, (*attrpp)->xvalue, step); - } - } - } - else - { - /* use the default */ - - assert(xsz % X_ALIGN == 0); - assert(xsz <= sizeof(xfillp)); - - xp = xfillp; - - switch(varp->type){ - case NC_BYTE : - status = NC_fill_schar(&xp, nelems); - break; - case NC_CHAR : - status = NC_fill_char(&xp, nelems); - break; - case NC_SHORT : - status = NC_fill_short(&xp, nelems); - break; - case NC_INT : - status = NC_fill_int(&xp, nelems); - break; - case NC_FLOAT : - status = NC_fill_float(&xp, nelems); - break; - case NC_DOUBLE : - status = NC_fill_double(&xp, nelems); - break; - default : - assert("fill_NC_var invalid type" == 0); - status = NC_EBADTYPE; - break; - } - if(status != NC_NOERR) - return status; - - assert(xp == xfillp + xsz); - } - - /* - * copyout: - * xfillp now contains 'nelems' elements of the fill value - * in external representation. - */ - - /* - * Copy it out. - */ - - offset = varp->begin; - if(IS_RECVAR(varp)) - { - offset += (off_t)ncp->recsize * recno; - } - - assert(remaining > 0); - for(;;) - { - const size_t chunksz = MIN(remaining, ncp->chunk); - size_t ii; - - status = ncio_get(ncp->nciop, offset, chunksz, - RGN_WRITE, &xp); - if(status != NC_NOERR) - { - return status; - } - - /* - * fill the chunksz buffer in units of xsz - */ - for(ii = 0; ii < chunksz/xsz; ii++) - { - (void) memcpy(xp, xfillp, xsz); - xp = (char *)xp + xsz; - } - /* - * Deal with any remainder - */ - { - const size_t rem = chunksz % xsz; - if(rem != 0) - { - (void) memcpy(xp, xfillp, rem); - /* xp = (char *)xp + xsz; */ - } - - } - - status = ncio_rel(ncp->nciop, offset, RGN_MODIFIED); - - if(status != NC_NOERR) - { - break; - } - - remaining -= chunksz; - if(remaining == 0) - break; /* normal loop exit */ - offset += chunksz; - - } - - return status; -} -/* End fill */ - - -/* - * Add a record containing the fill values. - */ -static int -NCfillrecord(NC *ncp, const NC_var *const *varpp, size_t recno) -{ - size_t ii = 0; - for(; ii < ncp->vars.nelems; ii++, varpp++) - { - if( !IS_RECVAR(*varpp) ) - { - continue; /* skip non-record variables */ - } - { - const int status = fill_NC_var(ncp, *varpp, (*varpp)->len, recno); - if(status != NC_NOERR) - return status; - } - } - return NC_NOERR; -} - - -/* - * Add a record containing the fill values in the special case when - * there is exactly one record variable, where we don't require each - * record to be four-byte aligned (no record padding). - */ -static int -NCfillspecialrecord(NC *ncp, const NC_var *varp, size_t recno) -{ - int status; - assert(IS_RECVAR(varp)); - status = fill_NC_var(ncp, varp, ncp->recsize, recno); - if(status != NC_NOERR) - return status; - return NC_NOERR; -} - - -/* - * It is advantageous to - * #define TOUCH_LAST - * when using memory mapped io. - */ -#if TOUCH_LAST -/* - * Grow the file to a size which can contain recno - */ -static int -NCtouchlast(NC *ncp, const NC_var *const *varpp, size_t recno) -{ - int status = NC_NOERR; - const NC_var *varp = NULL; - - { - size_t ii = 0; - for(; ii < ncp->vars.nelems; ii++, varpp++) - { - if( !IS_RECVAR(*varpp) ) - { - continue; /* skip non-record variables */ - } - varp = *varpp; - } - } - assert(varp != NULL); - assert( IS_RECVAR(varp) ); - { - const off_t offset = varp->begin - + (off_t)(recno-1) * (off_t)ncp->recsize - + (off_t)(varp->len - varp->xsz); - void *xp; - - - status = ncio_get(ncp->nciop, offset, varp->xsz, - RGN_WRITE, &xp); - if(status != NC_NOERR) - return status; - (void)memset(xp, 0, varp->xsz); - status = ncio_rel(ncp->nciop, offset, RGN_MODIFIED); - } - return status; -} -#endif /* TOUCH_LAST */ - - -/* - * Ensure that the netcdf file has 'numrecs' records, - * add records and fill as neccessary. - */ -static int -NCvnrecs(NC *ncp, size_t numrecs) -{ - int status = NC_NOERR; -#ifdef LOCKNUMREC - ushmem_t myticket = 0, nowserving = 0; - ushmem_t numpe = (ushmem_t) _num_pes(); - - /* get ticket and wait */ - myticket = shmem_short_finc((shmem_t *) ncp->lock + LOCKNUMREC_LOCK, - ncp->lock[LOCKNUMREC_BASEPE]); -#ifdef LN_TEST - fprintf(stderr,"%d of %d : ticket = %hu\n", - _my_pe(), _num_pes(), myticket); -#endif - do { - shmem_short_get((shmem_t *) &nowserving, - (shmem_t *) ncp->lock + LOCKNUMREC_SERVING, 1, - ncp->lock[LOCKNUMREC_BASEPE]); -#ifdef LN_TEST - fprintf(stderr,"%d of %d : serving = %hu\n", - _my_pe(), _num_pes(), nowserving); -#endif - /* work-around for non-unique tickets */ - if (nowserving > myticket && nowserving < myticket + numpe ) { - /* get a new ticket ... you've been bypassed */ - /* and handle the unlikely wrap-around effect */ - myticket = shmem_short_finc( - (shmem_t *) ncp->lock + LOCKNUMREC_LOCK, - ncp->lock[LOCKNUMREC_BASEPE]); -#ifdef LN_TEST - fprintf(stderr,"%d of %d : new ticket = %hu\n", - _my_pe(), _num_pes(), myticket); -#endif - } - } while(nowserving != myticket); - /* now our turn to check & update value */ -#endif - - if(numrecs > NC_get_numrecs(ncp)) - { - - -#if TOUCH_LAST - status = NCtouchlast(ncp, - (const NC_var *const*)ncp->vars.value, - numrecs); - if(status != NC_NOERR) - goto common_return; -#endif /* TOUCH_LAST */ - - set_NC_ndirty(ncp); - - if(!NC_dofill(ncp)) - { - /* Simply set the new numrecs value */ - NC_set_numrecs(ncp, numrecs); - } - else - { - /* Treat two cases differently: - - exactly one record variable (no padding) - - multiple record variables (each record padded - to 4-byte alignment) - */ - NC_var **vpp = (NC_var **)ncp->vars.value; - NC_var *const *const end = &vpp[ncp->vars.nelems]; - NC_var *recvarp = NULL; /* last record var */ - int numrecvars = 0; - size_t cur_nrecs; - - /* determine how many record variables */ - for( /*NADA*/; vpp < end; vpp++) { - if(IS_RECVAR(*vpp)) { - recvarp = *vpp; - numrecvars++; - } - } - - if (numrecvars != 1) { /* usual case */ - /* Fill each record out to numrecs */ - while((cur_nrecs = NC_get_numrecs(ncp)) < numrecs) - { - status = NCfillrecord(ncp, - (const NC_var *const*)ncp->vars.value, - cur_nrecs); - if(status != NC_NOERR) - { - break; - } - NC_increase_numrecs(ncp, cur_nrecs +1); - } - if(status != NC_NOERR) - goto common_return; - } else { /* special case */ - /* Fill each record out to numrecs */ - while((cur_nrecs = NC_get_numrecs(ncp)) < numrecs) - { - status = NCfillspecialrecord(ncp, - recvarp, - cur_nrecs); - if(status != NC_NOERR) - { - break; - } - NC_increase_numrecs(ncp, cur_nrecs +1); - } - if(status != NC_NOERR) - goto common_return; - - } - } - - if(NC_doNsync(ncp)) - { - status = write_numrecs(ncp); - } - - } -common_return: -#ifdef LOCKNUMREC - /* finished with our lock - increment serving number */ - (void) shmem_short_finc((shmem_t *) ncp->lock + LOCKNUMREC_SERVING, - ncp->lock[LOCKNUMREC_BASEPE]); -#endif - return status; -} - - -/* - * Check whether 'coord' values are valid for the variable. - */ -static int -NCcoordck(NC *ncp, const NC_var *varp, const size_t *coord) -{ - const size_t *ip; - size_t *up; - - if(varp->ndims == 0) - return NC_NOERR; /* 'scalar' variable */ - - if(IS_RECVAR(varp)) - { - if(*coord > X_UINT_MAX) /* rkr: bug fix from previous X_INT_MAX */ - return NC_EINVALCOORDS; /* sanity check */ - if(NC_readonly(ncp) && *coord >= NC_get_numrecs(ncp)) - { - if(!NC_doNsync(ncp)) - return NC_EINVALCOORDS; - /* else */ - { - /* Update from disk and check again */ - const int status = read_numrecs(ncp); - if(status != NC_NOERR) - return status; - if(*coord >= NC_get_numrecs(ncp)) - return NC_EINVALCOORDS; - } - } - ip = coord + 1; - up = varp->shape + 1; - } - else - { - ip = coord; - up = varp->shape; - } - -#ifdef CDEBUG -fprintf(stderr," NCcoordck: coord %ld, count %d, ip %ld\n", - coord, varp->ndims, ip ); -#endif /* CDEBUG */ - - for(; ip < coord + varp->ndims; ip++, up++) - { - -#ifdef CDEBUG -fprintf(stderr," NCcoordck: ip %p, *ip %ld, up %p, *up %lu\n", - ip, *ip, up, *up ); -#endif /* CDEBUG */ - - /* cast needed for braindead systems with signed size_t */ - if((unsigned long) *ip >= (unsigned long) *up ) - return NC_EINVALCOORDS; - } - - return NC_NOERR; -} - - -/* - * Check whether 'edges' are valid for the variable and 'start' - */ -/*ARGSUSED*/ -static int -NCedgeck(const NC *ncp, const NC_var *varp, - const size_t *start, const size_t *edges) -{ - const size_t *const end = start + varp->ndims; - const size_t *shp = varp->shape; - - if(varp->ndims == 0) - return NC_NOERR; /* 'scalar' variable */ - - if(IS_RECVAR(varp)) - { - start++; - edges++; - shp++; - } - - for(; start < end; start++, edges++, shp++) - { - /* cast needed for braindead systems with signed size_t */ - if((unsigned long) *edges > *shp || - (unsigned long) *start + (unsigned long) *edges > *shp) - { - return(NC_EEDGE); - } - } - return NC_NOERR; -} - - -/* - * Translate the (variable, coord) pair into a seek index - */ -static off_t -NC_varoffset(const NC *ncp, const NC_var *varp, const size_t *coord) -{ - if(varp->ndims == 0) /* 'scalar' variable */ - return varp->begin; - - if(varp->ndims == 1) - { - if(IS_RECVAR(varp)) - return varp->begin + - (off_t)(*coord) * (off_t)ncp->recsize; - /* else */ - return varp->begin + (off_t)(*coord) * (off_t)varp->xsz; - } - /* else */ - { - off_t lcoord = (off_t)coord[varp->ndims -1]; - - off_t *up = varp->dsizes +1; - const size_t *ip = coord; - const off_t *const end = varp->dsizes + varp->ndims; - - if(IS_RECVAR(varp)) - up++, ip++; - - for(; up < end; up++, ip++) - lcoord += (off_t)(*up) * (off_t)(*ip); - - lcoord *= varp->xsz; - - if(IS_RECVAR(varp)) - lcoord += (off_t)(*coord) * ncp->recsize; - - lcoord += varp->begin; - return lcoord; - } -} - - - -static int -putNCvx_char_char(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const char *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_char_char(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - - -static int -putNCvx_schar_schar(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const schar *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_schar_schar(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - -static int -putNCvx_schar_uchar(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const uchar *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_schar_uchar(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - -static int -putNCvx_schar_short(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const short *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_schar_short(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - -static int -putNCvx_schar_int(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const int *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_schar_int(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - -static int -putNCvx_schar_float(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const float *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_schar_float(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - -static int -putNCvx_schar_double(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const double *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_schar_double(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - -static int -putNCvx_schar_longlong(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const longlong *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_schar_longlong(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - - -static int -putNCvx_short_schar(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const schar *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_short_schar(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - -static int -putNCvx_short_uchar(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const uchar *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_short_uchar(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - -static int -putNCvx_short_short(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const short *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_short_short(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - -static int -putNCvx_short_int(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const int *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_short_int(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - -static int -putNCvx_short_float(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const float *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_short_float(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - -static int -putNCvx_short_double(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const double *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_short_double(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - -static int -putNCvx_short_longlong(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const longlong *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_short_longlong(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - - -static int -putNCvx_int_schar(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const schar *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_int_schar(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - -static int -putNCvx_int_uchar(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const uchar *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_int_uchar(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - -static int -putNCvx_int_short(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const short *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_int_short(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - -static int -putNCvx_int_int(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const int *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_int_int(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - -static int -putNCvx_int_float(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const float *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_int_float(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - -static int -putNCvx_int_double(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const double *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_int_double(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - -static int -putNCvx_int_longlong(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const longlong *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_int_longlong(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - - -static int -putNCvx_float_schar(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const schar *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_float_schar(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - -static int -putNCvx_float_uchar(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const uchar *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_float_uchar(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - -static int -putNCvx_float_short(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const short *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_float_short(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - -static int -putNCvx_float_int(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const int *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_float_int(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - -static int -putNCvx_float_float(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const float *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_float_float(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - -static int -putNCvx_float_double(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const double *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_float_double(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - -static int -putNCvx_float_longlong(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const longlong *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_float_longlong(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - - -static int -putNCvx_double_schar(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const schar *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_double_schar(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - -static int -putNCvx_double_uchar(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const uchar *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_double_uchar(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - -static int -putNCvx_double_short(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const short *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_double_short(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - -static int -putNCvx_double_int(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const int *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_double_int(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - -static int -putNCvx_double_float(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const float *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_double_float(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - -static int -putNCvx_double_double(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const double *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_double_double(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - -static int -putNCvx_double_longlong(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const longlong *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_double_longlong(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - - -#ifdef NOTUSED -static int -putNCvx_schar_uint(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const uint *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_schar_uint(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - -static int -putNCvx_schar_ulonglong(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const ulonglong *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_schar_ulonglong(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - -static int -putNCvx_short_uint(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const uint *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_short_uint(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - -static int -putNCvx_short_ulonglong(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const ulonglong *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_short_ulonglong(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - -static int -putNCvx_int_uint(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const uint *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_int_uint(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - -static int -putNCvx_int_ulonglong(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const ulonglong *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_int_ulonglong(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - -static int -putNCvx_float_uint(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const uint *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_float_uint(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - -static int -putNCvx_float_ulonglong(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const ulonglong *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_float_ulonglong(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - -static int -putNCvx_double_uint(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const uint *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_double_uint(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - -static int -putNCvx_double_ulonglong(NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, const ulonglong *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nput = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - RGN_WRITE, &xp); - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_putn_double_ulonglong(&xp, nput, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - { - /* not fatal to the loop */ - status = lstatus; - } - - (void) ncio_rel(ncp->nciop, offset, - RGN_MODIFIED); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nput; - - } - - return status; -} - -#endif /*NOTUSED*/ - - -static int -getNCvx_char_char(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, char *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_char_char(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - - -static int -getNCvx_schar_schar(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, schar *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_schar_schar(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - -static int -getNCvx_schar_short(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, short *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_schar_short(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - -static int -getNCvx_schar_int(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, int *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_schar_int(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - -static int -getNCvx_schar_float(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, float *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_schar_float(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - -static int -getNCvx_schar_double(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, double *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_schar_double(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - -static int -getNCvx_schar_longlong(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, longlong *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_schar_longlong(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - -static int -getNCvx_schar_uint(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, uint *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_schar_uint(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - -static int -getNCvx_schar_ulonglong(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, ulonglong *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_schar_ulonglong(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - - -static int -getNCvx_short_schar(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, schar *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_short_schar(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - -static int -getNCvx_short_uchar(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, uchar *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_short_uchar(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - -static int -getNCvx_short_short(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, short *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_short_short(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - -static int -getNCvx_short_int(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, int *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_short_int(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - -static int -getNCvx_short_float(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, float *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_short_float(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - -static int -getNCvx_short_double(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, double *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_short_double(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - -static int -getNCvx_short_longlong(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, longlong *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_short_longlong(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - -static int -getNCvx_short_uint(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, uint *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_short_uint(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - -static int -getNCvx_short_ulonglong(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, ulonglong *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_short_ulonglong(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - - -static int -getNCvx_int_schar(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, schar *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_int_schar(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - -static int -getNCvx_int_uchar(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, uchar *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_int_uchar(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - -static int -getNCvx_int_short(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, short *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_int_short(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - -static int -getNCvx_int_int(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, int *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_int_int(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - -static int -getNCvx_int_float(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, float *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_int_float(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - -static int -getNCvx_int_double(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, double *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_int_double(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - -static int -getNCvx_int_longlong(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, longlong *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_int_longlong(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - -static int -getNCvx_int_uint(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, uint *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_int_uint(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - -static int -getNCvx_int_ulonglong(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, ulonglong *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_int_ulonglong(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - - -static int -getNCvx_float_schar(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, schar *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_float_schar(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - -static int -getNCvx_float_uchar(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, uchar *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_float_uchar(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - -static int -getNCvx_float_short(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, short *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_float_short(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - -static int -getNCvx_float_int(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, int *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_float_int(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - -static int -getNCvx_float_float(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, float *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_float_float(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - -static int -getNCvx_float_double(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, double *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_float_double(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - -static int -getNCvx_float_longlong(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, longlong *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_float_longlong(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - -static int -getNCvx_float_uint(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, uint *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_float_uint(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - -static int -getNCvx_float_ulonglong(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, ulonglong *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_float_ulonglong(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - - -static int -getNCvx_double_schar(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, schar *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_double_schar(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - -static int -getNCvx_double_uchar(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, uchar *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_double_uchar(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - -static int -getNCvx_double_short(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, short *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_double_short(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - -static int -getNCvx_double_int(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, int *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_double_int(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - -static int -getNCvx_double_float(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, float *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_double_float(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - -static int -getNCvx_double_double(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, double *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_double_double(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - -static int -getNCvx_double_longlong(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, longlong *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_double_longlong(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - -static int -getNCvx_double_uint(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, uint *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_double_uint(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - -static int -getNCvx_double_ulonglong(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, ulonglong *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_double_ulonglong(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - - -#ifdef NOTUSED -static int -getNCvx_schar_uchar(const NC *ncp, const NC_var *varp, - const size_t *start, size_t nelems, uchar *value) -{ - off_t offset = NC_varoffset(ncp, varp, start); - size_t remaining = varp->xsz * nelems; - int status = NC_NOERR; - const void *xp; - - if(nelems == 0) - return NC_NOERR; - - assert(value != NULL); - - for(;;) - { - size_t extent = MIN(remaining, ncp->chunk); - size_t nget = ncx_howmany(varp->type, extent); - - int lstatus = ncio_get(ncp->nciop, offset, extent, - 0, (void **)&xp); /* cast away const */ - if(lstatus != NC_NOERR) - return lstatus; - - lstatus = ncx_getn_schar_uchar(&xp, nget, value); - if(lstatus != NC_NOERR && status == NC_NOERR) - status = lstatus; - - (void) ncio_rel(ncp->nciop, offset, 0); - - remaining -= extent; - if(remaining == 0) - break; /* normal loop exit */ - offset += extent; - value += nget; - } - - return status; -} - -#endif /*NOTUSED*/ - -/* - * For ncvar{put,get}, - * find the largest contiguous block from within 'edges'. - * returns the index to the left of this (which may be -1). - * Compute the number of contiguous elements and return - * that in *iocountp. - * The presence of "record" variables makes this routine - * overly subtle. - */ -static int -NCiocount(const NC *const ncp, const NC_var *const varp, - const size_t *const edges, - size_t *const iocountp) -{ - const size_t *edp0 = edges; - const size_t *edp = edges + varp->ndims; - const size_t *shp = varp->shape + varp->ndims; - - if(IS_RECVAR(varp)) - { - if(varp->ndims == 1 && ncp->recsize <= varp->len) - { - /* one dimensional && the only 'record' variable */ - *iocountp = *edges; - return(0); - } - /* else */ - edp0++; - } - - assert(edges != NULL); - - /* find max contiguous */ - while(edp > edp0) - { - shp--; edp--; - if(*edp < *shp ) - { - const size_t *zedp = edp; - while(zedp >= edp0) - { - if(*zedp == 0) - { - *iocountp = 0; - goto done; - } - /* Tip of the hat to segmented architectures */ - if(zedp == edp0) - break; - zedp--; - } - break; - } - assert(*edp == *shp); - } - - /* - * edp, shp reference rightmost index s.t. *(edp +1) == *(shp +1) - * - * Or there is only one dimension. - * If there is only one dimension and it is 'non record' dimension, - * edp is &edges[0] and we will return -1. - * If there is only one dimension and and it is a "record dimension", - * edp is &edges[1] (out of bounds) and we will return 0; - */ - assert(shp >= varp->shape + varp->ndims -1 - || *(edp +1) == *(shp +1)); - - /* now accumulate max count for a single io operation */ - for(*iocountp = 1, edp0 = edp; - edp0 < edges + varp->ndims; - edp0++) - { - *iocountp *= *edp0; - } - -done: - return((int)(edp - edges) - 1); -} - - -/* - * Set the elements of the array 'upp' to - * the sum of the corresponding elements of - * 'stp' and 'edp'. 'end' should be &stp[nelems]. - */ -static void -set_upper(size_t *upp, /* modified on return */ - const size_t *stp, - const size_t *edp, - const size_t *const end) -{ - while(upp < end) { - *upp++ = *stp++ + *edp++; - } -} - - -/* - * The infamous and oft-discussed odometer code. - * - * 'start[]' is the starting coordinate. - * 'upper[]' is the upper bound s.t. start[ii] < upper[ii]. - * 'coord[]' is the register, the current coordinate value. - * For some ii, - * upp == &upper[ii] - * cdp == &coord[ii] - * - * Running this routine increments *cdp. - * - * If after the increment, *cdp is equal to *upp - * (and cdp is not the leftmost dimension), - * *cdp is "zeroed" to the starting value and - * we need to "carry", eg, increment one place to - * the left. - * - * TODO: Some architectures hate recursion? - * Reimplement non-recursively. - */ -static void -odo1(const size_t *const start, const size_t *const upper, - size_t *const coord, /* modified on return */ - const size_t *upp, - size_t *cdp) -{ - assert(coord <= cdp && cdp <= coord + NC_MAX_VAR_DIMS); - assert(upper <= upp && upp <= upper + NC_MAX_VAR_DIMS); - assert(upp - upper == cdp - coord); - - assert(*cdp <= *upp); - - (*cdp)++; - if(cdp != coord && *cdp >= *upp) - { - *cdp = start[cdp - coord]; - odo1(start, upper, coord, upp -1, cdp -1); - } -} -#ifdef _CRAYC -#pragma _CRI noinline odo1 -#endif - - - -/* Define a macro to allow hash on two type values */ -#define CASE(nc1,nc2) (nc1*256+nc2) - -static int -readNCv(const NC* ncp, const NC_var* varp, const size_t* start, - const size_t nelems, void* value, const nc_type memtype) -{ - int status = NC_NOERR; - switch (CASE(varp->type,memtype)) { - case CASE(NC_CHAR,NC_CHAR): - case CASE(NC_CHAR,NC_UBYTE): - status = getNCvx_char_char(ncp,varp,start,nelems,(char*)value); - break; - - case CASE(NC_BYTE,NC_BYTE): - case CASE(NC_BYTE,NC_UBYTE): - status = getNCvx_schar_schar(ncp,varp,start,nelems,(signed char*)value); - break; - case CASE(NC_BYTE,NC_SHORT): - status = getNCvx_schar_short(ncp,varp,start,nelems,(short*)value); - break; - case CASE(NC_BYTE,NC_INT): - status = getNCvx_schar_int(ncp,varp,start,nelems,(int*)value); - break; - case CASE(NC_BYTE,NC_FLOAT): - status = getNCvx_schar_float(ncp,varp,start,nelems,(float*)value); - break; - case CASE(NC_BYTE,NC_DOUBLE): - status = getNCvx_schar_double(ncp,varp,start,nelems,(double *)value); - break; - case CASE(NC_BYTE,NC_INT64): - status = getNCvx_schar_longlong(ncp,varp,start,nelems,(long long*)value); - break; - case CASE(NC_BYTE,NC_UINT): - status = getNCvx_schar_uint(ncp,varp,start,nelems,(unsigned int*)value); - break; - case CASE(NC_BYTE,NC_UINT64): - status = getNCvx_schar_ulonglong(ncp,varp,start,nelems,(unsigned long long*)value); - break; - - case CASE(NC_SHORT,NC_BYTE): - status = getNCvx_short_schar(ncp,varp,start,nelems,(signed char*)value); - break; - case CASE(NC_SHORT,NC_UBYTE): - status = getNCvx_short_uchar(ncp,varp,start,nelems,(unsigned char*)value); - break; - case CASE(NC_SHORT,NC_SHORT): - status = getNCvx_short_short(ncp,varp,start,nelems,(short*)value); - break; - case CASE(NC_SHORT,NC_INT): - status = getNCvx_short_int(ncp,varp,start,nelems,(int*)value); - break; - case CASE(NC_SHORT,NC_FLOAT): - status = getNCvx_short_float(ncp,varp,start,nelems,(float*)value); - break; - case CASE(NC_SHORT,NC_DOUBLE): - status = getNCvx_short_double(ncp,varp,start,nelems,(double*)value); - break; - case CASE(NC_SHORT,NC_INT64): - status = getNCvx_short_longlong(ncp,varp,start,nelems,(long long*)value); - break; - case CASE(NC_SHORT,NC_UINT): - status = getNCvx_short_uint(ncp,varp,start,nelems,(unsigned int*)value); - break; - case CASE(NC_SHORT,NC_UINT64): - status = getNCvx_short_ulonglong(ncp,varp,start,nelems,(unsigned long long*)value); - break; - - - case CASE(NC_INT,NC_BYTE): - status = getNCvx_int_schar(ncp,varp,start,nelems,(signed char*)value); - break; - case CASE(NC_INT,NC_UBYTE): - status = getNCvx_int_uchar(ncp,varp,start,nelems,(unsigned char*)value); - break; - case CASE(NC_INT,NC_SHORT): - status = getNCvx_int_short(ncp,varp,start,nelems,(short*)value); - break; - case CASE(NC_INT,NC_INT): - status = getNCvx_int_int(ncp,varp,start,nelems,(int*)value); - break; - case CASE(NC_INT,NC_FLOAT): - status = getNCvx_int_float(ncp,varp,start,nelems,(float*)value); - break; - case CASE(NC_INT,NC_DOUBLE): - status = getNCvx_int_double(ncp,varp,start,nelems,(double*)value); - break; - case CASE(NC_INT,NC_INT64): - status = getNCvx_int_longlong(ncp,varp,start,nelems,(long long*)value); - break; - case CASE(NC_INT,NC_UINT): - status = getNCvx_int_uint(ncp,varp,start,nelems,(unsigned int*)value); - break; - case CASE(NC_INT,NC_UINT64): - status = getNCvx_int_ulonglong(ncp,varp,start,nelems,(unsigned long long*)value); - break; - - - case CASE(NC_FLOAT,NC_BYTE): - status = getNCvx_float_schar(ncp,varp,start,nelems,(signed char*)value); - break; - case CASE(NC_FLOAT,NC_UBYTE): - status = getNCvx_float_uchar(ncp,varp,start,nelems,(unsigned char*)value); - break; - case CASE(NC_FLOAT,NC_SHORT): - status = getNCvx_float_short(ncp,varp,start,nelems,(short*)value); - break; - case CASE(NC_FLOAT,NC_INT): - status = getNCvx_float_int(ncp,varp,start,nelems,(int*)value); - break; - case CASE(NC_FLOAT,NC_FLOAT): - status = getNCvx_float_float(ncp,varp,start,nelems,(float*)value); - break; - case CASE(NC_FLOAT,NC_DOUBLE): - status = getNCvx_float_double(ncp,varp,start,nelems,(double*)value); - break; - case CASE(NC_FLOAT,NC_INT64): - status = getNCvx_float_longlong(ncp,varp,start,nelems,(long long*)value); - break; - case CASE(NC_FLOAT,NC_UINT): - status = getNCvx_float_uint(ncp,varp,start,nelems,(unsigned int*)value); - break; - case CASE(NC_FLOAT,NC_UINT64): - status = getNCvx_float_ulonglong(ncp,varp,start,nelems,(unsigned long long*)value); - break; - - - case CASE(NC_DOUBLE,NC_BYTE): - status = getNCvx_double_schar(ncp,varp,start,nelems,(signed char*)value); - break; - case CASE(NC_DOUBLE,NC_UBYTE): - status = getNCvx_double_uchar(ncp,varp,start,nelems,(unsigned char*)value); - break; - case CASE(NC_DOUBLE,NC_SHORT): - status = getNCvx_double_short(ncp,varp,start,nelems,(short*)value); - break; - case CASE(NC_DOUBLE,NC_INT): - status = getNCvx_double_int(ncp,varp,start,nelems,(int*)value); - break; - case CASE(NC_DOUBLE,NC_FLOAT): - status = getNCvx_double_float(ncp,varp,start,nelems,(float*)value); - break; - case CASE(NC_DOUBLE,NC_DOUBLE): - status = getNCvx_double_double(ncp,varp,start,nelems,(double*)value); - break; - case CASE(NC_DOUBLE,NC_INT64): - status = getNCvx_double_longlong(ncp,varp,start,nelems,(long long*)value); - break; - case CASE(NC_DOUBLE,NC_UINT): - status = getNCvx_double_uint(ncp,varp,start,nelems,(unsigned int*)value); - break; - case CASE(NC_DOUBLE,NC_UINT64): - status = getNCvx_double_ulonglong(ncp,varp,start,nelems,(unsigned long long*)value); - break; - - default: - return NC_EBADTYPE; - } - return status; -} - - -static int -writeNCv(NC* ncp, const NC_var* varp, const size_t* start, - const size_t nelems, const void* value, const nc_type memtype) -{ - int status = NC_NOERR; - switch (CASE(varp->type,memtype)) { - case CASE(NC_CHAR,NC_CHAR): - case CASE(NC_CHAR,NC_UBYTE): - status = putNCvx_char_char(ncp,varp,start,nelems,(char*)value); - break; - - case CASE(NC_BYTE,NC_BYTE): - status = putNCvx_schar_schar(ncp,varp,start,nelems,(signed char*)value); - break; - case CASE(NC_BYTE,NC_UBYTE): - status = putNCvx_schar_uchar(ncp,varp,start,nelems,(unsigned char*)value); - break; - case CASE(NC_BYTE,NC_SHORT): - status = putNCvx_schar_short(ncp,varp,start,nelems,(short*)value); - break; - case CASE(NC_BYTE,NC_INT): - status = putNCvx_schar_int(ncp,varp,start,nelems,(int*)value); - break; - case CASE(NC_BYTE,NC_FLOAT): - status = putNCvx_schar_float(ncp,varp,start,nelems,(float*)value); - break; - case CASE(NC_BYTE,NC_DOUBLE): - status = putNCvx_schar_double(ncp,varp,start,nelems,(double *)value); - break; - case CASE(NC_BYTE,NC_INT64): - status = putNCvx_schar_longlong(ncp,varp,start,nelems,(long long*)value); - break; - - case CASE(NC_SHORT,NC_BYTE): - status = putNCvx_short_schar(ncp,varp,start,nelems,(signed char*)value); - break; - case CASE(NC_SHORT,NC_UBYTE): - status = putNCvx_short_uchar(ncp,varp,start,nelems,(unsigned char*)value); - break; - case CASE(NC_SHORT,NC_SHORT): - status = putNCvx_short_short(ncp,varp,start,nelems,(short*)value); - break; - case CASE(NC_SHORT,NC_INT): - status = putNCvx_short_int(ncp,varp,start,nelems,(int*)value); - break; - case CASE(NC_SHORT,NC_FLOAT): - status = putNCvx_short_float(ncp,varp,start,nelems,(float*)value); - break; - case CASE(NC_SHORT,NC_DOUBLE): - status = putNCvx_short_double(ncp,varp,start,nelems,(double*)value); - break; - case CASE(NC_SHORT,NC_INT64): - status = putNCvx_short_longlong(ncp,varp,start,nelems,(long long*)value); - break; - - case CASE(NC_INT,NC_BYTE): - status = putNCvx_int_schar(ncp,varp,start,nelems,(signed char*)value); - break; - case CASE(NC_INT,NC_UBYTE): - status = putNCvx_int_uchar(ncp,varp,start,nelems,(unsigned char*)value); - break; - case CASE(NC_INT,NC_SHORT): - status = putNCvx_int_short(ncp,varp,start,nelems,(short*)value); - break; - case CASE(NC_INT,NC_INT): - status = putNCvx_int_int(ncp,varp,start,nelems,(int*)value); - break; - case CASE(NC_INT,NC_FLOAT): - status = putNCvx_int_float(ncp,varp,start,nelems,(float*)value); - break; - case CASE(NC_INT,NC_DOUBLE): - status = putNCvx_int_double(ncp,varp,start,nelems,(double*)value); - break; - case CASE(NC_INT,NC_INT64): - status = putNCvx_int_longlong(ncp,varp,start,nelems,(long long*)value); - break; - - case CASE(NC_FLOAT,NC_BYTE): - status = putNCvx_float_schar(ncp,varp,start,nelems,(signed char*)value); - break; - case CASE(NC_FLOAT,NC_UBYTE): - status = putNCvx_float_uchar(ncp,varp,start,nelems,(unsigned char*)value); - break; - case CASE(NC_FLOAT,NC_SHORT): - status = putNCvx_float_short(ncp,varp,start,nelems,(short*)value); - break; - case CASE(NC_FLOAT,NC_INT): - status = putNCvx_float_int(ncp,varp,start,nelems,(int*)value); - break; - case CASE(NC_FLOAT,NC_FLOAT): - status = putNCvx_float_float(ncp,varp,start,nelems,(float*)value); - break; - case CASE(NC_FLOAT,NC_DOUBLE): - status = putNCvx_float_double(ncp,varp,start,nelems,(double*)value); - break; - case CASE(NC_FLOAT,NC_INT64): - status = putNCvx_float_longlong(ncp,varp,start,nelems,(long long*)value); - break; - - case CASE(NC_DOUBLE,NC_BYTE): - status = putNCvx_double_schar(ncp,varp,start,nelems,(signed char*)value); - break; - case CASE(NC_DOUBLE,NC_UBYTE): - status = putNCvx_double_uchar(ncp,varp,start,nelems,(unsigned char*)value); - break; - case CASE(NC_DOUBLE,NC_SHORT): - status = putNCvx_double_short(ncp,varp,start,nelems,(short*)value); - break; - case CASE(NC_DOUBLE,NC_INT): - status = putNCvx_double_int(ncp,varp,start,nelems,(int*)value); - break; - case CASE(NC_DOUBLE,NC_FLOAT): - status = putNCvx_double_float(ncp,varp,start,nelems,(float*)value); - break; - case CASE(NC_DOUBLE,NC_DOUBLE): - status = putNCvx_double_double(ncp,varp,start,nelems,(double*)value); - break; - case CASE(NC_DOUBLE,NC_INT64): - status = putNCvx_double_longlong(ncp,varp,start,nelems,(long long*)value); - break; - - default: - return NC_EBADTYPE; - } - return status; -} - -/**************************************************/ - -int -NC3_get_vara(int ncid, int varid, - const size_t *start, const size_t *edges0, - void *value0, - nc_type memtype) -{ - int status = NC_NOERR; - NC* ncp; - NC_var *varp; - int ii; - size_t iocount; - size_t memtypelen; - char* value = (char*) value0; /* legally allow ptr arithmetic */ - const size_t* edges = edges0; /* so we can modify for special cases */ - size_t modedges[NC_MAX_VAR_DIMS]; - - status = NC_check_id(ncid, &ncp); - if(status != NC_NOERR) - return status; - - if(NC_indef(ncp)) - return NC_EINDEFINE; - - varp = NC_lookupvar(ncp, varid); - if(varp == NULL) - return NC_ENOTVAR; - - if(memtype == NC_NAT) memtype=varp->type; - - if(memtype == NC_CHAR && varp->type != NC_CHAR) - return NC_ECHAR; - else if(memtype != NC_CHAR && varp->type == NC_CHAR) - return NC_ECHAR; - - /* If edges is NULL, then this was called from nc_get_var() */ - if(edges == NULL && varp->ndims > 0) { - /* If this is a record variable, then we have to - substitute the number of records into dimension 0. */ - if(varp->shape[0] == 0) { - (void*)memcpy((void*)modedges,(void*)varp->shape, - sizeof(size_t)*varp->ndims); - modedges[0] = NC_get_numrecs(ncp); - edges = modedges; - } else - edges = varp->shape; - } - - status = NCcoordck(ncp, varp, start); - if(status != NC_NOERR) - return status; - - status = NCedgeck(ncp, varp, start, edges); - if(status != NC_NOERR) - return status; - - /* Get the size of the memtype */ - memtypelen = nctypelen(memtype); - - if(varp->ndims == 0) /* scalar variable */ - { - return( readNCv(ncp, varp, start, 1, (void*)value, memtype) ); - } - - if(IS_RECVAR(varp)) - { - if(*start + *edges > NC_get_numrecs(ncp)) - return NC_EEDGE; - if(varp->ndims == 1 && ncp->recsize <= varp->len) - { - /* one dimensional && the only record variable */ - return( readNCv(ncp, varp, start, *edges, (void*)value, memtype) ); - } - } - - /* - * find max contiguous - * and accumulate max count for a single io operation - */ - ii = NCiocount(ncp, varp, edges, &iocount); - - if(ii == -1) - { - return( readNCv(ncp, varp, start, iocount, (void*)value, memtype) ); - } - - assert(ii >= 0); - - { /* inline */ - ALLOC_ONSTACK(coord, size_t, varp->ndims); - ALLOC_ONSTACK(upper, size_t, varp->ndims); - const size_t index = ii; - - /* copy in starting indices */ - (void) memcpy(coord, start, varp->ndims * sizeof(size_t)); - - /* set up in maximum indices */ - set_upper(upper, start, edges, &upper[varp->ndims]); - - /* ripple counter */ - while(*coord < *upper) - { - const int lstatus = readNCv(ncp, varp, coord, iocount, (void*)value, memtype); - if(lstatus != NC_NOERR) - { - if(lstatus != NC_ERANGE) - { - status = lstatus; - /* fatal for the loop */ - break; - } - /* else NC_ERANGE, not fatal for the loop */ - if(status == NC_NOERR) - status = lstatus; - } - value += (iocount * memtypelen); - odo1(start, upper, coord, &upper[index], &coord[index]); - } - - FREE_ONSTACK(upper); - FREE_ONSTACK(coord); - } /* end inline */ - - return status; -} - -int -NC3_put_vara(int ncid, int varid, - const size_t *start, const size_t *edges0, - const void *value0, - nc_type memtype) -{ - int status = NC_NOERR; - NC *ncp; - NC_var *varp; - int ii; - size_t iocount; - size_t memtypelen; - char* value = (char*) value0; /* legally allow ptr arithmetic */ - const size_t* edges = edges0; /* so we can modify for special cases */ - size_t modedges[NC_MAX_VAR_DIMS]; - - status = NC_check_id(ncid, &ncp); - if(status != NC_NOERR) - return status; - - if(NC_readonly(ncp)) - return NC_EPERM; - - if(NC_indef(ncp)) - return NC_EINDEFINE; - - varp = NC_lookupvar(ncp, varid); - if(varp == NULL) - return NC_ENOTVAR; /* TODO: lost NC_EGLOBAL */ - - if(memtype == NC_NAT) memtype=varp->type; - - if(memtype == NC_CHAR && varp->type != NC_CHAR) - return NC_ECHAR; - else if(memtype != NC_CHAR && varp->type == NC_CHAR) - return NC_ECHAR; - - /* Get the size of the memtype */ - memtypelen = nctypelen(memtype); - - /* If edges is NULL, then this was called from nc_get_var() */ - if(edges == NULL && varp->ndims > 0) { - /* If this is a record variable, then we have to - substitute the number of records into dimension 0. */ - if(varp->shape[0] == 0) { - (void*)memcpy((void*)modedges,(void*)varp->shape, - sizeof(size_t)*varp->ndims); - modedges[0] = NC_get_numrecs(ncp); - edges = modedges; - } else - edges = varp->shape; - } - - status = NCcoordck(ncp, varp, start); - if(status != NC_NOERR) - return status; - status = NCedgeck(ncp, varp, start, edges); - if(status != NC_NOERR) - return status; - - if(varp->ndims == 0) /* scalar variable */ - { - return( writeNCv(ncp, varp, start, 1, (void*)value, memtype) ); - } - - if(IS_RECVAR(varp)) - { - status = NCvnrecs(ncp, *start + *edges); - if(status != NC_NOERR) - return status; - - if(varp->ndims == 1 - && ncp->recsize <= varp->len) - { - /* one dimensional && the only record variable */ - return( writeNCv(ncp, varp, start, *edges, (void*)value, memtype) ); - } - } - - /* - * find max contiguous - * and accumulate max count for a single io operation - */ - ii = NCiocount(ncp, varp, edges, &iocount); - - if(ii == -1) - { - return( writeNCv(ncp, varp, start, iocount, (void*)value, memtype) ); - } - - assert(ii >= 0); - - { /* inline */ - ALLOC_ONSTACK(coord, size_t, varp->ndims); - ALLOC_ONSTACK(upper, size_t, varp->ndims); - const size_t index = ii; - - /* copy in starting indices */ - (void) memcpy(coord, start, varp->ndims * sizeof(size_t)); - - /* set up in maximum indices */ - set_upper(upper, start, edges, &upper[varp->ndims]); - - /* ripple counter */ - while(*coord < *upper) - { - const int lstatus = writeNCv(ncp, varp, coord, iocount, (void*)value, memtype); - if(lstatus != NC_NOERR) - { - if(lstatus != NC_ERANGE) - { - status = lstatus; - /* fatal for the loop */ - break; - } - /* else NC_ERANGE, not fatal for the loop */ - if(status == NC_NOERR) - status = lstatus; - } - value += (iocount * memtypelen); - odo1(start, upper, coord, &upper[index], &coord[index]); - } - - FREE_ONSTACK(upper); - FREE_ONSTACK(coord); - } /* end inline */ - - return status; -} diff --git a/xios_2311_src/trunk/.svn/pristine/69/696f16f0ab50543b9f2df079260ded9fdd496d19.svn-base b/xios_2311_src/trunk/.svn/pristine/69/696f16f0ab50543b9f2df079260ded9fdd496d19.svn-base deleted file mode 100644 index e5f0945904a03f27863983c1f3a37e6ed6c0f470..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/69/696f16f0ab50543b9f2df079260ded9fdd496d19.svn-base +++ /dev/null @@ -1,60 +0,0 @@ -/********************************************************************* - * Copyright 1993, UCAR/Unidata - * See netcdf/COPYRIGHT file for copying and redistribution conditions. - * $Header: /upc/share/CVS/netcdf-3/libncdap3/nchashmap.h,v 1.4 2009/09/23 22:26:08 dmh Exp $ - *********************************************************************/ -#ifndef NCHASHMAP_H -#define NCHASHMAP_H 1 - -#include "nclist.h" - -/* Define the type of the elements in the hashmap*/ - -#if defined(_CPLUSPLUS_) || defined(__CPLUSPLUS__) -#define EXTERNC extern "C" -#else -#define EXTERNC extern -#endif - -typedef unsigned long nchashid; - -EXTERNC int nchashnull(ncelem); - -typedef struct NChashmap { - int alloc; - int size; /* # of pairs still in table*/ - NClist** table; -} NChashmap; - -EXTERNC NChashmap* nchashnew(void); -EXTERNC NChashmap* nchashnew0(int); -EXTERNC int nchashfree(NChashmap*); - -/* Insert a (ncnchashid,ncelem) pair into the table*/ -/* Fail if already there*/ -EXTERNC int nchashinsert(NChashmap*, nchashid nchash, ncelem value); - -/* Insert a (nchashid,ncelem) pair into the table*/ -/* Overwrite if already there*/ -EXTERNC int nchashreplace(NChashmap*, nchashid nchash, ncelem value); - -/* lookup a nchashid and return found/notfound*/ -EXTERNC int nchashlookup(NChashmap*, nchashid nchash, ncelem* valuep); - -/* lookup a nchashid and return 0 or the value*/ -EXTERNC ncelem nchashget(NChashmap*, nchashid nchash); - -/* remove a nchashid*/ -EXTERNC int nchashremove(NChashmap*, nchashid nchash); - -/* Return the ith pair; order is completely arbitrary*/ -/* Can be expensive*/ -EXTERNC int nchashith(NChashmap*, int i, nchashid*, ncelem*); - -EXTERNC int nchashkeys(NChashmap* hm, nchashid** keylist); - -/* return the # of pairs in table*/ -#define nchashsize(hm) ((hm)?(hm)->size:0) - -#endif /*NCHASHMAP_H*/ - diff --git a/xios_2311_src/trunk/.svn/pristine/6a/6a39286683dd51c631db9f68d1df10469d44c22c.svn-base b/xios_2311_src/trunk/.svn/pristine/6a/6a39286683dd51c631db9f68d1df10469d44c22c.svn-base deleted file mode 100644 index d27fa1452539f43627e348c134c7dc62fcc3597f..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/6a/6a39286683dd51c631db9f68d1df10469d44c22c.svn-base +++ /dev/null @@ -1,42 +0,0 @@ -DECLARE_ATTRIBUTE(StdString, name) -DECLARE_ATTRIBUTE(StdString, standard_name) -DECLARE_ATTRIBUTE(StdString, long_name) - -DECLARE_ATTRIBUTE(StdString, comment) - -DECLARE_ATTRIBUTE(StdString, unit) -DECLARE_ATTRIBUTE(StdString, formula) -DECLARE_ATTRIBUTE(StdString, formula_term) -DECLARE_ATTRIBUTE(StdString, formula_bounds) -DECLARE_ATTRIBUTE(StdString, formula_term_bounds) -DECLARE_ATTRIBUTE(StdString, bounds_name) - -DECLARE_ATTRIBUTE(int, n_glo) -DECLARE_ENUM2(positive, up, down) -DECLARE_ENUM4(axis_type, X, Y, Z, T) - -DECLARE_ATTRIBUTE(StdString, dim_name) - -/* GLOBAL */ -DECLARE_ATTRIBUTE(int, n_distributed_partition) - -/* LOCAL */ -DECLARE_ARRAY(double , 1 , value, false) -DECLARE_ATTRIBUTE(StdString, axis_ref, false) - -DECLARE_ARRAY(int ,1 , index, false) - -/* LOCAL */ -DECLARE_ATTRIBUTE(int, data_n, false) -DECLARE_ATTRIBUTE(int, data_begin, false) -DECLARE_ARRAY(int , 1 , data_index, false) - -/*LOCAL */ -DECLARE_ATTRIBUTE(int, begin, false) -DECLARE_ATTRIBUTE(int, n, false) - -/* LOCAL */ -DECLARE_ARRAY(bool, 1 , mask, false) -DECLARE_ARRAY(double, 2 , bounds, false) -DECLARE_ATTRIBUTE(int, prec) -DECLARE_ARRAY(StdString ,1 , label, false) diff --git a/xios_2311_src/trunk/.svn/pristine/6a/6a3d063e6a64e139e8ec87fcbf8047d2427626f4.svn-base b/xios_2311_src/trunk/.svn/pristine/6a/6a3d063e6a64e139e8ec87fcbf8047d2427626f4.svn-base deleted file mode 100644 index d675e78ad8d3af9ce62fb51becb69e9b9aa28e82..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/6a/6a3d063e6a64e139e8ec87fcbf8047d2427626f4.svn-base +++ /dev/null @@ -1,126 +0,0 @@ -import glob -import sys -import subprocess -import os - -user_acct=os.getenv("user_account") - -def OSinfo(runthis): - red = lambda text: '\033[0;31m' + text + '\033[0m' - osstdout = subprocess.Popen(runthis, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True) - theInfo, theErr = osstdout.communicate() - if theErr: - print(red(runthis+" FAILED")) - print(theErr) - sys.exit() - - -def generate_compile_job_irene(revision): - with open("job_compile_irene.sh", "w") as f: - f.write("#!/bin/bash\n") - f.write("#=====================================\n") - f.write("#script generated by config_compile.py\n") - f.write("#=====================================\n") - f.write("#MSUB -r XIOS_rev"+revision+"\n") - f.write("#MSUB -o client_output.out\n") - f.write("#MSUB -e client_error.err\n") - f.write("#MSUB -eo\n") - f.write("#MSUB -c 16\n") - f.write("#MSUB -n 1\n") - f.write("#MSUB -X\n") - f.write("#MSUB -x\n") - f.write("#MSUB -T 1800\n") - f.write("#MSUB -q skylake\n") - f.write("#MSUB -A "+user_acct+"\n") - f.write("#MSUB -Q test\n") - f.write("#MSUB -m work,scratch\n") - f.write("cd $BRIDGE_MSUB_PWD\n") - f.write("cmake .\n") - f.write("ctest -V\n") - f.write("exit\n") - - - -def generate_compile_job_jeanzay(revision): - print("generating compile job for jz") - with open("job_compile_jeanzay.sh", "w") as f: - f.write("#!/bin/bash\n") - f.write("#=====================================\n") - f.write("#script generated by config_compile.py\n") - f.write("#=====================================\n") - f.write("#SBATCH --ntasks=1\n") - f.write("#SBATCH --cpus-per-task=16\n") - f.write("#SBATCH --hint=nomultithread\n") - f.write("#SBATCH -t 00:30:00\n") - f.write("#SBATCH -o output.out\n") - f.write("#SBATCH -e error.err \n") - f.write("#SBATCH -A "+user_acct+"\n") - f.write("#SBATCH --job-name=XIOS_rev"+revision+"\n") - f.write("cd ${SLURM_SUBMIT_DIR}\n") - f.write("cmake .\n") - f.write("ctest -V\n") - f.write("exit\n") - - -def main(): - machine=os.getenv('xios_machine_name') - revision=os.getenv('revision') - - - default_nb_config = 2 - nb_config = 1 - configs = [0]*default_nb_config - configs_arg = [[], []] - - f=open("compile_param_"+machine+".def", "r") - for line in f: - line = line.strip() - if len(line) != 0: - if not line.startswith("#"): - nb_config = nb_config * (line.count(",")+1) - line = line.replace(",", "") - line = line.replace("=", "") - if line.startswith("arch"): - line = line.replace("arch", "") - for word in line.split(): - configs[0] += 1 - configs_arg[0].append(word) - elif line.startswith("mode"): - line = line.replace("mode", "") - for word in line.split(): - configs[1] += 1 - configs_arg[1].append(word) - f.close() - - f=open("CMakeLists.txt", "w") - f.write("#######################################\n") - f.write("# file generated by config_compile.py #\n") - f.write("# DO NOT modify #\n") - f.write("#######################################\n\n") - f.write("cmake_minimum_required(VERSION 2.8.12.2)\n\n") - f.write("project(generic_testcase)\n\n") - f.write("find_package(PythonInterp REQUIRED)\n\n") - f.write("enable_testing()\n\n") - - for i in range(len(configs_arg[0])): - for j in range(len(configs_arg[1])): - build_dir_name = configs_arg[0][i]+"_"+configs_arg[1][j] - g=open("build_"+revision+"_"+machine+"_"+build_dir_name+".txt", "w") - g.write("arch "+configs_arg[0][i]+"\n") - g.write("mode "+configs_arg[1][j]+"\n") - g.write("machine "+machine+"\n") - g.write("revision "+revision+"\n") - g.close() - - f.write("add_test( NAME "+build_dir_name+'\n') - f.write(" COMMAND bash -c \"source ../ARCH/arch-"+configs_arg[0][i]+".env && cd ../.. && ./make_xios --use_tv --arch_path `pwd`/xios_test_suite/ARCH --arch "+configs_arg[0][i]+" --"+configs_arg[1][j]+" --job 16 --build_dir xios_test_suite/BUILD/build_"+build_dir_name+" ; echo $? >> xios_test_suite/COMPILE/build_"+revision+"_"+machine+"_"+build_dir_name+".txt\")\n\n") - f.write("set_tests_properties( "+build_dir_name+" PROPERTIES\n") - f.write(" FAIL_REGULAR_EXPRESSION \"failed\")\n\n") - - - f.close() - - globals()['generate_compile_job_'+machine](revision) - -if __name__== "__main__": - main() diff --git a/xios_2311_src/trunk/.svn/pristine/6a/6a7a1f097473171d5fe4d19208740bf0766d4920.svn-base b/xios_2311_src/trunk/.svn/pristine/6a/6a7a1f097473171d5fe4d19208740bf0766d4920.svn-base deleted file mode 100644 index c7159c4c812d81695085c03a7813b6fad19d14ba..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/6a/6a7a1f097473171d5fe4d19208740bf0766d4920.svn-base +++ /dev/null @@ -1,924 +0,0 @@ -/********************************************************************* - * Copyright 1993, UCAR/Unidata - * See netcdf/COPYRIGHT file for copying and redistribution conditions. - * $Header: /upc/share/CVS/netcdf-3/libncdap3/common34.c,v 1.29 2010/05/25 13:53:02 ed Exp $ - *********************************************************************/ - -#include "ncdap3.h" - -#ifdef HAVE_GETRLIMIT -# ifdef HAVE_SYS_RESOURCE_H -# include -# endif -# ifdef HAVE_SYS_RESOURCE_H -# include -# endif -#endif -#include "dapdump.h" - -extern CDFnode* v4node; - -/* Define the set of protocols known to be constrainable */ -static char* constrainableprotocols[] = {"http", "https",NULL}; -static NCerror buildcdftree34r(NCDAPCOMMON*,OCobject,CDFnode*,CDFtree*,CDFnode**); -static void defdimensions(OCobject, CDFnode*, NCDAPCOMMON*, CDFtree*); -static NCerror attachsubset34r(CDFnode*, CDFnode*); -static void free1cdfnode34(CDFnode* node); - -/* Define Procedures that are common to both - libncdap3 and libncdap4 -*/ - -/* Ensure every node has an initial base name defined and fullname */ -/* Exceptions: anonymous dimensions. */ -static NCerror -fix1node34(NCDAPCOMMON* nccomm, CDFnode* node) -{ - if(node->nctype == NC_Dimension && node->ocname == NULL) return NC_NOERR; - ASSERT((node->ocname != NULL)); - nullfree(node->ncbasename); - node->ncbasename = cdflegalname3(node->ocname); - if(node->ncbasename == NULL) return NC_ENOMEM; - nullfree(node->ncfullname); - node->ncfullname = makecdfpathstring3(node,nccomm->cdf.separator); - if(node->ncfullname == NULL) return NC_ENOMEM; - if(node->nctype == NC_Primitive) - node->externaltype = nctypeconvert(nccomm,node->etype); - return NC_NOERR; -} - -NCerror -fixnodes34(NCDAPCOMMON* nccomm, NClist* cdfnodes) -{ - int i; - for(i=0;isubnodes); - array = (CDFnode*)nclistget(grid->subnodes,0); - if(nccomm->controls.flags & (NCF_NC3)) { - /* Rename grid Array: variable, but leave its oc base name alone */ - nullfree(array->ncbasename); - array->ncbasename = nulldup(grid->ncbasename); - if(!array->ncbasename) return NC_ENOMEM; - } - /* validate and modify the grid structure */ - if((glen-1) != nclistlength(array->array.dimset0)) goto invalid; - for(i=1;iarray.dimset0,i-1); - CDFnode* map = (CDFnode*)nclistget(grid->subnodes,i); - CDFnode* mapdim; - /* map must have 1 dimension */ - if(nclistlength(map->array.dimset0) != 1) goto invalid; - /* and the map name must match the ith array dimension */ - if(arraydim->ocname != NULL && map->ocname != NULL - && strcmp(arraydim->ocname,map->ocname) != 0) - goto invalid; - /* and the map name must match its dim name (if any) */ - mapdim = (CDFnode*)nclistget(map->array.dimset0,0); - if(mapdim->ocname != NULL && map->ocname != NULL - && strcmp(mapdim->ocname,map->ocname) != 0) - goto invalid; - /* Add appropriate names for the anonymous dimensions */ - /* Do the map name first, so the array dim may inherit */ - if(mapdim->ocname == NULL) { - nullfree(mapdim->ncbasename); - mapdim->ocname = nulldup(map->ocname); - if(!mapdim->ocname) return NC_ENOMEM; - mapdim->ncbasename = cdflegalname3(mapdim->ocname); - if(!mapdim->ncbasename) return NC_ENOMEM; - } - if(arraydim->ocname == NULL) { - nullfree(arraydim->ncbasename); - arraydim->ocname = nulldup(map->ocname); - if(!arraydim->ocname) return NC_ENOMEM; - arraydim->ncbasename = cdflegalname3(arraydim->ocname); - if(!arraydim->ncbasename) return NC_ENOMEM; - } - if(FLAGSET(nccomm->controls,(NCF_NCDAP|NCF_NC3))) { - char tmp[3*NC_MAX_NAME]; - /* Add the grid name to the basename of the map */ - snprintf(tmp,sizeof(tmp),"%s%s%s",map->container->ncbasename, - nccomm->cdf.separator, - map->ncbasename); - nullfree(map->ncbasename); - map->ncbasename = nulldup(tmp); - if(!map->ncbasename) return NC_ENOMEM; - } - } - return NC_NOERR; -invalid: - return NC_EINVAL; /* mal-formed grid */ -} - -/** - * Given an anonymous dimension, compute the - * effective 0-based index wrt to the specified var. - * The result should mimic the libnc-dap indices. - */ - -static void -computedimindexanon3(CDFnode* dim, CDFnode* var) -{ - int i; - NClist* dimset = var->array.dimsetall; - for(i=0;idim.index1=i+1; - return; - } - } -} - -/* Replace dims in a list with their corresponding basedim */ -static void -replacedims(NClist* dims) -{ - int i; - for(i=0;idim.basedim; - if(basedim == NULL) continue; - nclistset(dims,i,(ncelem)basedim); - } -} - -/** - Two dimensions are equivalent if - 1. they have the same size - 2. neither are anonymous - 3. they ave the same names. - */ -static int -equivalentdim(CDFnode* basedim, CDFnode* dupdim) -{ - if(dupdim->dim.declsize != basedim->dim.declsize) return 0; - if(basedim->ocname == NULL && dupdim->ocname == NULL) return 0; - if(basedim->ocname == NULL || dupdim->ocname == NULL) return 0; - if(strcmp(dupdim->ocname,basedim->ocname) != 0) return 0; - return 1; -} - -/* - Provide short and/or unified names for dimensions. - This must mimic lib-ncdap, which is difficult. -*/ -NCerror -computecdfdimnames34(NCDAPCOMMON* nccomm) -{ - int i,j; - char tmp[NC_MAX_NAME*2]; - NClist* conflicts = nclistnew(); - NClist* varnodes = nccomm->cdf.varnodes; - NClist* alldims; - NClist* basedims; - - /* Collect all dimension nodes from dimsetall lists */ - - alldims = getalldims34(nccomm,0); - - /* Assign an index to all anonymous dimensions - vis-a-vis its containing variable - */ - for(i=0;iarray.dimsetall);j++) { - CDFnode* dim = (CDFnode*)nclistget(var->array.dimsetall,j); - if(dim->ocname != NULL) continue; /* not anonymous */ - computedimindexanon3(dim,var); - } - } - - /* Unify dimensions by defining one dimension as the "base" - dimension, and make all "equivalent" dimensions point to the - base dimension. - 1. Equivalent means: same size and both have identical non-null names. - 2. Dims with same name but different sizes will be handled separately - */ - for(i=0;idim.basedim != NULL) continue; /* already processed*/ - for(j=i+1;jdim.basedim != NULL) continue; /* already processed */ - if(!equivalentdim(basedim,dupdim)) - continue; - dupdim->dim.basedim = basedim; /* equate */ -#ifdef DEBUG1 -fprintf(stderr,"assign: %s/%s -> %s/%s\n", -basedim->dim.array->ocname,basedim->ocname, -dupdim->dim.array->ocname,dupdim->ocname -); -#endif - } - } - - /* Next case: same name and different sizes*/ - /* => rename second dim */ - - for(i=0;idim.basedim != NULL) continue; - /* Collect all conflicting dimensions */ - nclistclear(conflicts); - for(j=i+1;jdim.basedim != NULL) continue; - if(dim->ocname == NULL && basedim->ocname == NULL) continue; - if(dim->ocname == NULL || basedim->ocname == NULL) continue; - if(strcmp(dim->ocname,basedim->ocname)!=0) continue; - if(dim->dim.declsize == basedim->dim.declsize) continue; -#ifdef DEBUG2 -fprintf(stderr,"conflict: %s[%lu] %s[%lu]\n", - basedim->ncfullname,(unsigned long)basedim->dim.declsize, - dim->ncfullname,(unsigned long)dim->dim.declsize); -#endif - nclistpush(conflicts,(ncelem)dim); - } - /* Give all the conflicting dimensions an index */ - for(j=0;jdim.index1 = j+1; - } - } - nclistfree(conflicts); - - /* Replace all non-base dimensions with their base dimension */ - for(i=0;iarray.dimsetall); - replacedims(node->array.dimsetplus); - replacedims(node->array.dimset0); - } - - /* Collect list of all basedims */ - basedims = nclistnew(); - for(i=0;idim.basedim == NULL) { - if(!nclistcontains(basedims,(ncelem)dim)) { - nclistpush(basedims,(ncelem)dim); - } - } - } - - nccomm->cdf.dimnodes = basedims; - - /* cleanup */ - nclistfree(alldims); - - /* Assign ncbasenames and ncfullnames to base dimensions */ - for(i=0;idim.array; - if(dim->dim.basedim != NULL) PANIC1("nonbase basedim: %s\n",dim->ocname); - /* stringdim names are already assigned */ - if(dim->ocname == NULL) { /* anonymous: use the index to compute the name */ - snprintf(tmp,sizeof(tmp),"%s_%d", - var->ncfullname,dim->dim.index1-1); - nullfree(dim->ncbasename); - dim->ncbasename = cdflegalname3(tmp); - nullfree(dim->ncfullname); - dim->ncfullname = nulldup(dim->ncbasename); - } else { /* !anonymous; use index1 if defined */ - char* legalname = cdflegalname3(dim->ocname); - nullfree(dim->ncbasename); - if(dim->dim.index1 > 0) {/* need to fix conflicting names (see above) */ - char sindex[64]; - snprintf(sindex,sizeof(sindex),"_%d",dim->dim.index1); - dim->ncbasename = (char*)malloc(strlen(sindex)+strlen(legalname)+1); - if(dim->ncbasename == NULL) return NC_ENOMEM; - strcpy(dim->ncbasename,legalname); - strcat(dim->ncbasename,sindex); - nullfree(legalname); - } else {/* standard case */ - dim->ncbasename = legalname; - } - nullfree(dim->ncfullname); - dim->ncfullname = nulldup(dim->ncbasename); - } - } - - /* Verify unique and defined names for dimensions*/ - for(i=0;idim.basedim != NULL) PANIC1("nonbase basedim: %s\n",dim1->ncbasename); - if(dim1->ncbasename == NULL || dim1->ncfullname == NULL) - PANIC1("missing dim names: %s",dim1->ocname); - /* search backward so we can delete duplicates */ - for(j=nclistlength(basedims)-1;j>i;j--) { - CDFnode* dim2 = (CDFnode*)nclistget(basedims,j); - if(strcmp(dim1->ncfullname,dim2->ncfullname)==0) { - /* complain and suppress one of them */ - fprintf(stderr,"duplicate dim names: %s[%lu] %s[%lu]\n", - dim1->ncfullname,(unsigned long)dim1->dim.declsize, - dim2->ncfullname,(unsigned long)dim2->dim.declsize); - nclistremove(basedims,j); - } - } - } - -#ifdef DEBUG -for(i=0;incfullname,(long)dim->dim.declsize); - } -#endif - - return NC_NOERR; -} - -NCerror -makegetvar34(NCDAPCOMMON* nccomm, CDFnode* var, void* data, nc_type dsttype, Getvara** getvarp) -{ - Getvara* getvar; - NCerror ncstat = NC_NOERR; - - getvar = (Getvara*)calloc(1,sizeof(Getvara)); - MEMCHECK(getvar,NC_ENOMEM); - if(getvarp) *getvarp = getvar; - - getvar->target = var; - getvar->memory = data; - getvar->dsttype = dsttype; - getvar->target = var; - if(ncstat) nullfree(getvar); - return ncstat; -} - -int -constrainable34(NC_URI* durl) -{ - char** protocol = constrainableprotocols; - for(;*protocol;protocol++) { - if(strcmp(durl->protocol,*protocol)==0) - return 1; - } - return 0; -} - -CDFnode* -makecdfnode34(NCDAPCOMMON* nccomm, char* name, OCtype octype, - /*optional*/ OCobject ocnode, CDFnode* container) -{ - CDFnode* node; - assert(nccomm != NULL); - node = (CDFnode*)calloc(1,sizeof(CDFnode)); - if(node == NULL) return (CDFnode*)NULL; - - node->ocname = NULL; - if(name) { - size_t len = strlen(name); - if(len >= NC_MAX_NAME) len = NC_MAX_NAME-1; - node->ocname = (char*)malloc(len+1); - if(node->ocname == NULL) return NULL; - memcpy(node->ocname,name,len); - node->ocname[len] = '\0'; - } - node->nctype = octypetonc(octype); - node->ocnode = ocnode; - node->subnodes = nclistnew(); - node->container = container; - if(ocnode != OCNULL) { - oc_inq_primtype(nccomm->oc.conn,ocnode,&octype); - node->etype = octypetonc(octype); - } - return node; -} - -/* Given an OCnode tree, mimic it as a CDFnode tree; - Add DAS attributes if DAS is available. Accumulate set - of all nodes in preorder. -*/ -NCerror -buildcdftree34(NCDAPCOMMON* nccomm, OCobject ocroot, OCdxd occlass, CDFnode** cdfrootp) -{ - CDFnode* root = NULL; - CDFtree* tree = (CDFtree*)calloc(1,sizeof(CDFtree)); - NCerror err = NC_NOERR; - tree->ocroot = ocroot; - tree->nodes = nclistnew(); - tree->occlass = occlass; - tree->owner = nccomm; - - err = buildcdftree34r(nccomm,ocroot,NULL,tree,&root); - if(!err) { - if(occlass != OCDAS) - fixnodes34(nccomm,tree->nodes); - if(cdfrootp) *cdfrootp = root; - } - return err; -} - -static NCerror -buildcdftree34r(NCDAPCOMMON* nccomm, OCobject ocnode, CDFnode* container, - CDFtree* tree, CDFnode** cdfnodep) -{ - unsigned int i,ocrank,ocnsubnodes; - OCtype octype; - char* ocname = NULL; - NCerror ncerr = NC_NOERR; - CDFnode* cdfnode; - - oc_inq_class(nccomm->oc.conn,ocnode,&octype); - oc_inq_name(nccomm->oc.conn,ocnode,&ocname); - oc_inq_rank(nccomm->oc.conn,ocnode,&ocrank); - oc_inq_nsubnodes(nccomm->oc.conn,ocnode,&ocnsubnodes); - - switch (octype) { - case OC_Dataset: - case OC_Grid: - case OC_Structure: - case OC_Sequence: - case OC_Primitive: - cdfnode = makecdfnode34(nccomm,ocname,octype,ocnode,container); - nclistpush(tree->nodes,(ncelem)cdfnode); - if(tree->root == NULL) { - tree->root = cdfnode; - cdfnode->tree = tree; - } - break; - - case OC_Dimension: - default: PANIC1("buildcdftree: unexpect OC node type: %d",(int)octype); - - } - /* cross link */ - cdfnode->root = tree->root; - - if(ocrank > 0) defdimensions(ocnode,cdfnode,nccomm,tree); - for(i=0;ioc.conn,ocnode,i,&ocsubnode); - ncerr = buildcdftree34r(nccomm,ocsubnode,cdfnode,tree,&subnode); - if(ncerr) return ncerr; - nclistpush(cdfnode->subnodes,(ncelem)subnode); - } - nullfree(ocname); - if(cdfnodep) *cdfnodep = cdfnode; - return ncerr; -} - -static void -defdimensions(OCobject ocnode, CDFnode* cdfnode, NCDAPCOMMON* nccomm, CDFtree* tree) -{ - unsigned int i,ocrank; - - oc_inq_rank(nccomm->oc.conn,ocnode,&ocrank); - assert(ocrank > 0); - for(i=0;ioc.conn,ocnode,i,&ocdim); - oc_inq_dim(nccomm->oc.conn,ocdim,&declsize,&ocname); - - cdfdim = makecdfnode34(nccomm,ocname,OC_Dimension, - ocdim,cdfnode->container); - nullfree(ocname); - nclistpush(tree->nodes,(ncelem)cdfdim); - /* Initially, constrained and unconstrained are same */ - cdfdim->dim.declsize = declsize; - cdfdim->dim.array = cdfnode; - if(cdfnode->array.dimset0 == NULL) - cdfnode->array.dimset0 = nclistnew(); - nclistpush(cdfnode->array.dimset0,(ncelem)cdfdim); - } -} - -/* Note: this routine only applies some common - client parameters, other routines may apply - specific ones. -*/ - -NCerror -applyclientparams34(NCDAPCOMMON* nccomm) -{ - int i,len; - int dfaltstrlen = DEFAULTSTRINGLENGTH; - int dfaltseqlim = DEFAULTSEQLIMIT; - const char* value; - char tmpname[NC_MAX_NAME+32]; - char* pathstr; - OCconnection conn = nccomm->oc.conn; - unsigned long limit; - - ASSERT(nccomm->oc.url != NULL); - - nccomm->cdf.cache->cachelimit = DFALTCACHELIMIT; - value = oc_clientparam_get(conn,"cachelimit"); - limit = getlimitnumber(value); - if(limit > 0) nccomm->cdf.cache->cachelimit = limit; - - nccomm->cdf.fetchlimit = DFALTFETCHLIMIT; - value = oc_clientparam_get(conn,"fetchlimit"); - limit = getlimitnumber(value); - if(limit > 0) nccomm->cdf.fetchlimit = limit; - - nccomm->cdf.smallsizelimit = DFALTSMALLLIMIT; - value = oc_clientparam_get(conn,"smallsizelimit"); - limit = getlimitnumber(value); - if(limit > 0) nccomm->cdf.smallsizelimit = limit; - - nccomm->cdf.cache->cachecount = DFALTCACHECOUNT; -#ifdef HAVE_GETRLIMIT - { struct rlimit rl; - if(getrlimit(RLIMIT_NOFILE, &rl) >= 0) { - nccomm->cdf.cache->cachecount = (size_t)(rl.rlim_cur / 2); - } - } -#endif - value = oc_clientparam_get(conn,"cachecount"); - limit = getlimitnumber(value); - if(limit > 0) nccomm->cdf.cache->cachecount = limit; - /* Ignore limit if not caching */ - if(!FLAGSET(nccomm->controls,NCF_CACHE)) - nccomm->cdf.cache->cachecount = 0; - - if(oc_clientparam_get(conn,"nolimit") != NULL) - dfaltseqlim = 0; - value = oc_clientparam_get(conn,"limit"); - if(value != NULL && strlen(value) != 0) { - if(sscanf(value,"%d",&len) && len > 0) dfaltseqlim = len; - } - nccomm->cdf.defaultsequencelimit = dfaltseqlim; - - /* allow embedded _ */ - value = oc_clientparam_get(conn,"stringlength"); - if(value != NULL && strlen(value) != 0) { - if(sscanf(value,"%d",&len) && len > 0) dfaltstrlen = len; - } - nccomm->cdf.defaultstringlength = dfaltstrlen; - - /* String dimension limits apply to variables */ - for(i=0;icdf.varnodes);i++) { - CDFnode* var = (CDFnode*)nclistget(nccomm->cdf.varnodes,i); - /* Define the client param stringlength for this variable*/ - var->maxstringlength = 0; /* => use global dfalt */ - strcpy(tmpname,"stringlength_"); - pathstr = makeocpathstring3(conn,var->ocnode,"."); - strcat(tmpname,pathstr); - nullfree(pathstr); - value = oc_clientparam_get(conn,tmpname); - if(value != NULL && strlen(value) != 0) { - if(sscanf(value,"%d",&len) && len > 0) var->maxstringlength = len; - } - } - /* Sequence limits apply to sequences */ - for(i=0;icdf.ddsroot->tree->nodes);i++) { - CDFnode* var = (CDFnode*)nclistget(nccomm->cdf.ddsroot->tree->nodes,i); - if(var->nctype != NC_Sequence) continue; - var->sequencelimit = dfaltseqlim; - strcpy(tmpname,"nolimit_"); - pathstr = makeocpathstring3(conn,var->ocnode,"."); - strcat(tmpname,pathstr); - if(oc_clientparam_get(conn,tmpname) != NULL) - var->sequencelimit = 0; - strcpy(tmpname,"limit_"); - strcat(tmpname,pathstr); - value = oc_clientparam_get(conn,tmpname); - if(value != NULL && strlen(value) != 0) { - if(sscanf(value,"%d",&len) && len > 0) - var->sequencelimit = len; - } - nullfree(pathstr); - } - - /* test for the appropriate fetch flags */ - value = oc_clientparam_get(conn,"fetch"); - if(value != NULL && strlen(value) > 0) { - if(value[0] == 'd' || value[0] == 'D') { - SETFLAG(nccomm->controls,NCF_ONDISK); - } - } - - /* test for the force-whole-var flag */ - value = oc_clientparam_get(conn,"wholevar"); - if(value != NULL) { - SETFLAG(nccomm->controls,NCF_WHOLEVAR); - } - - return NC_NOERR; -} - -void -freecdfroot34(CDFnode* root) -{ - int i; - CDFtree* tree; - NCDAPCOMMON* nccomm; - if(root == NULL) return; - tree = root->tree; - ASSERT((tree != NULL)); - /* Explicitly FREE the ocroot */ - nccomm = tree->owner; - oc_root_free(nccomm->oc.conn,tree->ocroot); - tree->ocroot = OCNULL; - for(i=0;inodes);i++) { - CDFnode* node = (CDFnode*)nclistget(tree->nodes,i); - free1cdfnode34(node); - } - nclistfree(tree->nodes); - nullfree(tree); -} - -/* Free up a single node, but not any - nodes it points to. -*/ -static void -free1cdfnode34(CDFnode* node) -{ - unsigned int j,k; - if(node == NULL) return; - nullfree(node->ocname); - nullfree(node->ncbasename); - nullfree(node->ncfullname); - if(node->attributes != NULL) { - for(j=0;jattributes);j++) { - NCattribute* att = (NCattribute*)nclistget(node->attributes,j); - nullfree(att->name); - for(k=0;kvalues);k++) - nullfree((char*)nclistget(att->values,k)); - nclistfree(att->values); - nullfree(att); - } - } - nullfree(node->dodsspecial.dimname); - nclistfree(node->subnodes); - nclistfree(node->attributes); - nclistfree(node->array.dimsetplus); - nclistfree(node->array.dimsetall); - nclistfree(node->array.dimset0); - - /* Clean up the ncdap4 fields also */ - nullfree(node->typename); - nullfree(node->vlenname); - nullfree(node); -} - -/* Return true if node and node1 appear to refer to the same thing; - takes grid->structure changes into account. -*/ -int -nodematch34(CDFnode* node1, CDFnode* node2) -{ - return simplenodematch34(node1,node2); -} - -int -simplenodematch34(CDFnode* node1, CDFnode* node2) -{ - if(node1 == NULL) return (node2==NULL); - if(node2 == NULL) return 0; - if(node1->nctype != node2->nctype) { - /* Check for Grid->Structure match */ - if((node1->nctype == NC_Structure && node2->nctype == NC_Grid) - || (node2->nctype == NC_Structure && node1->nctype == NC_Grid)){ - if(node1->ocname == NULL || node2->ocname == NULL - || strcmp(node1->ocname,node2->ocname) !=0) return 0; - } else return 0; - } - /* Add hack to address the screwed up Columbia server */ - if(node1->nctype == NC_Dataset) return 1; - if(node1->nctype == NC_Primitive - && node1->etype != node2->etype) return 0; - if(node1->ocname != NULL && node2->ocname != NULL - && strcmp(node1->ocname,node2->ocname)!=0) return 0; - if(nclistlength(node1->array.dimset0) - != nclistlength(node2->array.dimset0)) return 0; - return 1; -} - -/* -Given DDS node, locate the node -in a DATADDS that matches the DDS node. -Return NULL if no node found -*/ - -void -unattach34(CDFnode* root) -{ - unsigned int i; - CDFtree* xtree = root->tree; - for(i=0;inodes);i++) { - CDFnode* xnode = (CDFnode*)nclistget(xtree->nodes,i); - /* break bi-directional link */ - xnode->attachment = NULL; - } -} - -static void -setattach(CDFnode* target, CDFnode* template) -{ - target->attachment = template; - template->attachment = target; - /* Transfer important information */ - target->externaltype = template->externaltype; - target->maxstringlength = template->maxstringlength; - target->sequencelimit = template->sequencelimit; - target->ncid = template->ncid; - /* also transfer libncdap4 info */ - target->typeid = template->typeid; - target->typesize = template->typesize; -} - -static NCerror -attachdims34(CDFnode* xnode, CDFnode* template) -{ - unsigned int i; - for(i=0;iarray.dimsetall);i++) { - CDFnode* xdim = (CDFnode*)nclistget(xnode->array.dimsetall,i); - CDFnode* tdim = (CDFnode*)nclistget(template->array.dimsetall,i); - setattach(xdim,tdim); -#ifdef DEBUG2 -fprintf(stderr,"attachdim: %s->%s\n",xdim->ocname,tdim->ocname); -#endif - } - return NC_NOERR; -} - -/* -Match a DATADDS node to a DDS node. -It is assumed that both trees have been regridded if necessary. -*/ - -static NCerror -attach34r(CDFnode* xnode, NClist* templatepath, int depth) -{ - unsigned int i,plen,lastnode,gridable; - NCerror ncstat = NC_NOERR; - CDFnode* templatepathnode; - CDFnode* templatepathnext; - - plen = nclistlength(templatepath); - if(depth >= plen) {THROWCHK(ncstat=NC_EINVAL); goto done;} - - lastnode = (depth == (plen-1)); - templatepathnode = (CDFnode*)nclistget(templatepath,depth); - ASSERT((simplenodematch34(xnode,templatepathnode))); - setattach(xnode,templatepathnode); -#ifdef DEBUG2 -fprintf(stderr,"attachnode: %s->%s\n",xnode->ocname,templatepathnode->ocname); -#endif - - if(lastnode) goto done; /* We have the match and are done */ - - if(nclistlength(xnode->array.dimsetall) > 0) { - attachdims34(xnode,templatepathnode); - } - - ASSERT((!lastnode)); - templatepathnext = (CDFnode*)nclistget(templatepath,depth+1); - - gridable = (templatepathnext->nctype == NC_Grid && depth+2 < plen); - - /* Try to find an xnode subnode that matches templatepathnext */ - for(i=0;isubnodes);i++) { - CDFnode* xsubnode = (CDFnode*)nclistget(xnode->subnodes,i); - if(simplenodematch34(xsubnode,templatepathnext)) { - ncstat = attach34r(xsubnode,templatepath,depth+1); - if(ncstat) goto done; - } else if(gridable && xsubnode->nctype == NC_Primitive) { - /* grids may or may not appear in the datadds; - try to match the xnode subnodes against the parts of the grid - */ - CDFnode* templatepathnext2 = (CDFnode*)nclistget(templatepath,depth+2); - if(simplenodematch34(xsubnode,templatepathnext2)) { - ncstat = attach34r(xsubnode,templatepath,depth+2); - if(ncstat) goto done; - } - } - } -done: - return THROW(ncstat); -} - -NCerror -attach34(CDFnode* xroot, CDFnode* template) -{ - NCerror ncstat = NC_NOERR; - NClist* templatepath = nclistnew(); - CDFnode* ddsroot = template->root; - - if(xroot->attachment) unattach34(xroot); - if(ddsroot != NULL && ddsroot->attachment) unattach34(ddsroot); - if(!simplenodematch34(xroot,ddsroot)) - {THROWCHK(ncstat=NC_EINVAL); goto done;} - collectnodepath3(template,templatepath,WITHDATASET); - ncstat = attach34r(xroot,templatepath,0); -done: - nclistfree(templatepath); - return ncstat; -} - -/* -Match nodes in template tree to nodes in target tree; -template tree is typically a structural superset of target tree. -WARNING: Dimensions are not attached -*/ - -NCerror -attachsubset34(CDFnode* target, CDFnode* template) -{ - NCerror ncstat = NC_NOERR; - - if(template == NULL) {THROWCHK(ncstat=NC_NOERR); goto done;} - if(!nodematch34(target,template)) {THROWCHK(ncstat=NC_EINVAL); goto done;} -#ifdef DEBUG2 -fprintf(stderr,"attachsubset: target=%s\n",dumptree(target)); -fprintf(stderr,"attachsubset: template=%s\n",dumptree(template)); -#endif - ncstat = attachsubset34r(target,template); -done: - return ncstat; -} - -static NCerror -attachsubset34r(CDFnode* target, CDFnode* template) -{ - unsigned int i; - NCerror ncstat = NC_NOERR; - int fieldindex; - -#ifdef DEBUG2 -fprintf(stderr,"attachsubsetr: attach: target=%s template=%s\n", - target->ocname,template->ocname); -#endif - - ASSERT((nodematch34(target,template))); - setattach(target,template); - - /* Try to match target subnodes against template subnodes */ - - fieldindex = 0; - for(fieldindex=0,i=0;isubnodes) && fieldindexsubnodes);i++) { - CDFnode* templatesubnode = (CDFnode*)nclistget(template->subnodes,i); - CDFnode* targetsubnode = (CDFnode*)nclistget(target->subnodes,fieldindex); - if(nodematch34(targetsubnode,templatesubnode)) { -#ifdef DEBUG2 -fprintf(stderr,"attachsubsetr: match: %s :: %s\n",targetsubnode->ocname,templatesubnode->ocname); -#endif - ncstat = attachsubset34r(targetsubnode,templatesubnode); - if(ncstat) goto done; - fieldindex++; - } - } -done: - return THROW(ncstat); -} - -static void -getalldims34a(NClist* dimset, NClist* alldims) -{ - int i; - for(i=0;incfullname,(unsigned long)dim->dim.declsize); -#endif - nclistpush(alldims,(ncelem)dim); - } - } -} - -/* Accumulate a set of all the known dimensions - vis-a-vis defined variables -*/ -NClist* -getalldims34(NCDAPCOMMON* nccomm, int visibleonly) -{ - int i; - NClist* alldims = nclistnew(); - NClist* varnodes = nccomm->cdf.varnodes; - - /* get bag of all dimensions */ - for(i=0;ivisible) { - getalldims34a(node->array.dimsetall,alldims); - } - } - return alldims; -} diff --git a/xios_2311_src/trunk/.svn/pristine/6a/6adfd85dd9e136b75f7fd6da5dce35a79050196d.svn-base b/xios_2311_src/trunk/.svn/pristine/6a/6adfd85dd9e136b75f7fd6da5dce35a79050196d.svn-base deleted file mode 100644 index 8af2f6bed35041ed6a067b180abdd0b2c00d7d05..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/6a/6adfd85dd9e136b75f7fd6da5dce35a79050196d.svn-base +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef __XIOS_INDENT_HPP__ -#define __XIOS_INDENT_HPP__ - -#include - -namespace xios -{ - class Cindent - { - public: - static int defaultIncSize; - static int index ; - int incSize ; - int offset ; - bool reset ; - public : - - Cindent(int i=0, bool r=false) ; - Cindent operator++(int) ; - Cindent operator--(int) ; - Cindent operator++() ; - Cindent operator--() ; - Cindent operator+=(int n) ; - Cindent operator-=(int n) ; - std::ostream& iendl(std::ostream& o) const ; - }; - - std::ostream& operator <<(std::ostream& o, const Cindent& indent) ; - - extern Cindent iendl; - extern Cindent ireset; - -} -#endif diff --git a/xios_2311_src/trunk/.svn/pristine/6b/6b95cc112022172e7acedf72a934842792b12bd9.svn-base b/xios_2311_src/trunk/.svn/pristine/6b/6b95cc112022172e7acedf72a934842792b12bd9.svn-base deleted file mode 100644 index 200a6237e1dc65c4853ac85a9a55338e3f09f0b8..0000000000000000000000000000000000000000 --- a/xios_2311_src/trunk/.svn/pristine/6b/6b95cc112022172e7acedf72a934842792b12bd9.svn-base +++ /dev/null @@ -1,2303 +0,0 @@ -# Doxyfile 1.8.6 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project. -# -# All text after a double hash (##) is considered a comment and is placed in -# front of the TAG it is preceding. -# -# All text after a single hash (#) is considered a comment and will be ignored. -# The format is: -# TAG = value [value, ...] -# For lists, items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (\" \"). - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all text -# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv -# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv -# for the list of possible encodings. -# The default value is: UTF-8. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by -# double-quotes, unless you are using Doxywizard) that should identify the -# project for which the documentation is generated. This name is used in the -# title of most generated pages and in a few other places. -# The default value is: My Project. - -PROJECT_NAME = "Remap" - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. This -# could be handy for archiving the generated documentation or if some version -# control system is used. - -PROJECT_NUMBER = - -# Using the PROJECT_BRIEF tag one can provide an optional one line description -# for a project that appears at the top of each page and should give viewer a -# quick idea about the purpose of the project. Keep the description short. - -PROJECT_BRIEF = - -# With the PROJECT_LOGO tag one can specify an logo or icon that is included in -# the documentation. The maximum height of the logo should not exceed 55 pixels -# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo -# to the output directory. - -PROJECT_LOGO = - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path -# into which the generated documentation will be written. If a relative path is -# entered, it will be relative to the location where doxygen was started. If -# left blank the current directory will be used. - -OUTPUT_DIRECTORY = - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub- -# directories (in 2 levels) under the output directory of each output format and -# will distribute the generated files over these directories. Enabling this -# option can be useful when feeding doxygen a huge amount of source files, where -# putting all generated files in the same directory would otherwise causes -# performance problems for the file system. -# The default value is: NO. - -CREATE_SUBDIRS = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, -# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), -# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, -# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), -# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, -# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, -# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, -# Ukrainian and Vietnamese. -# The default value is: English. - -OUTPUT_LANGUAGE = French - -# If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member -# descriptions after the members that are listed in the file and class -# documentation (similar to Javadoc). Set to NO to disable this. -# The default value is: YES. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief -# description of a member or function before the detailed description -# -# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. -# The default value is: YES. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator that is -# used to form the text in various listings. Each string in this list, if found -# as the leading text of the brief description, will be stripped from the text -# and the result, after processing the whole list, is used as the annotated -# text. Otherwise, the brief description is used as-is. If left blank, the -# following values are used ($name is automatically replaced with the name of -# the entity):The $name class, The $name widget, The $name file, is, provides, -# specifies, contains, represents, a, an and the. - -ABBREVIATE_BRIEF = - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# doxygen will generate a detailed section even if there is only a brief -# description. -# The default value is: NO. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. -# The default value is: NO. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path -# before files name in the file list and in the header files. If set to NO the -# shortest path that makes the file name unique will be used -# The default value is: YES. - -FULL_PATH_NAMES = YES - -# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. -# Stripping is only done if one of the specified strings matches the left-hand -# part of the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the path to -# strip. -# -# Note that you can specify absolute paths here, but also relative paths, which -# will be relative from the directory where doxygen is started. -# This tag requires that the tag FULL_PATH_NAMES is set to YES. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the -# path mentioned in the documentation of a class, which tells the reader which -# header file to include in order to use a class. If left blank only the name of -# the header file containing the class definition is used. Otherwise one should -# specify the list of include paths that are normally passed to the compiler -# using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but -# less readable) file names. This can be useful is your file systems doesn't -# support long names like on DOS, Mac, or CD-ROM. -# The default value is: NO. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the -# first line (until the first dot) of a Javadoc-style comment as the brief -# description. If set to NO, the Javadoc-style will behave just like regular Qt- -# style comments (thus requiring an explicit @brief command for a brief -# description.) -# The default value is: NO. - -JAVADOC_AUTOBRIEF = NO - -# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first -# line (until the first dot) of a Qt-style comment as the brief description. If -# set to NO, the Qt-style will behave just like regular Qt-style comments (thus -# requiring an explicit \brief command for a brief description.) -# The default value is: NO. - -QT_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a -# multi-line C++ special comment block (i.e. a block of //! or /// comments) as -# a brief description. This used to be the default behavior. The new default is -# to treat a multi-line C++ comment block as a detailed description. Set this -# tag to YES if you prefer the old behavior instead. -# -# Note that setting this tag to YES also means that rational rose comments are -# not recognized any more. -# The default value is: NO. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the -# documentation from any documented member that it re-implements. -# The default value is: YES. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a -# new page for each member. If set to NO, the documentation of a member will be -# part of the file/class/namespace that contains it. -# The default value is: NO. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen -# uses this value to replace tabs by spaces in code fragments. -# Minimum value: 1, maximum value: 16, default value: 4. - -TAB_SIZE = 4 - -# This tag can be used to specify a number of aliases that act as commands in -# the documentation. An alias has the form: -# name=value -# For example adding -# "sideeffect=@par Side Effects:\n" -# will allow you to put the command \sideeffect (or @sideeffect) in the -# documentation, which will result in a user-defined paragraph with heading -# "Side Effects:". You can put \n's in the value part of an alias to insert -# newlines. - -ALIASES = - -# This tag can be used to specify a number of word-keyword mappings (TCL only). -# A mapping has the form "name=value". For example adding "class=itcl::class" -# will allow you to use the command class in the itcl::class meaning. - -TCL_SUBST = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources -# only. Doxygen will then generate output that is more tailored for C. For -# instance, some of the names that are used will be different. The list of all -# members will be omitted, etc. -# The default value is: NO. - -OPTIMIZE_OUTPUT_FOR_C = NO - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or -# Python sources only. Doxygen will then generate output that is more tailored -# for that language. For instance, namespaces will be presented as packages, -# qualified scopes will look different, etc. -# The default value is: NO. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources. Doxygen will then generate output that is tailored for Fortran. -# The default value is: NO. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for VHDL. -# The default value is: NO. - -OPTIMIZE_OUTPUT_VHDL = NO - -# Doxygen selects the parser to use depending on the extension of the files it -# parses. With this tag you can assign which parser to use for a given -# extension. Doxygen has a built-in mapping, but you can override or extend it -# using this tag. The format is ext=language, where ext is a file extension, and -# language is one of the parsers supported by doxygen: IDL, Java, Javascript, -# C#, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL. For instance to make -# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C -# (default is Fortran), use: inc=Fortran f=C. -# -# Note For files without extension you can use no_extension as a placeholder. -# -# Note that for custom extensions you also need to set FILE_PATTERNS otherwise -# the files are not read by doxygen. - -EXTENSION_MAPPING = - -# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments -# according to the Markdown format, which allows for more readable -# documentation. See http://daringfireball.net/projects/markdown/ for details. -# The output of markdown processing is further processed by doxygen, so you can -# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in -# case of backward compatibilities issues. -# The default value is: YES. - -MARKDOWN_SUPPORT = YES - -# When enabled doxygen tries to link words that correspond to documented -# classes, or namespaces to their corresponding documentation. Such a link can -# be prevented in individual cases by by putting a % sign in front of the word -# or globally by setting AUTOLINK_SUPPORT to NO. -# The default value is: YES. - -AUTOLINK_SUPPORT = YES - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should set this -# tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); -# versus func(std::string) {}). This also make the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. -# The default value is: NO. - -BUILTIN_STL_SUPPORT = NO - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. -# The default value is: NO. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: -# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen -# will parse them like normal C++ but will assume all classes use public instead -# of private inheritance when no explicit protection keyword is present. -# The default value is: NO. - -SIP_SUPPORT = NO - -# For Microsoft's IDL there are propget and propput attributes to indicate -# getter and setter methods for a property. Setting this option to YES will make -# doxygen to replace the get and set methods by a property in the documentation. -# This will only work if the methods are indeed getting or setting a simple -# type. If this is not the case, or you want to show the methods anyway, you -# should set this option to NO. -# The default value is: YES. - -IDL_PROPERTY_SUPPORT = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. -# The default value is: NO. - -DISTRIBUTE_GROUP_DOC = NO - -# Set the SUBGROUPING tag to YES to allow class member groups of the same type -# (for instance a group of public functions) to be put as a subgroup of that -# type (e.g. under the Public Functions section). Set it to NO to prevent -# subgrouping. Alternatively, this can be done per class using the -# \nosubgrouping command. -# The default value is: YES. - -SUBGROUPING = YES - -# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions -# are shown inside the group in which they are included (e.g. using \ingroup) -# instead of on a separate page (for HTML and Man pages) or section (for LaTeX -# and RTF). -# -# Note that this feature does not work in combination with -# SEPARATE_MEMBER_PAGES. -# The default value is: NO. - -INLINE_GROUPED_CLASSES = NO - -# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions -# with only public data fields or simple typedef fields will be shown inline in -# the documentation of the scope in which they are defined (i.e. file, -# namespace, or group documentation), provided this scope is documented. If set -# to NO, structs, classes, and unions are shown on a separate page (for HTML and -# Man pages) or section (for LaTeX and RTF). -# The default value is: NO. - -INLINE_SIMPLE_STRUCTS = NO - -# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or -# enum is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically be -# useful for C code in case the coding convention dictates that all compound -# types are typedef'ed and only the typedef is referenced, never the tag name. -# The default value is: NO. - -TYPEDEF_HIDES_STRUCT = NO - -# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This -# cache is used to resolve symbols given their name and scope. Since this can be -# an expensive process and often the same symbol appears multiple times in the -# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small -# doxygen will become slower. If the cache is too large, memory is wasted. The -# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range -# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 -# symbols. At the end of a run doxygen will report the cache usage and suggest -# the optimal cache size from a speed point of view. -# Minimum value: 0, maximum value: 9, default value: 0. - -LOOKUP_CACHE_SIZE = 0 - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. Private -# class members and static file members will be hidden unless the -# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. -# Note: This will also disable the warnings about undocumented members that are -# normally produced when WARNINGS is set to YES. -# The default value is: NO. - -EXTRACT_ALL = YES - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will -# be included in the documentation. -# The default value is: NO. - -EXTRACT_PRIVATE = NO - -# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal -# scope will be included in the documentation. -# The default value is: NO. - -EXTRACT_PACKAGE = NO - -# If the EXTRACT_STATIC tag is set to YES all static members of a file will be -# included in the documentation. -# The default value is: NO. - -EXTRACT_STATIC = NO - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined -# locally in source files will be included in the documentation. If set to NO -# only classes defined in header files are included. Does not have any effect -# for Java sources. -# The default value is: YES. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. When set to YES local methods, -# which are defined in the implementation section but not in the interface are -# included in the documentation. If set to NO only methods in the interface are -# included. -# The default value is: NO. - -EXTRACT_LOCAL_METHODS = NO - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base name of -# the file that contains the anonymous namespace. By default anonymous namespace -# are hidden. -# The default value is: NO. - -EXTRACT_ANON_NSPACES = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all -# undocumented members inside documented classes or files. If set to NO these -# members will be included in the various overviews, but no documentation -# section is generated. This option has no effect if EXTRACT_ALL is enabled. -# The default value is: NO. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. If set -# to NO these classes will be included in the various overviews. This option has -# no effect if EXTRACT_ALL is enabled. -# The default value is: NO. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend -# (class|struct|union) declarations. If set to NO these declarations will be -# included in the documentation. -# The default value is: NO. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any -# documentation blocks found inside the body of a function. If set to NO these -# blocks will be appended to the function's detailed documentation block. -# The default value is: NO. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation that is typed after a -# \internal command is included. If the tag is set to NO then the documentation -# will be excluded. Set it to YES to include the internal documentation. -# The default value is: NO. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file -# names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. -# The default value is: system dependent. - -CASE_SENSE_NAMES = YES - -# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with -# their full class and namespace scopes in the documentation. If set to YES the -# scope will be hidden. -# The default value is: NO. - -HIDE_SCOPE_NAMES = NO - -# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of -# the files that are included by a file in the documentation of that file. -# The default value is: YES. - -SHOW_INCLUDE_FILES = YES - -# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each -# grouped member an include statement to the documentation, telling the reader -# which file to include in order to use the member. -# The default value is: NO. - -SHOW_GROUPED_MEMB_INC = NO - -# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include -# files with double quotes in the documentation rather than with sharp brackets. -# The default value is: NO. - -FORCE_LOCAL_INCLUDES = NO - -# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the -# documentation for inline members. -# The default value is: YES. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the -# (detailed) documentation of file and class members alphabetically by member -# name. If set to NO the members will appear in declaration order. -# The default value is: YES. - -SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief -# descriptions of file, namespace and class members alphabetically by member -# name. If set to NO the members will appear in declaration order. Note that -# this will also influence the order of the classes in the class list. -# The default value is: NO. - -SORT_BRIEF_DOCS = NO - -# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the -# (brief and detailed) documentation of class members so that constructors and -# destructors are listed first. If set to NO the constructors will appear in the -# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. -# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief -# member documentation. -# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting -# detailed member documentation. -# The default value is: NO. - -SORT_MEMBERS_CTORS_1ST = NO - -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy -# of group names into alphabetical order. If set to NO the group names will -# appear in their defined order. -# The default value is: NO. - -SORT_GROUP_NAMES = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by -# fully-qualified names, including namespaces. If set to NO, the class list will -# be sorted only by class name, not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the alphabetical -# list. -# The default value is: NO. - -SORT_BY_SCOPE_NAME = NO - -# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper -# type resolution of all parameters of a function it will reject a match between -# the prototype and the implementation of a member function even if there is -# only one candidate or it is obvious which candidate to choose by doing a -# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still -# accept a match between prototype and implementation in such cases. -# The default value is: NO. - -STRICT_PROTO_MATCHING = NO - -# The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the -# todo list. This list is created by putting \todo commands in the -# documentation. -# The default value is: YES. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the -# test list. This list is created by putting \test commands in the -# documentation. -# The default value is: YES. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug -# list. This list is created by putting \bug commands in the documentation. -# The default value is: YES. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO) -# the deprecated list. This list is created by putting \deprecated commands in -# the documentation. -# The default value is: YES. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional documentation -# sections, marked by \if ... \endif and \cond -# ... \endcond blocks. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the -# initial value of a variable or macro / define can have for it to appear in the -# documentation. If the initializer consists of more lines than specified here -# it will be hidden. Use a value of 0 to hide initializers completely. The -# appearance of the value of individual variables and macros / defines can be -# controlled using \showinitializer or \hideinitializer command in the -# documentation regardless of this setting. -# Minimum value: 0, maximum value: 10000, default value: 30. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at -# the bottom of the documentation of classes and structs. If set to YES the list -# will mention the files that were used to generate the documentation. -# The default value is: YES. - -SHOW_USED_FILES = YES - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This -# will remove the Files entry from the Quick Index and from the Folder Tree View -# (if specified). -# The default value is: YES. - -SHOW_FILES = YES - -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces -# page. This will remove the Namespaces entry from the Quick Index and from the -# Folder Tree View (if specified). -# The default value is: YES. - -SHOW_NAMESPACES = YES - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command command input-file, where command is the value of the -# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided -# by doxygen. Whatever the program writes to standard output is used as the file -# version. For an example see the documentation. - -FILE_VERSION_FILTER = - -# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed -# by doxygen. The layout file controls the global structure of the generated -# output files in an output format independent way. To create the layout file -# that represents doxygen's defaults, run doxygen with the -l option. You can -# optionally specify a file name after the option, if omitted DoxygenLayout.xml -# will be used as the name of the layout file. -# -# Note that if you run doxygen from a directory containing a file called -# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE -# tag is left empty. - -LAYOUT_FILE = - -# The CITE_BIB_FILES tag can be used to specify one or more bib files containing -# the reference definitions. This must be a list of .bib files. The .bib -# extension is automatically appended if omitted. This requires the bibtex tool -# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. -# For LaTeX the style of the bibliography can be controlled using -# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the -# search path. Do not use file names with spaces, bibtex cannot handle them. See -# also \cite for info how to create references. - -CITE_BIB_FILES = - -#--------------------------------------------------------------------------- -# Configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated to -# standard output by doxygen. If QUIET is set to YES this implies that the -# messages are off. -# The default value is: NO. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES -# this implies that the warnings are on. -# -# Tip: Turn warnings on while writing the documentation. -# The default value is: YES. - -WARNINGS = YES - -# If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate -# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag -# will automatically be disabled. -# The default value is: YES. - -WARN_IF_UNDOCUMENTED = YES - -# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some parameters -# in a documented function, or documenting parameters that don't exist or using -# markup commands wrongly. -# The default value is: YES. - -WARN_IF_DOC_ERROR = YES - -# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that -# are documented, but have no documentation for their parameters or return -# value. If set to NO doxygen will only warn about wrong or incomplete parameter -# documentation, but not about the absence of documentation. -# The default value is: NO. - -WARN_NO_PARAMDOC = NO - -# The WARN_FORMAT tag determines the format of the warning messages that doxygen -# can produce. The string should contain the $file, $line, and $text tags, which -# will be replaced by the file and line number from which the warning originated -# and the warning text. Optionally the format may contain $version, which will -# be replaced by the version of the file (if it could be obtained via -# FILE_VERSION_FILTER) -# The default value is: $file:$line: $text. - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning and error -# messages should be written. If left blank the output is written to standard -# error (stderr). - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# Configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag is used to specify the files and/or directories that contain -# documented source files. You may enter file names like myfile.cpp or -# directories like /usr/src/myproject. Separate the files or directories with -# spaces. -# Note: If this tag is empty the current directory is searched. - -INPUT = src - -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses -# libiconv (or the iconv built into libc) for the transcoding. See the libiconv -# documentation (see: http://www.gnu.org/software/libiconv) for the list of -# possible encodings. -# The default value is: UTF-8. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and -# *.h) to filter out the source-files in the directories. If left blank the -# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii, -# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp, -# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown, -# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, -# *.qsf, *.as and *.js. - -FILE_PATTERNS = - -# The RECURSIVE tag can be used to specify whether or not subdirectories should -# be searched for input files as well. -# The default value is: NO. - -RECURSIVE = NO - -# The EXCLUDE tag can be used to specify files and/or directories that should be -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. -# -# Note that relative paths are relative to the directory from which doxygen is -# run. - -EXCLUDE = - -# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or -# directories that are symbolic links (a Unix file system feature) are excluded -# from the input. -# The default value is: NO. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. -# -# Note that the wildcards are matched against the file with absolute path, so to -# exclude all test directories for example use the pattern */test/* - -EXCLUDE_PATTERNS = - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test -# -# Note that the wildcards are matched against the file with absolute path, so to -# exclude all test directories use the pattern */test/* - -EXCLUDE_SYMBOLS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or directories -# that contain example code fragments that are included (see the \include -# command). - -EXAMPLE_PATH = - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and -# *.h) to filter out the source-files in the directories. If left blank all -# files are included. - -EXAMPLE_PATTERNS = - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude commands -# irrespective of the value of the RECURSIVE tag. -# The default value is: NO. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or directories -# that contain images that are to be included in the documentation (see the -# \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command: -# -# -# -# where is the value of the INPUT_FILTER tag, and is the -# name of an input file. Doxygen will then use the output that the filter -# program writes to standard output. If FILTER_PATTERNS is specified, this tag -# will be ignored. -# -# Note that the filter must not add or remove lines; it is applied before the -# code is scanned, but not when the output code is generated. If lines are added -# or removed, the anchors will not be placed correctly. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: pattern=filter -# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how -# filters are used. If the FILTER_PATTERNS tag is empty or if none of the -# patterns match the file name, INPUT_FILTER is applied. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER ) will also be used to filter the input files that are used for -# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). -# The default value is: NO. - -FILTER_SOURCE_FILES = NO - -# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file -# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and -# it is also possible to disable source filtering for a specific pattern using -# *.ext= (so without naming a filter). -# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. - -FILTER_SOURCE_PATTERNS = - -# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that -# is part of the input, its contents will be placed on the main page -# (index.html). This can be useful if you have a project on for instance GitHub -# and want to reuse the introduction page also for the doxygen output. - -USE_MDFILE_AS_MAINPAGE = - -#--------------------------------------------------------------------------- -# Configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will be -# generated. Documented entities will be cross-referenced with these sources. -# -# Note: To get rid of all source code in the generated output, make sure that -# also VERBATIM_HEADERS is set to NO. -# The default value is: NO. - -SOURCE_BROWSER = NO - -# Setting the INLINE_SOURCES tag to YES will include the body of functions, -# classes and enums directly into the documentation. -# The default value is: NO. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any -# special comment blocks from generated source code fragments. Normal C, C++ and -# Fortran comments will always remain visible. -# The default value is: YES. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES then for each documented -# function all documented functions referencing it will be listed. -# The default value is: NO. - -REFERENCED_BY_RELATION = NO - -# If the REFERENCES_RELATION tag is set to YES then for each documented function -# all documented entities called/used by that function will be listed. -# The default value is: NO. - -REFERENCES_RELATION = NO - -# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set -# to YES, then the hyperlinks from functions in REFERENCES_RELATION and -# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will -# link to the documentation. -# The default value is: YES. - -REFERENCES_LINK_SOURCE = YES - -# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the -# source code will show a tooltip with additional information such as prototype, -# brief description and links to the definition and documentation. Since this -# will make the HTML file larger and loading of large files a bit slower, you -# can opt to disable this feature. -# The default value is: YES. -# This tag requires that the tag SOURCE_BROWSER is set to YES. - -SOURCE_TOOLTIPS = YES - -# If the USE_HTAGS tag is set to YES then the references to source code will -# point to the HTML generated by the htags(1) tool instead of doxygen built-in -# source browser. The htags tool is part of GNU's global source tagging system -# (see http://www.gnu.org/software/global/global.html). You will need version -# 4.8.6 or higher. -# -# To use it do the following: -# - Install the latest version of global -# - Enable SOURCE_BROWSER and USE_HTAGS in the config file -# - Make sure the INPUT points to the root of the source tree -# - Run doxygen as normal -# -# Doxygen will invoke htags (and that will in turn invoke gtags), so these -# tools must be available from the command line (i.e. in the search path). -# -# The result: instead of the source browser generated by doxygen, the links to -# source code will now point to the output of htags. -# The default value is: NO. -# This tag requires that the tag SOURCE_BROWSER is set to YES. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a -# verbatim copy of the header file for each class for which an include is -# specified. Set to NO to disable this. -# See also: Section \class. -# The default value is: YES. - -VERBATIM_HEADERS = YES - -#--------------------------------------------------------------------------- -# Configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all -# compounds will be generated. Enable this if the project contains a lot of -# classes, structs, unions or interfaces. -# The default value is: YES. - -ALPHABETICAL_INDEX = YES - -# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in -# which the alphabetical index list will be split. -# Minimum value: 1, maximum value: 20, default value: 5. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all classes will -# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag -# can be used to specify a prefix (or a list of prefixes) that should be ignored -# while generating the index headers. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output -# The default value is: YES. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a -# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of -# it. -# The default directory is: html. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each -# generated HTML page (for example: .htm, .php, .asp). -# The default value is: .html. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a user-defined HTML header file for -# each generated HTML page. If the tag is left blank doxygen will generate a -# standard header. -# -# To get valid HTML the header file that includes any scripts and style sheets -# that doxygen needs, which is dependent on the configuration options used (e.g. -# the setting GENERATE_TREEVIEW). It is highly recommended to start with a -# default header using -# doxygen -w html new_header.html new_footer.html new_stylesheet.css -# YourConfigFile -# and then modify the file new_header.html. See also section "Doxygen usage" -# for information on how to generate the default header that doxygen normally -# uses. -# Note: The header is subject to change so you typically have to regenerate the -# default header when upgrading to a newer version of doxygen. For a description -# of the possible markers and block names see the documentation. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each -# generated HTML page. If the tag is left blank doxygen will generate a standard -# footer. See HTML_HEADER for more information on how to generate a default -# footer and what special commands can be used inside the footer. See also -# section "Doxygen usage" for information on how to generate the default footer -# that doxygen normally uses. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style -# sheet that is used by each HTML page. It can be used to fine-tune the look of -# the HTML output. If left blank doxygen will generate a default style sheet. -# See also section "Doxygen usage" for information on how to generate the style -# sheet that doxygen normally uses. -# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as -# it is more robust and this tag (HTML_STYLESHEET) will in the future become -# obsolete. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_STYLESHEET = - -# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional user- -# defined cascading style sheet that is included after the standard style sheets -# created by doxygen. Using this option one can overrule certain style aspects. -# This is preferred over using HTML_STYLESHEET since it does not replace the -# standard style sheet and is therefor more robust against future updates. -# Doxygen will copy the style sheet file to the output directory. For an example -# see the documentation. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_EXTRA_STYLESHEET = - -# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or -# other source files which should be copied to the HTML output directory. Note -# that these files will be copied to the base HTML output directory. Use the -# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these -# files. In the HTML_STYLESHEET file, use the file name only. Also note that the -# files will be copied as-is; there are no commands or markers available. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_EXTRA_FILES = - -# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen -# will adjust the colors in the stylesheet and background images according to -# this color. Hue is specified as an angle on a colorwheel, see -# http://en.wikipedia.org/wiki/Hue for more information. For instance the value -# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 -# purple, and 360 is red again. -# Minimum value: 0, maximum value: 359, default value: 220. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_HUE = 220 - -# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors -# in the HTML output. For a value of 0 the output will use grayscales only. A -# value of 255 will produce the most vivid colors. -# Minimum value: 0, maximum value: 255, default value: 100. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_SAT = 100 - -# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the -# luminance component of the colors in the HTML output. Values below 100 -# gradually make the output lighter, whereas values above 100 make the output -# darker. The value divided by 100 is the actual gamma applied, so 80 represents -# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not -# change the gamma. -# Minimum value: 40, maximum value: 240, default value: 80. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_GAMMA = 80 - -# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML -# page will contain the date and time when the page was generated. Setting this -# to NO can help when comparing the output of multiple runs. -# The default value is: YES. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_TIMESTAMP = YES - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_DYNAMIC_SECTIONS = NO - -# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries -# shown in the various tree structured indices initially; the user can expand -# and collapse entries dynamically later on. Doxygen will expand the tree to -# such a level that at most the specified number of entries are visible (unless -# a fully collapsed tree already exceeds this amount). So setting the number of -# entries 1 will produce a full collapsed tree by default. 0 is a special value -# representing an infinite number of entries and will result in a full expanded -# tree by default. -# Minimum value: 0, maximum value: 9999, default value: 100. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_INDEX_NUM_ENTRIES = 100 - -# If the GENERATE_DOCSET tag is set to YES, additional index files will be -# generated that can be used as input for Apple's Xcode 3 integrated development -# environment (see: http://developer.apple.com/tools/xcode/), introduced with -# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a -# Makefile in the HTML output directory. Running make will produce the docset in -# that directory and running make install will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at -# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html -# for more information. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_DOCSET = NO - -# This tag determines the name of the docset feed. A documentation feed provides -# an umbrella under which multiple documentation sets from a single provider -# (such as a company or product suite) can be grouped. -# The default value is: Doxygen generated docs. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_FEEDNAME = "Doxygen generated docs" - -# This tag specifies a string that should uniquely identify the documentation -# set bundle. This should be a reverse domain-name style string, e.g. -# com.mycompany.MyDocSet. Doxygen will append .docset to the name. -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_BUNDLE_ID = org.doxygen.Project - -# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify -# the documentation publisher. This should be a reverse domain-name style -# string, e.g. com.mycompany.MyDocSet.documentation. -# The default value is: org.doxygen.Publisher. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_PUBLISHER_ID = org.doxygen.Publisher - -# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. -# The default value is: Publisher. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_PUBLISHER_NAME = Publisher - -# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three -# additional HTML index files: index.hhp, index.hhc, and index.hhk. The -# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop -# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on -# Windows. -# -# The HTML Help Workshop contains a compiler that can convert all HTML output -# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML -# files are now used as the Windows 98 help format, and will replace the old -# Windows help format (.hlp) on all Windows platforms in the future. Compressed -# HTML files also contain an index, a table of contents, and you can search for -# words in the documentation. The HTML workshop also contains a viewer for -# compressed HTML files. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_HTMLHELP = NO - -# The CHM_FILE tag can be used to specify the file name of the resulting .chm -# file. You can add a path in front of the file if the result should not be -# written to the html output directory. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -CHM_FILE = - -# The HHC_LOCATION tag can be used to specify the location (absolute path -# including file name) of the HTML help compiler ( hhc.exe). If non-empty -# doxygen will try to run the HTML help compiler on the generated index.hhp. -# The file has to be specified with full path. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -HHC_LOCATION = - -# The GENERATE_CHI flag controls if a separate .chi index file is generated ( -# YES) or that it should be included in the master .chm file ( NO). -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -GENERATE_CHI = NO - -# The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc) -# and project file content. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -CHM_INDEX_ENCODING = - -# The BINARY_TOC flag controls whether a binary table of contents is generated ( -# YES) or a normal table of contents ( NO) in the .chm file. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members to -# the table of contents of the HTML help documentation and to the tree view. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -TOC_EXPAND = NO - -# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and -# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that -# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help -# (.qch) of the generated HTML documentation. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_QHP = NO - -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify -# the file name of the resulting .qch file. The path specified is relative to -# the HTML output folder. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QCH_FILE = - -# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help -# Project output. For more information please see Qt Help Project / Namespace -# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_NAMESPACE = org.doxygen.Project - -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt -# Help Project output. For more information please see Qt Help Project / Virtual -# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- -# folders). -# The default value is: doc. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_VIRTUAL_FOLDER = doc - -# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom -# filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_CUST_FILTER_NAME = - -# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the -# custom filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_CUST_FILTER_ATTRS = - -# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this -# project's filter section matches. Qt Help Project / Filter Attributes (see: -# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_SECT_FILTER_ATTRS = - -# The QHG_LOCATION tag can be used to specify the location of Qt's -# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the -# generated .qhp file. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHG_LOCATION = - -# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be -# generated, together with the HTML files, they form an Eclipse help plugin. To -# install this plugin and make it available under the help contents menu in -# Eclipse, the contents of the directory containing the HTML and XML files needs -# to be copied into the plugins directory of eclipse. The name of the directory -# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. -# After copying Eclipse needs to be restarted before the help appears. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_ECLIPSEHELP = NO - -# A unique identifier for the Eclipse help plugin. When installing the plugin -# the directory name containing the HTML and XML files should also have this -# name. Each documentation set should have its own identifier. -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. - -ECLIPSE_DOC_ID = org.doxygen.Project - -# If you want full control over the layout of the generated HTML pages it might -# be necessary to disable the index and replace it with your own. The -# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top -# of each HTML page. A value of NO enables the index and the value YES disables -# it. Since the tabs in the index contain the same information as the navigation -# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -DISABLE_INDEX = NO - -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. If the tag -# value is set to YES, a side panel will be generated containing a tree-like -# index structure (just like the one that is generated for HTML Help). For this -# to work a browser that supports JavaScript, DHTML, CSS and frames is required -# (i.e. any modern browser). Windows users are probably better off using the -# HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can -# further fine-tune the look of the index. As an example, the default style -# sheet generated by doxygen has an example that shows how to put an image at -# the root of the tree instead of the PROJECT_NAME. Since the tree basically has -# the same information as the tab index, you could consider setting -# DISABLE_INDEX to YES when enabling this option. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_TREEVIEW = NO - -# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that -# doxygen will group on one line in the generated HTML documentation. -# -# Note that a value of 0 will completely suppress the enum values from appearing -# in the overview section. -# Minimum value: 0, maximum value: 20, default value: 4. -# This tag requires that the tag GENERATE_HTML is set to YES. - -ENUM_VALUES_PER_LINE = 4 - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used -# to set the initial width (in pixels) of the frame in which the tree is shown. -# Minimum value: 0, maximum value: 1500, default value: 250. -# This tag requires that the tag GENERATE_HTML is set to YES. - -TREEVIEW_WIDTH = 250 - -# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to -# external symbols imported via tag files in a separate window. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -EXT_LINKS_IN_WINDOW = NO - -# Use this tag to change the font size of LaTeX formulas included as images in -# the HTML documentation. When you change the font size after a successful -# doxygen run you need to manually remove any form_*.png images from the HTML -# output directory to force them to be regenerated. -# Minimum value: 8, maximum value: 50, default value: 10. -# This tag requires that the tag GENERATE_HTML is set to YES. - -FORMULA_FONTSIZE = 10 - -# Use the FORMULA_TRANPARENT tag to determine whether or not the images -# generated for formulas are transparent PNGs. Transparent PNGs are not -# supported properly for IE 6.0, but are supported on all modern browsers. -# -# Note that when changing this option you need to delete any form_*.png files in -# the HTML output directory before the changes have effect. -# The default value is: YES. -# This tag requires that the tag GENERATE_HTML is set to YES. - -FORMULA_TRANSPARENT = YES - -# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see -# http://www.mathjax.org) which uses client side Javascript for the rendering -# instead of using prerendered bitmaps. Use this if you do not have LaTeX -# installed or if you want to formulas look prettier in the HTML output. When -# enabled you may also need to install MathJax separately and configure the path -# to it using the MATHJAX_RELPATH option. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -USE_MATHJAX = NO - -# When MathJax is enabled you can set the default output format to be used for -# the MathJax output. See the MathJax site (see: -# http://docs.mathjax.org/en/latest/output.html) for more details. -# Possible values are: HTML-CSS (which is slower, but has the best -# compatibility), NativeMML (i.e. MathML) and SVG. -# The default value is: HTML-CSS. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_FORMAT = HTML-CSS - -# When MathJax is enabled you need to specify the location relative to the HTML -# output directory using the MATHJAX_RELPATH option. The destination directory -# should contain the MathJax.js script. For instance, if the mathjax directory -# is located at the same level as the HTML output directory, then -# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax -# Content Delivery Network so you can quickly see the result without installing -# MathJax. However, it is strongly recommended to install a local copy of -# MathJax from http://www.mathjax.org before deployment. -# The default value is: http://cdn.mathjax.org/mathjax/latest. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest - -# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax -# extension names that should be enabled during MathJax rendering. For example -# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_EXTENSIONS = - -# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces -# of code that will be used on startup of the MathJax code. See the MathJax site -# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an -# example see the documentation. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_CODEFILE = - -# When the SEARCHENGINE tag is enabled doxygen will generate a search box for -# the HTML output. The underlying search engine uses javascript and DHTML and -# should work on any modern browser. Note that when using HTML help -# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) -# there is already a search function so this one should typically be disabled. -# For large projects the javascript based search engine can be slow, then -# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to -# search using the keyboard; to jump to the search box use + S -# (what the is depends on the OS and browser, but it is typically -# , /