From c32ffd194c6011cb51ad99eb54de1de756775e87 Mon Sep 17 00:00:00 2001 From: Philip Fackler Date: Mon, 26 Feb 2024 17:19:22 -0500 Subject: [PATCH] Addressed some issues in flux handlers and perf handler (#179) --- .../xolotl/core/flux/AlloyFitFluxHandler.h | 4 +- .../xolotl/core/flux/AlphaZrFitFluxHandler.h | 6 +- .../xolotl/core/flux/CustomFitFluxHandler.h | 4 +- .../xolotl/core/flux/FeFitFluxHandler.h | 2 +- .../include/xolotl/core/flux/FluxHandler.h | 70 +++++++++---------- .../xolotl/core/flux/FuelFitFluxHandler.h | 2 +- .../include/xolotl/core/flux/PSIFluxHandler.h | 2 +- .../xolotl/core/flux/PulsedFitFluxHandler.h | 6 +- xolotl/perf/src/PerfHandler.cpp | 7 +- 9 files changed, 51 insertions(+), 52 deletions(-) diff --git a/xolotl/core/include/xolotl/core/flux/AlloyFitFluxHandler.h b/xolotl/core/include/xolotl/core/flux/AlloyFitFluxHandler.h index d1d71bc5b..27f6f6814 100644 --- a/xolotl/core/include/xolotl/core/flux/AlloyFitFluxHandler.h +++ b/xolotl/core/include/xolotl/core/flux/AlloyFitFluxHandler.h @@ -172,7 +172,7 @@ class AlloyFitFluxHandler : public FluxHandler */ void initializeFluxHandler(network::IReactionNetwork& network, int surfacePos, - std::vector grid) + std::vector grid) override { // Setup the ion damage and implantation depth profile if (false) { @@ -364,7 +364,7 @@ class AlloyFitFluxHandler : public FluxHandler attenuation * ionDamageRate(i, xi - surfacePos)); }); } -}; // namespace flux +}; // end class AlloyFitFluxHandler } // namespace flux diff --git a/xolotl/core/include/xolotl/core/flux/AlphaZrFitFluxHandler.h b/xolotl/core/include/xolotl/core/flux/AlphaZrFitFluxHandler.h index f4d4c3c5b..95a50700c 100644 --- a/xolotl/core/include/xolotl/core/flux/AlphaZrFitFluxHandler.h +++ b/xolotl/core/include/xolotl/core/flux/AlphaZrFitFluxHandler.h @@ -102,7 +102,7 @@ class AlphaZrFitFluxHandler : public FluxHandler */ void initializeFluxHandler(network::IReactionNetwork& network, int surfacePos, - std::vector grid) + std::vector grid) override { // Set the grid xGrid = grid; @@ -193,7 +193,7 @@ class AlphaZrFitFluxHandler : public FluxHandler * \see IFluxHandler.h */ std::vector> - getImplantedFlux(std::vector map) + getImplantedFlux(std::vector map) override { std::vector> toReturn; // Loop on the map @@ -214,7 +214,7 @@ class AlphaZrFitFluxHandler : public FluxHandler * \see IFluxHandler.h */ void - setImplantedFlux(std::vector> fluxVector) + setImplantedFlux(std::vector> fluxVector) override { fluxIndices.clear(); incidentFluxVec.clear(); diff --git a/xolotl/core/include/xolotl/core/flux/CustomFitFluxHandler.h b/xolotl/core/include/xolotl/core/flux/CustomFitFluxHandler.h index 75559e958..9677b79d5 100644 --- a/xolotl/core/include/xolotl/core/flux/CustomFitFluxHandler.h +++ b/xolotl/core/include/xolotl/core/flux/CustomFitFluxHandler.h @@ -93,7 +93,7 @@ class CustomFitFluxHandler : public FluxHandler */ void initializeFluxHandler(network::IReactionNetwork& network, int surfacePos, - std::vector grid) + std::vector grid) override { // Clear everything incidentFluxVec.clear(); @@ -381,7 +381,7 @@ class CustomFitFluxHandler : public FluxHandler } std::vector - getInstantFlux(double time) const + getInstantFlux(double time) const override { // Create the vector to return std::vector toReturn; diff --git a/xolotl/core/include/xolotl/core/flux/FeFitFluxHandler.h b/xolotl/core/include/xolotl/core/flux/FeFitFluxHandler.h index 6a48fd127..a003d153b 100644 --- a/xolotl/core/include/xolotl/core/flux/FeFitFluxHandler.h +++ b/xolotl/core/include/xolotl/core/flux/FeFitFluxHandler.h @@ -48,7 +48,7 @@ class FeFitFluxHandler : public FluxHandler */ void initializeFluxHandler(network::IReactionNetwork& network, int surfacePos, - std::vector grid) + std::vector grid) override { // Only defined in 0D if (xGrid.size() == 0) { diff --git a/xolotl/core/include/xolotl/core/flux/FluxHandler.h b/xolotl/core/include/xolotl/core/flux/FluxHandler.h index c246e12cd..c54d40d86 100644 --- a/xolotl/core/include/xolotl/core/flux/FluxHandler.h +++ b/xolotl/core/include/xolotl/core/flux/FluxHandler.h @@ -149,15 +149,15 @@ class FluxHandler : public IFluxHandler /** * \see IFluxHandler.h */ - virtual void + void initializeFluxHandler(network::IReactionNetwork& network, int surfacePos, - std::vector grid); + std::vector grid) override; /** * \see IFluxHandler.h */ - virtual void - initializeTimeProfile(const std::string& fileName); + void + initializeTimeProfile(const std::string& fileName) override; /** * \see IFluxHandler.h @@ -170,50 +170,50 @@ class FluxHandler : public IFluxHandler /** * \see IFluxHandler.h */ - virtual void - incrementFluence(double dt); + void + incrementFluence(double dt) override; /** * \see IFluxHandler.h */ - virtual void - computeFluence(double time); + void + computeFluence(double time) override; /** * \see IFluxHandler.h */ - virtual void - setFluence(std::vector fluence); + void + setFluence(std::vector fluence) override; /** * \see IFluxHandler.h */ - virtual std::vector - getFluence() const; + std::vector + getFluence() const override; /** * \see IFluxHandler.h */ - virtual void - setFluxAmplitude(double flux); + void + setFluxAmplitude(double flux) override; /** * \see IFluxHandler.h */ - virtual double - getFluxAmplitude() const; + double + getFluxAmplitude() const override; /** * \see IFluxHandler.h */ - virtual double - getFluxRate() const; + double + getFluxRate() const override; /** * \see IFluxHandler.h */ - virtual void - setPulseTime(double time) + void + setPulseTime(double time) override { return; } @@ -221,8 +221,8 @@ class FluxHandler : public IFluxHandler /** * \see IFluxHandler.h */ - virtual void - setProportion(double a) + void + setProportion(double a) override { return; } @@ -230,8 +230,8 @@ class FluxHandler : public IFluxHandler /** * \see IFluxHandler.h */ - virtual std::vector> - getImplantedFlux(std::vector map) + std::vector> + getImplantedFlux(std::vector map) override { return std::vector>(); } @@ -239,29 +239,29 @@ class FluxHandler : public IFluxHandler /** * \see IFluxHandler.h */ - virtual std::vector - getInstantFlux(double time) const; + void + setImplantedFlux(std::vector> fluxVector) override + { + return; + } /** * \see IFluxHandler.h */ - virtual void - setImplantedFlux(std::vector> fluxVector) - { - return; - } + std::vector + getInstantFlux(double time) const override; /** * \see IFluxHandler.h */ - virtual std::vector - getFluxIndices() const; + std::vector + getFluxIndices() const override; /** * \see IFluxHandler.h */ - virtual std::vector - getReductionFactors() const; + std::vector + getReductionFactors() const override; }; // end class FluxHandler diff --git a/xolotl/core/include/xolotl/core/flux/FuelFitFluxHandler.h b/xolotl/core/include/xolotl/core/flux/FuelFitFluxHandler.h index 2c7b4fc5a..d71dd5513 100644 --- a/xolotl/core/include/xolotl/core/flux/FuelFitFluxHandler.h +++ b/xolotl/core/include/xolotl/core/flux/FuelFitFluxHandler.h @@ -53,7 +53,7 @@ class FuelFitFluxHandler : public FluxHandler */ void initializeFluxHandler(network::IReactionNetwork& network, int surfacePos, - std::vector grid) + std::vector grid) override { // Set the grid xGrid = grid; diff --git a/xolotl/core/include/xolotl/core/flux/PSIFluxHandler.h b/xolotl/core/include/xolotl/core/flux/PSIFluxHandler.h index 7f47e8d9a..75a9ef00b 100644 --- a/xolotl/core/include/xolotl/core/flux/PSIFluxHandler.h +++ b/xolotl/core/include/xolotl/core/flux/PSIFluxHandler.h @@ -35,7 +35,7 @@ class PSIFluxHandler : public FluxHandler */ void initializeFluxHandler(network::IReactionNetwork& network, int surfacePos, - std::vector grid) + std::vector grid) override { // Call the general method FluxHandler::initializeFluxHandler(network, surfacePos, grid); diff --git a/xolotl/core/include/xolotl/core/flux/PulsedFitFluxHandler.h b/xolotl/core/include/xolotl/core/flux/PulsedFitFluxHandler.h index 7a52eb5ab..9e883b27d 100644 --- a/xolotl/core/include/xolotl/core/flux/PulsedFitFluxHandler.h +++ b/xolotl/core/include/xolotl/core/flux/PulsedFitFluxHandler.h @@ -70,7 +70,7 @@ class PulsedFitFluxHandler : public FluxHandler */ void initializeFluxHandler(network::IReactionNetwork& network, int surfacePos, - std::vector grid) + std::vector grid) override { // Call the general method FluxHandler::initializeFluxHandler(network, surfacePos, grid); @@ -143,7 +143,7 @@ class PulsedFitFluxHandler : public FluxHandler * \see IFluxHandler.h */ void - setPulseTime(double time) + setPulseTime(double time) override { deltaTime = time; return; @@ -153,7 +153,7 @@ class PulsedFitFluxHandler : public FluxHandler * \see IFluxHandler.h */ void - setProportion(double a) + setProportion(double a) override { alpha = a; return; diff --git a/xolotl/perf/src/PerfHandler.cpp b/xolotl/perf/src/PerfHandler.cpp index dff82ce14..9a29d3e74 100644 --- a/xolotl/perf/src/PerfHandler.cpp +++ b/xolotl/perf/src/PerfHandler.cpp @@ -116,10 +116,9 @@ PerfHandler::collectAllObjectNames(int myRank, // Marshal all our object names. auto myNamesBuf = std::make_unique(nBytes); char* pName = myNamesBuf.get(); - for (auto nameIter = myNames.begin(); nameIter != myNames.end(); - ++nameIter) { - strcpy(pName, nameIter->c_str()); - pName += (nameIter->length() + 1); // skip the NUL terminator + for (auto&& name : myNames) { + strncpy(pName, name.c_str(), name.length()); + pName += (name.length() + 1); // skip the NUL terminator } assert(pName == (myNamesBuf.get() + nBytes));