OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
analyse_mat.c
Go to the documentation of this file.
1//Copyright> OpenRadioss
2//Copyright> Copyright (C) 1986-2025 Altair Engineering Inc.
3//Copyright>
4//Copyright> This program is free software: you can redistribute it and/or modify
5//Copyright> it under the terms of the GNU Affero General Public License as published by
6//Copyright> the Free Software Foundation, either version 3 of the License, or
7//Copyright> (at your option) any later version.
8//Copyright>
9//Copyright> This program is distributed in the hope that it will be useful,
10//Copyright> but WITHOUT ANY WARRANTY; without even the implied warranty of
11//Copyright> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12//Copyright> GNU Affero General Public License for more details.
13//Copyright>
14//Copyright> You should have received a copy of the GNU Affero General Public License
15//Copyright> along with this program. If not, see <https://www.gnu.org/licenses/>.
16//Copyright>
17//Copyright>
18//Copyright> Commercial Alternative: Altair Radioss Software
19//Copyright>
20//Copyright> As an alternative to this open-source version, Altair also offers Altair Radioss
21//Copyright> software under a commercial license. Contact Altair to discuss further if the
22//Copyright> commercial version may interest you: https://www.altair.com/radioss/.
23/*
24 Cls41l45 : Create File
25*/
26/*********************************************************************
27 * INCLUDES
28 *********************************************************************/
29#include <stdlib.h> /* qsort */
30#include <stdio.h>
31
32/*Cow41l6+++*/
33#include "hardware.inc"
34
35#if CPP_mach == CPP_w95 || CPP_mach == CPP_ant || CPP_mach == CPP_wnt
36/* el41m2+1 #define _FCALL __stdcall */
37#define _FCALL
38#elif 1
39#define _FCALL
40#endif
41/*Cow41l6---*/
42
43
44#include "analyse_name.inc"
45
46#include "analyse.h"
47
48static int compar_mat (const void *mat_1_p, const void *mat_2_p)
49{
50 float *mat_1;
51 float *mat_2;
52 float test;
53
54 mat_1 = (float *)mat_1_p;
55 mat_2 = (float *)mat_2_p;
56
57 if (*(mat_1+2) == 0) return -1;
58 if (*(mat_2+2) == 0) return 1;
59
60 test = (((*(mat_1+1))/(*(mat_1+2))) - ((*(mat_2+1))/(*(mat_2+2))));
61
62 if (test < 0)
63 return -1;
64 else if (test == 0)
65 return 0;
66 else
67 return 1;
68
69}
70
71
72static void analyse_mat(int *nbmat, float *tabmat)
73{
74 int i;
75 int cnt=0;
76 int nummat = *nbmat;
77 int nummid = nummat/2;
78
79 float e_rho_mid;
80 float e_rho_min;
81 float e_rho_max;
82 float e_rho_tmp;
83
84 qsort(tabmat,nummat, 3*sizeof(float),compar_mat);
85
86 if (tabmat[nummid*3+2] == 0)
87 e_rho_mid = 0;
88 else
89 e_rho_mid = tabmat[nummid*3+1]/tabmat[nummid*3+2];
90
91 e_rho_min = e_rho_mid/100;
92 e_rho_max = e_rho_mid * 100;
93
94/* el41m21 printf( " %d %e \n", nummid, e_rho_mid); */
95
96 for(i=0; i<nummat; i++)
97 {
98 if (tabmat[i*3+2] == 0)
99 e_rho_tmp = 0;
100 else
101 e_rho_tmp = tabmat[i*3+1]/tabmat[i*3+2];
102
103/* el41m21 printf( "%d %e \n", i, e_rho_tmp); */
104
105 if (e_rho_tmp<=e_rho_min)
106 {
107 analyse_stack_int((int)(tabmat[i*3]));
108 analyse_stack_float(e_rho_tmp);
109 analyse_stack_float(e_rho_mid);
110 analyse_call_error(AN_INFO, 464, ANINFO_BLIND_2);
111 cnt++;
112 }
113 else if (e_rho_tmp>e_rho_max)
114 {
115 analyse_stack_int((int)(tabmat[i*3]));
116 analyse_stack_float(e_rho_tmp);
117 analyse_stack_float(e_rho_mid);
118 analyse_call_error(AN_INFO, 465, ANINFO_BLIND_2);
119 cnt++;
120 }
121 }
122
125
126}
127
128void anmat(int *nbmat, float *tabmat)
129{
130 analyse_mat(nbmat, tabmat);
131}
132
133void anmat_(int *nbmat, float *tabmat)
134{
135 analyse_mat(nbmat, tabmat);
136}
137
138void anmat__(int *nbmat, float *tabmat)
139{
140 analyse_mat(nbmat, tabmat);
141}
142
143/*void ANMAT(int *nbmat, float *tabmat)*/
144void _FCALL ANMAT(int *nbmat, float *tabmat)
145{
146 analyse_mat(nbmat, tabmat);
147}
void analyse_stack_float(float r)
Definition analyse.c:294
void analyse_stack_int(int i)
Definition analyse.c:334
void analyse_call_check(int id)
Definition analyse.c:802
void analyse_call_error(int type, int id, int mode)
Definition analyse.c:580
void anmat__(int *nbmat, float *tabmat)
void anmat(int *nbmat, float *tabmat)
void _FCALL ANMAT(int *nbmat, float *tabmat)
static void analyse_mat(int *nbmat, float *tabmat)
Definition analyse_mat.c:72
static int compar_mat(const void *mat_1_p, const void *mat_2_p)
Definition analyse_mat.c:48
void anmat_(int *nbmat, float *tabmat)
recursive subroutine qsort(a, idx, first, last)
#define _FCALL