~fluidity-core/fluidity/embedded_models

« back to all changes in this revision

Viewing changes to libadaptivity/load_balance/src/unn_t.cpp

  • Committer: Timothy Bond
  • Date: 2011-04-14 15:40:24 UTC
  • Revision ID: timothy.bond@imperial.ac.uk-20110414154024-116ci9gq6mwigmaw
Following the move from svn to bzr we change the nature of inclusion of these
four software libraries. Previously, they were included as svn externals and
pulled at latest version for trunk, pinned to specific versions for release
and stable trunk. Since bzr is less elegant at dealing with externals we have
made the decision to include the packages directly into the trunk instead.

At this import the versions are:

libadaptivity: r163
libvtkfortran: r67
libspud: r545
libmba2d: r28

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2006 Imperial College London and others.
 
2
 
 
3
 Please see the AUTHORS file in the main source directory for a full list
 
4
 of copyright holders.
 
5
 
 
6
 Dr Gerard J Gorman
 
7
 Applied Modelling and Computation Group
 
8
 Department of Earth Science and Engineering
 
9
 Imperial College London
 
10
 
 
11
 g.gorman@imperial.ac.uk
 
12
 
 
13
 This library is free software; you can redistribute it and/or
 
14
 modify it under the terms of the GNU Lesser General Public
 
15
 License as published by the Free Software Foundation; either
 
16
 version 2.1 of the License.
 
17
 
 
18
 This library 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 GNU
 
21
 Lesser General Public License for more details.
 
22
 
 
23
 You should have received a copy of the GNU Lesser General Public
 
24
 License along with this library; if not, write to the Free Software
 
25
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 
26
 USA
 
27
*/
 
28
#include <string>
 
29
using std::string;
 
30
 
 
31
#include <assert.h>
 
32
#include "unn_t.h"
 
33
 
 
34
// default constructor
 
35
unn_t::unn_t(){
 
36
  s.resize(UNN_LEN+1);
 
37
}
 
38
 
 
39
// copy constructor
 
40
unn_t::unn_t(const unn_t& unn){
 
41
  *this = unn;
 
42
}
 
43
 
 
44
// destructor
 
45
unn_t::~unn_t(){}
 
46
 
 
47
// return the unn as a c type string
 
48
const char *unn_t::number(){
 
49
  return(s.c_str());
 
50
}
 
51
 
 
52
// Overloaded operators.
 
53
unn_t & unn_t::operator=(const unn_t &a){
 
54
  s = a.s;
 
55
  return(*this);
 
56
}
 
57
unn_t & unn_t::operator=(const string &a){
 
58
  char num[UNN_LEN+1];
 
59
  
 
60
  if( a.size() < UNN_LEN ){
 
61
    sprintf(num, "%*s", UNN_LEN, a.c_str());
 
62
    for(int i=0;i<UNN_LEN;i++){
 
63
      if(num[i] == ' ')
 
64
        num[i] = '0';
 
65
      else
 
66
        break;
 
67
    }
 
68
  }else{
 
69
    strncpy(num, a.c_str(), UNN_LEN);
 
70
  }
 
71
  num[UNN_LEN] = '\0';
 
72
  
 
73
  s = num;
 
74
  return(*this);
 
75
}
 
76
unn_t & unn_t::operator=(const int &a){
 
77
  char num[UNN_LEN+1];
 
78
  sprintf(num, "%0*d", UNN_LEN, a);
 
79
  s = num;
 
80
  return(*this);
 
81
}