From 5a9c86d438256ba8a517246edcd68599b5d81747 Mon Sep 17 00:00:00 2001 From: David Schneider Date: Thu, 17 Aug 2023 17:24:26 +0200 Subject: [PATCH 1/4] Change signature of write function to consider size_t --- CHT/HeatFlux.H | 2 +- CHT/HeatTransferCoefficient.H | 2 +- CHT/SinkTemperature.H | 2 +- CHT/Temperature.H | 2 +- CouplingDataUser.H | 3 ++- FF/Pressure.H | 2 +- FF/PressureGradient.H | 2 +- FF/Temperature.H | 2 +- FF/TemperatureGradient.H | 2 +- FF/Velocity.H | 2 +- FF/VelocityGradient.H | 2 +- FSI/Displacement.H | 2 +- FSI/DisplacementDelta.H | 2 +- FSI/Force.H | 2 +- FSI/ForceBase.H | 2 +- FSI/Stress.H | 2 +- Interface.C | 4 ++-- 17 files changed, 19 insertions(+), 18 deletions(-) diff --git a/CHT/HeatFlux.H b/CHT/HeatFlux.H index ea21eac7..c3c4aa2e 100644 --- a/CHT/HeatFlux.H +++ b/CHT/HeatFlux.H @@ -33,7 +33,7 @@ public: //- Compute heat flux values from the temperature field // and write them into the buffer - void write(double* buffer, bool meshConnectivity, const unsigned int dim) final; + std::size_t write(double* buffer, bool meshConnectivity, const unsigned int dim) final; //- Read heat flux values from the buffer and assign them to // the gradient of the temperature field diff --git a/CHT/HeatTransferCoefficient.H b/CHT/HeatTransferCoefficient.H index c09edd00..bc0b887e 100644 --- a/CHT/HeatTransferCoefficient.H +++ b/CHT/HeatTransferCoefficient.H @@ -35,7 +35,7 @@ public: const std::string nameT); //- Write the heat transfer coefficient values into the buffer - void write(double* buffer, bool meshConnectivity, const unsigned int dim) final; + std::size_t write(double* buffer, bool meshConnectivity, const unsigned int dim) final; //- Read the heat transfer coefficient values from the buffer void read(double* buffer, const unsigned int dim) final; diff --git a/CHT/SinkTemperature.H b/CHT/SinkTemperature.H index 68493e54..ab15bce7 100644 --- a/CHT/SinkTemperature.H +++ b/CHT/SinkTemperature.H @@ -26,7 +26,7 @@ public: const std::string nameT); //- Write the sink temperature values into the buffer - void write(double* buffer, bool meshConnectivity, const unsigned int dim); + std::size_t write(double* buffer, bool meshConnectivity, const unsigned int dim); //- Read the sink temperature values from the buffer void read(double* buffer, const unsigned int dim); diff --git a/CHT/Temperature.H b/CHT/Temperature.H index cd776272..a374d64d 100644 --- a/CHT/Temperature.H +++ b/CHT/Temperature.H @@ -27,7 +27,7 @@ public: const std::string nameT); //- Write the temperature values into the buffer - void write(double* buffer, bool meshConnectivity, const unsigned int dim); + std::size_t write(double* buffer, bool meshConnectivity, const unsigned int dim); //- Read the temperature values from the buffer void read(double* buffer, const unsigned int dim); diff --git a/CouplingDataUser.H b/CouplingDataUser.H index 7ce00d8d..8faab32a 100644 --- a/CouplingDataUser.H +++ b/CouplingDataUser.H @@ -74,7 +74,8 @@ public: virtual void initialize(); //- Write the coupling data to the buffer - virtual void write(double* dataBuffer, bool meshConnectivity, const unsigned int dim) = 0; + // Returns the number of entries that were filles in the buffer (nComp * vertices) + virtual std::size_t write(double* dataBuffer, bool meshConnectivity, const unsigned int dim) = 0; //- Read the coupling data from the buffer virtual void read(double* dataBuffer, const unsigned int dim) = 0; diff --git a/FF/Pressure.H b/FF/Pressure.H index 1793278f..ecd06a02 100644 --- a/FF/Pressure.H +++ b/FF/Pressure.H @@ -26,7 +26,7 @@ public: const std::string nameP); //- Write the pressure values into the buffer - void write(double* buffer, bool meshConnectivity, const unsigned int dim); + std::size_t write(double* buffer, bool meshConnectivity, const unsigned int dim); //- Read the pressure values from the buffer void read(double* buffer, const unsigned int dim); diff --git a/FF/PressureGradient.H b/FF/PressureGradient.H index 95094f3c..47db220e 100644 --- a/FF/PressureGradient.H +++ b/FF/PressureGradient.H @@ -25,7 +25,7 @@ public: const std::string nameP); //- Write the pressure gradient values into the buffer - void write(double* buffer, bool meshConnectivity, const unsigned int dim); + std::size_t write(double* buffer, bool meshConnectivity, const unsigned int dim); //- Read the pressure gradient values from the buffer void read(double* buffer, const unsigned int dim); diff --git a/FF/Temperature.H b/FF/Temperature.H index f3a365b7..da6daad9 100644 --- a/FF/Temperature.H +++ b/FF/Temperature.H @@ -25,7 +25,7 @@ public: const std::string nameT); //- Write the temperature values into the buffer - void write(double* buffer, bool meshConnectivity, const unsigned int dim); + std::size_t write(double* buffer, bool meshConnectivity, const unsigned int dim); //- Read the temperature values from the buffer void read(double* buffer, const unsigned int dim); diff --git a/FF/TemperatureGradient.H b/FF/TemperatureGradient.H index 6675b647..c7259a7b 100644 --- a/FF/TemperatureGradient.H +++ b/FF/TemperatureGradient.H @@ -25,7 +25,7 @@ public: const std::string nameT); //- Write the Temperature gradient values into the buffer - void write(double* buffer, bool meshConnectivity, const unsigned int dim); + std::size_t write(double* buffer, bool meshConnectivity, const unsigned int dim); //- Read the Temperature gradient values from the buffer void read(double* buffer, const unsigned int dim); diff --git a/FF/Velocity.H b/FF/Velocity.H index 901e3334..c6706821 100644 --- a/FF/Velocity.H +++ b/FF/Velocity.H @@ -32,7 +32,7 @@ public: bool fluxCorrection = false); //- Write the velocity values into the buffer - void write(double* buffer, bool meshConnectivity, const unsigned int dim); + std::size_t write(double* buffer, bool meshConnectivity, const unsigned int dim); //- Read the velocity values from the buffer void read(double* buffer, const unsigned int dim); diff --git a/FF/VelocityGradient.H b/FF/VelocityGradient.H index 3e1f16da..77430aeb 100644 --- a/FF/VelocityGradient.H +++ b/FF/VelocityGradient.H @@ -25,7 +25,7 @@ public: const std::string nameU); //- Write the velocity gradient values into the buffer - void write(double* buffer, bool meshConnectivity, const unsigned int dim) final; + std::size_t write(double* buffer, bool meshConnectivity, const unsigned int dim) final; //- Read the velocity gradient values from the buffer void read(double* buffer, const unsigned int dim) final; diff --git a/FSI/Displacement.H b/FSI/Displacement.H index 8b7d5216..4339a29b 100644 --- a/FSI/Displacement.H +++ b/FSI/Displacement.H @@ -36,7 +36,7 @@ public: const std::string nameCellDisplacement); //- Write the displacement values into the buffer - void write(double* buffer, bool meshConnectivity, const unsigned int dim) final; + std::size_t write(double* buffer, bool meshConnectivity, const unsigned int dim) final; //- Read the displacement values from the buffer void read(double* buffer, const unsigned int dim) final; diff --git a/FSI/DisplacementDelta.H b/FSI/DisplacementDelta.H index 27c57e51..65066b77 100644 --- a/FSI/DisplacementDelta.H +++ b/FSI/DisplacementDelta.H @@ -36,7 +36,7 @@ public: const std::string nameCellDisplacement); //- Write the displacementDelta values into the buffer - void write(double* buffer, bool meshConnectivity, const unsigned int dim) final; + std::size_t write(double* buffer, bool meshConnectivity, const unsigned int dim) final; //- Read the displacementDelta values from the buffer void read(double* buffer, const unsigned int dim) final; diff --git a/FSI/Force.H b/FSI/Force.H index c528b14d..9e763c10 100644 --- a/FSI/Force.H +++ b/FSI/Force.H @@ -26,7 +26,7 @@ public: const std::string nameForce); //- Write the forces values into the buffer - void write(double* buffer, bool meshConnectivity, const unsigned int dim) final; + std::size_t write(double* buffer, bool meshConnectivity, const unsigned int dim) final; //- Read the forces values from the buffer void read(double* buffer, const unsigned int dim) final; diff --git a/FSI/ForceBase.H b/FSI/ForceBase.H index 38643333..ccf3d15d 100644 --- a/FSI/ForceBase.H +++ b/FSI/ForceBase.H @@ -39,7 +39,7 @@ public: const Foam::fvMesh& mesh, const std::string solverType); - void writeToBuffer(double* buffer, + std::size_t writeToBuffer(double* buffer, Foam::volVectorField& forceField, const unsigned int dim) const; diff --git a/FSI/Stress.H b/FSI/Stress.H index 24f62034..331100b4 100644 --- a/FSI/Stress.H +++ b/FSI/Stress.H @@ -27,7 +27,7 @@ public: const std::string solverType); //- Write the stress values into the buffer - void write(double* buffer, bool meshConnectivity, const unsigned int dim) final; + std::size_t write(double* buffer, bool meshConnectivity, const unsigned int dim) final; //- Read the stress values from the buffer void read(double* buffer, const unsigned int dim) final; diff --git a/Interface.C b/Interface.C index f1ec1d12..8c131b5d 100644 --- a/Interface.C +++ b/Interface.C @@ -571,14 +571,14 @@ void preciceAdapter::Interface::writeCouplingData() couplingDataWriter = couplingDataWriters_.at(i); // Write the data into the adapter's buffer - couplingDataWriter->write(dataBuffer_.data(), meshConnectivity_, dim_); + auto nWrittenData = couplingDataWriter->write(dataBuffer_.data(), meshConnectivity_, dim_); // Make preCICE write vector or scalar data precice_.writeData( meshName_, couplingDataWriter->dataName(), vertexIDs_, - dataBuffer_); + {dataBuffer_.data(), nWrittenData}); } // } } From 4afff4059088481b19cfc3973fe45b965cf5bbc4 Mon Sep 17 00:00:00 2001 From: David Schneider Date: Thu, 17 Aug 2023 17:37:39 +0200 Subject: [PATCH 2/4] Implement return type for all CouplingDataUsers --- CHT/HeatFlux.C | 3 ++- CHT/HeatTransferCoefficient.C | 3 ++- CHT/SinkTemperature.C | 3 ++- CHT/Temperature.C | 3 ++- FF/Pressure.C | 3 ++- FF/PressureGradient.C | 3 ++- FF/Temperature.C | 3 ++- FF/TemperatureGradient.C | 3 ++- FF/Velocity.C | 3 ++- FF/VelocityGradient.C | 3 ++- FSI/Displacement.C | 6 +++--- FSI/DisplacementDelta.C | 3 ++- FSI/Force.C | 4 ++-- FSI/ForceBase.C | 7 ++++--- FSI/Stress.C | 4 ++-- 15 files changed, 33 insertions(+), 21 deletions(-) diff --git a/CHT/HeatFlux.C b/CHT/HeatFlux.C index 2c7d1fb3..7c63e290 100644 --- a/CHT/HeatFlux.C +++ b/CHT/HeatFlux.C @@ -18,7 +18,7 @@ preciceAdapter::CHT::HeatFlux::HeatFlux( dataType_ = scalar; } -void preciceAdapter::CHT::HeatFlux::write(double* buffer, bool meshConnectivity, const unsigned int dim) +std::size_t preciceAdapter::CHT::HeatFlux::write(double* buffer, bool meshConnectivity, const unsigned int dim) { int bufferIndex = 0; @@ -68,6 +68,7 @@ void preciceAdapter::CHT::HeatFlux::write(double* buffer, bool meshConnectivity, } } } + return bufferIndex; } void preciceAdapter::CHT::HeatFlux::read(double* buffer, const unsigned int dim) diff --git a/CHT/HeatTransferCoefficient.C b/CHT/HeatTransferCoefficient.C index ccd9bb7b..68778280 100644 --- a/CHT/HeatTransferCoefficient.C +++ b/CHT/HeatTransferCoefficient.C @@ -20,7 +20,7 @@ preciceAdapter::CHT::HeatTransferCoefficient::HeatTransferCoefficient( } -void preciceAdapter::CHT::HeatTransferCoefficient::write(double* buffer, bool meshConnectivity, const unsigned int dim) +std::size_t preciceAdapter::CHT::HeatTransferCoefficient::write(double* buffer, bool meshConnectivity, const unsigned int dim) { int bufferIndex = 0; @@ -69,6 +69,7 @@ void preciceAdapter::CHT::HeatTransferCoefficient::write(double* buffer, bool me } } } + return bufferIndex; } diff --git a/CHT/SinkTemperature.C b/CHT/SinkTemperature.C index 8d2498a7..9ed18244 100644 --- a/CHT/SinkTemperature.C +++ b/CHT/SinkTemperature.C @@ -14,7 +14,7 @@ preciceAdapter::CHT::SinkTemperature::SinkTemperature( dataType_ = scalar; } -void preciceAdapter::CHT::SinkTemperature::write(double* buffer, bool meshConnectivity, const unsigned int dim) +std::size_t preciceAdapter::CHT::SinkTemperature::write(double* buffer, bool meshConnectivity, const unsigned int dim) { int bufferIndex = 0; @@ -63,6 +63,7 @@ void preciceAdapter::CHT::SinkTemperature::write(double* buffer, bool meshConnec // Clear the temporary internal field object patchInternalFieldTmp.clear(); } + return bufferIndex; } void preciceAdapter::CHT::SinkTemperature::read(double* buffer, const unsigned int dim) diff --git a/CHT/Temperature.C b/CHT/Temperature.C index 4452da2a..3459e840 100644 --- a/CHT/Temperature.C +++ b/CHT/Temperature.C @@ -15,7 +15,7 @@ preciceAdapter::CHT::Temperature::Temperature( dataType_ = scalar; } -void preciceAdapter::CHT::Temperature::write(double* buffer, bool meshConnectivity, const unsigned int dim) +std::size_t preciceAdapter::CHT::Temperature::write(double* buffer, bool meshConnectivity, const unsigned int dim) { int bufferIndex = 0; @@ -79,6 +79,7 @@ void preciceAdapter::CHT::Temperature::write(double* buffer, bool meshConnectivi } } } + return bufferIndex; } void preciceAdapter::CHT::Temperature::read(double* buffer, const unsigned int dim) diff --git a/FF/Pressure.C b/FF/Pressure.C index 5c1dc8aa..5e8b94db 100644 --- a/FF/Pressure.C +++ b/FF/Pressure.C @@ -13,7 +13,7 @@ preciceAdapter::FF::Pressure::Pressure( dataType_ = scalar; } -void preciceAdapter::FF::Pressure::write(double* buffer, bool meshConnectivity, const unsigned int dim) +std::size_t preciceAdapter::FF::Pressure::write(double* buffer, bool meshConnectivity, const unsigned int dim) { int bufferIndex = 0; @@ -55,6 +55,7 @@ void preciceAdapter::FF::Pressure::write(double* buffer, bool meshConnectivity, p_->boundaryFieldRef()[patchID][i]; } } + return bufferIndex; } void preciceAdapter::FF::Pressure::read(double* buffer, const unsigned int dim) diff --git a/FF/PressureGradient.C b/FF/PressureGradient.C index ef8dd9ff..ca125179 100644 --- a/FF/PressureGradient.C +++ b/FF/PressureGradient.C @@ -12,7 +12,7 @@ preciceAdapter::FF::PressureGradient::PressureGradient( dataType_ = scalar; } -void preciceAdapter::FF::PressureGradient::write(double* buffer, bool meshConnectivity, const unsigned int dim) +std::size_t preciceAdapter::FF::PressureGradient::write(double* buffer, bool meshConnectivity, const unsigned int dim) { int bufferIndex = 0; @@ -33,6 +33,7 @@ void preciceAdapter::FF::PressureGradient::write(double* buffer, bool meshConnec -gradientPatch[i]; } } + return bufferIndex; } void preciceAdapter::FF::PressureGradient::read(double* buffer, const unsigned int dim) diff --git a/FF/Temperature.C b/FF/Temperature.C index 62f26476..4aff8611 100644 --- a/FF/Temperature.C +++ b/FF/Temperature.C @@ -12,7 +12,7 @@ preciceAdapter::FF::Temperature::Temperature( dataType_ = scalar; } -void preciceAdapter::FF::Temperature::write(double* buffer, bool meshConnectivity, const unsigned int dim) +std::size_t preciceAdapter::FF::Temperature::write(double* buffer, bool meshConnectivity, const unsigned int dim) { int bufferIndex = 0; @@ -31,6 +31,7 @@ void preciceAdapter::FF::Temperature::write(double* buffer, bool meshConnectivit T_->boundaryFieldRef()[patchID][i]; } } + return bufferIndex; } void preciceAdapter::FF::Temperature::read(double* buffer, const unsigned int dim) diff --git a/FF/TemperatureGradient.C b/FF/TemperatureGradient.C index 911001b6..e9384c7a 100644 --- a/FF/TemperatureGradient.C +++ b/FF/TemperatureGradient.C @@ -13,7 +13,7 @@ preciceAdapter::FF::TemperatureGradient::TemperatureGradient( dataType_ = scalar; } -void preciceAdapter::FF::TemperatureGradient::write(double* buffer, bool meshConnectivity, const unsigned int dim) +std::size_t preciceAdapter::FF::TemperatureGradient::write(double* buffer, bool meshConnectivity, const unsigned int dim) { int bufferIndex = 0; @@ -34,6 +34,7 @@ void preciceAdapter::FF::TemperatureGradient::write(double* buffer, bool meshCon gradientPatch[i]; } } + return bufferIndex; } void preciceAdapter::FF::TemperatureGradient::read(double* buffer, const unsigned int dim) diff --git a/FF/Velocity.C b/FF/Velocity.C index be34d971..28092919 100644 --- a/FF/Velocity.C +++ b/FF/Velocity.C @@ -34,7 +34,7 @@ preciceAdapter::FF::Velocity::Velocity( dataType_ = vector; } -void preciceAdapter::FF::Velocity::write(double* buffer, bool meshConnectivity, const unsigned int dim) +std::size_t preciceAdapter::FF::Velocity::write(double* buffer, bool meshConnectivity, const unsigned int dim) { int bufferIndex = 0; @@ -118,6 +118,7 @@ void preciceAdapter::FF::Velocity::write(double* buffer, bool meshConnectivity, } } } + return bufferIndex; } void preciceAdapter::FF::Velocity::read(double* buffer, const unsigned int dim) diff --git a/FF/VelocityGradient.C b/FF/VelocityGradient.C index 1536fdbd..90c685a7 100644 --- a/FF/VelocityGradient.C +++ b/FF/VelocityGradient.C @@ -13,7 +13,7 @@ preciceAdapter::FF::VelocityGradient::VelocityGradient( dataType_ = vector; } -void preciceAdapter::FF::VelocityGradient::write(double* buffer, bool meshConnectivity, const unsigned int dim) +std::size_t preciceAdapter::FF::VelocityGradient::write(double* buffer, bool meshConnectivity, const unsigned int dim) { int bufferIndex = 0; @@ -46,6 +46,7 @@ void preciceAdapter::FF::VelocityGradient::write(double* buffer, bool meshConnec } } } + return bufferIndex; } void preciceAdapter::FF::VelocityGradient::read(double* buffer, const unsigned int dim) diff --git a/FSI/Displacement.C b/FSI/Displacement.C index 69baf676..4a76e26f 100644 --- a/FSI/Displacement.C +++ b/FSI/Displacement.C @@ -36,7 +36,7 @@ void preciceAdapter::FSI::Displacement::initialize() } -void preciceAdapter::FSI::Displacement::write(double* buffer, bool meshConnectivity, const unsigned int dim) +std::size_t preciceAdapter::FSI::Displacement::write(double* buffer, bool meshConnectivity, const unsigned int dim) { /* TODO: Implement * We need two nested for-loops for each patch, @@ -46,9 +46,9 @@ void preciceAdapter::FSI::Displacement::write(double* buffer, bool meshConnectiv // Copy the displacement field from OpenFOAM to the buffer + int bufferIndex = 0; if (this->locationType_ == LocationType::faceCenters) { - int bufferIndex = 0; // For every boundary patch of the interface for (const label patchID : patchIDs_) { @@ -70,7 +70,6 @@ void preciceAdapter::FSI::Displacement::write(double* buffer, bool meshConnectiv "See https://github.com/precice/openfoam-adapter/issues/153.", "warning")); - int bufferIndex = 0; // For every boundary patch of the interface for (const label patchID : patchIDs_) { @@ -87,6 +86,7 @@ void preciceAdapter::FSI::Displacement::write(double* buffer, bool meshConnectiv } } } + return bufferIndex; } diff --git a/FSI/DisplacementDelta.C b/FSI/DisplacementDelta.C index 19c93139..a4bdd730 100644 --- a/FSI/DisplacementDelta.C +++ b/FSI/DisplacementDelta.C @@ -34,7 +34,7 @@ void preciceAdapter::FSI::DisplacementDelta::initialize() } -void preciceAdapter::FSI::DisplacementDelta::write(double* buffer, bool meshConnectivity, const unsigned int dim) +std::size_t preciceAdapter::FSI::DisplacementDelta::write(double* buffer, bool meshConnectivity, const unsigned int dim) { /* TODO: Implement * We need two nested for-loops for each patch, @@ -44,6 +44,7 @@ void preciceAdapter::FSI::DisplacementDelta::write(double* buffer, bool meshConn FatalErrorInFunction << "Writing displacementDeltas is not supported." << exit(FatalError); + return 0; } // return the displacement to use later in the velocity? diff --git a/FSI/Force.C b/FSI/Force.C index a1ab6651..d8cbad39 100644 --- a/FSI/Force.C +++ b/FSI/Force.C @@ -36,9 +36,9 @@ preciceAdapter::FSI::Force::Force( } } -void preciceAdapter::FSI::Force::write(double* buffer, bool meshConnectivity, const unsigned int dim) +std::size_t preciceAdapter::FSI::Force::write(double* buffer, bool meshConnectivity, const unsigned int dim) { - this->writeToBuffer(buffer, *Force_, dim); + return this->writeToBuffer(buffer, *Force_, dim); } void preciceAdapter::FSI::Force::read(double* buffer, const unsigned int dim) diff --git a/FSI/ForceBase.C b/FSI/ForceBase.C index 4e9168b0..48297cdf 100644 --- a/FSI/ForceBase.C +++ b/FSI/ForceBase.C @@ -130,9 +130,9 @@ Foam::tmp preciceAdapter::FSI::ForceBase::mu() const } } -void preciceAdapter::FSI::ForceBase::writeToBuffer(double* buffer, - volVectorField& forceField, - const unsigned int dim) const +std::size_t preciceAdapter::FSI::ForceBase::writeToBuffer(double* buffer, + volVectorField& forceField, + const unsigned int dim) const { // Compute forces. See the Forces function object. // Stress tensor boundary field @@ -188,6 +188,7 @@ void preciceAdapter::FSI::ForceBase::writeToBuffer(double* buffer, forceField.boundaryField()[patchID][i][d]; } } + return bufferIndex; } void preciceAdapter::FSI::ForceBase::readFromBuffer(double* buffer) const diff --git a/FSI/Stress.C b/FSI/Stress.C index c5ba6d10..e4b6990d 100644 --- a/FSI/Stress.C +++ b/FSI/Stress.C @@ -21,9 +21,9 @@ preciceAdapter::FSI::Stress::Stress( Foam::vector::zero)); } -void preciceAdapter::FSI::Stress::write(double* buffer, bool meshConnectivity, const unsigned int dim) +std::size_t preciceAdapter::FSI::Stress::write(double* buffer, bool meshConnectivity, const unsigned int dim) { - this->writeToBuffer(buffer, *Stress_, dim); + return this->writeToBuffer(buffer, *Stress_, dim); } void preciceAdapter::FSI::Stress::read(double* buffer, const unsigned int dim) From 7f316de6ece4c6a81ab4f32b7d1c26b19ed3415d Mon Sep 17 00:00:00 2001 From: David Schneider Date: Mon, 11 Sep 2023 12:19:39 +0200 Subject: [PATCH 3/4] Read relevant buffer part only --- Interface.C | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Interface.C b/Interface.C index 8c131b5d..a137c43e 100644 --- a/Interface.C +++ b/Interface.C @@ -545,12 +545,16 @@ void preciceAdapter::Interface::readCouplingData(double relativeReadTime) // Make preCICE read vector or scalar data // and fill the adapter's buffer + std::size_t nReadData = vertexIDs_.size() * precice_.getDataDimensions(meshName_,couplingDataReader->dataName()); + // We could add a sanity check here + // nReadData == vertexIDs_.size() * (1 + (dim_ - 1) * static_cast(couplingDataReader->hasVectorData())); + precice_.readData( meshName_, couplingDataReader->dataName(), vertexIDs_, relativeReadTime, - dataBuffer_); + {dataBuffer_.data(), nReadData}); // Read the received data from the buffer couplingDataReader->read(dataBuffer_.data(), dim_); From a48b7aadd2fe957432c691f12c7a9acaff730c7b Mon Sep 17 00:00:00 2001 From: David Schneider Date: Wed, 13 Sep 2023 13:49:48 +0200 Subject: [PATCH 4/4] Indentation with clang-format 11 --- FSI/ForceBase.H | 4 ++-- FSI/Stress.C | 2 +- Interface.C | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/FSI/ForceBase.H b/FSI/ForceBase.H index ccf3d15d..2c53086a 100644 --- a/FSI/ForceBase.H +++ b/FSI/ForceBase.H @@ -40,8 +40,8 @@ public: const std::string solverType); std::size_t writeToBuffer(double* buffer, - Foam::volVectorField& forceField, - const unsigned int dim) const; + Foam::volVectorField& forceField, + const unsigned int dim) const; void readFromBuffer(double* buffer) const; diff --git a/FSI/Stress.C b/FSI/Stress.C index e4b6990d..1194a249 100644 --- a/FSI/Stress.C +++ b/FSI/Stress.C @@ -23,7 +23,7 @@ preciceAdapter::FSI::Stress::Stress( std::size_t preciceAdapter::FSI::Stress::write(double* buffer, bool meshConnectivity, const unsigned int dim) { - return this->writeToBuffer(buffer, *Stress_, dim); + return this->writeToBuffer(buffer, *Stress_, dim); } void preciceAdapter::FSI::Stress::read(double* buffer, const unsigned int dim) diff --git a/Interface.C b/Interface.C index a137c43e..cd2aa0d5 100644 --- a/Interface.C +++ b/Interface.C @@ -545,7 +545,7 @@ void preciceAdapter::Interface::readCouplingData(double relativeReadTime) // Make preCICE read vector or scalar data // and fill the adapter's buffer - std::size_t nReadData = vertexIDs_.size() * precice_.getDataDimensions(meshName_,couplingDataReader->dataName()); + std::size_t nReadData = vertexIDs_.size() * precice_.getDataDimensions(meshName_, couplingDataReader->dataName()); // We could add a sanity check here // nReadData == vertexIDs_.size() * (1 + (dim_ - 1) * static_cast(couplingDataReader->hasVectorData()));