forked from FSIS-IBM/pitch-plunge-omp-noisyinflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathassign_flag.cpp
32 lines (27 loc) · 1.16 KB
/
assign_flag.cpp
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
#include<cmath>
#include "assign_flag.h"
#include "nearestIBpoint.h"
// Function for tagging the flag to the different meshes
void assign_flag(int m_temp, int n_temp, int N_marker_temp, int c1_temp, int c2_temp, int c3_temp, int c4_temp, float* x_s_temp, float* y_s_temp, float* n1_temp, float* n2_temp, float* xtemp, float* ytemp, int* flagtemp)
{
float temp;
int k1;
#pragma omp parallel for default(shared) private(k1,temp) schedule(dynamic)
for(int i=0;i<n_temp;i++)
{
for (int j=0;j<m_temp;j++)
{
if(j>c1_temp && j<c2_temp && i>c3_temp && i<c4_temp)
{
k1 = nearestIBpoint(N_marker_temp, (float*)x_s_temp, (float*)y_s_temp, *(xtemp+i*m_temp+j), *(ytemp+i*m_temp+j));
temp = ((*(xtemp+i*m_temp+j)) - (*(x_s_temp+k1))) * (*(n1_temp+k1)) + ((*(ytemp+i*m_temp+j)) - (*(y_s_temp+k1))) * (*(n2_temp+k1));
if (temp>=0)
*(flagtemp+i*m_temp+j) = 1;
else
*(flagtemp+i*m_temp+j) = 0;
}
else
*(flagtemp+i*m_temp+j) = 1;
}
}
}