|
[Sponsors] |
September 6, 2022, 09:30 |
store labelIOField in objectRegistry
|
#1 |
New Member
Join Date: Sep 2022
Posts: 18
Rep Power: 3 |
Hello to all,
I would like to know how to store a labelIOField (IOField<label>) in the object registry so that I can latter use it inside a functionObject. This is to be inserted in the codeRead section of a coded functionObject. Currently I have: Code:
auto tfldPtr = tmp<IOField<label>>::New ( IOobject ( "someName", mesh().time().timeName(), mesh(), IOobject::NO_READ, IOobject::NO_WRITE ), labelList(10,0) ); mesh().objectRegistry::store(tfldPtr); Code:
/usr/lib/openfoam/openfoam2206/src/OpenFOAM/lnInclude/tmpI.H: In instantiation of ‘T* Foam::tmp<T>::ptr() const [with T = Foam::IOField<int>]’: /usr/lib/openfoam/openfoam2206/src/OpenFOAM/lnInclude/regIOobjectI.H:148:11: required from ‘static Type& Foam::regIOobject::store(Foam::tmp<T>&) [with Type = Foam::IOField<int>]’ /home/abc/Desktop/test/system/controlDict.functions.myFunction:135:53: required from here /usr/lib/openfoam/openfoam2206/src/OpenFOAM/lnInclude/tmpI.H:282:18: error: request for member ‘clone’ is ambiguous 282 | return ptr_->clone().ptr(); |
|
September 6, 2022, 10:12 |
|
#2 |
New Member
Join Date: Sep 2022
Posts: 18
Rep Power: 3 |
I think I solved it with:
Code:
const word fieldName = "someName"; if (!foundObject<IOField<label>>(fieldName)) { autoPtr<IOField<label>> tfldPtr ( new IOField<label> ( IOobject ( fieldName, mesh().time().timeName(), mesh(), IOobject::NO_READ, IOobject::NO_WRITE ), labelList(10, 0) ) ); mesh().thisDb().store( tfldPtr ); } Last edited by newGuyAtCFD; September 6, 2022 at 12:45. Reason: Think I found the correct solution |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Question regarding objectRegistry and related subjects. | granzer | OpenFOAM | 0 | March 21, 2020 13:01 |
store and access the value in UDM | serene6390 | Fluent UDF and Scheme Programming | 8 | April 16, 2018 01:21 |
Dynamic Meshing in Store separation | phoenixash11499 | FLUENT | 0 | December 7, 2017 21:59 |
chtMultiRegionSimpleFoam: crash on parallel run | student666 | OpenFOAM Running, Solving & CFD | 3 | April 20, 2017 11:05 |
Surface area of store | bharatesh | CFD Freelancers | 0 | May 29, 2015 01:02 |