freepooma-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pooma-dev] Re: Ref counting


From: Nils H. Busch
Subject: Re: [pooma-dev] Re: Ref counting
Date: Fri, 19 Apr 2002 14:19:35 +0200

Hi,

below is the small program that causes the assertion failure

### POOMA Assertion Failure ###
### initialized()
### File
/home/elster1/busch/local/pooma/sgi64/src/Geometry/RectilinearGeometryBase.h;
Line 218.
Pooma::pAbort called.
In default abort handler.
Abort (core dumped) .

As I found out the problem lies not with returning a field/array, but
with creating a C array of pooma arrays or fields. It doesn't make any
difference whether it's allocated on the stack or on the heap. The
assertion comes from the Field::operator=() call and the underlying
assign.

I might be doing something stupid,  but it looks like vaild C++ code to
me.

The program:

#include <iostream>
//#include "Pooma/Arrays.h"
#include "Pooma/Fields.h"

const int Dim = 1;

// typedefs
typedef UniformRectilinearMesh<Dim, Cartesian<Dim>, double> Mesh_t;
typedef DiscreteGeometry<Vert, Mesh_t> Geometry_t;
typedef MultiPatch<UniformTag, Brick> Engine_t;
typedef Field<Geometry_t, double, Engine_t> Field_t;


// main
int main(int argc, char *argv[])
{
    Pooma::initialize(argc,argv);

    Interval<Dim> dom(10);
    Mesh_t::PointType_t origin(0.0);
    Mesh_t::PointType_t spacings(1.0);
    Mesh_t mesh(dom, origin, spacings);

    Geometry_t geom(mesh);

    UniformGridLayout<Dim> layout(geom.totalDomain(), ReplicatedTag());

    Field_t a[2];
    a[0] = Field_t(geom, layout);
    a[1] = Field_t(geom, layout);

    a[0] = 3;
    a[1] = a[0];

    std::cout << a[0] << std::endl << a[1] << std::endl;

    Pooma::finalize();

    return 0;

}

The dbx output:

>  0 _kill(0xf861, 0x6, 0x0, 0x0, 0x1, 0x2, 0xffffffa770, 0x0)
["/xlv51/6.5.5f/work/irix/lib/libc/libc_64_M4/signal/kill.s":15,
0xda5cc98]
   1 _raise(0xf861, 0x6, 0x0, 0x0, 0x1, 0x2, 0xffffffa770, 0x0)
["/xlv51/6.5.5f/work/irix/lib/libc/libc_64_M4/signal/raise.c":27,
0xda5d664]
   2 abort(0xf861, 0x6, 0x0, 0x0, 0x1, 0x2, 0xffffffa770, 0x0)
