Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
arbd
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tbgl
tools
arbd
Commits
740230b8
Commit
740230b8
authored
9 years ago
by
cmaffeo2
Browse files
Options
Downloads
Patches
Plain Diff
removed possible bug in computeGridGrid kernel
parent
eb5ef427
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ComputeGridGrid.cuh
+20
-23
20 additions, 23 deletions
ComputeGridGrid.cuh
with
20 additions
and
23 deletions
ComputeGridGrid.cuh
+
20
−
23
View file @
740230b8
...
@@ -16,33 +16,30 @@ void computeGridGridForce(const RigidBodyGrid* rho, const RigidBodyGrid* u,
...
@@ -16,33 +16,30 @@ void computeGridGridForce(const RigidBodyGrid* rho, const RigidBodyGrid* u,
const
int
tid
=
threadIdx
.
x
;
const
int
tid
=
threadIdx
.
x
;
const
int
r_id
=
blockIdx
.
x
*
blockDim
.
x
+
threadIdx
.
x
;
const
int
r_id
=
blockIdx
.
x
*
blockDim
.
x
+
threadIdx
.
x
;
if
(
r_id
>=
rho
->
getSize
())
{
// skip threads with nothing to do
force
[
tid
]
=
Vector3
(
0.0
f
);
force
[
tid
]
=
Vector3
(
0.0
f
);
torque
[
tid
]
=
Vector3
(
0.0
f
);
torque
[
tid
]
=
Vector3
(
0.0
f
);
if
(
r_id
<
rho
->
getSize
())
{
// skip threads with nothing to do
return
;
// RBTODO: reduce registers used;
}
// commenting out interpolateForceD still uses ~40 registers
// -- the innocuous-looking fn below is responsible; consumes ~17 registers!
// RBTODO: reduce registers used;
Vector3
r_pos
=
rho
->
getPosition
(
r_id
);
/* i,j,k value of voxel */
// commenting out interpolateForceD still uses ~40 registers
// -- the innocuous-looking fn below is responsible; consumes ~17 registers!
Vector3
r_pos
=
rho
->
getPosition
(
r_id
);
/* i,j,k value of voxel */
r_pos
=
basis_rho
.
transform
(
r_pos
)
+
origin_rho_minus_origin_u
;
/* real space */
r_pos
=
basis_rho
.
transform
(
r_pos
)
+
origin_rho_minus_origin_u
;
/* real space */
const
Vector3
u_ijk_float
=
basis_u_inv
.
transform
(
r_pos
);
const
Vector3
u_ijk_float
=
basis_u_inv
.
transform
(
r_pos
);
// RBTODO What about non-unit delta?
// RBTODO What about non-unit delta?
/* Vector3 tmpf = Vector3(0.0f); */
/* Vector3 tmpf = Vector3(0.0f); */
/* float tmpe = 0.0f; */
/* float tmpe = 0.0f; */
/* const ForceEnergy fe = ForceEnergy( tmpf, tmpe); */
/* const ForceEnergy fe = ForceEnergy( tmpf, tmpe); */
const
ForceEnergy
fe
=
u
->
interpolateForceDLinearly
(
u_ijk_float
);
/* in coord frame of u */
const
ForceEnergy
fe
=
u
->
interpolateForceDLinearly
(
u_ijk_float
);
/* in coord frame of u */
force
[
tid
]
=
fe
.
f
;
force
[
tid
]
=
fe
.
f
;
const
float
r_val
=
rho
->
val
[
r_id
];
/* maybe move to beginning of function? */
const
float
r_val
=
rho
->
val
[
r_id
];
/* maybe move to beginning of function? */
force
[
tid
]
=
basis_u_inv
.
transpose
().
transform
(
r_val
*
force
[
tid
]
);
/* transform to lab frame, with correct scaling factor */
force
[
tid
]
=
basis_u_inv
.
transpose
().
transform
(
r_val
*
force
[
tid
]
);
/* transform to lab frame, with correct scaling factor */
// Calculate torque about origin_u in the lab frame
// Calculate torque about origin_u in the lab frame
torque
[
tid
]
=
r_pos
.
cross
(
force
[
tid
]);
// RBTODO: test if sign is correct!
torque
[
tid
]
=
r_pos
.
cross
(
force
[
tid
]);
// RBTODO: test if sign is correct!
}
// Reduce force and torques
// Reduce force and torques
// http://www.cuvilib.com/Reduction.pdf
// http://www.cuvilib.com/Reduction.pdf
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment