This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
>From: Markus Werle <address@hidden> >Subject: Non ANSI C++ >Organization: Lehr- und Forschungsgebiet fuer Mechanik, RWTH-Aachen >Keywords: 199805041934.NAA23467 netCDF g++ Hi Markus, > Here is another problem: > > > A multidimensional array can only be written to file by supplying > a one-dimensional array: > > double MeshPointData[spacedim*jdim*idim]; > > ... > > OriginalMesh.NcMeshPointsInFile->put(MeshPointData, spacedim, jdim, idim); > > > Is there any workaround or do I have to use/write an Array class > which provides one-dimensional data access for netCDF routines? If you declare and allocate space for the multidimensional array in a single declaration, e.g. double MeshPointData[spacedim][jdim][idim]; then the space for the values are allocated contiguously, so you can just provide the address of the first value instead of creating another 1-dimensional array: ...->put(&MeshPointData[0][0][0], spacedim, jdim, idim); > Do You know about any C++-examples in the WWW using netCDF with > multidimensional arrays from which I could learn? No, sorry, I don't know of any C++ examples. I'll try to look at your other question and reply in a separate message ... --Russ _____________________________________________________________________ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu