1 #ifndef EMM_MatterField_HPP 2 #define EMM_MatterField_HPP 14 const SV::EMM_Matter &matters=
mMatters;
18 if ((nCells==0) || (nCells==1)) {
20 const tReal* parameters=&(matters[0]->getParameter(k));
21 const tUSInt& dim=matters[0]->getParameterDimension(k);
37 memset(v,0,dim*
sizeof(T));
42 const tUSInt& dim=matters[0]->getParameterDimension(k);
61 tUIndex start=threadId*nCells/nThreads;
63 tUIndex end=(threadId+1)*nCells/nThreads;
65 const tUIndex *matterIndex=&matterIndices[start];
67 tUIndex nMatters=matters.getSize();
69 const tReal* parameters;
74 for (iCell=start;iCell<end;iCell++) {
77 memset(v,0,dim*
sizeof(T));
81 if (*matterIndex<nMatters) {
83 parameters=&matters[*matterIndex]->getParameter(k);
90 memset(v,0,dim*
sizeof(T));
104 for (d=0;d<dim;d++) {
117 if (!isInitialized) {
120 for (d=0;d<dim;d++) {
122 if ((*v)!=0) isInitialized=
true;
129 for (d=0;d<dim;d++) {
130 if (fabs(1-(*v)/(*vold))>eps) {
147 for (d=0;d<dim;d++) {
167 const SV::EMM_Matter &matters=
mMatters;
171 if ((nCells==0) || (nCells==1)) {
174 const tUSInt& dim=matters[0]->getParameterDimension(k);
180 const tReal* parameters=&(matters[0]->getParameter(k));
184 for (d=0;d<dim;d++) {
185 *v=(T) (*parameters);
191 memset(v,0,dim*
sizeof(T));
207 const tUSInt& dim=matters[0]->getParameterDimension(k);
211 vs.
setSize(nCells,dim,nThreads);
214 vector<CORE_MorseArrayIterator<T> > iterVs(nThreads);
216 OMP_PARALLEL_PRIVATE_SHARED(
private(iCell,d,threadId),shared(nThreads,cout,dim,nCells,vs,iterVs,matterIndices,matters,k)) {
225 tUIndex start=threadId*nCells/nThreads;
227 tUIndex end=(threadId+1)*nCells/nThreads;
229 const tUIndex *matterIndex=&matterIndices[start];
231 tUIndex nMatters=matters.getSize();
240 vs.
begin(start,threadId,iterV);
246 for (iCell=start;iCell<end;iCell++) {
251 if ( (*matterIndex)<nMatters) {
252 matter=matters.get(*matterIndex);
258 for (d=0;d<dim;d++) {
259 (*v)=(T) (*parameters);
EMM_UIndexArray mMatterIndices
list of indices of matters element index -> index of matter in mMatters list (NO_MATTER if no matter)...
Definition: EMM_MatterField.h:49
const tUIndex & getSize() const
return the size of the array for reading
Definition: CORE_Array.h:1018
tBoolean getMatterParameterDistribution(const tFlag &k, EMM_Array< T > &vs) const
get the values of a parameter of matters in a field for each cell
Definition: EMM_MatterField.hpp:7
#define OMP_GET_THREAD_ID()
Definition: openMP.h:76
void setUniformSize(const tUIndex &n, const tUIndex &ld)
set the morse array to be uniform of size n x ld
Definition: CORE_MorseArray.h:328
#define tUInteger
Definition: types.h:91
const tReal & getParameter(const tUSInt &k) const
get the parameter at index k for reading
Definition: EMM_Matter.h:377
This class describes a general morse array of size N. A morse array is composed by.
Definition: CORE_MorseArray.h:31
#define OMP_PARALLEL_SHARED(S)
Definition: openMP.h:85
void reset()
init the array to 0
Definition: CORE_MorseArray.h:381
#define tUSInt
Definition: types.h:28
#define tBoolean
Definition: types.h:139
void setSize(const tUIndex &n)
set the size
Definition: CORE_Array.h:292
tBoolean uniformize()
uniformize the array
Definition: CORE_MorseArray.h:558
#define null
Definition: types.h:144
void setSize(const tUIndex &n)
set the size of the element
Definition: CORE_MorseArrayIterator.h:153
This class describes a matter for E-MicroM package.
Definition: EMM_Matter.h:34
void merge()
merge the morse array built by P packs
Definition: CORE_MorseArray.h:530
T * values() const
return the current values
Definition: CORE_MorseArrayIterator.h:129
tBoolean isUniform() const
return true if the field is uniform
Definition: EMM_MatterField.h:195
virtual void fitToSize()
fit the array alocation exactly to size fit the allocation of the array to its size ...
Definition: CORE_Array.hpp:128
SV::EMM_Matter mMatters
list of matters
Definition: EMM_MatterField.h:53
#define tUIndex
Definition: types.h:126
#define OMP_GET_THREADS_NUMBER()
Definition: openMP.h:74
void begin(const tUIndex &start, const tUInteger &iPack, CORE_MorseArrayIterator< T > &iter)
create an iterator to index start for the pack at iPack for creating the morse array ...
Definition: CORE_MorseArray.h:232
#define OMP_PARALLEL_PRIVATE_SHARED(P, S)
Definition: openMP.h:86
This class describes a general array.
Definition: EMM_Array.h:18
#define tReal
Definition: types.h:118
static const tUIndex NO_MATTER
Definition: EMM_MatterField.h:40
This class describes a more array iterator.
Definition: CORE_MorseArrayIterator.h:15
void setSize(const tUIndex &n, const tUIndex &m, const tUInteger &p)
set the size of the morse array
Definition: CORE_MorseArray.h:342
#define tFlag
Definition: types.h:74