Skip to content

Commit

Permalink
GSW in c++,
Browse files Browse the repository at this point in the history
GSW in c++ developed from gsw-c. The first version.
  • Loading branch information
PaulMBarker committed Jul 27, 2021
1 parent 436f633 commit 1770c43
Show file tree
Hide file tree
Showing 24 changed files with 115,744 additions and 0 deletions.
45 changes: 45 additions & 0 deletions TeosCpp/TeosCpp.cbp
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="TeosCpp" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Debug">
<Option output="bin/Debug/libTeosCpp" prefix_auto="0" extension_auto="1" />
<Option object_output="obj/Debug/" />
<Option type="3" />
<Option compiler="gcc" />
<Option createDefFile="1" />
<Option createStaticLib="1" />
<Compiler>
<Add option="-g" />
<Add directory="include" />
</Compiler>
</Target>
</Build>
<Compiler>
<Add option="-Wall" />
<Add option="-fexceptions" />
</Compiler>
<Unit filename="include/SaarDataHandler.h" />
<Unit filename="include/TeosBase.h" />
<Unit filename="include/TeosIce.h" />
<Unit filename="include/TeosSea.h" />
<Unit filename="include/delta_sa_ref.h" />
<Unit filename="include/delta_sa_ref_map.h" />
<Unit filename="include/gsw_structs.h" />
<Unit filename="include/map_struct.h" />
<Unit filename="include/saar_ref.h" />
<Unit filename="include/saar_ref_map.h" />
<Unit filename="src/SaarDataHandler.cpp" />
<Unit filename="src/TeosBase.cpp" />
<Unit filename="src/TeosIce.cpp" />
<Unit filename="src/TeosSea.cpp" />
<Extensions>
<code_completion />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>
50 changes: 50 additions & 0 deletions TeosCpp/TeosCpp.depend
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# depslib dependency file v1.0
1578316153 source:/home/programmer/workspace/lib/TeosCpp/src/SaarDataHandler.cpp
"SaarDataHandler.h"
"map_struct.h"
"saar_ref_map.h"
"delta_sa_ref_map.h"
"saar_ref.h"
"delta_sa_ref.h"

1589374468 /home/programmer/workspace/lib/TeosCpp/include/SaarDataHandler.h

1589374791 /home/programmer/workspace/lib/TeosCpp/include/map_struct.h

1589374631 /home/programmer/workspace/lib/TeosCpp/include/saar_ref_map.h
"map_struct.h"

1589374994 /home/programmer/workspace/lib/TeosCpp/include/delta_sa_ref_map.h
"map_struct.h"

1589374744 /home/programmer/workspace/lib/TeosCpp/include/saar_ref.h
"SaarDataHandler.h"

1589375046 /home/programmer/workspace/lib/TeosCpp/include/delta_sa_ref.h
"SaarDataHandler.h"

1578575813 source:/home/programmer/workspace/lib/TeosCpp/src/TeosBase.cpp
"TeosBase.h"

1589374388 /home/programmer/workspace/lib/TeosCpp/include/TeosBase.h
<string.h>
<math.h>
<complex>
<errno.h>
"gsw_structs.h"
"SaarDataHandler.h"

1589374907 /home/programmer/workspace/lib/TeosCpp/include/gsw_structs.h

1578316153 source:/home/programmer/workspace/lib/TeosCpp/src/TeosIce.cpp
"TeosIce.h"

1589374235 /home/programmer/workspace/lib/TeosCpp/include/TeosIce.h
"TeosBase.h"

1578316153 source:/home/programmer/workspace/lib/TeosCpp/src/TeosSea.cpp
"TeosSea.h"

1589374165 /home/programmer/workspace/lib/TeosCpp/include/TeosSea.h
"TeosBase.h"

