flow_bc.h
Go to the documentation of this file.
1 /*
2  Copyright 2010 SINTEF ICT, Applied Mathematics.
3 
4  This file is part of the Open Porous Media project (OPM).
5 
6  OPM is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  OPM is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with OPM. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef OPM_FLOW_BC_HEADER_INCLUDED
21 #define OPM_FLOW_BC_HEADER_INCLUDED
22 
23 #include <stddef.h>
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
32 
33 /* Boundary condition structure.
34  *
35  * Condition i (in [0 .. nbc-1]) affects (outer) interface face[i], is
36  * of type type[i], and specifies a target value of value[i].
37  *
38  * The field 'cpty' is for internal use by the implementation. */
40  size_t nbc; /* Current number of bdry. conditions */
41 
42  size_t face_cpty; /* Internal management. Do not touch */
43  size_t cond_cpty; /* Internal management. Do not touch */
44 
45  size_t *cond_pos; /* Indirection pointer into '.face' */
46 
47  enum FlowBCType *type; /* Condition type */
48  double *value; /* Condition value (target) */
49  int *face; /* Outer faces affected by ind. target */
50 };
51 
52 
53 /* Allocate a 'FlowBoundaryConditions' structure, initially capable of
54  * managing 'nbc' individual boundary conditions. */
57 
58 
59 /* Release memory resources managed by 'fbc', including the containing
60  * 'struct' pointer, 'fbc'. */
61 void
63 
64 
65 /* Append a new boundary condition to existing set.
66  *
67  * Return one (1) if successful, and zero (0) otherwise. */
68 int
70  int face ,
71  double value,
72  struct FlowBoundaryConditions *fbc );
73 
74 /* Append a new boundary condition that affects multiple interfaces.
75  *
76  * Return one (1) if successful, and zero (0) otherwise. */
77 int
79  size_t nfaces,
80  const int *faces ,
81  double value ,
82  struct FlowBoundaryConditions *fbc );
83 
84 
85 /* Clear existing set of boundary conditions */
86 void
88 
89 #ifdef __cplusplus
90 }
91 #endif
92 
93 #endif /* OPM_FLOW_BC_HEADER_INCLUDED */
double * value
Definition: flow_bc.h:48
struct FlowBoundaryConditions * flow_conditions_construct(size_t nbc)
void flow_conditions_clear(struct FlowBoundaryConditions *fbc)
Definition: flow_bc.h:39
size_t nbc
Definition: flow_bc.h:40
FlowBCType
Definition: flow_bc.h:29
Definition: flow_bc.h:30
Definition: flow_bc.h:31
int flow_conditions_append_multi(enum FlowBCType type, size_t nfaces, const int *faces, double value, struct FlowBoundaryConditions *fbc)
int flow_conditions_append(enum FlowBCType type, int face, double value, struct FlowBoundaryConditions *fbc)
void flow_conditions_destroy(struct FlowBoundaryConditions *fbc)
enum FlowBCType * type
Definition: flow_bc.h:47
size_t * cond_pos
Definition: flow_bc.h:45
size_t face_cpty
Definition: flow_bc.h:42
int * face
Definition: flow_bc.h:49
Definition: flow_bc.h:29
size_t cond_cpty
Definition: flow_bc.h:43