Commit 5218b4f0 authored by graham's avatar graham
Browse files

Changed src/lagrangian/molecule folder to molecularDynamics and split off...

Changed src/lagrangian/molecule folder to molecularDynamics and split off separate potential library.
parent 32839999
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
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
/*---------------------------------------------------------------------------*\
========= |
\\ / 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<class Type>
const char* const
Foam::bufferedAccumulator<Type>::typeName("bufferedAccumulator");
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Type>
void Foam::bufferedAccumulator<Type>::accumulateAndResetBuffer(const label b)
{
accumulationBuffer() += (*this)[b];
averagesTaken_++;
(*this)[b] = Field<Type>(bufferLength(), pTraits<Type>::zero);
bufferOffsets_[b] = 0;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::bufferedAccumulator<Type>::bufferedAccumulator()
:
List< Field<Type> >(),
averagesTaken_(),
bufferOffsets_()
{}
template<class Type>
Foam::bufferedAccumulator<Type>::bufferedAccumulator
(
const label nBuffers,
const label bufferLength,
const label bufferingInterval
)
:
List< Field<Type> >(),
averagesTaken_(),
bufferOffsets_()
{
setSizes
(
nBuffers,
bufferLength,
bufferingInterval
);
}
template<class Type>
Foam::bufferedAccumulator<Type>::bufferedAccumulator
(
const bufferedAccumulator<Type>& bA
)
:
List< Field<Type> >(static_cast< List< Field<Type> > >(bA)),
averagesTaken_(bA.averagesTaken()),
bufferOffsets_(bA.bufferOffsets())
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type>
Foam::bufferedAccumulator<Type>::~bufferedAccumulator()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::bufferedAccumulator<Type>::setSizes
(
const label nBuffers,
const label bufferLength,
const label bufferingInterval
)
{
(*this).setSize(nBuffers + 1);
forAll((*this), b)
{
(*this)[b] = Field<Type>(bufferLength, pTraits<Type>::zero);
}
averagesTaken_ = 0;
bufferOffsets_.setSize(nBuffers);
forAll(bufferOffsets_, bO)
{
bufferOffsets_[bO] = -bufferingInterval * bO - 1;
}
}
template<class Type>
Foam::label Foam::bufferedAccumulator<Type>::addToBuffers
(
const List<Type>& valuesToAdd
)
{
label bufferToRefill = -1;
for (label b = 0; b < nBuffers(); b++)
{
Field<Type>& 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<Type>::addToBuffers ")
<< "More than one bufferedAccumulator accumulation "
<< "buffer filled at once, this is considered an error."
<< abort(FatalError);
}
bufferToRefill = b;
}
}
return bufferToRefill;
}
template<class Type>
Foam::Field<Type> Foam::bufferedAccumulator<Type>::averaged() const
{
if (averagesTaken_)
{
Field<Type> bA = accumulationBuffer()/averagesTaken_;
return bA;
}
else
{
WarningIn
(
"bufferedAccumulator<Type>::averagedbufferedAccumulator() const"
)
<< "Averaged correlation function requested but averagesTaken = "
<< averagesTaken_
<< ". Returning empty field."
<< endl;
return Field<Type>(bufferLength(), pTraits<Type>::zero);
}
}
template<class Type>
void Foam::bufferedAccumulator<Type>::resetAveraging()
{
accumulationBuffer() = Field<Type>(bufferLength(), pTraits<Type>::zero);
averagesTaken_ = 0;
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class Type>
void Foam::bufferedAccumulator<Type>::operator=
(
const bufferedAccumulator<Type>& rhs
)
{
// Check for assignment to self
if (this == &rhs)
{
FatalErrorIn
(
"bufferedAccumulator<Type>::operator=(const bufferedAccumulator&)"
)
<< "Attempted assignment to self"
<< abort(FatalError);
}
List< Field<Type> >::operator=(rhs);
averagesTaken_ = rhs.averagesTaken();
bufferOffsets_ = rhs.bufferOffsets();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
# include "bufferedAccumulatorIO.C"
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 Type>
class bufferedAccumulator;
template<class Type>
Ostream& operator<<
(
Ostream&,
const bufferedAccumulator<Type>&
);
/*---------------------------------------------------------------------------*\
Class bufferedAccumulator Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class bufferedAccumulator
:
public List< Field<Type> >
{
// Private data
label averagesTaken_;
List<label> bufferOffsets_;
// Private Member Functions
inline Field<Type>& accumulationBuffer();
inline const Field<Type>& accumulationBuffer() const;
void accumulateAndResetBuffer(const label b);
public:
//- Component type
typedef typename pTraits<Type>::cmptType cmptType;
// Static data members
static const char* const typeName;
// Constructors
//- Construct null
bufferedAccumulator();
//- Construct from components
bufferedAccumulator
(
const label nBuffers,
const label bufferLength,
const label bufferingInterval
);
//- Construct as copy
bufferedAccumulator(const bufferedAccumulator<Type>&);
// Destructor
~bufferedAccumulator();
// Member Functions
label addToBuffers(const List<Type>& valuesToAdd);
Field<Type> averaged() const;
void resetAveraging();
// Access
inline label averagesTaken() const;
inline label nBuffers() const;
inline label bufferLength() const;
inline const List<label>& bufferOffsets() const;
// Edit
void setSizes
(
const label nBuffers,
const label bufferLength,
const label bufferingInterval
);
// Member Operators
void operator=(const bufferedAccumulator<Type>&);
// IOstream Operators
friend Ostream& operator<< <Type>
(
Ostream&,
const bufferedAccumulator<Type>&
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "bufferedAccumulatorI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "bufferedAccumulator.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
\*---------------------------------------------------------------------------*/
namespace Foam
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Type>
inline Field<Type>& bufferedAccumulator<Type>::accumulationBuffer()
{
return (*this)[nBuffers()];
}
template<class Type>
inline const Field<Type>& bufferedAccumulator<Type>::accumulationBuffer() const
{
return (*this)[nBuffers()];
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
inline label bufferedAccumulator<Type>::averagesTaken() const
{
return averagesTaken_;
}
template<class Type>
inline label bufferedAccumulator<Type>::nBuffers() const
{
return bufferOffsets_.size();
}
template<class Type>
inline label bufferedAccumulator<Type>::bufferLength() const
{
return (*this)[0].size();
}
template<class Type>
inline const List<label>& bufferedAccumulator<Type>::bufferOffsets() const
{
return bufferOffsets_;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source bAD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 OpenbAD 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