/usr/include/code_saturne/cs_interface.h is in code-saturne-include 3.2.1-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 | #ifndef __CS_INTERFACE_H__
#define __CS_INTERFACE_H__
/*============================================================================
* Main structure for handling of interfaces associating mesh elements
* (such as inter-processor or periodic connectivity between cells, faces,
* or vertices);
*============================================================================*/
/*
This file is part of Code_Saturne, a general-purpose CFD tool.
Copyright (C) 1998-2013 EDF S.A.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 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 GNU General Public License for more
details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
* Local headers
*----------------------------------------------------------------------------*/
#include "fvm_defs.h"
#include "fvm_periodicity.h"
/*----------------------------------------------------------------------------*/
BEGIN_C_DECLS
/*=============================================================================
* Macro definitions
*============================================================================*/
/*============================================================================
* Type definitions
*============================================================================*/
/*----------------------------------------------------------------------------
* Structure defining an I/O numbering scheme
*----------------------------------------------------------------------------*/
/*
Pointer to structures representing an interface and a list of interfaces.
The structures themselves are private, and is defined in cs_interface.c
*/
typedef struct _cs_interface_t cs_interface_t;
typedef struct _cs_interface_set_t cs_interface_set_t;
/*=============================================================================
* Static global variables
*============================================================================*/
/*=============================================================================
* Public function prototypes
*============================================================================*/
/*----------------------------------------------------------------------------
* Return process rank associated with an interface's distant elements.
*
* parameters:
* itf <-- pointer to interface structure
*
* returns:
* process rank associated with the interface's distant elements
*----------------------------------------------------------------------------*/
int
cs_interface_rank(const cs_interface_t *itf);
/*----------------------------------------------------------------------------
* Return number of local and distant elements defining an interface.
*
* parameters:
* itf <-- pointer to interface structure
*
* returns:
* number of local and distant elements defining the interface
*----------------------------------------------------------------------------*/
cs_lnum_t
cs_interface_size(const cs_interface_t *itf);
/*----------------------------------------------------------------------------
* Return pointer to array of local element ids defining an interface.
*
* The size of the array may be obtained by cs_interface_size().
* The array is owned by the interface structure, and is not copied
* (hence the constant qualifier for the return value).
*
* parameters:
* itf <-- pointer to interface structure
*
* returns:
* pointer to array of local element ids (0 to n-1) defining the interface
*----------------------------------------------------------------------------*/
const cs_lnum_t *
cs_interface_get_elt_ids(const cs_interface_t *itf);
/*----------------------------------------------------------------------------
* Return pointer to array of matching element ids defining an interface.
*
* This array is only available if cs_interface_set_add_match_ids() has
* been called for the containing interface set.
*
* The size of the array may be obtained by cs_interface_size().
* The array is owned by the interface structure, and is not copied
* (hence the constant qualifier for the return value).
*
* parameters:
* itf <-- pointer to interface structure
*
* returns:
* pointer to array of local element ids (0 to n-1) defining the interface
*----------------------------------------------------------------------------*/
const cs_lnum_t *
cs_interface_get_match_ids(const cs_interface_t *itf);
/*----------------------------------------------------------------------------
* Return size of index of sub-sections for different transformations.
*
* The index is applicable to both local_num and distant_num arrays,
* with purely parallel equivalences appearing at position 0, and
* equivalences through periodic transform i at position i+1;
* Its size should thus be equal to 1 + number of periodic transforms + 1,
* In absence of periodicity, it may be 0, as the index is not needed.
*
* parameters:
* itf <-- pointer to interface structure
*
* returns:
* transform index size for the interface
*----------------------------------------------------------------------------*/
cs_lnum_t
cs_interface_get_tr_index_size(const cs_interface_t *itf);
/*----------------------------------------------------------------------------
* Return pointer to index of sub-sections for different transformations.
*
* The index is applicable to both local_num and distant_num arrays,
* with purely parallel equivalences appearing at position 0, and
* equivalences through periodic transform i at position i+1;
* In absence of periodicity, it may be NULL, as it is not needed.
*
* parameters:
* itf <-- pointer to interface structure
*
* returns:
* pointer to transform index for the interface
*----------------------------------------------------------------------------*/
const cs_lnum_t *
cs_interface_get_tr_index(const cs_interface_t *itf);
/*----------------------------------------------------------------------------
* Creation of a list of interfaces between elements of a same type.
*
* These interfaces may be used to identify equivalent vertices or faces using
* domain splitting, as well as periodic elements (on the same or on
* distant ranks).
*
* Note that periodicity information will be completed and made consistent
* based on the input, so that if a periodic couple is defined on a given rank,
* the reverse couple wil be defined, whether it is also defined on the same
* or a different rank.
*
* In addition, multiple periodicity interfaces will be built automatically
* if the periodicity structure provides for composed periodicities, so they
* need not be defined prior to this function.
*
* The corresponding elements must be locally ordered.
*
* parameters:
* n_elts <-- number of local elements considered
* (size of parent_element_number[]
* parent_element_id <-- pointer to list of selected elements local
* numbers (0 to n-1), or NULL if all first n_elts
* elements are used
* global_number <-- pointer to list of global (i.e. domain splitting
* independent) element numbers
* periodicity <-- periodicity information (NULL if none)
* n_periodic_lists <-- number of periodic lists (may be local)
* periodicity_num <-- periodicity number (1 to n) associated with
* each periodic list (primary periodicities only)
* n_periodic_couples <-- number of periodic couples associated with
* each periodic list
* periodic_couples <-- array indicating periodic couples (using
* global numberings) for each list
*
* returns:
* pointer to list of interfaces (possibly NULL in serial mode)
*----------------------------------------------------------------------------*/
cs_interface_set_t *
cs_interface_set_create(cs_lnum_t n_elts,
const cs_lnum_t parent_element_id[],
const cs_gnum_t global_number[],
const fvm_periodicity_t *periodicity,
int n_periodic_lists,
const int periodicity_num[],
const cs_lnum_t n_periodic_couples[],
const cs_gnum_t *const periodic_couples[]);
/*----------------------------------------------------------------------------
* Destruction of an interface set.
*
* parameters:
* ifs <-> pointer to pointer to structure to destroy
*----------------------------------------------------------------------------*/
void
cs_interface_set_destroy(cs_interface_set_t **ifs);
/*----------------------------------------------------------------------------
* Return number of interfaces associated with an interface set.
*
* parameters:
* ifs <-- pointer to interface set structure
*
* returns:
* number of interfaces in set
*----------------------------------------------------------------------------*/
int
cs_interface_set_size(const cs_interface_set_t *ifs);
/*----------------------------------------------------------------------------
* Return total number of elements in interface set.
*
* This is equal to the sum of cs_interface_size() on the cs_interface_size()
* interfaces of a set.
*
* parameters:
* ifs <-- pointer to interface set structure
*
* returns:
* number of interfaces in set
*----------------------------------------------------------------------------*/
cs_lnum_t
cs_interface_set_n_elts(const cs_interface_set_t *ifs);
/*----------------------------------------------------------------------------
* Return pointer to a given interface in an interface set.
*
* parameters:
* ifs <-- pointer to interface set structure
* interface_id <-- index of interface in set (0 to n-1)
*
* returns:
* pointer to interface structure
*----------------------------------------------------------------------------*/
const cs_interface_t *
cs_interface_set_get(const cs_interface_set_t *ifs,
int interface_id);
/*----------------------------------------------------------------------------
* Return pointer to the periocicity structure associated of an interface set.
*
* parameters:
* ifs <-- pointer to interface set structure
*
* returns:
* pointer to periodicity structure, or NULL
*----------------------------------------------------------------------------*/
const fvm_periodicity_t *
cs_interface_set_periodicity(const cs_interface_set_t *ifs);
/*----------------------------------------------------------------------------
* Apply renumbering of elements referenced by an interface set.
*
* For any given element i, a negative old_to_new[i] value means that that
* element does not appear anymore in the new numbering.
*
* parameters:
* ifs <-> pointer to interface set structure
* old_to_new <-- renumbering array (0 to n-1 numbering)
*----------------------------------------------------------------------------*/
void
cs_interface_set_renumber(cs_interface_set_t *ifs,
const cs_lnum_t old_to_new[]);
/*----------------------------------------------------------------------------
* Add matching element id information to an interface set.
*
* This information is required by calls to cs_interface_get_dist_ids(),
* and may be freed using cs_interface_set_free_match_ids().
*
* parameters:
* ifs <-> pointer to interface set structure
*----------------------------------------------------------------------------*/
void
cs_interface_set_add_match_ids(cs_interface_set_t *ifs);
/*----------------------------------------------------------------------------
* Free matching element id information of an interface set.
*
* This information is used by calls to cs_interface_get_dist_ids(),
* and may be defined using cs_interface_set_add_match_ids().
*
* parameters:
* ifs <-> pointer to interface set structure
*----------------------------------------------------------------------------*/
void
cs_interface_set_free_match_ids(cs_interface_set_t *ifs);
/*----------------------------------------------------------------------------
* Copy array from distant or matching interface elements to local elements.
*
* Source and destination arrays define values for all elements in the
* interface set (i.e. all elements listed by cs_interface_get_elt_ids()
* when looping over interfaces of a set,
*
* parameters:
* ifs <-- pointer to interface set structure
* datatype <-- type of data considered
* stride <-- number of values per entity (interlaced)
* src_on_parent <-- true if source array is defined on the elements
* defined by ifs->elt_ids, false if source array
* defined directly on cs_interface_set_n_elts(ifs)
* src <-- source array (size: cs_interface_set_n_elts(ifs)*stride
* or parent array size * stride)
* dest <-- destination array
* (size: cs_interface_set_n_elts(ifs)*stride)
*----------------------------------------------------------------------------*/
void
cs_interface_set_copy_array(const cs_interface_set_t *ifs,
cs_datatype_t datatype,
int stride,
bool src_on_parent,
const void *src,
void *dest);
/*----------------------------------------------------------------------------
* Copy indexed array from distant or matching interface elements to
* local elements.
*
* Source and destination arrays define values for all elements in the
* interface set (i.e. all elements listed by cs_interface_get_elt_ids()
* when looping over interfaces of a set,
*
* Note that when copying the same type of data to all matching elements,
* the source and destination index may be the same, if src_on_parent is true.
* To avoid requiring a separate destination index, the dest_index argument
* may be set to NULL, in which case it is assumed that source and destination
* are symmetric, and src_index is sufficient to determine sizes (whether
* src_on_parent is true or not).
*
* In some use cases, for example when copying values only in one, the
* copying is not symmetric, so both a source and destination buffer must
* be provided.
*
* parameters:
* ifs <-- pointer to interface set structure
* datatype <-- type of data considered
* src_on_parent <-- true if source array is defined on the elements
* defined by ifs->elt_ids, false if source array
* defined directly on cs_interface_set_n_elts(ifs)
* src_index <-- index for source array
* dest_index <-- index for destination array, or NULL
* src <-- source array (size:
* src_index[cs_interface_set_n_elts(ifs)]
* or parent array size * stride)
* dest <-- destination array (size:
* src_index[cs_interface_set_n_elts(ifs)] or
* dest_index[cs_interface_set_n_elts(ifs)])
*----------------------------------------------------------------------------*/
void
cs_interface_set_copy_indexed(const cs_interface_set_t *ifs,
cs_datatype_t datatype,
bool src_on_parent,
const cs_lnum_t src_index[],
const cs_lnum_t dest_index[],
const void *src,
void *dest);
/*----------------------------------------------------------------------------
* Update the sum of values for elements associated with an interface set.
*
* On input, the variable array should contain local contributions. On output,
* contributions from matching elements on parallel or periodic boundaries
* have been added.
*
* Only the values of elements belonging to the interfaces are modified.
*
* parameters:
* ifs <-- pointer to a fvm_interface_set_t structure
* n_elts <-- number of elements in var buffer
* stride <-- number of values (non interlaced) by entity
* interlace <-- true if variable is interlaced (for stride > 1)
* datatype <-- type of data considered
* var <-> variable buffer
*----------------------------------------------------------------------------*/
void
cs_interface_set_sum(cs_interface_set_t *ifs,
cs_lnum_t n_elts,
cs_lnum_t stride,
bool interlace,
cs_datatype_t datatype,
void *var);
/*----------------------------------------------------------------------------
* Update to maximum value for elements associated with an interface set.
*
* On input, the variable array should contain local contributions. On output,
* contributions from matching elements on parallel or periodic boundaries
* have been added.
*
* Only the values of elements belonging to the interfaces are modified.
*
* parameters:
* ifs <-- pointer to a fvm_interface_set_t structure
* n_elts <-- number of elements in var buffer
* stride <-- number of values (non interlaced) by entity
* interlace <-- true if variable is interlaced (for stride > 1)
* datatype <-- type of data considered
* var <-> variable buffer
*----------------------------------------------------------------------------*/
void
cs_interface_set_max(cs_interface_set_t *ifs,
cs_lnum_t n_elts,
cs_lnum_t stride,
bool interlace,
cs_datatype_t datatype,
void *var);
/*----------------------------------------------------------------------------
* Update to maximum value for elements associated with an interface set.
*
* On input, the variable array should contain local contributions. On output,
* contributions from matching elements on parallel or periodic boundaries
* have been added.
*
* Only the values of elements belonging to the interfaces are modified.
*
* parameters:
* ifs <-- pointer to a fvm_interface_set_t structure
* n_elts <-- number of elements in var buffer
* stride <-- number of values (non interlaced) by entity
* interlace <-- true if variable is interlaced (for stride > 1)
* datatype <-- type of data considered
* var <-> variable buffer
*----------------------------------------------------------------------------*/
void
cs_interface_set_max(cs_interface_set_t *ifs,
cs_lnum_t n_elts,
cs_lnum_t stride,
bool interlace,
cs_datatype_t datatype,
void *var);
/*----------------------------------------------------------------------------
* Dump printout of an interface list.
*
* parameters:
* ifs <-- pointer to structure that should be dumped
*----------------------------------------------------------------------------*/
void
cs_interface_set_dump(const cs_interface_set_t *ifs);
/*----------------------------------------------------------------------------*/
END_C_DECLS
#endif /* __CS_INTERFACE_H__ */
|