hxt_linear_system.h 3.07 KB
Newer Older
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
1
2
/*
 * Marblesbag - Copyright (C) <2010-2018>
3
4
 * <Universite catholique de Louvain (UCL), Belgium
 *  Universite de Montpellier, France>
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
5
 * 	
6
 * List of the contributors to the development of Marblesbag: see AUTHORS file.
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
7
8
9
 * Description and complete License: see LICENSE file.
 * 	
 * This program (Marblesbag) is free software: 
10
 * you can redistribute it and/or modify it under the terms of the GNU Lesser General 
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
11
12
13
14
15
16
 * Public License as published by the Free Software Foundation, either version
 * 3 of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU Lesser General Public License for more details.
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
18
 * 
19
20
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program (see COPYING and COPYING.LESSER files).  If not, 
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
21
22
23
 * see <http://www.gnu.org/licenses/>.
 */

Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef HEXTREME_LINEAR_SYSTEM_H
#define HEXTREME_LINEAR_SYSTEM_H
#include <stdint.h>
#include "hxt_message.h"

typedef struct HXTLinearSystemStruct HXTLinearSystem;

HXTStatus hxtLinearSystemAddToMatrix(HXTLinearSystem *lsys, int el0, int el1, const double *localMatrix);
HXTStatus hxtLinearSystemAddMatrixEntry(HXTLinearSystem *lsys, int node0, int field0, int node1, int field1, double entry);
HXTStatus hxtLinearSystemAddToRhs(HXTLinearSystem *lsys, double *rhs, int el0, const double *localVector);
HXTStatus hxtLinearSystemSize(HXTLinearSystem *lsys, int *size);
HXTStatus hxtLinearSystemZeroMatrix(HXTLinearSystem *lsys);
HXTStatus hxtLinearSystemSolve(HXTLinearSystem *lsys, double *rhs, double *solution);
HXTStatus hxtLinearSystemSetMatrixRowIdentity(HXTLinearSystem *lsys, int node, int field);
HXTStatus hxtLinearSystemSetMatrixRowFieldCombinaison(HXTLinearSystem *system, int node, int field, double *coeff);
HXTStatus hxtLinearSystemSetRhsEntry(HXTLinearSystem *lsys, double *rhs, int node, int field, double v);
HXTStatus hxtLinearSystemAddRhsEntry(HXTLinearSystem *lsys, double *rhs, int node, int field, double v);
HXTStatus hxtLinearSystemDelete(HXTLinearSystem **pSystem);
HXTStatus hxtLinearSystemGetRhsNorm(HXTLinearSystem *lsys, double *rhs, double *norm);
HXTStatus hxtLinearSystemHasConverged(HXTLinearSystem *lsys, int *converged);

HXTStatus hxtLinearSystemCreateLU(HXTLinearSystem **sys, int nElement, int nNodesByElement, int nFields, uint32_t *elements);
typedef struct HXTLinearSystemLUStruct HXTLinearSystemLU;
HXTStatus hxtLinearSystemGetLinearSystemLU(HXTLinearSystem *sys, HXTLinearSystemLU **psys);

#ifdef HXT_HAVE_PETSC
typedef struct HXTLinearSystemPETScStruct HXTLinearSystemPETSc;
HXTStatus hxtLinearSystemCreatePETSc(HXTLinearSystem **sys, int nElement, int nNodesByElement, int nFields, uint32_t *elements, const char *petscOptions);
HXTStatus hxtLinearSystemGetLinearSystemPETSc(HXTLinearSystem *sys, HXTLinearSystemPETSc **psys);
53
HXTStatus hxtPETScInsertOptions(const char *options, const char *prefix);
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
54
55
56
57
58
#endif

HXTStatus hxtInitializeLinearSystems(int *argc, char ***argv);

#endif