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:
parent
270f14f644
commit
e211ff7dab
15
bin/foamNew
15
bin/foamNew
@ -33,7 +33,6 @@
|
||||
usage() {
|
||||
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
||||
cat<<USAGE
|
||||
|
||||
usage: ${0##*/} <type> {args}
|
||||
|
||||
* create a new standard OpenFOAM source or template file
|
||||
@ -44,22 +43,18 @@ USAGE
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ "$#" -lt 2 ]
|
||||
then
|
||||
usage "wrong number of arguments, expected 2 (or more)"
|
||||
fi
|
||||
|
||||
# this implicitly covers a lone -help, but let other scripts handle the rest
|
||||
[ "$#" -gt 1 ] || usage
|
||||
|
||||
case "$1" in
|
||||
-h | -help)
|
||||
usage
|
||||
;;
|
||||
source)
|
||||
shift
|
||||
$WM_PROJECT_DIR/bin/foamTemplates/source/newSource $*
|
||||
$WM_PROJECT_DIR/bin/templates/source/foamNewSource $*
|
||||
;;
|
||||
template)
|
||||
shift
|
||||
$WM_PROJECT_DIR/bin/foamTemplates/sourceTemplate/newSourceTemplate $*
|
||||
$WM_PROJECT_DIR/bin/templates/sourceTemplate/foamNewTemplate $*
|
||||
;;
|
||||
*)
|
||||
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 * * * * * * * * * * * * * //
|
||||
|
||||
const dataType Foam::className::staticData();
|
||||
const dataType Foam::CLASSNAME::staticData();
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
@ -42,21 +42,21 @@ const dataType Foam::className::staticData();
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::className::className()
|
||||
Foam::CLASSNAME::CLASSNAME()
|
||||
:
|
||||
baseClassName(),
|
||||
data_()
|
||||
{}
|
||||
|
||||
|
||||
Foam::className::className(const dataType& data)
|
||||
Foam::CLASSNAME::CLASSNAME(const dataType& data)
|
||||
:
|
||||
baseClassName(),
|
||||
data_(data)
|
||||
{}
|
||||
|
||||
|
||||
Foam::className::className(const className&)
|
||||
Foam::CLASSNAME::CLASSNAME(const CLASSNAME&)
|
||||
:
|
||||
baseClassName(),
|
||||
data_()
|
||||
@ -65,15 +65,15 @@ Foam::className::className(const className&)
|
||||
|
||||
// * * * * * * * * * * * * * * * * 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 * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::className::~className()
|
||||
Foam::CLASSNAME::~CLASSNAME()
|
||||
{}
|
||||
|
||||
|
||||
@ -82,12 +82,12 @@ Foam::className::~className()
|
||||
|
||||
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::className::operator=(const className& rhs)
|
||||
void Foam::CLASSNAME::operator=(const CLASSNAME& rhs)
|
||||
{
|
||||
// Check for assignment to self
|
||||
if (this == &rhs)
|
||||
{
|
||||
FatalErrorIn("Foam::className::operator=(const Foam::className&)")
|
||||
FatalErrorIn("Foam::CLASSNAME::operator=(const Foam::CLASSNAME&)")
|
||||
<< "Attempted assignment to self"
|
||||
<< abort(FatalError);
|
||||
}
|
@ -23,19 +23,19 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::className
|
||||
Foam::CLASSNAME
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
classNameI.H
|
||||
className.C
|
||||
classNameIO.C
|
||||
CLASSNAMEI.H
|
||||
CLASSNAME.C
|
||||
CLASSNAMEIO.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef className_H
|
||||
#define className_H
|
||||
#ifndef CLASSNAME_H
|
||||
#define CLASSNAME_H
|
||||
|
||||
#include ".H"
|
||||
|
||||
@ -49,16 +49,16 @@ class Istream;
|
||||
class Ostream;
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
class className;
|
||||
Istream& operator>>(Istream&, className&);
|
||||
Ostream& operator<<(Ostream&, const className&);
|
||||
class CLASSNAME;
|
||||
Istream& operator>>(Istream&, CLASSNAME&);
|
||||
Ostream& operator<<(Ostream&, const CLASSNAME&);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class className Declaration
|
||||
Class CLASSNAME Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class className
|
||||
class CLASSNAME
|
||||
:
|
||||
public baseClassName
|
||||
{
|
||||
@ -71,10 +71,10 @@ class className
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
className(const className&);
|
||||
CLASSNAME(const CLASSNAME&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const className&);
|
||||
void operator=(const CLASSNAME&);
|
||||
|
||||
|
||||
public:
|
||||
@ -88,26 +88,26 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
className();
|
||||
CLASSNAME();
|
||||
|
||||
//- Construct from components
|
||||
className(const dataType& data);
|
||||
CLASSNAME(const dataType& data);
|
||||
|
||||
//- Construct from Istream
|
||||
className(Istream&);
|
||||
CLASSNAME(Istream&);
|
||||
|
||||
//- Construct as copy
|
||||
className(const className&);
|
||||
CLASSNAME(const CLASSNAME&);
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Select null constructed
|
||||
static autoPtr<className> New();
|
||||
static autoPtr<CLASSNAME> New();
|
||||
|
||||
|
||||
//- Destructor
|
||||
~className();
|
||||
~CLASSNAME();
|
||||
|
||||
|
||||
// Member Functions
|
||||
@ -123,7 +123,7 @@ public:
|
||||
|
||||
// Member Operators
|
||||
|
||||
void operator=(const className&);
|
||||
void operator=(const CLASSNAME&);
|
||||
|
||||
|
||||
// Friend Functions
|
||||
@ -132,8 +132,8 @@ public:
|
||||
|
||||
// IOstream Operators
|
||||
|
||||
friend Istream& operator>>(Istream&, className&);
|
||||
friend Ostream& operator<<(Ostream&, const className&);
|
||||
friend Istream& operator>>(Istream&, 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
|
||||
|
||||
Application
|
||||
className
|
||||
CLASSNAME
|
||||
|
||||
Description
|
||||
|
@ -24,12 +24,12 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "className.H"
|
||||
#include "CLASSNAME.H"
|
||||
#include "IOstreams.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::className::className(Istream& is)
|
||||
Foam::CLASSNAME::CLASSNAME(Istream& is)
|
||||
:
|
||||
base1(is),
|
||||
base2(is),
|
||||
@ -37,31 +37,31 @@ Foam::className::className(Istream& is)
|
||||
member2(is)
|
||||
{
|
||||
// Check state of Istream
|
||||
is.check("Foam::className::className(Foam::Istream&)");
|
||||
is.check("Foam::CLASSNAME::CLASSNAME(Foam::Istream&)");
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
Foam::Istream& Foam::operator>>(Istream& is, className&)
|
||||
Foam::Istream& Foam::operator>>(Istream& is, CLASSNAME&)
|
||||
{
|
||||
// Check state of Istream
|
||||
is.check
|
||||
(
|
||||
"Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::className&)"
|
||||
"Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::CLASSNAME&)"
|
||||
);
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const className&)
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const CLASSNAME&)
|
||||
{
|
||||
// Check state of Ostream
|
||||
os.check
|
||||
(
|
||||
"Foam::Ostream& Foam::operator<<(Foam::Ostream&, "
|
||||
"const Foam::className&)"
|
||||
"const Foam::CLASSNAME&)"
|
||||
);
|
||||
|
||||
return os;
|
@ -24,18 +24,18 @@
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# Script
|
||||
# foamNew
|
||||
# foamNewSource
|
||||
#
|
||||
# Description
|
||||
# Create a new standard OpenFOAM source file
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
Script=${0##*/}
|
||||
Template="$WM_PROJECT_DIR/bin/templates/source/_Template"
|
||||
|
||||
usage() {
|
||||
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
||||
cat<<USAGE
|
||||
|
||||
usage: $Script <type> <class name>
|
||||
|
||||
* create a new standard OpenFOAM source file
|
||||
@ -46,49 +46,56 @@ USAGE
|
||||
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
|
||||
-h | -help)
|
||||
usage
|
||||
;;
|
||||
C|H)
|
||||
template=foamTemplate
|
||||
fileType=$1
|
||||
;;
|
||||
Type=".$1"
|
||||
;;
|
||||
I)
|
||||
suffix=$1
|
||||
template=foamTemplateI
|
||||
fileType=H
|
||||
;;
|
||||
Type="$1.H"
|
||||
;;
|
||||
IO)
|
||||
suffix=$1
|
||||
template=foamTemplateIO
|
||||
fileType=C
|
||||
;;
|
||||
Type="$1.C"
|
||||
;;
|
||||
app|App)
|
||||
template=foamAppTemplate
|
||||
fileType=C
|
||||
if [ ! -d Make ]; then
|
||||
echo "foamNew: Creating Make/files and Make/options"
|
||||
wmakeFilesAndOptions
|
||||
fi
|
||||
;;
|
||||
subType=App
|
||||
Type=".C"
|
||||
;;
|
||||
*)
|
||||
usage "unknown type"
|
||||
;;
|
||||
usage "unknown type"
|
||||
;;
|
||||
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"
|
||||
exit 1
|
||||
|
||||
echo "$Script: Creating new interface file $fileName"
|
||||
if [ -e "$fileName" ]
|
||||
then
|
||||
echo " Error: file exists"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo $Script: Creating new interface file $fileName
|
||||
sed s/className/$2/g \
|
||||
$WM_PROJECT_DIR/bin/foamTemplates/source/$template.$fileType > $fileName
|
||||
|
||||
# process class name
|
||||
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 * * * * * * * * * * * * * //
|
||||
|
||||
template<TemplateClassArgument>
|
||||
const dataType Foam::ClassName<TemplateArgument>::staticData();
|
||||
const dataType Foam::CLASSNAME<TemplateArgument>::staticData();
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
|
||||
@ -38,7 +38,7 @@ const dataType Foam::ClassName<TemplateArgument>::staticData();
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<TemplateClassArgument>
|
||||
Foam::ClassName<TemplateArgument>::ClassName()
|
||||
Foam::CLASSNAME<TemplateArgument>::CLASSNAME()
|
||||
:
|
||||
baseClassName(),
|
||||
data_()
|
||||
@ -46,7 +46,7 @@ Foam::ClassName<TemplateArgument>::ClassName()
|
||||
|
||||
|
||||
template<TemplateClassArgument>
|
||||
Foam::ClassName<TemplateArgument>::ClassName(const dataType& data)
|
||||
Foam::CLASSNAME<TemplateArgument>::CLASSNAME(const dataType& data)
|
||||
:
|
||||
baseClassName(),
|
||||
data_(data)
|
||||
@ -54,12 +54,12 @@ Foam::ClassName<TemplateArgument>::ClassName(const dataType& data)
|
||||
|
||||
|
||||
template<TemplateClassArgument>
|
||||
Foam::ClassName<TemplateArgument>::ClassName
|
||||
Foam::CLASSNAME<TemplateArgument>::CLASSNAME
|
||||
(
|
||||
const ClassName<TemplateArgument>&
|
||||
const CLASSNAME<TemplateArgument>&
|
||||
)
|
||||
:
|
||||
baseClassName(),
|
||||
baseCLASSNAME(),
|
||||
data_()
|
||||
{}
|
||||
|
||||
@ -67,12 +67,12 @@ Foam::ClassName<TemplateArgument>::ClassName
|
||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<TemplateClassArgument>
|
||||
Foam::autoPtr<Foam::ClassName<TemplateArgument> >
|
||||
Foam::ClassName<TemplateArgument>::New()
|
||||
Foam::autoPtr<Foam::CLASSNAME<TemplateArgument> >
|
||||
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 * * * * * * * * * * * * * * * //
|
||||
|
||||
template<TemplateClassArgument>
|
||||
Foam::ClassName<TemplateArgument>::~ClassName()
|
||||
Foam::CLASSNAME<TemplateArgument>::~CLASSNAME()
|
||||
{}
|
||||
|
||||
|
||||
@ -96,9 +96,9 @@ Foam::ClassName<TemplateArgument>::~ClassName()
|
||||
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
|
||||
|
||||
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
|
||||
@ -106,8 +106,8 @@ void Foam::ClassName<TemplateArgument>::operator=
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::ClassName<TemplateArgument>::operator="
|
||||
"(const Foam::ClassName<TemplateArgument>&)"
|
||||
"Foam::CLASSNAME<TemplateArgument>::operator="
|
||||
"(const Foam::CLASSNAME<TemplateArgument>&)"
|
||||
) << "Attempted assignment to self"
|
||||
<< abort(FatalError);
|
||||
}
|
@ -23,19 +23,19 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::ClassName
|
||||
Foam::CLASSNAME
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
ClassNameI.H
|
||||
ClassName.C
|
||||
ClassNameIO.C
|
||||
CLASSNAMEI.H
|
||||
CLASSNAME.C
|
||||
CLASSNAMEIO.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef ClassName_H
|
||||
#define ClassName_H
|
||||
#ifndef CLASSNAME_H
|
||||
#define CLASSNAME_H
|
||||
|
||||
#include ".H"
|
||||
|
||||
@ -51,21 +51,21 @@ class someClass;
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
template<TemplateClassArgument>
|
||||
class ClassName;
|
||||
class CLASSNAME;
|
||||
|
||||
template<TemplateClassArgument>
|
||||
Istream& operator>>(Istream&, ClassName<TemplateArgument>&);
|
||||
Istream& operator>>(Istream&, CLASSNAME<TemplateArgument>&);
|
||||
|
||||
template<TemplateClassArgument>
|
||||
Ostream& operator<<(Ostream&, const ClassName<TemplateArgument>&);
|
||||
Ostream& operator<<(Ostream&, const CLASSNAME<TemplateArgument>&);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class ClassName Declaration
|
||||
Class CLASSNAME Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<TemplateClassArgument>
|
||||
class ClassName
|
||||
class CLASSNAME
|
||||
:
|
||||
public baseClassName
|
||||
{
|
||||
@ -77,10 +77,10 @@ class ClassName
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
ClassName(const ClassName<TemplateArgument>&);
|
||||
CLASSNAME(const CLASSNAME<TemplateArgument>&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const ClassName<TemplateArgument>&);
|
||||
void operator=(const CLASSNAME<TemplateArgument>&);
|
||||
|
||||
|
||||
public:
|
||||
@ -94,33 +94,33 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
ClassName();
|
||||
CLASSNAME();
|
||||
|
||||
//- Construct from components
|
||||
ClassName(const dataType& data);
|
||||
CLASSNAME(const dataType& data);
|
||||
|
||||
//- Construct from Istream
|
||||
ClassName(Istream&);
|
||||
CLASSNAME(Istream&);
|
||||
|
||||
//- Construct as copy
|
||||
ClassName(const ClassName<TemplateArgument>&);
|
||||
CLASSNAME(const CLASSNAME<TemplateArgument>&);
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Select null constructed
|
||||
static autoPtr<ClassName<TemplateArgument> > New();
|
||||
static autoPtr<CLASSNAME<TemplateArgument> > New();
|
||||
|
||||
|
||||
//- Destructor
|
||||
~ClassName();
|
||||
~CLASSNAME();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Member Operators
|
||||
|
||||
void operator=(const ClassName<TemplateArgument>&);
|
||||
void operator=(const CLASSNAME<TemplateArgument>&);
|
||||
|
||||
|
||||
// Friend Functions
|
||||
@ -130,10 +130,10 @@ public:
|
||||
// IOstream Operators
|
||||
|
||||
friend Istream& operator>> <TemplateArgument>
|
||||
(Istream&, ClassName<TemplateArgument>&);
|
||||
(Istream&, CLASSNAME<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
|
||||
# include "ClassName.C"
|
||||
# include "CLASSNAME.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
@ -24,13 +24,13 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "ClassName.H"
|
||||
#include "CLASSNAME.H"
|
||||
#include "IOstreams.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<TemplateClassArgument>
|
||||
Foam::ClassName<TemplateArgument>::ClassName(Istream& is)
|
||||
Foam::CLASSNAME<TemplateArgument>::CLASSNAME(Istream& is)
|
||||
:
|
||||
base1(is),
|
||||
base2(is),
|
||||
@ -38,7 +38,7 @@ Foam::ClassName<TemplateArgument>::ClassName(Istream& is)
|
||||
member2(is)
|
||||
{
|
||||
// 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>>
|
||||
(
|
||||
Istream& is,
|
||||
ClassName<TemplateArgument>&
|
||||
CLASSNAME<TemplateArgument>&
|
||||
)
|
||||
{
|
||||
// Check state of Istream
|
||||
is.check
|
||||
(
|
||||
"Foam::Istream& Foam::operator>>"
|
||||
"(Foam::Istream&, Foam::ClassName<TemplateArgument>&)"
|
||||
"(Foam::Istream&, Foam::CLASSNAME<TemplateArgument>&)"
|
||||
);
|
||||
|
||||
return is;
|
||||
@ -66,14 +66,14 @@ template<TemplateClassArgument>
|
||||
Foam::Ostream& Foam::operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const ClassName<TemplateArgument>&
|
||||
const CLASSNAME<TemplateArgument>&
|
||||
)
|
||||
{
|
||||
// Check state of Ostream
|
||||
os.check
|
||||
(
|
||||
"Foam::Ostream& Foam::operator<<"
|
||||
"(Ostream&, const ClassName<TemplateArgument>&)"
|
||||
"(Ostream&, const CLASSNAME<TemplateArgument>&)"
|
||||
);
|
||||
|
||||
return os;
|
@ -24,13 +24,14 @@
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# Script
|
||||
# newSourceTemplate
|
||||
# foamNewTemplate
|
||||
#
|
||||
# Description
|
||||
# Create a new standard OpenFOAM templated source file
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
Script=${0##*/}
|
||||
Template="$WM_PROJECT_DIR/bin/templates/sourceTemplate/_TemplateTemplate"
|
||||
|
||||
usage() {
|
||||
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
||||
@ -46,51 +47,50 @@ USAGE
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ "$#" -le 2 ]; then
|
||||
usage "wrong number of arguments, expected 3 (or more)"
|
||||
fi
|
||||
# this implicitly covers a lone -help
|
||||
[ "$#" -gt 1 ] || usage
|
||||
|
||||
|
||||
className="$2"
|
||||
unset Type
|
||||
|
||||
unset suffix fileType
|
||||
case "$1" in
|
||||
-h | -help)
|
||||
usage
|
||||
;;
|
||||
C|H)
|
||||
Template=Template
|
||||
fileType=$1
|
||||
className=$2
|
||||
;;
|
||||
Type=".$1"
|
||||
;;
|
||||
I)
|
||||
suffix=$1
|
||||
Template=TemplateI
|
||||
fileType=H
|
||||
className=$2
|
||||
;;
|
||||
Type="$1.H"
|
||||
;;
|
||||
IO)
|
||||
suffix=$1
|
||||
Template=TemplateIO
|
||||
fileType=C
|
||||
className=$2
|
||||
;;
|
||||
Type="$1.C"
|
||||
;;
|
||||
*)
|
||||
usage "unknown type"
|
||||
;;
|
||||
usage "unknown type"
|
||||
;;
|
||||
esac
|
||||
[ "$#" -ge 3 ] || usage "wrong number of arguments"
|
||||
shift 2
|
||||
|
||||
fileName="$className$Type"
|
||||
|
||||
|
||||
fileName=$className$suffix.$fileType
|
||||
|
||||
if [ -e "$fileName" ]; then
|
||||
echo "Cannot make $fileName, file exists"
|
||||
exit 1
|
||||
echo "$Script: Creating new template interface file $fileName"
|
||||
if [ -e "$fileName" ]
|
||||
then
|
||||
echo " Error: file exists"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
shift 2
|
||||
echo "$Script: Creating new interface file $fileName"
|
||||
|
||||
# process class name
|
||||
sed -e "s/ClassName/$className/g" \
|
||||
$WM_PROJECT_DIR/bin/foamTemplates/sourceTemplate/foamTemplate$Template.$fileType > $fileName.1
|
||||
sed -e "s/CLASSNAME/$className/g" $Template$Type > $fileName.1
|
||||
|
||||
|
||||
# process template arguments
|
||||
for tArg in $*
|
||||
for tArg
|
||||
do
|
||||
sed -e "s/TemplateClassArgument/class $tArg, TemplateClassArgument/g" \
|
||||
-e "s/TemplateArgument/$tArg, TemplateArgument/g" \
|
||||
@ -99,7 +99,8 @@ do
|
||||
mv $fileName.2 $fileName.1
|
||||
done
|
||||
|
||||
# remove remaining ", Template argument"
|
||||
|
||||
# remove remaining ", Template .."
|
||||
sed -e "s/, TemplateClassArgument//g" \
|
||||
-e "s/, TemplateArgument//g" \
|
||||
$fileName.1 > $fileName
|
@ -22,11 +22,11 @@
|
||||
# along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# Script
|
||||
# File
|
||||
# Makefile
|
||||
#
|
||||
# Description
|
||||
# Generic Makefile used by wmake
|
||||
# A generic Makefile, used by wmake
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
|
@ -22,11 +22,11 @@
|
||||
# along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# Script
|
||||
# File
|
||||
# MakefileApps
|
||||
#
|
||||
# Description
|
||||
# Makefile used by
|
||||
# Makefile used by
|
||||
# wmake all
|
||||
# to make the applications in the subdirectories of the current directory
|
||||
#
|
||||
|
@ -22,11 +22,11 @@
|
||||
# along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# Script
|
||||
# File
|
||||
# MakefileFiles
|
||||
#
|
||||
# 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
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# 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
|
||||
@ -51,7 +51,7 @@ DFILES = $(WM_OPTIONS)/dependencyFiles
|
||||
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
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
|
@ -22,11 +22,11 @@
|
||||
# along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# Script
|
||||
# File
|
||||
# MakefileOptions
|
||||
#
|
||||
# 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
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# 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
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# 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
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
|
@ -55,12 +55,12 @@ else
|
||||
fi
|
||||
|
||||
[ -e Make/files ] || {
|
||||
echo "$Script: Creating files"
|
||||
echo "$Script: Creating Make/files"
|
||||
$WM_DIR/scripts/makeFiles
|
||||
}
|
||||
|
||||
[ -e Make/options ] || {
|
||||
echo "$Script: Creating options"
|
||||
echo "$Script: Creating Make/options"
|
||||
$WM_DIR/scripts/makeOptions
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user