KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > JSci > physics > relativity > EMFieldTensor


1 package JSci.physics.relativity;
2
3 import JSci.maths.vectors.Double3Vector;
4
5 /**
6 * The EMFieldTensor class encapsulates the electromagnetic field tensor.
7 * @version 1.0
8 * @author Mark Hale
9 */

10 public final class EMFieldTensor extends Rank2Tensor {
11         /**
12         * Constructs an electromagnetic field tensor.
13         * @param E electric field
14         * @param B magnetic field
15         */

16         public EMFieldTensor(Double3Vector E,Double3Vector B) {
17                 rank2[0][0]=rank2[1][1]=rank2[2][2]=rank2[3][3]=0.0;
18                 rank2[1][0]=E.getComponent(0);
19                 rank2[2][0]=E.getComponent(1);
20                 rank2[3][0]=E.getComponent(2);
21                 rank2[3][2]=B.getComponent(0);
22                 rank2[1][3]=B.getComponent(1);
23                 rank2[2][1]=B.getComponent(2);
24                 rank2[0][1]=-rank2[1][0];
25                 rank2[0][2]=-rank2[2][0];
26                 rank2[0][3]=-rank2[3][0];
27                 rank2[2][3]=-rank2[3][2];
28                 rank2[3][1]=-rank2[1][3];
29                 rank2[1][2]=-rank2[2][1];
30         }
31 }
32
33
Popular Tags