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

Contents of /trunk/paso/src/SystemMatrixPattern_unrollBlocks.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3312 - (show annotations)
Tue Oct 26 07:54:58 2010 UTC (8 years, 10 months ago) by gross
File MIME type: text/plain
File size: 4126 byte(s)
last step for a clean up version of the AMG
1
2 /*******************************************************
3 *
4 * Copyright (c) 2003-2010 by University of Queensland
5 * Earth Systems Science Computational Center (ESSCC)
6 * http://www.uq.edu.au/esscc
7 *
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
17 /* Paso: SystemMatrixPattern_unrollBlocks */
18
19 /**************************************************************/
20
21 /* Author: Lutz Gross, l.gross@uq.edu.au */
22
23 /**************************************************************/
24
25 #include "SystemMatrixPattern.h"
26 #include "Paso.h"
27 #include "esysUtils/error.h"
28
29 /**************************************************************/
30
31 /* creates SystemMatrixPattern */
32
33
34 Paso_SystemMatrixPattern* Paso_SystemMatrixPattern_unrollBlocks(Paso_SystemMatrixPattern* pattern,
35 int type, dim_t output_block_size,dim_t input_block_size) {
36 Paso_SystemMatrixPattern*out=NULL;
37 Paso_Pattern *new_mainPattern=NULL, *new_col_couplePattern=NULL, *new_row_couplePattern=NULL;
38 Paso_Distribution* new_output_distribution=NULL, *new_input_distribution=NULL;
39 Paso_Connector *new_col_connector=NULL, *new_row_connector=NULL;
40
41 if ( ( output_block_size == 1 ) && (input_block_size == 1) && ((pattern->type & MATRIX_FORMAT_OFFSET1) == (type & MATRIX_FORMAT_OFFSET1) ) ) {
42 out = Paso_SystemMatrixPattern_getReference(pattern);
43 } else {
44 new_mainPattern=Paso_Pattern_unrollBlocks(pattern->mainPattern,type,output_block_size,input_block_size);
45 new_col_couplePattern=Paso_Pattern_unrollBlocks(pattern->col_couplePattern,type,output_block_size,input_block_size);
46 new_row_couplePattern=Paso_Pattern_unrollBlocks(pattern->row_couplePattern,type,output_block_size,input_block_size);
47 if (output_block_size>1) {
48 new_output_distribution=Paso_Distribution_alloc(pattern->output_distribution->mpi_info,
49 pattern->output_distribution->first_component,
50 output_block_size,0);
51 new_row_connector=Paso_Connector_unroll(pattern->row_connector,output_block_size);
52 } else {
53 new_output_distribution=Paso_Distribution_getReference(pattern->output_distribution);
54 new_row_connector= Paso_Connector_getReference(pattern->row_connector);
55 }
56 if (input_block_size>1) {
57 new_input_distribution=Paso_Distribution_alloc(pattern->input_distribution->mpi_info,
58 pattern->input_distribution->first_component,
59 input_block_size,0);
60 new_col_connector=Paso_Connector_unroll(pattern->col_connector,input_block_size);
61 } else {
62 new_input_distribution=Paso_Distribution_getReference(pattern->input_distribution);
63 new_col_connector=Paso_Connector_getReference(pattern->col_connector);
64 }
65 if (Esys_noError()) {
66 out=Paso_SystemMatrixPattern_alloc(type,
67 new_output_distribution,
68 new_input_distribution,
69 new_mainPattern,
70 new_col_couplePattern,
71 new_row_couplePattern,
72 new_col_connector,
73 new_row_connector);
74 }
75 Paso_Pattern_free(new_mainPattern);
76 Paso_Pattern_free(new_col_couplePattern);
77 Paso_Pattern_free(new_row_couplePattern);
78 Paso_Distribution_free(new_output_distribution);
79 Paso_Distribution_free(new_input_distribution);
80 Paso_Connector_free(new_row_connector);
81 Paso_Connector_free(new_col_connector);
82 }
83 if (Esys_noError()) {
84 return out;
85 } else {
86 Paso_SystemMatrixPattern_free(out);
87 return NULL;
88 }
89 }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26