CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   check in a uniformInterpolationTable without destroying it (https://www.cfd-online.com/Forums/openfoam-programming-development/131339-check-uniforminterpolationtable-without-destroying.html)

Vesposo March 13, 2014 08:29

check in a uniformInterpolationTable without destroying it
 
Hi,

in the constructor of my boundary condition I'm trying to construct an uniformInterpolationTable and check it into the objectRegistry.

Code:

    myUniformInterpolationTable_
    (
        IOobject
        (
            tableName_,
            this->patch().boundaryMesh().mesh().time().constant(),
            this->patch().boundaryMesh().mesh(),
            IOobject::MUST_READ,
            IOobject::NO_WRITE,
            true
        ),
        true
    )

The problem is, I can't look it up

Code:

const uniformInterpolationTable<scalar>& myTable =
              db().lookupObject<uniformInterpolationTable<scalar> >(tableName_);

results in an error:

Code:

--> FOAM FATAL ERROR:

    request for IOobject myUniformInterpolationTable_ from objectRegistry region0 failed
    available objects of type IOobject are
0()

If I set the debug flag objectRegistry=1, it shows that the regIOobject will be destroyed after constructing and checking in.

Code:

Constructing IOobject called myUniformInterpolationTable_ of type IOobject
objectRegistry::checkIn(regIOobject&) : region0 : checking in myUniformInterpolationTable_
Destroying regIOobject called myUniformInterpolationTable_ of type regIOobject in directory

Is there a way which lets the uniformInterpolationTable accessable?

Thanks

mturcios777 March 13, 2014 13:45

Are you sure you are checking it in to the object registry with the call to this->patch().boundaryMesh().mesh()? Following the function calls seems like you're returning pointers and references. Can you try use a more direct access to mesh and see if it improves things?

Vesposo March 14, 2014 02:38

Quote:

Originally Posted by mturcios777 (Post 479851)
Are you sure you are checking it in to the object registry with the call to this->patch().boundaryMesh().mesh()? Following the function calls seems like you're returning pointers and references. Can you try use a more direct access to mesh and see if it improves things?

Thank you for your answer.

The debug information says

Code:

objectRegistry::checkIn(regIOobject&) : region0 : checking in myUniformInterpolationTable_
So I assume it's checking in.

I don't know how to access it in a more direct way, due to I'm in my boundary condition. Can you give me a hint.

Thanks

mturcios777 March 14, 2014 11:39

If its checking in and then out, then maybe its more the time you are asking it to be created. Try this->db().time().constant(). It seems most boundary conditions use that for finding the time. Similarly, maybe try this->db().mesh().


All times are GMT -4. The time now is 05:05.