/[escript]/trunk/finley/src/ElementFile_createColoring.c
ViewVC logotype

Contents of /trunk/finley/src/ElementFile_createColoring.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1628 - (show annotations)
Fri Jul 11 13:12:46 2008 UTC (11 years, 2 months ago) by phornby
File MIME type: text/plain
File size: 3852 byte(s)

Merge in /branches/windows_from_1456_trunk_1620_merged_in branch.

You will find a preserved pre-merge trunk in tags under tags/trunk_at_1625.
That will be useful for diffing & checking on my stupidity.

Here is a list of the conflicts and their resolution at this
point in time.


=================================================================================
(LLWS == looks like white space).

finley/src/Assemble_addToSystemMatrix.c - resolve to branch - unused var. may be wrong.....
finley/src/CPPAdapter/SystemMatrixAdapter.cpp - resolve to branch - LLWS
finley/src/CPPAdapter/MeshAdapter.cpp - resolve to branch - LLWS
paso/src/PCG.c - resolve to branch - unused var fixes.
paso/src/SolverFCT.c - resolve to branch - LLWS
paso/src/FGMRES.c - resolve to branch - LLWS
paso/src/Common.h - resolve to trunk version. It's omp.h's include... not sure it's needed,
but for the sake of saftey.....
paso/src/Functions.c - resolve to branch version, indentation/tab removal and return error
on bad unimplemented Paso_FunctionCall.
paso/src/SolverFCT_solve.c - resolve to branch version, unused vars
paso/src/SparseMatrix_MatrixVector.c - resolve to branch version, unused vars.
escript/src/Utils.cpp - resloved to branch, needs WinSock2.h
escript/src/DataExpanded.cpp - resolved to branch version - LLWS
escript/src/DataFactory.cpp - resolve to branch version
=================================================================================

This currently passes tests on linux (debian), but is not checked on windows or Altix yet.

This checkin is to make a trunk I can check out for windows to do tests on it.

Known outstanding problem is in the operator=() method of exceptions
causing warning messages on the intel compilers.

May the God of doughnuts have mercy on my soul.


1
2 /* $Id$ */
3
4 /*******************************************************
5 *
6 * Copyright 2003-2007 by ACceSS MNRF
7 * Copyright 2007 by University of Queensland
8 *
9 * http://esscc.uq.edu.au
10 * Primary Business: Queensland, Australia
11 * Licensed under the Open Software License version 3.0
12 * http://www.opensource.org/licenses/osl-3.0.php
13 *
14 *******************************************************/
15
16 /**************************************************************/
17 /* */
18 /* Finley: ElementFile */
19 /* */
20 /* This routine tries to reduce the number of colors used to color elements in the Finley_ElementFile in */
21 /* */
22 /**************************************************************/
23
24 #include "ElementFile.h"
25 #include "Util.h"
26
27 /**************************************************************/
28
29 void Finley_ElementFile_createColoring(Finley_ElementFile* in,dim_t numNodes, index_t* degreeOfFreedom) {
30 dim_t e,i,numUncoloredElements,n,len,NN;
31 index_t *maskDOF,min_id,max_id;
32 bool_t independent;
33
34 if (in==NULL) return;
35 if (in->numElements<1) return;
36 NN=in->numNodes;
37
38 min_id=Finley_Util_getMinInt(1,numNodes,degreeOfFreedom);
39 max_id=Finley_Util_getMaxInt(1,numNodes,degreeOfFreedom);
40 len=max_id-min_id+1;
41 maskDOF=TMPMEMALLOC(len,index_t);
42 if (! Finley_checkPtr(maskDOF) ) {
43 #pragma omp parallel for private(e) schedule(static)
44 for (e=0;e<in->numElements;e++) in->Color[e]=-1;
45 numUncoloredElements=in->numElements;
46 in->minColor=0;
47 in->maxColor=in->minColor-1;
48 while (numUncoloredElements>0) {
49 /* initialize the mask marking nodes used by a color */
50 #pragma omp parallel for private(n) schedule(static)
51 for (n=0;n<len;n++) maskDOF[n]=-1;
52 numUncoloredElements=0;
53 /* OMP ?*/
54 for (e=0;e<in->numElements;e++) {
55 if (in->Color[e]<0) {
56 /* find out if element e is independend from the elements already colored: */
57 independent=TRUE;
58 for (i=0;i<NN;i++) {
59 #ifdef BOUNDS_CHECK
60 if (in->Nodes[INDEX2(i,e,NN)] < 0 || in->Nodes[INDEX2(i,e,NN)] >= numNodes) { printf("BOUNDS_CHECK %s %d i=%d e=%d NN=%d min_id=%d in->Nodes[INDEX2...]=%d\n", __FILE__, __LINE__, i, e, NN, min_id, in->Nodes[INDEX2(i,e,NN)]); exit(1); }
61 if ((degreeOfFreedom[in->Nodes[INDEX2(i,e,NN)]]-min_id) >= len || (degreeOfFreedom[in->Nodes[INDEX2(i,e,NN)]]-min_id) < 0) { printf("BOUNDS_CHECK %s %d i=%d e=%d NN=%d min_id=%d dof=%d\n", __FILE__, __LINE__, i, e, NN, min_id, degreeOfFreedom[in->Nodes[INDEX2(i,e,NN)]]-min_id); exit(1); }
62 #endif
63 if (maskDOF[degreeOfFreedom[in->Nodes[INDEX2(i,e,NN)]]-min_id]>0) {
64 independent=FALSE;
65 break;
66 }
67 }
68 /* if e is independend a new color is assigned and the nodes are marked as being used */
69 if (independent) {
70 for (i=0;i<NN;i++) maskDOF[degreeOfFreedom[in->Nodes[INDEX2(i,e,NN)]]-min_id]=1;
71 in->Color[e]=in->maxColor+1;
72 } else {
73 numUncoloredElements++;
74 }
75 }
76
77 }
78 in->maxColor++;
79 } /* end of while loop */
80 }
81 /* all done : */
82 TMPMEMFREE(maskDOF);
83 }

  ViewVC Help
Powered by ViewVC 1.1.26