~ubuntu-branches/ubuntu/precise/code-saturne/precise

« back to all changes in this revision

Viewing changes to src/mei/mei_math_util.c

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2011-11-24 00:00:08 UTC
  • mfrom: (6.1.9 sid)
  • Revision ID: package-import@ubuntu.com-20111124000008-2vo99e38267942q5
Tags: 2.1.0-3
Install a missing file

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*!
 
2
 * \file mei_math_util.c
 
3
 *
 
4
 * \brief Provides mathemathical functions facilities
 
5
 */
 
6
 
 
7
/*
 
8
  This file is part of Code_Saturne, a general-purpose CFD tool.
 
9
 
 
10
  Copyright (C) 1998-2011 EDF S.A.
 
11
 
 
12
  This program is free software; you can redistribute it and/or modify it under
 
13
  the terms of the GNU General Public License as published by the Free Software
 
14
  Foundation; either version 2 of the License, or (at your option) any later
 
15
  version.
 
16
 
 
17
  This program is distributed in the hope that it will be useful, but WITHOUT
 
18
  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 
19
  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 
20
  details.
 
21
 
 
22
  You should have received a copy of the GNU General Public License along with
 
23
  this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
 
24
  Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
25
*/
 
26
 
 
27
/*----------------------------------------------------------------------------*/
 
28
 
 
29
#ifdef __cplusplus
 
30
extern "C" {
 
31
#endif /* __cplusplus */
 
32
 
 
33
/*----------------------------------------------------------------------------
 
34
 * Fichiers `include' librairie standard C
 
35
 *----------------------------------------------------------------------------*/
 
36
 
 
37
/*----------------------------------------------------------------------------
 
38
 * Fichiers `include' locaux
 
39
 *----------------------------------------------------------------------------*/
 
40
 
 
41
#include "mei_math_util.h"
 
42
 
 
43
/*============================================================================
 
44
 * Public function definitions
 
45
 *============================================================================*/
 
46
 
 
47
/*!
 
48
 * \brief Return the max value from two doubles.
 
49
 *
 
50
 * \param [in] x1 double
 
51
 * \param [in] x2 double
 
52
 * \return max value
 
53
 */
 
54
 
 
55
double
 
56
mei_max(double x1, double x2)
 
57
{
 
58
    if (x1 < x2)
 
59
        return x2;
 
60
    else
 
61
        return x1;
 
62
}
 
63
 
 
64
/*!
 
65
 * \brief Return the min value from two doubles.
 
66
 *
 
67
 * \param [in] x1 double
 
68
 * \param [in] x2 double
 
69
 * \return min value
 
70
 */
 
71
 
 
72
double
 
73
mei_min(double x1, double x2)
 
74
{
 
75
    if (x1 < x2)
 
76
        return x1;
 
77
    else
 
78
        return x2;
 
79
}
 
80
 
 
81
 
 
82
#ifdef __cplusplus
 
83
}
 
84
#endif /* __cplusplus */
 
85
 
 
86