75 changes: 75 additions & 0 deletions TeosCpp/TeosCpp.layout
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<FileVersion major="1" minor="0" />
<ActiveTarget name="Debug" />
<File name="include/delta_sa_ref_map.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="600" topLine="12" />
</Cursor>
</File>
<File name="include/map_struct.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="201" topLine="8" />
</Cursor>
</File>
<File name="src/SaarDataHandler.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="42551" topLine="851" />
</Cursor>
</File>
<File name="include/saar_ref.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="712" topLine="0" />
</Cursor>
</File>
<File name="include/SaarDataHandler.h" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="873" topLine="0" />
</Cursor>
</File>
<File name="src/TeosSea.cpp" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1068" topLine="150" />
</Cursor>
</File>
<File name="src/TeosIce.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="82" topLine="0" />
</Cursor>
</File>
<File name="include/delta_sa_ref.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="737" topLine="0" />
</Cursor>
</File>
<File name="include/TeosIce.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="590" topLine="0" />
</Cursor>
</File>
<File name="src/TeosBase.cpp" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="7102" topLine="225" />
</Cursor>
</File>
<File name="include/saar_ref_map.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="411" topLine="0" />
</Cursor>
</File>
<File name="include/TeosSea.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="607" topLine="0" />
</Cursor>
</File>
<File name="include/TeosBase.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2532" topLine="0" />
</Cursor>
</File>
<File name="include/gsw_structs.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="13485" topLine="0" />
</Cursor>
</File>
</CodeBlocks_layout_file>
Binary file added TeosCpp/bin/Debug/libTeosCpp.so
Binary file not shown.
82 changes: 82 additions & 0 deletions TeosCpp/include/SaarDataHandler.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#ifndef SAARDATAHANDLER_H
#define SAARDATAHANDLER_H

/**************************************
Version 1.0
by Randall Kent Whited
rkwhited@gmail.com
------------------
This is a modification of the
TEOS-10 file "gsw_saar_data.c"
as adapted from the TEOS-10
C version 3.05
http://www.teos-10.org
-------------------------------------
About a 40% reduction in file size
(disk space & memory use) resulted,
in the debug compilation.
-------------------------------------
All copyrights and all license issues
are the same as for the C version
****************************************/

using namespace std;

/** array limit violation notice */
const double SAAR_ERROR_LIMIT = 1e10;

/** data array sizes that define boundaries (0-max) */
const unsigned sdata_lat_max = 45;
const unsigned sdata_long_max = 91;
const unsigned ndepth_ref_max = 4095;
/*******************************************
These next two VLA (very large arrays)
were re-designed by removing a meg or so
of repeated-value sections and then
'mapping' into the new locations.
********************************************/
const unsigned delta_sa_max = 111628;
const unsigned saar_max = 111921;

/** used in various SAAR-using methods/member functions */
const int gsw_nx = 91;
const int gsw_ny = 45;
const int gsw_nz = 45;

/***************************************
SAAR data-array access by C++
"getter" methods/member functions
-------------------------------------
The parameter "pos" is the zero-based
original array position of the data
value being sought.
-------------------------------------
Objects of this class handle array
data that was originally placed in
the "gsw_saar_data.c" file.
****************************************/
class SaarDataHandler
{
public:
SaarDataHandler();
virtual ~SaarDataHandler();

const double get_p_ref(unsigned pos);
const double get_lats_ref(unsigned pos);
const double get_longs_ref(unsigned pos);
const double get_saar_ref(unsigned pos);
const double get_ndepth_ref(unsigned pos);
const double get_delta_sa_ref(unsigned pos);

private:
/** mapping access functionality ('tpos' is the original VLA position) */
double getSaarValue(unsigned tpos);
double getDeltaSaValue(unsigned tpos);

unsigned getSaarArrayPos(unsigned valPos);
unsigned getDeltaSaArrayPos(unsigned valPos);

unsigned getOffset(unsigned arrayNumber, bool isSaar);
};

#endif // SAARDATAHANDLER_H

0 comments on commit 1770c43

Please sign in to comment.