CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

erro: no match for operator[]

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree6Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 1, 2022, 04:49
Default
  #21
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,503
Rep Power: 35
olesen will become famous soon enougholesen will become famous soon enough
Quote:
Originally Posted by wind_ View Post
Hi,Nick
I also have this problem in OF5x, and I changed
tsource().internalField() =...
->
tsource().primitiveField() =...
but it doesn't work, how to fix it?
Thanks
Feng

If you read the docs on GeometricField (https://www.openfoam.com/documentati...tricField.html) you will notice that both internalField() and primitiveField() return const refs to the field. Cannot really change those by placing them on the LHS of an assignment. The compiler is correct to complain. If you want modifiable references, then you should be using the ref() or primitiveFieldRef() methods.
olesen is offline   Reply With Quote

Reply

Tags
cell value, operator, size, tmp<volscalarfield>

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[ANSYS Meshing] Match Control, is this weird or am I stupid? Moufle ANSYS Meshing & Geometry 2 November 18, 2015 16:00
createPatch Segmentation Fault (CORE DUMPED) sam.ho OpenFOAM Pre-Processing 2 April 21, 2014 02:01
Match Control and Symmetry Boundary Condtions in a quasi 2D calculation peterputer ANSYS Meshing & Geometry 0 May 15, 2012 08:53
gmsh2ToFoam sarajags_89 OpenFOAM 0 November 24, 2009 22:50
[Commercial meshers] Trimmed cell and embedded refinement mesh conversion issues michele OpenFOAM Meshing & Mesh Conversion 2 July 15, 2005 04:15


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