~ubuntu-branches/ubuntu/trusty/rheolef/trusty

« back to all changes in this revision

Viewing changes to nfem/basis/make_basis_cxx.sh

  • Committer: Package Import Robot
  • Author(s): Pierre Saramito
  • Date: 2012-04-06 09:12:21 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20120406091221-m58me99p1nxqui49
Tags: 6.0-1
* New upstream release 6.0 (major changes):
  - massively distributed and parallel support
  - full FEM characteristic method (Lagrange-Gakerkin method) support
  - enhanced users documentation 
  - source code supports g++-4.7 (closes: #667356)
* debian/control: dependencies for MPI distributed solvers added
* debian/rules: build commands simplified
* debian/librheolef-dev.install: man1/* to man9/* added
* debian/changelog: package description rewritted (closes: #661689)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh
2
 
basis_list=$*
3
 
old_file="basis.cc"
4
 
new_file="basis.cc.new"
5
 
 
6
 
cat > ${new_file} << EOF1
7
 
// file automatically generated by: $0
8
 
///
9
 
/// This file is part of Rheolef.
10
 
///
11
 
/// Copyright (C) 2000-2009 Pierre Saramito <Pierre.Saramito@imag.fr>
12
 
///
13
 
/// Rheolef is free software; you can redistribute it and/or modify
14
 
/// it under the terms of the GNU General Public License as published by
15
 
/// the Free Software Foundation; either version 2 of the License, or
16
 
/// (at your option) any later version.
17
 
///
18
 
/// Rheolef is distributed in the hope that it will be useful,
19
 
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 
/// GNU General Public License for more details.
22
 
///
23
 
/// You should have received a copy of the GNU General Public License
24
 
/// along with Rheolef; if not, write to the Free Software
25
 
/// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26
 
///
27
 
/// =========================================================================
28
 
#include "rheolef/basis.h"
29
 
EOF1
30
 
 
31
 
for basis in ${basis_list}; do
32
 
 echo "#include \"${basis}.h\"" >>  ${new_file}
33
 
done
34
 
 
35
 
cat >> ${new_file} << EOF2
36
 
namespace rheolef {
37
 
using namespace std;
38
 
 
39
 
basis_rep* 
40
 
basis_rep::make_ptr (string name) 
41
 
{
42
 
  // TODO: use gperf instead of a long if-else test suite
43
 
  if (name == "") return 0;
44
 
EOF2
45
 
 
46
 
for basis in ${basis_list}; do
47
 
  echo "  if (name == \"${basis}\") return new_macro(basis_${basis});" >>  ${new_file}
48
 
done
49
 
 
50
 
cat >> ${new_file} << EOF3
51
 
  error_macro ("undefined basis \`" << name << "'");
52
 
}
53
 
 
54
 
} // namespace rheolef
55
 
EOF3
56
 
 
57
 
if test ! -f ${old_file}; then
58
 
  mv ${new_file} ${old_file}
59
 
  echo "! file ${old_file} created." 1>&2
60
 
elif diff ${old_file} ${new_file} >/dev/null; then
61
 
  echo "! file ${old_file} unchanged." 1>&2
62
 
  rm -f ${new_file}
63
 
else
64
 
  mv ${new_file} ${old_file}
65
 
  echo "! file ${old_file} modified." 1>&2
66
 
fi
67
 
 
68
 
exit 0