Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Dominik Mehlich
waLBerla
Commits
e69f495a
Commit
e69f495a
authored
Oct 04, 2019
by
Sebastian Eibl
Browse files
[ADD] ParticleAccessorWithShape
as this class is often needed it is now part of the mesa_pd core
parent
ba344f72
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/mesa_pd/data/ParticleAccessorWithShape.h
0 → 100644
View file @
e69f495a
//======================================================================================================================
//
// This file is part of waLBerla. waLBerla is free software: you can
// redistribute it and/or modify it under the terms of the GNU General Public
// License as published by the Free Software Foundation, either version 3 of
// the License, or (at your option) any later version.
//
// waLBerla is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
//
//! \file ParticleAccessorWithShape.h
//! \author Sebastian Eibl <sebastian.eibl@fau.de>
//
//======================================================================================================================
#pragma once
#include
<mesa_pd/data/ParticleAccessor.h>
#include
<mesa_pd/data/ParticleStorage.h>
#include
<mesa_pd/data/ShapeStorage.h>
namespace
walberla
{
namespace
mesa_pd
{
namespace
data
{
class
ParticleAccessorWithShape
:
public
data
::
ParticleAccessor
{
public:
ParticleAccessorWithShape
(
std
::
shared_ptr
<
data
::
ParticleStorage
>&
ps
,
std
::
shared_ptr
<
data
::
ShapeStorage
>&
ss
)
:
ParticleAccessor
(
ps
)
,
ss_
(
ss
)
{}
const
auto
&
getInvMass
(
const
size_t
p_idx
)
const
{
return
ss_
->
shapes
[
ps_
->
getShapeIDRef
(
p_idx
)]
->
getInvMass
();}
const
auto
&
getInvInertiaBF
(
const
size_t
p_idx
)
const
{
return
ss_
->
shapes
[
ps_
->
getShapeIDRef
(
p_idx
)]
->
getInvInertiaBF
();}
data
::
BaseShape
*
getShape
(
const
size_t
p_idx
)
const
{
return
ss_
->
shapes
[
ps_
->
getShapeIDRef
(
p_idx
)].
get
();}
private:
std
::
shared_ptr
<
data
::
ShapeStorage
>
ss_
;
};
}
//namespace data
}
//namespace mesa_pd
}
//namespace walberla
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment