Vlasiator ebf0dd394 on dev (v5.4.0 + 1054 commits)
Loading...
Searching...
No Matches
constantfield.cpp
Go to the documentation of this file.
1/*
2 * This file is part of Vlasiator.
3 * Copyright 2010-2016 Finnish Meteorological Institute
4 *
5 * For details of usage, see the COPYING file and read the "Rules of the Road"
6 * at http://www.physics.helsinki.fi/vlasiator/
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 */
22/*
23Background magnetic field class of Vlasiator.
24*/
25
26#include <stdlib.h>
27#include <math.h>
28#include "constantfield.hpp"
29#include "../common.h"
30
31
32void ConstantField::initialize(const double Bx,const double By, const double Bz){
33 _B[0]=Bx;
34 _B[1]=By;
35 _B[2]=Bz;
36 _initialized=true;
37}
38
39
40
41double ConstantField::operator()( double x, double y, double z, coordinate component, unsigned int derivative, coordinate dcomponent) const {
42 if(derivative == 0) {
43 //Value of B
44 return _B[component];
45 } else {
46 //all derivatives are zero
47 return 0.0;
48 }
49}
50
51
52
53
54
55
Real operator()(Real x, Real y, Real z, coordinate component, unsigned int derivative, coordinate dcomponent) const
void initialize(const double Bx, const double By, const double Bz)
coordinate
Definition functions.hpp:28