["/xlv51/6.5.5f/work/irix/lib/libc/libc_64_M4/gen/abort.c":52,
0xd9cd0e0]
   3 Pooma::toss_cookies(const char*,const char*,int ...)(0xf861, 0x1,
0xda00000000, 0x0, 0x8, 0xffffffad40, 0x10044f50, 0xffffffad40)
["/scr/origin3/nilsb/apps/pooma-2.3.0/src/IO/Serializers.cmpl.cpp":498,
0xdffbcb6c]
   4 ::RectilinearGeometryBase<Vert,UniformRectilinearMesh<(const
int)1,Cartesian<(const int)1>,double> >::physicalDomain(void) const(this
= 0xffffffac98, <no name> = 0xffffffa9f0)
["/home/elster1/busch/local/pooma/sgi64/src/Geometry/RectilinearGeometryBase.h":218,
0x10028664]
   5 ::ConstField<DiscreteGeometry<Vert,UniformRectilinearMesh<(const
int)1,Cartesian<(const int)1>,double>
>,double,MultiPatch<UniformTag,Brick> >::physicalDomain(void) const(this
= 0xffffffac38, <no name> = 0xffffffa9f0)
["/home/elster1/busch/local/pooma/sgi64/src/Field/ConstField.h":944,
0x100331d4]
   6 ::Field<DiscreteGeometry<Vert,UniformRectilinearMesh<(const
int)1,Cartesian<(const int)1>,double>
>,double,MultiPatch<UniformTag,Brick> >::operator()(void) const(this =
0xffffffac38, <no name> = 0xffffffaa10)
["/home/elster1/busch/local/pooma/sgi64/src/Field/Field.h":1041,
0x100335b0]
   7 ::assign(const
Field<DiscreteGeometry<Vert,UniformRectilinearMesh<(const
int)1,Cartesian<(const int)1>,double>
>,double,MultiPatch<UniformTag,Brick> >&,const
Field<DiscreteGeometry<Vert,UniformRectilinearMesh<(const
int)1,Cartesian<(const int)1>,double>
>,double,MultiPatch<UniformTag,Brick> >&,const OpAssign&)(lhs =
0xffffffac38, rhs = 0xffffffad28, op = 0xffffffab80)
["/home/elster1/busch/local/pooma/sgi64/src/Field/Field.cpp":236,
0x1001a214]
   8 ::Field<DiscreteGeometry<Vert,UniformRectilinearMesh<(const
int)1,Cartesian<(const int)1>,double>
>,double,MultiPatch<UniformTag,Brick> >::operator=(const
Field<DiscreteGeometry<Vert,UniformRectilinearMesh<(const
int)1,Cartesian<(const int)1>,double>
>,double,MultiPatch<UniformTag,Brick> >&)(this = 0xffffffac38, rhs =
0xffffffad28)
["/home/elster1/busch/local/pooma/sgi64/src/Field/Field.h":1138,
0x10033610]
   9 ::main(argc = 1, argv = 0xffffffae68)
["/home/elster1/busch/prg/pooma/test/fieldtest.cpp":51, 0x1001a034]
   10 __start()
["/xlv55/kudzu-apr12/work/irix/lib/libc/libc_64_M4/csu/crt1text.s":177,
0x10019888]

(dbx) up 4
::RectilinearGeometryBase<Vert,UniformRectilinearMesh<: 218
PAssert(initialized());
(dbx) dump
::RectilinearGeometryBase<Vert,UniformRectilinearMesh<(const
int)1,Cartesian<(const int)1>,double> >::physicalDomain(void) const(this
= 0xffffffac98, <no name> = 0xffffffa9f0)
["/home/elster1/busch/local/pooma/sgi64/src/Geometry/RectilinearGeometryBase.h":218,
0x10028664]

(dbx) up 3
:assign: 236  ViewedLHS_t vlhs = lhs();
(dbx) dump
::assign(const Field<DiscreteGeometry<Vert,UniformRectilinearMesh<(const
int)1,Cartesian<(const int)1>,double>
>,double,MultiPatch<UniformTag,Brick> >&,const
Field<DiscreteGeometry<Vert,UniformRectilinearMesh<(const
int)1,Cartesian<(const int)1>,double>
>,double,MultiPatch<UniformTag,Brick> >&,const OpAssign&)(lhs =
0xffffffac38, rhs = 0xffffffad28, op = 0xffffffab80)
["/home/elster1/busch/local/pooma/sgi64/src/Field/Field.cpp":236,
0x1001a214]
vlhs = class <DiscreteGeometry,double,MultiPatchView> {
}
vrhs = class <DiscreteGeometry,double,MultiPatchView> {
}
rhsExpr = struct <ConstField> {
    reference_m = 0xa
}

(dbx) up 2
::main:  51  a[0] = Field_t(geom, layout);

It seems to me that only a combination of default constructors and then
Field::initialize works and I don't understand why.

Thanks.


--
    Nils H. Busch
    Max-Planck-Institute of Cognitive Neuroscience
    phone:  ++49 (341) 9940-335 fax:  ++49 (341) 9940-204
    e-mail: address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]