Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
S
SWE
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Gaurav Kukreja
SWE
Commits
d71ec41e
Commit
d71ec41e
authored
Nov 20, 2012
by
Sebastian Rettenberger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use c interface in netcdf writer
Add missing authors
parent
6ecfd4c1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
131 additions
and
133 deletions
+131
-133
SConstruct
SConstruct
+1
-1
SWE_WavePropagationBlock.cpp
src/SWE_WavePropagationBlock.cpp
+1
-0
SWE_WavePropagationBlock.hh
src/SWE_WavePropagationBlock.hh
+1
-0
swe_mpi.cpp
src/examples/swe_mpi.cpp
+1
-0
NetCdfWriter.cpp
src/tools/NetCdfWriter.cpp
+93
-125
NetCdfWriter.hh
src/tools/NetCdfWriter.hh
+34
-7
No files found.
SConstruct
View file @
d71ec41e
...
@@ -283,7 +283,7 @@ if 'libSDLDir' in env:
...
@@ -283,7 +283,7 @@ if 'libSDLDir' in env:
# set the precompiler flags and includes for netCDF
# set the precompiler flags and includes for netCDF
if
env
[
'writeNetCDF'
]
==
True
:
if
env
[
'writeNetCDF'
]
==
True
:
env
.
Append
(
CPPDEFINES
=
[
'WRITENETCDF'
])
env
.
Append
(
CPPDEFINES
=
[
'WRITENETCDF'
])
env
.
Append
(
LIBS
=
[
'netcdf'
,
'netcdf_c++'
])
env
.
Append
(
LIBS
=
[
'netcdf'
])
# set netCDF location
# set netCDF location
if
'netCDFDir'
in
env
:
if
'netCDFDir'
in
env
:
env
.
Append
(
CPPPATH
=
[
env
[
'netCDFDir'
]
+
'/include'
])
env
.
Append
(
CPPPATH
=
[
env
[
'netCDFDir'
]
+
'/include'
])
...
...
src/SWE_WavePropagationBlock.cpp
View file @
d71ec41e
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
* This file is part of SWE.
* This file is part of SWE.
*
*
* @author Alexander Breuer (breuera AT in.tum.de, http://www5.in.tum.de/wiki/index.php/Dipl.-Math._Alexander_Breuer)
* @author Alexander Breuer (breuera AT in.tum.de, http://www5.in.tum.de/wiki/index.php/Dipl.-Math._Alexander_Breuer)
* @author Sebastian Rettenberger (rettenbs AT in.tum.de, http://www5.in.tum.de/wiki/index.php/Sebastian_Rettenberger,_M.Sc.)
*
*
* @section LICENSE
* @section LICENSE
*
*
...
...
src/SWE_WavePropagationBlock.hh
View file @
d71ec41e
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
* This file is part of SWE.
* This file is part of SWE.
*
*
* @author Alexander Breuer (breuera AT in.tum.de, http://www5.in.tum.de/wiki/index.php/Dipl.-Math._Alexander_Breuer)
* @author Alexander Breuer (breuera AT in.tum.de, http://www5.in.tum.de/wiki/index.php/Dipl.-Math._Alexander_Breuer)
* @author Sebastian Rettenberger (rettenbs AT in.tum.de, http://www5.in.tum.de/wiki/index.php/Sebastian_Rettenberger,_M.Sc.)
*
*
* @section LICENSE
* @section LICENSE
*
*
...
...
src/examples/swe_mpi.cpp
View file @
d71ec41e
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
*
*
* @author Michael Bader (bader AT in.tum.de, http://www5.in.tum.de/wiki/index.php/Univ.-Prof._Dr._Michael_Bader)
* @author Michael Bader (bader AT in.tum.de, http://www5.in.tum.de/wiki/index.php/Univ.-Prof._Dr._Michael_Bader)
* Alexander Breuer (breuera AT in.tum.de, http://www5.in.tum.de/wiki/index.php/Dipl.-Math._Alexander_Breuer)
* Alexander Breuer (breuera AT in.tum.de, http://www5.in.tum.de/wiki/index.php/Dipl.-Math._Alexander_Breuer)
* @author Sebastian Rettenberger (rettenbs AT in.tum.de, http://www5.in.tum.de/wiki/index.php/Sebastian_Rettenberger,_M.Sc.)
*
*
* @section LICENSE
* @section LICENSE
*
*
...
...
src/tools/NetCdfWriter.cpp
View file @
d71ec41e
This diff is collapsed.
Click to expand it.
src/tools/NetCdfWriter.hh
View file @
d71ec41e
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
* This file is part of SWE.
* This file is part of SWE.
*
*
* @author Alexander Breuer (breuera AT in.tum.de, http://www5.in.tum.de/wiki/index.php/Dipl.-Math._Alexander_Breuer)
* @author Alexander Breuer (breuera AT in.tum.de, http://www5.in.tum.de/wiki/index.php/Dipl.-Math._Alexander_Breuer)
* @author Sebastian Rettenberger (rettenbs AT in.tum.de, http://www5.in.tum.de/wiki/index.php/Sebastian_Rettenberger,_M.Sc.)
*
*
* @section LICENSE
* @section LICENSE
*
*
...
@@ -28,9 +29,10 @@
...
@@ -28,9 +29,10 @@
#ifndef NETCDFWRITER_HH_
#ifndef NETCDFWRITER_HH_
#define NETCDFWRITER_HH_
#define NETCDFWRITER_HH_
#include <cstring>
#include <string>
#include <string>
#include <vector>
#include <vector>
#include <netcdf
cpp
.h>
#include <netcdf.h>
#include "help.hh"
#include "help.hh"
namespace
io
{
namespace
io
{
...
@@ -38,25 +40,31 @@ namespace io {
...
@@ -38,25 +40,31 @@ namespace io {
}
}
class
io
::
NetCdfWriter
{
class
io
::
NetCdfWriter
{
//
private:
private
:
//! dimensions of the grid in x- and y-direction.
//! dimensions of the grid in x- and y-direction.
const
int
nX
,
nY
;
const
int
nX
,
nY
;
//! current time step of the netCDF-file
//! current time step of the netCDF-file
in
t
timeStep
;
size_
t
timeStep
;
//! file name of the netCDF-file
//! file name of the netCDF-file
const
std
::
string
fileName
;
const
std
::
string
fileName
;
/** netCDF file id*/
int
dataFile
;
/** Variable ids */
int
timeVar
,
hVar
,
huVar
,
hvVar
,
bVar
;
// writer time dependent variables.
// writer time dependent variables.
void
writeVarTimeDependent
(
const
Float2D
&
i_matrix
,
void
writeVarTimeDependent
(
const
Float2D
&
i_matrix
,
const
int
i_boundarySize
[
4
],
const
int
i_boundarySize
[
4
],
NcVar
*
o
_ncVariable
);
int
i
_ncVariable
);
// writes time independent variables.
// writes time independent variables.
void
writeVarTimeIndependent
(
const
Float2D
&
i_matrix
,
void
writeVarTimeIndependent
(
const
Float2D
&
i_matrix
,
const
int
i_boundarySize
[
4
],
const
int
i_boundarySize
[
4
],
NcVar
*
o
_ncVariable
);
int
i
_ncVariable
);
public
:
public
:
...
@@ -78,9 +86,19 @@ class io::NetCdfWriter {
...
@@ -78,9 +86,19 @@ class io::NetCdfWriter {
const
int
i_boundarySize
[
4
],
const
int
i_boundarySize
[
4
],
const
float
&
i_time
);
const
float
&
i_time
);
// writes the time independent bathymetry (static displacement) to the netCDF-file.
/**
* Write (static) bathymetry data to a netCDF-file (-> constructor) with respect to the boundary sizes.
*
* @param i_b bathymetry data.
* @param i_boundarySize size of the boundaries.
*
* @see writeUnknowns
*/
void
writeBathymetry
(
const
Float2D
&
i_b
,
void
writeBathymetry
(
const
Float2D
&
i_b
,
const
int
i_boundarySize
[
4
]
);
const
int
i_boundarySize
[
4
]
)
{
writeVarTimeIndependent
(
i_b
,
i_boundarySize
,
bVar
);
}
// writes one dimensional unknowns to the netCDF-file (not used in SWE).
// writes one dimensional unknowns to the netCDF-file (not used in SWE).
void
writeUnknownsOneDimensional
(
const
std
::
vector
<
double
>
&
i_h
,
void
writeUnknownsOneDimensional
(
const
std
::
vector
<
double
>
&
i_h
,
...
@@ -94,6 +112,15 @@ class io::NetCdfWriter {
...
@@ -94,6 +112,15 @@ class io::NetCdfWriter {
const
int
&
i_leftBoundarySize
,
const
int
&
i_leftBoundarySize
,
const
int
&
i_rightBoundarySize
);
const
int
&
i_rightBoundarySize
);
private
:
/**
* This is a small wrapper for `nc_put_att_text` which automatically sets the length.
*/
void
ncPutAttText
(
int
varid
,
const
char
*
name
,
const
char
*
value
)
{
nc_put_att_text
(
dataFile
,
varid
,
name
,
strlen
(
value
),
value
);
}
};
};
#endif
/* NETCDFWRITER_HH_ */
#endif
/* NETCDFWRITER_HH_ */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment