mirror of
https://github.com/OpenFOAM/OpenFOAM-6.git
synced 2025-12-08 06:57:46 +00:00
Add the OpenFOAM source tree
This commit is contained in:
65
etc/codeTemplates/dynamicCode/FilterFunctionObjectTemplate.C
Normal file
65
etc/codeTemplates/dynamicCode/FilterFunctionObjectTemplate.C
Normal file
@ -0,0 +1,65 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "FilterFunctionObjectTemplate.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||
|
||||
extern "C"
|
||||
{
|
||||
// dynamicCode:
|
||||
// SHA1 = ${SHA1sum}
|
||||
//
|
||||
// unique function name that can be checked if the correct library version
|
||||
// has been loaded
|
||||
void ${typeName}_${SHA1sum}(bool load)
|
||||
{
|
||||
if (load)
|
||||
{
|
||||
// code that can be explicitly executed after loading
|
||||
}
|
||||
else
|
||||
{
|
||||
// code that can be explicitly executed before unloading
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineNamedTemplateTypeNameAndDebug(${typeName}FilterFunctionObject, 0);
|
||||
|
||||
//addToRunTimeSelectionTable
|
||||
addRemovableToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
${typeName}FilterFunctionObject,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
51
etc/codeTemplates/dynamicCode/FilterFunctionObjectTemplate.H
Normal file
51
etc/codeTemplates/dynamicCode/FilterFunctionObjectTemplate.H
Normal file
@ -0,0 +1,51 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
FunctionObject wrapper around functionObjectTemplate to allow them
|
||||
to be created via the functions entry within controlDict.
|
||||
|
||||
SourceFiles
|
||||
FilterFunctionObject.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef FilterFunctionObject_H
|
||||
#define FilterFunctionObject_H
|
||||
|
||||
#include "functionObjectTemplate.H"
|
||||
#include "OutputFilterFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<${typeName}FunctionObject>
|
||||
${typeName}FilterFunctionObject;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
50
etc/codeTemplates/dynamicCode/IOfunctionObjectTemplate.H
Normal file
50
etc/codeTemplates/dynamicCode/IOfunctionObjectTemplate.H
Normal file
@ -0,0 +1,50 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Typedef
|
||||
Foam::IOfunctionObjectTemplate
|
||||
|
||||
Description
|
||||
Instance of the generic IOOutputFilter for ${typeName}FunctionObject.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef IOfunctionObjectTemplate_H
|
||||
#define IOfunctionObjectTemplate_H
|
||||
|
||||
#include "functionObjectTemplate.H"
|
||||
#include "IOOutputFilter.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef IOOutputFilter<${typeName}FunctionObject>
|
||||
IO${typeName}FunctionObject;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
71
etc/codeTemplates/dynamicCode/codeStreamTemplate.C
Normal file
71
etc/codeTemplates/dynamicCode/codeStreamTemplate.C
Normal file
@ -0,0 +1,71 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
Template for use with codeStream.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "dictionary.H"
|
||||
#include "Ostream.H"
|
||||
#include "Pstream.H"
|
||||
#include "unitConversion.H"
|
||||
|
||||
//{{{ begin codeInclude
|
||||
${codeInclude}
|
||||
//}}} end codeInclude
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
|
||||
|
||||
//{{{ begin localCode
|
||||
${localCode}
|
||||
//}}} end localCode
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void ${typeName}
|
||||
(
|
||||
Ostream& os,
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
//{{{ begin code
|
||||
${code}
|
||||
//}}} end code
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
204
etc/codeTemplates/dynamicCode/codedFvOptionTemplate.C
Normal file
204
etc/codeTemplates/dynamicCode/codedFvOptionTemplate.C
Normal file
@ -0,0 +1,204 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "codedFvOptionTemplate.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "unitConversion.H"
|
||||
#include "fvMatrix.H"
|
||||
|
||||
//{{{ begin codeInclude
|
||||
${codeInclude}
|
||||
//}}} end codeInclude
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
namespace fv
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
|
||||
|
||||
//{{{ begin localCode
|
||||
${localCode}
|
||||
//}}} end localCode
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||
|
||||
extern "C"
|
||||
{
|
||||
// dynamicCode:
|
||||
// SHA1 = ${SHA1sum}
|
||||
//
|
||||
// unique function name that can be checked if the correct library version
|
||||
// has been loaded
|
||||
void ${typeName}_${SHA1sum}(bool load)
|
||||
{
|
||||
if (load)
|
||||
{
|
||||
// code that can be explicitly executed after loading
|
||||
}
|
||||
else
|
||||
{
|
||||
// code that can be explicitly executed before unloading
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
//makeRemovablePatchTypeField
|
||||
//(
|
||||
// fvPatch${FieldType},
|
||||
// ${typeName}FvOption${SourceType}
|
||||
//);
|
||||
defineTypeNameAndDebug(${typeName}FvOption${SourceType}, 0);
|
||||
addRemovableToRunTimeSelectionTable
|
||||
(
|
||||
option,
|
||||
${typeName}FvOption${SourceType},
|
||||
dictionary
|
||||
);
|
||||
|
||||
|
||||
const char* const ${typeName}FvOption${SourceType}::SHA1sum =
|
||||
"${SHA1sum}";
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
${typeName}FvOption${SourceType}::
|
||||
${typeName}FvOption${SourceType}
|
||||
(
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
option(name, modelType, dict, mesh)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
Info<<"construct ${typeName} sha1: ${SHA1sum}"
|
||||
" from components\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
${typeName}FvOption${SourceType}::
|
||||
~${typeName}FvOption${SourceType}()
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
Info<<"destroy ${typeName} sha1: ${SHA1sum}\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void ${typeName}FvOption${SourceType}::correct
|
||||
(
|
||||
GeometricField<${TemplateType}, fvPatchField, volMesh>& fld
|
||||
)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
Info<<"${typeName}FvOption${SourceType}::correct()\n";
|
||||
}
|
||||
|
||||
//{{{ begin code
|
||||
${codeCorrect}
|
||||
//}}} end code
|
||||
}
|
||||
|
||||
|
||||
void ${typeName}FvOption${SourceType}::addSup
|
||||
(
|
||||
fvMatrix<${TemplateType}>& eqn,
|
||||
const label fieldI
|
||||
)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
Info<<"${typeName}FvOption${SourceType}::addSup()\n";
|
||||
}
|
||||
|
||||
//{{{ begin code
|
||||
${codeAddSup}
|
||||
//}}} end code
|
||||
}
|
||||
|
||||
|
||||
void ${typeName}FvOption${SourceType}::addSup
|
||||
(
|
||||
const volScalarField& rho,
|
||||
fvMatrix<${TemplateType}>& eqn,
|
||||
const label fieldI
|
||||
)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
Info<<"${typeName}FvOption${SourceType}::addSup()\n";
|
||||
}
|
||||
|
||||
//{{{ begin code
|
||||
${codeAddSup}
|
||||
//}}} end code
|
||||
}
|
||||
|
||||
|
||||
void ${typeName}FvOption${SourceType}::setValue
|
||||
(
|
||||
fvMatrix<${TemplateType}>& eqn,
|
||||
const label fieldI
|
||||
)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
Info<<"${typeName}FvOption${SourceType}::setValue()\n";
|
||||
}
|
||||
|
||||
//{{{ begin code
|
||||
${codeSetValue}
|
||||
//}}} end code
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
} // End namespace fv
|
||||
// ************************************************************************* //
|
||||
193
etc/codeTemplates/dynamicCode/codedFvOptionTemplate.H
Normal file
193
etc/codeTemplates/dynamicCode/codedFvOptionTemplate.H
Normal file
@ -0,0 +1,193 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
Template for use with dynamic code generation of a source.
|
||||
The hook functions take the following arguments:
|
||||
|
||||
codeCorrect
|
||||
(
|
||||
GeometricField<Type, fvPatchField, volMesh>& fld
|
||||
)
|
||||
|
||||
codeAddSup
|
||||
(
|
||||
fvMatrix<Type}>& eqn,
|
||||
const label fieldI
|
||||
)
|
||||
|
||||
setValue
|
||||
(
|
||||
fvMatrix<Type}>& eqn,
|
||||
const label fieldI
|
||||
)
|
||||
|
||||
where :
|
||||
fld is the field in fieldNames
|
||||
eqn is the fvMatrix
|
||||
|
||||
energySource
|
||||
{
|
||||
type scalarCodedSource;
|
||||
|
||||
active true;
|
||||
selectionMode all;
|
||||
|
||||
scalarCodedSourceCoeffs
|
||||
{
|
||||
fieldNames (h);
|
||||
redirectType sourceTime;
|
||||
|
||||
codeInclude
|
||||
#{
|
||||
|
||||
#};
|
||||
|
||||
codeCorrect
|
||||
#{
|
||||
Pout<< "**codeCorrect**" << endl;
|
||||
#};
|
||||
|
||||
codeAddSup
|
||||
#{
|
||||
const Time& time = mesh().time();
|
||||
const scalarField& V = mesh_.V();
|
||||
scalarField& heSource = eqn.source();
|
||||
heSource -= 0.1*sqr(time.value())*V;
|
||||
#};
|
||||
|
||||
codeSetValue
|
||||
#{
|
||||
Pout<< "**codeSetValue**" << endl;
|
||||
#};
|
||||
|
||||
// Dummy entry. Make dependent on above to trigger recompilation
|
||||
code
|
||||
#{
|
||||
$codeInclude
|
||||
$codeCorrect
|
||||
$codeAddSup
|
||||
$codeSetValue
|
||||
#};
|
||||
}
|
||||
|
||||
sourceTimeCoeffs
|
||||
{
|
||||
// Dummy entry
|
||||
}
|
||||
}
|
||||
|
||||
SourceFiles
|
||||
codedFvOptionTemplate.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef codedFvOptionTemplate_H
|
||||
#define codedFvOptionTemplate_H
|
||||
|
||||
#include "fvOption.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
namespace fv
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
A templated CodedFvOption
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class ${typeName}FvOption${SourceType}
|
||||
:
|
||||
public option
|
||||
{
|
||||
public:
|
||||
|
||||
//- Information about the SHA1 of the code itself
|
||||
static const char* const SHA1sum;
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("${typeName}");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
${typeName}FvOption${SourceType}
|
||||
(
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
);
|
||||
|
||||
//- Destructor
|
||||
virtual ~${typeName}FvOption${SourceType}();
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Correct field
|
||||
virtual void correct
|
||||
(
|
||||
GeometricField<${TemplateType}, fvPatchField, volMesh>&
|
||||
);
|
||||
|
||||
//- Explicit and implicit matrix contributions
|
||||
virtual void addSup
|
||||
(
|
||||
fvMatrix<${TemplateType}>& eqn,
|
||||
const label fieldI
|
||||
);
|
||||
|
||||
//- Explicit and implicit matrix contributions for compressible
|
||||
// equations
|
||||
virtual void addSup
|
||||
(
|
||||
const volScalarField& rho,
|
||||
fvMatrix<${TemplateType}>& eqn,
|
||||
const label fieldI
|
||||
);
|
||||
|
||||
//- Set value
|
||||
virtual void setValue
|
||||
(
|
||||
fvMatrix<${TemplateType}>& eqn,
|
||||
const label fieldI
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
} // End namespace fv
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
211
etc/codeTemplates/dynamicCode/fixedValueFvPatchFieldTemplate.C
Normal file
211
etc/codeTemplates/dynamicCode/fixedValueFvPatchFieldTemplate.C
Normal file
@ -0,0 +1,211 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fixedValueFvPatchFieldTemplate.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "unitConversion.H"
|
||||
//{{{ begin codeInclude
|
||||
${codeInclude}
|
||||
//}}} end codeInclude
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
|
||||
|
||||
//{{{ begin localCode
|
||||
${localCode}
|
||||
//}}} end localCode
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||
|
||||
extern "C"
|
||||
{
|
||||
// dynamicCode:
|
||||
// SHA1 = ${SHA1sum}
|
||||
//
|
||||
// unique function name that can be checked if the correct library version
|
||||
// has been loaded
|
||||
void ${typeName}_${SHA1sum}(bool load)
|
||||
{
|
||||
if (load)
|
||||
{
|
||||
// code that can be explicitly executed after loading
|
||||
}
|
||||
else
|
||||
{
|
||||
// code that can be explicitly executed before unloading
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
makeRemovablePatchTypeField
|
||||
(
|
||||
fvPatch${FieldType},
|
||||
${typeName}FixedValueFvPatch${FieldType}
|
||||
);
|
||||
|
||||
|
||||
const char* const ${typeName}FixedValueFvPatch${FieldType}::SHA1sum =
|
||||
"${SHA1sum}";
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
${typeName}FixedValueFvPatch${FieldType}::
|
||||
${typeName}FixedValueFvPatch${FieldType}
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<${TemplateType}, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<${TemplateType}>(p, iF)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
Info<<"construct ${typeName} sha1: ${SHA1sum}"
|
||||
" from patch/DimensionedField\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
${typeName}FixedValueFvPatch${FieldType}::
|
||||
${typeName}FixedValueFvPatch${FieldType}
|
||||
(
|
||||
const ${typeName}FixedValueFvPatch${FieldType}& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<${TemplateType}, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<${TemplateType}>(ptf, p, iF, mapper)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
Info<<"construct ${typeName} sha1: ${SHA1sum}"
|
||||
" from patch/DimensionedField/mapper\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
${typeName}FixedValueFvPatch${FieldType}::
|
||||
${typeName}FixedValueFvPatch${FieldType}
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<${TemplateType}, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<${TemplateType}>(p, iF, dict)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
Info<<"construct ${typeName} sha1: ${SHA1sum}"
|
||||
" from patch/dictionary\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
${typeName}FixedValueFvPatch${FieldType}::
|
||||
${typeName}FixedValueFvPatch${FieldType}
|
||||
(
|
||||
const ${typeName}FixedValueFvPatch${FieldType}& ptf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<${TemplateType}>(ptf)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
Info<<"construct ${typeName} sha1: ${SHA1sum}"
|
||||
" as copy\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
${typeName}FixedValueFvPatch${FieldType}::
|
||||
${typeName}FixedValueFvPatch${FieldType}
|
||||
(
|
||||
const ${typeName}FixedValueFvPatch${FieldType}& ptf,
|
||||
const DimensionedField<${TemplateType}, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<${TemplateType}>(ptf, iF)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
Info<<"construct ${typeName} sha1: ${SHA1sum} "
|
||||
"as copy/DimensionedField\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
${typeName}FixedValueFvPatch${FieldType}::
|
||||
~${typeName}FixedValueFvPatch${FieldType}()
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
Info<<"destroy ${typeName} sha1: ${SHA1sum}\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void ${typeName}FixedValueFvPatch${FieldType}::updateCoeffs()
|
||||
{
|
||||
if (this->updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (${verbose:-false})
|
||||
{
|
||||
Info<<"updateCoeffs ${typeName} sha1: ${SHA1sum}\n";
|
||||
}
|
||||
|
||||
//{{{ begin code
|
||||
${code}
|
||||
//}}} end code
|
||||
|
||||
this->fixedValueFvPatchField<${TemplateType}>::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
142
etc/codeTemplates/dynamicCode/fixedValueFvPatchFieldTemplate.H
Normal file
142
etc/codeTemplates/dynamicCode/fixedValueFvPatchFieldTemplate.H
Normal file
@ -0,0 +1,142 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
Template for use with dynamic code generation of a
|
||||
fixedValue fvPatchField.
|
||||
|
||||
- without state
|
||||
|
||||
SourceFiles
|
||||
fixedValueFvPatchFieldTemplate.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef fixedValueFvPatchTemplate${FieldType}_H
|
||||
#define fixedValueFvPatchTemplate${FieldType}_H
|
||||
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
A templated FixedValueFvPatch
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class ${typeName}FixedValueFvPatch${FieldType}
|
||||
:
|
||||
public fixedValueFvPatchField<${TemplateType}>
|
||||
{
|
||||
public:
|
||||
|
||||
//- Information about the SHA1 of the code itself
|
||||
static const char* const SHA1sum;
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("${typeName}");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
${typeName}FixedValueFvPatch${FieldType}
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<${TemplateType}, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
${typeName}FixedValueFvPatch${FieldType}
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<${TemplateType}, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping a copy onto a new patch
|
||||
${typeName}FixedValueFvPatch${FieldType}
|
||||
(
|
||||
const ${typeName}FixedValueFvPatch${FieldType}&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<${TemplateType}, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
${typeName}FixedValueFvPatch${FieldType}
|
||||
(
|
||||
const ${typeName}FixedValueFvPatch${FieldType}&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp< fvPatch${FieldType} > clone() const
|
||||
{
|
||||
return tmp< fvPatch${FieldType} >
|
||||
(
|
||||
new ${typeName}FixedValueFvPatch${FieldType}(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
${typeName}FixedValueFvPatch${FieldType}
|
||||
(
|
||||
const ${typeName}FixedValueFvPatch${FieldType}&,
|
||||
const DimensionedField<${TemplateType}, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp< fvPatch${FieldType} > clone
|
||||
(
|
||||
const DimensionedField<${TemplateType}, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp< fvPatch${FieldType} >
|
||||
(
|
||||
new ${typeName}FixedValueFvPatch${FieldType}(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~${typeName}FixedValueFvPatch${FieldType}();
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,211 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fixedValuePointPatchFieldTemplate.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "pointPatchFieldMapper.H"
|
||||
#include "pointFields.H"
|
||||
#include "unitConversion.H"
|
||||
//{{{ begin codeInclude
|
||||
${codeInclude}
|
||||
//}}} end codeInclude
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
|
||||
|
||||
//{{{ begin localCode
|
||||
${localCode}
|
||||
//}}} end localCode
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||
|
||||
extern "C"
|
||||
{
|
||||
// dynamicCode:
|
||||
// SHA1 = ${SHA1sum}
|
||||
//
|
||||
// unique function name that can be checked if the correct library version
|
||||
// has been loaded
|
||||
void ${typeName}_${SHA1sum}(bool load)
|
||||
{
|
||||
if (load)
|
||||
{
|
||||
// code that can be explicitly executed after loading
|
||||
}
|
||||
else
|
||||
{
|
||||
// code that can be explicitly executed before unloading
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
makePointPatchTypeField
|
||||
(
|
||||
pointPatch${FieldType},
|
||||
${typeName}FixedValuePointPatch${FieldType}
|
||||
);
|
||||
|
||||
|
||||
const char* const ${typeName}FixedValuePointPatch${FieldType}::SHA1sum =
|
||||
"${SHA1sum}";
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
${typeName}FixedValuePointPatch${FieldType}::
|
||||
${typeName}FixedValuePointPatch${FieldType}
|
||||
(
|
||||
const pointPatch& p,
|
||||
const DimensionedField<${TemplateType}, pointMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<${TemplateType}>(p, iF)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
Info<<"construct ${typeName} sha1: ${SHA1sum}"
|
||||
" from patch/DimensionedField\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
${typeName}FixedValuePointPatch${FieldType}::
|
||||
${typeName}FixedValuePointPatch${FieldType}
|
||||
(
|
||||
const ${typeName}FixedValuePointPatch${FieldType}& ptf,
|
||||
const pointPatch& p,
|
||||
const DimensionedField<${TemplateType}, pointMesh>& iF,
|
||||
const pointPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<${TemplateType}>(ptf, p, iF, mapper)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
Info<<"construct ${typeName} sha1: ${SHA1sum}"
|
||||
" from patch/DimensionedField/mapper\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
${typeName}FixedValuePointPatch${FieldType}::
|
||||
${typeName}FixedValuePointPatch${FieldType}
|
||||
(
|
||||
const pointPatch& p,
|
||||
const DimensionedField<${TemplateType}, pointMesh>& iF,
|
||||
const dictionary& dict,
|
||||
const bool valueRequired
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<${TemplateType}>(p, iF, dict, valueRequired)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
Info<<"construct ${typeName} sha1: ${SHA1sum}"
|
||||
" from patch/dictionary\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
${typeName}FixedValuePointPatch${FieldType}::
|
||||
${typeName}FixedValuePointPatch${FieldType}
|
||||
(
|
||||
const ${typeName}FixedValuePointPatch${FieldType}& ptf
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<${TemplateType}>(ptf)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
Info<<"construct ${typeName} sha1: ${SHA1sum}"
|
||||
" as copy\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
${typeName}FixedValuePointPatch${FieldType}::
|
||||
${typeName}FixedValuePointPatch${FieldType}
|
||||
(
|
||||
const ${typeName}FixedValuePointPatch${FieldType}& ptf,
|
||||
const DimensionedField<${TemplateType}, pointMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<${TemplateType}>(ptf, iF)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
Info<<"construct ${typeName} sha1: ${SHA1sum} "
|
||||
"as copy/DimensionedField\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
${typeName}FixedValuePointPatch${FieldType}::
|
||||
~${typeName}FixedValuePointPatch${FieldType}()
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
Info<<"destroy ${typeName} sha1: ${SHA1sum}\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void ${typeName}FixedValuePointPatch${FieldType}::updateCoeffs()
|
||||
{
|
||||
if (this->updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (${verbose:-false})
|
||||
{
|
||||
Info<<"updateCoeffs ${typeName} sha1: ${SHA1sum}\n";
|
||||
}
|
||||
|
||||
//{{{ begin code
|
||||
${code}
|
||||
//}}} end code
|
||||
|
||||
this->fixedValuePointPatchField<${TemplateType}>::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,143 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
Template for use with dynamic code generation of a
|
||||
fixedValue pointPatchField.
|
||||
|
||||
- without state
|
||||
|
||||
SourceFiles
|
||||
fixedValuePointPatchFieldTemplate.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef fixedValuePointPatchTemplate${FieldType}_H
|
||||
#define fixedValuePointPatchTemplate${FieldType}_H
|
||||
|
||||
#include "fixedValuePointPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
A templated FixedValuePointPatchField
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class ${typeName}FixedValuePointPatch${FieldType}
|
||||
:
|
||||
public fixedValuePointPatchField<${TemplateType}>
|
||||
{
|
||||
public:
|
||||
|
||||
//- Information about the SHA1 of the code itself
|
||||
static const char* const SHA1sum;
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("${typeName}");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
${typeName}FixedValuePointPatch${FieldType}
|
||||
(
|
||||
const pointPatch&,
|
||||
const DimensionedField<${TemplateType}, pointMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
${typeName}FixedValuePointPatch${FieldType}
|
||||
(
|
||||
const pointPatch&,
|
||||
const DimensionedField<${TemplateType}, pointMesh>&,
|
||||
const dictionary&,
|
||||
const bool valueRequired=true
|
||||
);
|
||||
|
||||
//- Construct by mapping a copy onto a new patch
|
||||
${typeName}FixedValuePointPatch${FieldType}
|
||||
(
|
||||
const ${typeName}FixedValuePointPatch${FieldType}&,
|
||||
const pointPatch&,
|
||||
const DimensionedField<${TemplateType}, pointMesh>&,
|
||||
const pointPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
${typeName}FixedValuePointPatch${FieldType}
|
||||
(
|
||||
const ${typeName}FixedValuePointPatch${FieldType}&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr< pointPatchField<${TemplateType}> > clone() const
|
||||
{
|
||||
return autoPtr< pointPatchField<${TemplateType}> >
|
||||
(
|
||||
new ${typeName}FixedValuePointPatch${FieldType}(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
${typeName}FixedValuePointPatch${FieldType}
|
||||
(
|
||||
const ${typeName}FixedValuePointPatch${FieldType}&,
|
||||
const DimensionedField<${TemplateType}, pointMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual autoPtr< pointPatchField<${TemplateType}> > clone
|
||||
(
|
||||
const DimensionedField<${TemplateType}, pointMesh>& iF
|
||||
) const
|
||||
{
|
||||
return autoPtr< pointPatchField<${TemplateType}> >
|
||||
(
|
||||
new ${typeName}FixedValuePointPatch${FieldType}(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~${typeName}FixedValuePointPatch${FieldType}();
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
156
etc/codeTemplates/dynamicCode/functionObjectTemplate.C
Normal file
156
etc/codeTemplates/dynamicCode/functionObjectTemplate.C
Normal file
@ -0,0 +1,156 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "functionObjectTemplate.H"
|
||||
#include "Time.H"
|
||||
#include "fvCFD.H"
|
||||
#include "unitConversion.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(${typeName}FunctionObject, 0);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
|
||||
|
||||
//{{{ begin localCode
|
||||
${localCode}
|
||||
//}}} end localCode
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
const objectRegistry& ${typeName}FunctionObject::obr() const
|
||||
{
|
||||
return obr_;
|
||||
}
|
||||
|
||||
|
||||
const fvMesh& ${typeName}FunctionObject::mesh() const
|
||||
{
|
||||
return refCast<const fvMesh>(obr_);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
${typeName}FunctionObject::${typeName}FunctionObject
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
obr_(obr)
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
${typeName}FunctionObject::~${typeName}FunctionObject()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void ${typeName}FunctionObject::read(const dictionary& dict)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
Info<<"read ${typeName} sha1: ${SHA1sum}\n";
|
||||
}
|
||||
|
||||
//{{{ begin code
|
||||
${codeRead}
|
||||
//}}} end code
|
||||
}
|
||||
|
||||
|
||||
void ${typeName}FunctionObject::execute()
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
Info<<"execute ${typeName} sha1: ${SHA1sum}\n";
|
||||
}
|
||||
|
||||
//{{{ begin code
|
||||
${codeExecute}
|
||||
//}}} end code
|
||||
}
|
||||
|
||||
|
||||
void ${typeName}FunctionObject::end()
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
Info<<"end ${typeName} sha1: ${SHA1sum}\n";
|
||||
}
|
||||
|
||||
//{{{ begin code
|
||||
${codeEnd}
|
||||
//}}} end code
|
||||
}
|
||||
|
||||
|
||||
void ${typeName}FunctionObject::timeSet()
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
Info<<"timeSet ${typeName} sha1: ${SHA1sum}\n";
|
||||
}
|
||||
|
||||
//{{{ begin codeTime
|
||||
${codeTimeSet}
|
||||
//}}} end code
|
||||
}
|
||||
|
||||
|
||||
void ${typeName}FunctionObject::write()
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
Info<<"write ${typeName} sha1: ${SHA1sum}\n";
|
||||
}
|
||||
|
||||
//{{{ begin code
|
||||
${code}
|
||||
//}}} end code
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
151
etc/codeTemplates/dynamicCode/functionObjectTemplate.H
Normal file
151
etc/codeTemplates/dynamicCode/functionObjectTemplate.H
Normal file
@ -0,0 +1,151 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
Template for use with dynamic code generation of a
|
||||
OutputFilter functionObject.
|
||||
|
||||
SourceFiles
|
||||
functionObjectTemplate.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef functionObjectTemplate_H
|
||||
#define functionObjectTemplate_H
|
||||
|
||||
#include "stringList.H"
|
||||
#include "pointField.H"
|
||||
|
||||
//{{{ begin codeInclude
|
||||
${codeInclude}
|
||||
//}}} end codeInclude
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
class polyMesh;
|
||||
class mapPolyMesh;
|
||||
class fvMesh;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
A templated functionObject
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class ${typeName}FunctionObject
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of this set of system calls
|
||||
word name_;
|
||||
|
||||
//- Registry
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//{{{ begin codeData
|
||||
${codeData}
|
||||
//}}} end codeData
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
const objectRegistry& obr() const;
|
||||
|
||||
const fvMesh& mesh() const;
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
${typeName}FunctionObject(const ${typeName}FunctionObject&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const ${typeName}FunctionObject&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("${typeName}");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given objectRegistry and dictionary.
|
||||
// Allow the possibility to load fields from files
|
||||
${typeName}FunctionObject
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& unused,
|
||||
const dictionary&,
|
||||
const bool loadFromFilesUnused = false
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~${typeName}FunctionObject();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return name of the system call set
|
||||
virtual const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Read the system calls
|
||||
virtual void read(const dictionary&);
|
||||
|
||||
//- Execute the "executeCalls" at each time-step
|
||||
virtual void execute();
|
||||
|
||||
//- Execute the "endCalls" at the final time-loop
|
||||
virtual void end();
|
||||
|
||||
//- Write, execute the "writeCalls"
|
||||
virtual void write();
|
||||
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual void timeSet();
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh&)
|
||||
{}
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void movePoints(const polyMesh&)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
211
etc/codeTemplates/dynamicCode/mixedFvPatchFieldTemplate.C
Normal file
211
etc/codeTemplates/dynamicCode/mixedFvPatchFieldTemplate.C
Normal file
@ -0,0 +1,211 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "mixedFvPatchFieldTemplate.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "unitConversion.H"
|
||||
//{{{ begin codeInclude
|
||||
${codeInclude}
|
||||
//}}} end codeInclude
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
|
||||
|
||||
//{{{ begin localCode
|
||||
${localCode}
|
||||
//}}} end localCode
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||
|
||||
extern "C"
|
||||
{
|
||||
// dynamicCode:
|
||||
// SHA1 = ${SHA1sum}
|
||||
//
|
||||
// unique function name that can be checked if the correct library version
|
||||
// has been loaded
|
||||
void ${typeName}_${SHA1sum}(bool load)
|
||||
{
|
||||
if (load)
|
||||
{
|
||||
// code that can be explicitly executed after loading
|
||||
}
|
||||
else
|
||||
{
|
||||
// code that can be explicitly executed before unloading
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
makeRemovablePatchTypeField
|
||||
(
|
||||
fvPatch${FieldType},
|
||||
${typeName}MixedValueFvPatch${FieldType}
|
||||
);
|
||||
|
||||
|
||||
const char* const ${typeName}MixedValueFvPatch${FieldType}::SHA1sum =
|
||||
"${SHA1sum}";
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
${typeName}MixedValueFvPatch${FieldType}::
|
||||
${typeName}MixedValueFvPatch${FieldType}
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<${TemplateType}, volMesh>& iF
|
||||
)
|
||||
:
|
||||
mixedFvPatchField<${TemplateType}>(p, iF)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
Info<<"construct ${typeName} sha1: ${SHA1sum}"
|
||||
" from patch/DimensionedField\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
${typeName}MixedValueFvPatch${FieldType}::
|
||||
${typeName}MixedValueFvPatch${FieldType}
|
||||
(
|
||||
const ${typeName}MixedValueFvPatch${FieldType}& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<${TemplateType}, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
mixedFvPatchField<${TemplateType}>(ptf, p, iF, mapper)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
Info<<"construct ${typeName} sha1: ${SHA1sum}"
|
||||
" from patch/DimensionedField/mapper\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
${typeName}MixedValueFvPatch${FieldType}::
|
||||
${typeName}MixedValueFvPatch${FieldType}
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<${TemplateType}, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
mixedFvPatchField<${TemplateType}>(p, iF, dict)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
Info<<"construct ${typeName} sha1: ${SHA1sum}"
|
||||
" from patch/dictionary\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
${typeName}MixedValueFvPatch${FieldType}::
|
||||
${typeName}MixedValueFvPatch${FieldType}
|
||||
(
|
||||
const ${typeName}MixedValueFvPatch${FieldType}& ptf
|
||||
)
|
||||
:
|
||||
mixedFvPatchField<${TemplateType}>(ptf)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
Info<<"construct ${typeName} sha1: ${SHA1sum}"
|
||||
" as copy\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
${typeName}MixedValueFvPatch${FieldType}::
|
||||
${typeName}MixedValueFvPatch${FieldType}
|
||||
(
|
||||
const ${typeName}MixedValueFvPatch${FieldType}& ptf,
|
||||
const DimensionedField<${TemplateType}, volMesh>& iF
|
||||
)
|
||||
:
|
||||
mixedFvPatchField<${TemplateType}>(ptf, iF)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
Info<<"construct ${typeName} sha1: ${SHA1sum} "
|
||||
"as copy/DimensionedField\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
${typeName}MixedValueFvPatch${FieldType}::
|
||||
~${typeName}MixedValueFvPatch${FieldType}()
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
Info<<"destroy ${typeName} sha1: ${SHA1sum}\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void ${typeName}MixedValueFvPatch${FieldType}::updateCoeffs()
|
||||
{
|
||||
if (this->updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (${verbose:-false})
|
||||
{
|
||||
Info<<"updateCoeffs ${typeName} sha1: ${SHA1sum}\n";
|
||||
}
|
||||
|
||||
//{{{ begin code
|
||||
${code}
|
||||
//}}} end code
|
||||
|
||||
this->mixedFvPatchField<${TemplateType}>::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
142
etc/codeTemplates/dynamicCode/mixedFvPatchFieldTemplate.H
Normal file
142
etc/codeTemplates/dynamicCode/mixedFvPatchFieldTemplate.H
Normal file
@ -0,0 +1,142 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
Template for use with dynamic code generation of a
|
||||
mixed fvPatchField.
|
||||
|
||||
- without state
|
||||
|
||||
SourceFiles
|
||||
mixedFvPatchFieldTemplate.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef mixedFvPatchTemplate${FieldType}_H
|
||||
#define mixedFvPatchTemplate${FieldType}_H
|
||||
|
||||
#include "mixedFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
A templated MixedValueFvPatchField
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class ${typeName}MixedValueFvPatch${FieldType}
|
||||
:
|
||||
public mixedFvPatchField<${TemplateType}>
|
||||
{
|
||||
public:
|
||||
|
||||
//- Information about the SHA1 of the code itself
|
||||
static const char* const SHA1sum;
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("${typeName}");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
${typeName}MixedValueFvPatch${FieldType}
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<${TemplateType}, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
${typeName}MixedValueFvPatch${FieldType}
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<${TemplateType}, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping a copy onto a new patch
|
||||
${typeName}MixedValueFvPatch${FieldType}
|
||||
(
|
||||
const ${typeName}MixedValueFvPatch${FieldType}&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<${TemplateType}, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
${typeName}MixedValueFvPatch${FieldType}
|
||||
(
|
||||
const ${typeName}MixedValueFvPatch${FieldType}&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp< fvPatch${FieldType} > clone() const
|
||||
{
|
||||
return tmp< fvPatch${FieldType} >
|
||||
(
|
||||
new ${typeName}MixedValueFvPatch${FieldType}(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
${typeName}MixedValueFvPatch${FieldType}
|
||||
(
|
||||
const ${typeName}MixedValueFvPatch${FieldType}&,
|
||||
const DimensionedField<${TemplateType}, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp< fvPatch${FieldType} > clone
|
||||
(
|
||||
const DimensionedField<${TemplateType}, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp< fvPatch${FieldType} >
|
||||
(
|
||||
new ${typeName}MixedValueFvPatch${FieldType}(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~${typeName}MixedValueFvPatch${FieldType}();
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
31
etc/codeTemplates/foamCommentStyles
Normal file
31
etc/codeTemplates/foamCommentStyles
Normal file
@ -0,0 +1,31 @@
|
||||
1234567890123456789012345678901234567890123456789012345678901234567890123456789
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
// ------------------------------------------------------------------------- //
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||
32
etc/codeTemplates/foamScript
Normal file
32
etc/codeTemplates/foamScript
Normal file
@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
#------------------------------------------------------------------------------
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration |
|
||||
# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
# \\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Script
|
||||
#
|
||||
#
|
||||
# Description
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
102
etc/codeTemplates/source/_Template.C
Normal file
102
etc/codeTemplates/source/_Template.C
Normal file
@ -0,0 +1,102 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "CLASSNAME.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
const dataType Foam::CLASSNAME::staticData();
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::CLASSNAME::CLASSNAME()
|
||||
:
|
||||
baseClassName(),
|
||||
data_()
|
||||
{}
|
||||
|
||||
|
||||
Foam::CLASSNAME::CLASSNAME(const dataType& data)
|
||||
:
|
||||
baseClassName(),
|
||||
data_(data)
|
||||
{}
|
||||
|
||||
|
||||
Foam::CLASSNAME::CLASSNAME(const CLASSNAME&)
|
||||
:
|
||||
baseClassName(),
|
||||
data_()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::CLASSNAME>
|
||||
Foam::CLASSNAME::New()
|
||||
{
|
||||
return autoPtr<CLASSNAME>(new CLASSNAME);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::CLASSNAME::~CLASSNAME()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::CLASSNAME::operator=(const CLASSNAME& rhs)
|
||||
{
|
||||
// Check for assignment to self
|
||||
if (this == &rhs)
|
||||
{
|
||||
FatalErrorIn("Foam::CLASSNAME::operator=(const Foam::CLASSNAME&)")
|
||||
<< "Attempted assignment to self"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
151
etc/codeTemplates/source/_Template.H
Normal file
151
etc/codeTemplates/source/_Template.H
Normal file
@ -0,0 +1,151 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::CLASSNAME
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
CLASSNAMEI.H
|
||||
CLASSNAME.C
|
||||
CLASSNAMEIO.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef CLASSNAME_H
|
||||
#define CLASSNAME_H
|
||||
|
||||
#include ".H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class Istream;
|
||||
class Ostream;
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
class CLASSNAME;
|
||||
Istream& operator>>(Istream&, CLASSNAME&);
|
||||
Ostream& operator<<(Ostream&, const CLASSNAME&);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class CLASSNAME Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class CLASSNAME
|
||||
:
|
||||
public baseClassName
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Description of data_
|
||||
dataType data_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
CLASSNAME(const CLASSNAME&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const CLASSNAME&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Static data members
|
||||
|
||||
//- Static data staticData
|
||||
static const dataType staticData;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
CLASSNAME();
|
||||
|
||||
//- Construct from components
|
||||
CLASSNAME(const dataType& data);
|
||||
|
||||
//- Construct from Istream
|
||||
CLASSNAME(Istream&);
|
||||
|
||||
//- Construct as copy
|
||||
CLASSNAME(const CLASSNAME&);
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Select null constructed
|
||||
static autoPtr<CLASSNAME> New();
|
||||
|
||||
|
||||
//- Destructor
|
||||
~CLASSNAME();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
// Check
|
||||
|
||||
// Edit
|
||||
|
||||
// Write
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
void operator=(const CLASSNAME&);
|
||||
|
||||
|
||||
// Friend Functions
|
||||
|
||||
// Friend Operators
|
||||
|
||||
// IOstream Operators
|
||||
|
||||
friend Istream& operator>>(Istream&, CLASSNAME&);
|
||||
friend Ostream& operator<<(Ostream&, const CLASSNAME&);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "CLASSNAMEI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
48
etc/codeTemplates/source/_TemplateApp.C
Normal file
48
etc/codeTemplates/source/_TemplateApp.C
Normal file
@ -0,0 +1,48 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Application
|
||||
CLASSNAME
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nEnd\n" << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
58
etc/codeTemplates/source/_TemplateI.H
Normal file
58
etc/codeTemplates/source/_TemplateI.H
Normal file
@ -0,0 +1,58 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
70
etc/codeTemplates/source/_TemplateIO.C
Normal file
70
etc/codeTemplates/source/_TemplateIO.C
Normal file
@ -0,0 +1,70 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "CLASSNAME.H"
|
||||
#include "IOstreams.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::CLASSNAME::CLASSNAME(Istream& is)
|
||||
:
|
||||
base1(is),
|
||||
base2(is),
|
||||
member1(is),
|
||||
member2(is)
|
||||
{
|
||||
// Check state of Istream
|
||||
is.check("Foam::CLASSNAME::CLASSNAME(Foam::Istream&)");
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
Foam::Istream& Foam::operator>>(Istream& is, CLASSNAME&)
|
||||
{
|
||||
// Check state of Istream
|
||||
is.check
|
||||
(
|
||||
"Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::CLASSNAME&)"
|
||||
);
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const CLASSNAME&)
|
||||
{
|
||||
// Check state of Ostream
|
||||
os.check
|
||||
(
|
||||
"Foam::Ostream& Foam::operator<<(Foam::Ostream&, "
|
||||
"const Foam::CLASSNAME&)"
|
||||
);
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
115
etc/codeTemplates/source/foamNewSource
Executable file
115
etc/codeTemplates/source/foamNewSource
Executable file
@ -0,0 +1,115 @@
|
||||
#!/bin/sh
|
||||
#------------------------------------------------------------------------------
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration |
|
||||
# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
# \\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Script
|
||||
# foamNewSource
|
||||
#
|
||||
# Description
|
||||
# Create a new standard OpenFOAM source file
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
Script=${0##*/}
|
||||
Template="$WM_PROJECT_DIR/etc/codeTemplates/source/_Template"
|
||||
|
||||
usage() {
|
||||
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
||||
cat<<USAGE
|
||||
Usage: $Script [OPTION] <type> <ClassName>
|
||||
options:
|
||||
-help print the usage
|
||||
|
||||
* create a new standard OpenFOAM source file
|
||||
|
||||
type: (C|H|I|IO|App)
|
||||
|
||||
A ClassName starting with '-' will simply display the template
|
||||
|
||||
USAGE
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
className="$2"
|
||||
unset subType Type printOpt
|
||||
|
||||
# for a className starting with '-' simply display the code
|
||||
if [ "${2#-}" != "${2}" ]
|
||||
then
|
||||
printOpt=true
|
||||
fi
|
||||
|
||||
|
||||
# this implicitly covers a lone -help
|
||||
[ "$#" -gt 1 ] || usage
|
||||
|
||||
case "$1" in
|
||||
(-h | -help)
|
||||
usage
|
||||
;;
|
||||
(C|H)
|
||||
Type=".$1"
|
||||
;;
|
||||
(I)
|
||||
Type="$1.H"
|
||||
;;
|
||||
(IO)
|
||||
Type="$1.C"
|
||||
;;
|
||||
(app|App)
|
||||
subType=App
|
||||
Type=".C"
|
||||
;;
|
||||
(*)
|
||||
usage "unknown type '$1'"
|
||||
;;
|
||||
esac
|
||||
|
||||
[ "$#" -eq 2 ] || usage "wrong number of arguments"
|
||||
shift 2
|
||||
|
||||
|
||||
if [ "${printOpt:-false}" = true ]
|
||||
then
|
||||
cat $Template$subType$Type
|
||||
else
|
||||
|
||||
fileName="$className$Type"
|
||||
|
||||
echo "$Script: Creating new interface file $fileName"
|
||||
if [ -e "$fileName" ]
|
||||
then
|
||||
echo " Error: file exists"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# process class name
|
||||
sed "s/CLASSNAME/$className/g" $Template$subType$Type > $fileName
|
||||
|
||||
if [ "$subType" = App -a ! -d Make ]
|
||||
then
|
||||
wmakeFilesAndOptions
|
||||
fi
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
122
etc/codeTemplates/template/_TemplateTemplate.C
Normal file
122
etc/codeTemplates/template/_TemplateTemplate.C
Normal file
@ -0,0 +1,122 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "CLASSNAME.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
template<TemplateClassArgument>
|
||||
const dataType Foam::CLASSNAME<TemplateArgument>::staticData();
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<TemplateClassArgument>
|
||||
Foam::CLASSNAME<TemplateArgument>::CLASSNAME()
|
||||
:
|
||||
baseClassName(),
|
||||
data_()
|
||||
{}
|
||||
|
||||
|
||||
template<TemplateClassArgument>
|
||||
Foam::CLASSNAME<TemplateArgument>::CLASSNAME(const dataType& data)
|
||||
:
|
||||
baseClassName(),
|
||||
data_(data)
|
||||
{}
|
||||
|
||||
|
||||
template<TemplateClassArgument>
|
||||
Foam::CLASSNAME<TemplateArgument>::CLASSNAME
|
||||
(
|
||||
const CLASSNAME<TemplateArgument>&
|
||||
)
|
||||
:
|
||||
baseCLASSNAME(),
|
||||
data_()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<TemplateClassArgument>
|
||||
Foam::autoPtr<Foam::CLASSNAME<TemplateArgument> >
|
||||
Foam::CLASSNAME<TemplateArgument>::New()
|
||||
{
|
||||
return autoPtr<CLASSNAME<TemplateArgument> >
|
||||
(
|
||||
new CLASSNAME<TemplateArgument>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<TemplateClassArgument>
|
||||
Foam::CLASSNAME<TemplateArgument>::~CLASSNAME()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
|
||||
|
||||
template<TemplateClassArgument>
|
||||
void Foam::CLASSNAME<TemplateArgument>::operator=
|
||||
(
|
||||
const CLASSNAME<TemplateArgument>& rhs
|
||||
)
|
||||
{
|
||||
// Check for assignment to self
|
||||
if (this == &rhs)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::CLASSNAME<TemplateArgument>::operator="
|
||||
"(const Foam::CLASSNAME<TemplateArgument>&)"
|
||||
) << "Attempted assignment to self"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
157
etc/codeTemplates/template/_TemplateTemplate.H
Normal file
157
etc/codeTemplates/template/_TemplateTemplate.H
Normal file
@ -0,0 +1,157 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::CLASSNAME
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
CLASSNAMEI.H
|
||||
CLASSNAME.C
|
||||
CLASSNAMEIO.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef CLASSNAME_H
|
||||
#define CLASSNAME_H
|
||||
|
||||
#include ".H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class someClass;
|
||||
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
template<TemplateClassArgument>
|
||||
class CLASSNAME;
|
||||
|
||||
template<TemplateClassArgument>
|
||||
Istream& operator>>(Istream&, CLASSNAME<TemplateArgument>&);
|
||||
|
||||
template<TemplateClassArgument>
|
||||
Ostream& operator<<(Ostream&, const CLASSNAME<TemplateArgument>&);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class CLASSNAME Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<TemplateClassArgument>
|
||||
class CLASSNAME
|
||||
:
|
||||
public baseClassName
|
||||
{
|
||||
// Private data
|
||||
|
||||
dataType data_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
CLASSNAME(const CLASSNAME<TemplateArgument>&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const CLASSNAME<TemplateArgument>&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Static data members
|
||||
|
||||
//- Static data someStaticData
|
||||
static const dataType staticData;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
CLASSNAME();
|
||||
|
||||
//- Construct from components
|
||||
CLASSNAME(const dataType& data);
|
||||
|
||||
//- Construct from Istream
|
||||
CLASSNAME(Istream&);
|
||||
|
||||
//- Construct as copy
|
||||
CLASSNAME(const CLASSNAME<TemplateArgument>&);
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Select null constructed
|
||||
static autoPtr<CLASSNAME<TemplateArgument> > New();
|
||||
|
||||
|
||||
//- Destructor
|
||||
~CLASSNAME();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Member Operators
|
||||
|
||||
void operator=(const CLASSNAME<TemplateArgument>&);
|
||||
|
||||
|
||||
// Friend Functions
|
||||
|
||||
// Friend Operators
|
||||
|
||||
// IOstream Operators
|
||||
|
||||
friend Istream& operator>> <TemplateArgument>
|
||||
(Istream&, CLASSNAME<TemplateArgument>&);
|
||||
|
||||
friend Ostream& operator<< <TemplateArgument>
|
||||
(Ostream&, const CLASSNAME<TemplateArgument>&);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "CLASSNAMEI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "CLASSNAME.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
58
etc/codeTemplates/template/_TemplateTemplateI.H
Normal file
58
etc/codeTemplates/template/_TemplateTemplateI.H
Normal file
@ -0,0 +1,58 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
82
etc/codeTemplates/template/_TemplateTemplateIO.C
Normal file
82
etc/codeTemplates/template/_TemplateTemplateIO.C
Normal file
@ -0,0 +1,82 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "CLASSNAME.H"
|
||||
#include "IOstreams.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<TemplateClassArgument>
|
||||
Foam::CLASSNAME<TemplateArgument>::CLASSNAME(Istream& is)
|
||||
:
|
||||
base1(is),
|
||||
base2(is),
|
||||
member1(is),
|
||||
member2(is)
|
||||
{
|
||||
// Check state of Istream
|
||||
is.check("Foam::CLASSNAME<TemplateArgument>::CLASSNAME(Foam::Istream&)");
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
template<TemplateClassArgument>
|
||||
Foam::Istream& Foam::operator>>
|
||||
(
|
||||
Istream& is,
|
||||
CLASSNAME<TemplateArgument>&
|
||||
)
|
||||
{
|
||||
// Check state of Istream
|
||||
is.check
|
||||
(
|
||||
"Foam::Istream& Foam::operator>>"
|
||||
"(Foam::Istream&, Foam::CLASSNAME<TemplateArgument>&)"
|
||||
);
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
template<TemplateClassArgument>
|
||||
Foam::Ostream& Foam::operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const CLASSNAME<TemplateArgument>&
|
||||
)
|
||||
{
|
||||
// Check state of Ostream
|
||||
os.check
|
||||
(
|
||||
"Foam::Ostream& Foam::operator<<"
|
||||
"(Ostream&, const CLASSNAME<TemplateArgument>&)"
|
||||
);
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
130
etc/codeTemplates/template/foamNewTemplate
Executable file
130
etc/codeTemplates/template/foamNewTemplate
Executable file
@ -0,0 +1,130 @@
|
||||
#!/bin/sh
|
||||
#------------------------------------------------------------------------------
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration |
|
||||
# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
# \\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Script
|
||||
# foamNewTemplate
|
||||
#
|
||||
# Description
|
||||
# Create a new standard OpenFOAM templated source file
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
Script=${0##*/}
|
||||
Template="$WM_PROJECT_DIR/etc/codeTemplates/template/_TemplateTemplate"
|
||||
|
||||
usage() {
|
||||
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
||||
cat<<USAGE
|
||||
|
||||
Usage: $Script [OPTION] <type> <ClassName> <Template arguments...>
|
||||
options:
|
||||
-help print the usage
|
||||
|
||||
* create a new standard OpenFOAM source file for templated classes
|
||||
|
||||
type: (C|H|I|IO)
|
||||
|
||||
A ClassName starting with '-' will simply display the template
|
||||
|
||||
USAGE
|
||||
exit 1
|
||||
}
|
||||
|
||||
# this implicitly covers a lone -help
|
||||
[ "$#" -gt 1 ] || usage
|
||||
|
||||
|
||||
className="$2"
|
||||
unset Type printOpt
|
||||
|
||||
# for a className starting with '-' simply display the code
|
||||
if [ "${2#-}" != "${2}" ]
|
||||
then
|
||||
printOpt=true
|
||||
fi
|
||||
|
||||
|
||||
case "$1" in
|
||||
(-h | -help)
|
||||
usage
|
||||
;;
|
||||
(C|H)
|
||||
Type=".$1"
|
||||
;;
|
||||
(I)
|
||||
Type="$1.H"
|
||||
;;
|
||||
(IO)
|
||||
Type="$1.C"
|
||||
;;
|
||||
*)
|
||||
usage "unknown type '$1'"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
if [ "${printOpt:-false}" = true ]
|
||||
then
|
||||
[ "$#" -eq 2 ] || usage "wrong number of arguments"
|
||||
shift 2
|
||||
|
||||
cat $Template$Type
|
||||
|
||||
else
|
||||
|
||||
[ "$#" -ge 3 ] || usage "wrong number of arguments"
|
||||
shift 2
|
||||
|
||||
fileName="$className$Type"
|
||||
|
||||
echo "$Script: Creating new template interface file $fileName"
|
||||
if [ -e "$fileName" ]
|
||||
then
|
||||
echo " Error: file exists"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# process class name
|
||||
sed -e "s/CLASSNAME/$className/g" $Template$Type > $fileName.1
|
||||
|
||||
|
||||
# process remaining (template) arguments
|
||||
for tArg
|
||||
do
|
||||
sed -e "s/TemplateClassArgument/class $tArg, TemplateClassArgument/g" \
|
||||
-e "s/TemplateArgument/$tArg, TemplateArgument/g" \
|
||||
$fileName.1 > $fileName.2
|
||||
|
||||
mv $fileName.2 $fileName.1
|
||||
done
|
||||
|
||||
|
||||
# remove remaining ", Template .."
|
||||
sed -e "s/, TemplateClassArgument//g" \
|
||||
-e "s/, TemplateArgument//g" \
|
||||
$fileName.1 > $fileName
|
||||
|
||||
rm $fileName.1
|
||||
fi
|
||||
#------------------------------------------------------------------------------
|
||||
Reference in New Issue
Block a user