Commit ef1c1eb3 authored by Bernd Flemisch's avatar Bernd Flemisch
Browse files

implement naming convention numElems, nElems, nElements -> numElements

git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@11595 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent bea99e51
......@@ -215,16 +215,16 @@ public:
reuseMatrix_ = false;
int numVerts = gridView_().size(dim);
int numElems = gridView_().size(0);
int numElements = gridView_().size(0);
residual_.resize(matrix_->N());
totalElems_ = gridView_().comm().sum(numElems);
totalElems_ = gridView_().comm().sum(numElements);
// initialize data needed for partial reassembly
if (enablePartialReassemble) {
vertexColor_.resize(numVerts);
vertexDelta_.resize(numVerts);
elementColor_.resize(numElems);
elementColor_.resize(numElements);
}
reassembleAll();
}
......
......@@ -125,15 +125,15 @@ private:
// Construct the BCRS matrix for the global jacobian
void createMatrix_()
{
int nElems = this->gridView_().size(0);
int numElements = this->gridView_().size(0);
// allocate raw matrix
this->matrix_ = Dune::make_shared<JacobianMatrix>(nElems, nElems, JacobianMatrix::random);
this->matrix_ = Dune::make_shared<JacobianMatrix>(numElements, numElements, JacobianMatrix::random);
// find out the global indices of the neighboring elements of
// each element
typedef std::set<int> NeighborSet;
std::vector<NeighborSet> neighbors(nElems);
std::vector<NeighborSet> neighbors(numElements);
ElementIterator eIt = this->gridView_().template begin<0>();
const ElementIterator eEndIt = this->gridView_().template end<0>();
for (; eIt != eEndIt; ++eIt) {
......@@ -161,14 +161,14 @@ private:
}
// allocate space for the rows of the matrix
for (int i = 0; i < nElems; ++i) {
for (int i = 0; i < numElements; ++i) {
this->matrix_->setrowsize(i, neighbors[i].size());
}
this->matrix_->endrowsizes();
// fill the rows with indices. each element talks to all of its
// neighbors and itself.
for (int i = 0; i < nElems; ++i) {
for (int i = 0; i < numElements; ++i) {
typename NeighborSet::iterator nIt = neighbors[i].begin();
typename NeighborSet::iterator nEndIt = neighbors[i].end();
for (; nIt != nEndIt; ++nIt) {
......
......@@ -124,7 +124,7 @@ public:
reuseMatrix_ = false;
int numVerts = gridView_().size(dim);
int numElems = gridView_().size(0);
int numElements = gridView_().size(0);
int numDofs = problem.model().numDofs();
residual_.resize(numDofs);
......@@ -138,14 +138,14 @@ public:
}
if (gridView_().comm().size() > 1)
totalElems_ = gridView_().comm().sum(numElems);
totalElems_ = gridView_().comm().sum(numElements);
else
totalElems_ = numElems;
totalElems_ = numElements;
// initialize data needed for partial reassembly
if (enablePartialReassemble_()) {
delta_.resize(numDofs);
elementColor_.resize(numElems);
elementColor_.resize(numElements);
if (isBox)
vertexColor_.resize(numVerts);
}
......
......@@ -17,7 +17,7 @@ public:
typedef typename GridView::Traits::template Codim<0>::Entity Element;
typedef typename Element::Geometry Geometry;
static Grid* create(const std::string& dgfName, const Dune::FieldVector<int, dim>& nElements,
static Grid* create(const std::string& dgfName, const Dune::FieldVector<int, dim>& numElements,
const Scalar interfaceY, const Scalar gradingFactor, const bool refineTop = false)
{
typedef Dune::SGrid<dim,dim> HelperGrid;
......@@ -41,8 +41,8 @@ public:
std::cout << "rglobal = " << refinePoint << ", rlocal = " << refinePointLocal << std::endl;
Dune::GridFactory<Grid> factory;
int nX = nElements[0];
int nY = nElements[1];
int nX = numElements[0];
int nY = numElements[1];
std::vector<std::vector<Scalar> > localPositions(dim);
for (int comp = 0; comp < dim; comp++)
......@@ -55,33 +55,33 @@ std::cout << "rglobal = " << refinePoint << ", rlocal = " << refinePointLocal <<
if (lengthLeft < 1e-10)
{
nLeft = 0;
nRight = nElements[comp];
nRight = numElements[comp];
if (gradingFactors[comp] > 1.0)
hLeft = hRight = (1.0 - gradingFactors[comp])/(1.0 - pow(gradingFactors[comp], nRight));
else
hLeft = hRight = 1.0/nElements[comp];
hLeft = hRight = 1.0/numElements[comp];
}
else if (lengthLeft > 1.0 - 1e-10)
{
nLeft = nElements[comp];
nLeft = numElements[comp];
nRight = 0;
if (gradingFactors[comp] > 1.0)
hLeft = hRight = (1.0 - gradingFactors[comp])/(1.0 - pow(gradingFactors[comp], nLeft));
else
hLeft = hRight = 1.0/nElements[comp];
hLeft = hRight = 1.0/numElements[comp];
}
else if (comp == dim - 1 && refineTop)
{
lengthLeft = refinePointLocal[comp];
lengthRight = (1 - refinePointLocal[comp])/2;
nLeft = nRight = nElements[comp]/3;
nLeft = nRight = numElements[comp]/3;
if (nElements[comp]%3 == 1)
if (numElements[comp]%3 == 1)
nLeft += 1;
else if (nElements[comp]%3 == 2)
else if (numElements[comp]%3 == 2)
nRight += 1;
hLeft = lengthLeft*(1.0 - gradingFactors[comp])/(1.0 - pow(gradingFactors[comp], nLeft));
......@@ -89,11 +89,11 @@ std::cout << "rglobal = " << refinePoint << ", rlocal = " << refinePointLocal <<
}
else if (lengthLeft > 0.5)
{
Scalar nLeftDouble = std::ceil(-log((1.0 + sqrt(1.0 + 4.0*pow(gradingFactors[comp], nElements[comp])*lengthRight/lengthLeft))
/(2.0*pow(gradingFactors[comp], nElements[comp])))/log(gradingFactors[comp]));
nLeft = std::min((int)std::ceil(nLeftDouble), nElements[comp]);
Scalar nLeftDouble = std::ceil(-log((1.0 + sqrt(1.0 + 4.0*pow(gradingFactors[comp], numElements[comp])*lengthRight/lengthLeft))
/(2.0*pow(gradingFactors[comp], numElements[comp])))/log(gradingFactors[comp]));
nLeft = std::min((int)std::ceil(nLeftDouble), numElements[comp]);
nRight = nElements[comp] - nLeft;
nRight = numElements[comp] - nLeft;
if (gradingFactors[comp] > 1.0)
{
......@@ -101,15 +101,15 @@ std::cout << "rglobal = " << refinePoint << ", rlocal = " << refinePointLocal <<
hRight = lengthRight*(1.0 - gradingFactors[comp])/(1.0 - pow(gradingFactors[comp], nRight));
}
else
hLeft = hRight = 1.0/nElements[comp];
hLeft = hRight = 1.0/numElements[comp];
}
else
{
Scalar nRightDouble = -log((1.0 + sqrt(1.0 + 4.0*pow(gradingFactors[comp], nElements[comp])*lengthLeft/lengthRight))
/(2.0*pow(gradingFactors[comp], nElements[comp])))/log(gradingFactors[comp]);
nRight = std::min((int)std::ceil(nRightDouble), nElements[comp]);
Scalar nRightDouble = -log((1.0 + sqrt(1.0 + 4.0*pow(gradingFactors[comp], numElements[comp])*lengthLeft/lengthRight))
/(2.0*pow(gradingFactors[comp], numElements[comp])))/log(gradingFactors[comp]);
nRight = std::min((int)std::ceil(nRightDouble), numElements[comp]);
nLeft = nElements[comp] - nRight;
nLeft = numElements[comp] - nRight;
if (gradingFactors[comp] > 1.0)
{
......@@ -117,11 +117,11 @@ std::cout << "rglobal = " << refinePoint << ", rlocal = " << refinePointLocal <<
hRight = lengthRight*(1.0 - gradingFactors[comp])/(1.0 - pow(gradingFactors[comp], nRight));
}
else
hLeft = hRight = 1.0/nElements[comp];
hLeft = hRight = 1.0/numElements[comp];
}
std::cout << "lengthLeft = " << lengthLeft << ", lengthRight = " << lengthRight << ", hLeft = " << hLeft << ", hRight = " << hRight << ", nLeft = " << nLeft << ", nRight = " << nRight << std::endl;
int nVertices = nElements[comp] + 1;
int nVertices = numElements[comp] + 1;
localPositions[comp].resize(nVertices);
localPositions[comp][0] = 0.0;
......
......@@ -143,8 +143,8 @@ public:
void setParams(GridPointer *gridPtr)
{
gridPtr_ = gridPtr;
int numElems = (*gridPtr_)->leafView().size(0);
paramIdx_.resize(numElems);
int numElements = (*gridPtr_)->leafView().size(0);
paramIdx_.resize(numElements);
ElementIterator eIt = (*gridPtr_)->leafView().template begin<0>();
const ElementIterator eEndIt = (*gridPtr_)->leafView().template end<0>();
......
......@@ -229,7 +229,7 @@ int start_(int argc,
std::string dgfFileName;
Scalar dt, tEnd;
Dune::FieldVector<int, dim> nElements;
Dune::FieldVector<int, dim> numElements;
Scalar interfacePos, gradingFactor;
int gridRefinement;
bool useInterfaceMeshCreator;
......@@ -239,9 +239,9 @@ int start_(int argc,
dgfFileName = GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, std::string, Grid, File);
dt = GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, Scalar, TimeManager, DtInitial);
tEnd = GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, Scalar, TimeManager, TEnd);
nElements[0] = GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, int, Grid, CellsX);
if (dim>1) nElements[1] = GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, int, Grid, CellsY);
if (dim==3) nElements[2] = GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, int, Grid, CellsZ);
numElements[0] = GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, int, Grid, CellsX);
if (dim>1) numElements[1] = GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, int, Grid, CellsY);
if (dim==3) numElements[2] = GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, int, Grid, CellsZ);
interfacePos = GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, Scalar, Grid, InterfacePos);
gradingFactor = GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, Scalar, Grid, Grading);
gridRefinement = GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, Scalar, Grid, Refinement);
......@@ -261,7 +261,7 @@ int start_(int argc,
if (useInterfaceMeshCreator)
{
Dumux::InterfaceMeshCreator<Grid> interfaceMeshCreator;
gridPtr = interfaceMeshCreator.create(dgfFileName, nElements, interfacePos, gradingFactor);
gridPtr = interfaceMeshCreator.create(dgfFileName, numElements, interfacePos, gradingFactor);
}
else
gridPtr = GridPointer(dgfFileName);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment