mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-16 08:38:23 +01:00
Added GETCOMPONENTCOUNT and GETCOMPONENT fortran routines
git-svn-id: svn://136.177.114.72/svn_GW/IPhreeqc/branches/class@4174 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
parent
745917b89d
commit
9ce16bc323
@ -169,3 +169,18 @@
|
|||||||
CHARACTER(LEN=*) :: LINE
|
CHARACTER(LEN=*) :: LINE
|
||||||
END SUBROUTINE
|
END SUBROUTINE
|
||||||
END INTERFACE
|
END INTERFACE
|
||||||
|
|
||||||
|
|
||||||
|
INTERFACE
|
||||||
|
FUNCTION GetComponentCount()
|
||||||
|
INTEGER(KIND=4) :: GetComponentCount
|
||||||
|
END FUNCTION GetComponentCount
|
||||||
|
END INTERFACE
|
||||||
|
|
||||||
|
|
||||||
|
INTERFACE
|
||||||
|
SUBROUTINE GetComponent(N,COMP)
|
||||||
|
INTEGER(KIND=4) :: N
|
||||||
|
CHARACTER(LEN=*) :: COMP
|
||||||
|
END SUBROUTINE
|
||||||
|
END INTERFACE
|
||||||
|
|||||||
20
src/fwrap.c
20
src/fwrap.c
@ -167,6 +167,18 @@ GetErrorLineF(int* n, char* line, unsigned int line_length)
|
|||||||
padfstring(line, ::GetErrorLine((*n) - 1), line_length);
|
padfstring(line, ::GetErrorLine((*n) - 1), line_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
GetComponentCountF(void)
|
||||||
|
{
|
||||||
|
return ::GetComponentCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
GetComponentF(int *n, char* line, unsigned int line_length)
|
||||||
|
{
|
||||||
|
padfstring(line, ::GetComponent((*n) - 1), line_length);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
RunF(void)
|
RunF(void)
|
||||||
{
|
{
|
||||||
@ -353,6 +365,14 @@ void __stdcall GETERRORLINE(int *n, char* line, unsigned int line_length)
|
|||||||
{
|
{
|
||||||
GetErrorLineF(n, line, line_length);
|
GetErrorLineF(n, line, line_length);
|
||||||
}
|
}
|
||||||
|
int __stdcall GETCOMPONENTCOUNT(void)
|
||||||
|
{
|
||||||
|
return GetComponentCountF();
|
||||||
|
}
|
||||||
|
void __stdcall GETCOMPONENT(int *n, char* line, unsigned int line_length)
|
||||||
|
{
|
||||||
|
GetComponentF(n, line, line_length);
|
||||||
|
}
|
||||||
int __stdcall RUN(void)
|
int __stdcall RUN(void)
|
||||||
{
|
{
|
||||||
return RunF();
|
return RunF();
|
||||||
|
|||||||
@ -43,6 +43,10 @@ extern "C" {
|
|||||||
|
|
||||||
void GetErrorLineF(int* n, char* line, unsigned int line_length);
|
void GetErrorLineF(int* n, char* line, unsigned int line_length);
|
||||||
|
|
||||||
|
int GetComponentCountF(void);
|
||||||
|
|
||||||
|
void GetComponentF(int* n, char* line, unsigned int line_length);
|
||||||
|
|
||||||
void OutputLastErrorF(void);
|
void OutputLastErrorF(void);
|
||||||
|
|
||||||
void OutputLinesF(void);
|
void OutputLinesF(void);
|
||||||
|
|||||||
@ -62,6 +62,14 @@ void GETERRORLINE(int *n, char* line, unsigned int line_length)
|
|||||||
{
|
{
|
||||||
GetErrorLineF(n, line, line_length);
|
GetErrorLineF(n, line, line_length);
|
||||||
}
|
}
|
||||||
|
int GETCOMPONENTCOUNT(void)
|
||||||
|
{
|
||||||
|
return GetComponentCountF();
|
||||||
|
}
|
||||||
|
void GETCOMPONENT(int *n, char* line, unsigned int line_length)
|
||||||
|
{
|
||||||
|
GetComponentF(n, line, line_length);
|
||||||
|
}
|
||||||
int RUN(void)
|
int RUN(void)
|
||||||
{
|
{
|
||||||
return RunF();
|
return RunF();
|
||||||
|
|||||||
@ -62,6 +62,14 @@ void geterrorline_(int *n, char* line, unsigned int line_length)
|
|||||||
{
|
{
|
||||||
GetErrorLineF(n, line, line_length);
|
GetErrorLineF(n, line, line_length);
|
||||||
}
|
}
|
||||||
|
int getcomponentcount_(void)
|
||||||
|
{
|
||||||
|
return GetComponentCountF();
|
||||||
|
}
|
||||||
|
void getcomponent_(int *n, char* line, unsigned int line_length)
|
||||||
|
{
|
||||||
|
GetComponentF(n, line, line_length);
|
||||||
|
}
|
||||||
int run_(void)
|
int run_(void)
|
||||||
{
|
{
|
||||||
return RunF();
|
return RunF();
|
||||||
|
|||||||
@ -7,6 +7,8 @@
|
|||||||
INTEGER i, j, k, rows, cols
|
INTEGER i, j, k, rows, cols
|
||||||
INTEGER vtype
|
INTEGER vtype
|
||||||
CHARACTER(30) svalue
|
CHARACTER(30) svalue
|
||||||
|
CHARACTER(30) comp
|
||||||
|
INTEGER n
|
||||||
INTEGER len
|
INTEGER len
|
||||||
REAL*8 dvalue
|
REAL*8 dvalue
|
||||||
|
|
||||||
@ -79,6 +81,14 @@
|
|||||||
40 CONTINUE
|
40 CONTINUE
|
||||||
!!!!45 CONTINUE
|
!!!!45 CONTINUE
|
||||||
|
|
||||||
|
!! test ListComponents
|
||||||
|
n = GetComponentCount()
|
||||||
|
DO i = 1, n
|
||||||
|
CALL GetComponent(i, comp)
|
||||||
|
WRITE (*, *) trim(comp)
|
||||||
|
END DO
|
||||||
|
|
||||||
|
|
||||||
50 FORMAT(A15,A,$)
|
50 FORMAT(A15,A,$)
|
||||||
60 FORMAT(1PG15.7E2,A,$)
|
60 FORMAT(1PG15.7E2,A,$)
|
||||||
END PROGRAM DRIVER
|
END PROGRAM DRIVER
|
||||||
|
|||||||
@ -4,6 +4,9 @@
|
|||||||
INCLUDE '..\include\IPhreeqc.f90.inc'
|
INCLUDE '..\include\IPhreeqc.f90.inc'
|
||||||
INTEGER iresult
|
INTEGER iresult
|
||||||
INTEGER rows, cols
|
INTEGER rows, cols
|
||||||
|
CHARACTER(30) comp
|
||||||
|
INTEGER n
|
||||||
|
INTEGER i
|
||||||
|
|
||||||
iresult = LoadDatabase
|
iresult = LoadDatabase
|
||||||
&('wateq4f.dat')
|
&('wateq4f.dat')
|
||||||
@ -31,6 +34,7 @@
|
|||||||
PRINT*,'Rows= ',rows
|
PRINT*,'Rows= ',rows
|
||||||
PRINT*,'Cols= ',cols
|
PRINT*,'Cols= ',cols
|
||||||
|
|
||||||
|
|
||||||
STOP 'Ok'
|
STOP 'Ok'
|
||||||
|
|
||||||
END
|
END
|
||||||
@ -1723,24 +1723,25 @@ TestInterface::TestGetComponent(void)
|
|||||||
CPPUNIT_ASSERT_EQUAL( VR_OK, SOLUTION(1.0, 1.0, 1.0) );
|
CPPUNIT_ASSERT_EQUAL( VR_OK, SOLUTION(1.0, 1.0, 1.0) );
|
||||||
|
|
||||||
// run
|
// run
|
||||||
::SetOutputOn(1);
|
::SetOutputOn(0);
|
||||||
::SetErrorOn(0);
|
::SetErrorOn(0);
|
||||||
::SetLogOn(0);
|
::SetLogOn(0);
|
||||||
::SetSelectedOutputOn(0);
|
::SetSelectedOutputOn(0);
|
||||||
::SetDumpOn(0);
|
::SetDumpOn(0);
|
||||||
::SetDumpStringOn(0);
|
::SetDumpStringOn(0);
|
||||||
|
|
||||||
std::cout << "\n";
|
|
||||||
::OutputLines();
|
|
||||||
std::cout << "\n";
|
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL( 0, ::Run() );
|
CPPUNIT_ASSERT_EQUAL( 0, ::Run() );
|
||||||
|
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL( 4, ::GetComponentCount() );
|
CPPUNIT_ASSERT_EQUAL( 4, ::GetComponentCount() );
|
||||||
|
|
||||||
|
CPPUNIT_ASSERT_EQUAL( std::string(""), std::string(::GetComponent(-2)) );
|
||||||
|
CPPUNIT_ASSERT_EQUAL( std::string(""), std::string(::GetComponent(-1)) );
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL( std::string("Ca"), std::string(::GetComponent(0)) );
|
CPPUNIT_ASSERT_EQUAL( std::string("Ca"), std::string(::GetComponent(0)) );
|
||||||
CPPUNIT_ASSERT_EQUAL( std::string("H"), std::string(::GetComponent(1)) );
|
CPPUNIT_ASSERT_EQUAL( std::string("H"), std::string(::GetComponent(1)) );
|
||||||
CPPUNIT_ASSERT_EQUAL( std::string("Na"), std::string(::GetComponent(2)) );
|
CPPUNIT_ASSERT_EQUAL( std::string("Na"), std::string(::GetComponent(2)) );
|
||||||
CPPUNIT_ASSERT_EQUAL( std::string("O"), std::string(::GetComponent(3)) );
|
CPPUNIT_ASSERT_EQUAL( std::string("O"), std::string(::GetComponent(3)) );
|
||||||
|
|
||||||
|
CPPUNIT_ASSERT_EQUAL( std::string(""), std::string(::GetComponent(4)) );
|
||||||
|
CPPUNIT_ASSERT_EQUAL( std::string(""), std::string(::GetComponent(5)) );
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user