/[escript]/trunk-mpi-branch/paso/src/SystemMatrixPattern.c
ViewVC logotype

Contents of /trunk-mpi-branch/paso/src/SystemMatrixPattern.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1258 - (show annotations)
Mon Aug 20 03:56:05 2007 UTC (12 years, 1 month ago) by gross
File MIME type: text/plain
File size: 4467 byte(s)
solver starts now but there still seems to be a problem in the MVM
1 /* $Id$ */
2
3 /*
4 ********************************************************************************
5 * Copyright 2006 by ACcESS MNRF *
6 * *
7 * http://www.access.edu.au *
8 * Primary Business: Queensland, Australia *
9 * Licensed under the Open Software License version 3.0 *
10 * http://www.opensource.org/licenses/osl-3.0.php *
11 ********************************************************************************
12 */
13
14 /**************************************************************/
15
16 /* Paso: SystemMatrixPatternPattern */
17
18 /**************************************************************/
19
20 /* Copyrights by ACcESS Australia 2003, 2004,2005, 2006, 2007 */
21 /* Author: gross@access.edu.au */
22
23 /**************************************************************/
24
25 #include "Paso.h"
26 #include "SystemMatrixPattern.h"
27
28 /**************************************************************/
29
30 /* allocates a SystemMatrixPattern */
31
32 Paso_SystemMatrixPattern* Paso_SystemMatrixPattern_alloc(int type,
33 Paso_Distribution *output_distribution,
34 Paso_Distribution *input_distribution,
35 Paso_Pattern* mainPattern,
36 Paso_Pattern* couplePattern,
37 Paso_Coupler* coupler)
38 {
39 Paso_SystemMatrixPattern*out=NULL;
40
41
42 Paso_resetError();
43
44 if (mainPattern->type != type) {
45 Paso_setError(VALUE_ERROR,"Paso_SystemMatrixPattern_alloc: type of mainPattern does not match expected type.");
46 }
47 if (couplePattern->type != type) {
48 Paso_setError(VALUE_ERROR,"Paso_SystemMatrixPattern_alloc: type of couplePattern does not match expected type.");
49 }
50 if ( couplePattern->numOutput != mainPattern->numOutput) {
51 Paso_setError(VALUE_ERROR,"Paso_SystemMatrixPattern_alloc: number of output for couple and main pattern don't match.");
52 }
53 if (mainPattern->numOutput != Paso_Distribution_getMyNumComponents(output_distribution)) {
54 Paso_setError(VALUE_ERROR,"Paso_SystemMatrixPattern_alloc: number of output and given distribution don't match.");
55 }
56 if (mainPattern->numInput != Paso_Distribution_getMyNumComponents(input_distribution)) {
57 Paso_setError(VALUE_ERROR,"Paso_SystemMatrixPattern_alloc: number of input for main pattern and number of send components in coupler don't match.");
58 }
59 if (couplePattern->numInput != coupler->recv->numSharedComponents) {
60 Paso_setError(VALUE_ERROR,"Paso_SystemMatrixPattern_alloc: number of inputs for couple pattern and number of received components in coupler don't match.");
61 }
62 out=MEMALLOC(1,Paso_SystemMatrixPattern);
63 if (Paso_checkPtr(out)) return NULL;
64 out->type=type;
65 out->reference_counter=1;
66 out->mainPattern=Paso_Pattern_getReference(mainPattern);
67 out->couplePattern=Paso_Pattern_getReference(couplePattern);
68 out->coupler=Paso_Coupler_getReference(coupler);
69 out->output_distribution=Paso_Distribution_getReference(output_distribution);
70 out->input_distribution=Paso_Distribution_getReference(input_distribution);
71 out->mpi_info= Paso_MPIInfo_getReference(coupler->mpi_info);
72 #ifdef Paso_TRACE
73 printf("Paso_SystemMatrixPattern_dealloc: system matrix pattern as been allocated.\n");
74 #endif
75 return out;
76 }
77
78 /* returns a reference to in */
79
80 Paso_SystemMatrixPattern* Paso_SystemMatrixPattern_reference(Paso_SystemMatrixPattern* in) {
81 if (in!=NULL) {
82 ++(in->reference_counter);
83 }
84 return in;
85 }
86
87 /* deallocates a SystemMatrixPattern: */
88
89 void Paso_SystemMatrixPattern_free(Paso_SystemMatrixPattern* in) {
90 if (in!=NULL) {
91 in->reference_counter--;
92 if (in->reference_counter<=0) {
93 Paso_Pattern_free(in->mainPattern);
94 Paso_Pattern_free(in->couplePattern);
95 Paso_Coupler_free(in->coupler);
96 Paso_Distribution_free(in->output_distribution);
97 Paso_Distribution_free(in->input_distribution);
98 Paso_MPIInfo_free(in->mpi_info);
99 MEMFREE(in);
100 #ifdef Paso_TRACE
101 printf("Paso_SystemMatrixPattern_free: system matrix pattern as been deallocated.\n");
102 #endif
103 }
104 }
105 }

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26