[cig-commits] r5652 - in long/3D/Gale/trunk/src/StGermain: . Discretisation/Mesh/src

walter at geodynamics.org walter at geodynamics.org
Fri Jan 5 11:34:55 PST 2007


Author: walter
Date: 2007-01-05 11:34:54 -0800 (Fri, 05 Jan 2007)
New Revision: 5652

Added:
   long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_RegularAlgorithms.c
   long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_RegularAlgorithms.h
   long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_RegularAlgorithms.meta
Modified:
   long/3D/Gale/trunk/src/StGermain/
   long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/CartesianGenerator.c
   long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Init.c
   long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh.h
   long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/MeshAdaptor.c
   long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/MeshAdaptor.h
   long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/MeshClass.c
   long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/MeshClass.h
   long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/MeshGenerator.c
   long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/MeshGenerator.h
   long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/MeshTopology.c
   long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_Algorithms.c
   long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/SurfaceAdaptor.c
   long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/types.h
Log:
 r3223 at earth (orig r3914):  LukeHodkinson | 2007-01-01 17:02:32 -0800
 Fixing a number of minor problems and adding a 
 class to handle more efficient regular mesh
 operations.
 
 



Property changes on: long/3D/Gale/trunk/src/StGermain
___________________________________________________________________
Name: svk:merge
   - 1ef209d2-b310-0410-a72d-e20c9eb0015c:/cig:3196
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/branches/decomp3d/StGermain:3913
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/trunk/StGermain:3899
   + 1ef209d2-b310-0410-a72d-e20c9eb0015c:/cig:3196
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/branches/decomp3d/StGermain:3914
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/trunk/StGermain:3899

Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/CartesianGenerator.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/CartesianGenerator.c	2007-01-05 19:33:39 UTC (rev 5651)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/CartesianGenerator.c	2007-01-05 19:34:54 UTC (rev 5652)
@@ -145,6 +145,8 @@
 	char*			rootKey;
 	Dictionary_Entry_Value*	sizeList;
 	Dictionary_Entry_Value	*minList, *maxList;
+	unsigned		maxDecompDims;
+	unsigned		*minDecomp, *maxDecomp;
 	double			*crdMin, *crdMax;
 	unsigned*		size;
 	unsigned		shadowDepth;
@@ -173,8 +175,41 @@
 		size[d_i] = Dictionary_Entry_Value_AsUnsignedInt( tmp );
 	}
 
+	/* Read decomposition restrictions. */
+	maxDecompDims = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, "maxDecomposedDims", 0 );
+
+	minList = Dictionary_Get( dict, "minDecompositions" );
+	if( minList ) {
+		minDecomp = AllocArray( unsigned, self->nDims );
+		for( d_i = 0; d_i < self->nDims; d_i++ ) {
+			tmp = Dictionary_Entry_Value_GetElement( minList, d_i );
+			rootKey = Dictionary_Entry_Value_AsString( tmp );
+
+			if( !Stg_StringIsNumeric( rootKey ) )
+				tmp = Dictionary_Get( cf->rootDict, rootKey );
+			minDecomp[d_i] = Dictionary_Entry_Value_AsUnsignedInt( tmp );
+		}
+	}
+	else
+		minDecomp = NULL;
+
+	maxList = Dictionary_Get( dict, "maxDecompositions" );
+	if( maxList ) {
+		maxDecomp = AllocArray( unsigned, self->nDims );
+		for( d_i = 0; d_i < self->nDims; d_i++ ) {
+			tmp = Dictionary_Entry_Value_GetElement( maxList, d_i );
+			rootKey = Dictionary_Entry_Value_AsString( tmp );
+
+			if( !Stg_StringIsNumeric( rootKey ) )
+				tmp = Dictionary_Get( cf->rootDict, rootKey );
+			maxDecomp[d_i] = Dictionary_Entry_Value_AsUnsignedInt( tmp );
+		}
+	}
+	else
+		maxDecomp = NULL;
+
 	/* Initial setup. */
-	CartesianGenerator_SetTopologyParams( self, size, 0, NULL, NULL );
+	CartesianGenerator_SetTopologyParams( self, size, maxDecompDims, minDecomp, maxDecomp );
 
 	/* Read geometry. */
 	minList = Dictionary_Get( dict, "minCoord" );
