mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
cellModeller - cosmetics
This commit is contained in:
@ -289,7 +289,6 @@ $(tetCell)/tetCell.C
|
|||||||
|
|
||||||
cellModeller = $(meshShapes)/cellModeller
|
cellModeller = $(meshShapes)/cellModeller
|
||||||
$(cellModeller)/cellModeller.C
|
$(cellModeller)/cellModeller.C
|
||||||
$(cellModeller)/cellModellerIO.C
|
|
||||||
|
|
||||||
cellModel = $(meshShapes)/cellModel
|
cellModel = $(meshShapes)/cellModel
|
||||||
$(cellModel)/cellModel.C
|
$(cellModel)/cellModel.C
|
||||||
|
|||||||
@ -27,14 +27,9 @@ License
|
|||||||
#include "cellModel.H"
|
#include "cellModel.H"
|
||||||
#include "pyramid.H"
|
#include "pyramid.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
vector cellModel::centre
|
Foam::vector Foam::cellModel::centre
|
||||||
(
|
(
|
||||||
const labelList& pointLabels,
|
const labelList& pointLabels,
|
||||||
const pointField& points
|
const pointField& points
|
||||||
@ -91,7 +86,7 @@ vector cellModel::centre
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
scalar cellModel::mag
|
Foam::scalar Foam::cellModel::mag
|
||||||
(
|
(
|
||||||
const labelList& pointLabels,
|
const labelList& pointLabels,
|
||||||
const pointField& points
|
const pointField& points
|
||||||
@ -143,9 +138,4 @@ scalar cellModel::mag
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -29,12 +29,58 @@ Description
|
|||||||
|
|
||||||
#include "cellModeller.H"
|
#include "cellModeller.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
Foam::cellModeller::cellModeller()
|
||||||
{
|
{
|
||||||
|
if (modelPtrs_.size())
|
||||||
|
{
|
||||||
|
FatalErrorIn("cellModeller::cellModeller(const fileName&)")
|
||||||
|
<< "attempt to re-construct cellModeller when it already exists"
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
cellModeller::~cellModeller()
|
label maxIndex = 0;
|
||||||
|
forAll(models_, i)
|
||||||
|
{
|
||||||
|
if (models_[i].index() > maxIndex) maxIndex = models_[i].index();
|
||||||
|
}
|
||||||
|
|
||||||
|
modelPtrs_.setSize(maxIndex + 1);
|
||||||
|
modelPtrs_ = NULL;
|
||||||
|
|
||||||
|
// For all the words in the wordlist, set the details of the model
|
||||||
|
// to those specified by the word name and the other parameters
|
||||||
|
// given. This should result in an automatic 'read' of the model
|
||||||
|
// from its File (see cellModel class).
|
||||||
|
forAll(models_, i)
|
||||||
|
{
|
||||||
|
if (modelPtrs_[models_[i].index()])
|
||||||
|
{
|
||||||
|
FatalErrorIn("cellModeller::cellModeller(const fileName&)")
|
||||||
|
<< "more than one model share the index "
|
||||||
|
<< models_[i].index()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
modelPtrs_[models_[i].index()] = &models_[i];
|
||||||
|
|
||||||
|
if (modelDictionary_.found(models_[i].name()))
|
||||||
|
{
|
||||||
|
FatalErrorIn("cellModeller::cellModeller(const fileName&)")
|
||||||
|
<< "more than one model share the name "
|
||||||
|
<< models_[i].name()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
modelDictionary_.insert(models_[i].name(), &models_[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::cellModeller::~cellModeller()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -43,9 +89,9 @@ cellModeller::~cellModeller()
|
|||||||
// Returns a pointer to a model which matches the string symbol
|
// Returns a pointer to a model which matches the string symbol
|
||||||
// supplied. A null pointer is returned if there is no suitable match.
|
// supplied. A null pointer is returned if there is no suitable match.
|
||||||
|
|
||||||
const cellModel* cellModeller::lookup(const word& symbol)
|
const Foam::cellModel* Foam::cellModeller::lookup(const word& name)
|
||||||
{
|
{
|
||||||
HashTable<const cellModel*>::iterator iter = modelDictionary_.find(symbol);
|
HashTable<const cellModel*>::iterator iter = modelDictionary_.find(name);
|
||||||
|
|
||||||
if (iter != modelDictionary_.end())
|
if (iter != modelDictionary_.end())
|
||||||
{
|
{
|
||||||
@ -57,9 +103,7 @@ const cellModel* cellModeller::lookup(const word& symbol)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -48,7 +48,7 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class cellModeller Declaration
|
Class cellModeller Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class cellModeller
|
class cellModeller
|
||||||
@ -69,10 +69,9 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct given file name
|
//- Construct from central "cellModels" file
|
||||||
cellModeller();
|
cellModeller();
|
||||||
|
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
|
|
||||||
~cellModeller();
|
~cellModeller();
|
||||||
@ -80,12 +79,10 @@ public:
|
|||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
|
|
||||||
//- Look up a model given name and return ptr to model if good
|
//- Look up a model by name and return a pointer to the model or NULL
|
||||||
// else zero
|
|
||||||
static const cellModel* lookup(const word&);
|
static const cellModel* lookup(const word&);
|
||||||
|
|
||||||
//- Look up a model given label and return ptr to model if good
|
//- Look up a model by index and return a pointer to the model or NULL
|
||||||
// else zero
|
|
||||||
static const cellModel* lookup(const label i)
|
static const cellModel* lookup(const label i)
|
||||||
{
|
{
|
||||||
return modelPtrs_[i];
|
return modelPtrs_[i];
|
||||||
|
|||||||
@ -1,91 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 1991-2008 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
|
|
||||||
|
|
||||||
Description
|
|
||||||
Reads the data portion of a model catalogue File.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "cellModeller.H"
|
|
||||||
#include "dictionary.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
cellModeller::cellModeller()
|
|
||||||
{
|
|
||||||
if (modelPtrs_.size())
|
|
||||||
{
|
|
||||||
FatalErrorIn("cellModeller::cellModeller(const fileName&)")
|
|
||||||
<< "attempt to re-construct cellModeller when it already exists"
|
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
label maxIndex = 0;
|
|
||||||
forAll(models_, i)
|
|
||||||
{
|
|
||||||
if (models_[i].index() > maxIndex) maxIndex = models_[i].index();
|
|
||||||
}
|
|
||||||
|
|
||||||
modelPtrs_.setSize(maxIndex + 1);
|
|
||||||
modelPtrs_ = NULL;
|
|
||||||
|
|
||||||
// For all the words in the wordlist, set the details of the model
|
|
||||||
// to those specified by the word name and the other parameters
|
|
||||||
// given. This should result in an automatic 'read' of the model
|
|
||||||
// from its File (see cellModel class).
|
|
||||||
forAll(models_, i)
|
|
||||||
{
|
|
||||||
if (modelPtrs_[models_[i].index()])
|
|
||||||
{
|
|
||||||
FatalErrorIn("cellModeller::cellModeller(const fileName&)")
|
|
||||||
<< "more than one model share the index "
|
|
||||||
<< models_[i].index()
|
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
modelPtrs_[models_[i].index()] = &models_[i];
|
|
||||||
|
|
||||||
if (modelDictionary_.found(models_[i].name()))
|
|
||||||
{
|
|
||||||
FatalErrorIn("cellModeller::cellModeller(const fileName&)")
|
|
||||||
<< "more than one model share the name "
|
|
||||||
<< models_[i].name()
|
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
modelDictionary_.insert(models_[i].name(), &models_[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -23,6 +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
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
cellModeller global initializations
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
@ -30,24 +31,25 @@ Description
|
|||||||
#include "OSspecific.H"
|
#include "OSspecific.H"
|
||||||
#include "IFstream.H"
|
#include "IFstream.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Static data * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Static data * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
// PtrList of models
|
// PtrList of models
|
||||||
PtrList<cellModel> cellModeller::models_
|
Foam::PtrList<Foam::cellModel> Foam::cellModeller::models_
|
||||||
(
|
(
|
||||||
IFstream(findEtcFile("cellModels", true))()
|
IFstream(findEtcFile("cellModels", true))()
|
||||||
);
|
);
|
||||||
|
|
||||||
// List of model pointers
|
// List of model pointers
|
||||||
List<cellModel*> cellModeller::modelPtrs_;
|
Foam::List<Foam::cellModel*> Foam::cellModeller::modelPtrs_;
|
||||||
|
|
||||||
// HashTable of model pointers
|
// HashTable of model pointers
|
||||||
HashTable<const cellModel*> cellModeller::modelDictionary_;
|
Foam::HashTable<const Foam::cellModel*> Foam::cellModeller::modelDictionary_;
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
// Construct a dummy cellModeller which reads the models and fills
|
// Construct a dummy cellModeller which reads the models and fills
|
||||||
// the above tables
|
// the above tables
|
||||||
|
|||||||
Reference in New Issue
Block a user