-
Notifications
You must be signed in to change notification settings - Fork 97
feat: Add functions to connect well perforation to surface elements #3359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
998857e
8d2f816
dba796a
c8557e7
75d7a70
85fe134
f249115
d4caa6a
c2eb806
7e911d3
e927410
7c3b280
7839d7a
c0702ef
a4aa4a2
f88f482
c26e1cc
7cef347
0f88d5a
a4041d7
7be3513
91d8e63
7af09b0
6e63f20
6733dc1
8a7c8fa
a1caadf
28a7b0a
c93f069
5d0f32c
fe5d046
c4eaa53
b7988a5
ba5f466
5911c0d
bad8ebd
c65a65f
5e61ed8
7858fd7
14422f2
1210866
be90a23
4d8a986
418f18f
cd30695
0c6bcef
d2fc2a6
b1a3f19
0bc4a38
f18b63e
2b47317
2f26203
6fe9518
85bedf6
6ace57b
af565ed
02a5901
29ffe9b
cf4e21e
3051704
2720743
56d52cb
74924be
f8b21d9
a979d51
624187d
c22d0ae
ec48635
9b47105
1021317
026e729
7a15d18
090f555
6123da5
799e4b4
fb42fc2
b5472e9
0bbb761
e44d6c9
57b5ad6
e4d8400
ce2e7bf
616d4e0
cfb4ad3
df474a1
5de317a
9031a4b
f98e9ea
e0e560e
027eb80
5246773
79501ec
a702020
18de74a
30b20b6
a4aec50
6a40a02
b9fd44f
e517a4f
9ebd1eb
7f3b542
835c350
e53b870
e75ee07
cce8dac
4375a76
838548c
a436250
7c202db
ccb4aa4
4d0c270
ad1c20f
906bbd7
7deed47
6db923f
cd4caa5
a308ef1
38e082e
8f58720
c6ebc65
aff3ff9
91882eb
386ca54
07ac768
8ce2223
c31d347
896ec4a
d70ee8f
e09d625
4fe59ac
08b2fc1
9c9b46b
0cdf7a0
ae33099
ace6d0d
27454a0
f46efe0
b982c47
3c9ebb4
5d76d83
58ed082
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -434,104 +434,104 @@ | |
| } | ||
|
|
||
| template< typename POLYGON_TYPE, typename POINT_TYPE > | ||
| bool isPointInPolygon2d( POLYGON_TYPE const & polygon, integer n, POINT_TYPE const & point ) | ||
| { | ||
| integer count = 0; | ||
|
|
||
| for( integer i = 0; i < n; i++ ) | ||
| { | ||
| auto const & p1 = polygon[i]; | ||
| auto const & p2 = polygon[(i + 1) % n]; | ||
|
|
||
| if((point[1] > std::min( p1[1], p2[1] )) && | ||
| (point[1] <= std::max( p1[1], p2[1] )) && | ||
| (point[0] <= std::max( p1[0], p2[0] ))) | ||
| { | ||
| real64 const xIntersect = (point[1] - p1[1]) * (p2[0] - p1[0]) / (p2[1] - p1[1]) + p1[0]; | ||
|
||
| if( std::abs( p1[0] - p2[0] ) < 1e-10 || point[0] <= xIntersect ) | ||
jhuang2601 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| { | ||
| count++; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| return count % 2 == 1; | ||
| } | ||
|
|
||
| template< typename POLYGON_TYPE, typename POINT_TYPE > | ||
| bool isPointInPolygon3d( POLYGON_TYPE const & polygon, integer const n, POINT_TYPE const & point ) | ||
| { | ||
| // Check if the point lies in the plane of the polygon | ||
| auto const & p0 = polygon[0]; | ||
| POINT_TYPE normal = {0, 0, 0}; | ||
| for( integer i = 1; i < n - 1; i++ ) | ||
| { | ||
| auto const & p1 = polygon[i]; | ||
| auto const & p2 = polygon[i + 1]; | ||
| normal[0] += (p1[1] - p0[1]) * (p2[2] - p0[2]) - (p1[2] - p0[2]) * (p2[1] - p0[1]); | ||
| normal[1] += (p1[2] - p0[2]) * (p2[0] - p0[0]) - (p1[0] - p0[0]) * (p2[2] - p0[2]); | ||
| normal[2] += (p1[0] - p0[0]) * (p2[1] - p0[1]) - (p1[1] - p0[1]) * (p2[0] - p0[0]); | ||
| } | ||
|
|
||
| real64 d = -(normal[0] * p0[0] + normal[1] * p0[1] + normal[2] * p0[2]); | ||
| real64 dist = normal[0] * point[0] + normal[1] * point[1] + normal[2] * point[2] + d; | ||
|
|
||
| if( std::abs( dist ) > 1e-6 ) | ||
| { | ||
| return false; | ||
| } | ||
|
|
||
| // Determine the dominant component of the normal vector | ||
| int dominantIndex = 0; | ||
| if( std::abs( normal[1] ) > std::abs( normal[0] )) | ||
| { | ||
| dominantIndex = 1; | ||
| } | ||
| if( std::abs( normal[2] ) > std::abs( normal[dominantIndex] )) | ||
| { | ||
| dominantIndex = 2; | ||
| } | ||
|
|
||
| // Project the polygon and the point onto a 2D plane | ||
| POLYGON_TYPE projectedPolygon( n ); | ||
| POINT_TYPE projectedPoint; | ||
| for( integer i = 0; i < n; i++ ) | ||
| { | ||
| projectedPolygon[i][0] = polygon[i][1]; | ||
| projectedPolygon[i][1] = polygon[i][2]; | ||
| } | ||
paveltomin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| if( dominantIndex == 0 ) // X is dominant, project onto YZ plane | ||
| { | ||
| for( int i = 0; i < n; i++ ) | ||
| { | ||
| projectedPolygon[i][0] = polygon[i][1]; | ||
| projectedPolygon[i][1] = polygon[i][2]; | ||
| } | ||
| projectedPoint[0] = point[1]; | ||
| projectedPoint[1] = point[2]; | ||
| } | ||
| else if( dominantIndex == 1 ) // Y is dominant, project onto XZ plane | ||
| { | ||
| for( int i = 0; i < n; i++ ) | ||
| { | ||
| projectedPolygon[i][0] = polygon[i][0]; | ||
| projectedPolygon[i][1] = polygon[i][2]; | ||
| } | ||
| projectedPoint[0] = point[0]; | ||
| projectedPoint[1] = point[2]; | ||
| } | ||
| else // Z is dominant, project onto XY plane | ||
| { | ||
| for( int i = 0; i < n; i++ ) | ||
| { | ||
| projectedPolygon[i][0] = polygon[i][0]; | ||
| projectedPolygon[i][1] = polygon[i][1]; | ||
| } | ||
| projectedPoint[0] = point[0]; | ||
| projectedPoint[1] = point[1]; | ||
| } | ||
|
|
||
| return isPointInPolygon2d( projectedPolygon, n, projectedPoint ); | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -946,8 +946,6 @@ | |
| arrayView2d< real64 const, nodes::REFERENCE_POSITION_USD > const & pointCoordinates, | ||
| VEC_TYPE && boxDims ) | ||
| { | ||
| std::cout << "getBoundingBox " << elemIndex << std::endl; | ||
|
|
||
| // This holds the min coordinates of the set in each direction | ||
| R1Tensor minCoords = { LvArray::NumericLimits< real64 >::max, | ||
| LvArray::NumericLimits< real64 >::max, | ||
|
|
@@ -957,7 +955,6 @@ | |
| LvArray::tensorOps::fill< 3 >( boxDims, LvArray::NumericLimits< real64 >::lowest ); | ||
|
|
||
| // loop over all the vertices of the element to get the min and max coords | ||
| std::cout << pointIndices[elemIndex].size() << std::endl; | ||
| for( localIndex a = 0; a < pointIndices[elemIndex].size(); ++a ) | ||
| { | ||
| localIndex const id = pointIndices( elemIndex, a ); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.