Merge commit 'origin/master' into olesenm

This commit is contained in:
Mark Olesen
2008-05-23 18:26:11 +02:00
832 changed files with 21473 additions and 494230 deletions

View File

@ -15,7 +15,7 @@ wmake libso edgeMesh
wmake libso meshTools
wmake libso finiteVolume
( cd MGridGenGamgAgglomeration && ./Allwmake )
( cd decompositionAgglomeration && ./Allwmake )
wmake libso sampling

View File

@ -65,7 +65,7 @@ string pOpen(const string &cmd, label line=0)
{
string str(buffer);
return str.substr(0, str.size()-1);
}
}
}
pclose(cmdPipe);
}
@ -93,9 +93,9 @@ void printSourceFileAndLine
void *addr;
sscanf(myAddress.c_str(), "%p",&addr);
Dl_info info;
dladdr(addr, &info);
unsigned long offset = ulong(info.dli_fbase);
@ -216,7 +216,7 @@ void error::printStack(Ostream& os)
{
string::size_type lPos = msg.find('[');
string::size_type rPos = msg.find(']');
if (lPos != string::npos && rPos != string::npos && lPos<rPos)
{
address = msg.substr(lPos+1, rPos-lPos-1);
@ -274,7 +274,7 @@ void error::printStack(Ostream& os)
else
{
string::size_type endBracketPos = msg.find(')', start);
if (endBracketPos != string::size_type(string::npos))
{
string fullName(msg.substr(start, endBracketPos-start));

View File

@ -329,7 +329,6 @@ $(polyBoundaryMesh)/polyBoundaryMesh.C
$(polyBoundaryMesh)/polyBoundaryMeshEntries.C
meshes/ProcessorTopology/commSchedule.C
meshes/ProcessorTopology/dataSchedule.C
globalMeshData = $(polyMesh)/globalMeshData
$(globalMeshData)/globalMeshData.C

View File

@ -183,6 +183,12 @@ label findLower
);
//- To construct a List from a C array. Has extra Container type
// to initialise e.g. wordList from arrays of char*.
template<class Container, class T, int nRows>
List<Container> initList(const T[nRows]);
//- To construct a (square) ListList from a C array. Has extra Container type
// to initialise e.g. faceList from arrays of labels.
template<class Container, class T, int nRows, int nColumns>

View File

@ -486,6 +486,19 @@ Foam::label Foam::findLower
}
template<class Container, class T, int nRows>
Foam::List<Container> Foam::initList(const T elems[nRows])
{
List<Container> faces(nRows);
forAll(faces, faceI)
{
faces[faceI] = Container(elems[faceI]);
}
return faces;
}
template<class Container, class T, int nRows, int nColumns>
Foam::List<Container> Foam::initListList(const T elems[nRows][nColumns])
{

View File

@ -66,7 +66,7 @@ basicSymmetryPointPatchField<Type>::basicSymmetryPointPatchField
const pointPatchFieldMapper&
)
:
pointPatchField<Type>(ptf, iF)
pointPatchField<Type>(p, iF)
{}

View File

@ -72,7 +72,7 @@ calculatedPointPatchField<Type>::calculatedPointPatchField
const pointPatchFieldMapper&
)
:
pointPatchField<Type>(ptf, iF)
pointPatchField<Type>(p, iF)
{}

View File

@ -65,7 +65,7 @@ coupledPointPatchField<Type>::coupledPointPatchField
const pointPatchFieldMapper&
)
:
pointPatchField<Type>(ptf, iF)
pointPatchField<Type>(p, iF)
{}

View File

@ -114,7 +114,7 @@ valuePointPatchField<Type>::valuePointPatchField
const pointPatchFieldMapper& mapper
)
:
pointPatchField<Type>(ptf, iF),
pointPatchField<Type>(p, iF),
Field<Type>(ptf, mapper)
{}

View File

@ -65,7 +65,7 @@ zeroGradientPointPatchField<Type>::zeroGradientPointPatchField
const pointPatchFieldMapper&
)
:
pointPatchField<Type>(ptf, iF)
pointPatchField<Type>(p, iF)
{}

View File