@@ -217,6 +252,8 @@
 
 	/* Free stuff. */
 	FreeArray( size );
+	FreeArray( minDecomp );
+	FreeArray( maxDecomp );
 }
 
 void _CartesianGenerator_Build( void* meshGenerator, void* data ) {
@@ -282,8 +319,12 @@
 
 	if( minDecomp )
 		memcpy( self->minDecomp, minDecomp, self->nDims * sizeof(unsigned) );
+	else
+		memset( self->minDecomp, 0, self->nDims * sizeof(unsigned) );
 	if( maxDecomp )
 		memcpy( self->maxDecomp, maxDecomp, self->nDims * sizeof(unsigned) );
+	else
+		memset( self->maxDecomp, 0, self->nDims * sizeof(unsigned) );
 	self->maxDecompDims = maxDecompDims;
 
 	/* As soon as we know the topology, we can decompose. */
@@ -659,7 +700,8 @@
 
 			MeshTopology_Invert( topo, d_i, d_j );
 		}
-
+	}
+	for( d_i = 0; d_i <= self->nDims; d_i++ ) {
 		if( self->enabledInc[d_i][d_i] )
 			MeshTopology_Neighbourhood( topo, d_i );
 	}

Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Init.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Init.c	2007-01-05 19:33:39 UTC (rev 5651)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Init.c	2007-01-05 19:34:54 UTC (rev 5652)
@@ -54,6 +54,9 @@
 	Stg_ComponentRegister_Add( Stg_ComponentRegister_Get_ComponentRegister(), 
 				   Mesh_Algorithms_Type, "0", (Stg_Component_DefaultConstructorFunction*)Mesh_Algorithms_New );
 	Stg_ComponentRegister_Add( Stg_ComponentRegister_Get_ComponentRegister(), 
+				   Mesh_RegularAlgorithms_Type, "0", 
+				   (Stg_Component_DefaultConstructorFunction*)Mesh_RegularAlgorithms_New );
+	Stg_ComponentRegister_Add( Stg_ComponentRegister_Get_ComponentRegister(), 
 				   MeshTopology_Type, "0", (Stg_Component_DefaultConstructorFunction*)MeshTopology_New );
 	Stg_ComponentRegister_Add( Stg_ComponentRegister_Get_ComponentRegister(), 
 				   CartesianGenerator_Type, "0", (Stg_Component_DefaultConstructorFunction*)CartesianGenerator_New );
@@ -65,6 +68,7 @@
 				   MeshVariable_Type, "0", (Stg_Component_DefaultConstructorFunction*)MeshVariable_New );
 
 	RegisterParent( Mesh_Algorithms_Type, Stg_Component_Type );
+	RegisterParent( Mesh_RegularAlgorithms_Type, Mesh_Algorithms_Type );
 	RegisterParent( MeshTopology_Type, Stg_Component_Type );
 	RegisterParent( Mesh_Type, Stg_Component_Type );
 	RegisterParent( MeshGenerator_Type, Stg_Component_Type );

Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh.h
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh.h	2007-01-05 19:33:39 UTC (rev 5651)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh.h	2007-01-05 19:34:54 UTC (rev 5652)
@@ -56,6 +56,7 @@
 	#include "Mesh_ElementType.h"
 	#include "Mesh_HexType.h"
 	#include "Mesh_Algorithms.h"
+	#include "Mesh_RegularAlgorithms.h"
 	#include "MeshClass.h"
 	#include "MeshGenerator.h"
 	#include "CartesianGenerator.h"

Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/MeshAdaptor.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/MeshAdaptor.c	2007-01-05 19:33:39 UTC (rev 5651)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/MeshAdaptor.c	2007-01-05 19:34:54 UTC (rev 5652)
@@ -61,7 +61,7 @@
 	
 	/* Allocate memory */
 	assert( sizeOfSelf >= sizeof(MeshAdaptor) );
-	self = (MeshAdaptor*)_MeshGenerator_New( STG_COMPONENT_PASSARGS, NULL, generateFunc );
+	self = (MeshAdaptor*)_MeshGenerator_New( MESHGENERATOR_PASSARGS );
 
 	/* Virtual info */
 

Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/MeshAdaptor.h
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/MeshAdaptor.h	2007-01-05 19:33:39 UTC (rev 5651)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/MeshAdaptor.h	2007-01-05 19:34:54 UTC (rev 5652)
@@ -63,14 +63,11 @@
 	** Constructors
 	*/
 
