[cig-commits] r9028 - cs/benchmark/cigma/trunk/src
luis at geodynamics.org
luis at geodynamics.org
Mon Jan 14 21:27:48 PST 2008
Author: luis
Date: 2008-01-14 21:27:47 -0800 (Mon, 14 Jan 2008)
New Revision: 9028
Modified:
cs/benchmark/cigma/trunk/src/Quadrature.cpp
cs/benchmark/cigma/trunk/src/Quadrature.h
Log:
Don't need cell private member in quadrature class
Modified: cs/benchmark/cigma/trunk/src/Quadrature.cpp
===================================================================
--- cs/benchmark/cigma/trunk/src/Quadrature.cpp 2008-01-15 05:27:46 UTC (rev 9027)
+++ cs/benchmark/cigma/trunk/src/Quadrature.cpp 2008-01-15 05:27:47 UTC (rev 9028)
@@ -7,111 +7,78 @@
qdim = 0;
qpts = 0;
qwts = 0;
- cell = 0;
}
cigma::Quadrature::~Quadrature()
{
- if (data != 0) delete [] data;
if (qpts != 0) delete [] qpts;
if (qwts != 0) delete [] qwts;
+ if (data != 0) delete [] data;
}
// ---------------------------------------------------------------------------
-void cigma::Quadrature::set_data(Cell *cell, double *quadpts, double *quadwts, int npts)
+void cigma::Quadrature::set_quadrature(double *quadpts, double *quadwts, int npts, int qdim)
{
/* some basic assertions */
- assert(cell != 0);
assert(quadpts != 0);
assert(quadwts != 0);
assert(npts > 0);
+ assert(qdim > 0);
/* clear existing data */
- if (data != 0) delete [] data;
if (qpts != 0) delete [] qpts;
if (qwts != 0) delete [] qwts;
- /* assign cell pointer! */
- this->cell = cell;
-
/* set dimensions */
this->num = npts;
- this->dim = cell->n_celldim();
- this->qdim = cell->n_dim();
+ this->qdim = qdim;
/* allocate new data arrays */
- data = new double[npts * dim];
- qpts = new double[npts * qdim];
- qwts = new double[npts];
+ qpts = new double[num * qdim];
+ qwts = new double[num];
/* copy from quadpts & quadwts */
int i,j;
- for (i = 0; i < npts; i++)
+ for (i = 0; i < num; i++)
{
qwts[i] = quadwts[i];
- for (j = 0; j < dim; j++)
- {
- int n = dim*i + j;
- data[n] = quadpts[n];
- }
for (j = 0; j < qdim; j++)
{
- qpts[qdim*i + j] = 0.0;
+ int n = qdim*i + j;
+ qpts[n] = quadpts[n];
}
}
}
-void cigma::Quadrature::apply_refmap()
+void cigma::Quadrature::set_globaldim(int dim)
{
- assert(cell != 0);
+ assert(num > 0);
+ this->dim = dim;
+ this->data = new double[num * dim];
for (int i = 0; i < num; i++)
{
- cell->uvw2xyz(&data[dim*i], &qpts[qdim*i]);
- }
-}
-
-
-/*
-void cigma::Quadrature::set_quadrature(double *points, double *weights, int npts, int nsd)
-{
- nq = npts;
- dim = nsd;
-
- for (int i = 0; i < nq; i++)
- {
- qwts[i] = weights[i];
-
for (int j = 0; j < dim; j++)
{
- qpts[dim*i + j] = points[dim*i + j];
+ data[dim*i+j] = 0.0;
}
}
}
-void cigma::Quadrature::get_quadrature(double **points, double **weights, int *npts, int *nsd)
+void cigma::Quadrature::apply_refmap(Cell *cell)
{
- double *pts = new double[nq*dim];
- double *wts = new double[nq];
+ assert(cell != 0);
+ assert(data != 0);
- for (int i = 0; i < nq; i++)
+ for (int i = 0; i < num; i++)
{
- wts[i] = qwts[i];
-
- for (int j = 0; j < dim; j++)
- {
- pts[dim*i+j] = qpts[dim*i+j];
- }
+ double *uvw = &qpts[qdim*i];
+ double *xyz = &data[dim*i];
+ cell->uvw2xyz(uvw, xyz);
}
-
- *points = pts;
- *weights = wts;
- *npts = nq;
- *nsd = dim;
}
-*/
// ---------------------------------------------------------------------------
Modified: cs/benchmark/cigma/trunk/src/Quadrature.h
===================================================================
--- cs/benchmark/cigma/trunk/src/Quadrature.h 2008-01-15 05:27:46 UTC (rev 9027)
+++ cs/benchmark/cigma/trunk/src/Quadrature.h 2008-01-15 05:27:47 UTC (rev 9028)
@@ -21,21 +21,19 @@
~Quadrature();
public:
- void set_data(Cell *cell, double *quadpts, double *quadwts, int npts);
+ void set_quadrature(double *quadpts, double *quadwts, int npts, int qdim);
+ void set_globaldim(int dim);
+ void apply_refmap(Cell *cell);
public:
- void apply_refmap();
-
-public:
int n_refdim() const;
int n_globaldim() const;
public:
- int global_index(int i, int j) const;
- double global_value(int i, int j) const;
+ double point(int i, int j) const;
+ double weight(int i) const;
public:
- Cell *cell;
int qdim;
double *qpts;
double *qwts;
@@ -46,22 +44,22 @@
inline int cigma::Quadrature::n_refdim() const
{
- return dim;
+ return qdim;
}
inline int cigma::Quadrature::n_globaldim() const
{
- return qdim;
+ return dim;
}
-inline int cigma::Quadrature::global_index(int i, int j) const
+inline double cigma::Quadrature::point(int i, int j) const
{
- return qdim*i + j;
+ return qpts[qdim*i + j];
}
-inline double cigma::Quadrature::global_value(int i, int j) const
+inline double cigma::Quadrature::weight(int i) const
{
- return qpts[global_index(i,j)];
+ return qwts[i];
}
// ---------------------------------------------------------------------------
More information about the cig-commits
mailing list