First version of block matrix selection and interfaces, 3
This commit is contained in:
parent
516d44197b
commit
32621068ae
21 changed files with 2611 additions and 0 deletions
|
@ -0,0 +1,100 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration | Version: 4.0
|
||||
\\ / A nd | Web: http://www.foam-extend.org
|
||||
\\/ M anipulation | For copyright notice see file Copyright
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "BlockSAMGInterfaceField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::CoeffField<Type> >
|
||||
Foam::BlockSAMGInterfaceField<Type>::selectBlockCoeffs
|
||||
(
|
||||
const Foam::CoeffField<Type>& fineCoeffs
|
||||
) const
|
||||
{
|
||||
tmp<CoeffField<Type> > tcoarseCoeffs
|
||||
(
|
||||
new CoeffField<Type>(interface_.size())
|
||||
);
|
||||
CoeffField<Type>& coarseCoeffs = tcoarseCoeffs();
|
||||
/* HJ, code missing
|
||||
typedef CoeffField<Type> TypeCoeffField;
|
||||
|
||||
typedef typename TypeCoeffField::linearTypeField linearTypeField;
|
||||
typedef typename TypeCoeffField::squareTypeField squareTypeField;
|
||||
|
||||
// Get addressing from the fine interface
|
||||
const labelField& fineAddressing = interface_.fineAddressing();
|
||||
const labelField& restrictAddressing = interface_.restrictAddressing();
|
||||
const scalarField& restrictWeights = interface_.restrictWeights();
|
||||
|
||||
// Added weights to account for non-integral matching
|
||||
if (fineCoeffs.activeType() == blockCoeffBase::SQUARE)
|
||||
{
|
||||
squareTypeField& activeCoarseCoeffs = coarseCoeffs.asSquare();
|
||||
const squareTypeField& activeFineCoeffs = fineCoeffs.asSquare();
|
||||
|
||||
activeCoarseCoeffs *= 0.0;
|
||||
|
||||
// Added weights to account for non-integral matching
|
||||
forAll (restrictAddressing, ffi)
|
||||
{
|
||||
activeCoarseCoeffs[restrictAddressing[ffi]] +=
|
||||
restrictWeights[ffi]*activeFineCoeffs[fineAddressing[ffi]];
|
||||
}
|
||||
}
|
||||
else if (fineCoeffs.activeType() == blockCoeffBase::LINEAR)
|
||||
{
|
||||
linearTypeField& activeCoarseCoeffs = coarseCoeffs.asLinear();
|
||||
const linearTypeField& activeFineCoeffs = fineCoeffs.asLinear();
|
||||
|
||||
activeCoarseCoeffs *= 0.0;
|
||||
|
||||
// Added weights to account for non-integral matching
|
||||
forAll (restrictAddressing, ffi)
|
||||
{
|
||||
activeCoarseCoeffs[restrictAddressing[ffi]] +=
|
||||
restrictWeights[ffi]*activeFineCoeffs[fineAddressing[ffi]];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::tmp<Foam::CoeffField<Type> >\n"
|
||||
"Foam::BlockSAMGInterfaceField<Type>::selectBlockCoeffs\n"
|
||||
"(\n"
|
||||
" const Foam::CoeffField<Type>& fineCoeffs\n"
|
||||
") const"
|
||||
) << "Scalar type selection currently not handled"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
*/
|
||||
return tcoarseCoeffs;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
|
@ -0,0 +1,169 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration | Version: 4.0
|
||||
\\ / A nd | Web: http://www.foam-extend.org
|
||||
\\/ M anipulation | For copyright notice see file Copyright
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::BlockSAMGInterfaceField
|
||||
|
||||
Description
|
||||
Abstract base class for AMG selected interface fields.
|
||||
|
||||
Author
|
||||
Hrvoje Jasak. All rights reserved
|
||||
|
||||
SourceFiles
|
||||
BlockSAMGInterfaceField.C
|
||||
newBlockSAMGInterfaceField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef BlockSAMGInterfaceField_H
|
||||
#define BlockSAMGInterfaceField_H
|
||||
|
||||
#include "BlockLduInterfaceField.H"
|
||||
#include "SAMGInterface.H"
|
||||
#include "autoPtr.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class BlockSAMGInterfaceField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Type>
|
||||
class BlockSAMGInterfaceField
|
||||
:
|
||||
public BlockLduInterfaceField<Type>
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Local reference cast into the interface
|
||||
const SAMGInterface& interface_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
BlockSAMGInterfaceField(const BlockSAMGInterfaceField&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const BlockSAMGInterfaceField&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("BlockSAMGInterfaceField");
|
||||
|
||||
|
||||
// Declare run-time constructor selection tables
|
||||
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
BlockSAMGInterfaceField,
|
||||
lduInterface,
|
||||
(
|
||||
const SAMGInterface& SAMGCp,
|
||||
const BlockLduInterfaceField<Type>& fineInterface
|
||||
),
|
||||
(SAMGCp, fineInterface)
|
||||
);
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Return a pointer to a new interface created on freestore given
|
||||
// the fine interface
|
||||
static autoPtr<BlockSAMGInterfaceField<Type> > New
|
||||
(
|
||||
const SAMGInterface& SAMGCp,
|
||||
const BlockLduInterfaceField<Type>& fineInterface
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from AMG interface and fine level interface field
|
||||
BlockSAMGInterfaceField
|
||||
(
|
||||
const SAMGInterface& SAMGCp,
|
||||
const BlockLduInterfaceField<Type>&
|
||||
)
|
||||
:
|
||||
BlockLduInterfaceField<Type>(SAMGCp),
|
||||
interface_(SAMGCp)
|
||||
{}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~BlockSAMGInterfaceField<Type>()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Agglomeration
|
||||
|
||||
//- Select the CoeffField fine-level coefficients
|
||||
// for the coarse level
|
||||
virtual tmp<CoeffField<Type> > selectBlockCoeffs
|
||||
(
|
||||
const CoeffField<Type>& fineCoeffs
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "BlockSAMGInterfaceField.C"
|
||||
# include "newBlockSAMGInterfaceField.C"
|
||||
#endif
|
||||
|
||||
#define makeBlockSAMGInterfaceField(BlockSAMGInterfaceFieldType, typeBlockSAMGInterfaceFieldType) \
|
||||
\
|
||||
defineNamedTemplateTypeNameAndDebug(typeBlockSAMGInterfaceFieldType, 0); \
|
||||
\
|
||||
addToRunTimeSelectionTable(BlockSAMGInterfaceFieldType, typeBlockSAMGInterfaceFieldType, lduInterface);
|
||||
|
||||
#define makeBlockSAMGInterfaceFields(blockSAMGInterfaceFieldType) \
|
||||
\
|
||||
makeBlockSAMGInterfaceField(blockScalarSAMGInterfaceField, blockSAMGInterfaceFieldType##Scalar); \
|
||||
makeBlockSAMGInterfaceField(blockVectorSAMGInterfaceField, blockSAMGInterfaceFieldType##Vector); \
|
||||
|
||||
//HJ, hacked! Needs terminal specialisation. HJ, 16/Mar/2016
|
||||
// makeBlockSAMGInterfaceField(blockTensorSAMGInterfaceField, blockSAMGInterfaceFieldType##Tensor);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
|
@ -0,0 +1,61 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration | Version: 4.0
|
||||
\\ / A nd | Web: http://www.foam-extend.org
|
||||
\\/ M anipulation | For copyright notice see file Copyright
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "blockSAMGInterfaceFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineNamedTemplateTypeNameAndDebug(blockScalarSAMGInterfaceField, 0);
|
||||
defineNamedTemplateTypeNameAndDebug(blockVectorSAMGInterfaceField, 0);
|
||||
defineNamedTemplateTypeNameAndDebug(blockTensorSAMGInterfaceField, 0);
|
||||
|
||||
defineTemplateRunTimeSelectionTable
|
||||
(
|
||||
blockScalarSAMGInterfaceField,
|
||||
lduInterface
|
||||
);
|
||||
|
||||
defineTemplateRunTimeSelectionTable
|
||||
(
|
||||
blockVectorSAMGInterfaceField,
|
||||
lduInterface
|
||||
);
|
||||
|
||||
defineTemplateRunTimeSelectionTable
|
||||
(
|
||||
blockTensorSAMGInterfaceField,
|
||||
lduInterface
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
|
@ -0,0 +1,63 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration | Version: 4.0
|
||||
\\ / A nd | Web: http://www.foam-extend.org
|
||||
\\/ M anipulation | For copyright notice see file Copyright
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
BlockSAMGInterfaceField
|
||||
|
||||
Description
|
||||
Typedefs for block SAMG interface fields.
|
||||
|
||||
Author
|
||||
Hrvoje Jasak
|
||||
|
||||
SourceFiles
|
||||
blockSAMGInterfaceFields.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef blockSAMGInterfaceFields_H
|
||||
#define blockSAMGInterfaceFields_H
|
||||
|
||||
#include "BlockSAMGInterfaceField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
typedef BlockSAMGInterfaceField<scalar> blockScalarSAMGInterfaceField;
|
||||
typedef BlockSAMGInterfaceField<vector> blockVectorSAMGInterfaceField;
|
||||
typedef BlockSAMGInterfaceField<tensor> blockTensorSAMGInterfaceField;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
|
@ -0,0 +1,64 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration | Version: 4.0
|
||||
\\ / A nd | Web: http://www.foam-extend.org
|
||||
\\/ M anipulation | For copyright notice see file Copyright
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
blockVectorNSAMGInterfaceFields
|
||||
|
||||
Description
|
||||
Macros for VectorN types for AMG interface fields with block coeffs
|
||||
|
||||
Author
|
||||
Hrvoje Jasak
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "BlockSAMGInterfaceField.H"
|
||||
#include "ProcessorBlockSAMGInterfaceField.H"
|
||||
#include "VectorNFieldTypes.H"
|
||||
#include "ExpandTensorNField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
#define makeTemplateTypeNameAndDebug(type, Type, args...) \
|
||||
\
|
||||
typedef BlockSAMGInterfaceField<type > block##Type##SAMGInterfaceField; \
|
||||
defineNamedTemplateTypeNameAndDebug(block##Type##SAMGInterfaceField, 0); \
|
||||
defineTemplateRunTimeSelectionTable(block##Type##SAMGInterfaceField, lduInterface); \
|
||||
\
|
||||
typedef ProcessorBlockSAMGInterfaceField<type > block##Type##ProcessorSAMGInterfaceField; \
|
||||
makeBlockSAMGInterfaceField(block##Type##SAMGInterfaceField, block##Type##ProcessorSAMGInterfaceField); \
|
||||
|
||||
forAllVectorNTypes(makeTemplateTypeNameAndDebug);
|
||||
|
||||
#undef makeTemplateTypeNameAndDebug
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
|
@ -0,0 +1,70 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration | Version: 4.0
|
||||
\\ / A nd | Web: http://www.foam-extend.org
|
||||
\\/ M anipulation | For copyright notice see file Copyright
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "BlockSAMGInterfaceField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::autoPtr<Foam::BlockSAMGInterfaceField<Type> >
|
||||
Foam::BlockSAMGInterfaceField<Type>::New
|
||||
(
|
||||
const SAMGInterface& SAMGCp,
|
||||
const BlockLduInterfaceField<Type>& fineInterface
|
||||
)
|
||||
{
|
||||
word coupleType(fineInterface.interfaceFieldType());
|
||||
|
||||
typename lduInterfaceConstructorTable::iterator cstrIter =
|
||||
lduInterfaceConstructorTablePtr_->find(coupleType);
|
||||
|
||||
if (cstrIter == lduInterfaceConstructorTablePtr_->end())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"BlockSAMGInterfaceField::New\n"
|
||||
"(\n"
|
||||
" const SAMGInterface& SAMGCp,\n"
|
||||
" const BlockLduInterfaceField<Type>& fineInterface\n"
|
||||
")"
|
||||
) << "Unknown BlockSAMGInterfaceField type " << coupleType << ".\n"
|
||||
<< "Valid BlockSAMGInterfaceField types are :"
|
||||
<< lduInterfaceConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<BlockSAMGInterfaceField<Type> >
|
||||
(
|
||||
cstrIter()
|
||||
(
|
||||
SAMGCp,
|
||||
fineInterface
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
|
@ -0,0 +1,217 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration | Version: 4.0
|
||||
\\ / A nd | Web: http://www.foam-extend.org
|
||||
\\/ M anipulation | For copyright notice see file Copyright
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "ProcessorBlockSAMGInterfaceField.H"
|
||||
#include "processorLduInterfaceField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "lduMatrix.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::ProcessorBlockSAMGInterfaceField<Type>::ProcessorBlockSAMGInterfaceField
|
||||
(
|
||||
const SAMGInterface& AMGCp,
|
||||
const BlockLduInterfaceField<Type>& fineInterfaceField
|
||||
)
|
||||
:
|
||||
BlockSAMGInterfaceField<Type>(AMGCp, fineInterfaceField),
|
||||
procInterface_(refCast<const processorSAMGInterface>(AMGCp)),
|
||||
doTransform_(false),
|
||||
outstandingSendRequest_(-1),
|
||||
outstandingRecvRequest_(-1),
|
||||
sendBuf_(0),
|
||||
receiveBuf_(0)
|
||||
{
|
||||
// If the interface based on a patch this must be taken care specially of
|
||||
if (isA<ProcessorBlockLduInterfaceField<Type> >(fineInterfaceField))
|
||||
{
|
||||
const ProcessorBlockLduInterfaceField<Type>& p =
|
||||
refCast<const ProcessorBlockLduInterfaceField<Type> >
|
||||
(
|
||||
fineInterfaceField
|
||||
);
|
||||
|
||||
doTransform_ = p.doTransform();
|
||||
}
|
||||
else if (isA<processorLduInterfaceField>(fineInterfaceField))
|
||||
{
|
||||
const processorLduInterfaceField& p =
|
||||
refCast<const processorLduInterfaceField >(fineInterfaceField);
|
||||
|
||||
doTransform_ = p.doTransform();
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn("ProcessorBlockSAMGInterfaceField<Type> Constructor")
|
||||
<< "fineInterface must be of processor type and either" << endl
|
||||
<< " ProcessorBlockLduInterfaceField<Type> or " << endl
|
||||
<< " processorFvPatchField<Type> " << endl
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::ProcessorBlockSAMGInterfaceField<Type>::
|
||||
~ProcessorBlockSAMGInterfaceField()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::ProcessorBlockSAMGInterfaceField<Type>::initInterfaceMatrixUpdate
|
||||
(
|
||||
const Field<Type>& psiInternal,
|
||||
Field<Type>&,
|
||||
const BlockLduMatrix<Type>&,
|
||||
const CoeffField<Type>&,
|
||||
const Pstream::commsTypes commsType,
|
||||
const bool switchToLhs
|
||||
) const
|
||||
{
|
||||
label oldWarn = Pstream::warnComm;
|
||||
Pstream::warnComm = comm();
|
||||
|
||||
sendBuf_ = procInterface_.interfaceInternalField(psiInternal);
|
||||
|
||||
if (commsType == Pstream::nonBlocking)
|
||||
{
|
||||
// Fast path.
|
||||
receiveBuf_.setSize(sendBuf_.size());
|
||||
outstandingRecvRequest_ = Pstream::nRequests();
|
||||
IPstream::read
|
||||
(
|
||||
Pstream::nonBlocking,
|
||||
procInterface_.neighbProcNo(),
|
||||
reinterpret_cast<char*>(receiveBuf_.begin()),
|
||||
receiveBuf_.byteSize(),
|
||||
procInterface_.tag(),
|
||||
comm()
|
||||
);
|
||||
|
||||
outstandingSendRequest_ = Pstream::nRequests();
|
||||
OPstream::write
|
||||
(
|
||||
Pstream::nonBlocking,
|
||||
procInterface_.neighbProcNo(),
|
||||
reinterpret_cast<const char*>(sendBuf_.begin()),
|
||||
sendBuf_.byteSize(),
|
||||
procInterface_.tag(),
|
||||
comm()
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
procInterface_.send
|
||||
(
|
||||
commsType,
|
||||
procInterface_.interfaceInternalField(psiInternal)()
|
||||
);
|
||||
}
|
||||
|
||||
// Mark as ready for update
|
||||
const_cast<ProcessorBlockSAMGInterfaceField<Type>&>(*this).updatedMatrix() =
|
||||
false;
|
||||
|
||||
Pstream::warnComm = oldWarn;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::ProcessorBlockSAMGInterfaceField<Type>::updateInterfaceMatrix
|
||||
(
|
||||
const Field<Type>& psiInternal,
|
||||
Field<Type>& result,
|
||||
const BlockLduMatrix<Type>&,
|
||||
const CoeffField<Type>& coeffs,
|
||||
const Pstream::commsTypes commsType,
|
||||
const bool switchToLhs
|
||||
) const
|
||||
{
|
||||
if (this->updatedMatrix())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (commsType == Pstream::nonBlocking)
|
||||
{
|
||||
// Fast path.
|
||||
if
|
||||
(
|
||||
outstandingRecvRequest_ >= 0
|
||||
&& outstandingRecvRequest_ < Pstream::nRequests()
|
||||
)
|
||||
{
|
||||
Pstream::waitRequest(outstandingRecvRequest_);
|
||||
}
|
||||
|
||||
// Recv finished so assume sending finished as well.
|
||||
outstandingSendRequest_ = -1;
|
||||
outstandingRecvRequest_ = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Check size
|
||||
receiveBuf_.setSize(sendBuf_.size());
|
||||
|
||||
procInterface_.receive<Type>(commsType, receiveBuf_);
|
||||
}
|
||||
|
||||
// The data is now in receiveBuf_ for both cases
|
||||
|
||||
// Transformation missing. Is it needed? HJ, 28/Nov/2016
|
||||
|
||||
// Multiply neighbour field with coeffs and re-use buffer for result
|
||||
// of multiplication
|
||||
multiply(receiveBuf_, coeffs, receiveBuf_);
|
||||
|
||||
const unallocLabelList& faceCells = procInterface_.faceCells();
|
||||
|
||||
if (switchToLhs)
|
||||
{
|
||||
forAll(faceCells, elemI)
|
||||
{
|
||||
result[faceCells[elemI]] += receiveBuf_[elemI];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
forAll(faceCells, elemI)
|
||||
{
|
||||
result[faceCells[elemI]] -= receiveBuf_[elemI];
|
||||
}
|
||||
}
|
||||
|
||||
// Mark as updated
|
||||
const_cast<ProcessorBlockSAMGInterfaceField<Type>&>(*this).updatedMatrix() =
|
||||
true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
|
@ -0,0 +1,220 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration | Version: 4.0
|
||||
\\ / A nd | Web: http://www.foam-extend.org
|
||||
\\/ M anipulation | For copyright notice see file Copyright
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::ProcessorBlockSAMGInterfaceField
|
||||
|
||||
Description
|
||||
AMG selected processor interface field.
|
||||
|
||||
SourceFiles
|
||||
ProcessorBlockSAMGInterfaceField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef ProcessorBlockSAMGInterfaceField_H
|
||||
#define ProcessorBlockSAMGInterfaceField_H
|
||||
|
||||
#include "BlockSAMGInterfaceField.H"
|
||||
#include "processorSAMGInterface.H"
|
||||
#include "ProcessorBlockLduInterfaceField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class ProcessorBlockSAMGInterfaceField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template <class Type>
|
||||
class ProcessorBlockSAMGInterfaceField
|
||||
:
|
||||
public BlockSAMGInterfaceField<Type>,
|
||||
public ProcessorBlockLduInterfaceField<Type>
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Local reference cast into the processor interface
|
||||
const processorSAMGInterface& procInterface_;
|
||||
|
||||
//- Is the transform required
|
||||
bool doTransform_;
|
||||
|
||||
|
||||
// Sending and receiving
|
||||
|
||||
//- Outstanding request
|
||||
mutable label outstandingSendRequest_;
|
||||
|
||||
//- Outstanding request
|
||||
mutable label outstandingRecvRequest_;
|
||||
|
||||
//- Send buffer.
|
||||
mutable Field<Type> sendBuf_;
|
||||
|
||||
//- Receive buffer.
|
||||
mutable Field<Type> receiveBuf_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
ProcessorBlockSAMGInterfaceField
|
||||
(
|
||||
const ProcessorBlockSAMGInterfaceField&
|
||||
);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const ProcessorBlockSAMGInterfaceField&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("processor");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from AMG interface and fine level interface field
|
||||
ProcessorBlockSAMGInterfaceField
|
||||
(
|
||||
const SAMGInterface& AMGCp,
|
||||
const BlockLduInterfaceField<Type>& fineInterfaceField
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~ProcessorBlockSAMGInterfaceField();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return size
|
||||
label size() const
|
||||
{
|
||||
return procInterface_.size();
|
||||
}
|
||||
|
||||
|
||||
// Block coupled interface matrix update
|
||||
|
||||
//- Transform given patch component field
|
||||
virtual void transformCoupleField
|
||||
(
|
||||
scalarField& f,
|
||||
const direction cmpt
|
||||
) const
|
||||
{
|
||||
ProcessorBlockLduInterfaceField<Type>::transformCoupleField
|
||||
(
|
||||
f,
|
||||
cmpt
|
||||
);
|
||||
}
|
||||
|
||||
//- Transform neighbour field
|
||||
virtual void transformCoupleField
|
||||
(
|
||||
Field<Type>& f
|
||||
) const
|
||||
{
|
||||
ProcessorBlockLduInterfaceField<Type>::transformCoupleField(f);
|
||||
}
|
||||
|
||||
//- Initialise neighbour matrix update
|
||||
virtual void initInterfaceMatrixUpdate
|
||||
(
|
||||
const Field<Type>&,
|
||||
Field<Type>&,
|
||||
const BlockLduMatrix<Type>&,
|
||||
const CoeffField<Type>&,
|
||||
const Pstream::commsTypes commsType,
|
||||
const bool switchToLhs
|
||||
) const;
|
||||
|
||||
//- Update result field based on interface functionality
|
||||
virtual void updateInterfaceMatrix
|
||||
(
|
||||
const Field<Type>&,
|
||||
Field<Type>&,
|
||||
const BlockLduMatrix<Type>&,
|
||||
const CoeffField<Type>&,
|
||||
const Pstream::commsTypes commsType,
|
||||
const bool switchToLhs
|
||||
) const;
|
||||
|
||||
|
||||
//- Processor interface functions
|
||||
|
||||
//- Return communicator used for comms
|
||||
virtual label comm() const
|
||||
{
|
||||
return procInterface_.comm();
|
||||
}
|
||||
|
||||
//- Return processor number
|
||||
virtual int myProcNo() const
|
||||
{
|
||||
return procInterface_.myProcNo();
|
||||
}
|
||||
|
||||
//- Return neigbour processor number
|
||||
virtual int neighbProcNo() const
|
||||
{
|
||||
return procInterface_.neighbProcNo();
|
||||
}
|
||||
|
||||
//- Does the interface field perform the transfromation
|
||||
virtual bool doTransform() const
|
||||
{
|
||||
return doTransform_;
|
||||
}
|
||||
|
||||
//- Return face transformation tensor
|
||||
virtual const tensorField& forwardT() const
|
||||
{
|
||||
return procInterface_.forwardT();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "ProcessorBlockSAMGInterfaceField.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
|
@ -0,0 +1,42 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration | Version: 4.0
|
||||
\\ / A nd | Web: http://www.foam-extend.org
|
||||
\\/ M anipulation | For copyright notice see file Copyright
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "ProcessorBlockSAMGInterfaceFields.H"
|
||||
#include "blockSAMGInterfaceFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
makeBlockSAMGInterfaceFields(ProcessorBlockSAMGInterfaceField);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
|
@ -0,0 +1,68 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration | Version: 4.0
|
||||
\\ / A nd | Web: http://www.foam-extend.org
|
||||
\\/ M anipulation | For copyright notice see file Copyright
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
ProcessorBlockSAMGInterfaceField
|
||||
|
||||
Description
|
||||
Typedefs for block coefficient processor AMG interface fields
|
||||
|
||||
Author
|
||||
Klas Jareteg, 2013-02-08
|
||||
|
||||
SourceFiles
|
||||
ProcessorBlockSAMGInterfaceFields.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef ProcessorBlockSAMGInterfaceFields_H
|
||||
#define ProcessorBlockSAMGInterfaceFields_H
|
||||
|
||||
#include "ProcessorBlockSAMGInterfaceField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
typedef ProcessorBlockSAMGInterfaceField<scalar>
|
||||
ProcessorBlockSAMGInterfaceFieldScalar;
|
||||
|
||||
typedef ProcessorBlockSAMGInterfaceField<vector>
|
||||
ProcessorBlockSAMGInterfaceFieldVector;
|
||||
|
||||
typedef ProcessorBlockSAMGInterfaceField<tensor>
|
||||
ProcessorBlockSAMGInterfaceFieldTensor;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
|
@ -0,0 +1,37 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration | Version: 4.0
|
||||
\\ / A nd | Web: http://www.foam-extend.org
|
||||
\\/ M anipulation | For copyright notice see file Copyright
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "SAMGInterfaceField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(SAMGInterfaceField, 0);
|
||||
defineRunTimeSelectionTable(SAMGInterfaceField, lduInterface);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
|
@ -0,0 +1,126 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration | Version: 4.0
|
||||
\\ / A nd | Web: http://www.foam-extend.org
|
||||
\\/ M anipulation | For copyright notice see file Copyright
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::SAMGInterfaceField
|
||||
|
||||
Description
|
||||
Abstract base class for AMG selected interface fields.
|
||||
|
||||
SourceFiles
|
||||
SAMGInterfaceField.C
|
||||
newAmgInterfaceField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef SAMGInterfaceField_H
|
||||
#define SAMGInterfaceField_H
|
||||
|
||||
#include "lduInterfaceField.H"
|
||||
#include "SAMGInterface.H"
|
||||
#include "autoPtr.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class SAMGInterfaceField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class SAMGInterfaceField
|
||||
:
|
||||
public lduInterfaceField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Local reference cast into the interface
|
||||
const SAMGInterface& interface_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
SAMGInterfaceField(const SAMGInterfaceField&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const SAMGInterfaceField&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("SAMGInterfaceField");
|
||||
|
||||
|
||||
// Declare run-time constructor selection tables
|
||||
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
SAMGInterfaceField,
|
||||
lduInterface,
|
||||
(
|
||||
const SAMGInterface& SAMGCp,
|
||||
const lduInterfaceField& fineInterface
|
||||
),
|
||||
(SAMGCp, fineInterface)
|
||||
);
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Return a pointer to a new interface created on freestore given
|
||||
// the fine interface
|
||||
static autoPtr<SAMGInterfaceField> New
|
||||
(
|
||||
const SAMGInterface& SAMGCp,
|
||||
const lduInterfaceField& fineInterface
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from AMG interface and fine level interface field
|
||||
SAMGInterfaceField
|
||||
(
|
||||
const SAMGInterface& SAMGCp,
|
||||
const lduInterfaceField&
|
||||
)
|
||||
:
|
||||
lduInterfaceField(SAMGCp),
|
||||
interface_(SAMGCp)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
|
@ -0,0 +1,60 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration | Version: 4.0
|
||||
\\ / A nd | Web: http://www.foam-extend.org
|
||||
\\/ M anipulation | For copyright notice see file Copyright
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "SAMGInterfaceField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::SAMGInterfaceField> Foam::SAMGInterfaceField::New
|
||||
(
|
||||
const SAMGInterface& SAMGCp,
|
||||
const lduInterfaceField& fineInterface
|
||||
)
|
||||
{
|
||||
word coupleType(fineInterface.interfaceFieldType());
|
||||
|
||||
lduInterfaceConstructorTable::iterator cstrIter =
|
||||
lduInterfaceConstructorTablePtr_->find(coupleType);
|
||||
|
||||
if (cstrIter == lduInterfaceConstructorTablePtr_->end())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"SAMGInterfaceField::New\n"
|
||||
"(\n"
|
||||
" const SAMGInterface& SAMGCp,\n"
|
||||
" const lduInterfaceField& fineInterface\n"
|
||||
")"
|
||||
) << "Unknown SAMGInterfaceField type " << coupleType << ".\n"
|
||||
<< "Valid SAMGInterfaceField types are :"
|
||||
<< lduInterfaceConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<SAMGInterfaceField>(cstrIter()(SAMGCp, fineInterface));
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
|
@ -0,0 +1,204 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration | Version: 4.0
|
||||
\\ / A nd | Web: http://www.foam-extend.org
|
||||
\\/ M anipulation | For copyright notice see file Copyright
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "processorSAMGInterfaceField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "lduMatrix.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(processorSAMGInterfaceField, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
SAMGInterfaceField,
|
||||
processorSAMGInterfaceField,
|
||||
lduInterface
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::processorSAMGInterfaceField::processorSAMGInterfaceField
|
||||
(
|
||||
const SAMGInterface& AMGCp,
|
||||
const lduInterfaceField& fineInterfaceField
|
||||
)
|
||||
:
|
||||
SAMGInterfaceField(AMGCp, fineInterfaceField),
|
||||
procInterface_(refCast<const processorSAMGInterface>(AMGCp)),
|
||||
doTransform_(false),
|
||||
rank_(0),
|
||||
outstandingSendRequest_(-1),
|
||||
outstandingRecvRequest_(-1),
|
||||
scalarSendBuf_(0),
|
||||
scalarReceiveBuf_(0)
|
||||
{
|
||||
const processorLduInterfaceField& p =
|
||||
refCast<const processorLduInterfaceField>(fineInterfaceField);
|
||||
|
||||
doTransform_ = p.doTransform();
|
||||
rank_ = p.rank();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::processorSAMGInterfaceField::~processorSAMGInterfaceField()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::processorSAMGInterfaceField::initInterfaceMatrixUpdate
|
||||
(
|
||||
const scalarField& psiInternal,
|
||||
scalarField&,
|
||||
const lduMatrix&,
|
||||
const scalarField&,
|
||||
const direction,
|
||||
const Pstream::commsTypes commsType,
|
||||
const bool switchToLhs
|
||||
) const
|
||||
{
|
||||
label oldWarn = Pstream::warnComm;
|
||||
Pstream::warnComm = comm();
|
||||
|
||||
scalarSendBuf_ = procInterface_.interfaceInternalField(psiInternal);
|
||||
|
||||
if (commsType == Pstream::nonBlocking)
|
||||
{
|
||||
// Fast path.
|
||||
scalarReceiveBuf_.setSize(scalarSendBuf_.size());
|
||||
outstandingRecvRequest_ = Pstream::nRequests();
|
||||
IPstream::read
|
||||
(
|
||||
Pstream::nonBlocking,
|
||||
procInterface_.neighbProcNo(),
|
||||
reinterpret_cast<char*>(scalarReceiveBuf_.begin()),
|
||||
scalarReceiveBuf_.byteSize(),
|
||||
procInterface_.tag(),
|
||||
comm()
|
||||
);
|
||||
|
||||
outstandingSendRequest_ = Pstream::nRequests();
|
||||
OPstream::write
|
||||
(
|
||||
Pstream::nonBlocking,
|
||||
procInterface_.neighbProcNo(),
|
||||
reinterpret_cast<const char*>(scalarSendBuf_.begin()),
|
||||
scalarSendBuf_.byteSize(),
|
||||
procInterface_.tag(),
|
||||
comm()
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
procInterface_.send
|
||||
(
|
||||
commsType,
|
||||
procInterface_.interfaceInternalField(psiInternal)()
|
||||
);
|
||||
}
|
||||
|
||||
// Mark as ready for update
|
||||
const_cast<processorSAMGInterfaceField&>(*this).updatedMatrix() = false;
|
||||
|
||||
Pstream::warnComm = oldWarn;
|
||||
}
|
||||
|
||||
|
||||
void Foam::processorSAMGInterfaceField::updateInterfaceMatrix
|
||||
(
|
||||
const scalarField&,
|
||||
scalarField& result,
|
||||
const lduMatrix&,
|
||||
const scalarField& coeffs,
|
||||
const direction cmpt,
|
||||
const Pstream::commsTypes commsType,
|
||||
const bool switchToLhs
|
||||
) const
|
||||
{
|
||||
if (this->updatedMatrix())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (commsType == Pstream::nonBlocking)
|
||||
{
|
||||
// Fast path.
|
||||
if
|
||||
(
|
||||
outstandingRecvRequest_ >= 0
|
||||
&& outstandingRecvRequest_ < Pstream::nRequests()
|
||||
)
|
||||
{
|
||||
Pstream::waitRequest(outstandingRecvRequest_);
|
||||
}
|
||||
|
||||
// Recv finished so assume sending finished as well.
|
||||
outstandingSendRequest_ = -1;
|
||||
outstandingRecvRequest_ = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Check size
|
||||
scalarReceiveBuf_.setSize(scalarSendBuf_.size());
|
||||
|
||||
procInterface_.receive<scalar>(commsType, scalarReceiveBuf_);
|
||||
}
|
||||
|
||||
// The data is now in scalarReceiveBuf_ for both cases
|
||||
|
||||
// Transform according to the transformation tensor
|
||||
transformCoupleField(scalarReceiveBuf_, cmpt);
|
||||
|
||||
// Multiply the field by coefficients and add into the result
|
||||
|
||||
const unallocLabelList& faceCells = procInterface_.faceCells();
|
||||
|
||||
if (switchToLhs)
|
||||
{
|
||||
forAll(faceCells, elemI)
|
||||
{
|
||||
result[faceCells[elemI]] += coeffs[elemI]*scalarReceiveBuf_[elemI];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
forAll(faceCells, elemI)
|
||||
{
|
||||
result[faceCells[elemI]] -= coeffs[elemI]*scalarReceiveBuf_[elemI];
|
||||
}
|
||||
}
|
||||
|
||||
// Mark as updated
|
||||
const_cast<processorSAMGInterfaceField&>(*this).updatedMatrix() = true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
|
@ -0,0 +1,208 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration | Version: 4.0
|
||||
\\ / A nd | Web: http://www.foam-extend.org
|
||||
\\/ M anipulation | For copyright notice see file Copyright
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::processorSAMGInterfaceField
|
||||
|
||||
Description
|
||||
AMG selected processor interface field.
|
||||
|
||||
SourceFiles
|
||||
processorSAMGInterfaceField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef processorSAMGInterfaceField_H
|
||||
#define processorSAMGInterfaceField_H
|
||||
|
||||
#include "SAMGInterfaceField.H"
|
||||
#include "processorSAMGInterface.H"
|
||||
#include "processorLduInterfaceField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class processorSAMGInterfaceField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class processorSAMGInterfaceField
|
||||
:
|
||||
public SAMGInterfaceField,
|
||||
public processorLduInterfaceField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Local reference cast into the processor interface
|
||||
const processorSAMGInterface& procInterface_;
|
||||
|
||||
//- Is the transform required
|
||||
bool doTransform_;
|
||||
|
||||
//- Rank of component for transformation
|
||||
int rank_;
|
||||
|
||||
|
||||
// Sending and receiving
|
||||
|
||||
//- Outstanding request
|
||||
mutable label outstandingSendRequest_;
|
||||
|
||||
//- Outstanding request
|
||||
mutable label outstandingRecvRequest_;
|
||||
|
||||
//- Scalar send buffer
|
||||
mutable Field<scalar> scalarSendBuf_;
|
||||
|
||||
//- Scalar receive buffer
|
||||
mutable Field<scalar> scalarReceiveBuf_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
processorSAMGInterfaceField(const processorSAMGInterfaceField&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const processorSAMGInterfaceField&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("processor");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from AMG interface and fine level interface field
|
||||
processorSAMGInterfaceField
|
||||
(
|
||||
const SAMGInterface& AMGCp,
|
||||
const lduInterfaceField& fineInterfaceField
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~processorSAMGInterfaceField();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return size
|
||||
label size() const
|
||||
{
|
||||
return procInterface_.size();
|
||||
}
|
||||
|
||||
|
||||
// Coupled interface matrix update
|
||||
|
||||
//- Transform neighbour field
|
||||
virtual void transformCoupleField
|
||||
(
|
||||
scalarField& pnf,
|
||||
const direction cmpt
|
||||
) const
|
||||
{
|
||||
processorLduInterfaceField::transformCoupleField(pnf, cmpt);
|
||||
}
|
||||
|
||||
//- Initialise neighbour matrix update
|
||||
virtual void initInterfaceMatrixUpdate
|
||||
(
|
||||
const scalarField& psiInternal,
|
||||
scalarField& result,
|
||||
const lduMatrix& m,
|
||||
const scalarField& coeffs,
|
||||
const direction cmpt,
|
||||
const Pstream::commsTypes commsType,
|
||||
const bool switchToLhs
|
||||
) const;
|
||||
|
||||
//- Update result field based on interface functionality
|
||||
virtual void updateInterfaceMatrix
|
||||
(
|
||||
const scalarField& psiInternal,
|
||||
scalarField& result,
|
||||
const lduMatrix&,
|
||||
const scalarField& coeffs,
|
||||
const direction cmpt,
|
||||
const Pstream::commsTypes commsType,
|
||||
const bool switchToLhs
|
||||
) const;
|
||||
|
||||
|
||||
//- Processor interface functions
|
||||
|
||||
//- Return communicator used for comms
|
||||
virtual label comm() const
|
||||
{
|
||||
return procInterface_.comm();
|
||||
}
|
||||
|
||||
//- Return processor number
|
||||
virtual int myProcNo() const
|
||||
{
|
||||
return procInterface_.myProcNo();
|
||||
}
|
||||
|
||||
//- Return neigbour processor number
|
||||
virtual int neighbProcNo() const
|
||||
{
|
||||
return procInterface_.neighbProcNo();
|
||||
}
|
||||
|
||||
//- Does the interface field perform the transfromation
|
||||
virtual bool doTransform() const
|
||||
{
|
||||
return doTransform_;
|
||||
}
|
||||
|
||||
//- Return face transformation tensor
|
||||
virtual const tensorField& forwardT() const
|
||||
{
|
||||
return procInterface_.forwardT();
|
||||
}
|
||||
|
||||
//- Return rank of component for transform
|
||||
virtual int rank() const
|
||||
{
|
||||
return rank_;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
|
@ -0,0 +1,66 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration | Version: 4.0
|
||||
\\ / A nd | Web: http://www.foam-extend.org
|
||||
\\/ M anipulation | For copyright notice see file Copyright
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "SAMGInterface.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(SAMGInterface, 0);
|
||||
defineRunTimeSelectionTable(SAMGInterface, lduInterface);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::tmp<Foam::labelField> Foam::SAMGInterface::interfaceInternalField
|
||||
(
|
||||
const unallocLabelList& internalData
|
||||
) const
|
||||
{
|
||||
return interfaceInternalField<label>(internalData);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::SAMGInterface::selectCoeffs
|
||||
(
|
||||
const scalarField& fineCoeffs
|
||||
) const
|
||||
{
|
||||
tmp<scalarField> tcoarseCoeffs(new scalarField(size(), 0.0));
|
||||
scalarField& coarseCoeffs = tcoarseCoeffs();
|
||||
|
||||
// Added weights to account for non-integral matching
|
||||
forAll (fineAddressing_, ffi)
|
||||
{
|
||||
coarseCoeffs[ffi] = fineCoeffs[fineAddressing_[ffi]];
|
||||
}
|
||||
|
||||
return tcoarseCoeffs;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
|
@ -0,0 +1,219 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration | Version: 4.0
|
||||
\\ / A nd | Web: http://www.foam-extend.org
|
||||
\\/ M anipulation | For copyright notice see file Copyright
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::SAMGInterface
|
||||
|
||||
Description
|
||||
Abstract base class for AMG selected interfaces.
|
||||
|
||||
Author
|
||||
Hrvoje Jasak, Wikki Ltd. All rights reserved.
|
||||
|
||||
SourceFiles
|
||||
SAMGInterface.C
|
||||
newAmgInterface.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef SAMGInterface_H
|
||||
#define SAMGInterface_H
|
||||
|
||||
#include "lduInterface.H"
|
||||
#include "autoPtr.H"
|
||||
#include "lduPrimitiveMesh.H"
|
||||
#include "coeffFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class SAMGInterface Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class SAMGInterface
|
||||
:
|
||||
public lduInterface
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Reference to ldu addressing
|
||||
const lduPrimitiveMesh& lduMesh_;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Face-cell addressing. Contains coarse level addressing
|
||||
labelField faceCells_;
|
||||
|
||||
//- Fine addressing. Contains fine index for each coarse face
|
||||
labelField fineAddressing_;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
SAMGInterface(const SAMGInterface&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const SAMGInterface&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("SAMGInterface");
|
||||
|
||||
|
||||
// Declare run-time constructor selection tables
|
||||
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
SAMGInterface,
|
||||
lduInterface,
|
||||
(
|
||||
const lduPrimitiveMesh& lduMesh,
|
||||
const lduInterfacePtrsList& coarseInterfaces,
|
||||
const lduInterface& fineInterface,
|
||||
const labelField& localSelectAddressing,
|
||||
const labelField& neighbourSelectAddressing
|
||||
),
|
||||
(
|
||||
lduMesh,
|
||||
coarseInterfaces,
|
||||
fineInterface,
|
||||
localSelectAddressing,
|
||||
neighbourSelectAddressing
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Return a pointer to a new interface created on freestore given
|
||||
// the fine interface
|
||||
static autoPtr<SAMGInterface> New
|
||||
(
|
||||
const lduPrimitiveMesh& lduMesh,
|
||||
const lduInterfacePtrsList& coarseInterfaces,
|
||||
const lduInterface& fineInterface,
|
||||
const labelField& localSelectAddressing,
|
||||
const labelField& neighbourSelectAddressing
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from fine-level interface,
|
||||
// local and neighbour select addressing
|
||||
SAMGInterface(const lduPrimitiveMesh& lduMesh)
|
||||
:
|
||||
lduMesh_(lduMesh)
|
||||
{}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~SAMGInterface()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return reference to addressing
|
||||
const lduMesh& ldu() const
|
||||
{
|
||||
return lduMesh_;
|
||||
}
|
||||
|
||||
//- Return size
|
||||
virtual label size() const
|
||||
{
|
||||
return faceCells_.size();
|
||||
}
|
||||
|
||||
//- Return faceCell addressing
|
||||
virtual const unallocLabelList& faceCells() const
|
||||
{
|
||||
return faceCells_;
|
||||
}
|
||||
|
||||
//- Return fine addressing
|
||||
const labelField& fineAddressing() const
|
||||
{
|
||||
return fineAddressing_;
|
||||
}
|
||||
|
||||
//- Return the interface internal field of the given field
|
||||
template<class Type>
|
||||
tmp<Field<Type> > interfaceInternalField
|
||||
(
|
||||
const UList<Type>& internalData
|
||||
) const;
|
||||
|
||||
//- Return the values of the given internal data adjacent to
|
||||
// the interface as a field
|
||||
virtual tmp<labelField> interfaceInternalField
|
||||
(
|
||||
const unallocLabelList& internalData
|
||||
) const;
|
||||
|
||||
|
||||
// Agglomeration
|
||||
|
||||
//- Select the given fine-level coefficients and return
|
||||
virtual tmp<scalarField> selectCoeffs
|
||||
(
|
||||
const scalarField& fineCoeffs
|
||||
) const;
|
||||
|
||||
// Coefficient agglomeration functions for block coefficients
|
||||
// moved to BlockSAMGInterfaceField to allow
|
||||
// templating on virtual functions in block matrix agglomeration
|
||||
// HJ, 16/Mar/2016
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "SAMGInterfaceTemplates.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
|
@ -0,0 +1,49 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration | Version: 4.0
|
||||
\\ / A nd | Web: http://www.foam-extend.org
|
||||
\\/ M anipulation | For copyright notice see file Copyright
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "SAMGInterface.H"
|
||||
#include "scalarCoeffField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type> > Foam::SAMGInterface::interfaceInternalField
|
||||
(
|
||||
const UList<Type>& iF
|
||||
) const
|
||||
{
|
||||
tmp<Field<Type> > tresult(new Field<Type>(size()));
|
||||
Field<Type>& result = tresult();
|
||||
|
||||
forAll (result, elemI)
|
||||
{
|
||||
result[elemI] = iF[faceCells_[elemI]];
|
||||
}
|
||||
|
||||
return tresult;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
@ -0,0 +1,78 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration | Version: 4.0
|
||||
\\ / A nd | Web: http://www.foam-extend.org
|
||||
\\/ M anipulation | For copyright notice see file Copyright
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "SAMGInterface.H"
|
||||
#include "lduMatrix.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::SAMGInterface> Foam::SAMGInterface::New
|
||||
(
|
||||
const lduPrimitiveMesh& lduMesh,
|
||||
const lduInterfacePtrsList& coarseInterfaces,
|
||||
const lduInterface& fineInterface,
|
||||
const labelField& localRestrictAddressing,
|
||||
const labelField& neighbourRestrictAddressing
|
||||
)
|
||||
{
|
||||
word coupleType(fineInterface.type());
|
||||
|
||||
lduInterfaceConstructorTable::iterator cstrIter =
|
||||
lduInterfaceConstructorTablePtr_->find(coupleType);
|
||||
|
||||
if (cstrIter == lduInterfaceConstructorTablePtr_->end())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"SAMGInterface::New\n"
|
||||
"(\n"
|
||||
" const lduPrimitiveMesh& lduMesh,\n"
|
||||
" const lduInterfacePtrsList& coarseInterfaces,\n"
|
||||
" const lduInterface& fineInterface,\n"
|
||||
" const labelField& localRestrictAddressing,\n"
|
||||
" const labelField& neighbourRestrictAddressing\n"
|
||||
")"
|
||||
) << "Unknown SAMGInterface type " << coupleType << ".\n"
|
||||
<< "Valid SAMGInterface types are :"
|
||||
<< lduInterfaceConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<SAMGInterface>
|
||||
(
|
||||
cstrIter()
|
||||
(
|
||||
lduMesh,
|
||||
coarseInterfaces,
|
||||
fineInterface,
|
||||
localRestrictAddressing,
|
||||
neighbourRestrictAddressing
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
|
@ -0,0 +1,302 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration | Version: 4.0
|
||||
\\ / A nd | Web: http://www.foam-extend.org
|
||||
\\/ M anipulation | For copyright notice see file Copyright
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "processorSAMGInterface.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(processorSAMGInterface, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
SAMGInterface,
|
||||
processorSAMGInterface,
|
||||
lduInterface
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::processorSAMGInterface::processorSAMGInterface
|
||||
(
|
||||
const lduPrimitiveMesh& lduMesh,
|
||||
const lduInterfacePtrsList& coarseInterfaces,
|
||||
const lduInterface& fineInterface,
|
||||
const labelField& localRestrictAddressing,
|
||||
const labelField& neighbourRestrictAddressing
|
||||
)
|
||||
:
|
||||
SAMGInterface(lduMesh),
|
||||
fineProcInterface_(refCast<const processorLduInterface>(fineInterface)),
|
||||
comm_(fineProcInterface_.comm()),
|
||||
tag_(fineProcInterface_.tag())
|
||||
{
|
||||
/* HJ, Code missing here
|
||||
|
||||
// Make a lookup table of entries for owner/neighbour
|
||||
HashTable<SLList<label>, label, Hash<label> > neighboursTable
|
||||
(
|
||||
localRestrictAddressing.size()
|
||||
);
|
||||
|
||||
// Table of face-sets to be agglomerated
|
||||
HashTable<SLList<SLList<label> >, label, Hash<label> > faceFaceTable
|
||||
(
|
||||
localRestrictAddressing.size()
|
||||
);
|
||||
|
||||
label nCoarseFaces = 0;
|
||||
|
||||
forAll (localRestrictAddressing, ffi)
|
||||
{
|
||||
label curMaster = -1;
|
||||
label curSlave = -1;
|
||||
|
||||
// Do switching on master/slave indexes based on the owner/neighbour of
|
||||
// the processor index such that both sides get the same answer.
|
||||
if (myProcNo() < neighbProcNo())
|
||||
{
|
||||
// Master side
|
||||
curMaster = localRestrictAddressing[ffi];
|
||||
curSlave = neighbourRestrictAddressing[ffi];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Slave side
|
||||
curMaster = neighbourRestrictAddressing[ffi];
|
||||
curSlave = localRestrictAddressing[ffi];
|
||||
}
|
||||
|
||||
// Look for the master cell. If it has already got a face,
|
||||
// add the coefficient to the face. If not, create a new face.
|
||||
if (neighboursTable.found(curMaster))
|
||||
{
|
||||
// Check all current neighbours to see if the current slave already
|
||||
// exists and if so, add the fine face to the agglomeration.
|
||||
|
||||
SLList<label>& curNbrs = neighboursTable.find(curMaster)();
|
||||
|
||||
SLList<SLList<label> >& curFaceFaces =
|
||||
faceFaceTable.find(curMaster)();
|
||||
|
||||
bool nbrFound = false;
|
||||
|
||||
SLList<label>::iterator nbrsIter = curNbrs.begin();
|
||||
|
||||
SLList<SLList<label> >::iterator faceFacesIter =
|
||||
curFaceFaces.begin();
|
||||
|
||||
for
|
||||
(
|
||||
;
|
||||
nbrsIter != curNbrs.end(), faceFacesIter != curFaceFaces.end();
|
||||
++nbrsIter, ++faceFacesIter
|
||||
)
|
||||
{
|
||||
if (nbrsIter() == curSlave)
|
||||
{
|
||||
nbrFound = true;
|
||||
faceFacesIter().append(ffi);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!nbrFound)
|
||||
{
|
||||
curNbrs.append(curSlave);
|
||||
curFaceFaces.append(SLList<label>(ffi));
|
||||
|
||||
// New coarse face created
|
||||
nCoarseFaces++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// This master has got no neighbours yet. Add a neighbour
|
||||
// and a coefficient, thus creating a new face
|
||||
neighboursTable.insert(curMaster, SLList<label>(curSlave));
|
||||
faceFaceTable.insert
|
||||
(
|
||||
curMaster,
|
||||
SLList<SLList<label> >(SLList<label>(ffi))
|
||||
);
|
||||
|
||||
// New coarse face created
|
||||
nCoarseFaces++;
|
||||
}
|
||||
} // end for all fine faces
|
||||
|
||||
|
||||
faceCells_.setSize(nCoarseFaces, -1);
|
||||
fineAddressing_.setSize(localRestrictAddressing.size(), -1);
|
||||
restrictAddressing_.setSize(localRestrictAddressing.size(), -1);
|
||||
|
||||
// All weights are equal to 1: integral matching
|
||||
restrictWeights_.setSize(localRestrictAddressing.size(), 1.0);
|
||||
|
||||
labelList contents = neighboursTable.toc();
|
||||
|
||||
// Sort makes sure the order is identical on both sides.
|
||||
// HJ, 20/Feb.2009
|
||||
sort(contents);
|
||||
|
||||
// Reset face counter for re-use
|
||||
nCoarseFaces = 0;
|
||||
|
||||
if (myProcNo() < neighbProcNo())
|
||||
{
|
||||
// On master side, the owner addressing is stored in table of contents
|
||||
forAll (contents, masterI)
|
||||
{
|
||||
SLList<label>& curNbrs = neighboursTable.find(contents[masterI])();
|
||||
|
||||
SLList<SLList<label> >& curFaceFaces =
|
||||
faceFaceTable.find(contents[masterI])();
|
||||
|
||||
SLList<label>::iterator nbrsIter = curNbrs.begin();
|
||||
|
||||
SLList<SLList<label> >::iterator faceFacesIter =
|
||||
curFaceFaces.begin();
|
||||
|
||||
for
|
||||
(
|
||||
;
|
||||
nbrsIter != curNbrs.end(), faceFacesIter != curFaceFaces.end();
|
||||
++nbrsIter, ++faceFacesIter
|
||||
)
|
||||
{
|
||||
faceCells_[nCoarseFaces] = contents[masterI];
|
||||
|
||||
for
|
||||
(
|
||||
SLList<label>::iterator facesIter =
|
||||
faceFacesIter().begin();
|
||||
facesIter != faceFacesIter().end();
|
||||
++facesIter
|
||||
)
|
||||
{
|
||||
fineAddressing_[facesIter()] = facesIter();
|
||||
restrictAddressing_[facesIter()] = nCoarseFaces;
|
||||
}
|
||||
|
||||
nCoarseFaces++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// On slave side, the owner addressing is stored in linked lists
|
||||
forAll (contents, masterI)
|
||||
{
|
||||
SLList<label>& curNbrs = neighboursTable.find(contents[masterI])();
|
||||
|
||||
SLList<SLList<label> >& curFaceFaces =
|
||||
faceFaceTable.find(contents[masterI])();
|
||||
|
||||
SLList<label>::iterator nbrsIter = curNbrs.begin();
|
||||
|
||||
SLList<SLList<label> >::iterator faceFacesIter =
|
||||
curFaceFaces.begin();
|
||||
|
||||
for
|
||||
(
|
||||
;
|
||||
nbrsIter != curNbrs.end(), faceFacesIter != curFaceFaces.end();
|
||||
++nbrsIter, ++faceFacesIter
|
||||
)
|
||||
{
|
||||
faceCells_[nCoarseFaces] = nbrsIter();
|
||||
|
||||
for
|
||||
(
|
||||
SLList<label>::iterator facesIter = faceFacesIter().begin();
|
||||
facesIter != faceFacesIter().end();
|
||||
++facesIter
|
||||
)
|
||||
{
|
||||
fineAddressing_[facesIter()] = facesIter();
|
||||
restrictAddressing_[facesIter()] = nCoarseFaces;
|
||||
}
|
||||
|
||||
nCoarseFaces++;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Desstructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::processorSAMGInterface::~processorSAMGInterface()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::processorSAMGInterface::initTransfer
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
const unallocLabelList& interfaceData
|
||||
) const
|
||||
{
|
||||
send(commsType, interfaceData);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::labelField> Foam::processorSAMGInterface::transfer
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
const unallocLabelList& interfaceData
|
||||
) const
|
||||
{
|
||||
return receive<label>(commsType, this->size());
|
||||
}
|
||||
|
||||
|
||||
void Foam::processorSAMGInterface::initInternalFieldTransfer
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
const unallocLabelList& iF
|
||||
) const
|
||||
{
|
||||
send(commsType, interfaceInternalField(iF)());
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::labelField> Foam::processorSAMGInterface::internalFieldTransfer
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
const unallocLabelList&
|
||||
) const
|
||||
{
|
||||
return receive<label>(commsType, this->size());
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
|
@ -0,0 +1,188 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration | Version: 4.0
|
||||
\\ / A nd | Web: http://www.foam-extend.org
|
||||
\\/ M anipulation | For copyright notice see file Copyright
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::processorSAMGInterface
|
||||
|
||||
Description
|
||||
AMG selected processor interface.
|
||||
|
||||
SourceFiles
|
||||
processorSAMGInterface.C
|
||||
processorSAMGInterfaceTemplates.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef processorSAMGInterface_H
|
||||
#define processorSAMGInterface_H
|
||||
|
||||
#include "SAMGInterface.H"
|
||||
#include "processorLduInterface.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class processorSAMGInterface Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class processorSAMGInterface
|
||||
:
|
||||
public SAMGInterface,
|
||||
public processorLduInterface
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Reference tor the processorLduInterface from which this is
|
||||
// agglomerated
|
||||
const processorLduInterface& fineProcInterface_;
|
||||
|
||||
//- Communicator to use for parallel communication
|
||||
const label comm_;
|
||||
|
||||
//- Message tag used for sending
|
||||
const int tag_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
processorSAMGInterface(const processorSAMGInterface&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const processorSAMGInterface&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("processor");
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from fine-level interface,
|
||||
// local and neighbour restrict addressing
|
||||
processorSAMGInterface
|
||||
(
|
||||
const lduPrimitiveMesh& lduMesh,
|
||||
const lduInterfacePtrsList& coarseInterfaces,
|
||||
const lduInterface& fineInterface,
|
||||
const labelField& localRestrictAddressing,
|
||||
const labelField& neighbourRestrictAddressing
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~processorSAMGInterface();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return true if interface is coupled
|
||||
virtual bool coupled() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Communications support
|
||||
|
||||
//- Return communicator used for parallel communication
|
||||
virtual int comm() const
|
||||
{
|
||||
return comm_;
|
||||
}
|
||||
|
||||
//- Return message tag used for sending
|
||||
virtual int tag() const
|
||||
{
|
||||
return tag_;
|
||||
}
|
||||
|
||||
|
||||
// Interface transfer functions
|
||||
|
||||
//- Initialise interface data transfer
|
||||
virtual void initTransfer
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
const unallocLabelList& interfaceData
|
||||
) const;
|
||||
|
||||
//- Transfer and return neighbour field
|
||||
virtual tmp<labelField> transfer
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
const unallocLabelList& interfaceData
|
||||
) const;
|
||||
|
||||
//- Initialise neighbour field transfer
|
||||
virtual void initInternalFieldTransfer
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
const unallocLabelList& iF
|
||||
) const;
|
||||
|
||||
//- Transfer and return internal field adjacent to the interface
|
||||
virtual tmp<labelField> internalFieldTransfer
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
const unallocLabelList& iF
|
||||
) const;
|
||||
|
||||
|
||||
//- Processor interface functions
|
||||
|
||||
//- Return processor number
|
||||
virtual int myProcNo() const
|
||||
{
|
||||
return fineProcInterface_.myProcNo();
|
||||
}
|
||||
|
||||
//- Return neigbour processor number
|
||||
virtual int neighbProcNo() const
|
||||
{
|
||||
return fineProcInterface_.neighbProcNo();
|
||||
}
|
||||
|
||||
//- Return face transformation tensor
|
||||
virtual const tensorField& forwardT() const
|
||||
{
|
||||
return fineProcInterface_.forwardT();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
Reference in a new issue