Skip to content

Commit e72ca8a

Browse files
committed
Change function signatures of CouplingDataUser::Read and ::Write. Modernize buffer to be a span instead of a pointer.
1 parent ee4e25c commit e72ca8a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+107
-102
lines changed

CHT/HeatFlux.C

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ preciceAdapter::CHT::HeatFlux::HeatFlux(
1818
dataType_ = scalar;
1919
}
2020

21-
std::size_t preciceAdapter::CHT::HeatFlux::write(double* buffer, bool meshConnectivity, const unsigned int dim)
21+
std::size_t preciceAdapter::CHT::HeatFlux::write(precice::span<double> buffer, bool meshConnectivity, const unsigned int dim)
2222
{
2323
int bufferIndex = 0;
2424

@@ -71,7 +71,7 @@ std::size_t preciceAdapter::CHT::HeatFlux::write(double* buffer, bool meshConnec
7171
return bufferIndex;
7272
}
7373

74-
void preciceAdapter::CHT::HeatFlux::read(double* buffer, const unsigned int dim)
74+
void preciceAdapter::CHT::HeatFlux::read(precice::span<double> buffer, const unsigned int dim)
7575
{
7676
int bufferIndex = 0;
7777

CHT/HeatFlux.H

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ public:
3333

3434
//- Compute heat flux values from the temperature field
3535
// and write them into the buffer
36-
std::size_t write(double* buffer, bool meshConnectivity, const unsigned int dim) final;
36+
std::size_t write(precice::span<double> buffer, bool meshConnectivity, const unsigned int dim) final;
3737

3838
//- Read heat flux values from the buffer and assign them to
3939
// the gradient of the temperature field
40-
void read(double* buffer, const unsigned int dim) final;
40+
void read(precice::span<double> buffer, const unsigned int dim) final;
4141

4242
bool isLocationTypeSupported(const bool meshConnectivity) const final;
4343

CHT/HeatTransferCoefficient.C

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ preciceAdapter::CHT::HeatTransferCoefficient::HeatTransferCoefficient(
2020
}
2121

2222

23-
std::size_t preciceAdapter::CHT::HeatTransferCoefficient::write(double* buffer, bool meshConnectivity, const unsigned int dim)
23+
std::size_t preciceAdapter::CHT::HeatTransferCoefficient::write(precice::span<double> buffer, bool meshConnectivity, const unsigned int dim)
2424
{
2525
int bufferIndex = 0;
2626

@@ -73,7 +73,7 @@ std::size_t preciceAdapter::CHT::HeatTransferCoefficient::write(double* buffer,
7373
}
7474

7575

76-
void preciceAdapter::CHT::HeatTransferCoefficient::read(double* buffer, const unsigned int dim)
76+
void preciceAdapter::CHT::HeatTransferCoefficient::read(precice::span<double> buffer, const unsigned int dim)
7777
{
7878
int bufferIndex = 0;
7979

CHT/HeatTransferCoefficient.H

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ public:
3535
const std::string nameT);
3636

3737
//- Write the heat transfer coefficient values into the buffer
38-
std::size_t write(double* buffer, bool meshConnectivity, const unsigned int dim) final;
38+
std::size_t write(precice::span<double> buffer, bool meshConnectivity, const unsigned int dim) final;
3939

4040
//- Read the heat transfer coefficient values from the buffer
41-
void read(double* buffer, const unsigned int dim) final;
41+
void read(precice::span<double> buffer, const unsigned int dim) final;
4242

4343
bool isLocationTypeSupported(const bool meshConnectivity) const final;
4444

CHT/SinkTemperature.C

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ preciceAdapter::CHT::SinkTemperature::SinkTemperature(
1414
dataType_ = scalar;
1515
}
1616

17-
std::size_t preciceAdapter::CHT::SinkTemperature::write(double* buffer, bool meshConnectivity, const unsigned int dim)
17+
std::size_t preciceAdapter::CHT::SinkTemperature::write(precice::span<double> buffer, bool meshConnectivity, const unsigned int dim)
1818
{
1919
int bufferIndex = 0;
2020

@@ -66,7 +66,7 @@ std::size_t preciceAdapter::CHT::SinkTemperature::write(double* buffer, bool mes
6666
return bufferIndex;
6767
}
6868

69-
void preciceAdapter::CHT::SinkTemperature::read(double* buffer, const unsigned int dim)
69+
void preciceAdapter::CHT::SinkTemperature::read(precice::span<double> buffer, const unsigned int dim)
7070
{
7171
int bufferIndex = 0;
7272

CHT/SinkTemperature.H

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ public:
2626
const std::string nameT);
2727

2828
//- Write the sink temperature values into the buffer
29-
std::size_t write(double* buffer, bool meshConnectivity, const unsigned int dim) final;
29+
std::size_t write(precice::span<double> buffer, bool meshConnectivity, const unsigned int dim) final;
3030

3131
//- Read the sink temperature values from the buffer
32-
void read(double* buffer, const unsigned int dim) final;
32+
void read(precice::span<double> buffer, const unsigned int dim) final;
3333

3434
bool isLocationTypeSupported(const bool meshConnectivity) const final;
3535

CHT/Temperature.C

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ preciceAdapter::CHT::Temperature::Temperature(
1515
dataType_ = scalar;
1616
}
1717

18-
std::size_t preciceAdapter::CHT::Temperature::write(double* buffer, bool meshConnectivity, const unsigned int dim)
18+
std::size_t preciceAdapter::CHT::Temperature::write(precice::span<double> buffer, bool meshConnectivity, const unsigned int dim)
1919
{
2020
int bufferIndex = 0;
2121

@@ -82,7 +82,7 @@ std::size_t preciceAdapter::CHT::Temperature::write(double* buffer, bool meshCon
8282
return bufferIndex;
8383
}
8484

85-
void preciceAdapter::CHT::Temperature::read(double* buffer, const unsigned int dim)
85+
void preciceAdapter::CHT::Temperature::read(precice::span<double> buffer, const unsigned int dim)
8686
{
8787
int bufferIndex = 0;
8888

CHT/Temperature.H

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ public:
2727
const std::string nameT);
2828

2929
//- Write the temperature values into the buffer
30-
std::size_t write(double* buffer, bool meshConnectivity, const unsigned int dim) final;
30+
std::size_t write(precice::span<double> buffer, bool meshConnectivity, const unsigned int dim) final;
3131

3232
//- Read the temperature values from the buffer
33-
void read(double* buffer, const unsigned int dim) final;
33+
void read(precice::span<double> buffer, const unsigned int dim) final;
3434

3535
bool isLocationTypeSupported(const bool meshConnectivity) const final;
3636

CouplingDataUser.H

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#define COUPLINGDATAUSER_H
33

44
#include "Utilities.H"
5+
#include <precice/precice.hpp>
56
#include <vector>
67
#include <string>
78

@@ -75,10 +76,10 @@ public:
7576

7677
//- Write the coupling data to the buffer
7778
// Returns the number of entries that were filles in the buffer (nComp * vertices)
78-
virtual std::size_t write(double* dataBuffer, bool meshConnectivity, const unsigned int dim) = 0;
79+
virtual std::size_t write(precice::span<double> dataBuffer, bool meshConnectivity, const unsigned int dim) = 0;
7980

8081
//- Read the coupling data from the buffer
81-
virtual void read(double* dataBuffer, const unsigned int dim) = 0;
82+
virtual void read(precice::span<double> dataBuffer, const unsigned int dim) = 0;
8283

8384
//- Given the meshConnectivity, return if the underlying loactionType of the
8485
//- interface nodes is supported by the data set

FF/Alpha.C

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ preciceAdapter::FF::Alpha::Alpha(
1212
dataType_ = scalar;
1313
}
1414

15-
std::size_t preciceAdapter::FF::Alpha::write(double* buffer, bool meshConnectivity, const unsigned int dim)
15+
std::size_t preciceAdapter::FF::Alpha::write(precice::span<double> buffer, bool meshConnectivity, const unsigned int dim)
1616
{
1717
int bufferIndex = 0;
1818

@@ -57,7 +57,7 @@ std::size_t preciceAdapter::FF::Alpha::write(double* buffer, bool meshConnectivi
5757
return bufferIndex;
5858
}
5959

60-
void preciceAdapter::FF::Alpha::read(double* buffer, const unsigned int dim)
60+
void preciceAdapter::FF::Alpha::read(precice::span<double> buffer, const unsigned int dim)
6161
{
6262
int bufferIndex = 0;
6363

0 commit comments

Comments
 (0)