mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-15 16:18:22 +01:00
working on fortran/test integration
git-svn-id: svn://136.177.114.72/svn_GW/IPhreeqc/trunk@9360 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
parent
613c643952
commit
68cb2cc5e5
@ -1,10 +1,10 @@
|
||||
cmake_minimum_required (VERSION 2.8.11)
|
||||
cmake_minimum_required (VERSION 3.0.2)
|
||||
|
||||
##include(CheckLanguage)
|
||||
##check_language(Fortran)
|
||||
##if (CMAKE_Fortran_COMPILER)
|
||||
## enable_language(Fortran)
|
||||
##endif()
|
||||
include(CheckLanguage)
|
||||
check_language(Fortran)
|
||||
if (CMAKE_Fortran_COMPILER)
|
||||
enable_language(Fortran)
|
||||
endif()
|
||||
|
||||
if (POLICY CMP0054)
|
||||
cmake_policy(PUSH)
|
||||
@ -21,22 +21,21 @@ endif()
|
||||
## set(CMAKE_INSTALL_DOCDIR "doc")
|
||||
##endif()
|
||||
|
||||
### Maybe this should be in subdir Tests
|
||||
###
|
||||
##if (NOT PHREEQCRM_BUILD_FORTRAN)
|
||||
## if (NOT CMAKE_Fortran_COMPILER OR CMAKE_Fortran_COMPILER STREQUAL "CMAKE_Fortran_COMPILER-NOTFOUND")
|
||||
## option (PHREEQCRM_BUILD_FORTRAN "Build FORTRAN support" OFF)
|
||||
## else()
|
||||
## option (PHREEQCRM_BUILD_FORTRAN "Build FORTRAN support" ON)
|
||||
## endif()
|
||||
##else()
|
||||
## if (PHREEQCRM_BUILD_FORTRAN)
|
||||
## enable_language(Fortran)
|
||||
## ##include(FortranCInterface)
|
||||
## ##FortranCInterface_HEADER(FC.h MACRO_NAMESPACE "FC_")
|
||||
## ##FortranCInterface_VERIFY(CXX QUIET)
|
||||
## endif()
|
||||
##endif()
|
||||
# Fortran
|
||||
if (NOT IPHREEQC_BUILD_FORTRAN)
|
||||
if (NOT CMAKE_Fortran_COMPILER OR CMAKE_Fortran_COMPILER STREQUAL "CMAKE_Fortran_COMPILER-NOTFOUND")
|
||||
option (IPHREEQC_BUILD_FORTRAN "Build FORTRAN support" OFF)
|
||||
else()
|
||||
option (IPHREEQC_BUILD_FORTRAN "Build FORTRAN support" ON)
|
||||
endif()
|
||||
else()
|
||||
if (IPHREEQC_BUILD_FORTRAN)
|
||||
enable_language(Fortran)
|
||||
##include(FortranCInterface)
|
||||
##FortranCInterface_HEADER(FC.h MACRO_NAMESPACE "FC_")
|
||||
##FortranCInterface_VERIFY(CXX QUIET)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
@ -60,6 +59,7 @@ src/ErrorReporter.hxx
|
||||
src/IPhreeqc.cpp
|
||||
src/IPhreeqc.h
|
||||
src/IPhreeqc.hpp
|
||||
src/IPhreeqc_interface_F.cpp
|
||||
src/IPhreeqcCallbacks.h
|
||||
src/IPhreeqcLib.cpp
|
||||
src/Var.c
|
||||
@ -212,20 +212,20 @@ SET_SOURCE_FILES_PROPERTIES(src/Var.c PROPERTIES LANGUAGE CXX)
|
||||
##endif ()
|
||||
|
||||
|
||||
if (IPHREEQC_BUILD_FORTRAN AND MSVC)
|
||||
SET(IPhreeqc_SOURCES
|
||||
${IPhreeqc_SOURCES}
|
||||
src/fwrap.cpp
|
||||
src/fwrap1.cpp
|
||||
src/fwrap2.cpp
|
||||
src/fwrap3.cpp
|
||||
src/fwrap4.cpp
|
||||
src/fwrap5.cpp
|
||||
src/fwrap6.cpp
|
||||
src/fwrap7.cpp
|
||||
src/fwrap8.cpp
|
||||
)
|
||||
endif ()
|
||||
##if (IPHREEQC_BUILD_FORTRAN AND MSVC)
|
||||
## SET(IPhreeqc_SOURCES
|
||||
## ${IPhreeqc_SOURCES}
|
||||
## src/fwrap.cpp
|
||||
## src/fwrap1.cpp
|
||||
## src/fwrap2.cpp
|
||||
## src/fwrap3.cpp
|
||||
## src/fwrap4.cpp
|
||||
## src/fwrap5.cpp
|
||||
## src/fwrap6.cpp
|
||||
## src/fwrap7.cpp
|
||||
## src/fwrap8.cpp
|
||||
## )
|
||||
##endif ()
|
||||
|
||||
# setup include directories
|
||||
include_directories("${PROJECT_SOURCE_DIR}")
|
||||
@ -329,7 +329,7 @@ endif()
|
||||
## )
|
||||
##ENDIF(MSVC)
|
||||
|
||||
### tests
|
||||
##enable_testing()
|
||||
##
|
||||
##add_subdirectory(Tests)
|
||||
# tests
|
||||
enable_testing()
|
||||
|
||||
add_subdirectory(tests)
|
||||
|
||||
@ -1,6 +1,22 @@
|
||||
#ifndef IPHREEQC_NO_FORTRAN_MODULE
|
||||
MODULE IPhreeqc
|
||||
implicit none
|
||||
|
||||
! GetSelectedOutputValue TYPES
|
||||
INTEGER(KIND=4),PARAMETER :: TT_EMPTY = 0
|
||||
INTEGER(KIND=4),PARAMETER :: TT_ERROR = 1
|
||||
INTEGER(KIND=4),PARAMETER :: TT_DOUBLE = 3
|
||||
INTEGER(KIND=4),PARAMETER :: TT_STRING = 4
|
||||
|
||||
! ERROR RETURN TYPES
|
||||
INTEGER(KIND=4),PARAMETER :: IPQ_OK = 0
|
||||
INTEGER(KIND=4),PARAMETER :: IPQ_OUTOFMEMORY = -1
|
||||
INTEGER(KIND=4),PARAMETER :: IPQ_BADVARTYPE = -2
|
||||
INTEGER(KIND=4),PARAMETER :: IPQ_INVALIDARG = -3
|
||||
INTEGER(KIND=4),PARAMETER :: IPQ_INVALIDROW = -4
|
||||
INTEGER(KIND=4),PARAMETER :: IPQ_INVALIDCOL = -5
|
||||
INTEGER(KIND=4),PARAMETER :: IPQ_BADINSTANCE = -6
|
||||
|
||||
SAVE
|
||||
CONTAINS
|
||||
|
||||
|
||||
@ -83,74 +83,73 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
IPQ_RESULT AccumulateLineF(int *id, char *line);
|
||||
int AddErrorF(int *id, char *error_msg);
|
||||
int AddWarningF(int *id, char *warn_msg);
|
||||
IPQ_RESULT ClearAccumulatedLinesF(int *id);
|
||||
int CreateIPhreeqcF(void);
|
||||
int DestroyIPhreeqcF(int *id);
|
||||
void GetComponentF(int *id, int* n, char* line, int* line_length);
|
||||
int GetComponentCountF(int *id);
|
||||
int GetCurrentSelectedOutputUserNumberF(int *id);
|
||||
void GetDumpFileNameF(int *id, char* filename, int* filename_length);
|
||||
int GetDumpFileOnF(int *id);
|
||||
void GetDumpStringLineF(int *id, int* n, char* line, int* line_length);
|
||||
int GetDumpStringLineCountF(int *id);
|
||||
int GetDumpStringOnF(int *id);
|
||||
void GetErrorFileNameF(int *id, char* filename, int* filename_length);
|
||||
int GetErrorFileOnF(int *id);
|
||||
void GetErrorStringLineF(int *id, int* n, char* line, int* line_length);
|
||||
int GetErrorStringLineCountF(int *id);
|
||||
int GetErrorStringOnF(int *id);
|
||||
void GetLogFileNameF(int *id, char* filename, int* filename_length);
|
||||
int GetLogFileOnF(int *id);
|
||||
void GetLogStringLineF(int *id, int* n, char* line, int* line_length);
|
||||
int GetLogStringLineCountF(int *id);
|
||||
int GetLogStringOnF(int *id);
|
||||
int GetNthSelectedOutputUserNumberF(int *id, int* n);
|
||||
void GetOutputFileNameF(int *id, char* filename, int* filename_length);
|
||||
int GetOutputFileOnF(int *id);
|
||||
void GetOutputStringLineF(int *id, int* n, char* line, int* line_length);
|
||||
int GetOutputStringLineCountF(int *id);
|
||||
int GetOutputStringOnF(int *id);
|
||||
int GetSelectedOutputColumnCountF(int *id);
|
||||
int GetSelectedOutputCountF(int *id);
|
||||
void GetSelectedOutputFileNameF(int *id, char* filename, int* filename_length);
|
||||
int GetSelectedOutputFileOnF(int *id);
|
||||
int GetSelectedOutputRowCountF(int *id);
|
||||
void GetSelectedOutputStringLineF(int *id, int* n, char* line, int* line_length);
|
||||
int GetSelectedOutputStringLineCountF(int *id);
|
||||
int GetSelectedOutputStringOnF(int *id);
|
||||
IPQ_RESULT GetSelectedOutputValueF(int *id, int *row, int *col, int *vtype, double* dvalue, char* svalue, int* svalue_length);
|
||||
void GetVersionStringF(char* version, int* version_length);
|
||||
void GetWarningStringLineF(int *id, int* n, char* line, int* line_length);
|
||||
int GetWarningStringLineCountF(int *id);
|
||||
int LoadDatabaseF(int *id, char* filename);
|
||||
int LoadDatabaseStringF(int *id, char* input);
|
||||
void OutputAccumulatedLinesF(int *id);
|
||||
void OutputErrorStringF(int *id);
|
||||
void OutputWarningStringF(int *id);
|
||||
int RunAccumulatedF(int *id);
|
||||
int RunFileF(int *id, char* filename);
|
||||
int RunStringF(int *id, char* input);
|
||||
IPQ_RESULT SetBasicFortranCallbackF(int *id, double (*fcn)(double *x1, double *x2, char *str, size_t l));
|
||||
IPQ_RESULT SetCurrentSelectedOutputUserNumberF(int *id, int *n);
|
||||
IPQ_RESULT SetDumpFileNameF(int *id, char* fname);
|
||||
IPQ_RESULT SetDumpFileOnF(int *id, int* dump_on);
|
||||
IPQ_RESULT SetDumpStringOnF(int *id, int* dump_string_on);
|
||||
IPQ_RESULT SetErrorFileNameF(int *id, char* fname);
|
||||
IPQ_RESULT SetErrorFileOnF(int *id, int* error_file_on);
|
||||
IPQ_RESULT SetErrorStringOnF(int *id, int* error_string_on);
|
||||
IPQ_RESULT SetLogFileNameF(int *id, char* fname);
|
||||
IPQ_RESULT SetLogFileOnF(int *id, int* log_file_on);
|
||||
IPQ_RESULT SetLogStringOnF(int *id, int* log_string_on);
|
||||
IPQ_RESULT SetOutputFileNameF(int *id, char* fname);
|
||||
IPQ_RESULT SetOutputFileOnF(int *id, int* output_on);
|
||||
IPQ_RESULT SetOutputStringOnF(int *id, int* output_string_on);
|
||||
IPQ_RESULT SetSelectedOutputFileNameF(int *id, char* fname);
|
||||
IPQ_RESULT SetSelectedOutputFileOnF(int *id, int* selected_output_file_on);
|
||||
IPQ_RESULT SetSelectedOutputStringOnF(int *id, int* selected_output_string_on);
|
||||
|
||||
IPQ_DLL_EXPORT IPQ_RESULT AccumulateLineF(int *id, char *line);
|
||||
IPQ_DLL_EXPORT int AddErrorF(int *id, char *error_msg);
|
||||
IPQ_DLL_EXPORT int AddWarningF(int *id, char *warn_msg);
|
||||
IPQ_DLL_EXPORT IPQ_RESULT ClearAccumulatedLinesF(int *id);
|
||||
IPQ_DLL_EXPORT int CreateIPhreeqcF(void);
|
||||
IPQ_DLL_EXPORT int DestroyIPhreeqcF(int *id);
|
||||
IPQ_DLL_EXPORT void GetComponentF(int *id, int* n, char* line, int* line_length);
|
||||
IPQ_DLL_EXPORT int GetComponentCountF(int *id);
|
||||
IPQ_DLL_EXPORT int GetCurrentSelectedOutputUserNumberF(int *id);
|
||||
IPQ_DLL_EXPORT void GetDumpFileNameF(int *id, char* filename, int* filename_length);
|
||||
IPQ_DLL_EXPORT int GetDumpFileOnF(int *id);
|
||||
IPQ_DLL_EXPORT void GetDumpStringLineF(int *id, int* n, char* line, int* line_length);
|
||||
IPQ_DLL_EXPORT int GetDumpStringLineCountF(int *id);
|
||||
IPQ_DLL_EXPORT int GetDumpStringOnF(int *id);
|
||||
IPQ_DLL_EXPORT void GetErrorFileNameF(int *id, char* filename, int* filename_length);
|
||||
IPQ_DLL_EXPORT int GetErrorFileOnF(int *id);
|
||||
IPQ_DLL_EXPORT void GetErrorStringLineF(int *id, int* n, char* line, int* line_length);
|
||||
IPQ_DLL_EXPORT int GetErrorStringLineCountF(int *id);
|
||||
IPQ_DLL_EXPORT int GetErrorStringOnF(int *id);
|
||||
IPQ_DLL_EXPORT void GetLogFileNameF(int *id, char* filename, int* filename_length);
|
||||
IPQ_DLL_EXPORT int GetLogFileOnF(int *id);
|
||||
IPQ_DLL_EXPORT void GetLogStringLineF(int *id, int* n, char* line, int* line_length);
|
||||
IPQ_DLL_EXPORT int GetLogStringLineCountF(int *id);
|
||||
IPQ_DLL_EXPORT int GetLogStringOnF(int *id);
|
||||
IPQ_DLL_EXPORT int GetNthSelectedOutputUserNumberF(int *id, int* n);
|
||||
IPQ_DLL_EXPORT void GetOutputFileNameF(int *id, char* filename, int* filename_length);
|
||||
IPQ_DLL_EXPORT int GetOutputFileOnF(int *id);
|
||||
IPQ_DLL_EXPORT void GetOutputStringLineF(int *id, int* n, char* line, int* line_length);
|
||||
IPQ_DLL_EXPORT int GetOutputStringLineCountF(int *id);
|
||||
IPQ_DLL_EXPORT int GetOutputStringOnF(int *id);
|
||||
IPQ_DLL_EXPORT int GetSelectedOutputColumnCountF(int *id);
|
||||
IPQ_DLL_EXPORT int GetSelectedOutputCountF(int *id);
|
||||
IPQ_DLL_EXPORT void GetSelectedOutputFileNameF(int *id, char* filename, int* filename_length);
|
||||
IPQ_DLL_EXPORT int GetSelectedOutputFileOnF(int *id);
|
||||
IPQ_DLL_EXPORT int GetSelectedOutputRowCountF(int *id);
|
||||
IPQ_DLL_EXPORT void GetSelectedOutputStringLineF(int *id, int* n, char* line, int* line_length);
|
||||
IPQ_DLL_EXPORT int GetSelectedOutputStringLineCountF(int *id);
|
||||
IPQ_DLL_EXPORT int GetSelectedOutputStringOnF(int *id);
|
||||
IPQ_DLL_EXPORT IPQ_RESULT GetSelectedOutputValueF(int *id, int *row, int *col, int *vtype, double* dvalue, char* svalue, int* svalue_length);
|
||||
IPQ_DLL_EXPORT void GetVersionStringF(char* version, int* version_length);
|
||||
IPQ_DLL_EXPORT void GetWarningStringLineF(int *id, int* n, char* line, int* line_length);
|
||||
IPQ_DLL_EXPORT int GetWarningStringLineCountF(int *id);
|
||||
IPQ_DLL_EXPORT int LoadDatabaseF(int *id, char* filename);
|
||||
IPQ_DLL_EXPORT int LoadDatabaseStringF(int *id, char* input);
|
||||
IPQ_DLL_EXPORT void OutputAccumulatedLinesF(int *id);
|
||||
IPQ_DLL_EXPORT void OutputErrorStringF(int *id);
|
||||
IPQ_DLL_EXPORT void OutputWarningStringF(int *id);
|
||||
IPQ_DLL_EXPORT int RunAccumulatedF(int *id);
|
||||
IPQ_DLL_EXPORT int RunFileF(int *id, char* filename);
|
||||
IPQ_DLL_EXPORT int RunStringF(int *id, char* input);
|
||||
IPQ_DLL_EXPORT IPQ_RESULT SetBasicFortranCallbackF(int *id, double (*fcn)(double *x1, double *x2, char *str, size_t l));
|
||||
IPQ_DLL_EXPORT IPQ_RESULT SetCurrentSelectedOutputUserNumberF(int *id, int *n);
|
||||
IPQ_DLL_EXPORT IPQ_RESULT SetDumpFileNameF(int *id, char* fname);
|
||||
IPQ_DLL_EXPORT IPQ_RESULT SetDumpFileOnF(int *id, int* dump_on);
|
||||
IPQ_DLL_EXPORT IPQ_RESULT SetDumpStringOnF(int *id, int* dump_string_on);
|
||||
IPQ_DLL_EXPORT IPQ_RESULT SetErrorFileNameF(int *id, char* fname);
|
||||
IPQ_DLL_EXPORT IPQ_RESULT SetErrorFileOnF(int *id, int* error_file_on);
|
||||
IPQ_DLL_EXPORT IPQ_RESULT SetErrorStringOnF(int *id, int* error_string_on);
|
||||
IPQ_DLL_EXPORT IPQ_RESULT SetLogFileNameF(int *id, char* fname);
|
||||
IPQ_DLL_EXPORT IPQ_RESULT SetLogFileOnF(int *id, int* log_file_on);
|
||||
IPQ_DLL_EXPORT IPQ_RESULT SetLogStringOnF(int *id, int* log_string_on);
|
||||
IPQ_DLL_EXPORT IPQ_RESULT SetOutputFileNameF(int *id, char* fname);
|
||||
IPQ_DLL_EXPORT IPQ_RESULT SetOutputFileOnF(int *id, int* output_on);
|
||||
IPQ_DLL_EXPORT IPQ_RESULT SetOutputStringOnF(int *id, int* output_string_on);
|
||||
IPQ_DLL_EXPORT IPQ_RESULT SetSelectedOutputFileNameF(int *id, char* fname);
|
||||
IPQ_DLL_EXPORT IPQ_RESULT SetSelectedOutputFileOnF(int *id, int* selected_output_file_on);
|
||||
IPQ_DLL_EXPORT IPQ_RESULT SetSelectedOutputStringOnF(int *id, int* selected_output_string_on);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
FUNCTION F_MAIN()
|
||||
|
||||
USE IPhreeqc
|
||||
IMPLICIT NONE
|
||||
INCLUDE 'IPhreeqc.f90.inc'
|
||||
!!INCLUDE 'IPhreeqc.f90.inc'
|
||||
INTEGER(KIND=4) id
|
||||
|
||||
INTEGER(KIND=4) r
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user