1 |
/******************************************************* |
/***************************************************************************** |
2 |
* |
* |
3 |
* Copyright (c) 2003-2009 by University of Queensland |
* Copyright (c) 2003-2013 by University of Queensland |
4 |
* Earth Systems Science Computational Center (ESSCC) |
* http://www.uq.edu.au |
|
* http://www.uq.edu.au/esscc |
|
5 |
* |
* |
6 |
* Primary Business: Queensland, Australia |
* Primary Business: Queensland, Australia |
7 |
* Licensed under the Open Software License version 3.0 |
* Licensed under the Open Software License version 3.0 |
8 |
* http://www.opensource.org/licenses/osl-3.0.php |
* http://www.opensource.org/licenses/osl-3.0.php |
9 |
* |
* |
10 |
*******************************************************/ |
* Development until 2012 by Earth Systems Science Computational Center (ESSCC) |
11 |
|
* Development since 2012 by School of Earth Sciences |
12 |
|
* |
13 |
|
*****************************************************************************/ |
14 |
|
|
15 |
|
|
16 |
/**************************************************************/ |
/************************************************************************************/ |
17 |
|
|
18 |
/* Finley: Mesh */ |
/* Finley: Mesh */ |
19 |
|
|
20 |
/**************************************************************/ |
/************************************************************************************/ |
21 |
|
|
22 |
#include "Mesh.h" |
#include "Mesh.h" |
23 |
|
|
24 |
/**************************************************************/ |
/************************************************************************************/ |
25 |
|
|
26 |
/* allocates a Mesh with name name for elements of type id using an integration order. If order is negative, */ |
/* allocates a Mesh with name name for elements of type id using an integration order. If order is negative, */ |
27 |
/* the most appropriate order is selected indepently. */ |
/* the most appropriate order is selected independently. */ |
28 |
|
|
29 |
Finley_Mesh* Finley_Mesh_alloc(char* name,dim_t numDim, Paso_MPIInfo *mpi_info) |
Finley_Mesh* Finley_Mesh_alloc(char* name,dim_t numDim, Esys_MPIInfo *mpi_info) |
30 |
{ |
{ |
31 |
Finley_Mesh *out; |
Finley_Mesh *out; |
32 |
|
|
47 |
out->FullReducedPattern=NULL; |
out->FullReducedPattern=NULL; |
48 |
out->ReducedFullPattern=NULL; |
out->ReducedFullPattern=NULL; |
49 |
out->ReducedReducedPattern=NULL; |
out->ReducedReducedPattern=NULL; |
50 |
out->MPIInfo = Paso_MPIInfo_getReference( mpi_info ); |
out->MPIInfo = Esys_MPIInfo_getReference( mpi_info ); |
51 |
if (! Finley_noError()) { |
if (! Finley_noError()) { |
52 |
Finley_Mesh_free(out); |
Finley_Mesh_free(out); |
53 |
return NULL; |
return NULL; |
87 |
return in; |
return in; |
88 |
} |
} |
89 |
|
|
90 |
/* freeates a mesh: */ |
/* frees a mesh: */ |
91 |
|
|
92 |
void Finley_Mesh_free(Finley_Mesh* in) { |
void Finley_Mesh_free(Finley_Mesh* in) { |
93 |
if (in!=NULL) { |
if (in!=NULL) { |
104 |
Paso_SystemMatrixPattern_free(in->FullReducedPattern); |
Paso_SystemMatrixPattern_free(in->FullReducedPattern); |
105 |
Paso_SystemMatrixPattern_free(in->ReducedFullPattern); |
Paso_SystemMatrixPattern_free(in->ReducedFullPattern); |
106 |
Paso_SystemMatrixPattern_free(in->ReducedReducedPattern); |
Paso_SystemMatrixPattern_free(in->ReducedReducedPattern); |
107 |
Paso_MPIInfo_free( in->MPIInfo ); |
Esys_MPIInfo_free( in->MPIInfo ); |
108 |
MEMFREE(in); |
MEMFREE(in); |
109 |
} |
} |
110 |
} |
} |
111 |
} |
} |
112 |
|
|
113 |
/**************************************************************/ |
/************************************************************************************/ |
114 |
|
|
115 |
/* returns the spatial dimension of the mesh: */ |
/* returns the spatial dimension of the mesh: */ |
116 |
|
|
144 |
} |
} |
145 |
} |
} |
146 |
|
|
147 |
void Mesh_setOrders(Finley_Mesh *in) |
void Finley_Mesh_setOrders(Finley_Mesh *in) |
148 |
{ |
{ |
149 |
const dim_t order_max=9999999; |
const dim_t order_max=9999999; |
150 |
dim_t locals[4]; |
dim_t locals[4]; |
151 |
#ifdef PASO_MPI |
#ifdef ESYS_MPI |
152 |
dim_t globals[4]; |
dim_t globals[4]; |
153 |
#endif |
#endif |
154 |
locals[0]=order_max; locals[1]=order_max; locals[2]=order_max; locals[3]=order_max; |
locals[0]=order_max; locals[1]=order_max; locals[2]=order_max; locals[3]=order_max; |
181 |
|
|
182 |
} |
} |
183 |
|
|
184 |
#ifdef PASO_MPI |
#ifdef ESYS_MPI |
185 |
MPI_Allreduce( locals, globals, 4, MPI_INT, MPI_MIN, in->MPIInfo->comm ); |
MPI_Allreduce( locals, globals, 4, MPI_INT, MPI_MIN, in->MPIInfo->comm ); |
186 |
in->approximationOrder=(globals[0] < order_max ? globals[0] : -1 ); |
in->approximationOrder=(globals[0] < order_max ? globals[0] : -1 ); |
187 |
in->reducedApproximationOrder=(globals[1] < order_max ? globals[1] : -1 ); |
in->reducedApproximationOrder=(globals[1] < order_max ? globals[1] : -1 ); |