/[escript]/trunk/paso/src/Distribution.c
ViewVC logotype

Contents of /trunk/paso/src/Distribution.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: 2961 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 /* Paso: system matrix pattern */
19
20 /**************************************************************/
21
22 /* Copyrights by ACcESS Australia 2004,2005,2007 */
23 /* Author: gross@access.edu.au */
24
25 /**************************************************************/
26
27 #include "Distribution.h"
28
29 Paso_Distribution* Paso_Distribution_alloc( Paso_MPIInfo *mpi_info,
30 index_t *first_component,
31 index_t m, index_t b)
32 {
33 int i;
34 Paso_Distribution *out=NULL;
35 out = MEMALLOC( 1, Paso_Distribution );
36 if (Paso_checkPtr(out)) return NULL;
37 out->mpi_info = Paso_MPIInfo_getReference(mpi_info);
38 out->reference_counter = 0;
39 out->first_component=NULL;
40
41 out->first_component = MEMALLOC( (mpi_info->size)+1, index_t );
42 if (Paso_checkPtr(out->first_component)) {
43 Paso_Distribution_free(out);
44 return NULL;
45 }
46 for (i=0; i<(mpi_info->size)+1; ++i) out->first_component[i]=m*first_component[i]+b;
47 out->reference_counter++;
48 return out;
49 }
50
51 void Paso_Distribution_free( Paso_Distribution *in )
52 {
53 if (in != NULL) {
54 --(in->reference_counter);
55 if (in->reference_counter<=0) {
56 Paso_MPIInfo_free( in->mpi_info );
57 MEMFREE( in->first_component );
58 MEMFREE( in );
59 }
60 }
61 }
62
63 Paso_Distribution* Paso_Distribution_getReference( Paso_Distribution *in )
64 {
65 if ( in != NULL)
66 in->reference_counter++;
67 return in;
68 }
69
70 index_t Paso_Distribution_getFirstComponent(Paso_Distribution *in ) {
71 if (in !=NULL) {
72 return in->first_component[in->mpi_info->rank];
73 } else {
74 return 0;
75 }
76 }
77 index_t Paso_Distribution_getLastComponent(Paso_Distribution *in ){
78 if (in !=NULL) {
79 return in->first_component[(in->mpi_info->rank)+1];
80 } else {
81 return 0;
82 }
83 }
84
85 dim_t Paso_Distribution_getGlobalNumComponents(Paso_Distribution *in ){
86 return Paso_Distribution_getMaxGlobalComponents(in)-Paso_Distribution_getMinGlobalComponents(in);
87 }
88 dim_t Paso_Distribution_getMyNumComponents(Paso_Distribution *in ) {
89 return Paso_Distribution_getLastComponent(in)-Paso_Distribution_getFirstComponent(in);
90 }
91
92 dim_t Paso_Distribution_getMinGlobalComponents(Paso_Distribution *in ){
93 if (in !=NULL) {
94 return in->first_component[0];
95 } else {
96 return 0;
97 }
98 }
99 dim_t Paso_Distribution_getMaxGlobalComponents(Paso_Distribution *in ){
100 if (in !=NULL) {
101 return in->first_component[in->mpi_info->size];
102 } else {
103 return 0;
104 }
105 }
106

  ViewVC Help
Powered by ViewVC 1.1.26