[SCM] Gerris Flow Solver branch, upstream, updated. b3aa46814a06c9cb2912790b23916ffb44f1f203
Stephane Popinet
popinet at users.sf.net
Fri May 15 02:55:17 UTC 2009
The following commit has been merged in the upstream branch:
commit 5fe1fea6372c744c76d3992328183dc1ae45a2da
Author: Stephane Popinet <popinet at users.sf.net>
Date: Tue May 6 07:39:20 2008 +1000
Initial import of FES2004_distribution_soft-1.0.9
A GPL-ed library to read FES2004 tidal atlas data.
darcs-hash:20080505213920-d4795-5e2d1e3c09b2401e6efe1ef3de20d63dab6e8f56.gz
diff --git a/modules/FES2004_distribution_soft-1.0.9/AUTHORS b/modules/FES2004_distribution_soft-1.0.9/AUTHORS
new file mode 100644
index 0000000..08f2c94
--- /dev/null
+++ b/modules/FES2004_distribution_soft-1.0.9/AUTHORS
@@ -0,0 +1,20 @@
+
+
+
+The FES2004_distribution_soft-1.0.2 was written by :
+
+Thierry LETELLIER (tletelli @ notos.cst.cnes.fr)
+LEGOS Toulouse FRANCE
+in October 2005
+
+
+
+
+The FES2004_distribution_soft-1.0.2 used some functions from Aktarus library
+The Aktarus library was written by :
+
+Thierry LETELLIER and Laurent ROBLOU
+LEGOS Toulouse FRANCE
+in 2003
+(tletelli @ notos.cst.cnes.fr) and (laurent.roblou @ noveltis.fr)
+
diff --git a/modules/FES2004_distribution_soft-1.0.9/COPYING b/modules/FES2004_distribution_soft-1.0.9/COPYING
new file mode 100644
index 0000000..d60c31a
--- /dev/null
+++ b/modules/FES2004_distribution_soft-1.0.9/COPYING
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/modules/FES2004_distribution_soft-1.0.9/ChangeLog b/modules/FES2004_distribution_soft-1.0.9/ChangeLog
new file mode 100644
index 0000000..e69de29
diff --git a/modules/FES2004_distribution_soft-1.0.9/Makefile.am b/modules/FES2004_distribution_soft-1.0.9/Makefile.am
new file mode 100644
index 0000000..af437a6
--- /dev/null
+++ b/modules/FES2004_distribution_soft-1.0.9/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = src
diff --git a/modules/FES2004_distribution_soft-1.0.9/NEWS b/modules/FES2004_distribution_soft-1.0.9/NEWS
new file mode 100644
index 0000000..e69de29
diff --git a/modules/FES2004_distribution_soft-1.0.9/README b/modules/FES2004_distribution_soft-1.0.9/README
new file mode 100644
index 0000000..62a3666
--- /dev/null
+++ b/modules/FES2004_distribution_soft-1.0.9/README
@@ -0,0 +1,217 @@
+################################################################
+#
+# FES2004_distribution_soft-1.0.2
+#
+# -----------------------------------------------------------------------------------------------------------------------
+# THE SOFTWARE IS DISTRIBUTED FOR THE SCIENTIC COMMUNITY WITHOUT ANY GARANTEE
+# -----------------------------------------------------------------------------------------------------------------------
+#
+# Author : T. LETELLIER Legos Toulouse FRANCE
+#
+################################################################
+
+
+
+
+ REQUIREMENTS :
+================
+
+1---
+
+You need GSL (the Gnu Scientific Library) to be installed on your computer
+see : http://www.gnu.org/software/gsl/
+
+By default GSL is installed by root in the classical /usr/bin /usr/lib /usr/include
+some times in /usr/local/bin /usr/local/lib /usr/local/include
+
+If the installation was made made be a default user or if the configure script not found the GSL files
+you need to configure the environement :
+in bash :
+export PATH=$PATH:/home/user/softs/gsl/bin
+export CFLAGS="$CFLAGS -I/home/user/softs/gsl/include"
+export LDFLAGS="$LDLAGS -I/home/user/softs/gsl/lib"
+
+2---
+
+You need NETCDF (network Common Data Form) to be installed on your computer
+see : http://www.unidata.ucar.edu/software/netcdf/
+
+By default NETCDF is installed by root in the classical /usr/bin /usr/lib /usr/include
+some times in /usr/local/bin /usr/local/lib /usr/local/include
+
+If the installation was made made be a default user or if the configure script not found the NETCDF files
+you need to configure the environement :
+in bash :
+export PATH=$PATH:/home/user/softs/netcdf/bin
+export CFLAGS="$CFLAGS -I/home/user/softs/netcdf/include"
+export LDFLAGS="$LDLAGS -I/home/user/softs/netcdf/lib"
+
+
+
+
+
+ COMPILATION :
+================
+
+You just have to execute the 3 commands :
+ ./configure
+ make
+ make install
+
+in the major compilation case you do not have to install this program in the system path
+(and also if oyu are not root you do not have the right)
+
+Then use the option --prefix=/home/user/bin/... (path that pointing to an existing directory)
+to the configure script
+example :
+ mkdir /home/user/bin/FES2004_EXEC_DIR
+ ./configure --prefix=/home/user/bin/FES2004_EXEC_DIR
+
+
+
+
+ INSTALLATION :
+================
+
+The "make install" script will install 3 files
+the executable FES2004.exe in bin directory
+the header file fes2004.h in include directory
+the lib file libfes.a in lib directory
+
+
+
+
+ USE FES2004.exe :
+===================
+
+Usage : FES2004.exe [parameters] [option] file ...
+
+ ----PARAMETERS---- :
+ ------------------
+ -t [argument] Process type : extraction - prediction Note : this option can be use two times ...
+ -s [argument] Data set for process : tide - loading Note : this option can be use two times ...
+ -A [FILE] Necessary (with -s tide) path and filename of the --TIDE-- FES netcdf data file
+ -B [FILE] Necessary (with -s load) path and filename of the --LOAD-- FES netcdf data file
+ -----VARIABLE PARAMETER---- :
+ ----------------------------
+ -r [value] Necessary for prediction :
+ This is the time refence of the input file.
+ Use : 0 --> 01Jan1950 0H00
+ 1 --> 01Jan1958 0H00
+ 2 --> 01Jan1985 0H00
+ 3 --> 01Jan2000 0H00
+ DEFAULT is 0
+ ----OPTION---- :
+ ---------------
+ -o [file] Optionnal give a specific root output file name
+
+ ----EXAMPLES---- :
+ ----------------
+
+ 1- FES2004.exe -t extraction -s loading -B load.nc inputFILE --> extraction of the loading data in out_file.loading.extract
+
+ 2- FES2004.exe -t extraction -t prediction -s tide -A tide.nc inputFILE --> extraction of the tide data in out_file.tide.extract
+ and prediction of the tide data in out_file.tide.pred
+
+ 3- FES2004.exe -t prediction -s tide -s loading -A tide.nc -B load.nc inputFILE --> prediction of both the tide and loading data
+ in out_file.tide.pred and out_file.loading.extract
+
+ 4- FES2004.exe -t prediction -A tide.nc -s tide -o my_output inputFILE --> prediction of the tide data in my_output.tide.pred
+
+ 5- FES2004.exe -t prediction -s tide -A tide.nc -d /MYPATH/ inputFILE --> prediction of the tide data (FES2004.nc) found in /MYPATH/
+
+
+The inputFile MUST HAVE THIS FORMAT
+
+Latitude Longitude Time
+Latitude Longitude Time
+Latitude Longitude Time
+Latitude Longitude Time
+Latitude Longitude Time
+Latitude Longitude Time
+ .
+ .
+ .
+Where latitude longitude and time are double
+With Latitude and Longitude in degrees (-180 +180) or (0 360)
+and time in hours since the time reference ...
+
+For the extraction process you do not have to indicate a valid time
+because it is not use
+BUT IT MUST PRESENT
+
+
+
+
+
+ USE libfes.a :
+===================
+
+The libfes can be used in C and C++ language
+
+You just have to include the file fes2004.h (that prototype the prediction and extraction functions)
+and use the libfes2004.a the gsl gslcblas and netcdf libraries during the linking
+
+Example
+
+---
+C sources
+
+#include "fes2004.h"
+
+int main()
+{
+char netcdf_filename[256];
+int nb_position=600;
+double *lat,double *lon,double **amplitude,double **phase;
+int nb_CPU;
+
+//allocation
+
+rstatus=fes2004_extraction (netcdf_filename,nb_position,lat,lon,amplitude,phase,nb_CPU);
+
+}
+
+---
+compilation
+
+gcc -g -IFES_Directory/include -lfes -lnetcdf -lgsl -lgslcblas -o My_own_extract.exe
+
+
+For the Fortran We think that the liffes.a can also be use
+all the parameters used for the CALL are classical and correspond to Fortran tabular
+But yet it was never been tested ....
+
+
+---
+experts
+
+You can use libfes on a defined number of processors
+You need to uncoment the
+#define MULTI
+in the src/fes2004_kernel.c file and then recompile the lib
+with
+./configure --prefix= ...
+make
+make install
+
+You can now use the nb_cpu parameters of the extraction and prediction functions
+ ...
+ It's easy
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/FES2004_distribution_soft-1.0.9/aclocal.m4 b/modules/FES2004_distribution_soft-1.0.9/aclocal.m4
new file mode 100644
index 0000000..965df90
--- /dev/null
+++ b/modules/FES2004_distribution_soft-1.0.9/aclocal.m4
@@ -0,0 +1,850 @@
+# generated automatically by aclocal 1.9.5 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005 Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION so it can be traced.
+# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+ [AM_AUTOMAKE_VERSION([1.9.5])])
+
+# AM_AUX_DIR_EXPAND -*- Autoconf -*-
+
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory. The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run. This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+# fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+# fails if $ac_aux_dir is absolute,
+# fails when called from a subdirectory in a VPATH build with
+# a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir. In an in-source build this is usually
+# harmless because $srcdir is `.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
+# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+# MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH. The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_CONDITIONAL -*- Autoconf -*-
+
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 7
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ(2.52)dnl
+ ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
+ [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])
+AC_SUBST([$1_FALSE])
+if $2; then
+ $1_TRUE=
+ $1_FALSE='#'
+else
+ $1_TRUE='#'
+ $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+ AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 8
+
+# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery. Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
+ [$1], CXX, [depcc="$CXX" am_compiler_list=],
+ [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+ [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
+ [depcc="$$1" am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+ [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_$1_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+ fi
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+ # Solaris 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ case $depmode in
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ none) break ;;
+ esac
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this.
+ if depmode=$depmode \
+ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_$1_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE(dependency-tracking,
+[ --disable-dependency-tracking speeds up one-time build
+ --enable-dependency-tracking do not reject slow dependency extractors])
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])
+])
+
+# Generate code to set up dependency tracking. -*- Autoconf -*-
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+#serial 3
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[for mf in $CONFIG_FILES; do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named `Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # So let's grep whole file.
+ if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+ dirpart=`AS_DIRNAME("$mf")`
+ else
+ continue
+ fi
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running `make'.
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+ # When using ansi2knr, U may be empty or an underscore; expand it
+ U=`sed -n 's/^U = //p' < "$mf"`
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`AS_DIRNAME(["$file"])`
+ AS_MKDIR_P([$dirpart/$fdir])
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+done
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled. FIXME. This creates each `.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+ [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+ [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+# Do all the work for Automake. -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 12
+
+# This macro actually does too much. Some checks are only needed if
+# your package does certain things. But this isn't really a big deal.
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out. PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition. After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_PREREQ([2.58])dnl
+dnl Autoconf wants to disallow AM_ names. We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+ test -f $srcdir/config.status; then
+ AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
+AM_MISSING_PROG(AUTOCONF, autoconf)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
+AM_MISSING_PROG(AUTOHEADER, autoheader)
+AM_MISSING_PROG(MAKEINFO, makeinfo)
+AM_PROG_INSTALL_SH
+AM_PROG_INSTALL_STRIP
+AC_REQUIRE([AM_PROG_MKDIR_P])dnl
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+ [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+ [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+ [_AM_DEPENDENCIES(CC)],
+ [define([AC_PROG_CC],
+ defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [_AM_DEPENDENCIES(CXX)],
+ [define([AC_PROG_CXX],
+ defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+])
+])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated. The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $1 | $1:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
+
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+AC_SUBST(install_sh)])
+
+# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot. For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
+# Check to see how 'make' treats includes. -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+ am__include=include
+ am__quote=
+ _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ fi
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
+
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ AC_MSG_WARN([`missing' script is too old or missing])
+fi
+])
+
+# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_MKDIR_P
+# ---------------
+# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
+#
+# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
+# created by `make install' are always world readable, even if the
+# installer happens to have an overly restrictive umask (e.g. 077).
+# This was a mistake. There are at least two reasons why we must not
+# use `-m 0755':
+# - it causes special bits like SGID to be ignored,
+# - it may be too restrictive (some setups expect 775 directories).
+#
+# Do not use -m 0755 and let people choose whatever they expect by
+# setting umask.
+#
+# We cannot accept any implementation of `mkdir' that recognizes `-p'.
+# Some implementations (such as Solaris 8's) are not thread-safe: if a
+# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
+# concurrently, both version can detect that a/ is missing, but only
+# one can create it and the other will error out. Consequently we
+# restrict ourselves to GNU make (using the --version option ensures
+# this.)
+AC_DEFUN([AM_PROG_MKDIR_P],
+[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+ # We used to keeping the `.' as first argument, in order to
+ # allow $(mkdir_p) to be used without argument. As in
+ # $(mkdir_p) $(somedir)
+ # where $(somedir) is conditionally defined. However this is wrong
+ # for two reasons:
+ # 1. if the package is installed by a user who cannot write `.'
+ # make install will fail,
+ # 2. the above comment should most certainly read
+ # $(mkdir_p) $(DESTDIR)$(somedir)
+ # so it does not work when $(somedir) is undefined and
+ # $(DESTDIR) is not.
+ # To support the latter case, we have to write
+ # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
+ # so the `.' trick is pointless.
+ mkdir_p='mkdir -p --'
+else
+ # On NextStep and OpenStep, the `mkdir' command does not
+ # recognize any option. It will interpret all options as
+ # directories to create, and then abort because `.' already
+ # exists.
+ for d in ./-p ./--version;
+ do
+ test -d $d && rmdir $d
+ done
+ # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
+ if test -f "$ac_aux_dir/mkinstalldirs"; then
+ mkdir_p='$(mkinstalldirs)'
+ else
+ mkdir_p='$(install_sh) -d'
+ fi
+fi
+AC_SUBST([mkdir_p])])
+
+# Helper functions for option handling. -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# ------------------------------
+# Set option NAME. Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ----------------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+# Check to make sure that the build environment is sane. -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+ if test "$[*]" = "X"; then
+ # -L didn't work.
+ set X `ls -t $srcdir/configure conftest.file`
+ fi
+ rm -f conftest.file
+ if test "$[*]" != "X $srcdir/configure conftest.file" \
+ && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
+alias in your environment])
+ fi
+
+ test "$[2]" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT(yes)])
+
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_STRIP
+# ---------------------
+# One issue with vendor `install' (even GNU) is that you can't
+# specify the program used to strip binaries. This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in `make install-strip', and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'. However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+if test "$cross_compiling" != no; then
+ AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Check how to create a tarball. -*- Autoconf -*-
+
+# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of `v7', `ustar', or `pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+# tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+# $(am__untar) < result.tar
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility.
+AM_MISSING_PROG([AMTAR], [tar])
+m4_if([$1], [v7],
+ [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
+ [m4_case([$1], [ustar],, [pax],,
+ [m4_fatal([Unknown tar format])])
+AC_MSG_CHECKING([how to create a $1 tar archive])
+# Loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+_am_tools=${am_cv_prog_tar_$1-$_am_tools}
+# Do not fold the above two line into one, because Tru64 sh and
+# Solaris sh will not grok spaces in the rhs of `-'.
+for _am_tool in $_am_tools
+do
+ case $_am_tool in
+ gnutar)
+ for _am_tar in tar gnutar gtar;
+ do
+ AM_RUN_LOG([$_am_tar --version]) && break
+ done
+ am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+ am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+ am__untar="$_am_tar -xf -"
+ ;;
+ plaintar)
+ # Must skip GNU tar: if it does not support --format= it doesn't create
+ # ustar tarball either.
+ (tar --version) >/dev/null 2>&1 && continue
+ am__tar='tar chf - "$$tardir"'
+ am__tar_='tar chf - "$tardir"'
+ am__untar='tar xf -'
+ ;;
+ pax)
+ am__tar='pax -L -x $1 -w "$$tardir"'
+ am__tar_='pax -L -x $1 -w "$tardir"'
+ am__untar='pax -r'
+ ;;
+ cpio)
+ am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+ am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+ am__untar='cpio -i -H $1 -d'
+ ;;
+ none)
+ am__tar=false
+ am__tar_=false
+ am__untar=false
+ ;;
+ esac
+
+ # If the value was cached, stop now. We just wanted to have am__tar
+ # and am__untar set.
+ test -n "${am_cv_prog_tar_$1}" && break
+
+ # tar/untar a dummy directory, and stop if the command works
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ echo GrepMe > conftest.dir/file
+ AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+ rm -rf conftest.dir
+ if test -s conftest.tar; then
+ AM_RUN_LOG([$am__untar <conftest.tar])
+ grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+ fi
+done
+rm -rf conftest.dir
+
+AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
diff --git a/modules/FES2004_distribution_soft-1.0.9/config.h.in b/modules/FES2004_distribution_soft-1.0.9/config.h.in
new file mode 100644
index 0000000..2ff5adb
--- /dev/null
+++ b/modules/FES2004_distribution_soft-1.0.9/config.h.in
@@ -0,0 +1,95 @@
+/* config.h.in. Generated from configure.ac by autoheader. */
+
+/* Define to 1 if you have the `floor' function. */
+#undef HAVE_FLOOR
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the `c' library (-lc). */
+#undef HAVE_LIBC
+
+/* Define to 1 if you have the `fes' library (-lfes). */
+#undef HAVE_LIBFES
+
+/* Define to 1 if you have the `gsl' library (-lgsl). */
+#undef HAVE_LIBGSL
+
+/* Define to 1 if you have the `gslcblas' library (-lgslcblas). */
+#undef HAVE_LIBGSLCBLAS
+
+/* Define to 1 if you have the `m' library (-lm). */
+#undef HAVE_LIBM
+
+/* Define to 1 if you have the `netcdf' library (-lnetcdf). */
+#undef HAVE_LIBNETCDF
+
+/* Define to 1 if you have the `pthread' library (-lpthread). */
+#undef HAVE_LIBPTHREAD
+
+/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
+ to 0 otherwise. */
+#undef HAVE_MALLOC
+
+/* Define to 1 if you have the <malloc.h> header file. */
+#undef HAVE_MALLOC_H
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the `sqrt' function. */
+#undef HAVE_SQRT
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the `strdup' function. */
+#undef HAVE_STRDUP
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Version number of package */
+#undef VERSION
+
+/* Define to rpl_malloc if the replacement function should be used. */
+#undef malloc
+
+/* Define to `unsigned' if <sys/types.h> does not define. */
+#undef size_t
diff --git a/modules/FES2004_distribution_soft-1.0.9/configure.ac b/modules/FES2004_distribution_soft-1.0.9/configure.ac
new file mode 100644
index 0000000..a62612e
--- /dev/null
+++ b/modules/FES2004_distribution_soft-1.0.9/configure.ac
@@ -0,0 +1,138 @@
+# -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ(2.59)
+AC_INIT(FES_distribution_soft, 1.0.9, tletelli at notos.cst.cnes.fr)
+AC_CONFIG_SRCDIR([src/fes2004_alloc.c])
+AC_CONFIG_HEADER([config.h])
+AM_INIT_AUTOMAKE(FES2004_distribution_soft, 1.0.9)
+# Checks for programs.
+AC_PROG_CC
+
+# Checks for libraries.
+
+# Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS([malloc.h stdlib.h string.h strings.h])
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_TYPE_SIZE_T
+
+#CFLAGS="$CFLAGS -g"
+
+
+
+######################
+# #
+# Checks for include #
+# #
+######################
+dnl --------RECHERCHE DE include NETCDF--------
+AC_CHECK_HEADER(netcdf.h,,AC_MSG_ERROR([
+
+Can not found netcdf.h
+install it or use >> export CFLAGS="\$CFLAGS -I/netcdf_PATH/include"
+]))
+
+
+
+######################
+# #
+# Checks for library #
+# #
+######################
+
+dnl ----------------------------------------
+dnl
+dnl --------RECHERCHE DE LIB C--------
+dnl
+dnl ----------------------------------------
+
+AC_CHECK_LIB(c,main)
+
+
+
+dnl ----------------------------------------
+dnl
+dnl --------RECHERCHE DE LIB pthread--------
+dnl
+dnl ----------------------------------------
+
+#AC_CHECK_LIB(pthread,pthread_create , , [AC_MSG_ERROR([can not found the library libpthread the software can be compiled but generally it will not work !!!!!])])
+AC_CHECK_LIB(pthread,pthread_create)
+
+
+
+dnl ----------------------------------------
+dnl
+dnl --------RECHERCHE DE LIB MATH--------
+dnl
+dnl ----------------------------------------
+
+AC_CHECK_LIB(m,main)
+
+
+dnl ----------------------------------------
+dnl
+dnl --------RECHERCHE DE LIB BLAS--------
+dnl
+dnl ----------------------------------------
+
+AC_CHECK_LIB(gslcblas,main, ,[AC_MSG_ERROR([
+
+Can not found libgslcblas
+install it or use :
+1- export LDFLAGS="\$LDFLAGS -L/gsl_PATH/lib"
+2- export LDFLAGS="\$LDFLAGS -L$(gsl-config --prefix)/lib"
+
+])])
+
+dnl ----------------------------------------
+dnl
+dnl --------RECHERCHE DE LIB GSL--------
+dnl
+dnl ----------------------------------------
+
+AC_CHECK_LIB(gsl,main, ,[AC_MSG_ERROR([
+
+Can not found libgsl
+install it or use :
+1- export LDFLAGS="\$LDFLAGS -L/gsl_PATH/lib"
+2- export LDFLAGS="\$LDFLAGS -L$(gsl-config --prefix)/lib"
+
+])])
+
+dnl ----------------------------------------
+dnl
+dnl --------RECHERCHE DE LIB NETCDF--------
+dnl
+dnl ----------------------------------------
+
+AC_CHECK_LIB([netcdf],[main], ,[AC_MSG_ERROR([
+
+Can not found libnetcdf
+install it or use >> export LDFLAGS="\$LDFLAGS -L/netcdf_PATH/lib"
+
+])])
+
+
+
+AC_PROG_RANLIB
+
+AC_FUNC_MALLOC
+AC_CHECK_FUNCS([floor sqrt strdup])
+
+dnl ----------------------------------------
+dnl
+dnl --------RECHERCHE DE LIB fes--------
+dnl
+dnl ----------------------------------------
+dnl La lib FES fait planter la recherche des autres composants....
+dnl il faut faire le test en dernier pour s'affranchir des erreurs
+dnl mais il faut la faire pour l'include dans la compil
+
+AC_CHECK_LIB(fes,extraction, ,LIBS=" -lfes $LIBS")
+
+
+
+AC_OUTPUT(Makefile src/Makefile)
diff --git a/modules/FES2004_distribution_soft-1.0.9/src/Makefile.am b/modules/FES2004_distribution_soft-1.0.9/src/Makefile.am
new file mode 100644
index 0000000..d67e33f
--- /dev/null
+++ b/modules/FES2004_distribution_soft-1.0.9/src/Makefile.am
@@ -0,0 +1,13 @@
+include_HEADERS = fes.h
+
+
+noinst_HEADERS = fes2004_lib.h
+
+lib_LIBRARIES = libfes.a
+
+libfes_a_SOURCES=fes2004_alloc.c fes2004_error.c fes2004_extraction.c fes2004_init.c fes2004_io.c fes2004_prediction.c fes2004_kernel.c
+
+
+bin_PROGRAMS = FES2004_exe
+FES2004_exe_SOURCES = fes2004_main.c
+FES2004_exe_LDFLAGS = -L.
diff --git a/modules/FES2004_distribution_soft-1.0.9/src/Makefile.in b/modules/FES2004_distribution_soft-1.0.9/src/Makefile.in
new file mode 100644
index 0000000..d829bd3
--- /dev/null
+++ b/modules/FES2004_distribution_soft-1.0.9/src/Makefile.in
@@ -0,0 +1,481 @@
+# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+
+
+SOURCES = $(libfes_a_SOURCES) $(FES2004_exe_SOURCES)
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+bin_PROGRAMS = FES2004_exe$(EXEEXT)
+subdir = src
+DIST_COMMON = $(include_HEADERS) $(noinst_HEADERS) \
+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \
+ "$(DESTDIR)$(includedir)"
+libLIBRARIES_INSTALL = $(INSTALL_DATA)
+LIBRARIES = $(lib_LIBRARIES)
+AR = ar
+ARFLAGS = cru
+libfes_a_AR = $(AR) $(ARFLAGS)
+libfes_a_LIBADD =
+am_libfes_a_OBJECTS = fes2004_alloc.$(OBJEXT) fes2004_error.$(OBJEXT) \
+ fes2004_extraction.$(OBJEXT) fes2004_init.$(OBJEXT) \
+ fes2004_io.$(OBJEXT) fes2004_prediction.$(OBJEXT) \
+ fes2004_kernel.$(OBJEXT)
+libfes_a_OBJECTS = $(am_libfes_a_OBJECTS)
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_FES2004_exe_OBJECTS = fes2004_main.$(OBJEXT)
+FES2004_exe_OBJECTS = $(am_FES2004_exe_OBJECTS)
+FES2004_exe_LDADD = $(LDADD)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libfes_a_SOURCES) $(FES2004_exe_SOURCES)
+DIST_SOURCES = $(libfes_a_SOURCES) $(FES2004_exe_SOURCES)
+includeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(include_HEADERS) $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build_alias = @build_alias@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+include_HEADERS = fes.h
+noinst_HEADERS = fes2004_lib.h
+lib_LIBRARIES = libfes.a
+libfes_a_SOURCES = fes2004_alloc.c fes2004_error.c fes2004_extraction.c fes2004_init.c fes2004_io.c fes2004_prediction.c fes2004_kernel.c
+FES2004_exe_SOURCES = fes2004_main.c
+FES2004_exe_LDFLAGS = -L.
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-libLIBRARIES: $(lib_LIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
+ @list='$(lib_LIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(libLIBRARIES_INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+ $(libLIBRARIES_INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+ else :; fi; \
+ done
+ @$(POST_INSTALL)
+ @list='$(lib_LIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ p=$(am__strip_dir) \
+ echo " $(RANLIB) '$(DESTDIR)$(libdir)/$$p'"; \
+ $(RANLIB) "$(DESTDIR)$(libdir)/$$p"; \
+ else :; fi; \
+ done
+
+uninstall-libLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+ rm -f "$(DESTDIR)$(libdir)/$$p"; \
+ done
+
+clean-libLIBRARIES:
+ -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES)
+libfes.a: $(libfes_a_OBJECTS) $(libfes_a_DEPENDENCIES)
+ -rm -f libfes.a
+ $(libfes_a_AR) libfes.a $(libfes_a_OBJECTS) $(libfes_a_LIBADD)
+ $(RANLIB) libfes.a
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+FES2004_exe$(EXEEXT): $(FES2004_exe_OBJECTS) $(FES2004_exe_DEPENDENCIES)
+ @rm -f FES2004_exe$(EXEEXT)
+ $(LINK) $(FES2004_exe_LDFLAGS) $(FES2004_exe_OBJECTS) $(FES2004_exe_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fes2004_alloc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fes2004_error.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fes2004_extraction.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fes2004_init.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fes2004_io.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fes2004_kernel.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fes2004_main.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fes2004_prediction.Po at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+uninstall-info-am:
+install-includeHEADERS: $(include_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(includedir)" || $(mkdir_p) "$(DESTDIR)$(includedir)"
+ @list='$(include_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \
+ $(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \
+ done
+
+uninstall-includeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(include_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \
+ rm -f "$(DESTDIR)$(includedir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(includedir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-includeHEADERS
+
+install-exec-am: install-binPROGRAMS install-libLIBRARIES
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-includeHEADERS \
+ uninstall-info-am uninstall-libLIBRARIES
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-binPROGRAMS install-data install-data-am install-exec \
+ install-exec-am install-includeHEADERS install-info \
+ install-info-am install-libLIBRARIES install-man install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-binPROGRAMS uninstall-includeHEADERS \
+ uninstall-info-am uninstall-libLIBRARIES
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/modules/FES2004_distribution_soft-1.0.9/src/fes.h b/modules/FES2004_distribution_soft-1.0.9/src/fes.h
new file mode 100644
index 0000000..c606cc9
--- /dev/null
+++ b/modules/FES2004_distribution_soft-1.0.9/src/fes.h
@@ -0,0 +1,23 @@
+
+// this file is a hearder file that prototype the libfes.a functions
+// The inputs are :
+// char an string that contain the ath to load the NETCDF SOLUTION
+// int time reference 0->01/01/1950 1->01/01/1958 2->01/01/1985 3->01/0/2000
+// int nb_position the number of point the predict and or to extract
+// double lat lon time 3 tabulars(nb_position) that contain the position and time for the prediction extraction
+// The returns are :
+// double prediction tabular(nb_position) that contains the prediction in meters
+// double amplitude phase 2 dimension tabular[nb_position][nb_wave=14] that contain the amplitude and the phase_lag extracted for each point and all waves
+
+// the int nb_cpu can be use if chachc in the source code src/fes2004_kernel.c
+// and activate the multithread mode ... read the end of the README file
+
+//extern int fes2004_prediction (char *netcdf_filename,int time_reference,int nb_position,double *lat,double *lon,double *time,double *prediction,int nb_CPU);
+//extern int fes2004_extraction (char *netcdf_filename,int nb_position,double *lat,double *lon,double **amplitude,double **phase,int nb_CPU);
+
+// prototypes
+
+
+
+extern int fes2004_prediction (char *,int ,int ,double *,double *,double *,double *,int );
+extern int fes2004_extraction (char *,int ,double *,double *,double **,double **,int );
diff --git a/modules/FES2004_distribution_soft-1.0.9/src/fes2004_alloc.c b/modules/FES2004_distribution_soft-1.0.9/src/fes2004_alloc.c
new file mode 100644
index 0000000..8c949d8
--- /dev/null
+++ b/modules/FES2004_distribution_soft-1.0.9/src/fes2004_alloc.c
@@ -0,0 +1,123 @@
+#include "fes2004_lib.h"
+
+
+/*####################################################*/
+/* */
+/* spectrum variable allocation */
+/* */
+/* */
+/* Thierry LETELLIER 03Oct2005 */
+/* */
+/*####################################################*/
+
+void alloc_tide_spectrum(spectrum_struct **spectrum )
+{
+ int nb_wave;
+ nb_wave=NB_WAVE_IN_SPECTRUM;
+ *spectrum=(spectrum_struct *)calloc(nb_wave,sizeof(spectrum_struct));
+ if(*spectrum==NULL) print_error_3("error in spectrum allocation, you may use a larger memory computer -->exit");
+
+}
+
+
+
+/*####################################################*/
+/* */
+/* threads variable allocation */
+/* */
+/* */
+/* Thierry LETELLIER 03Oct2005 */
+/* */
+/*####################################################*/
+
+void alloc_prediction_threads(mega_struct *P,int CPU)
+{
+ int i;
+
+ for(i=0;i<CPU;i++)
+ {
+ P[i].Mat=gsl_matrix_calloc(coef_spline,coef_spline);
+ if(P[i].Mat==NULL) print_error_3("error in threads allocation, you may use a larger memory computer or reduce the number of CPU -->exit");
+
+ P[i].sec_r=gsl_vector_calloc(coef_spline);
+ if(P[i].sec_r==NULL) print_error_3("error in threads allocation, you may use a larger memory computer or reduce the number of CPU -->exit");
+
+ P[i].sec_i=gsl_vector_calloc(coef_spline);
+ if(P[i].sec_i==NULL) print_error_3("error in threads allocation, you may use a larger memory computer or reduce the number of CPU -->exit");
+
+ P[i].res_r=gsl_vector_calloc(coef_spline);
+ if(P[i].res_r==NULL) print_error_3("error in threads allocation, you may use a larger memory computer or reduce the number of CPU -->exit");
+
+ P[i].res_i=gsl_vector_calloc(coef_spline);
+ if(P[i].res_i==NULL) print_error_3("error in threads allocation, you may use a larger memory computer or reduce the number of CPU -->exit");
+
+ P[i].Perm=gsl_permutation_calloc(coef_spline);
+ if(P[i].Perm==NULL) print_error_3("error in threads allocation, you may use a larger memory computer or reduce the number of CPU -->exit");
+
+ P[i].spectrum=calloc(36,sizeof(spectrum_struct));
+ if(P[i].spectrum==NULL) print_error_3("error in threads allocation, you may use a larger memory computer or reduce the number of CPU -->exit");
+
+ P[i].data_amp=malloc(56*sizeof(float));
+ P[i].data_phi=malloc(56*sizeof(float));
+
+ P[i].weight=malloc(4*sizeof(double));
+ P[i].sindice=malloc(3*sizeof(int));
+ P[i].aindice=malloc(10*sizeof(int));
+
+
+ }
+}
+
+/*####################################################*/
+/* */
+/* threads variable allocation */
+/* */
+/* */
+/* Thierry LETELLIER 03Oct2005 */
+/* */
+/*####################################################*/
+
+void alloc_extraction_threads(mega_struct *P,int CPU)
+{
+ int i;
+ for(i=0;i<CPU;i++)
+ {
+ P[i].spectrum=calloc(36,sizeof(spectrum_struct));
+ if(P[i].spectrum==NULL) print_error_3("error in threads allocation, you may use a larger memory computer or reduce the number of CPU -->exit");
+ P[i].data_amp=malloc(56*sizeof(float));
+ P[i].data_phi=malloc(56*sizeof(float));
+ P[i].weight=malloc(4*sizeof(double));
+ }
+
+}
+
+/*####################################################*/
+/* */
+/* threads variable free */
+/* */
+/* */
+/* Thierry LETELLIER 06Oct2005 */
+/* */
+/*####################################################*/
+
+
+void free_threads(mega_struct *P,int CPU)
+{
+ int i;
+ for(i=0;i<CPU;i++)
+ {
+ if(P[i].Mat!=NULL)gsl_matrix_free( P[i].Mat);
+ if(P[i].sec_r!=NULL)gsl_vector_free(P[i].sec_r);
+ if(P[i].sec_i!=NULL)gsl_vector_free(P[i].sec_i);
+ if(P[i].res_r!=NULL)gsl_vector_free(P[i].res_r);
+ if(P[i].res_i!=NULL)gsl_vector_free(P[i].res_i);
+ if(P[i].Perm!=NULL)gsl_permutation_free(P[i].Perm);
+
+ if(P[i].spectrum!=NULL)free(P[i].spectrum);
+ if(P[i].data_amp!=NULL)free(P[i].data_amp);
+ if( P[i].data_phi!=NULL)free( P[i].data_phi);
+ if(P[i].weight!=NULL) free(P[i].weight);
+ if(P[i].sindice!=NULL)free(P[i].sindice);
+ if(P[i].aindice!=NULL)free(P[i].aindice);
+ }
+}
diff --git a/modules/FES2004_distribution_soft-1.0.9/src/fes2004_error.c b/modules/FES2004_distribution_soft-1.0.9/src/fes2004_error.c
new file mode 100644
index 0000000..d29d753
--- /dev/null
+++ b/modules/FES2004_distribution_soft-1.0.9/src/fes2004_error.c
@@ -0,0 +1,36 @@
+
+
+void print_error_1()
+{
+ printf("error: wrong run parameters\n use: [executable] [time origine (CNES:0,CTO:1,ESA:2)] [input file] [Nb CPU dispo]\nexit");
+ exit(101);
+
+}
+
+void print_error_2()
+{
+ printf("a strange error occur, certainly due to the memory allocation in the spectrum initialisation --> exit\n");
+ exit(102);
+
+}
+
+void print_error_3(char *message)
+{
+ printf("%s\n",message);
+ exit(103);
+
+}
+
+void print_error_4(char *message)
+{
+ printf("%s\n",message);
+ exit(104);
+
+}
+
+void print_error_5(char *message)
+{
+ printf("can not open the file : %s , please check this error --> exit\n",message);
+ exit(105);
+
+}
diff --git a/modules/FES2004_distribution_soft-1.0.9/src/fes2004_extraction.c b/modules/FES2004_distribution_soft-1.0.9/src/fes2004_extraction.c
new file mode 100644
index 0000000..2a0f01b
--- /dev/null
+++ b/modules/FES2004_distribution_soft-1.0.9/src/fes2004_extraction.c
@@ -0,0 +1,63 @@
+#include "fes2004_lib.h"
+
+
+
+
+int fes2004_extraction (char *netcdf_filename,int nb_position,double *lat,double *lon,double **amplitude, double **phase,int nb_CPU)
+{
+
+ /*####################################################*/
+ /* variable*/
+ /*####################################################*/
+ //classical variables
+ int rstatus;
+
+ //prediction typedef variables
+ spectrum_struct *spectrum=NULL;
+ mega_struct *P=NULL;
+
+ /*####################################################*/
+ /* allocation*/
+ /*####################################################*/
+
+ alloc_tide_spectrum(&spectrum);
+ P=calloc(nb_CPU,sizeof(mega_struct));
+ alloc_extraction_threads(P,nb_CPU);
+
+ /*####################################################*/
+ /*init prediction spectrum*/
+ /*####################################################*/
+
+ rstatus=init_spectrum(spectrum,99);
+ if (rstatus != 0 ) print_error_2();
+
+ /*####################################################*/
+ /* load data files*/
+ /*####################################################*/
+
+ load_netcdf_fes2004_data(netcdf_filename,P,nb_CPU);
+
+
+ /*####################################################*/
+ /*init thread struct*/
+ /*####################################################*/
+
+ init_thread_struct(nb_CPU, P, 99, lat, lon, NULL, NULL, spectrum,amplitude,phase);
+
+ /*####################################################*/
+ /*Multithreaded extraction*/
+ /*####################################################*/
+
+ multi_t_extraction( nb_position, nb_CPU, P);
+
+ /*####################################################*/
+ /*free memory and exit*/
+ /*####################################################*/
+ free_threads(P,nb_CPU);
+ free(P);
+
+
+
+ printf("\n------------- extraction completed -------------\n");
+
+}/*end*/
diff --git a/modules/FES2004_distribution_soft-1.0.9/src/fes2004_init.c b/modules/FES2004_distribution_soft-1.0.9/src/fes2004_init.c
new file mode 100644
index 0000000..c67abcd
--- /dev/null
+++ b/modules/FES2004_distribution_soft-1.0.9/src/fes2004_init.c
@@ -0,0 +1,287 @@
+#define LIB
+#include "fes2004_lib.h"
+
+
+/*####################################################*/
+/* */
+/* received : 1 name */
+/* return : 2 pointers (type FILE) */
+/* */
+/* the 2 files are open in r (in) and w (out) */
+/* */
+/* Thierry LETELLIER 03Oct2005 */
+/* */
+/*####################################################*/
+
+void in_out_file_open(char *name,FILE **in,FILE **out)
+{
+ char *outfilename;
+ int len;
+
+ *in=fopen(name,"r");
+ len=strlen(name);
+ outfilename=(char *)malloc( (len+15)*sizeof(char));
+ sprintf(outfilename,"%s.output_file",name);
+ *out=fopen(outfilename,"w");
+
+}
+
+/*####################################################*/
+/* */
+/* received and return: 1 spectrum */
+/* */
+/* all the information in the spectrum are */
+/* readable in the prediction.h */
+/* */
+/* Thierry LETELLIER 03Oct2005 */
+/* */
+/*####################################################*/
+
+int init_spectrum(spectrum_struct *spectrum, int CTO)
+{
+ int rstatus;
+ int i;
+
+ //the rstatus return code is not test YET
+
+ // spectrum waves initialisation
+ /*------------FES2004-------------------*/
+ rstatus=Wave_select(8,&spectrum[0].wave,2); /*2N2*/
+ rstatus=Wave_select(5,&spectrum[1].wave,2); /*K1*/
+ rstatus=Wave_select(4,&spectrum[2].wave,2); /*K2*/
+ rstatus=Wave_select(1,&spectrum[3].wave,2); /*M2*/
+ rstatus=Wave_select(37,&spectrum[4].wave,2); /*M4*/
+ rstatus=Wave_select(27,&spectrum[5].wave,2);/*Mf*/
+ rstatus=Wave_select(28,&spectrum[6].wave,2);/*Mm*/
+ rstatus=Wave_select(30,&spectrum[7].wave,2);/*Msqm*/
+ rstatus=Wave_select(29,&spectrum[8].wave,2);/*Mtm*/
+ rstatus=Wave_select(3,&spectrum[9].wave,2); /*N2*/
+ rstatus=Wave_select(6,&spectrum[10].wave,2); /*O1*/
+ rstatus=Wave_select(16,&spectrum[11].wave,2); /*P1*/
+ rstatus=Wave_select(7,&spectrum[12].wave,2); /*Q1*/
+ rstatus=Wave_select(2,&spectrum[13].wave,2); /*S2*/
+ /*------------ADMITTED------------------*/
+ /*semidiurne*/
+ rstatus=Wave_select(10,&spectrum[14].wave,2);/*nu2*/
+ rstatus=Wave_select(9, &spectrum[15].wave,2);/*mu2*/
+ rstatus=Wave_select(11,&spectrum[16].wave,2);/*L2*/
+ rstatus=Wave_select(12,&spectrum[17].wave,2);/*T2*/
+ rstatus=Wave_select(13,&spectrum[18].wave,2);/*LA1*/
+ rstatus=Wave_select(14,&spectrum[19].wave,2);/*KJ2*/
+ rstatus=Wave_select(15,&spectrum[20].wave,2);/*R2*/
+ /*diurne*/
+ rstatus=Wave_select(17,&spectrum[21].wave,2);/*OO1*/
+ rstatus=Wave_select(18,&spectrum[22].wave,2);/*J1*/
+ rstatus=Wave_select(19,&spectrum[23].wave,2);/*PHI1*/
+ rstatus=Wave_select(20,&spectrum[24].wave,2);/*PI1*/
+ rstatus=Wave_select(21,&spectrum[25].wave,2);/*PSI1*/
+ rstatus=Wave_select(22,&spectrum[26].wave,2);/*RO1*/
+ rstatus=Wave_select(23,&spectrum[27].wave,2);/*SIG1*/
+ rstatus=Wave_select(24,&spectrum[28].wave,2);/*TTA1*/
+ rstatus=Wave_select(25,&spectrum[29].wave,2);/*2Q1*/
+ rstatus=Wave_select(26,&spectrum[30].wave,2);/*Ki1*/
+ /*long*/
+ rstatus=Wave_select(33,&spectrum[31].wave,2);/*Msm*/
+ rstatus=Wave_select(34,&spectrum[32].wave,2);/*Msf*/
+ rstatus=Wave_select(35,&spectrum[33].wave,2);/*Mqm*/
+ rstatus=Wave_select(36,&spectrum[34].wave,2);/*Mstm*/
+ /*------------computed------------------*/
+ rstatus=Wave_select(31,&spectrum[35].wave,2);/*SSA*/
+
+ //spectrum data initialisation
+ for(i=0;i<13;i++)
+ {
+ spectrum[i].buffer=NULL;
+ spectrum[i].rstatus=-1;
+ sprintf(spectrum[i].PATH,"../data/%s.nc",spectrum[i].wave.name);
+ }
+ for(i=0;i<36;i++) spectrum[i].CTO=CTO;
+ return(0);
+}
+
+
+/*####################################################*/
+/* */
+/* */
+/* init the mega struct P to prepare the */
+/* multithreaded part of the prediction */
+/* */
+/* Thierry LETELLIER 03Oct2005 */
+/* */
+/*####################################################*/
+
+void init_thread_struct(int CPU, mega_struct *P, int CTO,double *lat,double *lon, double *time, double *Otide, spectrum_struct *spectrum, double **amplitude,double **phase)
+{
+ int i,j;
+ for(i=0;i<CPU;i++)
+ {
+ P[i].CTO=CTO;
+ P[i].lat=lat;
+ P[i].lon=lon;
+ P[i].time=time;
+ P[i].Otide=Otide;
+ P[i].amplitude=amplitude;
+ P[i].phase=phase;
+ for(j=0;j<36;j++)P[i].spectrum[j]=spectrum[j];
+ }
+}
+
+
+
+
+/*####################################################*/
+/* */
+/* */
+/* init select the wave in prediction.h */
+/* */
+/* Thierry LETELLIER 03Oct2005 */
+/* this routine is a part of the aktarus lib LEGOS */
+/*####################################################*/
+int Wave_select(int i, tidal_wave *carac,int detided)
+{
+
+ int verbose=1;
+
+switch (i)
+{
+
+ case 1 : {*carac=wM2; break;}
+ case 2 : {*carac=wS2; break;}
+ case 3 : {*carac=wN2; break;}
+ case 4 : {*carac=wK2; break;}
+ case 5 : {*carac=wK1; break;}
+ case 6 : {*carac=wO1; break;}
+ case 7 : {*carac=wQ1; break;}
+ case 8 : {*carac=w2N2; break;}
+/*-----------------------------*/
+ case 9 : {*carac=wMu2; break;}
+ case 10 : { *carac=wNu2;break;}
+ case 11 : {*carac=wL2; break;}
+ case 12 : {*carac=wT2; break;}
+ case 13 : {*carac=wLa2; break;}
+ case 14 :
+ {
+ if (detided==2) {*carac=wKJ2; break;}
+ else {verbose=0;break;}
+ }
+ case 15 :
+ {
+ if (detided==2) {*carac=wR2; break;}
+ else {verbose=0;break;}
+ }
+/*-----------------------------*/
+ case 16 : {*carac=wP1; break;}
+ case 17 : {*carac=wOO1; break;}
+ case 18 : {*carac=wJ1; break;}
+ case 19 : {*carac=wPhi1; break;}
+ case 20 : {*carac=wPi1; break;}
+ case 21 :
+ {
+ if (detided==0) {verbose=0;break; }
+ else {*carac=wPsi1; break;}
+ }
+ case 22 : {*carac=wRo1; break;}
+ case 23 : {*carac=wSig1; break;}
+ case 24 : {*carac=wTta1; break;}
+ case 25 : {*carac=w2Q1; break;}
+ case 26 : {*carac=wKi1; break;}
+/*-----------------------------*/
+ case 27 : {*carac=wMf; break;}
+ case 28 : {*carac=wMm; break;}
+ case 29 : {*carac=wMtm; break;}
+ case 30 :
+ {
+ if (detided==2) {*carac=wMSqm; break;}
+ else {verbose=0;break;}
+ }
+ case 31 : {*carac=wSsa; break;}
+ case 32 : {*carac=wSa; break;}
+ case 33 :
+ {
+ if (detided==2) {*carac=wMSm; break;}
+ else {verbose=0;break;}
+ }
+ case 34 : {*carac=wMSf; break;}
+ case 35 : {*carac=wMqm; break;}
+ case 36 : {*carac=wMStm; break;}
+
+/*-----------------------------*/
+ case 37 : {*carac=wM4; break;}
+ case 38 : {*carac=wMS4; break;}
+ case 39 : {*carac=wMN4; break;}
+ case 40 : {*carac=wS4; break;}
+ case 41 : {*carac=wN4; break;}
+
+/*-----------------------------*/
+ case 42 : {*carac=wS1; break;}
+
+ default : verbose=0;}/*switch*/
+
+
+return(verbose);
+
+
+}/*end*/
+
+
+
+/*####################################################*/
+/* */
+/* init the coef for the splien admittance */
+/* */
+/* Thierry LETELLIER 04Oct2005 */
+/* */
+/*####################################################*/
+
+void init_admittance_coeff(int *sindice,int *aindice,int *nb,int GROUPE)
+{
+ switch(GROUPE)
+ {
+ case SEMI_DIURNAL :
+ {
+ sindice[0]=2;
+ sindice[1]=3;
+ sindice[2]=9;
+ aindice[0]=14;
+ aindice[1]=15;
+ aindice[2]=16;
+ aindice[3]=17;
+ aindice[4]=18;
+ aindice[5]=19;
+ aindice[6]=20;
+ *nb=7;
+ break;
+ }
+ case DIURNAL :
+ {
+ sindice[0]=1;
+ sindice[1]=10;
+ sindice[2]=12;
+ aindice[0]=21;
+ aindice[1]=22;
+ aindice[2]=23;
+ aindice[3]=24;
+ aindice[4]=25;
+ aindice[5]=26;
+ aindice[6]=27;
+ aindice[7]=28;
+ aindice[8]=29;
+ aindice[9]=30;
+ *nb=10;
+ break;
+ }
+ case LONG :
+ {
+ sindice[0]=5;
+ sindice[1]=6;
+ sindice[2]=8;
+ aindice[0]=31;
+ aindice[0]=32;
+ aindice[0]=33;
+ aindice[0]=34;
+ *nb=4;
+ break;
+ }
+ }
+
+}
diff --git a/modules/FES2004_distribution_soft-1.0.9/src/fes2004_io.c b/modules/FES2004_distribution_soft-1.0.9/src/fes2004_io.c
new file mode 100644
index 0000000..15d3020
--- /dev/null
+++ b/modules/FES2004_distribution_soft-1.0.9/src/fes2004_io.c
@@ -0,0 +1,22 @@
+#include "fes2004_lib.h"
+
+
+/*####################################################*/
+/* */
+/* load the FES2004 data from FES2004.nc */
+/* */
+/* Thierry LETELLIER 03Oct2005 */
+/* */
+/*####################################################*/
+void load_netcdf_fes2004_data(char *filename,mega_struct *P,int CPU)
+{
+
+
+ int i,rstatus;
+
+ for(i=0;i<CPU;i++)
+ {
+ rstatus=nc_open( filename, NC_NOWRITE,&P[i].ncid );
+ // if (rstatus != NC_NOERR) handle_error(rstatus);
+ }
+}
diff --git a/modules/FES2004_distribution_soft-1.0.9/src/fes2004_kernel.c b/modules/FES2004_distribution_soft-1.0.9/src/fes2004_kernel.c
new file mode 100644
index 0000000..d1db9bb
--- /dev/null
+++ b/modules/FES2004_distribution_soft-1.0.9/src/fes2004_kernel.c
@@ -0,0 +1,1280 @@
+#include "fes2004_lib.h"
+
+//#define H_THREAD
+//
+// Uncomment this define to compile with the multithread option
+
+
+/*####################################################*/
+/* */
+/* */
+/* running the multithread prediction */
+/* */
+/* */
+/* Thierry LETELLIER 03Oct2005 */
+/* */
+/*####################################################*/
+void multi_t_prediction(int nocycle, int CPU, mega_struct *P)
+{
+
+#ifdef H_THREAD
+ pthread_t *tid;
+#endif
+
+ int cnt,i;
+
+#ifdef H_THREAD
+ tid=malloc(CPU*sizeof(pthread_t));
+ printf("starting a multithread prediction on %d processors \n",CPU);
+#endif
+ cnt=0;
+ while(cnt<nocycle)
+ {
+ for(i=0;i<CPU;i++)
+ {
+ P[i].cnt=cnt;
+#ifdef H_THREAD
+ pthread_create(&tid[i], NULL,pred_coeur,(void *)&(P[i]));
+#else
+ pred_coeur( (void *)&(P[i]) );
+#endif
+ cnt++;
+ }
+#ifdef H_THREAD
+ for (i=0;i<CPU;i++)pthread_join(tid[i], NULL);
+#endif
+
+ if(CPU>(nocycle-cnt))CPU=nocycle-cnt;
+ }/* end loop on AT points*/
+}
+
+
+/*####################################################*/
+/* */
+/* */
+/* running the multithread extraction */
+/* */
+/* */
+/* Thierry LETELLIER 03Oct2005 */
+/* */
+/*####################################################*/
+void multi_t_extraction(int nocycle, int CPU, mega_struct *P)
+{
+
+#ifdef H_THREAD
+ pthread_t *tid;
+#endif
+ int cnt,i;
+
+#ifdef H_THREAD
+ tid=malloc(CPU*sizeof(pthread_t));
+ printf("starting a multithread extraction on %d processors \n",CPU);
+#endif
+ cnt=0;
+ while(cnt<nocycle)
+ {
+ for(i=0;i<CPU;i++)
+ {
+ P[i].cnt=cnt;
+#ifdef H_THREAD
+ pthread_create(&tid[i], NULL,extract_coeur,(void *)&(P[i]));
+#else
+ extract_coeur( (void *)&(P[i]) );
+#endif
+ cnt++;
+ }
+#ifdef H_THREAD
+ for (i=0;i<CPU;i++)pthread_join(tid[i], NULL);
+#endif
+ if(CPU>(nocycle-cnt))CPU=nocycle-cnt;
+ }/* end loop on AT points*/
+}
+
+
+
+
+/*####################################################*/
+/* */
+/* */
+/* the thread prediction function */
+/* */
+/* */
+/* Thierry LETELLIER 03Oct2005 */
+/* */
+/*####################################################*/
+
+void * pred_coeur(void *input)
+{
+ int i,j,cnt;
+ mega_struct *P;
+ double lat,lon,decal_lat,decal_lon;
+
+ size_t start[3],count[3];
+ int indice_y,indice_x,rstatus;
+ double pi;
+
+ double prediction;
+
+ //THE FAMOUS PI
+ pi=acos(-1.0);
+
+ //simplifie the variables name
+ P=(mega_struct *) input;
+ cnt=P->cnt;
+ lat=P->lat[cnt];
+ lon=P->lon[cnt];
+
+ //to recale lat with the indice I must :
+ decal_lat=lat+90;
+ if(lon<0.0) decal_lon=360.0+lon; else decal_lon=lon;
+
+
+ //find the indice in the data tab
+ indice_x=(int) floor( decal_lon/(RESOLUTION) );
+ indice_y=(int) floor( decal_lat /(RESOLUTION) );
+
+ //configure the loading parameters
+ start[0]=0;start[1]=indice_y;start[2]=indice_x;
+ count[0]=14;count[1]=2;count[2]=2;
+
+ //load data
+ rstatus=nc_get_vara_float(P->ncid,3,start,count,P->data_amp );
+ rstatus=nc_get_vara_float(P->ncid,4,start,count,P->data_phi );
+
+ //interpolation
+ rstatus=interpolation_w_mask(decal_lon,decal_lat,indice_x,indice_y,P->weight,P->data_amp);
+
+ if(rstatus==-99)
+ {
+ P->Otide[cnt]=MASK;
+ return;
+ }
+
+ //initialisation of the prediction output
+ P->Otide[cnt]=0;
+
+ //prediction
+ for(i=0;i<4;i++)
+ {
+ if(P->weight[i]!=0.0)
+ {
+ prediction=predic_and_admit(P->data_amp,P->data_phi,i,P,lat,lon);
+ P->Otide[cnt]+=P->weight[i]*prediction;
+ }
+ }
+}/*fin de pred_coeur*/
+
+
+
+
+
+/*####################################################*/
+/* */
+/* */
+/* the thread prediction function */
+/* */
+/* */
+/* Thierry LETELLIER 03Oct2005 */
+/* */
+/*####################################################*/
+
+void * extract_coeur(void *input)
+{
+ int i,j,cnt;
+ mega_struct *P;
+ double lat,lon,decal_lat,decal_lon;
+
+ size_t start[3],count[3];
+ int indice_y,indice_x,rstatus;
+ double pi;
+
+ double prediction;
+
+ //THE FAMOUS PI
+ pi=acos(-1.0);
+
+ //simplifie the variables name
+ P=(mega_struct *) input;
+ cnt=P->cnt;
+ lat=P->lat[cnt];
+ lon=P->lon[cnt];
+
+ //to recale lat with the indice I must :
+ decal_lat=lat+90;
+ if(lon<0.0) decal_lon=360.0+lon; else decal_lon=lon;
+
+
+ //find the indice in the data tab
+ indice_x=(int) floor( decal_lon/(RESOLUTION) );
+ indice_y=(int) floor( decal_lat /(RESOLUTION) );
+
+ //configure the loading parameters
+ start[0]=0;start[1]=indice_y;start[2]=indice_x;
+ count[0]=14;count[1]=2;count[2]=2;
+
+ //load data
+ rstatus=nc_get_vara_float(P->ncid,3,start,count,P->data_amp );
+ rstatus=nc_get_vara_float(P->ncid,4,start,count,P->data_phi );
+
+ //interpolation
+ rstatus=interpolation_w_mask(decal_lon,decal_lat,indice_x,indice_y,P->weight,P->data_amp);
+
+ if(rstatus==-99)
+ {
+ for(i=0;i<14;i++)
+ {
+ P->amplitude[cnt][i]=MASK;
+ P->phase[cnt][i]=MASK;
+ }
+ return;
+ }
+
+ //extraction
+
+ for(i=0;i<14;i++)
+ {
+
+ for(j=0;j<4;j++)
+ {
+ if(i==4) //the M4 case//
+ {
+ if((P->data_amp[i*4+j]!=MASK)&&(P->data_amp[i*4+j]==MASK) )
+ {
+ P->amplitude[cnt][i]=MASK; //M4 has a different Mask
+ P->phase[cnt][i]=MASK;
+ } //M4 has a different Mask
+ }
+ else
+ {
+ P->amplitude[cnt][i]+=P->data_amp[i*4+j]*P->weight[j];
+ P->phase[cnt][i]+=P->data_phi[i*4+j]*P->weight[j];
+ }
+
+ }
+
+ }
+
+}/*fin de extract_coeur*/
+
+
+
+
+/*####################################################*/
+/* */
+/* */
+/* the prediction and admittance function */
+/* */
+/* */
+/* Thierry LETELLIER 04Oct2005 */
+/* */
+/*####################################################*/
+
+double predic_and_admit(float *data_amp,float *data_phi,int pt,mega_struct *P,double lat,double lon)
+{
+ int i;
+ double ampli,phase;
+ double prediction=0;
+ double Amp,G;
+ for(i=0;i<14;i++)
+ {
+ ampli=data_amp[i*4+pt];
+ if(ampli==MASK)
+ {
+ // printf("wave %s is masked --> not inclued in prediction\n lat : %lf --- lon : %lf\n", P->spectrum[i].wave.name,lat,lon);
+ P->spectrum[i].prediction=0;
+ }
+ else
+ {
+ phase=data_phi[i*4+pt];
+ //going the complex space
+ P->spectrum[i].Z.reel=ampli*cos(phase*-1.0*3.14/180.0);
+ P->spectrum[i].Z.imag=ampli*sin(phase*-1.0*3.14/180.0);
+ //prediction !!!!
+ P->spectrum[i].prediction=Tide_prediction(P->time[P->cnt],P->spectrum[i].wave,P->spectrum[i].Z,0,P->CTO);
+ }
+ }
+ /*------------------------------------------------------------------------------*/
+ /* spline admittance coefficients for semi-diurnal tidal waves */
+ /*------------------------------------------------------------------------------*/
+ compute_admittance(P->Mat,P->Perm,P->sec_r,P->sec_i,P->res_r,P->res_i,P->spectrum, SEMI_DIURNAL,P->sindice,P->aindice);
+
+ /*------------------------------------------------------------------------------*/
+ /* spline admittance coefficients for diurnal tidal waves */
+ /*------------------------------------------------------------------------------*/
+ compute_admittance(P->Mat,P->Perm,P->sec_r,P->sec_i,P->res_r,P->res_i,P->spectrum, DIURNAL,P->sindice,P->aindice);
+
+ /*------------------------------------------------------------------------------*/
+ /* spline admittance coefficients for long period tidal waves */
+ /*------------------------------------------------------------------------------*/
+ compute_admittance(P->Mat,P->Perm,P->sec_r,P->sec_i,P->res_r,P->res_i,P->spectrum, LONG,P->sindice,P->aindice);
+
+ /*------------------------------------------------------------------------------*/
+ /* compute prediction for Ssa tidal wave */
+ /*------------------------------------------------------------------------------*/
+ tidal_potential( P->spectrum[35].wave, lat, lon, &Amp, &G,0 );
+ P->spectrum[35].Z.reel=Amp*cos(G);
+ P->spectrum[35].Z.imag=Amp*sin(G);
+ P->spectrum[35].prediction=Tide_prediction(P->time[P->cnt],P->spectrum[34].wave,P->spectrum[34].Z,0,P->CTO);
+
+ for(i=0;i<36;i++)prediction+=P->spectrum[i].prediction;
+ return(prediction);
+
+}
+
+
+
+
+
+/*####################################################*/
+/* */
+/* */
+/* an simple interpolation funtion */
+/* */
+/* it take in account the mask */
+/* */
+/* Thierry LETELLIER 04Oct2005 */
+/* */
+/*####################################################*/
+
+int interpolation_w_mask(double lon,double lat,int indice_x,int indice_y,double *weight,float *data_amp)
+{
+ int i,nb_data;
+ int mask_true[4],redo;
+ double surface;
+ //DEBUG
+ double somme;
+
+ nb_data=4;
+ //init mask_true
+ for(i=0;i<4;i++)mask_true[i]=1;
+
+ for(i=0;i<4;i++){if(data_amp [i]==MASK) {mask_true[i]=0; nb_data--; } }
+
+ redo=1;
+ while(redo==1)
+ {
+ switch (nb_data)
+ {
+ case 0 :
+ {
+ return(-99);
+ break;
+ }
+ case 1 :
+ {
+ for(i=0;i<4;i++)weight[i]=1.00*mask_true[i];
+ redo=0;
+ break;
+ }
+ case 2 :
+ {
+ weight[0]=geo_d_km(lon,lat,indice_x*RESOLUTION,indice_y*RESOLUTION) * mask_true[0];
+ weight[1]=geo_d_km(lon,lat,(indice_x+1)*RESOLUTION,indice_y*RESOLUTION) * mask_true[1];
+ weight[2]=geo_d_km(lon,lat,indice_x*RESOLUTION,(indice_y+1)*RESOLUTION) * mask_true[2];
+ weight[3]=geo_d_km(lon,lat,(indice_x+1)*RESOLUTION,(indice_y+1)*RESOLUTION) * mask_true[3];
+ redo=0;
+ break;
+ }
+ case 3 :
+ {
+ surface=RESOLUTION*RESOLUTION;
+ somme=( (indice_x+1)*RESOLUTION - lon )*((indice_y+1)*RESOLUTION - lat);
+ if(somme==0){mask_true[0]=0;nb_data--;break;}
+ weight[0]=surface*somme;
+
+ somme=( lon - indice_x*RESOLUTION )*((indice_y+1)*RESOLUTION - lat);
+ if(somme==0){mask_true[0]=0;nb_data--;break;}
+ weight[1]=surface*somme;
+
+ somme=( (indice_x+1)*RESOLUTION - lon )*(lat - indice_y*RESOLUTION);
+ if(somme==0){mask_true[0]=0;nb_data--;break;}
+ weight[2]=surface*somme;
+
+ somme=( lon - indice_x*RESOLUTION )*(lat - indice_y*RESOLUTION);
+ if(somme==0){mask_true[0]=0;nb_data--;break;}
+ weight[3]=surface*somme;
+ redo=0;
+
+ break;
+ }
+ case 4 :
+ {
+ surface=RESOLUTION*RESOLUTION;
+ somme=( (indice_x+1)*RESOLUTION - lon )*((indice_y+1)*RESOLUTION - lat);
+ if(somme==0){mask_true[0]=0;nb_data--;break;}
+ weight[0]=surface*somme;
+
+ somme=( lon - indice_x*RESOLUTION )*((indice_y+1)*RESOLUTION - lat);
+ if(somme==0){mask_true[0]=0;nb_data--;break;}
+ weight[1]=surface*somme;
+
+ somme=( (indice_x+1)*RESOLUTION - lon )*(lat - indice_y*RESOLUTION);
+ if(somme==0){mask_true[0]=0;nb_data--;break;}
+ weight[2]=surface*somme;
+
+ somme=( lon - indice_x*RESOLUTION )*(lat - indice_y*RESOLUTION);
+ if(somme==0){mask_true[0]=0;nb_data--;break;}
+ weight[3]=surface*somme;
+ redo=0;
+ break;
+ }
+ }
+
+ }
+ surface=weight[0]+weight[1]+weight[2]+weight[3];
+
+ weight[0]/=surface;
+ weight[1]/=surface;
+ weight[2]/=surface;
+ weight[3]/=surface;
+
+ //DEBUG
+ somme=weight[0]+weight[1]+weight[2]+weight[3];
+
+ return(0);
+
+}
+
+
+
+
+/*####################################################*/
+/* */
+/* */
+/* compute the admittance to extend */
+/* the prediction spectrum */
+/* */
+/* Thierry LETELLIER 04Oct2005 */
+/* */
+/*####################################################*/
+
+void compute_admittance(gsl_matrix *Mat,gsl_permutation *Perm,gsl_vector *sec_r,gsl_vector *sec_i,gsl_vector *res_r,gsl_vector *res_i,spectrum_struct *spectrum,int GROUPE,int *sindice ,int *aindice)
+{
+
+ int i,n,gsl_out;
+ double d2r,tau;
+ int signum;
+ double omega;
+ int nb;
+
+ d2r=pi/180.0;
+ tau=2*24;
+ n=0;
+
+ init_admittance_coeff(sindice,aindice,&nb,GROUPE);
+
+ for(i=0;i<3;i++)
+ {
+ omega=pulsation(spectrum[sindice[i]].wave);
+ gsl_matrix_set(Mat,n,0,cos(tau*omega*d2r)*spectrum[sindice[i]].wave.Ap);
+ gsl_matrix_set(Mat,n,1,sin(tau*omega*d2r)*spectrum[sindice[i]].wave.Ap);
+ gsl_matrix_set(Mat,n,2,spectrum[sindice[i]].wave.Ap);
+ gsl_vector_set(sec_r,n,spectrum[sindice[i]].Z.reel);
+ gsl_vector_set(sec_i,n,spectrum[sindice[i]].Z.imag);
+ n++;
+ }
+ gsl_out=gsl_linalg_LU_decomp(Mat,Perm,&signum);
+ gsl_out=gsl_linalg_LU_solve(Mat,Perm,sec_r,res_r);
+ gsl_out=gsl_linalg_LU_solve(Mat,Perm,sec_i,res_i);
+
+ for(i=0;i<nb;i++)
+ {
+ omega=pulsation(spectrum[aindice[i]].wave);
+
+ spectrum[aindice[i]].Z.reel=(gsl_vector_get(res_r,0)*cos(tau*omega*d2r)+gsl_vector_get(res_r,1)*sin(tau*omega*d2r)+gsl_vector_get(res_r,2))*spectrum[aindice[i]].wave.Ap;
+ spectrum[aindice[i]].Z.imag=(gsl_vector_get(res_i,0)*cos(tau*omega*d2r)+gsl_vector_get(res_i,1)*sin(tau*omega*d2r)+gsl_vector_get(res_i,2))*spectrum[aindice[i]].wave.Ap;
+ spectrum[aindice[i]].prediction=Tide_prediction(spectrum[aindice[i]].time,spectrum[aindice[i]].wave,spectrum[aindice[i]].Z,0,spectrum[aindice[i]].CTO);
+ }
+
+}
+
+
+/*XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX*/
+
+ double geo_d_km(double t1,double p1,double t2,double p2)
+
+/*XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX*/
+
+{
+ double dt,dp;
+ double a1,a2,b1,b2,ux,uy,uz,vx,vy,vz,pds,angle;
+ double ro;
+ double pi=M_PI;
+
+ double dtr=pi/180.0;
+
+
+ dt=t2-t1;
+ dp=p2-p1;
+
+ if ((dt == 0.0) && (dp == 0.0)) return(0.);
+
+ a1=t1*dtr;
+ b1=p1*dtr;
+ a2=t2*dtr;
+ b2=p2*dtr;
+
+ ux=cos(a1)*cos(b1);
+ uy=sin(a1)*cos(b1);
+ uz=sin(b1);
+ vx=cos(a2)*cos(b2);
+ vy=sin(a2)*cos(b2);
+ vz=sin(b2);
+
+ pds=ux*vx+uy*vy+uz*vz;
+
+ if(pds < 1.0)
+ {
+ angle=acos(pds);
+ /* Conversion real double de geo_mean_radius*/
+ ro=(double)(6400.*angle);
+ return(ro);
+ }
+ else return(0.);
+
+}
+
+
+
+
+
+
+//##############################################################################################################################
+//##############################################################################################################################
+//##############################################################################################################################
+//##############################################################################################################################
+//##############################################################################################################################
+
+
+
+//##############################################################################################################################
+//##############################################################################################################################
+//##############################################################################################################################
+//##############################################################################################################################
+//##############################################################################################################################
+
+
+
+//##############################################################################################################################
+//##############################################################################################################################
+//##############################################################################################################################
+//##############################################################################################################################
+//##############################################################################################################################
+
+// the next functions are a part of the Aktarus tide library developped
+// By Thierry LETELLIER [LEGOS]
+// and Laurent ROBLOU [Noveltis]
+//
+// These functions are the prediction kernel YOU DON'T NEED TO CHANGE THEM ...
+// ----------------------------------
+
+// You don't have the right to use these functions in other programs than the FES2004 prediction
+// If you want more information please contact --- thierry.letellier at free.fr ---
+
+
+//##############################################################################################################################
+//##############################################################################################################################
+//##############################################################################################################################
+//##############################################################################################################################
+//##############################################################################################################################
+
+
+
+
+
+
+double Tide_prediction(double time,tidal_wave wave,fcomplex Z,int verbose,int CTO)
+/*---------------------------------------------------------------*/
+/* The prediction is made from a true complex, */
+/* Z = (A cos(-G), A sin(-G) ) */
+/*---------------------------------------------------------------*/
+{
+ double V,f,ret;
+ astro_ang_struct astro_ang;
+
+ init_argument(time,verbose,CTO,&astro_ang);
+ V=greenwhich_argument(wave,&astro_ang)+nodal_phase(wave,&astro_ang);
+ f=nodal_factort(wave.formula,&astro_ang);
+
+ ret=f*(cos(V)*Z.reel-sin(V)*Z.imag);
+ return(ret);
+}
+
+
+/*XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX*/
+
+ void init_argument(double first_time, int verbose, int CTO,astro_ang_struct *astro_ang)
+
+/*XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX*/
+
+{
+ int i,N;
+
+ double scale=36525*24.0;
+
+ date_t t_schureman={1,1,1900,0.0}; /* LR: 21/07/2003, -43200 -> 0 */
+ date_t date58= { 1, 1, 1958, 0.0};/* LR: 21/07/2003, -43200 -> 0 */
+ date_t date50= { 1, 1, 1950, 0.0};/* LR: 21/07/2003, -43200 -> 0 */
+ date_t date85= { 1, 1, 1985, 0.0};/* LR: 21/07/2003, -43200 -> 0 */
+ date_t date2000= { 1, 1, 2000, 0.0};/* LR: 21/07/2003, -43200 -> 0 */
+ date_t date;
+ double tj;
+
+
+ switch (CTO)
+ {
+ case(0): {date =date50;break;}
+ case(1): {date =date58;break;}
+ case(2): {date =date85;break;}
+ case(3): {date =date2000;break;}
+ default: {printf("error in time reference, exit\n");exit(22);}
+ }
+
+ N= julian_day(date.month,date.day,date.year)
+ -julian_day(t_schureman.month,t_schureman.day,t_schureman.year);
+ /* number of day elapsed between 1950 and 1900 (CNES Time and SCHUREMAN Time) */
+ /*or number of day elapsed between 1958 and 1900 (CTO Time and SCHUREMAN Time) */
+ /*or number of day elapsed between 1985 and 1900 (ESA Time and SCHUREMAN Time) */
+
+ tj=((double) N + first_time/(double) 24.) /(double) 36525.0;
+
+ astronomic_angle(tj,verbose,astro_ang);
+
+}
+
+/*XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX*/
+
+ void astronomic_angle(double tj, int verbose, astro_ang_struct *astro_ang)
+
+/*XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX*/
+
+
+/*----------------------------------------------------------------------
+
+ tj is time elapsed since 1st January 1900, 0 hour, counted in julian
+ century (e.g. time in days divide by 36525)
+----------------------------------------------------------------------*/
+
+{
+ double dtr,days,tt;
+ date_t actual;
+ double cosI,p,q;
+ double t2,t4,sin2I,s2;
+ double tgI2,P;
+ double sh_tgn2,at1,at2;
+
+ pi=acos(-1.0);
+ dtr=pi/180.0;
+
+/*----------------------------------------------------------------------
+ Sh_n Longitude of ascending lunar node
+----------------------------------------------------------------------*/
+
+ astro_ang->sh_N=(259.1560563 -1934.1423972 *tj)*dtr;
+
+/*----------------------------------------------------------------------
+ T mean solar angle (Greenwhich time)
+----------------------------------------------------------------------*/
+ days=36525.0*tj;
+ astro_ang->sh_T=((days - (int)days)*24.0*15.0+180.0)*dtr;
+
+/*----------------------------------------------------------------------
+ h mean solar Longitude
+----------------------------------------------------------------------*/
+
+ astro_ang->sh_h=(280.1895015 +36000.76892 *tj)*dtr;
+
+/*----------------------------------------------------------------------
+ s mean lunar Longitude
+----------------------------------------------------------------------*/
+
+ astro_ang->sh_s=(277.0256206 +481267.892 *tj)*dtr;
+
+/*----------------------------------------------------------------------
+ p1 Longitude of solar perigee
+----------------------------------------------------------------------*/
+
+ astro_ang->sh_p1=(281.2208568 +1.719175 *tj)*dtr;
+
+/*----------------------------------------------------------------------
+ p Longitude of lunar perigee
+----------------------------------------------------------------------*/
+
+ astro_ang->sh_p=(334.3837214 +4069.0322056 *tj)*dtr;
+
+ astro_ang->sh_N =fmod(astro_ang->sh_N ,2*pi);
+ astro_ang->sh_s =fmod(astro_ang->sh_s ,2*pi);
+ astro_ang->sh_h =fmod(astro_ang->sh_h, 2*pi);
+ astro_ang->sh_p =fmod(astro_ang->sh_p, 2*pi);
+ astro_ang->sh_p1=fmod(astro_ang->sh_p1,2*pi);
+
+ cosI=0.913694997 -0.035692561 *cos(astro_ang->sh_N);
+
+ astro_ang->sh_I=acos(cosI);
+
+ sin2I=sin(astro_ang->sh_I);
+ sh_tgn2=tan(astro_ang->sh_N/2.0);
+
+ at1=atan(1.01883*sh_tgn2);
+ at2=atan(0.64412*sh_tgn2);
+
+ astro_ang->sh_xi=-at1-at2+astro_ang->sh_N;
+
+ if (astro_ang->sh_N > pi) astro_ang->sh_xi=astro_ang->sh_xi-2.0*pi;
+
+ astro_ang->sh_nu=at1-at2;
+
+/*----------------------------------------------------------------------
+ For constituents l2 k1 k2
+----------------------------------------------------------------------*/
+
+ tgI2=tan(astro_ang->sh_I/2.0);
+ P=astro_ang->sh_p-astro_ang->sh_xi;
+
+ t2=tgI2*tgI2;
+ t4=t2*t2;
+ astro_ang->sh_x1ra=sqrt(1.0-12.0*t2*cos(2.0*P)+36.0*t4);
+
+ p=sin(2.0*P);
+ q=1.0/(6.0*t2)-cos(2.0*P);
+ astro_ang->sh_R=atan(p/q);
+
+ p=sin(2.0*astro_ang->sh_I)*sin(astro_ang->sh_nu);
+ q=sin(2.0*astro_ang->sh_I)*cos(astro_ang->sh_nu)+0.3347;
+ astro_ang->sh_nuprim=atan(p/q);
+
+ s2=sin(astro_ang->sh_I)*sin(astro_ang->sh_I);
+ p=s2*sin(2.0*astro_ang->sh_nu);
+ q=s2*cos(2.0*astro_ang->sh_nu)+0.0727;
+ astro_ang->sh_nusec=0.5*atan(p/q);
+
+ tt=(tj*36525.-18262)*24;
+ getcnesdate(tt,&actual);
+
+
+ if (verbose)
+ {
+ printf ("%d/%d/%d \n",actual.day,actual.month,actual.year);
+ printf ("s: %f h: %f p: %f p1: %f \n",astro_ang->sh_s/dtr,astro_ang->sh_h/dtr,astro_ang->sh_p/dtr,astro_ang->sh_p1/dtr);
+ printf ("I: %f N: %f \n",astro_ang->sh_I/dtr,astro_ang->sh_N/dtr);
+ }
+
+}
+
+
+/*XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX*/
+
+ double greenwhich_argument(tidal_wave w,astro_ang_struct *astro_ang)
+
+/*XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX*/
+/*----------------------------------------------------------------------
+
+ Returns the phase of the tidal potential relative to the Greenwhich
+ meridian (e.g. the position of the fictuous celestial body). Units are
+ radian.
+
+----------------------------------------------------------------------*/
+
+{
+ double V0;
+
+ V0=astro_ang->sh_T*w.nT+astro_ang->sh_s*w.ns+astro_ang->sh_h*w.nh+astro_ang->sh_p*w.np+astro_ang->sh_p1*w.np1+w.shift*deg_to_rad;
+ V0=fmod(V0,pi2);
+ return(V0);
+
+}
+/*XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX*/
+
+ double nodal_phase(tidal_wave w,astro_ang_struct *astro_ang)
+
+/*XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX*/
+/*----------------------------------------------------------------------
+
+ Returns the phase correction u due to nodal motion. Units are radian.
+
+----------------------------------------------------------------------*/
+
+{
+ double u;
+
+ u=astro_ang->sh_xi*w.nksi+astro_ang->sh_nu*w.nnu0+astro_ang->sh_nuprim*w.nnu1+astro_ang->sh_nusec*w.nnu2+astro_ang->sh_R*w.R;
+ return(u);
+
+}
+/*XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX*/
+
+int julian_day(int mm,int id,int iyyy)
+
+/*XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX*/
+
+/*-----------------------------------------------------------------------
+ tides_julianday routine returns the julian day number which begins at noon
+ of the calendar date specified by month mm, day id, and year iyyy.
+ positive year signifies a.d.; negative, b.c. (remember that the
+ year after 1 b.c. was 1 a.d.
+ this routine has been lifted directly from the book
+ press et al., numerical recipes, cambridge univ. press, 1986.
+ routine handles changeover to gregorian calendar on oct. 15, 1582.
+ note: to get the corresponding modified julian day,
+ set mjd = julday - 2400001.
+
+ f77 to C: 7/10/2001 (Thierry)
+-----------------------------------------------------------------------*/
+
+ {
+ int igreg=15+31*(10+12*1582);
+ int jy,jm,ja, tmp_iyyy;
+ double temp_tides_juliandays;
+
+ tmp_iyyy=iyyy;
+
+ if (tmp_iyyy != 0)
+/* if (tmp_iyyy == 2000) printf("Probleme avec le passage a l annee 2000"); */
+/* else */
+ {
+ if (tmp_iyyy < 0) tmp_iyyy = tmp_iyyy + 1;
+ if (mm > 2)
+ {
+ jy = tmp_iyyy;
+ jm = mm + 1;
+ }
+ else
+ {
+ jy = tmp_iyyy - 1;
+ jm = mm + 13;
+ }
+ temp_tides_juliandays=floor(365.25*jy)+floor(30.6001*jm)+id+1720995;
+ if(id+31*(mm+12*tmp_iyyy) >= igreg)
+ {
+ ja=floor(0.01*jy);
+ temp_tides_juliandays=temp_tides_juliandays+2-ja+floor(0.25*ja);
+ }
+ }/*else*/
+
+ return(temp_tides_juliandays);
+
+ }/*end*/
+/*XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX*/
+
+double nodal_factort(int formula, astro_ang_struct *astro_ang)
+
+/*XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX*/
+{
+ double s,f;
+
+ switch (formula)
+ {
+
+/* formule 0, solar waves */
+
+ case 0:
+ f=1.0;
+ break;
+
+/* formule 1, compound waves (78 x 78)*/
+
+ case 1:
+ f=nodal_factort(78,astro_ang)*nodal_factort(78,astro_ang);
+ break;
+
+/* formule 2, compound waves (78 x 0) === (78)*/
+
+ case 2:
+ f=nodal_factort(78,astro_ang)*nodal_factort(0,astro_ang);
+ break;
+
+
+
+/* formule 4, compound waves (78 x 235) */
+
+ case 4:
+ f=nodal_factort(78,astro_ang)*nodal_factort(235,astro_ang);
+ break;
+
+
+/* formule 5, compound waves (78 *78 x 235) */
+
+ case 5:
+ f=nodal_factort(78,astro_ang)*nodal_factort(78,astro_ang)*nodal_factort(235,astro_ang);
+ break;
+
+/* formule 6, compound waves (78 *78 x 0) */
+
+ case 6:
+ f=nodal_factort(78,astro_ang)*nodal_factort(78,astro_ang)*nodal_factort(0,astro_ang);
+ break;
+
+/* formule 7, compound waves (75 x 75)*/
+
+ case 7:
+ f=nodal_factort(75,astro_ang)*nodal_factort(75,astro_ang);
+ break;
+
+/* formule 8, compound waves (78 x 0 x 235) */
+
+ case 8:
+ f=nodal_factort(78,astro_ang)*nodal_factort(0,astro_ang)*nodal_factort(235,astro_ang);
+ break;
+
+/* formule 9, compound waves (78 x 0 x 227) */
+
+ case 9:
+ f=nodal_factort(78,astro_ang)*nodal_factort(0,astro_ang)*nodal_factort(227,astro_ang);
+ break;
+
+/* formule 10, compound waves (78 x 227) */
+
+ case 10:
+ f=nodal_factort(78,astro_ang)*nodal_factort(227,astro_ang);
+ break;
+
+/* formule 11, compound waves (75 x 0) */
+
+ case 11:
+ f=nodal_factort(75,astro_ang)*nodal_factort(0,astro_ang);
+ break;
+
+/* formule 12, compound waves (78 x 78 x 78 x 0) */
+
+ case 12:
+ f=nodal_factort(78,astro_ang)*nodal_factort(78,astro_ang)*nodal_factort(78,astro_ang)*nodal_factort(0,astro_ang);
+ break;
+
+/* formule 13, compound waves (78 x 75)*/
+
+ case 13:
+ f=nodal_factort(78,astro_ang)*nodal_factort(75,astro_ang);
+ break;
+
+/* formule 14, compound waves (235 x 0) === (235)*/
+
+ case 14:
+ f=nodal_factort(235,astro_ang)*nodal_factort(0,astro_ang);
+ break;
+
+/* formule 15, compound waves (235 x 75) */
+
+ case 15:
+ f=nodal_factort(235,astro_ang)*nodal_factort(75,astro_ang);
+ break;
+
+/* formule 16, compound waves (78 x 0 x 0) === (78)*/
+
+ case 16:
+ f=nodal_factort(78,astro_ang)*nodal_factort(0,astro_ang)*nodal_factort(0,astro_ang);
+ break;
+
+/* formule 17, compound waves (227 x 0) */
+
+ case 17:
+ f=nodal_factort(227,astro_ang)*nodal_factort(0,astro_ang);
+ break;
+
+/* formule 18, compound waves (78 x 78 x 78 ) */
+
+ case 18:
+ f=nodal_factort(78,astro_ang)*nodal_factort(78,astro_ang)*nodal_factort(78,astro_ang);
+ break;
+
+/* formule 19, compound waves (78 x 0 x 0 x 0) === (78)*/
+
+ case 19:
+ f=nodal_factort(78,astro_ang)*nodal_factort(0,astro_ang)*nodal_factort(0,astro_ang);
+ break;
+
+
+/* formule 73 */
+
+ case 73:
+ s=sin(astro_ang->sh_I);
+ f=(2./3.-s*s)/0.5021;
+ break;
+
+/* formule 74 */
+
+ case 74:
+ s=sin(astro_ang->sh_I);
+ f=s*s/0.1578;
+ break;
+
+/* formule 75 */
+
+ case 75:
+ s=cos (astro_ang->sh_I/2);
+ f=sin (astro_ang->sh_I)*s*s/0.3800;
+ break;
+
+/* formule 76 */
+
+ case 76:
+ f=sin (2*astro_ang->sh_I)/0.7214;
+ break;
+
+/* formule 77 */
+
+ case 77:
+ s=sin (astro_ang->sh_I/2);
+ f=sin (astro_ang->sh_I)*s*s/0.0164;
+ break;
+
+/* formule 78 */
+
+ case 78:
+ s=cos (astro_ang->sh_I/2);
+ f=s*s*s*s/0.9154;
+ break;
+
+/* formule 79 */
+
+ case 79:
+ s=sin(astro_ang->sh_I);
+ f=s*s/0.1565;
+ break;
+
+/* formule 144 */
+
+ case 144:
+ s=sin (astro_ang->sh_I/2);
+ f=(1-10*s*s+15*s*s*s*s)*cos(astro_ang->sh_I/2)/0.5873;
+ break;
+
+/* formule 149 */
+
+ case 149:
+ s=cos (astro_ang->sh_I/2);
+ f=s*s*s*s*s*s/0.8758;
+ break;
+
+/* formule 215 */
+
+ case 215:
+ s=cos (astro_ang->sh_I/2);
+ f=s*s*s*s/0.9154*astro_ang->sh_x1ra;
+ break;
+
+/* formule 227 */
+
+ case 227:
+ s=sin (2*astro_ang->sh_I);
+ f=sqrt (0.8965*s*s+0.6001*s*cos (astro_ang->sh_nu)+0.1006);
+ break;
+
+/* formule 235 */
+
+ case 235:
+ s=sin (astro_ang->sh_I);
+ f=sqrt (19.0444*s*s*s*s+2.7702*s*s*cos (2*astro_ang->sh_nu)+.0981);
+ break;
+
+
+ default:
+ exit;
+ }
+ return(f);
+}
+/*-----------------------------------------------------------------------*/
+
+void calendary(int njd,date_t *actual)
+
+/*-----------------------------------------------------------------------*/
+
+{
+ int njul,nj,nb,nm1,nj3,m,j,ndj;
+ int na,nm,nd;
+ int n[12]= {31,28,31,30,31,30,31,31,30,31,30,31};
+
+/*-----------------------------------------------------------------------
+! Input = njd: nombre ecoules depuis le 1er Janvier 1950, 0 heure
+! Output= nd,nm,na: jour, mois annee calendaire
+!-----------------------------------------------------------------------*/
+
+ njul=njd+1;
+ na=njul/365;
+ nj=njul-na*365;
+ nb=(na+1)/ 4;
+ nj=nj-nb;
+
+ if (nj > 0) goto a1;
+
+ na=na+1949;
+ nm=12;
+ nd=nj+31;
+ goto a9000;
+
+ a1:
+ j=na-2-nb*4;
+ na=na+1950;
+
+ if (j < 0) goto a5000;
+
+ a4000:
+ if (60-nj < 0) goto a4500;
+ if (60-nj == 0) goto a7000;
+ goto a5000;
+
+ a4500:
+ nm1=60;
+
+ m=3;
+ goto a6000;
+
+ a5000:
+ nm1=0;
+
+ m=1;
+
+ a6000:
+ ndj=nm1+n[m-1];
+
+ nj3=nj-ndj;
+
+ if (nj3 <= 0) goto a8000;
+
+ a6500:
+ m=m+1;
+
+ nm1=ndj;
+ goto a6000;
+
+ a7000:
+ nm=2;
+
+ nd=29;
+
+ goto a9000;
+
+ a8000:
+ nm=m;
+
+ nd=nj-nm1;
+
+ a9000:
+ actual->year=na;
+ actual->month=nm;
+ actual->day=nd;
+ actual->second=0;
+
+}
+
+/*-------------------------------------------*/
+
+void getcnesdate(double t,date_t *actual)
+
+/*-------------------------------------------*/
+{
+ int N,nday;
+ float second;
+
+/* t is time elapsed from 1/1/1950 in hours */
+
+ nday=floor(t/24.0);
+
+ calendary(nday,actual);
+ second=(t-nday*24)*3600.;
+ actual->second=second;
+}
+
+
+/*XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX*/
+
+double pulsation( tidal_wave wave)
+
+/*XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX*/
+/* redundant with tide_wavearray_initC */
+
+{
+ int verbose,dummy=0;
+ double scale=36525*24.0;
+ double omega;
+
+
+double omega_T= 13149000.0;
+double omega_s= 481267.892;
+double omega_h= 36000.76892;
+double omega_p= 4069.0322056;
+double omega_n= 1934.1423972;
+double omega_p1= 1.719175;
+
+ omega = omega_T * wave.nT
+ + omega_s * wave.ns
+ + omega_h * wave.nh
+ + omega_p * wave.np
+ + omega_p1* wave.np1;
+ omega /= scale;
+ return(omega);
+}
+
+
+/*--------------------------------------------------------------------------------*/
+
+void tidal_potential(tidal_wave wave,double lat,double lon, double *Amp, double *G,int terrestre)
+
+/*--------------------------------------------------------------------------------*/
+{
+ float k2=0.3,h2=0.6;
+ double C,S,a,dV,pi,dtr;
+
+ pi=acos(-1.0);
+ dtr=pi/180.0;
+
+ if (terrestre) a=wave.Ap*h2;
+ else a=wave.Ap*(1+k2-h2);
+ switch (wave.nT)
+ {
+ case (0):
+
+/*######################### Long period tide #########################
+
+ potential/g = A*(1/2 -3/2 sin^2(Y)*cos(w*t+V0)
+
+ dP/dx= 0
+ dP/dy= -3*A*cos(Y)sin(Y)*cos(w*t+V0)
+
+----------------------------------------------------------------------*/
+ dV=0.0;
+ C=cos(lat*dtr);
+ S=sin(lat*dtr);
+ *Amp = a*(0.5-1.5*S*S)/100;
+ *G = -dV*dtr;
+ break;
+
+ case (1):
+
+/*########################### Diurnal tide ###########################
+
+ potential/g = A*sin(2Y)*cos(w*t+V0+X)
+
+----------------------------------------------------------------------*/
+
+ dV=lon;
+ C=cos(lat*dtr);
+ S=sin(lat*dtr);
+ *Amp = 2*a*S*C/100;
+ *G = -dV*dtr;
+ break;
+
+ case (2):
+
+/*######################### Semi-diurnal tide #########################
+
+ potential/g = A*cos^2(Y)*cos(w*t+V0+2*X)
+
+----------------------------------------------------------------------*/
+
+ dV=2*lon;
+ C=cos(lat*dtr);
+ S=sin(lat*dtr);
+ *Amp = a*C*C/100;
+ *G = -dV*dtr;
+ break;
+
+/*####################### non-astronomical tide #######################
+ potential/g = 0
+
+----------------------------------------------------------------------*/
+ default:
+ break;
+
+ }/*end switch */
+}/* end*/
+
diff --git a/modules/FES2004_distribution_soft-1.0.9/src/fes2004_lib.h b/modules/FES2004_distribution_soft-1.0.9/src/fes2004_lib.h
new file mode 100644
index 0000000..738b60a
--- /dev/null
+++ b/modules/FES2004_distribution_soft-1.0.9/src/fes2004_lib.h
@@ -0,0 +1,419 @@
+
+
+
+/*####################################################*/
+/* */
+/* Includes for the prediction program */
+/* */
+/* Thierry LETELLIER 03Oct2005 */
+/* */
+/*####################################################*/
+// standard include //
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <string.h>
+#include <strings.h>
+#include <malloc.h>
+
+// standard multithread include //
+//#include <pthread.h>
+
+// netcdf include //
+#include <netcdf.h>
+
+// Gnu Scientific library include //
+// www.gnu.org/software/gsl/ //
+#include "gsl/gsl_cblas.h"
+#include "gsl/gsl_linalg.h"
+#include "gsl/gsl_vector.h"
+#include "gsl/gsl_matrix.h"
+#include "gsl/gsl_permutation.h"
+
+
+/*####################################################*/
+/* */
+/* constantes definitions */
+/* */
+/* Thierry LETELLIER 03Oct2005 */
+/* */
+/*####################################################*/
+#define coef_spline 3
+#define NB_WAVE_IN_SPECTRUM 36
+#define RESOLUTION 0.125
+#define SEMI_DIURNAL 1
+#define DIURNAL 2
+#define LONG 3
+
+#define MASK -9999.000
+
+/*####################################################*/
+/* */
+/* variables struct definitions */
+/* */
+/* Thierry LETELLIER 03Oct2005 */
+/* */
+/*####################################################*/
+
+//wave struct contains all the tials waves parameters
+typedef struct {
+ float Ap; /* specify tidal potentiel amplitude */
+ int nT,ns,nh,np,np1; /* specify the main wave fequency V */
+ int nksi,nnu0,nnu1,nnu2,R; /* specify nodal argument u */
+ float shift; /* specify nodal argument u */
+ int formula,code; /* formula index for nodal factor f + code for JMM */
+ double omega; /* specify pulsation, redondant with nT,ns,nh,np,np1 */
+ char name[10]; /* */
+ char spec;
+ int admit;
+} tidal_wave;
+
+//simple complex definition
+typedef struct
+ {
+ float reel,imag;
+ } fcomplex;
+
+//the struct that contains all the predicted wave parameters
+typedef struct
+{
+ fcomplex *buffer;
+ tidal_wave wave;
+ fcomplex mask,Z;
+ char PATH[256];
+ int rstatus, headN ,founded,CTO;
+ double lat,lon,time, prediction;
+} spectrum_struct;
+
+
+
+typedef struct
+{
+ double amp,phi;
+} wave_cst_struct;
+
+/* typedef struct */
+/* { */
+/* wave_cst_struct M2,M4,K1,K2,O1,P1,Q1,S2,N2,DN2,MM,MF,MTM,MSQM; */
+/* wave_cst_struct NU2,MU2,L2,T2,LA2,KJ2,R2,OO1,J1,PHI1,PI1,PSI1,RO1,SIG1,TTA1,DQ1,KI1,MSM,MSF,MQM,MSTM,SSA; */
+
+/* } fes2004_extract_struct; */
+
+
+
+
+//the multithread struct
+typedef struct
+{
+ int cnt,CTO,ncid;
+ double *lat,*lon,*time,*Otide;
+ spectrum_struct *spectrum;
+ gsl_matrix *Mat;
+ gsl_vector *sec_r,*sec_i,*res_r,*res_i;
+ gsl_permutation *Perm;
+ //fes2004_extract_struct *constante;
+ double **amplitude,**phase;
+ //allocatable variable need in the thread
+ float *data_amp;
+ float *data_phi;
+ double *weight;
+ int *sindice,*aindice;
+} mega_struct;
+
+typedef struct
+{
+ double sh_T,sh_h,sh_s,sh_p1,sh_p;
+ double sh_xi,sh_nu,sh_R,sh_x1ra,sh_nuprim,sh_nusec;
+ double sh_I,sh_N;
+}astro_ang_struct;
+
+typedef struct
+{
+ int day,month,year; /* Gregorian date (define uniquely a given day) */
+ float second; /* elapsed time in second from 0h00)*/
+} date_t;
+
+
+
+
+/*####################################################*/
+/* */
+/* functions prototype */
+/* */
+/* Thierry LETELLIER 03Oct2005 */
+/* */
+/*####################################################*/
+//fes2004_alloc.c
+extern void alloc_tide_spectrum(spectrum_struct ** );
+extern void alloc_prediction_threads(mega_struct *,int );
+extern void alloc_extraction_threads(mega_struct *,int );
+extern void free_threads(mega_struct *,int );
+
+//fes2004_extraction.c
+extern int fes2004_extraction (char *,int ,double *,double *,double **,double **,int );
+
+//fes2004_prediction.c
+extern int fes2004_prediction (char *,int ,int ,double *,double *,double *,double *,int );
+
+//fes2004_io.c
+extern void load_netcdf_fes2004_data(char *,mega_struct *,int );
+
+//fes2004_init.c
+extern void in_out_file_open(char *,FILE **,FILE **);
+extern int init_spectrum(spectrum_struct *, int );
+extern void init_thread_struct(int , mega_struct *, int ,double *,double *, double *, double *, spectrum_struct *, double ** ,double **);
+extern int Wave_select(int i, tidal_wave *,int );
+extern void init_admittance_coeff(int *,int *,int *,int );
+
+//fes2004_error.c
+extern void print_error_1() ;
+extern void print_error_2() ;
+extern void print_error_3(char *) ;
+extern void print_error_4(char *) ;
+extern void print_error_5(char *) ;
+
+//fes2004_kernel.c
+extern void multi_t_prediction(int , int , mega_struct *);
+extern void multi_t_extraction(int , int , mega_struct *);
+extern void * pred_coeur(void *);
+extern void * extract_coeur(void *);
+extern double predic_and_admit(float *,float *,int ,mega_struct *,double ,double );
+extern int interpolation_w_mask(double ,double ,int ,int ,double *,float *);
+extern void compute_admittance(gsl_matrix *,gsl_permutation *,gsl_vector *,gsl_vector *,gsl_vector *,gsl_vector *,spectrum_struct *,int ,int * ,int *);
+extern double geo_d_km(double ,double ,double ,double );
+//##############################################################################################################################
+// the next functions are a part of the Aktarus tide library developped
+// By Thierry LETELLIER [LEGOS]
+// and Laurent ROBLOU [Noveltis]
+//
+// These functions are the prediction kernel YOU DON'T NEED TO CHANGE THEM ...
+// ----------------------------------
+
+// You don't have the right to use these functions in other programs than the FES2004 prediction
+// If you want more information please contact --- thierry.letellier at free.fr ---
+//##############################################################################################################################
+extern double Tide_prediction(double time,tidal_wave wave,fcomplex Z,int verbose,int CTO);
+extern void init_argument(double first_time, int verbose, int CTO,astro_ang_struct *astro_ang);
+extern void astronomic_angle(double tj, int verbose, astro_ang_struct *astro_ang);
+extern double greenwhich_argument(tidal_wave w,astro_ang_struct *astro_ang);
+extern double nodal_phase(tidal_wave w,astro_ang_struct *astro_ang);
+extern int julian_day(int mm,int id,int iyyy);
+extern double nodal_factort(int formula, astro_ang_struct *astro_ang);
+extern void calendary(int njd,date_t *actual);
+extern void getcnesdate(double t,date_t *actual);
+extern double pulsation( tidal_wave wave);
+extern void tidal_potential(tidal_wave wave,double lat,double lon, double *Amp, double *G,int terrestre);
+//##############################################################################################################################
+
+
+
+
+
+/*####################################################*/
+/* */
+/* waves definitions */
+/* */
+/* Thierry LETELLIER 03Oct2005 */
+/* */
+/*####################################################*/
+#ifdef LIB
+
+/*----------------potentiel---T---s---h---p--p1-ksi--nu-nu1-nu2-R--shift-form-code-frq--name-spec-admit*/
+
+ tidal_wave wmean = { 0.0000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 187, 0.0, "mean",'p',999};/*LR: code=187*/
+
+ tidal_wave wSa = { 0.0000, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 0.0, "Sa",'p',999};
+ tidal_wave wSsa = { 1.9416, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 46, 0.0, "Ssa",'p',999};
+ tidal_wave wMm = { 2.2056, 0, +1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 73, 38, 0.0, "Mm",'p',999};
+ tidal_wave wMSm = { 0.3094, 0, +1, -2, +1, 0, 0, 0, 0, 0, 0, 0, 73, 41, 0.0, "MSm",'p',38};/*LR: 31/03/03 */
+ tidal_wave wMSf = { 0.2240, 0, +2, -2, 0, 0, 0, 0, 0, 0, 0, 0, 73, 39, 0.0, "MSf",'p',40};/*LR: 31/03/03 */
+ tidal_wave wMf = { 4.1765, 0, +2, 0, 0, 0, -2, 0, 0, 0, 0, 0, 74, 40, 0.0, "Mf",'p',999};
+ tidal_wave wMtm = { 0.8081, 0, +3, 0, -1, 0, -2, 0, 0, 0, 0, 0, 74, 42, 0.0, "Mtm",'p',999};/*LR: 24/01/02 */
+ tidal_wave wMqm = { 0.0000, 0, +4, 0, -2, 0, -2, 0, 0, 0, 0, 0, 74, 43, 0.0, "Mqm",'p',999};
+ tidal_wave wMStm = { 0.1147, 0, +3, -2, 1, 0, -2, 0, 0, 0, 0, 0, 74, 44, 0.0, "MStm",'p',42};/*LR: 31/03/03 */
+ tidal_wave wMSqm = { 0.0667, 0, +4, -2, 0, 0, -2, 0, 0, 0, 0, 0, 74, 45, 0.0, "MSqm",'p',999};/*LR: 24/01/02 */
+
+/*----------------potentiel---T---s---h---p--p1-ksi--nu-nu1-nu2-R--shift-form-code-frq--name-spec-admit*/
+ tidal_wave wO1 = {10.0573, +1, -2, +1, 0, 0, +2, -1, 0, 0, 0, +90, 75, 1, 0.0, "O1",'p',999};
+ tidal_wave wQ1 = { 1.9469, +1, -3, +1, +1, 0, +2, -1, 0, 0, 0, +90, 75, 27, 0.0, "Q1",'p',999};
+ tidal_wave w2Q1 = { 0.2587, +1, -4, +1, +2, 0, +2, -1, 0, 0, 0, +90, 75, 67, 0.0, "2Q1",'p',999};/*LR: 24/01/02 */
+ tidal_wave wRo1 = { 0.3787, +1, -3, +3, -1, 0, +2, -1, 0, 0, 0, +90, 75, 69, 0.0, "Ro1",'p',999};/*LR: 24/01/02 */
+ tidal_wave wSig1 = { 0.1627, +1, -4, +3, 0, 0, +2, -1, 0, 0, 0, +90, 75, 68, 0.0, "Sig1",'p',999};/*LR: 24/01/02 */
+ tidal_wave wJ1 = { 0.7921, +1, +1, +1, -1, 0, 0, -1, 0, 0, 0, -90, 76, 29, 0.0, "J1",'p',999};/*avant s=-2*/
+ tidal_wave wKi1 = { 0.1120, +1, -1, +3, -1, 0, 0, -1, 0, 0, 0, -90, 76, 70, 0.0, "Ki1",'p',999};/*LR: 24/01/02 */
+ tidal_wave wTta1 = { 0.1120, +1, +1, -1, +1, 0, 0, -1, 0, 0, 0, -90, 76, 73, 0.0, "Tta1",'p',999};/*LR: 24/01/02 */
+ tidal_wave wS1 = { 0.0000, +1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 26, 0.0, "S1",'p',3};/* LR: 28/03/03 */
+ tidal_wave wPi1 = { 0.2747, +1, 0, -2, 0, +1, 0, 0, 0, 0, 0, +90, 0, 71, 0.0, "Pi1",'p',999};
+ tidal_wave wK1 = {14.1484, +1, 0, +1, 0, 0, 0, 0, -1, 0, 0, -90, 227, 3, 0.0, "K1",'p',999};
+ tidal_wave wP1 = { 4.6806, +1, 0, -1, 0, 0, 0, 0, 0, 0, 0, +90, 0, 2, 0.0, "P1",'p',3};
+ tidal_wave wPsi1 = { 0.1120, +1, 0, +2, 0, -1, 0, 0, 0, 0, 0, -90, 0, 0, 0.0, "Psi1",'p',3};/*LR: 31/03/03 */
+ tidal_wave wPhi1 = { 0.2027, +1, 0, +3, 0, 0, 0, 0, 0, 0, 0, -90, 0, 72, 0.0, "Phi1",'p',999};/*LR: 24/01/02 */
+ tidal_wave wOO1 = { 0.4347, +1, +2, +1, 0, 0, -2, -1, 0, 0, 0, -90, 77, 28, 0.0, "OO1",'p',999};
+ tidal_wave wMP1 = { 0.0000, +1, -2, +3, 0, 0, 0, -1, 0, 0, 0, -90, 76, 49, 0.0, "MP1",'n',999};/*LR: 2/04/02*/
+ tidal_wave wSO1 = { 0.0000, +1, +2, -1, 0, 0, 0, -1, 0, 0, 0, -90, 76, 48, 0.0, "SO1",'n',999};/*LR: 2/04/02*/
+ tidal_wave wKQ1 = { 0.0000, +1, +3, +1, -1, 0, -2, -1, 0, 0, 0, -90, 15, 76, 0.0, "KQ1",'n',999};/*LR: 2/04/02*/
+ tidal_wave wM1 = { 0.9788, +1, -1, +1, 0, 0, +1, -1, 0, 0, 0, 0, 144, 74, 0.0, "M1",'p',999};/*LR: 2/04/02*/
+
+/*----------------potentiel---T---s---h---p--p1-ksi--nu-nu1-nu2-R--shift-form-code-frq--name-spec-admit*/
+ tidal_wave wE2 = { 0.1789, +2, -5, +4, +1, 0, +2, -2, 0, 0, 0, 0, 78, 4, 0.0, "E2",'p',5};/*LR: 2/04/02*/
+ tidal_wave w2N2 = { 0.6267, +2, -4, +2, +2, 0, +2, -2, 0, 0, 0, 0, 78, 5, 0.0, "2N2",'p',999};
+ tidal_wave wMu2 = { 0.5841, +2, -4, +4, 0, 0, +2, -2, 0, 0, 0, 0, 78, 6, 0.0, "Mu2",'p',5};/*avant p=-1*/
+ tidal_wave wN2 = { 4.6313, +2, -3, +2, +1, 0, +2, -2, 0, 0, 0, 0, 78, 7, 0.0, "N2",'p',999};
+ tidal_wave wNu2 = { 0.9094, +2, -3, +4, -1, 0, +2, -2, 0, 0, 0, 0, 78, 8, 0.0, "Nu2",'p',7};
+ tidal_wave wL2 = { 0.6694, +2, -1, +2, -1, 0, +2, -2, 0, 0, 1,+180, 215, 11, 0.0, "L2",'p',14};
+ tidal_wave wLa2 = { 0.1760, +2, -1, 0, +1, 0, +2, -2, 0, 0, 0,+180, 78, 10, 0.0, "La2",'p',999};/*LR: 24/01/02 */
+ tidal_wave wT2 = { 0.6614, +2, 0, -1, 0, +1, 0, 0, 0, 0, 0, 0, 0, 12, 0.0, "T2",'p',14};/*LR: 31/03/03 */
+ tidal_wave wS2 = {11.2734, +2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 0.0, "S2",'p',999};
+ tidal_wave wM2 = {24.2297, +2, -2, +2, 0, 0, +2, -2, 0, 0, 0, 0, 78, 9, 0.0, "M2",'p',999};
+ tidal_wave wK2 = { 3.0697, +2, 0, +2, 0, 0, 0, 0, 0, -2, 0, 0, 235, 14, 0.0, "K2",'p',13};/*LR: 06/06/04 */
+ tidal_wave wKJ2 = { 0.1707, +2, +1, +2, -1, 0, 0, 0, 0, -2, 0, 0, 79, 77, 0.0, "KJ2",'n',999};/*LR: 24/01/02 */
+ tidal_wave wR2 = { 0.0933, +2, 0, +1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 50, 0.0, "R2",'p',14};/*LR: 31/03/03 */
+ tidal_wave wOQ2 = { 0.0000, +2, -5, +2, +1, 0, 0, 0, 0, 0, 0,+180, 7, 51, 0.0, "OQ2",'n',999};/*LR: 2/04/02*/
+ tidal_wave w2MK2 = { 0.0000, +2, +4, +2, 0, 0, 4, -4, 0, +2, 0, 0, 5, 65, 0.0, "2MK2",'n',999};/*LR: 2/04/02*/
+ tidal_wave wMSK2 = { 0.0000, +2, -2, 0, 0, 0, +2, -2, 0, +2, 0, 0, 8, 31, 0.0, "MSK2",'n',999};/*LR: 2/04/02*/
+ tidal_wave wMSN2 = { 0.0000, +2, +1, 0, +1, 0, +2, -2, 0, +2, 0, 0, 6, 15, 0.0, "MSN2",'n',999};/*LR: 2/04/02*/
+ tidal_wave w2SM2 = { 0.0000, +2, +2, -2, 0, 0, -2, +2, 0, 0, 0, 0, 16, 16, 0.0, "2SM2",'n',999};/*LR: 2/04/02*/
+ tidal_wave wM_SK_2={ 0.0000, +2, -2, +1, 0, 0, +2, -2, 1, 0, 0, +90, 9, 37, 0.0, "M(SK)2",'n',999};/*LR: 2/04/02*/
+ tidal_wave wM_KS_2={ 0.0000, +2, -2, +3, 0, 0, +2, -2, -1, 0, 0, -90, 9, 36, 0.0, "M(KS)2",'n',999};/*LR: 2/04/02*/
+ tidal_wave wMKS2 = { 0.0000, +2, -2, +4, 0, 0, -2, -2, 0, 0, 0, 0, 8, 30, 0.0, "MKS2",'n',999};/*LR: 2/04/02*/
+ tidal_wave wOP2 = { 0.0000, +2, -2, 0, 0, 0, +2, -1, 0, 0, 0,+180, 11,100, 0.0, "OP2",'n',999};/*LR: 2/04/02*/
+ tidal_wave wMNS2 = { 0.0000, +2, -5, +4, +1, 0, +4, -4, 0, 0, 0, 0, 6,101, 0.0, "MNS2",'n',999};/*LR: 24/01/02 */
+
+/*----------------potentiel---T---s---h---p--p1-ksi--nu-nu1-nu2-R--shift-form-code-frq--name-spec-admit*/
+ tidal_wave wM3 = { 0.4747, +3, -3, +3, 0, 0, +3, -3, 0, 0, 0, 0, 1, 34, 0.0, "M3",'n',999};/*LR: 24/01/02 */
+ tidal_wave wS3 = { 0.0000, +3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 35, 0.0, "S3",'n',999};/*LR: 2/04/02*/
+ tidal_wave w2MK3 = { 0.0000, +3, -4, +3, 0, 0, +4, -4, +1, 0, 0, +90, 10, 25, 0.0, "2MK3",'n',999};/*LR: 2/04/02*/
+ tidal_wave wSO3 = { 0.0000, +3, -2, +1, 0, 0, +2, -1, 0, 0, 0, +90, 11, 53, 0.0, "SO3",'n',999};/*LR: 2/04/02*/
+ tidal_wave wMK3 = { 0.0000, +3, -2, +3, 0, 0, +2, -2, -1, 0, 0, -90, 10, 24, 0.0, "MK3",'n',999};/*LR: 2/04/02*/
+ tidal_wave wSK3 = { 0.0000, +3, 0, +1, 0, 0, 0, 0, -1, 0, 0, -90, 17, 54, 0.0, "SK3",'n',999};/*LR: 2/04/02*/
+ tidal_wave wMO3 = { 0.0000, +3, -4, +1, 0, 0, +2, -2, 0, 0, 0, +90, 13,102, 0.0, "MO3",'n',999};/*LR: 2/04/02*/
+
+/*----------------potentiel---T---s---h---p--p1-ksi--nu-nu1-nu2-R--shift-form-code-frq--name-spec-admit*/
+ tidal_wave wN4 = { 0.0000, +4, -6, +4, +2, 0, +4, -4, 0, 0, 0, 0, 1, 33, 0.0, "N4",'n',999};
+ tidal_wave wM4 = { 0.0000, +4, -4, +4, 0, 0, +4, -4, 0, 0, 0, 0, 1, 18, 0.0, "M4",'n',999};
+ tidal_wave wS4 = { 0.0000, +4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 56, 0.0, "S4",'n',999};
+ tidal_wave wMN4 = { 0.0000, +4, -5, +4, 1, 0, +4, -4, 0, 0, 0, 0, 1, 17, 0.0, "MN4",'n',999};
+ tidal_wave wMS4 = { 0.0000, +4, -2, +2, 0, 0, +2, -2, 0, 0, 0, 0, 2, 19, 0.0, "MS4",'n',999};
+ tidal_wave wMK4 = { 0.0000, +4, -2, +4, 0, 0, +2, -2, 0, -2, 0, 0, 4, 20, 0.0, "MK4",'n',999};
+ tidal_wave wSN4 = { 0.0000, +4, -3, +2, +1, 0, +2, -2, 0, 0, 0, 0, 2, 55, 0.0, "SN4",'n',999};/*LR: 29/03/02 */
+ tidal_wave w3MS4 = { 0.0000, +4, -6, +6, 0, 0, +6, -6, 0, 0, 0, 0, 12, 58, 0.0, "3MS4",'n',999};/*LR: 29/03/02 */
+ tidal_wave wSK4 = { 0.0000, +4, 0, +2, 0, 0, 0, 0, 0, -2, 0, 0, 14,103, 0.0, "SK4",'n',999};
+
+/*----------------potentiel---T---s---h---p--p1-ksi--nu-nu1-nu2-R--shift-form-code-frq--name-spec-admit*/
+ tidal_wave wM6 = { 0.0000, +6, -6, +6, 0, 0, +6, -6, 0, 0, 0, 0, 18, 22, 0.0, "M6",'n',999};
+ tidal_wave w2MN6 = { 0.0000, +6, -7, +6, 1, 0, +6, -6, 0, 0, 0, 0, 18, 21, 0.0, "2MN6",'n',999};
+ tidal_wave w2MS6 = { 0.0000, +6, -4, +4, 0, 0, +4, -4, 0, 0, 0, 0, 6, 59, 0.0, "2MS6",'n',999};
+ tidal_wave w2MK6 = { 0.0000, +6, -4, +6, 0, 0, +4, -4, 0, -2, 0, 0, 5, 60, 0.0, "2MK6",'n',999};
+ tidal_wave wMSN6 = { 0.0000, +6, -5, +4, +1, 0, +4, -4, 0, 0, 0, 0, 6, 23, 0.0, "MSN6",'n',999};/*LR: 29/03/02 */
+ tidal_wave w2SM6 = { 0.0000, +6, -2, +2, 0, 0, +2, -2, 0, 0, 0, 0, 16,104, 0.0, "2SM6",'n',999};/*LR: 2/04/02*/
+ tidal_wave wMSK6 = { 0.0000, +6, -2, +4, 0, 0, +2, -2, 0, -2, 0, 0, 8,105, 0.0, "MSK6",'n',999};/*LR: 2/04/02*/
+
+/*----------------potentiel---T---s---h---p--p1-ksi--nu-nu1-nu2-R--shift-form-code-frq--name-spec-admit*/
+ tidal_wave w3MS8 = { 0.0000, +8, -6, +6, 0, 0, +6, -6, 0, 0, 0, 0, 19, 61, 0.0, "3MS8",'n',999};/*LR: 2/04/02*/
+
+/*----------------potentiel---T---s---h---p--p1-ksi--nu-nu1-nu2-R--shift-form-code-frq--name-spec-admit*/
+ tidal_wave wRH5 = { 0.0000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 78, 3.0, "RH5",'a',999};
+
+
+/*----------------potentiel---T---s---h---p--p1--ksi-nu-nu1-nu2-shift-form-code-frq--name-linear*/
+ tidal_wave wNUL = {0.0000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0, 0, 0, 0.0, "NUL",'p',999}; /*TL: 08/06/2004*/
+
+ double pi = 3.14159265358979323844;
+ double pi2 = 3.14159265358979323844*2.;
+ double deg_to_rad = 3.14159265358979323844/180.;
+
+#else
+ extern tidal_wave wmean;
+
+ extern tidal_wave wSa ;
+ extern tidal_wave wSsa ;
+ extern tidal_wave wMm ;
+ extern tidal_wave wMSm ;
+ extern tidal_wave wMSf ;
+ extern tidal_wave wMf ;
+ extern tidal_wave wMtm ;
+ extern tidal_wave wMqm ;
+ extern tidal_wave wMStm ;
+ extern tidal_wave wMSqm ;
+
+ extern tidal_wave wO1 ;
+ extern tidal_wave wQ1 ;
+ extern tidal_wave w2Q1 ;
+ extern tidal_wave wRo1 ;
+ extern tidal_wave wSig1 ;
+ extern tidal_wave wJ1 ;
+ extern tidal_wave wKi1 ;
+ extern tidal_wave wTta1 ;
+ extern tidal_wave wS1 ;
+ extern tidal_wave wPi1 ;
+ extern tidal_wave wK1 ;
+ extern tidal_wave wP1 ;
+ extern tidal_wave wPsi1 ;
+ extern tidal_wave wPhi1 ;
+ extern tidal_wave wOO1 ;
+ extern tidal_wave wMP1 ;/*LR: 2/04/02*/
+ extern tidal_wave wSO1 ;/*LR: 2/04/02*/
+ extern tidal_wave wKQ1 ;/*LR: 2/04/02*/
+ extern tidal_wave wM1 ;/*LR: 2/04/02*/
+
+ extern tidal_wave wE2 ;
+ extern tidal_wave w2N2 ;
+ extern tidal_wave wMu2 ;
+ extern tidal_wave wN2 ;
+ extern tidal_wave wNu2 ;
+ extern tidal_wave wM2 ;
+ extern tidal_wave wL2 ;
+ extern tidal_wave wLa2 ;
+ extern tidal_wave wT2 ;
+ extern tidal_wave wS2 ;
+ extern tidal_wave wK2 ;
+ extern tidal_wave wKJ2 ;
+ extern tidal_wave wR2 ;
+ extern tidal_wave wOQ2 ;/*LR: 2/04/02*/
+ extern tidal_wave w2MK2 ;/*LR: 2/04/02*/
+ extern tidal_wave wMSK2 ;/*LR: 2/04/02*/
+ extern tidal_wave wMSN2 ;/*LR: 2/04/02*/
+ extern tidal_wave w2SM2 ;/*LR: 2/04/02*/
+ extern tidal_wave wM_SK_2 ;/*LR: 2/04/02*/
+ extern tidal_wave wM_KS_2;/*LR: 2/04/02*/
+ extern tidal_wave wMKS2 ;/*LR: 2/04/02*/
+ extern tidal_wave wOP2 ;/*LR: 2/04/02*/
+ extern tidal_wave wMNS2 ;/*LR: 2/04/02*/
+
+ extern tidal_wave wM3 ;
+ extern tidal_wave wS3 ;
+ extern tidal_wave w2MK3 ;/*LR: 2/04/02*/
+ extern tidal_wave wSO3 ;/*LR: 2/04/02*/
+ extern tidal_wave wMK3 ;/*LR: 2/04/02*/
+ extern tidal_wave wSK3 ;/*LR: 2/04/02*/
+ extern tidal_wave wMO3 ;/*LR: 2/04/02*/
+
+ extern tidal_wave wN4 ;
+ extern tidal_wave wM4 ;
+ extern tidal_wave wS4 ;
+ extern tidal_wave wMN4 ;
+ extern tidal_wave wMS4 ;
+ extern tidal_wave wMK4 ;
+ extern tidal_wave wSN4 ;/*LR: 2/04/02*/
+ extern tidal_wave w3MS4 ;/*LR: 2/04/02*/
+ extern tidal_wave wSK4 ;/*LR: 2/04/02*/
+
+ extern tidal_wave wM6 ;
+ extern tidal_wave w2MN6 ;
+ extern tidal_wave w2MS6 ;
+ extern tidal_wave w2MK6 ;
+ extern tidal_wave wMSN6 ;/*LR: 29/03/02 */
+ extern tidal_wave w2SM6 ;/*LR: 2/04/02*/
+ extern tidal_wave wMSK6 ;/*LR: 2/04/02*/
+
+ extern tidal_wave w3MS8 ;/*LR: 2/04/02*/
+
+ extern tidal_wave wRH5 ;
+ extern tidal_wave wNUL ;
+
+ extern double pi;
+ extern double pi2;
+ extern double deg_to_rad;
+
+
+#endif
diff --git a/modules/FES2004_distribution_soft-1.0.9/src/fes2004_main.c b/modules/FES2004_distribution_soft-1.0.9/src/fes2004_main.c
new file mode 100644
index 0000000..6385122
--- /dev/null
+++ b/modules/FES2004_distribution_soft-1.0.9/src/fes2004_main.c
@@ -0,0 +1,393 @@
+// standard include //
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <string.h>
+#include <strings.h>
+#include <malloc.h>
+
+#include "fes2004_lib.h"
+
+
+
+/*####################################################*/
+/* */
+/* read an simple file construct with */
+/* lat lon time structs */
+/* */
+/* Thierry LETELLIER 03Oct2005 */
+/* */
+/*####################################################*/
+void load_input_file(FILE *in, int nb, double *lat ,double *lon, double *time)
+{
+ int i,val;
+ char carac[256];
+
+ for(i=0;i<nb;i++)
+ {
+ val=fscanf(in, "%lf %lf %lf",&lat[i],&lon[i],&time[i]);
+ if (val!=3) {sprintf(carac,"fatal error during the read of the input file at line : %d",i+1); print_error_4(carac);}
+ if(lon[i]>180) lon[i]-=360;
+ }
+
+}
+
+/*####################################################*/
+/* */
+/* search the number of lines in filename */
+/* */
+/* Thierry LETELLIER 03Oct2005 */
+/* */
+/*####################################################*/
+int compter_lignes(char *filename)
+{
+
+ FILE *fichier;
+ int lignes = 0;
+ char line[1024];
+
+ fichier=fopen(filename,"r");
+ if(fichier==NULL) print_error_5(filename);
+ while (!feof(fichier))
+ {
+ fgets(line,sizeof(line),fichier);
+ if(!feof(fichier))lignes++;
+ }
+ printf("%s: %d lignes\n", filename, lignes);
+ fclose(fichier);
+ return(lignes);
+
+}
+
+
+/*####################################################*/
+/* */
+/* vectors variables allocation */
+/* */
+/* */
+/* Thierry LETELLIER 03Oct2005 */
+/* */
+/*####################################################*/
+
+void alloc_vectors(int nb, double **lat,double **lon,double **time,double **prediction,double ***amplitude,double ***phase)
+{
+ int i;
+ *lat=calloc(nb,sizeof(double));
+ *lon=calloc(nb,sizeof(double));
+ *time=calloc(nb,sizeof(double));
+ *prediction=calloc(nb,sizeof(double));
+ *amplitude=malloc(nb*sizeof(double *));
+ *phase=malloc(nb*sizeof(double *));
+
+ for(i=0;i<nb;i++)
+ {
+ (*amplitude)[i]=calloc(14,sizeof(double));
+ (*phase)[i]=calloc(14,sizeof(double));
+ }
+
+}
+
+/*####################################################*/
+/* */
+/* generate a row output for the prediction */
+/* */
+/* */
+/* Thierry LETELLIER 07Oct2005 */
+/* */
+/*####################################################*/
+int prediction_output(int nb_position,double *prediction,double *lat,double *lon,double *time,int time_reference,char *out_filename)
+{
+ int cnt;
+ FILE *out;
+ char ref[56];
+ out=fopen(out_filename,"w");
+ if(time_reference==0) sprintf(ref,"01/01/1950");
+ if(time_reference==1) sprintf(ref,"01/01/1958");
+ if(time_reference==2) sprintf(ref,"01/01/1985");
+ if(time_reference==3) sprintf(ref,"01/01/2000");
+ fprintf(out,"# FES2004 prediction in meter\n# read : lat, lon, time, prediction\n#the time is the number of hour since the %s\n###############################################\n",ref);
+ for(cnt=0;cnt<nb_position;cnt++) fprintf(out,"%12.6lf %12.6lf %12.6lf %12.6lf \n",lat[cnt],lon[cnt],time[cnt],prediction[cnt]);
+ fclose(out);
+}
+
+
+/*####################################################*/
+/* */
+/* generate a row output for the extraction */
+/* */
+/* */
+/* Thierry LETELLIER 07Oct2005 */
+/* */
+/*####################################################*/
+int extraction_output(int nb_position,double **amplitude,double **phase,double *lat,double *lon,char *out_filename)
+{
+ int cnt;
+ FILE *out;
+ out=fopen(out_filename,"w");
+ fprintf(out,"###############################################\n#\n# FES2004 extraction -- amplitude in meter and phase lag in degree\n# read header : Pt_X -- lat lon\n#Wave_name Amp phi \n#\n###############################################\n");
+ for(cnt=0;cnt<nb_position;cnt++)
+ {
+ fprintf(out,"----------------------------------------------------------\n");
+ fprintf(out,"Pt %6d %12.6lf N %12.6lf E\n",cnt,lat[cnt],lon[cnt]);
+ if(amplitude[cnt][2]==-9999.00){ fprintf(out,"Masked point\n");continue;}
+ fprintf(out,"M2 %12.6lf %12.6lf\n",amplitude[cnt][3],phase[cnt][3]);
+ fprintf(out,"S2 %12.6lf %12.6lf\n",amplitude[cnt][13],phase[cnt][13]);
+ fprintf(out,"K1 %12.6lf %12.6lf\n",amplitude[cnt][1],phase[cnt][1]);
+ fprintf(out,"K2 %12.6lf %12.6lf\n",amplitude[cnt][2],phase[cnt][2]);
+ fprintf(out,"N2 %12.6lf %12.6lf\n",amplitude[cnt][9],phase[cnt][9]);
+ fprintf(out,"2N2 %12.6lf %12.6lf\n",amplitude[cnt][0],phase[cnt][0]);
+ fprintf(out,"O1 %12.6lf %12.6lf\n",amplitude[cnt][10],phase[cnt][10]);
+ fprintf(out,"P1 %12.6lf %12.6lf\n",amplitude[cnt][11],phase[cnt][11]);
+ fprintf(out,"Q1 %12.6lf %12.6lf\n",amplitude[cnt][12],phase[cnt][12]);
+ fprintf(out,"M4 %12.6lf %12.6lf\n",amplitude[cnt][4],phase[cnt][4]);
+ fprintf(out,"Mf %12.6lf %12.6lf\n",amplitude[cnt][5],phase[cnt][5]);
+ fprintf(out,"Mm %12.6lf %12.6lf\n",amplitude[cnt][6],phase[cnt][6]);
+ fprintf(out,"Mtm %12.6lf %12.6lf\n",amplitude[cnt][8],phase[cnt][8]);
+ fprintf(out,"Msqm %12.6lf %12.6lf\n",amplitude[cnt][7],phase[cnt][7]);
+ }
+ fclose(out);
+}
+
+
+void usage()
+{
+ printf("\n\n");
+ printf("################################################################################################################################\n#\n");
+ printf("# This is the FES2004 extraction and prediction software : version 1.6.0\n#\n");
+ printf("# Usage : FES2004.exe [parameters] [option] file ...\n");
+ printf("# \n");
+ printf("# ----PARAMETERS---- :\n");
+ printf("# ------------------ \n");
+ printf("# -t [argument] Process type : extraction - prediction # Note : this option can be use two times ...\n");
+ printf("# -s [argument] Data set for process : tide - loading # Note : this option can be use two times ...\n");
+ printf("# -A [FILE] Necessary (with -s tide) path and filename of the --TIDE-- FES netcdf data file \n");
+ printf("# -B [FILE] Necessary (with -s load) path and filename of the --LOAD-- FES netcdf data file \n");
+ printf("# -----VARIABLE PARAMETER---- :\n");
+ printf("# --------------------------- \n");
+ printf("# -r [value] Necessary for prediction :\n");
+ printf("# This is the time refence of the input file.\n");
+ printf("# Use : 0 --> 01Jan1950 0H00\n");
+ printf("# 1 --> 01Jan1958 0H00\n");
+ printf("# 2 --> 01Jan1985 0H00\n");
+ printf("# 3 --> 01Jan2000 0H00\n");
+ printf("# DEFAULT is 0\n");
+ printf("# ----OPTIONAL PARAMETER---- :\n");
+ printf("# -------------------------- \n");
+ printf("# -o [file] Optionnal give a specific root output file name\n");
+ printf("# \n");
+ printf("# \n");
+ printf("# \n");
+ printf("# ----EXEMPLES---- : \n");
+ printf("# ---------------- \n");
+ printf("# \n");
+ printf("# 1- FES2004.exe -t extraction -s loading -B load.nc inputFILE --> extraction of the loading data in out_file.loading.extract\n");
+ printf("# \n");
+ printf("# 2- FES2004.exe -t extraction -t prediction -s tide -A tide.nc inputFILE --> extraction of the tide data in out_file.tide.extract\n");
+ printf("# and prediction of the tide data in out_file.tide.pred\n");
+ printf("# \n");
+ printf("# 3- FES2004.exe -t prediction -s tide -s loading -A tide.nc -B load.nc inputFILE --> prediction of both the tide and loading data\n");
+ printf("# in out_file.tide.pred and out_file.loading.extract\n");
+ printf("# \n");
+ printf("# 4- FES2004.exe -t prediction -A tide.nc -s tide -o my_output inputFILE --> prediction of the tide data in my_output.tide.pred\n");
+ printf("# \n");
+ printf("# 5- FES2004.exe -t prediction -s tide -A tide.nc -d /MYPATH/ inputFILE --> prediction of the tide data (FES2004.nc) found in /MYPATH/\n");
+ printf("# \n");
+ printf("################################################################################################################################\n\n");
+
+ exit(9);
+}
+
+/*--------------------------------------------------------------------------*/
+/* MAIN */
+/* ---- */
+/*--------------------------------------------------------------------------*/
+
+
+int main(int argc, char *argv[])
+{
+
+ int rstatus,n,cnt;
+ double *lat,*lon,*time,*prediction;
+ int nb_position,nb_CPU;
+ FILE *in;
+ char *keyword;
+
+ int time_reference=99;
+ char *netcdf_filename=NULL,*output_filename=NULL,*input_filename=NULL,*TIDE_cdf_filename=NULL,*LOAD_cdf_filename=NULL;
+ int conf_extract=0, conf_predict=0 , conf_tide=0,conf_loading=0;
+
+ double **amplitude,**phase;
+
+ keyword=malloc(56*sizeof(char));
+ netcdf_filename=malloc(256*sizeof(char));
+ if(argc==1) usage();;
+
+ n=1;
+ while (n < argc)
+ {
+ keyword=strdup(argv[n]);
+ switch (keyword[0])
+ {
+ case '-':
+ {
+ switch (keyword[1])
+ {
+ case 't' :
+ if(strcmp(argv[n+1],"extraction")==0)conf_extract=1;
+ else if(strcmp(argv[n+1],"prediction")==0)conf_predict=1;
+ else {printf("=======>> unknown option %s\n",argv[n+1]);exit(99);}
+ n++;
+ n++;
+ break;
+
+ case 's' :
+ if(strcmp(argv[n+1],"tide")==0)conf_tide=1;
+ else if(strcmp(argv[n+1],"loading")==0)conf_loading=1;
+ else {printf("=======>> unknown option %s\n",argv[n+1]);exit(99);}
+ n++;
+ n++;
+ break;
+
+ case 'o' :
+ output_filename=strdup(argv[n+1]);
+ n++;
+ n++;
+ break;
+
+ case 'r' :
+ time_reference=atoi(argv[n+1]);
+ n++;
+ n++;
+ break;
+
+ case 'A' :
+ TIDE_cdf_filename= strdup(argv[n+1]);
+ n++;
+ n++;
+ break;
+
+ case 'B' :
+ LOAD_cdf_filename= strdup(argv[n+1]);
+ n++;
+ n++;
+ break;
+
+ case 'h' :
+ usage();
+ break;
+
+ default:
+ printf("=======>> unknown option %s\n",keyword);
+ exit(98);
+ }
+ break;
+ }
+ default :
+ {
+ input_filename= strdup(argv[n]);
+ n++;
+ break;
+ }
+ free(keyword);
+ }
+ }
+ if(input_filename==NULL)
+ {
+ printf("=======>> please give an input file \n");
+ printf("=======>> use FES2004.EXE -help \n");
+ exit(34);
+ }
+
+ if((conf_predict==1)&&(time_reference==-99) )
+ {
+ printf("=======>> You have not give a time reference use the -r option \n");
+ printf("=======>> use FES2004.EXE -help \n");
+ }
+
+ if(output_filename==NULL)
+ {
+ printf("=======>> the outputs will be write in files named (type.process) (example tide.pred)\n");
+ output_filename=calloc(56,sizeof(char));
+ sprintf(output_filename,"out_file");
+ }
+
+ if(time_reference==99)
+ {
+ printf("=======>> No time ference was given --> take option 0 (01/01/1950) as reference\n");
+ time_reference=0;
+ }
+
+
+ // generality
+
+
+ nb_position=compter_lignes(input_filename);
+ printf("found %d lines in input file : %s\n",nb_position,input_filename);
+ alloc_vectors( nb_position, &lat,&lon,&time,&prediction,&litude,&phase);
+ printf("done --> allocation to load the input file\n");
+
+
+ in=fopen(input_filename,"r");
+ load_input_file(in,nb_position , lat ,lon, time);
+ fclose(in);
+ printf("done --> load the input file\n");
+
+
+ // conf dependent
+
+
+
+ if(conf_predict==1)
+ {
+ if(conf_loading==1)
+ {
+ if(LOAD_cdf_filename!=NULL)sprintf(netcdf_filename,"%s",LOAD_cdf_filename);
+ else {printf("=======>> The load Netcdf file was not given\n");usage();}
+ rstatus=fes2004_prediction(netcdf_filename,0,nb_position,lat,lon,time,prediction,1);
+ sprintf(output_filename,"loading.pred");
+ rstatus=prediction_output(nb_position,prediction,lat,lon,time,time_reference,output_filename);
+ }
+ if(conf_tide==1)
+ {
+ if(TIDE_cdf_filename!=NULL)sprintf(netcdf_filename,"%s",TIDE_cdf_filename);
+ else {printf("=======>> The tide Netcdf file was not given do not forget the -A option !!!!\n");usage();printf("=======>> The tide Netcdf file was not given do not forget the -A option !!!!\n");}
+ printf("entering in the prediction function ...\n");
+ rstatus=fes2004_prediction(netcdf_filename,0,nb_position,lat,lon,time,prediction,1);
+ sprintf(output_filename,"tide.pred");
+ rstatus=prediction_output(nb_position,prediction,lat,lon,time,time_reference,output_filename);
+ }
+ if((conf_loading==0)&&(conf_tide==0))
+ {
+ printf("=======>> you have not give the data set type for prediction, use the -s option\n");
+ printf("=======>> use FES2004.EXE -help \n");
+ exit(66);
+ }
+ }
+
+ if(conf_extract==1)
+ {
+ if(conf_loading==1)
+ {
+ if(LOAD_cdf_filename!=NULL)sprintf(netcdf_filename,"%s",LOAD_cdf_filename);
+ else {printf("=======>> The load Netcdf file was not given\n");usage();}
+ rstatus=fes2004_extraction(netcdf_filename,nb_position ,lat,lon,amplitude,phase,1);
+ sprintf(output_filename,"loading.extract");
+ rstatus=extraction_output(nb_position,amplitude,phase ,lat,lon,output_filename);
+ }
+ if(conf_tide==1)
+ {
+ if(TIDE_cdf_filename!=NULL)sprintf(netcdf_filename,"%s",TIDE_cdf_filename);
+ else {printf("=======>> The tide Netcdf file was not given\n");usage();}
+ rstatus=fes2004_extraction(netcdf_filename,nb_position ,lat,lon,amplitude,phase,1);
+ sprintf(output_filename,"tide.extract");
+ rstatus=extraction_output(nb_position,amplitude,phase ,lat,lon,output_filename);
+ }
+ if((conf_loading==0)&&(conf_tide==0))
+ {
+ printf("=======>> you have not give the data set type for extraction, use the -s option\n");
+ printf("=======>> use FES2004.EXE -help \n");
+ exit(66);
+ }
+ }
+
+}
diff --git a/modules/FES2004_distribution_soft-1.0.9/src/fes2004_prediction.c b/modules/FES2004_distribution_soft-1.0.9/src/fes2004_prediction.c
new file mode 100644
index 0000000..3d62f3a
--- /dev/null
+++ b/modules/FES2004_distribution_soft-1.0.9/src/fes2004_prediction.c
@@ -0,0 +1,60 @@
+#include "fes2004_lib.h"
+
+
+int fes2004_prediction (char *netcdf_filename,int time_reference,int nb_position,double *lat,double *lon,double *time,double *prediction,int nb_CPU)
+{
+
+ /*####################################################*/
+ /* variable*/
+ /*####################################################*/
+
+ //classical variables
+ int rstatus;
+
+ //prediction typedef variables
+ spectrum_struct *spectrum=NULL;
+ mega_struct *P=NULL;
+
+ /*####################################################*/
+ /* allocation*/
+ /*####################################################*/
+
+ alloc_tide_spectrum(&spectrum);
+ P=calloc(nb_CPU,sizeof(mega_struct));
+ alloc_prediction_threads(P,nb_CPU);
+
+ /*####################################################*/
+ /*init prediction spectrum*/
+ /*####################################################*/
+
+ rstatus=init_spectrum(spectrum,time_reference);
+ if (rstatus != 0 ) print_error_2();
+
+ /*####################################################*/
+ /* load data files*/
+ /*####################################################*/
+
+ load_netcdf_fes2004_data(netcdf_filename,P,nb_CPU);
+
+ /*####################################################*/
+ /*init thread struct*/
+ /*####################################################*/
+
+ init_thread_struct(nb_CPU, P, time_reference, lat, lon, time, prediction, spectrum,NULL,NULL);
+
+ /*####################################################*/
+ /*Multithreaded prediction*/
+ /*####################################################*/
+
+ multi_t_prediction(nb_position , nb_CPU, P);
+
+ /*####################################################*/
+ /*free memory and exit*/
+ /*####################################################*/
+ free_threads(P,nb_CPU);
+ free(P);
+
+
+ printf("\n------------- prediction completed -------------\n");
+
+}/*end*/
--
Gerris Flow Solver
More information about the debian-science-commits
mailing list