Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F79598060
ref_node_paradis.hh
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Aug 27, 07:10
Size
10 KB
Mime Type
text/x-c++
Expires
Thu, Aug 29, 07:10 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
20207121
Attached To
rLIBMULTISCALE LibMultiScale
ref_node_paradis.hh
View Options
/**
* @file ref_node_paradis.hh
*
* @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
* @author Max Hodapp <max.hodapp@epfl.ch>
* @author Jaehyun Cho <jaehyun.cho@epfl.ch>
*
* @date Mon Oct 28 19:23:14 2013
*
* @brief Nodal reference of ParaDiS
*
* @section LICENSE
*
* Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
* Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
*
* LibMultiScale is free software: you can redistribute it and/or modify it
* under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* LibMultiScale 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 Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with LibMultiScale. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef __LIBMULTISCALE_REF_NODE_PARADIS_HH__
#define __LIBMULTISCALE_REF_NODE_PARADIS_HH__
/* -------------------------------------------------------------------------- */
// ParaDis includes
#define PARALLEL
#include <mpi.h>
extern
"C"
{
#include "Home.h"
#include "Typedefs.h"
}
#undef PARALLEL
/* -------------------------------------------------------------------------- */
#include "ref_node_dd.hh"
/* -------------------------------------------------------------------------- */
__BEGIN_LIBMULTISCALE__
/* -------------------------------------------------------------------------- */
class
DomainParaDiS
;
class
ComparatorRefParaDiSNode
;
/* -------------------------------------------------------------------------- */
/**
* Class RefPARADISNode
*
*/
class
RefParaDiSNode
:
public
RefDDNode
<
3
,
RefParaDiSNode
>
{
/* ------------------------------------------------------------------------ */
/* Typedefs */
/* ------------------------------------------------------------------------ */
public
:
//! generic container of the original model container
typedef
DomainParaDiS
Domain
;
//! node comparator class to be usable in maps
typedef
ComparatorRefParaDiSNode
RefComparator
;
static
const
UInt
Dim
=
3
;
/* ------------------------------------------------------------------------ */
/* Constructors/Destructors */
/* ------------------------------------------------------------------------ */
public
:
RefParaDiSNode
()
:
fakestress
(
0
)
{}
RefParaDiSNode
(
int
index
)
:
fakestress
(
0
)
{
index_node
=
index
;
}
/* ------------------------------------------------------------------------ */
/* Methods */
/* ------------------------------------------------------------------------ */
bool
operator
==
(
RefParaDiSNode
&
ref
)
{
return
(
ref
.
index_node
==
index_node
);
};
VectorProxy
<
3
>
position0
()
{
return
this
->
position
();
}
VectorProxy
<
3
>
position
()
{
return
VectorProxy
<
3
>
(
paradis_ptr
->
nodeKeys
[
this
->
index_node
]
->
x
,
paradis_ptr
->
nodeKeys
[
this
->
index_node
]
->
y
,
paradis_ptr
->
nodeKeys
[
this
->
index_node
]
->
z
);
}
VectorProxy
<
3
>
velocity
()
{
return
VectorProxy
<
3
>
(
paradis_ptr
->
nodeKeys
[
this
->
index_node
]
->
vX
,
paradis_ptr
->
nodeKeys
[
this
->
index_node
]
->
vY
,
paradis_ptr
->
nodeKeys
[
this
->
index_node
]
->
vZ
);
}
VectorProxy
<
3
>
force
()
{
return
VectorProxy
<
3
>
(
paradis_ptr
->
nodeKeys
[
this
->
index_node
]
->
fX
,
paradis_ptr
->
nodeKeys
[
this
->
index_node
]
->
fY
,
paradis_ptr
->
nodeKeys
[
this
->
index_node
]
->
fZ
);
}
// Real &prev_position(unsigned int i) {
// switch (i) {
// case 0:
// return paradis_ptr->nodeKeys[this->index_node]->oldx;
// break;
// case 1:
// return paradis_ptr->nodeKeys[this->index_node]->oldy;
// break;
// case 2:
// return paradis_ptr->nodeKeys[this->index_node]->oldz;
// break;
// }
// Real *p = NULL;
// return *p;
// }
int
&
numNbrsIndexNode
(
unsigned
int
idx
)
{
return
paradis_ptr
->
nodeKeys
[
idx
]
->
numNbrs
;
}
// Real &getNeighborNodeCoord(unsigned int n, unsigned int i) {
// UInt my_domain = paradis_ptr->myDomain;
// Node_t current = *paradis_ptr->nodeKeys[this->index_node];
// Tag_t *tag = current.nbrTag;
// UInt tag_domain = tag[n].domainID;
// int idx_for_neighbor = tag[n].index;
// if (my_domain == tag_domain) {
// switch (i) {
// case 0:
// return paradis_ptr->nodeKeys[idx_for_neighbor]->x;
// break;
// case 1:
// return paradis_ptr->nodeKeys[idx_for_neighbor]->y;
// break;
// case 2:
// return paradis_ptr->nodeKeys[idx_for_neighbor]->z;
// break;
// }
// } else {
// switch (i) {
// case 0:
// return paradis_ptr->remoteDomainKeys[tag_domain]
// ->nodeKeys[idx_for_neighbor]
// ->x;
// break;
// case 1:
// return paradis_ptr->remoteDomainKeys[tag_domain]
// ->nodeKeys[idx_for_neighbor]
// ->y;
// break;
// case 2:
// return paradis_ptr->remoteDomainKeys[tag_domain]
// ->nodeKeys[idx_for_neighbor]
// ->z;
// break;
// }
// }
// Real *p = NULL;
// return *p;
// }
// int &getNeighborNodeIndex0(unsigned int n) {
// Node_t current = *paradis_ptr->nodeKeys[this->index_node];
// Tag_t *tag = current.nbrTag;
// return tag[n].index0;
// }
// int &getNeighborNodeIndex(unsigned int n) {
// Node_t current = *paradis_ptr->nodeKeys[this->index_node];
// Tag_t *tag = current.nbrTag;
// return tag[n].index;
// }
// int &getNeighborNodeSlave(unsigned int n) {
// UInt my_domain = paradis_ptr->myDomain;
// Node_t current = *paradis_ptr->nodeKeys[this->index_node];
// Tag_t *tag = current.nbrTag;
// UInt tag_domain = tag[n].domainID;
// int idx_for_neighbor = tag[n].index;
// if (my_domain == tag_domain)
// return paradis_ptr->nodeKeys[idx_for_neighbor]->slave;
// else
// return paradis_ptr->remoteDomainKeys[tag_domain]
// ->nodeKeys[idx_for_neighbor]
// ->slave;
// }
// int &getNbrNeighborsOfNeighbor(unsigned int n) {
// UInt my_domain = paradis_ptr->myDomain;
// Node_t current = *paradis_ptr->nodeKeys[this->index_node];
// Tag_t *tag = current.nbrTag;
// UInt tag_domain = tag[n].domainID;
// int idx_for_neighbor = tag[n].index;
// if (my_domain == tag_domain)
// return paradis_ptr->nodeKeys[idx_for_neighbor]->numNbrs;
// else
// return paradis_ptr->remoteDomainKeys[tag_domain]
// ->nodeKeys[idx_for_neighbor]
// ->numNbrs;
// }
UInt
&
tag
()
{
return
this
->
index_node
;
}
int
&
getIndex0
()
{
return
paradis_ptr
->
nodeKeys
[
this
->
index_node
]
->
myTag
.
index0
;
}
int
&
getIndex
()
{
return
paradis_ptr
->
nodeKeys
[
this
->
index_node
]
->
myTag
.
index
;
}
void
getIndexes
(
int
&
n
)
{
n
=
index_node
;
}
void
setIndex
(
UInt
index
)
{
index_node
=
index
;
}
void
setHome
(
Home_t
*
paradis_ptr
)
{
this
->
paradis_ptr
=
paradis_ptr
;
};
// // Get the number of neighbors
// UInt getNbrOfNeighs() {
// return UInt(this->paradis_ptr->nodeKeys[this->index_node]->numNbrs);
// }
int
getSlave
()
{
return
this
->
paradis_ptr
->
nodeKeys
[
this
->
index_node
]
->
slave
;
}
//! constraint tag:
int
getConstraint
()
{
return
this
->
paradis_ptr
->
nodeKeys
[
this
->
index_node
]
->
constraint
;
}
void
slaving
()
{
paradis_ptr
->
nodeKeys
[
this
->
index_node
]
->
slave
=
1
;
}
void
unslaving
()
{
paradis_ptr
->
nodeKeys
[
this
->
index_node
]
->
slave
=
0
;
}
void
constrain
()
{
paradis_ptr
->
nodeKeys
[
this
->
index_node
]
->
constraint
=
7
;
}
void
unconstrain
()
{
paradis_ptr
->
nodeKeys
[
this
->
index_node
]
->
constraint
=
0
;
}
// void setOldVel(unsigned int i, Real oldv) {
// switch (i) {
// case 0:
// paradis_ptr->nodeKeys[this->index_node]->oldvX = oldv;
// return;
// case 1:
// paradis_ptr->nodeKeys[this->index_node]->oldvY = oldv;
// return;
// case 2:
// paradis_ptr->nodeKeys[this->index_node]->oldvZ = oldv;
// return;
// }
// return;
// }
// void release(UInt nbr_index) {
// paradis_ptr->nodeKeys[this->index_node]->constraint = 0;
// UInt index_for_neighbor =
// paradis_ptr->nodeKeys[this->index_node]->nbrTag[0].index;
// paradis_ptr->nodeKeys[this->index_node]->oldvX =
// 0.5 * (paradis_ptr->nodeKeys[index_for_neighbor]->oldvX +
// paradis_ptr->nodeKeys[nbr_index]->oldvX);
// paradis_ptr->nodeKeys[this->index_node]->oldvY =
// 0.5 * (paradis_ptr->nodeKeys[index_for_neighbor]->oldvY +
// paradis_ptr->nodeKeys[nbr_index]->oldvY);
// paradis_ptr->nodeKeys[this->index_node]->oldvZ =
// 0.5 * (paradis_ptr->nodeKeys[index_for_neighbor]->oldvZ +
// paradis_ptr->nodeKeys[nbr_index]->oldvZ);
// InsertArm(paradis_ptr, paradis_ptr->nodeKeys[this->index_node],
// ¶dis_ptr->nodeKeys[nbr_index]->myTag,
// -1.0 * (paradis_ptr->nodeKeys[this->index_node]->burgX[0]),
// -1.0 * (paradis_ptr->nodeKeys[this->index_node]->burgY[0]),
// -1.0 * (paradis_ptr->nodeKeys[this->index_node]->burgZ[0]),
// paradis_ptr->nodeKeys[this->index_node]->nx[0],
// paradis_ptr->nodeKeys[this->index_node]->ny[0],
// paradis_ptr->nodeKeys[this->index_node]->nz[0], 0, 1);
// paradis_ptr->nodeKeys[this->index_node]->numNbrs = 2;
// }
friend
class
ContainerParaDiSNode
;
private
:
Home_t
*
paradis_ptr
;
unsigned
int
index_node
;
unsigned
int
index0_node
;
Real
fakestress
;
// This is a temprary fix to make the dumpers work: FIXMETILL
};
/* -------------------------------------------------------------------------- */
class
ComparatorRefParaDiSNode
{
public
:
bool
operator
()(
RefParaDiSNode
&
r1
,
RefParaDiSNode
&
r2
)
const
{
// return r1.index_atome < r2.index_atome;
LM_TOIMPLEMENT
;
}
bool
operator
()(
const
RefParaDiSNode
&
r1
,
const
RefParaDiSNode
&
r2
)
const
{
LM_TOIMPLEMENT
;
}
};
/* -------------------------------------------------------------------------- */
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
RefParaDiSNode
&
ref
)
{
int
n
;
ref
.
getIndexes
(
n
);
os
<<
"ParaDiSNode reference : "
<<
n
;
return
os
;
}
/* -------------------------------------------------------------------------- */
__END_LIBMULTISCALE__
#endif
/* __LIBMULTISCALE_REF_NODE_ParaDiS_HH__ */
Event Timeline
Log In to Comment