SIMION® Industry standard charged particle optics simulation software.
Newsflash: SIMION 8.1.1 is here: dielectrics, new examples + preview of permeability; ASMS2012 posters; major improvements to enhanced surface accuracy feature coming soon (details in Check for Updates).
About | Documentation | Community/Support | Downloads | Ordering

SL Libraries -- C++

The SIMION SL™ Toolkit (version 1.2.1.0 - 2004-11-09)

field.cpp

Go to the documentation of this file.
00001 /** 00002 * @file field.cpp 00003 * Generates magnetic PA from magnetic field vectors. 00004 * 00005 * David Manura, Scientific Instrument Services, Inc. 00006 * $Revision: 1.3 $ $Date: 2004/07/17 20:48:50 $ Created 2004-07. 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:
  Name/e-mail/phone (optional):
 
The SIMION SL Toolkit™ and documentation is (c) 2003-2004 Scientific Instrument Services, Inc. All Rights Reserved.
Any comments on this web page? (will be sent to SIS)
[Optional] Your name: email: phone/fax:
The SL Tookit™ and documentation is (c) 2003 Scientific Instrument Services, Inc. All Rights Reserved.
(c) 2003-2006 Scientific Instrument Services, Inc. (SIS). Contact SIS.