The SIMION SL Toolkit (version 1.2.1.0 - 2004-11-09) |
field.cppGo to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009 #include <simion/pa.h>
00010 #include <cmath>
00011 using namespace std;
00012 using namespace simion;
00013
00014 void test1()
00015 {
00016 PA pa( PAArgs().nx(100).ny(100));
00017 int z = 0;
00018 for( int x = 0; x < pa. nx(); x++) {
00019 for( int y = 0; y < pa. ny(); y++) {
00020 double ex = x;
00021 double ey = y*y;
00022 double ez = z;
00023 pa. field(x, y, z, ex, ey, ez);
00024 }}
00025 pa. save( "mag1.pa");
00026 }
00027
00028 void test2()
00029 {
00030 PA pa( PAArgs().nx(100).ny(100).field_type( MAGNETIC));
00031
00032 int z = 0;
00033 for( int x = 0; x < pa. nx()-1; x++) {
00034 for( int y = 0; y < pa. ny()-1; y++) {
00035 double ex = cos(( double)x / 10.0);
00036 double ey = sin(( double)y / 10.0);
00037 double ez = 0;
00038 pa. field(x, y, z, ex, ey, ez);
00039 }}
00040 pa. save( "mag2.pa");
00041 }
00042
00043 int main()
00044 {
00045 test1();
00046 test2();
00047
00048 return 0;
00049 }
00050
00051
00052
(c) 2003-2004. Scientific Instrument Services, Inc. All Rights Reserved.
|
Please report any errors/comments regarding this web page: