LOOS  v2.3.2
gridscale.cpp
1 /*
2  gridscale.cpp
3 
4  Applies a constant scaling to a grid...
5 */
6 
7 /*
8  This file is part of LOOS.
9 
10  LOOS (Lightweight Object-Oriented Structure library)
11  Copyright (c) 2009, Tod D. Romo, Alan Grossfield
12  Department of Biochemistry and Biophysics
13  School of Medicine & Dentistry, University of Rochester
14 
15  This package (LOOS) is free software: you can redistribute it and/or modify
16  it under the terms of the GNU General Public License as published by
17  the Free Software Foundation under version 3 of the License.
18 
19  This package is distributed in the hope that it will be useful,
20  but WITHOUT ANY WARRANTY; without even the implied warranty of
21  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  GNU General Public License for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with this program. If not, see <http://www.gnu.org/licenses/>.
26 */
27 
28 
29 #include <loos.hpp>
30 #include <DensityGrid.hpp>
31 
32 using namespace std;
33 using namespace loos;
34 using namespace loos::DensityTools;
35 
36 int main(int argc, char *argv[]) {
37  string hdr = invocationHeader(argc, argv);
38  if (argc != 2) {
39  cerr << "Usage- gridscale scale-value <in-grid >out-grid\n";
40  cerr << "\nScales the density values in the grid by the specified value.\n";
41  cerr << "Requires a double-precision floating point grid.\n";
42  exit(-1);
43  }
44 
45  double konst = strtod(argv[1], 0);
46 
48  cin >> grid;
49  grid.scale(konst);
50  grid.addMetadata(hdr);
51  cout << grid;
52 }
53 
STL namespace.
std::string invocationHeader(int argc, char *argv[])
Create an invocation header.
Definition: utils.cpp:124
Namespace for Density package.
Definition: DensityGrid.hpp:48
Namespace for most things not already encapsulated within a class.