sieve-dev IndicesVisitor
Shi Jin
jinzishuai at gmail.com
Mon Sep 15 23:19:04 CDT 2008
Hi there,
I have the following loop:
typedef
ALE::ISieveVisitor::IndicesVisitor<PETSC_MESH_TYPE::real_section_type ,
PETSC_MESH_TYPE::order_type,PetscInt> visitor_type;
int numIndices;
int e=0;
for (PETSC_MESH_TYPE::label_sequence::iterator c_iter = cells->begin();
c_iter
!=cells->end(); ++c_iter, e++)//Loop thru local elements
{
*visitor_type velVisitor(*vel[0], *velGlobalOrder, (int) (pow(
sieve->getMaxConeSize(), m->depth())+1)*m->getMaxDof(),
m->depth() > 1);
visitor_type preVisitor(*p, *preGlobalOrder, (int) (pow(
sieve->getMaxConeSize(), m->depth())+1)*m->getMaxDof(),
m->depth() > 1);*
computeIndicesForCell(e, vel[0], &numIndices, velVisitor);
for (int i=0; i<numIndices; i++)
velCellIndices[e*numIndices+i]=elementIndices[i];
computeIndicesForCell(e, p, &numIndices, preVisitor);
for (int i=0; i<numIndices; i++)
preCellIndices[e*numIndices+i]=elementIndices[i];
}
Where the function computeIndicesForCell() calls the visitor by reference.
I want to take the definitions of the two visitors out of loop since I think
they can be reused. However, if I do that, an exception will be thrown at
void visitPoint(const point_type& point, const int orientation) {
if (p >= size) {
ostringstream msg;
* msg << "Too many points (>" << size << ")for IndicesVisitor
visitor";*
throw ALE::Exception(msg.str().c_str());
}
if (points) {
int pp;
for(pp = 0; pp < p; ++pp) {if (points[pp] == point) break;}
if (pp != p) return;
points[*p++*] = point;
}
...
}
due to too large p value.
I wonder if this is normal. The value of p increments in each call to
visitPoint() and it does not get reset in the clear() call as i does.
Should I just keep the definitions inside the loop? Thanks a lot.
--
Sincerely,
Shi Jin, Ph.D.
http://www.ualberta.ca/~sjin1/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.mcs.anl.gov/mailman/private/sieve-dev/attachments/20080915/eadaa4c2/attachment.htm>
More information about the sieve-dev
mailing list