STYLE: move source templates from bin/templates/ to etc/codeTemplates/

This commit is contained in:
Mark Olesen
2010-03-03 09:19:23 +01:00
parent 8c6a5dde5c
commit 2073dcf9d7
59 changed files with 53 additions and 53 deletions

View 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 * * * * * * * * * * * * * //

View File

@ -0,0 +1,33 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
#
# OpenFOAM is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenFOAM; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# Script
#
#
# Description
#
#------------------------------------------------------------------------------
# ----------------------------------------------------------------- end-of-file

View File

@ -0,0 +1,102 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "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 * * * * * * * * * * * * * * //
// ************************************************************************* //

View File

@ -0,0 +1,152 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::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
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
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;
}
// ************************************************************************* //

View File

@ -0,0 +1,59 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* //

View File

@ -0,0 +1,71 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "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;
}
// ************************************************************************* //

View File

@ -0,0 +1,101 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
#
# OpenFOAM is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenFOAM; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# 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 <type> <ClassName>
* create a new standard OpenFOAM source file
type: (C|H|I|IO|App)
USAGE
exit 1
}
# this implicitly covers a lone -help
[ "$#" -gt 1 ] || usage
className="$2"
unset subType Type
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"
;;
esac
[ "$#" -eq 2 ] || usage "wrong number of arguments"
shift 2
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
#------------------------------------------------------------------------------

View File

@ -0,0 +1,123 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "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 * * * * * * * * * * * * * * //
// ************************************************************************* //

View File

@ -0,0 +1,158 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::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
// ************************************************************************* //

View File

@ -0,0 +1,59 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* //

View File

@ -0,0 +1,83 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "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;
}
// ************************************************************************* //

View File

@ -0,0 +1,110 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
#
# OpenFOAM is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenFOAM; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# 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 <type> <ClassName> <Template arguments...>
* create a new standard OpenFOAM source file for templated classes
type: (C|H|I|IO)
USAGE
exit 1
}
# this implicitly covers a lone -help
[ "$#" -gt 1 ] || usage
className="$2"
unset Type
case "$1" in
-h | -help)
usage
;;
C|H)
Type=".$1"
;;
I)
Type="$1.H"
;;
IO)
Type="$1.C"
;;
*)
usage "unknown type"
;;
esac
[ "$#" -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 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
#------------------------------------------------------------------------------