Skip to content

Commit 5a65081

Browse files
authored
feat: Receive cycleNumber for Python bindings in output/execute/collect calls (#3631)
* Receive cycleNumber from Python in output/execute/collect calls
1 parent bc60b09 commit 5a65081

4 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/coreComponents/fileIO/python/PyHistoryCollection.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,15 @@ static PyObject * collect( PyHistoryCollection * self, PyObject * args )
9090

9191
double time;
9292
double dt;
93+
int cycleNumber;
9394

94-
if( !PyArg_ParseTuple( args, "dd", &time, &dt ) )
95+
if( !PyArg_ParseTuple( args, "ddi", &time, &dt, &cycleNumber ) )
9596
{
9697
return nullptr;
9798
}
9899

99100
geos::DomainPartition & domain = self->group->getGroupByPath< DomainPartition >( "/Problem/domain" );
100101

101-
int cycleNumber = int(round( time/dt ));
102102
try
103103
{
104104
self->group->execute( time, dt, cycleNumber, 0, 0, domain );

src/coreComponents/fileIO/python/PyHistoryOutput.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,15 @@ static PyObject * output( PyHistoryOutput * self, PyObject * args )
8888

8989
double time;
9090
double dt;
91+
int cycleNumber;
9192

92-
if( !PyArg_ParseTuple( args, "dd", &time, &dt ) )
93+
if( !PyArg_ParseTuple( args, "ddi", &time, &dt, &cycleNumber ) )
9394
{
9495
return nullptr;
9596
}
9697

9798
geos::DomainPartition & domain = self->group->getGroupByPath< DomainPartition >( "/Problem/domain" );
9899

99-
int cycleNumber = int(round( time/dt ));
100100
try
101101
{
102102
self->group->cleanup( time, cycleNumber, 0, 0, domain );

src/coreComponents/fileIO/python/PyVTKOutput.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,15 @@ static PyObject * output( PyVTKOutput * self, PyObject * args )
8686

8787
double time;
8888
double dt;
89+
int cycleNumber;
8990

90-
if( !PyArg_ParseTuple( args, "dd", &time, &dt ) )
91+
if( !PyArg_ParseTuple( args, "ddi", &time, &dt, &cycleNumber ) )
9192
{
9293
return nullptr;
9394
}
9495

9596
geos::DomainPartition & domain = self->group->getGroupByPath< DomainPartition >( "/Problem/domain" );
9697

97-
int cycleNumber = int(round( time/dt ));
9898
try
9999
{
100100
self->group->execute( time, dt, cycleNumber, 0, 0, domain );

src/coreComponents/physicsSolvers/python/PySolver.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,15 @@ static PyObject * execute( PySolver * self, PyObject * args )
8585

8686
double time;
8787
double dt;
88-
if( !PyArg_ParseTuple( args, "dd", &time, &dt ) )
88+
int cycleNumber;
89+
90+
if( !PyArg_ParseTuple( args, "ddi", &time, &dt, &cycleNumber ) )
8991
{
9092
return nullptr;
9193
}
9294

9395
geos::DomainPartition & domain = self->group->getGroupByPath< DomainPartition >( "/Problem/domain" );
9496

95-
int cycleNumber = int(round( time/dt ));
96-
9797
self->group->execute( time, dt, cycleNumber, 0, 0, domain );
9898

9999
Py_RETURN_NONE;

0 commit comments

Comments
 (0)