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
c342db71
Commit
c342db71
authored
9 years ago
by
cmaffeo2
Browse files
Options
Downloads
Patches
Plain Diff
--amend
parent
4b132126
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Configuration.cpp
+3
-0
3 additions, 0 deletions
Configuration.cpp
RigidBodyType.cpp
+24
-2
24 additions, 2 deletions
RigidBodyType.cpp
RigidBodyType.h
+29
-26
29 additions, 26 deletions
RigidBodyType.h
with
56 additions
and
28 deletions
Configuration.cpp
+
3
−
0
View file @
c342db71
...
@@ -408,6 +408,9 @@ void Configuration::copyToCUDA() {
...
@@ -408,6 +408,9 @@ void Configuration::copyToCUDA() {
// TODO: The above line fails when there is not enough memory. If it fails, stop.
// TODO: The above line fails when there is not enough memory. If it fails, stop.
// TODO: what's going on here?
// TODO: what's going on here?
// pmf_h is made as a copy of *part[i].pmf, which is then asynchronously copied to Device, and
// is not deleted
// seems like bad code, but not 100% sure
for
(
int
i
=
0
;
i
<
numParts
;
i
++
)
{
for
(
int
i
=
0
;
i
<
numParts
;
i
++
)
{
BaseGrid
*
pmf
=
NULL
,
*
diffusionGrid
=
NULL
;
BaseGrid
*
pmf
=
NULL
,
*
diffusionGrid
=
NULL
;
BrownianParticleType
*
b
=
new
BrownianParticleType
(
part
[
i
]);
BrownianParticleType
*
b
=
new
BrownianParticleType
(
part
[
i
]);
...
...
This diff is collapsed.
Click to expand it.
RigidBodyType.cpp
+
24
−
2
View file @
c342db71
...
@@ -52,8 +52,30 @@ KeyGrid RigidBodyType::createKeyGrid(String s) {
...
@@ -52,8 +52,30 @@ KeyGrid RigidBodyType::createKeyGrid(String s) {
return
g
;
return
g
;
}
}
void
RigidBodyType
::
addPotentialGrid
(
String
s
)
{
void
RigidBodyType
::
addPotentialGrid
(
String
s
)
{
potentialGrids
.
push_back
(
createKeyGrid
(
s
)
);
// tokenize and return
int
numTokens
=
s
.
tokenCount
();
if
(
numTokens
!=
2
)
{
printf
(
"ERROR: could not add Grid.
\n
"
);
// TODO improve this message
exit
(
1
);
}
String
*
token
=
new
String
[
numTokens
];
s
.
tokenize
(
token
);
String
key
=
token
[
0
];
BaseGrid
g
(
token
[
1
]);
potentialGrids
.
push_back
(
g
);
}
}
void
RigidBodyType
::
addDensityGrid
(
String
s
)
{
void
RigidBodyType
::
addDensityGrid
(
String
s
)
{
densityGrids
.
push_back
(
createKeyGrid
(
s
)
);
// tokenize and return
int
numTokens
=
s
.
tokenCount
();
if
(
numTokens
!=
2
)
{
printf
(
"ERROR: could not add Grid.
\n
"
);
// TODO improve this message
exit
(
1
);
}
String
*
token
=
new
String
[
numTokens
];
s
.
tokenize
(
token
);
String
key
=
token
[
0
];
BaseGrid
g
(
token
[
1
]);
densityGrids
.
push_back
(
g
);
}
}
This diff is collapsed.
Click to expand it.
RigidBodyType.h
+
29
−
26
View file @
c342db71
...
@@ -9,41 +9,47 @@
...
@@ -9,41 +9,47 @@
#include
"useful.h"
#include
"useful.h"
#include
"BaseGrid.h"
#include
"BaseGrid.h"
// Stores particle type's potential grid and other information
struct
KeyGrid
{
String
key
;
BaseGrid
grid
;
KeyGrid
()
:
key
(
NULL
),
grid
()
{
}
};
class
RigidBodyType
{
class
RigidBodyType
{
private:
private:
// Deletes all members
// Deletes all members
void
clear
();
void
clear
();
// void copy(const RigidBodyType& src);
// void copy(const RigidBodyType& src);
KeyGrid
createKeyGrid
(
String
s
);
public:
public:
/* RigidBodyType(const String& name = "") : */
/* name(name), num(0), */
/* reservoir(NULL), mass(1.0f), inertia(), transDamping(), */
/* rotDamping(), potentialGrids(NULL), densityGrids(NULL), */
/* potentialGrids_D(NULL), densityGrids_D(NULL) { } */
RigidBodyType
(
const
String
&
name
=
""
)
:
RigidBodyType
(
const
String
&
name
=
""
)
:
name
(
name
),
num
(
0
),
name
(
name
),
num
(
0
),
reservoir
(
NULL
),
mass
(
1.0
f
),
inertia
(),
transDamping
(),
reservoir
(
NULL
),
mass
(
1.0
f
),
inertia
(),
transDamping
(),
rotDamping
(),
potentialGrids
(
NULL
),
densityGrids
(
NULL
),
rotDamping
()
{
potentialGrids_D
(
NULL
),
densityGrids_D
(
NULL
)
{
}
/* potentialGrids = *(new thrust::host_vector<BaseGrid>()); */
/* densityGrids = *(new thrust::host_vector<BaseGrid>()); */
/* potentialGrids = *(new thrust::host_vector<BaseGrid>()); */
/* densityGrids = *(new thrust::host_vector<BaseGrid>()); */
/* thrust::host_vector<BaseGrid> potentialGrids; */
/* thrust::host_vector<BaseGrid> densityGrids; */
/* thrust::device_vector<BaseGrid> potentialGrids_D; */
/* thrust::device_vector<BaseGrid> densityGrids_D; */
potentialGrids
=
thrust
::
host_vector
<
BaseGrid
>
();
densityGrids
=
thrust
::
host_vector
<
BaseGrid
>
();
potentialGrids
=
thrust
::
host_vector
<
BaseGrid
>
();
densityGrids
=
thrust
::
host_vector
<
BaseGrid
>
();
}
/* RigidBodyType(const RigidBodyType& src) { copy(src); } */
/* RigidBodyType(const RigidBodyType& src) { copy(src); } */
~
RigidBodyType
()
{
clear
();
}
~
RigidBodyType
()
{
clear
();
}
/* RigidBodyType& operator=(const RigidBodyType& src); */
/* RigidBodyType& operator=(const RigidBodyType& src); */
// crop
// Crops all BaseGrid members
// @param boundries to crop to (x0, y0, z0) -> (x1, y1, z1);
// whether to change the origin
// @return success of function (if false nothing was done)
/* bool crop(int x0, int y0, int z0, int x1, int y1, int z1, bool keep_origin); */
void
addPotentialGrid
(
String
s
);
void
addPotentialGrid
(
String
s
);
void
addDensityGrid
(
String
s
);
void
addDensityGrid
(
String
s
);
...
@@ -52,17 +58,14 @@ public:
...
@@ -52,17 +58,14 @@ public:
int
num
;
// number of particles of this type
int
num
;
// number of particles of this type
Reservoir
*
reservoir
;
Reservoir
*
reservoir
;
/* BaseGrid* pmf; */
float
mass
;
float
mass
;
Vector3
inertia
;
Vector3
inertia
;
Vector3
transDamping
;
Vector3
transDamping
;
Vector3
rotDamping
;
Vector3
rotDamping
;
/* std::vector<KeyGrid> potentialGrids; */
thrust
::
host_vector
<
BaseGrid
>
potentialGrids
;
/* std::vector<KeyGrid> densityGrids; */
thrust
::
host_vector
<
BaseGrid
>
densityGrids
;
thrust
::
host_vector
<
KeyGrid
>
potentialGrids
;
thrust
::
device_vector
<
BaseGrid
>
potentialGrids_D
;
thrust
::
device_vector
<
KeyGrid
>
potentialGrids_D
;
thrust
::
device_vector
<
BaseGrid
>
densityGrids_D
;
thrust
::
host_vector
<
KeyGrid
>
densityGrids
;
thrust
::
device_vector
<
KeyGrid
>
densityGrids_D
;
};
};
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