-	#define MESHADAPTOR_DEFARGS	\
-		STG_COMPONENT_DEFARGS,				\
-		MeshGenerator_GenerateFunc*	generateFunc
+	#define MESHADAPTOR_DEFARGS \
+		MESHGENERATOR_DEFARGS
 
-	#define MESHADAPTOR_PASSARGS		\
-		STG_COMPONENT_PASSARGS,		\
-		NULL,				\
-		generateFunc
+	#define MESHADAPTOR_PASSARGS \
+		MESHGENERATOR_PASSARGS
 
 	MeshAdaptor* _MeshAdaptor_New( MESHADAPTOR_DEFARGS );
 	void _MeshAdaptor_Init( MeshAdaptor* self );

Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/MeshClass.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/MeshClass.c	2007-01-05 19:33:39 UTC (rev 5651)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/MeshClass.c	2007-01-05 19:34:54 UTC (rev 5652)
@@ -435,11 +435,19 @@
 {
 	Mesh*	self = (Mesh*)mesh;
 
-	assert( self );
+	assert( self && Stg_CheckType( self, Mesh ) );
 
 	return Mesh_Algorithms_Search( self->algorithms, point, dim, ind );
 }
 
+Bool Mesh_SearchElements( void* mesh, double* point, unsigned* elInd ) {
+	Mesh*	self = (Mesh*)mesh;
+
+	assert( self && Stg_CheckType( self, Mesh ) );
+
+	return Mesh_Algorithms_SearchElements( self->algorithms, point, elInd );
+}
+
 Bool Mesh_ElementHasPoint( void* mesh, unsigned element, double* point, 
 			   MeshTopology_Dim* dim, unsigned* ind )
 {

Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/MeshClass.h
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/MeshClass.h	2007-01-05 19:33:39 UTC (rev 5651)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/MeshClass.h	2007-01-05 19:34:54 UTC (rev 5652)
@@ -149,6 +149,7 @@
 	unsigned Mesh_NearestVertex( void* mesh, double* point );
 	Bool Mesh_Search( void* mesh, double* point, 
 			  MeshTopology_Dim* dim, unsigned* ind );
+	Bool Mesh_SearchElements( void* mesh, double* point, unsigned* elInd );
 	Bool Mesh_ElementHasPoint( void* mesh, unsigned element, double* point, 
 				   MeshTopology_Dim* dim, unsigned* ind );
 	Mesh_ElementType* Mesh_GetElementType( void* mesh, unsigned element );

Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/MeshGenerator.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/MeshGenerator.c	2007-01-05 19:33:39 UTC (rev 5651)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/MeshGenerator.c	2007-01-05 19:34:54 UTC (rev 5652)
@@ -257,6 +257,18 @@
 	self->enabledDims[dim] = state;
 }
 
+void MeshGenerator_ClearIncidenceStates( void* meshGenerator ) {
+	MeshGenerator*	self = (MeshGenerator*)meshGenerator;
+	unsigned	d_i, d_j;
+
+	assert( self && Stg_CheckType( self, MeshGenerator ) );
+
+	for( d_i = 0; d_i <= self->nDims; d_i++ ) {
+		for( d_j = 0; d_j <= self->nDims; d_j++ )
+			self->enabledInc[d_i][d_j] = False;
+	}
+}
+
 void MeshGenerator_SetIncidenceState( void* meshGenerator, unsigned fromDim, unsigned toDim, Bool state ) {
 	MeshGenerator*	self = (MeshGenerator*)meshGenerator;
 

Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/MeshGenerator.h
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/MeshGenerator.h	2007-01-05 19:33:39 UTC (rev 5651)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/MeshGenerator.h	2007-01-05 19:34:54 UTC (rev 5652)
@@ -119,6 +119,7 @@
 	void MeshGenerator_SetComm( void* meshGenerator, MPI_Comm comm );
 	void MeshGenerator_AddMesh( void* meshGenerator, void* mesh );
 	void MeshGenerator_SetDimState( void* meshGenerator, unsigned dim, Bool state );
+	void MeshGenerator_ClearIncidenceStates( void* meshGenerator );
 	void MeshGenerator_SetIncidenceState( void* meshGenerator, unsigned fromDim, unsigned toDim, Bool state );
 
 	/*--------------------------------------------------------------------------------------------------------------------------

Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/MeshTopology.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/MeshTopology.c	2007-01-05 19:33:39 UTC (rev 5651)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/MeshTopology.c	2007-01-05 19:34:54 UTC (rev 5652)
@@ -884,6 +884,9 @@
 	}
 
 	for( d_i = 0; d_i < self->nTDims; d_i++ ) {
+		if( !MeshTopology_GetCommTopology( self, d_i ) )
+			continue;
+
 		for( p_i = 0; p_i < nIncRanks; p_i++ ) {
 			FreeArray( shdEls[d_i][p_i] );
 			FreeArray( shdInc[d_i][p_i] );

Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_Algorithms.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_Algorithms.c	2007-01-05 19:33:39 UTC (rev 5651)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_Algorithms.c	2007-01-05 19:34:54 UTC (rev 5652)
@@ -176,7 +176,7 @@
 	assert( self && Stg_CheckType( self, Mesh_Algorithms ) );
 	assert( self->nearestVertex );
 
-	self->nearestVertex( self, point );
+	return self->nearestVertex( self, point );
 }
 
 Bool _Mesh_Algorithms_Search( void* algorithms, double* point, 
@@ -187,7 +187,7 @@
 	assert( self && Stg_CheckType( self, Mesh_Algorithms ) );
 	assert( self->search );
 
-	self->search( self, point, dim, ind );
+	return self->search( self, point, dim, ind );
 }
 
 Bool _Mesh_Algorithms_SearchElements( void* algorithms, double* point, 
@@ -519,13 +519,13 @@
 	for( inc_i = 0; inc_i < nInc; inc_i++ ) {
 		if( Mesh_ElementHasPoint( mesh, inc[inc_i], point, dim, ind ) )
 			return True;
+	}
 
-		/* Brute force, search every element in turn (last resort). */
-		nEls = Mesh_GetDomainSize( mesh, nDims );
-		for( e_i = 0; e_i < nEls; e_i++ ) {
-			if( Mesh_ElementHasPoint( mesh, e_i, point, dim, ind ) )
-				return True;
-		}
+	/* Brute force, search every element in turn (last resort). */
+	nEls = Mesh_GetDomainSize( mesh, nDims );
+	for( e_i = 0; e_i < nEls; e_i++ ) {
+		if( Mesh_ElementHasPoint( mesh, e_i, point, dim, ind ) )
+			return True;
 	}
 
 	return False;

Added: long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_RegularAlgorithms.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_RegularAlgorithms.c	2007-01-05 19:33:39 UTC (rev 5651)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_RegularAlgorithms.c	2007-01-05 19:34:54 UTC (rev 5652)
@@ -0,0 +1,237 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify 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.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: Mesh_RegularAlgorithms.c 3584 2006-05-16 11:11:07Z PatrickSunter $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include <mpi.h>
+
+#include "Base/Base.h"
+#include "Discretisation/Geometry/Geometry.h"
+#include "Mesh.h"
+
+
+/* Textual name of this class */
+const Type Mesh_RegularAlgorithms_Type = "Mesh_RegularAlgorithms";
+
+
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Constructors
+*/
+
+Mesh_RegularAlgorithms* Mesh_RegularAlgorithms_New( Name name ) {
+	return _Mesh_RegularAlgorithms_New( sizeof(Mesh_RegularAlgorithms), 
+					    Mesh_RegularAlgorithms_Type, 
+					    _Mesh_RegularAlgorithms_Delete, 
+					    _Mesh_RegularAlgorithms_Print, 
+					    NULL, 
+					    (void* (*)(Name))_Mesh_RegularAlgorithms_New, 
+					    _Mesh_RegularAlgorithms_Construct, 
+					    _Mesh_RegularAlgorithms_Build, 
+					    _Mesh_RegularAlgorithms_Initialise, 
+					    _Mesh_RegularAlgorithms_Execute, 
+					    _Mesh_RegularAlgorithms_Destroy, 
+					    name, 
+					    NON_GLOBAL, 
+					    _Mesh_Algorithms_SetMesh, 
+					    _Mesh_Algorithms_Update, 
+					    _Mesh_Algorithms_NearestVertex, 
+					    _Mesh_Algorithms_Search, 
+					    Mesh_RegularAlgorithms_SearchElements, 
+					    _Mesh_Algorithms_GetMinimumSeparation, 
+					    _Mesh_Algorithms_GetLocalCoordRange, 
+					    _Mesh_Algorithms_GetDomainCoordRange, 
+					    _Mesh_Algorithms_GetGlobalCoordRange );
+}
+
+Mesh_RegularAlgorithms* _Mesh_RegularAlgorithms_New( MESH_REGULARALGORITHMS_DEFARGS ) {
+	Mesh_RegularAlgorithms* self;
+	
+	/* Allocate memory */
+	assert( sizeOfSelf >= sizeof(Mesh_RegularAlgorithms) );
+	self = (Mesh_RegularAlgorithms*)_Mesh_Algorithms_New( MESH_ALGORITHMS_PASSARGS );
+
+	/* Virtual info */
+
+	/* Mesh_RegularAlgorithms info */
+	_Mesh_RegularAlgorithms_Init( self );
+
+	return self;
+}
+
+void _Mesh_RegularAlgorithms_Init( Mesh_RegularAlgorithms* self ) {
+}
+
+
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Virtual functions
+*/
+
+void _Mesh_RegularAlgorithms_Delete( void* algorithms ) {
+	Mesh_RegularAlgorithms*	self = (Mesh_RegularAlgorithms*)algorithms;
+
+	/* Delete the parent. */
+	_Mesh_Algorithms_Delete( self );
+}
+
+void _Mesh_RegularAlgorithms_Print( void* algorithms, Stream* stream ) {
+	Mesh_RegularAlgorithms*	self = (Mesh_RegularAlgorithms*)algorithms;
+	
+	/* Set the Journal for printing informations */
+	Stream* algorithmsStream;
+	algorithmsStream = Journal_Register( InfoStream_Type, "Mesh_RegularAlgorithmsStream" );
+
+	/* Print parent */
+	Journal_Printf( stream, "Mesh_RegularAlgorithms (ptr): (%p)\n", self );
+	_Mesh_Algorithms_Print( self, stream );
+}
+
+void _Mesh_RegularAlgorithms_Construct( void* algorithms, Stg_ComponentFactory* cf, void* data ) {
+	_Mesh_Algorithms_Construct( algorithms, cf, data );
+}
+
+void _Mesh_RegularAlgorithms_Build( void* algorithms, void* data ) {
+}
+
+void _Mesh_RegularAlgorithms_Initialise( void* algorithms, void* data ) {
+}
+
+void _Mesh_RegularAlgorithms_Execute( void* algorithms, void* data ) {
+}
+
+void _Mesh_RegularAlgorithms_Destroy( void* algorithms, void* data ) {
+}
+
+Bool _Mesh_RegularAlgorithms_Search( void* algorithms, void* _mesh, double* point, 
+				     MeshTopology_Dim* dim, unsigned* ind )
+{
+	Mesh_RegularAlgorithms*	self = (Mesh_RegularAlgorithms*)algorithms;
+	Mesh*			mesh = (Mesh*)_mesh;
+
+	assert( self );
+	assert( mesh );
+	assert( dim );
+	assert( ind );
+
+	/* TODO */
+
+	return False;
+}
+
+Bool Mesh_RegularAlgorithms_SearchElements( void* algorithms, double* point, unsigned* elInd ) {
+	Mesh_RegularAlgorithms*	self = (Mesh_RegularAlgorithms*)algorithms;
+	Mesh*			mesh;
+	unsigned		nDims;
+	unsigned		vertInd;
+	unsigned		inds[3];
+	Grid			*vertGrid, *elGrid;
+	unsigned		d_i;
+
+	assert( self && Stg_CheckType( self, Mesh_RegularAlgorithms ) );
+	assert( Mesh_GetDimSize( self->mesh ) <= 3 );
+	assert( elInd );
+
+	mesh = self->mesh;
+	nDims = Mesh_GetDimSize( mesh );
+	vertGrid = *(Grid**)ExtensionManager_Get( mesh->info, mesh, 
+						  ExtensionManager_GetHandle( mesh->info, "vertexGrid" ) );
+	elGrid = *(Grid**)ExtensionManager_Get( mesh->info, mesh, 
+						ExtensionManager_GetHandle( mesh->info, "elementGrid" ) );
+	for( d_i = 0; d_i < nDims; d_i++ ) {
+		for( inds[d_i] = 1; inds[d_i] < vertGrid->sizes[d_i]; inds[d_i]++ ) {
+			vertInd = Grid_Project( vertGrid, inds );
+			insist( Mesh_GlobalToDomain( mesh, MT_VERTEX, vertInd, &vertInd ) );
+			if( Mesh_GetVertex( mesh, vertInd )[d_i] >= point[d_i] )
+				break;
+		}
+		if( inds[d_i] == vertGrid->sizes[d_i] )
+			return False;
+		else
+			inds[d_i]--;
+	}
+	*elInd = Grid_Project( elGrid, inds );
+
+	return True;
+}
+
+double _Mesh_RegularAlgorithms_GetMinimumSeparation( void* algorithms, void* _mesh, double* perDim ) {
+	Mesh*			mesh = (Mesh*)_mesh;
+
+	/* TODO */
+
+	return 0.0;
+}
+
+void _Mesh_RegularAlgorithms_GetLocalCoordRange( void* algorithms, void* _mesh, double* min, double* max ) {
+	Mesh_RegularAlgorithms*	self = (Mesh_RegularAlgorithms*)algorithms;
+	Mesh*			mesh = (Mesh*)_mesh;
+
+	assert( self );
+	assert( mesh );
+	assert( min );
+	assert( max );
+
+	/* TODO */
+}
+
+void _Mesh_RegularAlgorithms_GetDomainCoordRange( void* algorithms, void* _mesh, double* min, double* max ) {
+	Mesh_RegularAlgorithms*	self = (Mesh_RegularAlgorithms*)algorithms;
+	Mesh*			mesh = (Mesh*)_mesh;
+
+	assert( self );
+	assert( mesh );
+	assert( min );
+	assert( max );
+
+	/* TODO */
+}
+
+void _Mesh_RegularAlgorithms_GetGlobalCoordRange( void* algorithms, void* _mesh, double* min, double* max ) {
+	Mesh_RegularAlgorithms*	self = (Mesh_RegularAlgorithms*)algorithms;
+	Mesh*			mesh = (Mesh*)_mesh;
+
+	assert( self );
+	assert( mesh );
+	assert( min );
+	assert( max );
+
+	/* TODO */
+}
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Public Functions
+*/
+
+
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Private Functions
+*/

Added: long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_RegularAlgorithms.h
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_RegularAlgorithms.h	2007-01-05 19:33:39 UTC (rev 5651)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_RegularAlgorithms.h	2007-01-05 19:34:54 UTC (rev 5652)
@@ -0,0 +1,102 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify 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.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+*/
+/** \file
+**  Role:
+**
+** Assumptions:
+**
+** Invariants:
+**
+** Comments:
+**
+** $Id: Mesh_RegularAlgorithms.h 3584 2006-05-16 11:11:07Z PatrickSunter $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#ifndef __Discretisaton_Mesh_Mesh_RegularAlgorithms_h__
+#define __Discretisaton_Mesh_Mesh_RegularAlgorithms_h__
+
+	/** Textual name of this class */
+	extern const Type Mesh_RegularAlgorithms_Type;
+
+	/** Virtual function types */
+
+	/** Class contents */
+	#define __Mesh_RegularAlgorithms		\
+		/* General info */			\
+		__Mesh_Algorithms			\
+							\
+		/* Virtual info */			\
+							\
+		/* Mesh_RegularAlgorithms info */
+
+	struct Mesh_RegularAlgorithms { __Mesh_RegularAlgorithms };
+
+	/*--------------------------------------------------------------------------------------------------------------------------
+	** Constructors
+	*/
+
+	#define MESH_REGULARALGORITHMS_DEFARGS \
+		MESH_ALGORITHMS_DEFARGS
+
+	#define MESH_REGULARALGORITHMS_PASSARGS \
+		MESH_ALGORITHMS_PASSARGS
+
+	Mesh_RegularAlgorithms* Mesh_RegularAlgorithms_New( Name name );
+	Mesh_RegularAlgorithms* _Mesh_RegularAlgorithms_New( MESH_REGULARALGORITHMS_DEFARGS );
+	void _Mesh_RegularAlgorithms_Init( Mesh_RegularAlgorithms* self );
+
+	/*--------------------------------------------------------------------------------------------------------------------------
+	** Virtual functions
+	*/
+
+	void _Mesh_RegularAlgorithms_Delete( void* algorithms );
+	void _Mesh_RegularAlgorithms_Print( void* algorithms, Stream* stream );
+	void _Mesh_RegularAlgorithms_Construct( void* algorithms, Stg_ComponentFactory* cf, void* data );
+	void _Mesh_RegularAlgorithms_Build( void* algorithms, void* data );
+	void _Mesh_RegularAlgorithms_Initialise( void* algorithms, void* data );
+	void _Mesh_RegularAlgorithms_Execute( void* algorithms, void* data );
+	void _Mesh_RegularAlgorithms_Destroy( void* algorithms, void* data );
+
+	Bool Mesh_RegularAlgorithms_Search( void* algorithms, void* mesh, double* point, 
+					    MeshTopology_Dim* dim, unsigned* ind );
+	Bool Mesh_RegularAlgorithms_SearchElements( void* algorithms, double* point, unsigned* elInd );
+	double Mesh_RegularAlgorithms_GetMinimumSeparation( void* algorithms, void* mesh, double* perDim );
+	void Mesh_RegularAlgorithms_GetLocalCoordRange( void* algorithms, void* mesh, double* min, double* max );
+	void Mesh_RegularAlgorithms_GetDomainCoordRange( void* algorithms, void* mesh, double* min, double* max );
+	void Mesh_RegularAlgorithms_GetGlobalCoordRange( void* algorithms, void* mesh, double* min, double* max );
+
+	/*--------------------------------------------------------------------------------------------------------------------------
+	** Public functions
+	*/
+
+	/*--------------------------------------------------------------------------------------------------------------------------
+	** Private Member functions
+	*/
+
+#endif /* __Discretisaton_Mesh_Mesh_RegularAlgorithms_h__ */

Added: long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_RegularAlgorithms.meta
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_RegularAlgorithms.meta	2007-01-05 19:33:39 UTC (rev 5651)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_RegularAlgorithms.meta	2007-01-05 19:34:54 UTC (rev 5652)
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<!DOCTYPE StGermainData SYSTEM "stgermain.dtd">
+<StGermainData xmlns="http://www.vpac.org/StGermain/XML_IO_Handler/Jun2003">
+
+<param name="Name">Mesh_RegularAlgorithms</param>
+<param name="Organisation">VPAC</param>
+<param name="Project">StGermain</param>
+<param name="Location">./StGermain/Discretisation/Utils/src/</param>
+<param name="Project Web">https://csd.vpac.org/twiki/bin/view/Stgermain/WebHome</param>
+<param name="Copyright">StGermain Framework. Copyright (C) 2003-2005 VPAC.</param>
+<param name="License">The Gnu Lesser General Public License http://www.gnu.org/licenses/lgpl.html</param>
+<param name="Parent">Stg_Component</param>
+<param name="Description">...</param>
+
+</StGermainData>

Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/SurfaceAdaptor.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/SurfaceAdaptor.c	2007-01-05 19:33:39 UTC (rev 5651)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/SurfaceAdaptor.c	2007-01-05 19:34:54 UTC (rev 5652)
@@ -78,6 +78,7 @@
 				    _SurfaceAdaptor_Destroy, 
 				    name, 
 				    NON_GLOBAL, 
+				    _MeshGenerator_SetDimSize, 
 				    SurfaceAdaptor_Generate );
 }
 

Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/types.h
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/types.h	2007-01-05 19:33:39 UTC (rev 5651)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/types.h	2007-01-05 19:34:54 UTC (rev 5652)
@@ -137,6 +137,7 @@
 	typedef struct Mesh_ElementType			Mesh_ElementType;
 	typedef struct Mesh_HexType			Mesh_HexType;
 	typedef struct Mesh_Algorithms			Mesh_Algorithms;
+	typedef struct Mesh_RegularAlgorithms		Mesh_RegularAlgorithms;
 	typedef struct Mesh				Mesh;
 	typedef struct MeshGenerator			MeshGenerator;
 	typedef struct CartesianGenerator		CartesianGenerator;



More information about the cig-commits mailing list