From 5218b4f0ef3dc8aa2769e3b97be192c3f0f5aef9 Mon Sep 17 00:00:00 2001 From: graham Date: Mon, 16 Jun 2008 18:06:28 +0100 Subject: [PATCH] Changed src/lagrangian/molecule folder to molecularDynamics and split off separate potential library. --- .../molecularDynamics/molecule/Make/files | 50 + .../molecularDynamics/molecule/Make/options | 10 + .../bufferedAccumulator/bufferedAccumulator.C | 238 +++ .../bufferedAccumulator/bufferedAccumulator.H | 178 +++ .../bufferedAccumulatorI.H | 80 + .../bufferedAccumulatorIO.C | 52 + .../correlationFunction/correlationFunction.C | 224 +++ .../correlationFunction/correlationFunction.H | 180 +++ .../correlationFunctionI.H | 70 + .../correlationFunctionIO.C | 72 + .../molecule/distribution/distribution.C | 449 ++++++ .../molecule/distribution/distribution.H | 133 ++ .../molecule/distribution/distributionI.H | 42 + .../molecule/distribution/distributionIO.C | 35 + .../molecule/mdTools/averageMDFields.H | 227 +++ .../calculateAutoCorrelationFunctions.H | 105 ++ .../molecule/mdTools/calculateMDFields.H | 23 + .../mdTools/calculateTransportProperties.H | 82 ++ .../mdTools/createAutoCorrelationFunctions.H | 99 ++ .../molecule/mdTools/createMDFields.H | 324 +++++ .../molecule/mdTools/createRefUnits.H | 22 + .../molecularDynamics/molecule/mdTools/md.H | 11 + .../mdTools/meanMomentumEnergyAndNMols.H | 130 ++ .../molecule/mdTools/resetMDFields.H | 26 + .../molecule/mdTools/temperatureAndPressure.H | 116 ++ .../mdTools/temperatureAndPressureVariables.H | 59 + .../mdTools/temperatureEquilibration.H | 43 + .../molecule/molecule/molecule.C | 214 +++ .../molecule/molecule/molecule.H | 271 ++++ .../molecule/molecule/moleculeI.H | 165 +++ .../molecule/molecule/moleculeIO.C | 208 +++ .../molecule/moleculeCloud/moleculeCloud.C | 135 ++ .../molecule/moleculeCloud/moleculeCloud.H | 328 +++++ ...eculeCloudApplyConstraintsAndThermostats.C | 60 + .../moleculeCloudBuildCellInteractionLists.C | 80 + .../moleculeCloudBuildCellOccupancy.C | 68 + .../moleculeCloudBuildCellReferralLists.C | 194 +++ .../moleculeCloudBuildDirectInteractionList.H | 188 +++ ...oleculeCloudBuildReferredInteractionList.H | 1285 +++++++++++++++++ .../moleculeCloudCalculateExternalForce.C | 42 + .../moleculeCloudCalculateForce.C | 59 + .../moleculeCloudCalculatePairForce.C | 41 + ...moleculeCloudCalculatePairForceRealCells.H | 49 + ...lculatePairForceRealCellsCalculationStep.H | 33 + ...culeCloudCalculatePairForceReferredCells.H | 59 + .../moleculeCloudCalculateTetherForce.C | 69 + .../moleculeCloud/moleculeCloudCodeSnippets.H | 193 +++ .../molecule/moleculeCloud/moleculeCloudI.H | 154 ++ .../moleculeCloudIntegrateEquationsOfMotion.C | 50 + .../moleculeCloudReadMDParameters.H | 177 +++ .../moleculeCloudRealCellsInRangeOfSegment.C | 152 ++ ...leculeCloudReferredCellsInRangeOfSegment.C | 117 ++ .../moleculeCloudRemoveHighEnergyOverlaps.C | 67 + ...leCloudRemoveHighEnergyOverlapsRealCells.H | 55 + ...ghEnergyOverlapsRealCellsCalculationStep.H | 79 + ...oudRemoveHighEnergyOverlapsReferredCells.H | 152 ++ .../moleculeCloudTestEdgeEdgeDistance.C | 86 ++ .../moleculeCloudTestPointFaceDistance.C | 235 +++ .../molecule/reducedUnits/reducedUnits.C | 165 +++ .../molecule/reducedUnits/reducedUnits.H | 184 +++ .../molecule/reducedUnits/reducedUnitsI.H | 95 ++ .../molecule/reducedUnits/reducedUnitsIO.C | 61 + .../referralLists/receivingReferralList.C | 181 +++ .../referralLists/receivingReferralList.H | 138 ++ .../referralLists/receivingReferralListI.H | 56 + .../referralLists/sendingReferralList.C | 178 +++ .../referralLists/sendingReferralList.H | 138 ++ .../referralLists/sendingReferralListI.H | 56 + .../molecule/referredCell/referredCell.C | 441 ++++++ .../molecule/referredCell/referredCell.H | 277 ++++ .../molecule/referredCell/referredCellI.H | 127 ++ .../referredCellList/referredCellList.C | 327 +++++ .../referredCellList/referredCellList.H | 103 ++ .../referredCellList/referredCellListI.H | 42 + .../referredMolecule/referredMolecule.C | 89 ++ .../referredMolecule/referredMolecule.H | 129 ++ .../referredMolecule/referredMoleculeI.H | 75 + .../tetherPotential/tetherPotential.C | 94 ++ .../tetherPotential/tetherPotential.H | 125 ++ .../tetherPotential/tetherPotentialI.H | 56 + .../tetherPotential/tetherPotentialList.C | 146 ++ .../tetherPotential/tetherPotentialList.H | 125 ++ .../tetherPotential/tetherPotentialListI.H | 50 + .../molecularDynamics/potential/Make/files | 35 + .../molecularDynamics/potential/Make/options | 6 + .../basic/energyScalingFunction.C | 76 + .../basic/energyScalingFunction.H | 149 ++ .../basic/newEnergyScalingFunction.C | 79 + .../derived/doubleSigmoid/doubleSigmoid.C | 104 ++ .../derived/doubleSigmoid/doubleSigmoid.H | 114 ++ .../derived/noScaling/noScaling.C | 81 ++ .../derived/noScaling/noScaling.H | 98 ++ .../derived/shifted/shifted.C | 84 ++ .../derived/shifted/shifted.H | 100 ++ .../derived/shiftedForce/shiftedForce.C | 86 ++ .../derived/shiftedForce/shiftedForce.H | 106 ++ .../derived/sigmoid/sigmoid.C | 100 ++ .../derived/sigmoid/sigmoid.H | 112 ++ .../pairPotential/basic/newPairPotential.C | 75 + .../pairPotential/basic/pairPotential.C | 238 +++ .../pairPotential/basic/pairPotential.H | 195 +++ .../pairPotential/basic/pairPotentialI.H | 58 + .../pairPotential/basic/pairPotentialIO.C | 53 + .../pairPotential/derived/azizChen/azizChen.C | 125 ++ .../pairPotential/derived/azizChen/azizChen.H | 126 ++ .../derived/lennardJones/lennardJones.C | 99 ++ .../derived/lennardJones/lennardJones.H | 103 ++ .../derived/maitlandSmith/maitlandSmith.C | 103 ++ .../derived/maitlandSmith/maitlandSmith.H | 127 ++ .../pairPotentialList/pairPotentialList.C | 284 ++++ .../pairPotentialList/pairPotentialList.H | 172 +++ .../pairPotentialList/pairPotentialListI.H | 84 ++ .../basic/newTetherPotential.C | 75 + .../tetherPotential/basic/tetherPotential.C | 71 + .../tetherPotential/basic/tetherPotential.H | 143 ++ .../derived/harmonicSpring/harmonicSpring.C | 93 ++ .../derived/harmonicSpring/harmonicSpring.H | 104 ++ .../restrainedHarmonicSpring.C | 121 ++ .../restrainedHarmonicSpring.H | 106 ++ .../tetherPotentialList/tetherPotentialList.C | 166 +++ .../tetherPotentialList/tetherPotentialList.H | 141 ++ .../tetherPotentialListI.H | 53 + 122 files changed, 15848 insertions(+) create mode 100755 src/lagrangian/molecularDynamics/molecule/Make/files create mode 100755 src/lagrangian/molecularDynamics/molecule/Make/options create mode 100755 src/lagrangian/molecularDynamics/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulator.C create mode 100755 src/lagrangian/molecularDynamics/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulator.H create mode 100755 src/lagrangian/molecularDynamics/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulatorI.H create mode 100755 src/lagrangian/molecularDynamics/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulatorIO.C create mode 100644 src/lagrangian/molecularDynamics/molecule/correlationFunction/correlationFunction.C create mode 100644 src/lagrangian/molecularDynamics/molecule/correlationFunction/correlationFunction.H create mode 100644 src/lagrangian/molecularDynamics/molecule/correlationFunction/correlationFunctionI.H create mode 100644 src/lagrangian/molecularDynamics/molecule/correlationFunction/correlationFunctionIO.C create mode 100755 src/lagrangian/molecularDynamics/molecule/distribution/distribution.C create mode 100755 src/lagrangian/molecularDynamics/molecule/distribution/distribution.H create mode 100755 src/lagrangian/molecularDynamics/molecule/distribution/distributionI.H create mode 100755 src/lagrangian/molecularDynamics/molecule/distribution/distributionIO.C create mode 100755 src/lagrangian/molecularDynamics/molecule/mdTools/averageMDFields.H create mode 100644 src/lagrangian/molecularDynamics/molecule/mdTools/calculateAutoCorrelationFunctions.H create mode 100755 src/lagrangian/molecularDynamics/molecule/mdTools/calculateMDFields.H create mode 100644 src/lagrangian/molecularDynamics/molecule/mdTools/calculateTransportProperties.H create mode 100644 src/lagrangian/molecularDynamics/molecule/mdTools/createAutoCorrelationFunctions.H create mode 100755 src/lagrangian/molecularDynamics/molecule/mdTools/createMDFields.H create mode 100644 src/lagrangian/molecularDynamics/molecule/mdTools/createRefUnits.H create mode 100755 src/lagrangian/molecularDynamics/molecule/mdTools/md.H create mode 100755 src/lagrangian/molecularDynamics/molecule/mdTools/meanMomentumEnergyAndNMols.H create mode 100755 src/lagrangian/molecularDynamics/molecule/mdTools/resetMDFields.H create mode 100755 src/lagrangian/molecularDynamics/molecule/mdTools/temperatureAndPressure.H create mode 100755 src/lagrangian/molecularDynamics/molecule/mdTools/temperatureAndPressureVariables.H create mode 100755 src/lagrangian/molecularDynamics/molecule/mdTools/temperatureEquilibration.H create mode 100755 src/lagrangian/molecularDynamics/molecule/molecule/molecule.C create mode 100755 src/lagrangian/molecularDynamics/molecule/molecule/molecule.H create mode 100755 src/lagrangian/molecularDynamics/molecule/molecule/moleculeI.H create mode 100755 src/lagrangian/molecularDynamics/molecule/molecule/moleculeIO.C create mode 100755 src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.C create mode 100755 src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.H create mode 100755 src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudApplyConstraintsAndThermostats.C create mode 100755 src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudBuildCellInteractionLists.C create mode 100755 src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudBuildCellOccupancy.C create mode 100755 src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudBuildCellReferralLists.C create mode 100755 src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudBuildDirectInteractionList.H create mode 100755 src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudBuildReferredInteractionList.H create mode 100755 src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudCalculateExternalForce.C create mode 100755 src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudCalculateForce.C create mode 100755 src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudCalculatePairForce.C create mode 100755 src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudCalculatePairForceRealCells.H create mode 100755 src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudCalculatePairForceRealCellsCalculationStep.H create mode 100755 src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudCalculatePairForceReferredCells.H create mode 100755 src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudCalculateTetherForce.C create mode 100755 src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudCodeSnippets.H create mode 100755 src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudI.H create mode 100755 src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudIntegrateEquationsOfMotion.C create mode 100755 src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudReadMDParameters.H create mode 100755 src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudRealCellsInRangeOfSegment.C create mode 100755 src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudReferredCellsInRangeOfSegment.C create mode 100755 src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudRemoveHighEnergyOverlaps.C create mode 100755 src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudRemoveHighEnergyOverlapsRealCells.H create mode 100755 src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudRemoveHighEnergyOverlapsRealCellsCalculationStep.H create mode 100755 src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudRemoveHighEnergyOverlapsReferredCells.H create mode 100755 src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudTestEdgeEdgeDistance.C create mode 100755 src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudTestPointFaceDistance.C create mode 100644 src/lagrangian/molecularDynamics/molecule/reducedUnits/reducedUnits.C create mode 100644 src/lagrangian/molecularDynamics/molecule/reducedUnits/reducedUnits.H create mode 100644 src/lagrangian/molecularDynamics/molecule/reducedUnits/reducedUnitsI.H create mode 100644 src/lagrangian/molecularDynamics/molecule/reducedUnits/reducedUnitsIO.C create mode 100755 src/lagrangian/molecularDynamics/molecule/referralLists/receivingReferralList.C create mode 100755 src/lagrangian/molecularDynamics/molecule/referralLists/receivingReferralList.H create mode 100755 src/lagrangian/molecularDynamics/molecule/referralLists/receivingReferralListI.H create mode 100755 src/lagrangian/molecularDynamics/molecule/referralLists/sendingReferralList.C create mode 100755 src/lagrangian/molecularDynamics/molecule/referralLists/sendingReferralList.H create mode 100755 src/lagrangian/molecularDynamics/molecule/referralLists/sendingReferralListI.H create mode 100755 src/lagrangian/molecularDynamics/molecule/referredCell/referredCell.C create mode 100755 src/lagrangian/molecularDynamics/molecule/referredCell/referredCell.H create mode 100755 src/lagrangian/molecularDynamics/molecule/referredCell/referredCellI.H create mode 100755 src/lagrangian/molecularDynamics/molecule/referredCellList/referredCellList.C create mode 100755 src/lagrangian/molecularDynamics/molecule/referredCellList/referredCellList.H create mode 100755 src/lagrangian/molecularDynamics/molecule/referredCellList/referredCellListI.H create mode 100755 src/lagrangian/molecularDynamics/molecule/referredMolecule/referredMolecule.C create mode 100755 src/lagrangian/molecularDynamics/molecule/referredMolecule/referredMolecule.H create mode 100755 src/lagrangian/molecularDynamics/molecule/referredMolecule/referredMoleculeI.H create mode 100755 src/lagrangian/molecularDynamics/molecule/tetherPotential/tetherPotential.C create mode 100755 src/lagrangian/molecularDynamics/molecule/tetherPotential/tetherPotential.H create mode 100755 src/lagrangian/molecularDynamics/molecule/tetherPotential/tetherPotentialI.H create mode 100755 src/lagrangian/molecularDynamics/molecule/tetherPotential/tetherPotentialList.C create mode 100755 src/lagrangian/molecularDynamics/molecule/tetherPotential/tetherPotentialList.H create mode 100755 src/lagrangian/molecularDynamics/molecule/tetherPotential/tetherPotentialListI.H create mode 100644 src/lagrangian/molecularDynamics/potential/Make/files create mode 100644 src/lagrangian/molecularDynamics/potential/Make/options create mode 100644 src/lagrangian/molecularDynamics/potential/energyScalingFunction/basic/energyScalingFunction.C create mode 100644 src/lagrangian/molecularDynamics/potential/energyScalingFunction/basic/energyScalingFunction.H create mode 100644 src/lagrangian/molecularDynamics/potential/energyScalingFunction/basic/newEnergyScalingFunction.C create mode 100644 src/lagrangian/molecularDynamics/potential/energyScalingFunction/derived/doubleSigmoid/doubleSigmoid.C create mode 100644 src/lagrangian/molecularDynamics/potential/energyScalingFunction/derived/doubleSigmoid/doubleSigmoid.H create mode 100644 src/lagrangian/molecularDynamics/potential/energyScalingFunction/derived/noScaling/noScaling.C create mode 100644 src/lagrangian/molecularDynamics/potential/energyScalingFunction/derived/noScaling/noScaling.H create mode 100644 src/lagrangian/molecularDynamics/potential/energyScalingFunction/derived/shifted/shifted.C create mode 100644 src/lagrangian/molecularDynamics/potential/energyScalingFunction/derived/shifted/shifted.H create mode 100644 src/lagrangian/molecularDynamics/potential/energyScalingFunction/derived/shiftedForce/shiftedForce.C create mode 100644 src/lagrangian/molecularDynamics/potential/energyScalingFunction/derived/shiftedForce/shiftedForce.H create mode 100644 src/lagrangian/molecularDynamics/potential/energyScalingFunction/derived/sigmoid/sigmoid.C create mode 100644 src/lagrangian/molecularDynamics/potential/energyScalingFunction/derived/sigmoid/sigmoid.H create mode 100644 src/lagrangian/molecularDynamics/potential/pairPotential/basic/newPairPotential.C create mode 100644 src/lagrangian/molecularDynamics/potential/pairPotential/basic/pairPotential.C create mode 100644 src/lagrangian/molecularDynamics/potential/pairPotential/basic/pairPotential.H create mode 100755 src/lagrangian/molecularDynamics/potential/pairPotential/basic/pairPotentialI.H create mode 100644 src/lagrangian/molecularDynamics/potential/pairPotential/basic/pairPotentialIO.C create mode 100644 src/lagrangian/molecularDynamics/potential/pairPotential/derived/azizChen/azizChen.C create mode 100644 src/lagrangian/molecularDynamics/potential/pairPotential/derived/azizChen/azizChen.H create mode 100644 src/lagrangian/molecularDynamics/potential/pairPotential/derived/lennardJones/lennardJones.C create mode 100644 src/lagrangian/molecularDynamics/potential/pairPotential/derived/lennardJones/lennardJones.H create mode 100644 src/lagrangian/molecularDynamics/potential/pairPotential/derived/maitlandSmith/maitlandSmith.C create mode 100644 src/lagrangian/molecularDynamics/potential/pairPotential/derived/maitlandSmith/maitlandSmith.H create mode 100755 src/lagrangian/molecularDynamics/potential/pairPotential/pairPotentialList/pairPotentialList.C create mode 100755 src/lagrangian/molecularDynamics/potential/pairPotential/pairPotentialList/pairPotentialList.H create mode 100755 src/lagrangian/molecularDynamics/potential/pairPotential/pairPotentialList/pairPotentialListI.H create mode 100644 src/lagrangian/molecularDynamics/potential/tetherPotential/basic/newTetherPotential.C create mode 100644 src/lagrangian/molecularDynamics/potential/tetherPotential/basic/tetherPotential.C create mode 100644 src/lagrangian/molecularDynamics/potential/tetherPotential/basic/tetherPotential.H create mode 100644 src/lagrangian/molecularDynamics/potential/tetherPotential/derived/harmonicSpring/harmonicSpring.C create mode 100644 src/lagrangian/molecularDynamics/potential/tetherPotential/derived/harmonicSpring/harmonicSpring.H create mode 100644 src/lagrangian/molecularDynamics/potential/tetherPotential/derived/restrainedHarmonicSpring/restrainedHarmonicSpring.C create mode 100644 src/lagrangian/molecularDynamics/potential/tetherPotential/derived/restrainedHarmonicSpring/restrainedHarmonicSpring.H create mode 100755 src/lagrangian/molecularDynamics/potential/tetherPotential/tetherPotentialList/tetherPotentialList.C create mode 100755 src/lagrangian/molecularDynamics/potential/tetherPotential/tetherPotentialList/tetherPotentialList.H create mode 100755 src/lagrangian/molecularDynamics/potential/tetherPotential/tetherPotentialList/tetherPotentialListI.H diff --git a/src/lagrangian/molecularDynamics/molecule/Make/files b/src/lagrangian/molecularDynamics/molecule/Make/files new file mode 100755 index 0000000000..a490edafe1 --- /dev/null +++ b/src/lagrangian/molecularDynamics/molecule/Make/files @@ -0,0 +1,50 @@ +correlationFunction = correlationFunction + +distribution = distribution + +molecule = molecule +moleculeCloud = moleculeCloud + +reducedUnits = reducedUnits + +referredMolecule = referredMolecule +referredCellList = referredCellList +referredCell = referredCell +referralLists = referralLists + +tetherPotential = tetherPotential + +$(distribution)/distribution.C + +$(reducedUnits)/reducedUnits.C +$(reducedUnits)/reducedUnitsIO.C + +$(molecule)/molecule.C +$(molecule)/moleculeIO.C + +$(moleculeCloud)/moleculeCloud.C +$(moleculeCloud)/moleculeCloudBuildCellOccupancy.C +$(moleculeCloud)/moleculeCloudBuildCellInteractionLists.C +$(moleculeCloud)/moleculeCloudBuildCellReferralLists.C + +$(moleculeCloud)/moleculeCloudTestEdgeEdgeDistance.C +$(moleculeCloud)/moleculeCloudTestPointFaceDistance.C +$(moleculeCloud)/moleculeCloudRealCellsInRangeOfSegment.C +$(moleculeCloud)/moleculeCloudReferredCellsInRangeOfSegment.C + +$(moleculeCloud)/moleculeCloudCalculateForce.C +$(moleculeCloud)/moleculeCloudCalculatePairForce.C +$(moleculeCloud)/moleculeCloudCalculateTetherForce.C +$(moleculeCloud)/moleculeCloudCalculateExternalForce.C +$(moleculeCloud)/moleculeCloudIntegrateEquationsOfMotion.C +$(moleculeCloud)/moleculeCloudRemoveHighEnergyOverlaps.C +$(moleculeCloud)/moleculeCloudApplyConstraintsAndThermostats.C + +$(referralLists)/receivingReferralList.C +$(referralLists)/sendingReferralList.C +$(referredCellList)/referredCellList.C +$(referredCell)/referredCell.C +$(referredMolecule)/referredMolecule.C + +LIB = $(FOAM_LIBBIN)/libmolecule + diff --git a/src/lagrangian/molecularDynamics/molecule/Make/options b/src/lagrangian/molecularDynamics/molecule/Make/options new file mode 100755 index 0000000000..cc91fd4bbe --- /dev/null +++ b/src/lagrangian/molecularDynamics/molecule/Make/options @@ -0,0 +1,10 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/lagrangian/basic/lnInclude \ + -I$(LIB_SRC)/lagrangian/molecularDynamics/potential/lnInclude + +EXE_LIBS = \ + -lfiniteVolume \ + -llagrangian \ + -lpotential + diff --git a/src/lagrangian/molecularDynamics/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulator.C b/src/lagrangian/molecularDynamics/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulator.C new file mode 100755 index 0000000000..c8a5ca0f30 --- /dev/null +++ b/src/lagrangian/molecularDynamics/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulator.C @@ -0,0 +1,238 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "bufferedAccumulator.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +template +const char* const + Foam::bufferedAccumulator::typeName("bufferedAccumulator"); + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +void Foam::bufferedAccumulator::accumulateAndResetBuffer(const label b) +{ + accumulationBuffer() += (*this)[b]; + + averagesTaken_++; + + (*this)[b] = Field(bufferLength(), pTraits::zero); + + bufferOffsets_[b] = 0; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::bufferedAccumulator::bufferedAccumulator() +: + List< Field >(), + averagesTaken_(), + bufferOffsets_() +{} + + +template +Foam::bufferedAccumulator::bufferedAccumulator +( + const label nBuffers, + const label bufferLength, + const label bufferingInterval +) +: + List< Field >(), + averagesTaken_(), + bufferOffsets_() +{ + setSizes + ( + nBuffers, + bufferLength, + bufferingInterval + ); +} + + +template +Foam::bufferedAccumulator::bufferedAccumulator +( + const bufferedAccumulator& bA +) +: + List< Field >(static_cast< List< Field > >(bA)), + averagesTaken_(bA.averagesTaken()), + bufferOffsets_(bA.bufferOffsets()) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::bufferedAccumulator::~bufferedAccumulator() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::bufferedAccumulator::setSizes +( + const label nBuffers, + const label bufferLength, + const label bufferingInterval +) +{ + (*this).setSize(nBuffers + 1); + + forAll((*this), b) + { + (*this)[b] = Field(bufferLength, pTraits::zero); + } + + averagesTaken_ = 0; + + bufferOffsets_.setSize(nBuffers); + + forAll(bufferOffsets_, bO) + { + bufferOffsets_[bO] = -bufferingInterval * bO - 1; + } +} + +template +Foam::label Foam::bufferedAccumulator::addToBuffers +( + const List& valuesToAdd +) +{ + label bufferToRefill = -1; + + for (label b = 0; b < nBuffers(); b++) + { + Field& buf((*this)[b]); + + label& bO = bufferOffsets_[b]; + + if (bO >= 0) + { + buf[bO] = valuesToAdd[b]; + } + + bO++; + + if (bO == bufferLength()) + { + accumulateAndResetBuffer(b); + } + + if (bO == 0) + { + if (bufferToRefill != -1) + { + FatalErrorIn("bufferedAccumulator::addToBuffers ") + << "More than one bufferedAccumulator accumulation " + << "buffer filled at once, this is considered an error." + << abort(FatalError); + } + + bufferToRefill = b; + } + } + + return bufferToRefill; +} + + +template +Foam::Field Foam::bufferedAccumulator::averaged() const +{ + if (averagesTaken_) + { + Field bA = accumulationBuffer()/averagesTaken_; + + return bA; + } + else + { + WarningIn + ( + "bufferedAccumulator::averagedbufferedAccumulator() const" + ) + << "Averaged correlation function requested but averagesTaken = " + << averagesTaken_ + << ". Returning empty field." + << endl; + + return Field(bufferLength(), pTraits::zero); + } +} + + +template +void Foam::bufferedAccumulator::resetAveraging() +{ + accumulationBuffer() = Field(bufferLength(), pTraits::zero); + + averagesTaken_ = 0; +} + + +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + +template +void Foam::bufferedAccumulator::operator= +( + const bufferedAccumulator& rhs +) +{ + // Check for assignment to self + if (this == &rhs) + { + FatalErrorIn + ( + "bufferedAccumulator::operator=(const bufferedAccumulator&)" + ) + << "Attempted assignment to self" + << abort(FatalError); + } + + List< Field >::operator=(rhs); + + averagesTaken_ = rhs.averagesTaken(); + + bufferOffsets_ = rhs.bufferOffsets(); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +# include "bufferedAccumulatorIO.C" + +// ************************************************************************* // diff --git a/src/lagrangian/molecularDynamics/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulator.H b/src/lagrangian/molecularDynamics/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulator.H new file mode 100755 index 0000000000..27bd52771c --- /dev/null +++ b/src/lagrangian/molecularDynamics/molecule/correlationFunction/bufferedAccumulator/bufferedAccumulator.H @@ -0,0 +1,178 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::bufferedAccumulator + +Description + +SourceFiles + bufferedAccumulatorI.H + bufferedAccumulator.C + bufferedAccumulatorIO.C + +\*---------------------------------------------------------------------------*/ + +#ifndef bufferedAccumulator_H +#define bufferedAccumulator_H + +#include "Field.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +template +class bufferedAccumulator; + +template +Ostream& operator<< +( + Ostream&, + const bufferedAccumulator& +); + +/*---------------------------------------------------------------------------*\ + Class bufferedAccumulator Declaration +\*---------------------------------------------------------------------------*/ + +template +class bufferedAccumulator +: + public List< Field > +{ + // Private data + + label averagesTaken_; + + List