[cig-commits] r4322 - in long/3D/Gale/trunk/src/StGermain: .
Discretisation/Geometry/src
walter at geodynamics.org
walter at geodynamics.org
Thu Aug 17 17:16:57 PDT 2006
Author: walter
Date: 2006-08-17 17:16:57 -0700 (Thu, 17 Aug 2006)
New Revision: 4322
Modified:
long/3D/Gale/trunk/src/StGermain/
long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/src/ComplexMath.h
long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/src/VectorMath.c
long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/src/VectorMath.h
long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/src/units.h
Log:
r2700 at earth: boo | 2006-08-17 17:14:16 -0700
r2654 at earth (orig r3735): KathleenHumble | 2006-08-01 01:05:14 -0700
Updated comments in VectorMath, fixed up typos
in COmplexMath and units from last commit.
Made sure all relevant comments are readable in doxygen
Property changes on: long/3D/Gale/trunk/src/StGermain
___________________________________________________________________
Name: svk:merge
- 1ef209d2-b310-0410-a72d-e20c9eb0015c:/cig:2699
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/trunk/StGermain:3734
+ 1ef209d2-b310-0410-a72d-e20c9eb0015c:/cig:2700
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/trunk/StGermain:3735
Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/src/ComplexMath.h
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/src/ComplexMath.h 2006-08-18 00:16:54 UTC (rev 4321)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/src/ComplexMath.h 2006-08-18 00:16:57 UTC (rev 4322)
@@ -73,7 +73,7 @@
Cmplx_RealPower( self, 0.5, destination )
/** Print a complex number.
-Currently uses %g.5 formatting */
+Currently uses %.5g formatting */
#define Journal_PrintCmplx( stream, self ) \
Journal_Printf( stream, #self " = %.5g %c %.5g i\n", (self)[ REAL_PART ], (self)[ IMAG_PART ] >= 0.0 ? '+' : '-', fabs( (self)[ IMAG_PART ] ) )
Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/src/VectorMath.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/src/VectorMath.c 2006-08-18 00:16:54 UTC (rev 4321)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/src/VectorMath.c 2006-08-18 00:16:57 UTC (rev 4322)
@@ -53,6 +53,7 @@
** Base operations.
*/
+/** (Assumes 3D) Define a cross product of 2 vectors */
void Vector_Cross( Coord dst, Coord a, Coord b ) {
Coord tmp;
@@ -63,7 +64,7 @@
Vector_Set( dst, tmp );
}
-
+/** (Assumes 3D) Divide a vector by a real */
void Vector_Div( Coord dest, Coord a, double s )
{
double inv = 1.0 / s;
@@ -73,7 +74,7 @@
dest[2] = a[2] * inv;
}
-
+/** Calculate the normal of the vector. (ie length = 1 )*/
void Vector_Norm( Coord dest, Coord a )
{
double invMag = 1.0 / sqrt( a[0] * a[0] + a[1] * a[1] + a[2] * a[2] );
@@ -83,7 +84,7 @@
dest[2] = a[2] * invMag;
}
-
+/** Swap coordinates according to i,j, k index */
void Vector_Swizzle( Coord dst, Coord src, unsigned char iInd, unsigned char jInd, unsigned char kInd ) {
assert( iInd < 3 && jInd < 3 && kInd < 3 );
@@ -99,7 +100,6 @@
which was taken from:
Eric W. Weisstein et al. "Rodrigues' Rotation Formula." From MathWorld--A Wolfram Web Resource.
http://mathworld.wolfram.com/RodriguesRotationFormula.html. */
-
void StGermain_RotateVector(double* rotatedVector, double* vector, double* w, double theta) {
double rotationMatrix[3][3]; /* Indicies [Column][Row] */
double cosTheta = cos(theta);
@@ -231,7 +231,7 @@
return dotProduct;
}
-/* See Eric W. Weisstein. "Cross Product."
+/** See Eric W. Weisstein. "Cross Product."
From MathWorld--A Wolfram Web Resource. http://mathworld.wolfram.com/CrossProduct.html
Tested against http://www.engplanet.com/redirect.html?3859 */
void StGermain_VectorCrossProduct(double* destination, double* vector1, double* vector2) {
@@ -240,7 +240,7 @@
destination[2] = vector1[0]*vector2[1] - vector1[1]*vector2[0];
}
-/* StGermain_VectorCrossProductMagnitude - See Eric W. Weisstein. "Cross Product."
+/** StGermain_VectorCrossProductMagnitude - See Eric W. Weisstein. "Cross Product."
From MathWorld--A Wolfram Web Resource. http://mathworld.wolfram.com/CrossProduct.html
|a \times b| = |a||b|\sqrt{ 1 - (\hat a . \hat b)^2}
*/
@@ -456,7 +456,8 @@
if (dim == 3)
coord[ K_AXIS ] *= factor;
}
-
+/** Prints a vector of any non-zero positive length
+Uses %lf print statement*/
void StGermain_PrintVector( Stream* stream, double* vector, Index dim ) {
Index d;
@@ -471,8 +472,3 @@
Journal_Printf( stream, "%lf}\n", vector[d] );
}
-
-
-
-
-
Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/src/VectorMath.h
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/src/VectorMath.h 2006-08-18 00:16:54 UTC (rev 4321)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/src/VectorMath.h 2006-08-18 00:16:57 UTC (rev 4322)
@@ -52,47 +52,47 @@
** Base operations.
*/
- /* copy src onto dest */
+ /** copy src onto dest */
#define Vector_Set( dest, src ) \
(dest)[0] = (src)[0]; \
(dest)[1] = (src)[1]; \
(dest)[2] = (src)[2]
- /* set dest's components to src */
+ /** set dest's components to src */
#define Vector_SetScalar( dest, x, y, z ) \
(dest)[0] = x; \
(dest)[1] = y; \
(dest)[2] = z
- /* dest = a + b */
+ /** dest = a + b */
#define Vector_Add( dest, a, b ) \
(dest)[0] = (a)[0] + (b)[0]; \
(dest)[1] = (a)[1] + (b)[1]; \
(dest)[2] = (a)[2] + (b)[2]
- /* dest = a - b */
+ /** dest = a - b */
#define Vector_Sub( dest, a, b ) \
(dest)[0] = (a)[0] - (b)[0]; \
(dest)[1] = (a)[1] - (b)[1]; \
(dest)[2] = (a)[2] - (b)[2]
- /* returns the dot product of a and b */
+ /** returns the dot product of a and b */
#define Vector_Dot( a, b ) \
((a)[0] * (b)[0] + (a)[1] * (b)[1] + (a)[2] * (b)[2])
- /* dest = a * s */
+ /** dest = a * s */
#define Vector_Mult( dest, a, s ) \
(dest)[0] = (a)[0] * (s); \
(dest)[1] = (a)[1] * (s); \
(dest)[2] = (a)[2] * (s)
- /* returns the magnitude of a */
+ /** returns the magnitude of a */
#define Vector_Mag( a ) \
sqrt( (a)[0] * (a)[0] + (a)[1] * (a)[1] + (a)[2] * (a)[2] )
@@ -101,7 +101,7 @@
** Combinations of base operations.
*/
- /* vector projection of a onto b, store result in dest */
+ /** vector projection of a onto b, store result in dest */
#define Vector_Proj( dest, a, b ) \
Vector_Norm( (dest), (b) ); \
Vector_Mult( (dest), (dest), Vector_Dot( a, b ) )
@@ -151,7 +151,7 @@
void StGermain_AverageCoord( double* coord, double** coordList, Index count, Dimension_Index dim ) ;
void StGermain_PrintVector( Stream* stream, double* vector, Index dim ) ;
-
+ /** Print a named vector. Name comes from vector variable in file*/
#define StGermain_PrintNamedVector(stream, vector, dim) \
do { \
Journal_Printf( stream, #vector " - " ); \
Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/src/units.h
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/src/units.h 2006-08-18 00:16:54 UTC (rev 4321)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/src/units.h 2006-08-18 00:16:57 UTC (rev 4322)
@@ -13,6 +13,7 @@
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
+** License as publishdify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version.
**
@@ -51,11 +52,11 @@
/**Defines a set of 3 floats */
typedef float XYZF[3];
typedef XYZF CoordF;
- /* Defines a set of 3 integers that can be used to index
+ /** Defines a set of 3 integers that can be used to index
into vectors */
typedef int XYZI[3];
typedef XYZI CoordI;
- /* Defines a set of 3 Cmplx */
+ /** Defines a set of 3 Cmplx */
typedef Cmplx XYZC[3];
typedef XYZC CoordC;
More information about the cig-commits
mailing list