CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   IOField<List<scalar > > (https://www.cfd-online.com/Forums/openfoam/93145-iofield-list-scalar.html)

heavy_user October 6, 2011 06:38

IOField<List<scalar > >
 
Hey Foamers,

i would like to add some information to my particles.
Therefore I added a member "List<scalar> myList" to myparticle class.
So each instance/particle will have that list.
I would like to write out that data so i tried to add that to the mypartticleClassIO.C file.
When I compile I get an error message and im am stuck right now..
Code:

/// in myParticlesClassIO.C
//this one works:
          IOField<scalar> m(c.fieldIOobject("m",IOobject::NO_READ),np);
//this one not:
              IOField<List<scalar > >  myList(c.fieldIOobject("myList",IOobject::NO_READ),np);

And i get the error message:

Code:

/opt/openfoam171/src/OpenFOAM/lnInclude/Field.H:87: error: no type named ‘cmptType’ in ‘class Foam::pTraits<Foam::List<double> >’
So two questions:
1.) How do I add a lot of scalars (lets say 50-100) to my particle class, so that i have proper IO ?
2.) If the answer is list, how do I manage the IO?

Thanks!!

Hisham June 19, 2012 16:29

I hope my response is not too late. I do not know what you need exactly but a scalarField works for the IOField so as vectorField and symmTensorField

Code:

IOField<scalarField> matHistoryScalar(
                                      IOobject
                                      (
                                      ...
                                      );


Best Regards
Hisham

qiang92 July 24, 2017 05:03

I also meet the problem right now. Did you solve you problem, I don't want to write Ifstrem to output the data of some variables which it not vetor or scalar defined in OpenFOAM. I create a FixedList<scalar, 5> a, variable a, I can output it through the way IOField.
If you solve your problem, please reply to me. Thanks

qiang92 July 26, 2017 04:45

I solved my problem using IOList instead of IOField,the full name of the type is IOList<scalarList>


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