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
e621f42c
Commit
e621f42c
authored
2 years ago
by
cmaffeo2
Browse files
Options
Downloads
Patches
Plain Diff
chatgpt docs --- unsettlingly good
parent
19a7f749
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Interaction.h
+46
-12
46 additions, 12 deletions
src/Interaction.h
with
46 additions
and
12 deletions
src/Interaction.h
+
46
−
12
View file @
e621f42c
/**
* @file LocalInteraction.h
* @brief Defines the LocalInteraction class and its related structures
*/
#pragma once
#include
<cassert>
...
...
@@ -5,32 +10,61 @@
#include
<map>
#include
"PatchOp.h"
/**
* @class LocalInteraction
* @brief Base class for local interaction
*/
class
LocalInteraction
:
public
BasePatchOp
{
public:
/**
* @brief Computes interaction for a given patch
* @param patch Pointer to the patch for which interaction is to be computed
*/
virtual
void
compute
(
Patch
*
patch
)
=
0
;
/**
* @brief Returns the number of patches
* @return The number of patches
*/
int
num_patches
()
const
{
return
1
;
};
// Following relates to lazy initialized factory method
/**
* @brief Struct for defining interaction configuration
*/
struct
Conf
{
enum
Object
{
Particle
,
RigidBody
};
enum
DoF
{
Bond
,
Angle
,
Dihedral
,
Bonded
,
NeighborhoodPair
};
enum
Form
{
Harmonic
,
Tabulated
,
LennardJones
,
Coulomb
,
LJ
};
enum
Backend
{
Default
,
CUDA
,
CPU
};
enum
Object
{
Particle
,
RigidBody
};
enum
DoF
{
Bond
,
Angle
,
Dihedral
,
Bonded
,
NeighborhoodPair
};
enum
Form
{
Harmonic
,
Tabulated
,
LennardJones
,
Coulomb
,
LJ
};
enum
Backend
{
Default
,
CUDA
,
CPU
};
Object
object_type
;
DoF
dof
;
Form
form
;
Backend
backend
;
explicit
operator
int
()
const
{
return
object_type
*
64
+
dof
*
16
+
form
*
4
+
backend
;};
Object
object_type
;
///< The object type
DoF
dof
;
///< The degree of freedom
Form
form
;
///< The form
Backend
backend
;
///< The backend for computing the interaction
/**
* @brief int Conversion operator for Conf for easy comparison
* @return The integer representation of Conf
*/
explicit
operator
int
()
const
{
return
object_type
*
64
+
dof
*
16
+
form
*
4
+
backend
;};
};
/**
* @brief Factory method for obtaining a LocalInteraction object
* @param conf The configuration for the LocalInteraction object to be obtained
* @return A pointer to the LocalInteraction object
*/
static
LocalInteraction
*
GetInteraction
(
Conf
&
conf
);
private
:
size_t
num_interactions
;
size_t
num_interactions
;
/**< Stores the number of interactions of this type in the system. */
protected
:
/**
* A map that maps interaction configurations to interaction objects.
* This map is shared across all instances of LocalInteraction and is used to
* lazily initialize and retrieve interaction objects based on their configuration.
*/
static
std
::
map
<
Conf
,
LocalInteraction
*>
_interactions
;
};
...
...
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