@ -81,10 +81,10 @@ cyclicPointPatchField<Type>::cyclicPointPatchField
const cyclicPointPatchField<Type>& ptf,
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF,
const pointPatchFieldMapper&
const pointPatchFieldMapper& mapper
)
:
coupledPointPatchField<Type>(ptf, iF),
coupledPointPatchField<Type>(ptf, p, iF, mapper),
cyclicPatch_(refCast<const cyclicPointPatch>(p))
{
if (!isType<cyclicPointPatch>(this->patch()))

View File

@ -81,7 +81,7 @@ emptyPointPatchField<Type>::emptyPointPatchField
const pointPatchFieldMapper&
)
:
pointPatchField<Type>(ptf, iF)
pointPatchField<Type>(p, iF)
{
if (!isType<emptyPointPatch>(this->patch()))
{

View File

@ -66,10 +66,10 @@ processorPointPatchField<Type>::processorPointPatchField
const processorPointPatchField<Type>& ptf,
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF,
const pointPatchFieldMapper&
const pointPatchFieldMapper& mapper
)
:
coupledPointPatchField<Type>(ptf, iF),
coupledPointPatchField<Type>(ptf, p, iF, mapper),
procPatch_(refCast<const processorPointPatch>(ptf.patch()))
{}

View File

@ -78,10 +78,10 @@ symmetryPointPatchField<Type>::symmetryPointPatchField
const symmetryPointPatchField<Type>& ptf,
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF,
const pointPatchFieldMapper&
const pointPatchFieldMapper& mapper
)
:
basicSymmetryPointPatchField<Type>(ptf, iF)
basicSymmetryPointPatchField<Type>(ptf, p, iF, mapper)
{
if (!isType<symmetryPointPatch>(this->patch()))
{

View File

@ -82,7 +82,7 @@ wedgePointPatchField<Type>::wedgePointPatchField
const pointPatchFieldMapper&
)
:
pointPatchField<Type>(ptf, iF)
pointPatchField<Type>(p, iF)
{
if (!isType<wedgePointPatch>(this->patch()))
{

View File

@ -1,222 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "ComponentMixedPointPatchVectorField.H"
#include "PointPatchFieldMapper.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template
<
template<class> class PatchField,
class PointPatch
>
void ComponentMixedPointPatchVectorField<PatchField, PointPatch>
::checkFieldSize() const
{
if
(
this->size() != this->patch().size()
|| refValue_.size() != this->patch().size()
|| valueFraction_.size() != this->patch().size()
)
{
FatalErrorIn
(
"void ComponentMixedPointPatchVectorField::checkField() const"
) << "field does not correspond to patch. " << endl
<< "Field size: " << this->size()
<< " value size: " << refValue_.size()
<< " valueFraction size: " << valueFraction_.size()
<< " patch size: " << this->patch().size()
<< abort(FatalError);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template
<
template<class> class PatchField,
class PointPatch
>
ComponentMixedPointPatchVectorField<PatchField, PointPatch>::
ComponentMixedPointPatchVectorField
(
const PointPatch& p,
const DimensionedField<vector, pointMesh>& iF
)
:
PatchField<vector>(p, iF),
refValue_(p.size()),
valueFraction_(p.size())
{}
template
<
template<class> class PatchField,
class PointPatch
>
ComponentMixedPointPatchVectorField<PatchField, PointPatch>::
ComponentMixedPointPatchVectorField
(
const PointPatch& p,
const DimensionedField<vector, pointMesh>& iF,
const dictionary& dict
)
:
PatchField<vector>(p, iF, dict),
refValue_("refValue", dict, p.size()),
valueFraction_("valueFraction", dict, p.size())
{}
template
<
template<class> class PatchField,
class PointPatch
>
ComponentMixedPointPatchVectorField<PatchField, PointPatch>::
ComponentMixedPointPatchVectorField
(
const ComponentMixedPointPatchVectorField<PatchField, PointPatch>& ptf,
const PointPatch& p,
const DimensionedField<vector, pointMesh>& iF,
const PointPatchFieldMapper& mapper
)
:
PatchField<vector>(ptf, iF),
refValue_(ptf.refValue_, mapper),
valueFraction_(ptf.valueFraction_, mapper)
{}
template
<
template<class> class PatchField,
class PointPatch
>
ComponentMixedPointPatchVectorField<PatchField, PointPatch>::
ComponentMixedPointPatchVectorField
(
const ComponentMixedPointPatchVectorField<PatchField, PointPatch>& ptf,
const DimensionedField<vector, pointMesh>& iF
)
:
PatchField<vector>(ptf, iF),
refValue_(ptf.refValue_),
valueFraction_(ptf.valueFraction_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template
<
template<class> class PatchField,
class PointPatch
>
void ComponentMixedPointPatchVectorField<PatchField, PointPatch>::autoMap
(
const PointPatchFieldMapper& m
)
{
refValue_.autoMap(m);
valueFraction_.autoMap(m);
}
// Grab the values using rmap
template
<
template<class> class PatchField,
class PointPatch
>
void ComponentMixedPointPatchVectorField<PatchField, PointPatch>::rmap
(
const PointPatchField<PatchField, PointPatch, vector>& ptf,
const labelList& addr
)
{
const ComponentMixedPointPatchVectorField& mptf =
refCast<const ComponentMixedPointPatchVectorField>(ptf);
refValue_.rmap(mptf.refValue_, addr);
valueFraction_.rmap(mptf.valueFraction_, addr);
}
// Evaluate patch field
template
<
template<class> class PatchField,
class PointPatch
>
void ComponentMixedPointPatchVectorField<PatchField, PointPatch>::evaluate
(
const Pstream::commsTypes
)
{
tmp<vectorField> internalValues = this->patchInternalField();
// Get internal field to insert values into
Field<vector>& iF = const_cast<vectorField&>(this->internalField());
vectorField values =
cmptMultiply(refValue_, valueFraction_)
+ cmptMultiply(internalValues, vector::one - valueFraction_);
this->setInInternalField(iF, values);
}
// Write
template
<
template<class> class PatchField,
class PointPatch
>
void ComponentMixedPointPatchVectorField<PatchField, PointPatch>::
write(Ostream& os) const
{
PatchField<vector>::write(os);
refValue_.writeEntry("refValue", os);
valueFraction_.writeEntry("valueFraction", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,218 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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::ComponentMixedPointPatchVectorField
Description
The boundary condition is a mix of a fixedValue and a zeroGradient
boundary condition, where a fixedValue/zeroGradient mix may be
different for each direction.
I am still not sure how to do the fixedValue-fixedGradient
combination.
SourceFiles
ComponentMixedPointPatchVectorField.C
\*---------------------------------------------------------------------------*/
#ifndef ComponentMixedPointPatchVectorField_H
#define ComponentMixedPointPatchVectorField_H
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class ComponentMixedPointPatchVectorField Declaration
\*---------------------------------------------------------------------------*/
template
<
template<class> class PatchField,
class PointPatch
>
class ComponentMixedPointPatchVectorField
:
public PatchField<vector>
{
// Private data
//- Fraction vector of value used for boundary condition
vectorField refValue_;
//- Fraction vector of value used for boundary condition
vectorField valueFraction_;
// Private member functions
void checkFieldSize() const;
public:
//- Runtime type information
TypeName("componentMixed");
// Constructors
//- Construct from patch and internal field
ComponentMixedPointPatchVectorField
(
const PointPatch&,
const DimensionedField<vector, pointMesh>&
);
//- Construct from patch, internal field and dictionary
ComponentMixedPointPatchVectorField
(
const PointPatch&,
const DimensionedField<vector, pointMesh>&,
const dictionary&
);
//- Construct by mapping given patchVectorField onto a new patch
ComponentMixedPointPatchVectorField
(
const ComponentMixedPointPatchVectorField<PatchField, PointPatch>&,
const PointPatch&,
const DimensionedField<vector, pointMesh>&,
const PointPatchFieldMapper&
);
//- Construct and return a clone
virtual autoPtr<PatchField<vector> > clone() const
{
return autoPtr<PatchField<vector> >
(
new ComponentMixedPointPatchVectorField
<PatchField, PointPatch>
(
*this
)
);
}
//- Construct as copy setting internal field reference
ComponentMixedPointPatchVectorField
(
const ComponentMixedPointPatchVectorField<PatchField, PointPatch>&,
const DimensionedField<vector, pointMesh>&
);
//- Construct and return a clone setting internal field reference
virtual autoPtr<PatchField<vector> > clone
(
const DimensionedField<vector, pointMesh>& iF
) const
{
return autoPtr<PatchField<vector> >
(
new ComponentMixedPointPatchVectorField
<PatchField, PointPatch>
(
*this,
iF
)
);
}
// Member functions
// Return defining fields
virtual vectorField& refValue()
{
return refValue_;
}
virtual const vectorField& refValue() const
{
return refValue_;
}
virtual vectorField& valueFraction()
{
return valueFraction_;
}
virtual const vectorField& valueFraction() const
{
return valueFraction_;
}
// Mapping functions
//- Map (and resize as needed) from self given a mapping object
virtual void autoMap
(
const PointPatchFieldMapper&
);
//- Reverse map the given PointPatchVectorField onto
// this PointPatchVectorField
virtual void rmap
(
const PointPatchField<PatchField, PointPatch, vector>&,
const labelList&
);
// Evaluation functions
//- Insert boundary value into the internal field
virtual void evaluate
(
const Pstream::commsTypes commsType=Pstream::Pstream::blocking
);
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "ComponentMixedPointPatchVectorField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -82,10 +82,10 @@ globalPointPatchField<Type>::globalPointPatchField
const globalPointPatchField<Type>& ptf,
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF,
const pointPatchFieldMapper&
const pointPatchFieldMapper& mapper
)
:
coupledPointPatchField<Type>(ptf, iF),
coupledPointPatchField<Type>(ptf, p, iF, mapper),
globalPointPatch_(refCast<const globalPointPatch>(ptf.patch()))
{
if (!isType<globalPointPatch>(this->patch()))

View File

@ -62,10 +62,10 @@ slipPointPatchField<Type>::slipPointPatchField
const slipPointPatchField<Type>& ptf,
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF,
const pointPatchFieldMapper&
const pointPatchFieldMapper& mapper
)
:
basicSymmetryPointPatchField<Type>(ptf, iF)
basicSymmetryPointPatchField<Type>(ptf, p, iF, mapper)
{}

View File

@ -1,149 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "dataSchedule.H"
#include "SortableList.H"
#include "commSchedule.H"
#include "Pstream.H"
#include "HashSet.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(dataSchedule, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from separate addressing
Foam::dataSchedule::dataSchedule
(
const labelList& sendProcs,
const labelList& receiveProcs
)
:
sendOrder_(Pstream::nProcs()),
receiveOrder_(Pstream::nProcs())
{
// Determine the schedule
// ~~~~~~~~~~~~~~~~~~~~~~
// Get all pairs of processors. Leave out local comms.
List<labelPair> allComms;
{
HashSet<labelPair, labelPair::Hash<> > commsSet(Pstream::nProcs());
forAll(receiveProcs, i)
{
if (sendProcs[i] != receiveProcs[i])
{
commsSet.insert(labelPair(sendProcs[i], receiveProcs[i]));
}
}
allComms = commsSet.toc();
}
// Determine my schedule.
labelList mySchedule
(
commSchedule
(
Pstream::nProcs(),
allComms
).procSchedule()[Pstream::myProcNo()]
);
// Processors involved in my schedule
List<labelPair>::operator=
(
IndirectList<labelPair>(allComms, mySchedule)
);
if (debug)
{
Pout<< "I need to:" << endl;
forAll(*this, i)
{
const labelPair& twoProcs = operator[](i);
label sendProc = twoProcs[0];
label recvProc = twoProcs[1];
if (recvProc == Pstream::myProcNo())
{
Pout<< " receive from " << sendProc << endl;
}
else
{
Pout<< " send to " << recvProc << endl;
}
}
}
// Determine the addressing
// ~~~~~~~~~~~~~~~~~~~~~~~~
// Per processor the indices we have to send/receive.
List<DynamicList<label> > dynSendOrder(Pstream::nProcs());
List<DynamicList<label> > dynReceiveOrder(Pstream::nProcs());
// Estimate size
forAll(dynSendOrder, procI)
{
dynSendOrder[procI].setSize(sendProcs.size()/Pstream::nProcs());
dynReceiveOrder[procI].setSize(sendProcs.size()/Pstream::nProcs());
}
forAll(sendProcs, sampleI)
{
// Note that also need to include local communication (both receiveProc
// and sendProc on local processor)
if (Pstream::myProcNo() == sendProcs[sampleI])
{
// I am the sender
dynSendOrder[receiveProcs[sampleI]].append(sampleI);
}
if (Pstream::myProcNo() == receiveProcs[sampleI])
{
// I am the receiver
dynReceiveOrder[sendProcs[sampleI]].append(sampleI);
}
}
forAll(dynSendOrder, procI)
{
sendOrder_[procI].transfer(dynSendOrder[procI].shrink());
receiveOrder_[procI].transfer(dynReceiveOrder[procI].shrink());
}
}
// ************************************************************************* //

View File

@ -1,188 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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::dataSchedule
Description
Gets for every data item the source processor and the send processor.
Determines:
- which processor do I need to send to / receive from
- what are the indices into the data I need to send / I am receiving.
Example:
- we have global sampling points
- for every sampling point we have the cell/processor containing the point
(sampleCells, sampleCellProcs)
- for every sampling point we also have the destination cell/processor
(receiveCells, receiveCellProcs)
- sampleCellProcs, receiveCellProcs have to be the same on all processors!
then we construct dataSchedule:
@code
dataSchedule mySchedule(sampleCellProcs, receiveCellProcs);
const labelListList& sendOrder = mySchedule.sendOrder();
const labelListList& receiveOrder = mySchedule.receiveOrder();
// Do all remote data
// ~~~~~~~~~~~~~~~~~~
forAll(mySchedule, commI)
{
const labelPair& twoProcs = mySchedule[i];
label sendProc = twoProcs[0];
label recvProc = twoProcs[1];
if (Pstream::myProcNo() == sendProc)
{
// I am sender. Send to recvProc.
// Labels of my cells to sample
labelList cellLabels
(
IndirectList<label>(sampleCells, sendOrder[recvProc])
);
OPstream toProc(recvProc);
toProc<< IndirectList<vector>(fld, cellLabels)();
}
else
{
// I am receiver. Receive from sendProc.
IPstream fromProc(sendProc);
vectorField fromFld(fromProc);
// Destination cells
labelList cellLabels
(
IndirectList<label>(receiveCells, receiveOrder[sendProc])
);
forAll(fromFld, i)
{
fld[cellLabels[i]] = fromFld[i];
}
}
}
// Do local data
// ~~~~~~~~~~~~~
labelList sendCells
(
IndirectList<label>(sampleCells, sendOrder[Pstream::myProcNo()])
);
vectorField toMyself(IndirectList<vector>(fld, sendCells)());
// Destination cells
labelList recvCells
(
IndirectList<label>
(
patchFaces,
receiveOrder[Pstream::myProcNo()]
)
);
forAll(toMyself, i)
{
recvCells[i] = toMySelf[i];
}
@endcode
SourceFiles
dataSchedule.C
\*---------------------------------------------------------------------------*/
#ifndef dataSchedule_H
#define dataSchedule_H
#include "commSchedule.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class dataSchedule Declaration
\*---------------------------------------------------------------------------*/
class dataSchedule
:
public List<labelPair>
{
// Private data
//- Per processor to send to the order in which the data needs to
// be packed.
labelListList sendOrder_;
//- Per processor to receive from the order how to unpack the
// received data.
labelListList receiveOrder_;
public:
ClassName("dataSchedule");
// Constructors
//- Construct from components
dataSchedule(const labelList& sendProcs, const labelList& receiveProcs);
// Member Functions
//- Send order per processor
const labelListList& sendOrder() const
{
return sendOrder_;
}
//- Receive order per processor
const labelListList& receiveOrder() const
{
return receiveOrder_;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -185,6 +185,78 @@ Foam::mapDistribute::mapDistribute
{}
Foam::mapDistribute::mapDistribute
(
const labelList& sendProcs,
const labelList& recvProcs
)
:
constructSize_(sendProcs.size()),
schedulePtr_()
{
if (sendProcs.size() != recvProcs.size())
{
FatalErrorIn
(
"mapDistribute::mapDistribute(const labelList&, const labelList&)"
) << "The send and receive data is not the same length. sendProcs:"
<< sendProcs.size() << " recvProcs:" << recvProcs.size()
<< abort(FatalError);
}
// Per processor the number of samples we have to send/receive.
labelList nSend(Pstream::nProcs(), 0);
labelList nRecv(Pstream::nProcs(), 0);
forAll(sendProcs, sampleI)
{
label sendProc = sendProcs[sampleI];
label recvProc = recvProcs[sampleI];
// Note that also need to include local communication (both
// RecvProc and sendProc on local processor)
if (Pstream::myProcNo() == sendProc)
{
// I am the sender. Count destination processor.
nSend[recvProc]++;
}
if (Pstream::myProcNo() == recvProc)
{
// I am the receiver.
nRecv[sendProc]++;
}
}
subMap_.setSize(Pstream::nProcs());
constructMap_.setSize(Pstream::nProcs());
forAll(nSend, procI)
{
subMap_[procI].setSize(nSend[procI]);
constructMap_[procI].setSize(nRecv[procI]);
}
nSend = 0;
nRecv = 0;
forAll(sendProcs, sampleI)
{
label sendProc = sendProcs[sampleI];
label recvProc = recvProcs[sampleI];
if (Pstream::myProcNo() == sendProc)
{
// I am the sender. Store index I need to send.
subMap_[recvProc][nSend[recvProc]++] = sampleI;
}
if (Pstream::myProcNo() == recvProc)
{
// I am the receiver.
constructMap_[sendProc][nRecv[sendProc]++] = sampleI;
}
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //

View File

@ -111,6 +111,14 @@ public:
const bool reUse // clone or reuse
);
//- Construct from reverse addressing: per data item the send
// processor and the receive processor. All processors get same data.
mapDistribute
(
const labelList& sendProcs,
const labelList& recvProcs
);
// Member Functions

View File

@ -10,7 +10,6 @@ $(autoHexMesh)/meshRefinement/meshRefinement.C
$(autoHexMesh)/meshRefinement/meshRefinementMerge.C
$(autoHexMesh)/meshRefinement/meshRefinementRefine.C
$(autoHexMesh)/refinementSurfaces/refinementSurfaces.C
$(autoHexMesh)/offsetTriSurfaceMesh/offsetTriSurfaceMesh.C
$(autoHexMesh)/trackedParticle/trackedParticle.C
$(autoHexMesh)/trackedParticle/trackedParticleCloud.C

View File

@ -2,13 +2,13 @@
EXE_INC = \
/* -g -DFULLDEBUG -O0 $(CGAL_CXXFLAGS) */ \
-I$(FOAM_UTILITIES)/parallelProcessing/decompositionMethods/decompositionMethods/lnInclude \
-I$(LIB_SRC)/decompositionAgglomeration/decompositionMethods/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(FOAM_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/edgeMesh/lnInclude \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/triSurface/lnInclude
LIB_LIBS = \
-ldecompositionMethods \

View File

@ -1183,7 +1183,8 @@ void Foam::autoHexMeshDriver::mergePatchFaces()
meshRefiner.mergePatchFaces
(
Foam::cos(45*mathematicalConstant::pi/180.0),
Foam::cos(45*mathematicalConstant::pi/180.0)
Foam::cos(45*mathematicalConstant::pi/180.0),
meshRefinement::addedPatches(globalToPatch_)
);
if (debug_)

View File

@ -62,7 +62,15 @@ Foam::label Foam::autoHexMeshDriver::mergePatchFacesUndo
combineFaces faceCombiner(mesh_, true);
// Get all sets of faces that can be merged
labelListList allFaceSets(faceCombiner.getMergeSets(minCos, concaveCos));
labelListList allFaceSets
(
faceCombiner.getMergeSets
(
minCos,
concaveCos,
meshRefinement::addedPatches(globalToPatch_)
)
);
label nFaceSets = returnReduce(allFaceSets.size(), sumOp<label>());

View File

@ -607,9 +607,8 @@ public:
label mergePatchFaces
(
const scalar minCos,
const scalar concaveCos
//const dictionary& motionDict,
//const labelList& globalToPatch
const scalar concaveCos,
const labelList& patchIDs
);
//- Remove points not used by any face or points used

View File

@ -48,14 +48,43 @@ Class
Foam::label Foam::meshRefinement::mergePatchFaces
(
const scalar minCos,
const scalar concaveCos
const scalar concaveCos,
const labelList& patchIDs
)
{
// Patch face merging engine
combineFaces faceCombiner(mesh_);
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
// Pick up all cells on boundary
labelHashSet boundaryCells(mesh_.nFaces()-mesh_.nInternalFaces());
forAll(patchIDs, i)
{
label patchI = patchIDs[i];
const polyPatch& patch = patches[patchI];
if (!patch.coupled())
{
forAll(patch, i)
{
boundaryCells.insert(mesh_.faceOwner()[patch.start()+i]);
}
}
}
// Get all sets of faces that can be merged
labelListList mergeSets(faceCombiner.getMergeSets(minCos, concaveCos));
labelListList mergeSets
(
faceCombiner.getMergeSets
(
minCos,
concaveCos,
boundaryCells
)
);
label nFaceSets = returnReduce(mergeSets.size(), sumOp<label>());

View File

@ -1,199 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "offsetTriSurfaceMesh.H"
#include "Random.H"
#include "addToRunTimeSelectionTable.H"
#include "triSurfaceTools.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(offsetTriSurfaceMesh, 0);
addToRunTimeSelectionTable(searchableSurface, offsetTriSurfaceMesh, dict);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::offsetTriSurfaceMesh::offsetTriSurfaceMesh
(
const IOobject& io,
const triSurface& s,
const scalar offset)
:
triSurfaceMesh(io, s),
offset_(offset)
{}
Foam::offsetTriSurfaceMesh::offsetTriSurfaceMesh
(
const IOobject& io,
const scalar offset
)
:
triSurfaceMesh(io),
offset_(offset)
{}
Foam::offsetTriSurfaceMesh::offsetTriSurfaceMesh
(
const word& name,
const objectRegistry& obj,
const dictionary& dict
)
:
triSurfaceMesh(name, obj, dict),
offset_(readScalar(dict.lookup("offset")))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::offsetTriSurfaceMesh::~offsetTriSurfaceMesh()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::pointIndexHit Foam::offsetTriSurfaceMesh::findNearest
(
const point& sample,
const scalar nearestDistSqr
) const
{
// Find nearest (add offset to search span)
pointIndexHit surfNearest = triSurfaceMesh::findNearest
(
sample,
nearestDistSqr + Foam::sqr(offset_)
);
// Shift back onto surface
if (surfNearest.hit())
{
vector n(sample-surfNearest.hitPoint());
n /= mag(n)+VSMALL;
surfNearest.setPoint(surfNearest.hitPoint() + offset_*n);
}
return surfNearest;
}
Foam::pointIndexHit Foam::offsetTriSurfaceMesh::findNearestOnEdge
(
const point& sample,
const scalar nearestDistSqr
) const
{
// Find nearest (add offset to search span)
pointIndexHit surfNearest = triSurfaceMesh::findNearestOnEdge
(
sample,
nearestDistSqr + Foam::sqr(offset_)
);
// Shift back onto surface
if (surfNearest.hit())
{
vector n = sample-surfNearest.hitPoint();
n /= mag(n)+VSMALL;
surfNearest.setPoint(surfNearest.hitPoint() + offset_*n);
}
return surfNearest;
}
Foam::searchableSurface::volumeType Foam::offsetTriSurfaceMesh::getVolumeType
(
const point& sample
) const
{
// Find the nearest point on background surface
pointIndexHit surfNearest = triSurfaceMesh::findNearest
(
sample,
Foam::sqr(GREAT)
);
if (!surfNearest.hit())
{
FatalErrorIn("offsetTriSurfaceMesh::getVolumeType(const point&)")
<< "treeBb:" << tree().bb()
<< " sample:" << sample
<< " surfNearest:" << surfNearest
<< abort(FatalError);
}
// Offset sample to the point.
vector n(surfNearest.hitPoint()-sample);
n /= mag(n)+VSMALL;
triSurfaceTools::sideType t = triSurfaceTools::surfaceSide
(
*this,
sample+offset_*n,
surfNearest.index(),
surfNearest.hitPoint()
);
if (t == triSurfaceTools::UNKNOWN)
{
return searchableSurface::UNKNOWN;
}
else if (t == triSurfaceTools::INSIDE)
{
return searchableSurface::INSIDE;
}
else if (t == triSurfaceTools::OUTSIDE)
{
return searchableSurface::OUTSIDE;
}
else
{
FatalErrorIn("offsetTriSurfaceMesh::getVolumeType(const point&)")
<< "problem" << abort(FatalError);
return searchableSurface::UNKNOWN;
}
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
// ************************************************************************* //

View File

@ -1,167 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
offsetTriSurfaceMesh
Description
triSurfaceMesh with offset. Used to define refinement boxes as a region
within certain distance to the refinement surface.
Note: reloads surface.
SourceFiles
offsetTriSurfaceMesh.C
\*---------------------------------------------------------------------------*/
#ifndef offsetTriSurfaceMesh_H
#define offsetTriSurfaceMesh_H
#include "triSurfaceMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class offsetTriSurfaceMesh Declaration
\*---------------------------------------------------------------------------*/
class offsetTriSurfaceMesh
:
public triSurfaceMesh
{
// Private data
const scalar offset_;
public:
//- Runtime type information
TypeName("offsetTriSurfaceMesh");
// Constructors
//- Construct from triSurface and offset
offsetTriSurfaceMesh(const IOobject&, const triSurface&, const scalar);
//- Construct read and offset
offsetTriSurfaceMesh(const IOobject& io, const scalar);
//- Construct as searchableSurface
offsetTriSurfaceMesh
(
const word& name,
const objectRegistry& obj,
const dictionary& dict
);
// Destructor
virtual ~offsetTriSurfaceMesh();
// Member Functions
// searchableSurface implementation
//- Calculate nearest point on surface. Returns
// - bool : any point found nearer than nearestDistSqr
// - label: relevant index in surface
// - point: actual nearest point found
virtual pointIndexHit findNearest
(
const point& sample,
const scalar nearestDistSqr
) const;
//- Calculate nearest point on edge. Returns
// - bool : any point found nearer than nearestDistSqr
// - label: relevant index in surface
// - point: actual nearest point found
virtual pointIndexHit findNearestOnEdge
(
const point& sample,
const scalar nearestDistSqr
) const;
//- Find nearest to line. Returns
// - bool : any point found?
// - label: relevant index in shapes
// - point: actual nearest point found
// sets:
// - tightest : bounding box
// - linePoint : corresponding nearest point on line
virtual pointIndexHit findNearest
(
const linePointRef& ln,
treeBoundBox& tightest,
point& linePoint
) const
{
notImplemented("offsetTriSurfaceMesh::findNearest(..)");
return pointIndexHit();
}
//- Find nearest intersection of line between start and end.
virtual pointIndexHit findLine
(
const point& start,
const point& end
) const
{
notImplemented("offsetTriSurfaceMesh::findLine(..)");
return pointIndexHit();
}
//- Find any intersection of line between start and end.
virtual pointIndexHit findLineAny
(
const point& start,
const point& end
) const
{
notImplemented("offsetTriSurfaceMesh::findLine(..)");
return pointIndexHit();
}
//- Determine type (inside/outside/mixed) for point. unknown if
// cannot be determined (e.g. non-manifold surface)
virtual volumeType getVolumeType(const point&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,14 @@
#!/bin/sh
set -x
wmake libso decompositionMethods
if [ -d $FOAM_MPI_LIBBIN ]
then
wmake libso parMetisDecomp
fi
( cd MGridGenGamgAgglomeration && ./Allwmake )
# ----------------------------------------------------------------- end-of-file

View File

@ -31,10 +31,10 @@ Description
#include "fvMesh.H"
#include "syncTools.H"
extern "C"
{
# include "mgridgen.h"
}
//extern "C"
//{
//# include "mgridgen.h"
//}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -42,8 +42,8 @@ void Foam::MGridGenGAMGAgglomeration::
makeCompactCellFaceAddressingAndFaceWeights
(
const lduAddressing& fineAddressing,
labelList& cellCells,
labelList& cellCellOffsets,
List<idxtype>& cellCells,
List<idxtype>& cellCellOffsets,
const vectorField& Si,
List<scalar>& faceWeights
)
@ -113,8 +113,8 @@ Foam::tmp<Foam::labelField> Foam::MGridGenGAMGAgglomeration::agglomerate
const label nFineCells = fineAddressing.size();
// Compact addressing for cellCells
labelList cellCells;
labelList cellCellOffsets;
List<idxtype> cellCells;
List<idxtype> cellCellOffsets;
// Face weights = face areas of the internal faces
List<scalar> faceWeights;
@ -130,7 +130,7 @@ Foam::tmp<Foam::labelField> Foam::MGridGenGAMGAgglomeration::agglomerate
);
// agglomeration options.
labelList options(4, 0);
List<int> options(4, 0);
options[0] = 4; // globular agglom
options[1] = 6; // objective F3 and F2
options[2] = 128; // debugging output level
@ -138,8 +138,8 @@ Foam::tmp<Foam::labelField> Foam::MGridGenGAMGAgglomeration::agglomerate
// output: cell -> processor addressing
tmp<labelField> tfinalAgglom(new labelField(nFineCells));
label nMoves = -1;
List<int> finalAgglom(nFineCells);
int nMoves = -1;
MGridGen
(
@ -154,10 +154,10 @@ Foam::tmp<Foam::labelField> Foam::MGridGenGAMGAgglomeration::agglomerate
options.begin(),
&nMoves,
&nCoarseCells,
tfinalAgglom->begin()
finalAgglom.begin()
);
return tfinalAgglom;
return tmp<labelField>(new labelField(finalAgglom));
}

View File

@ -37,8 +37,15 @@ SourceFiles
#ifndef MGridGenGAMGAgglomeration_H
#define MGridGenGAMGAgglomeration_H
#include "fvMesh.H"
#include "GAMGAgglomeration.H"
extern "C"
{
# include "mgridgen.h"
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
@ -65,8 +72,8 @@ class MGridGenGAMGAgglomeration
void makeCompactCellFaceAddressingAndFaceWeights
(
const lduAddressing& fineAddressing,
labelList& cellCells,
labelList& cellCellOffsets,
List<idxtype>& cellCells,
List<idxtype>& cellCellOffsets,
const vectorField& Si,
List<scalar>& faceWeights
);

View File

@ -1,4 +1,4 @@
ParMGridGen = $(LIB_SRC)/MGridGenGamgAgglomeration/ParMGridGen-1.0
ParMGridGen = $(LIB_SRC)/decompositionAgglomeration/MGridGenGamgAgglomeration/ParMGridGen-1.0
TYPE_REAL=
#if defined(SP)

Some files were not shown because too many files have changed in this diff Show More