sieve-dev IndicesVisitor
Matthew Knepley
knepley at gmail.com
Tue Sep 16 10:29:39 CDT 2008
This is a bug. I pushed the fix.
Thanks,
Matt
On Mon, Sep 15, 2008 at 11:19 PM, Shi Jin <jinzishuai at gmail.com> wrote:
> 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/
>
--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which
their experiments lead.
-- Norbert Wiener
More information about the sieve-dev
mailing list