~ubuntu-branches/ubuntu/precise/code-saturne/precise

« back to all changes in this revision

Viewing changes to users/base/cs_user_mesh_thinwall.c

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2011-11-01 17:43:32 UTC
  • mto: (6.1.7 sid)
  • mto: This revision was merged to the branch mainline in revision 11.
  • Revision ID: package-import@ubuntu.com-20111101174332-tl4vk45no0x3emc3
Tags: upstream-2.1.0
ImportĀ upstreamĀ versionĀ 2.1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*============================================================================
 
2
 * User function for geometry and mesh modification.
 
3
 *============================================================================*/
 
4
 
 
5
/* VERS */
 
6
 
 
7
/*
 
8
  This file is part of Code_Saturne, a general-purpose CFD tool.
 
9
 
 
10
  Copyright (C) 1998-2011 EDF S.A.
 
11
 
 
12
  This program is free software; you can redistribute it and/or modify it under
 
13
  the terms of the GNU General Public License as published by the Free Software
 
14
  Foundation; either version 2 of the License, or (at your option) any later
 
15
  version.
 
16
 
 
17
  This program is distributed in the hope that it will be useful, but WITHOUT
 
18
  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 
19
  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 
20
  details.
 
21
 
 
22
  You should have received a copy of the GNU General Public License along with
 
23
  this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
 
24
  Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
25
*/
 
26
 
 
27
/*----------------------------------------------------------------------------*/
 
28
 
 
29
#if defined(HAVE_CONFIG_H)
 
30
#include "cs_config.h"
 
31
#endif
 
32
 
 
33
/*----------------------------------------------------------------------------
 
34
 * Standard C library headers
 
35
 *----------------------------------------------------------------------------*/
 
36
 
 
37
#include <errno.h>
 
38
#include <locale.h>
 
39
#include <stdio.h>
 
40
#include <stdlib.h>
 
41
#include <string.h>
 
42
#include <assert.h>
 
43
 
 
44
/*----------------------------------------------------------------------------
 
45
 * BFT library headers
 
46
 *----------------------------------------------------------------------------*/
 
47
 
 
48
#include "bft_mem.h"
 
49
#include "bft_printf.h"
 
50
 
 
51
/*----------------------------------------------------------------------------
 
52
 * FVM library headers
 
53
 *----------------------------------------------------------------------------*/
 
54
 
 
55
#include "fvm_defs.h"
 
56
#include "fvm_selector.h"
 
57
 
 
58
/*----------------------------------------------------------------------------
 
59
 *  Local headers
 
60
 *----------------------------------------------------------------------------*/
 
61
 
 
62
#include "cs_base.h"
 
63
#include "cs_mesh.h"
 
64
#include "cs_mesh_quantities.h"
 
65
#include "cs_selector.h"
 
66
 
 
67
/*----------------------------------------------------------------------------
 
68
 *  Header for the current file
 
69
 *----------------------------------------------------------------------------*/
 
70
 
 
71
#include "cs_prototypes.h"
 
72
#include "cs_mesh_thinwall.h"
 
73
 
 
74
/*----------------------------------------------------------------------------*/
 
75
 
 
76
BEGIN_C_DECLS
 
77
 
 
78
/*============================================================================
 
79
 * User function definitions
 
80
 *============================================================================*/
 
81
 
 
82
/*----------------------------------------------------------------------------
 
83
 * Insert thin wall into a mesh.
 
84
 *----------------------------------------------------------------------------*/
 
85
 
 
86
void
 
87
cs_user_mesh_thinwall(cs_mesh_t  *mesh)
 
88
{
 
89
  return; /* REMOVE_LINE_FOR_USE_OF_SUBROUTINE */
 
90
 
 
91
  /* Example: modify vertex coordinates */
 
92
  /*------------------------------------*/
 
93
 
 
94
  fvm_lnum_t   n_selected_faces = 0;
 
95
  fvm_lnum_t  *selected_faces = NULL; 
 
96
 
 
97
  cs_real_t  *i_face_cog = NULL, *i_face_normal = NULL;
 
98
 
 
99
  /* example of multi-line character string */
 
100
 
 
101
  const char criteria[] = "plane[0, -1, 0, 0.5, epsilon = 0.0001]"
 
102
                          " or plane[-1, 0, 0, 0.5, epsilon = 0.0001]";
 
103
 
 
104
  cs_mesh_init_group_classes(mesh);
 
105
 
 
106
  cs_mesh_quantities_i_faces(mesh, &i_face_cog, &i_face_normal);
 
107
 
 
108
  cs_glob_mesh->select_i_faces = fvm_selector_create(mesh->dim,
 
109
                                                     mesh->n_i_faces,
 
110
                                                     mesh->class_defs,
 
111
                                                     mesh->i_face_family,
 
112
                                                     1,
 
113
                                                     i_face_cog,
 
114
                                                     i_face_normal);
 
115
 
 
116
  BFT_MALLOC(selected_faces, mesh->n_i_faces, cs_int_t);
 
117
                              
 
118
  cs_selector_get_i_face_list(criteria,
 
119
                              &n_selected_faces,
 
120
                              selected_faces);
 
121
  cs_create_thinwall(mesh,
 
122
                     selected_faces,
 
123
                     n_selected_faces);
 
124
  
 
125
  BFT_FREE(i_face_cog);
 
126
  BFT_FREE(i_face_normal);
 
127
 
 
128
  mesh->class_defs = fvm_group_class_set_destroy(mesh->class_defs);
 
129
  fvm_selector_destroy(mesh->select_i_faces);
 
130
}
 
131
 
 
132
/*----------------------------------------------------------------------------*/
 
133
 
 
134
END_C_DECLS