mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
consistency update: foamNew, foamNewSource, foamNewTemplate
- simplified the logic - provide direct link to the respective scripts - provide help from the respective scripts
This commit is contained in:
15
bin/foamNew
15
bin/foamNew
@ -33,7 +33,6 @@
|
|||||||
usage() {
|
usage() {
|
||||||
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
||||||
cat<<USAGE
|
cat<<USAGE
|
||||||
|
|
||||||
usage: ${0##*/} <type> {args}
|
usage: ${0##*/} <type> {args}
|
||||||
|
|
||||||
* create a new standard OpenFOAM source or template file
|
* create a new standard OpenFOAM source or template file
|
||||||
@ -44,22 +43,18 @@ USAGE
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$#" -lt 2 ]
|
|
||||||
then
|
# this implicitly covers a lone -help, but let other scripts handle the rest
|
||||||
usage "wrong number of arguments, expected 2 (or more)"
|
[ "$#" -gt 1 ] || usage
|
||||||
fi
|
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-h | -help)
|
|
||||||
usage
|
|
||||||
;;
|
|
||||||
source)
|
source)
|
||||||
shift
|
shift
|
||||||
$WM_PROJECT_DIR/bin/foamTemplates/source/newSource $*
|
$WM_PROJECT_DIR/bin/templates/source/foamNewSource $*
|
||||||
;;
|
;;
|
||||||
template)
|
template)
|
||||||
shift
|
shift
|
||||||
$WM_PROJECT_DIR/bin/foamTemplates/sourceTemplate/newSourceTemplate $*
|
$WM_PROJECT_DIR/bin/templates/sourceTemplate/foamNewTemplate $*
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
usage "unknown type"
|
usage "unknown type"
|
||||||
|
|||||||
1
bin/foamNewSource
Symbolic link
1
bin/foamNewSource
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
templates/source/foamNewSource
|
||||||
1
bin/foamNewTemplate
Symbolic link
1
bin/foamNewTemplate
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
templates/sourceTemplate/foamNewTemplate
|
||||||
@ -24,11 +24,11 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "className.H"
|
#include "CLASSNAME.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
const dataType Foam::className::staticData();
|
const dataType Foam::CLASSNAME::staticData();
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
@ -42,21 +42,21 @@ const dataType Foam::className::staticData();
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::className::className()
|
Foam::CLASSNAME::CLASSNAME()
|
||||||
:
|
:
|
||||||
baseClassName(),
|
baseClassName(),
|
||||||
data_()
|
data_()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::className::className(const dataType& data)
|
Foam::CLASSNAME::CLASSNAME(const dataType& data)
|
||||||
:
|
:
|
||||||
baseClassName(),
|
baseClassName(),
|
||||||
data_(data)
|
data_(data)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::className::className(const className&)
|
Foam::CLASSNAME::CLASSNAME(const CLASSNAME&)
|
||||||
:
|
:
|
||||||
baseClassName(),
|
baseClassName(),
|
||||||
data_()
|
data_()
|
||||||
@ -65,15 +65,15 @@ Foam::className::className(const className&)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::autoPtr<Foam::className> Foam::className::New()
|
Foam::autoPtr<Foam::CLASSNAME> Foam::CLASSNAME::New()
|
||||||
{
|
{
|
||||||
return autoPtr<className>(new className);
|
return autoPtr<CLASSNAME>(new CLASSNAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::className::~className()
|
Foam::CLASSNAME::~CLASSNAME()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -82,12 +82,12 @@ Foam::className::~className()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::className::operator=(const className& rhs)
|
void Foam::CLASSNAME::operator=(const CLASSNAME& rhs)
|
||||||
{
|
{
|
||||||
// Check for assignment to self
|
// Check for assignment to self
|
||||||
if (this == &rhs)
|
if (this == &rhs)
|
||||||
{
|
{
|
||||||
FatalErrorIn("Foam::className::operator=(const Foam::className&)")
|
FatalErrorIn("Foam::CLASSNAME::operator=(const Foam::CLASSNAME&)")
|
||||||
<< "Attempted assignment to self"
|
<< "Attempted assignment to self"
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
@ -23,19 +23,19 @@ License
|
|||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::className
|
Foam::CLASSNAME
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
classNameI.H
|
CLASSNAMEI.H
|
||||||
className.C
|
CLASSNAME.C
|
||||||
classNameIO.C
|
CLASSNAMEIO.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef className_H
|
#ifndef CLASSNAME_H
|
||||||
#define className_H
|
#define CLASSNAME_H
|
||||||
|
|
||||||
#include ".H"
|
#include ".H"
|
||||||
|
|
||||||
@ -49,16 +49,16 @@ class Istream;
|
|||||||
class Ostream;
|
class Ostream;
|
||||||
|
|
||||||
// Forward declaration of friend functions and operators
|
// Forward declaration of friend functions and operators
|
||||||
class className;
|
class CLASSNAME;
|
||||||
Istream& operator>>(Istream&, className&);
|
Istream& operator>>(Istream&, CLASSNAME&);
|
||||||
Ostream& operator<<(Ostream&, const className&);
|
Ostream& operator<<(Ostream&, const CLASSNAME&);
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class className Declaration
|
Class CLASSNAME Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class className
|
class CLASSNAME
|
||||||
:
|
:
|
||||||
public baseClassName
|
public baseClassName
|
||||||
{
|
{
|
||||||
@ -71,10 +71,10 @@ class className
|
|||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
className(const className&);
|
CLASSNAME(const CLASSNAME&);
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
void operator=(const className&);
|
void operator=(const CLASSNAME&);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -88,26 +88,26 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Construct null
|
||||||
className();
|
CLASSNAME();
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
className(const dataType& data);
|
CLASSNAME(const dataType& data);
|
||||||
|
|
||||||
//- Construct from Istream
|
//- Construct from Istream
|
||||||
className(Istream&);
|
CLASSNAME(Istream&);
|
||||||
|
|
||||||
//- Construct as copy
|
//- Construct as copy
|
||||||
className(const className&);
|
CLASSNAME(const CLASSNAME&);
|
||||||
|
|
||||||
|
|
||||||
// Selectors
|
// Selectors
|
||||||
|
|
||||||
//- Select null constructed
|
//- Select null constructed
|
||||||
static autoPtr<className> New();
|
static autoPtr<CLASSNAME> New();
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
~className();
|
~CLASSNAME();
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
@ -123,7 +123,7 @@ public:
|
|||||||
|
|
||||||
// Member Operators
|
// Member Operators
|
||||||
|
|
||||||
void operator=(const className&);
|
void operator=(const CLASSNAME&);
|
||||||
|
|
||||||
|
|
||||||
// Friend Functions
|
// Friend Functions
|
||||||
@ -132,8 +132,8 @@ public:
|
|||||||
|
|
||||||
// IOstream Operators
|
// IOstream Operators
|
||||||
|
|
||||||
friend Istream& operator>>(Istream&, className&);
|
friend Istream& operator>>(Istream&, CLASSNAME&);
|
||||||
friend Ostream& operator<<(Ostream&, const className&);
|
friend Ostream& operator<<(Ostream&, const CLASSNAME&);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -143,7 +143,7 @@ public:
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#include "classNameI.H"
|
#include "CLASSNAMEI.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ License
|
|||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Application
|
Application
|
||||||
className
|
CLASSNAME
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
|
||||||
@ -24,12 +24,12 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "className.H"
|
#include "CLASSNAME.H"
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::className::className(Istream& is)
|
Foam::CLASSNAME::CLASSNAME(Istream& is)
|
||||||
:
|
:
|
||||||
base1(is),
|
base1(is),
|
||||||
base2(is),
|
base2(is),
|
||||||
@ -37,31 +37,31 @@ Foam::className::className(Istream& is)
|
|||||||
member2(is)
|
member2(is)
|
||||||
{
|
{
|
||||||
// Check state of Istream
|
// Check state of Istream
|
||||||
is.check("Foam::className::className(Foam::Istream&)");
|
is.check("Foam::CLASSNAME::CLASSNAME(Foam::Istream&)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::Istream& Foam::operator>>(Istream& is, className&)
|
Foam::Istream& Foam::operator>>(Istream& is, CLASSNAME&)
|
||||||
{
|
{
|
||||||
// Check state of Istream
|
// Check state of Istream
|
||||||
is.check
|
is.check
|
||||||
(
|
(
|
||||||
"Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::className&)"
|
"Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::CLASSNAME&)"
|
||||||
);
|
);
|
||||||
|
|
||||||
return is;
|
return is;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::Ostream& Foam::operator<<(Ostream& os, const className&)
|
Foam::Ostream& Foam::operator<<(Ostream& os, const CLASSNAME&)
|
||||||
{
|
{
|
||||||
// Check state of Ostream
|
// Check state of Ostream
|
||||||
os.check
|
os.check
|
||||||
(
|
(
|
||||||
"Foam::Ostream& Foam::operator<<(Foam::Ostream&, "
|
"Foam::Ostream& Foam::operator<<(Foam::Ostream&, "
|
||||||
"const Foam::className&)"
|
"const Foam::CLASSNAME&)"
|
||||||
);
|
);
|
||||||
|
|
||||||
return os;
|
return os;
|
||||||
@ -24,18 +24,18 @@
|
|||||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
#
|
#
|
||||||
# Script
|
# Script
|
||||||
# foamNew
|
# foamNewSource
|
||||||
#
|
#
|
||||||
# Description
|
# Description
|
||||||
# Create a new standard OpenFOAM source file
|
# Create a new standard OpenFOAM source file
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
Script=${0##*/}
|
Script=${0##*/}
|
||||||
|
Template="$WM_PROJECT_DIR/bin/templates/source/_Template"
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
||||||
cat<<USAGE
|
cat<<USAGE
|
||||||
|
|
||||||
usage: $Script <type> <class name>
|
usage: $Script <type> <class name>
|
||||||
|
|
||||||
* create a new standard OpenFOAM source file
|
* create a new standard OpenFOAM source file
|
||||||
@ -46,49 +46,56 @@ USAGE
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$#" -ne 2 ]; then
|
|
||||||
usage "wrong number of arguments, expected 2"
|
|
||||||
fi
|
|
||||||
|
|
||||||
unset suffix fileType
|
# this implicitly covers a lone -help
|
||||||
|
[ "$#" -gt 1 ] || usage
|
||||||
|
|
||||||
|
className="$2"
|
||||||
|
unset subType Type
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
-h | -help)
|
||||||
|
usage
|
||||||
|
;;
|
||||||
C|H)
|
C|H)
|
||||||
template=foamTemplate
|
Type=".$1"
|
||||||
fileType=$1
|
|
||||||
;;
|
;;
|
||||||
I)
|
I)
|
||||||
suffix=$1
|
Type="$1.H"
|
||||||
template=foamTemplateI
|
|
||||||
fileType=H
|
|
||||||
;;
|
;;
|
||||||
IO)
|
IO)
|
||||||
suffix=$1
|
Type="$1.C"
|
||||||
template=foamTemplateIO
|
|
||||||
fileType=C
|
|
||||||
;;
|
;;
|
||||||
app|App)
|
app|App)
|
||||||
template=foamAppTemplate
|
subType=App
|
||||||
fileType=C
|
Type=".C"
|
||||||
if [ ! -d Make ]; then
|
|
||||||
echo "foamNew: Creating Make/files and Make/options"
|
|
||||||
wmakeFilesAndOptions
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
usage "unknown type"
|
usage "unknown type"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
[ "$#" -eq 2 ] || usage "wrong number of arguments"
|
||||||
|
shift 2
|
||||||
|
|
||||||
|
|
||||||
fileName=$2$suffix.$fileType
|
fileName="$className$Type"
|
||||||
|
|
||||||
if [ -e "$fileName" ]; then
|
|
||||||
echo "Cannot make $fileName, file exists"
|
echo "$Script: Creating new interface file $fileName"
|
||||||
|
if [ -e "$fileName" ]
|
||||||
|
then
|
||||||
|
echo " Error: file exists"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo $Script: Creating new interface file $fileName
|
|
||||||
sed s/className/$2/g \
|
# process class name
|
||||||
$WM_PROJECT_DIR/bin/foamTemplates/source/$template.$fileType > $fileName
|
sed "s/CLASSNAME/$className/g" $Template$subType$Type > $fileName
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$subType" = App -a ! -d Make ]
|
||||||
|
then
|
||||||
|
wmakeFilesAndOptions
|
||||||
|
fi
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
@ -24,12 +24,12 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "ClassName.H"
|
#include "CLASSNAME.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<TemplateClassArgument>
|
template<TemplateClassArgument>
|
||||||
const dataType Foam::ClassName<TemplateArgument>::staticData();
|
const dataType Foam::CLASSNAME<TemplateArgument>::staticData();
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
|
||||||
@ -38,7 +38,7 @@ const dataType Foam::ClassName<TemplateArgument>::staticData();
|
|||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<TemplateClassArgument>
|
template<TemplateClassArgument>
|
||||||
Foam::ClassName<TemplateArgument>::ClassName()
|
Foam::CLASSNAME<TemplateArgument>::CLASSNAME()
|
||||||
:
|
:
|
||||||
baseClassName(),
|
baseClassName(),
|
||||||
data_()
|
data_()
|
||||||
@ -46,7 +46,7 @@ Foam::ClassName<TemplateArgument>::ClassName()
|
|||||||
|
|
||||||
|
|
||||||
template<TemplateClassArgument>
|
template<TemplateClassArgument>
|
||||||
Foam::ClassName<TemplateArgument>::ClassName(const dataType& data)
|
Foam::CLASSNAME<TemplateArgument>::CLASSNAME(const dataType& data)
|
||||||
:
|
:
|
||||||
baseClassName(),
|
baseClassName(),
|
||||||
data_(data)
|
data_(data)
|
||||||
@ -54,12 +54,12 @@ Foam::ClassName<TemplateArgument>::ClassName(const dataType& data)
|
|||||||
|
|
||||||
|
|
||||||
template<TemplateClassArgument>
|
template<TemplateClassArgument>
|
||||||
Foam::ClassName<TemplateArgument>::ClassName
|
Foam::CLASSNAME<TemplateArgument>::CLASSNAME
|
||||||
(
|
(
|
||||||
const ClassName<TemplateArgument>&
|
const CLASSNAME<TemplateArgument>&
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
baseClassName(),
|
baseCLASSNAME(),
|
||||||
data_()
|
data_()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -67,12 +67,12 @@ Foam::ClassName<TemplateArgument>::ClassName
|
|||||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<TemplateClassArgument>
|
template<TemplateClassArgument>
|
||||||
Foam::autoPtr<Foam::ClassName<TemplateArgument> >
|
Foam::autoPtr<Foam::CLASSNAME<TemplateArgument> >
|
||||||
Foam::ClassName<TemplateArgument>::New()
|
Foam::CLASSNAME<TemplateArgument>::New()
|
||||||
{
|
{
|
||||||
return autoPtr<ClassName<TemplateArgument> >
|
return autoPtr<CLASSNAME<TemplateArgument> >
|
||||||
(
|
(
|
||||||
new ClassName<TemplateArgument>
|
new CLASSNAME<TemplateArgument>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ Foam::ClassName<TemplateArgument>::New()
|
|||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<TemplateClassArgument>
|
template<TemplateClassArgument>
|
||||||
Foam::ClassName<TemplateArgument>::~ClassName()
|
Foam::CLASSNAME<TemplateArgument>::~CLASSNAME()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -96,9 +96,9 @@ Foam::ClassName<TemplateArgument>::~ClassName()
|
|||||||
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<TemplateClassArgument>
|
template<TemplateClassArgument>
|
||||||
void Foam::ClassName<TemplateArgument>::operator=
|
void Foam::CLASSNAME<TemplateArgument>::operator=
|
||||||
(
|
(
|
||||||
const ClassName<TemplateArgument>& rhs
|
const CLASSNAME<TemplateArgument>& rhs
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Check for assignment to self
|
// Check for assignment to self
|
||||||
@ -106,8 +106,8 @@ void Foam::ClassName<TemplateArgument>::operator=
|
|||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"Foam::ClassName<TemplateArgument>::operator="
|
"Foam::CLASSNAME<TemplateArgument>::operator="
|
||||||
"(const Foam::ClassName<TemplateArgument>&)"
|
"(const Foam::CLASSNAME<TemplateArgument>&)"
|
||||||
) << "Attempted assignment to self"
|
) << "Attempted assignment to self"
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
@ -23,19 +23,19 @@ License
|
|||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::ClassName
|
Foam::CLASSNAME
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
ClassNameI.H
|
CLASSNAMEI.H
|
||||||
ClassName.C
|
CLASSNAME.C
|
||||||
ClassNameIO.C
|
CLASSNAMEIO.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef ClassName_H
|
#ifndef CLASSNAME_H
|
||||||
#define ClassName_H
|
#define CLASSNAME_H
|
||||||
|
|
||||||
#include ".H"
|
#include ".H"
|
||||||
|
|
||||||
@ -51,21 +51,21 @@ class someClass;
|
|||||||
// Forward declaration of friend functions and operators
|
// Forward declaration of friend functions and operators
|
||||||
|
|
||||||
template<TemplateClassArgument>
|
template<TemplateClassArgument>
|
||||||
class ClassName;
|
class CLASSNAME;
|
||||||
|
|
||||||
template<TemplateClassArgument>
|
template<TemplateClassArgument>
|
||||||
Istream& operator>>(Istream&, ClassName<TemplateArgument>&);
|
Istream& operator>>(Istream&, CLASSNAME<TemplateArgument>&);
|
||||||
|
|
||||||
template<TemplateClassArgument>
|
template<TemplateClassArgument>
|
||||||
Ostream& operator<<(Ostream&, const ClassName<TemplateArgument>&);
|
Ostream& operator<<(Ostream&, const CLASSNAME<TemplateArgument>&);
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class ClassName Declaration
|
Class CLASSNAME Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
template<TemplateClassArgument>
|
template<TemplateClassArgument>
|
||||||
class ClassName
|
class CLASSNAME
|
||||||
:
|
:
|
||||||
public baseClassName
|
public baseClassName
|
||||||
{
|
{
|
||||||
@ -77,10 +77,10 @@ class ClassName
|
|||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
ClassName(const ClassName<TemplateArgument>&);
|
CLASSNAME(const CLASSNAME<TemplateArgument>&);
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
void operator=(const ClassName<TemplateArgument>&);
|
void operator=(const CLASSNAME<TemplateArgument>&);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -94,33 +94,33 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Construct null
|
||||||
ClassName();
|
CLASSNAME();
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
ClassName(const dataType& data);
|
CLASSNAME(const dataType& data);
|
||||||
|
|
||||||
//- Construct from Istream
|
//- Construct from Istream
|
||||||
ClassName(Istream&);
|
CLASSNAME(Istream&);
|
||||||
|
|
||||||
//- Construct as copy
|
//- Construct as copy
|
||||||
ClassName(const ClassName<TemplateArgument>&);
|
CLASSNAME(const CLASSNAME<TemplateArgument>&);
|
||||||
|
|
||||||
|
|
||||||
// Selectors
|
// Selectors
|
||||||
|
|
||||||
//- Select null constructed
|
//- Select null constructed
|
||||||
static autoPtr<ClassName<TemplateArgument> > New();
|
static autoPtr<CLASSNAME<TemplateArgument> > New();
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
~ClassName();
|
~CLASSNAME();
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
// Member Operators
|
// Member Operators
|
||||||
|
|
||||||
void operator=(const ClassName<TemplateArgument>&);
|
void operator=(const CLASSNAME<TemplateArgument>&);
|
||||||
|
|
||||||
|
|
||||||
// Friend Functions
|
// Friend Functions
|
||||||
@ -130,10 +130,10 @@ public:
|
|||||||
// IOstream Operators
|
// IOstream Operators
|
||||||
|
|
||||||
friend Istream& operator>> <TemplateArgument>
|
friend Istream& operator>> <TemplateArgument>
|
||||||
(Istream&, ClassName<TemplateArgument>&);
|
(Istream&, CLASSNAME<TemplateArgument>&);
|
||||||
|
|
||||||
friend Ostream& operator<< <TemplateArgument>
|
friend Ostream& operator<< <TemplateArgument>
|
||||||
(Ostream&, const ClassName<TemplateArgument>&);
|
(Ostream&, const CLASSNAME<TemplateArgument>&);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -143,12 +143,12 @@ public:
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#include "ClassNameI.H"
|
#include "CLASSNAMEI.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#ifdef NoRepository
|
#ifdef NoRepository
|
||||||
# include "ClassName.C"
|
# include "CLASSNAME.C"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -24,13 +24,13 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "ClassName.H"
|
#include "CLASSNAME.H"
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<TemplateClassArgument>
|
template<TemplateClassArgument>
|
||||||
Foam::ClassName<TemplateArgument>::ClassName(Istream& is)
|
Foam::CLASSNAME<TemplateArgument>::CLASSNAME(Istream& is)
|
||||||
:
|
:
|
||||||
base1(is),
|
base1(is),
|
||||||
base2(is),
|
base2(is),
|
||||||
@ -38,7 +38,7 @@ Foam::ClassName<TemplateArgument>::ClassName(Istream& is)
|
|||||||
member2(is)
|
member2(is)
|
||||||
{
|
{
|
||||||
// Check state of Istream
|
// Check state of Istream
|
||||||
is.check("Foam::ClassName<TemplateArgument>::ClassName(Foam::Istream&)");
|
is.check("Foam::CLASSNAME<TemplateArgument>::CLASSNAME(Foam::Istream&)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -48,14 +48,14 @@ template<TemplateClassArgument>
|
|||||||
Foam::Istream& Foam::operator>>
|
Foam::Istream& Foam::operator>>
|
||||||
(
|
(
|
||||||
Istream& is,
|
Istream& is,
|
||||||
ClassName<TemplateArgument>&
|
CLASSNAME<TemplateArgument>&
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Check state of Istream
|
// Check state of Istream
|
||||||
is.check
|
is.check
|
||||||
(
|
(
|
||||||
"Foam::Istream& Foam::operator>>"
|
"Foam::Istream& Foam::operator>>"
|
||||||
"(Foam::Istream&, Foam::ClassName<TemplateArgument>&)"
|
"(Foam::Istream&, Foam::CLASSNAME<TemplateArgument>&)"
|
||||||
);
|
);
|
||||||
|
|
||||||
return is;
|
return is;
|
||||||
@ -66,14 +66,14 @@ template<TemplateClassArgument>
|
|||||||
Foam::Ostream& Foam::operator<<
|
Foam::Ostream& Foam::operator<<
|
||||||
(
|
(
|
||||||
Ostream& os,
|
Ostream& os,
|
||||||
const ClassName<TemplateArgument>&
|
const CLASSNAME<TemplateArgument>&
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Check state of Ostream
|
// Check state of Ostream
|
||||||
os.check
|
os.check
|
||||||
(
|
(
|
||||||
"Foam::Ostream& Foam::operator<<"
|
"Foam::Ostream& Foam::operator<<"
|
||||||
"(Ostream&, const ClassName<TemplateArgument>&)"
|
"(Ostream&, const CLASSNAME<TemplateArgument>&)"
|
||||||
);
|
);
|
||||||
|
|
||||||
return os;
|
return os;
|
||||||
@ -24,13 +24,14 @@
|
|||||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
#
|
#
|
||||||
# Script
|
# Script
|
||||||
# newSourceTemplate
|
# foamNewTemplate
|
||||||
#
|
#
|
||||||
# Description
|
# Description
|
||||||
# Create a new standard OpenFOAM templated source file
|
# Create a new standard OpenFOAM templated source file
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
Script=${0##*/}
|
Script=${0##*/}
|
||||||
|
Template="$WM_PROJECT_DIR/bin/templates/sourceTemplate/_TemplateTemplate"
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
||||||
@ -46,51 +47,50 @@ USAGE
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$#" -le 2 ]; then
|
# this implicitly covers a lone -help
|
||||||
usage "wrong number of arguments, expected 3 (or more)"
|
[ "$#" -gt 1 ] || usage
|
||||||
fi
|
|
||||||
|
|
||||||
|
className="$2"
|
||||||
|
unset Type
|
||||||
|
|
||||||
unset suffix fileType
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
-h | -help)
|
||||||
|
usage
|
||||||
|
;;
|
||||||
C|H)
|
C|H)
|
||||||
Template=Template
|
Type=".$1"
|
||||||
fileType=$1
|
|
||||||
className=$2
|
|
||||||
;;
|
;;
|
||||||
I)
|
I)
|
||||||
suffix=$1
|
Type="$1.H"
|
||||||
Template=TemplateI
|
|
||||||
fileType=H
|
|
||||||
className=$2
|
|
||||||
;;
|
;;
|
||||||
IO)
|
IO)
|
||||||
suffix=$1
|
Type="$1.C"
|
||||||
Template=TemplateIO
|
|
||||||
fileType=C
|
|
||||||
className=$2
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
usage "unknown type"
|
usage "unknown type"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
[ "$#" -ge 3 ] || usage "wrong number of arguments"
|
||||||
|
shift 2
|
||||||
|
|
||||||
|
fileName="$className$Type"
|
||||||
|
|
||||||
|
|
||||||
fileName=$className$suffix.$fileType
|
echo "$Script: Creating new template interface file $fileName"
|
||||||
|
if [ -e "$fileName" ]
|
||||||
if [ -e "$fileName" ]; then
|
then
|
||||||
echo "Cannot make $fileName, file exists"
|
echo " Error: file exists"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
shift 2
|
|
||||||
echo "$Script: Creating new interface file $fileName"
|
|
||||||
|
|
||||||
# process class name
|
# process class name
|
||||||
sed -e "s/ClassName/$className/g" \
|
sed -e "s/CLASSNAME/$className/g" $Template$Type > $fileName.1
|
||||||
$WM_PROJECT_DIR/bin/foamTemplates/sourceTemplate/foamTemplate$Template.$fileType > $fileName.1
|
|
||||||
|
|
||||||
# process template arguments
|
# process template arguments
|
||||||
for tArg in $*
|
for tArg
|
||||||
do
|
do
|
||||||
sed -e "s/TemplateClassArgument/class $tArg, TemplateClassArgument/g" \
|
sed -e "s/TemplateClassArgument/class $tArg, TemplateClassArgument/g" \
|
||||||
-e "s/TemplateArgument/$tArg, TemplateArgument/g" \
|
-e "s/TemplateArgument/$tArg, TemplateArgument/g" \
|
||||||
@ -99,7 +99,8 @@ do
|
|||||||
mv $fileName.2 $fileName.1
|
mv $fileName.2 $fileName.1
|
||||||
done
|
done
|
||||||
|
|
||||||
# remove remaining ", Template argument"
|
|
||||||
|
# remove remaining ", Template .."
|
||||||
sed -e "s/, TemplateClassArgument//g" \
|
sed -e "s/, TemplateClassArgument//g" \
|
||||||
-e "s/, TemplateArgument//g" \
|
-e "s/, TemplateArgument//g" \
|
||||||
$fileName.1 > $fileName
|
$fileName.1 > $fileName
|
||||||
@ -22,11 +22,11 @@
|
|||||||
# along with OpenFOAM; if not, write to the Free Software Foundation,
|
# along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
#
|
#
|
||||||
# Script
|
# File
|
||||||
# Makefile
|
# Makefile
|
||||||
#
|
#
|
||||||
# Description
|
# Description
|
||||||
# Generic Makefile used by wmake
|
# A generic Makefile, used by wmake
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
# along with OpenFOAM; if not, write to the Free Software Foundation,
|
# along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
#
|
#
|
||||||
# Script
|
# File
|
||||||
# MakefileApps
|
# MakefileApps
|
||||||
#
|
#
|
||||||
# Description
|
# Description
|
||||||
|
|||||||
@ -22,11 +22,11 @@
|
|||||||
# along with OpenFOAM; if not, write to the Free Software Foundation,
|
# along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
#
|
#
|
||||||
# Script
|
# File
|
||||||
# MakefileFiles
|
# MakefileFiles
|
||||||
#
|
#
|
||||||
# Description
|
# Description
|
||||||
# General, easy to use make system for multi-platform development.
|
# A Makefile for the 'files', used by wmake
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ include $(RULES)/general
|
|||||||
include $(OBJECTS_DIR)/options
|
include $(OBJECTS_DIR)/options
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# declare names of make system control files derived from file files
|
# declare names of make system control files derived from file 'files'
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
FILES = $(WM_OPTIONS)/files
|
FILES = $(WM_OPTIONS)/files
|
||||||
@ -51,7 +51,7 @@ DFILES = $(WM_OPTIONS)/dependencyFiles
|
|||||||
IFILES = $(WM_OPTIONS)/includeDeps
|
IFILES = $(WM_OPTIONS)/includeDeps
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# Declare dependecy of all make system files on FILE
|
# Declare dependecy of all make system files on FILES
|
||||||
# Causes all derived files to be remade if any are changed or missing
|
# Causes all derived files to be remade if any are changed or missing
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@ -22,11 +22,11 @@
|
|||||||
# along with OpenFOAM; if not, write to the Free Software Foundation,
|
# along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
#
|
#
|
||||||
# Script
|
# File
|
||||||
# MakefileOptions
|
# MakefileOptions
|
||||||
#
|
#
|
||||||
# Description
|
# Description
|
||||||
# General, easy to use make system for multi-platform development.
|
# A Makefile for the 'options', used by wmake
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -37,13 +37,13 @@ include $(GENERAL_RULES)/general
|
|||||||
include $(RULES)/general
|
include $(RULES)/general
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# declare names of make system control files derived from file files
|
# declare names of make system control files derived from file 'options'
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
OPTIONS = $(WM_OPTIONS)/options
|
OPTIONS = $(WM_OPTIONS)/options
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# Declare dependency of all make system files on FILE
|
# Declare dependency of all make system files on OPTIONS
|
||||||
# Causes all derived files to be remade if any are changed or missing
|
# Causes all derived files to be remade if any are changed or missing
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@ -55,12 +55,12 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
[ -e Make/files ] || {
|
[ -e Make/files ] || {
|
||||||
echo "$Script: Creating files"
|
echo "$Script: Creating Make/files"
|
||||||
$WM_DIR/scripts/makeFiles
|
$WM_DIR/scripts/makeFiles
|
||||||
}
|
}
|
||||||
|
|
||||||
[ -e Make/options ] || {
|
[ -e Make/options ] || {
|
||||||
echo "$Script: Creating options"
|
echo "$Script: Creating Make/options"
|
||||||
$WM_DIR/scripts/makeOptions
|
$WM_DIR/scripts/makeOptions
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user