Navigation

Main Page
Download
Support
Installation
Tutorial
Examples
Reference Manual
   Version 1.0.6dev
      Class Index
      File List
   Version 1.0.6
   Version 1.0.5new_solver
   Version 1.0.5dev
   Version 1.0.5b
   Version 1.0.4dev
   Version 1.0.4
Publications


Hosted by Get Ion Beam Simulator at SourceForge.net. Fast, secure and Free Open Source software downloads
meshscalarfield.hpp
Go to the documentation of this file.
1 
5 /* Copyright (c) 2005-2011 Taneli Kalvas. All rights reserved.
6  *
7  * You can redistribute this software and/or modify it under the terms
8  * of the GNU General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * This library is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this library (file "COPYING" included in the package);
19  * if not, write to the Free Software Foundation, Inc., 51 Franklin
20  * Street, Fifth Floor, Boston, MA 02110-1301 USA
21  *
22  * If you have questions about your rights to use or distribute this
23  * software, please contact Berkeley Lab's Technology Transfer
24  * Department at TTD@lbl.gov. Other questions, comments and bug
25  * reports should be sent directly to the author via email at
26  * taneli.kalvas@jyu.fi.
27  *
28  * NOTICE. This software was developed under partial funding from the
29  * U.S. Department of Energy. As such, the U.S. Government has been
30  * granted for itself and others acting on its behalf a paid-up,
31  * nonexclusive, irrevocable, worldwide license in the Software to
32  * reproduce, prepare derivative works, and perform publicly and
33  * display publicly. Beginning five (5) years after the date
34  * permission to assert copyright is obtained from the U.S. Department
35  * of Energy, and subject to any subsequent five (5) year renewals,
36  * the U.S. Government is granted for itself and others acting on its
37  * behalf a paid-up, nonexclusive, irrevocable, worldwide license in
38  * the Software to reproduce, prepare derivative works, distribute
39  * copies to the public, perform publicly and display publicly, and to
40  * permit others to do so.
41  */
42 
43 #ifndef MESHSCALARFIELD_HPP
44 #define MESHSCALARFIELD_HPP 1
45 
46 
47 #include <iostream>
48 #include "mesh.hpp"
49 #include "scalarfield.hpp"
50 
51 
70 class MeshScalarField : public ScalarField, public Mesh {
71 
74  void check_definition();
75 
76 protected:
77 
78  double *_F;
80 public:
81 
90 
97  MeshScalarField( const Mesh &m );
98 
105 
108  MeshScalarField( std::istream &s );
109 
112  MeshScalarField( const MeshScalarField &f );
113 
116  virtual ~MeshScalarField();
117 
120  void clear();
121 
127  void reset( geom_mode_e geom_mode, Int3D size, Vec3D origo, double h );
128 
131  void get_minmax( double &min, double &max ) const;
132 
136 
140 
144 
147  MeshScalarField &operator*=( double x );
148 
151  MeshScalarField &operator/=( double x );
152 
155  inline double &operator()( int32_t i ) {
156  return( _F[i] ); }
157 
160  inline double &operator()( int32_t i, int32_t j ) {
161  return( _F[i + j*_size(0)] ); }
162 
165  inline double &operator()( int32_t i, int32_t j, int32_t k ) {
166  return( _F[i + (j + k*_size(1))*_size(0)] ); }
167 
170  inline const double &operator()( int32_t i ) const {
171  return( _F[i] ); }
172 
175  inline const double &operator()( int32_t i, int32_t j ) const {
176  return( _F[i + j*_size(0)] ); }
177 
180  inline const double &operator()( int32_t i, int32_t j, int32_t k ) const {
181  return( _F[i + (j + k*_size(1))*_size(0)] ); }
182 
190  virtual double operator()( const Vec3D &x ) const;
191 
194  void save( const std::string &filename ) const;
195 
198  void save( std::ostream &os ) const;
199 
202  void debug_print( std::ostream &os ) const;
203 };
204 
205 
206 #endif
3D Integer vector class.
Definition: vec3d.hpp:320
Scalar field class.
Definition: meshscalarfield.hpp:70
MeshScalarField & operator+=(const MeshScalarField &f)
Accumulation operator.
Definition: meshscalarfield.cpp:205
double & operator()(int32_t i, int32_t j, int32_t k)
Operator for pointing to elements of the field mesh.
Definition: meshscalarfield.hpp:165
double * _F
Scalar field data.
Definition: meshscalarfield.hpp:78
void get_minmax(double &min, double &max) const
Search minimum and maximum values of scalar field.
Definition: meshscalarfield.cpp:140
void debug_print(std::ostream &os) const
Print debugging information to os.
Definition: meshscalarfield.cpp:348
void reset(geom_mode_e geom_mode, Int3D size, Vec3D origo, double h)
Resets the field geometry.
Definition: meshscalarfield.cpp:128
MeshScalarField & operator/=(double x)
Inverse scaling operator.
Definition: meshscalarfield.cpp:238
const double & operator()(int32_t i, int32_t j) const
Operator for pointing to elements of the field mesh.
Definition: meshscalarfield.hpp:175
MeshScalarField & operator=(const MeshScalarField &f)
Copy operator.
Definition: meshscalarfield.cpp:193
void clear()
Clears the field.
Definition: meshscalarfield.cpp:121
double & operator()(int32_t i, int32_t j)
Operator for pointing to elements of the field mesh.
Definition: meshscalarfield.hpp:160
MeshScalarField()
Default constructor.
Definition: meshscalarfield.cpp:52
virtual ~MeshScalarField()
Destructor.
Definition: meshscalarfield.cpp:98
const double & operator()(int32_t i) const
Operator for pointing to elements of the field mesh.
Definition: meshscalarfield.hpp:170
const double & operator()(int32_t i, int32_t j, int32_t k) const
Operator for pointing to elements of the field mesh.
Definition: meshscalarfield.hpp:180
void save(const std::string &filename) const
Saves scalar field data to file filename.
Definition: meshscalarfield.cpp:329
MeshScalarField & operator*=(double x)
Scaling operator.
Definition: meshscalarfield.cpp:229
MeshScalarField & operator-=(const MeshScalarField &f)
Inverse accumulation operator.
Definition: meshscalarfield.cpp:217
double & operator()(int32_t i)
Operator for pointing to elements of the field mesh.
Definition: meshscalarfield.hpp:155
Mesh geometry definion.
Definition: mesh.hpp:68
double h(void) const
Returns mesh cell size.
Definition: mesh.hpp:146
Int3D size(void) const
Returns size array of geometry.
Definition: mesh.hpp:116
Vec3D max(void) const
Returns vector pointing to the last mesh point opposite of origo.
Definition: mesh.hpp:137
Vec3D origo(void) const
Returns origo vector of geometry.
Definition: mesh.hpp:128
Int3D _size
Size of mesh.
Definition: mesh.hpp:71
geom_mode_e geom_mode(void) const
Returns geometry mode.
Definition: mesh.hpp:108
Scalar field.
Definition: scalarfield.hpp:55
Three dimensional vector.
Definition: vec3d.hpp:58
Rectangular mesh definition.
Scalar fields.
geom_mode_e
Geometry mode enum.
Definition: types.hpp:59


Reference manual for Ion Beam Simulator 1.0.6dev
Generated by Doxygen 1.9.1 on Thu Sep 11 2025 09:37:24.