5991 {
5993
5994 m_log <<
" generate Random Numbers ..." << endl;
5995
5996
6008 std::normal_distribution<>
dist{1.0, 1.0};
6010
6011 std::normal_distribution<> dist2{0.0, 0.5};
6015
6016 std::normal_distribution<> dist3{0.0, 1.0};
6023
6024
6025 m_p1[n] = zeta2 * d3 - zeta3 * d2;
6026 m_p2[n] = zeta3 * d1 - zeta1 * d3;
6027 m_p3[n] = zeta1 * d2 - zeta2 * d1;
6028 m_q1[n] = xi2 * d3 - xi3 * d2;
6029 m_q2[n] = xi3 * d1 - xi1 * d3;
6030 m_q3[n] = xi1 * d2 - xi2 * d1;
6031
6032
6033
6034
6035
6037 vc = 1;
6038 } else {
6039 vc = sqrt(1.5
6042 / (d1 * d1 + d2 * d2 + d3 * d3)));
6043 }
6044
6048
6049
6050
6051 }
6052
6053
6059 }
6062 }
6065 }
6068 }
6071 }
6074 }
6077 }
6080 }
6083 }
6086 }
6087 }
6088
6090
6093 m_omega[n] = sendRecvBuffer[n];
6094 }
6097 }
6100 }
6103 }
6106 }
6109 }
6112 }
6115 }
6118 }
6121 }
6122 }
6123 }
6124
6126 ofstream writeRnd;
6129 stringstream test;
6130 test << file;
6131 struct stat st {};
6132 if(stat((test.str()).c_str(), &st) != 0) {
6133#if defined(MAIA_MS_COMPILER)
6134#pragma message("WARNING: Not compatible")
6135 mTerm(0,
"ERROR: Not implemented!");
6136#else
6137 mkdir((test.str()).c_str(), 0744);
6138#endif
6139 m_log << endl <<
"creating folder " << test.str() <<
" for random numbers" << endl;
6140 }
6142 file.clear();
6143 file.append(test.str());
6144 }
6145 writeRnd.open(file.c_str(), ios_base::out | ios_base::trunc | ios_base::binary);
6146
6148
6151#ifdef SWAP_ENDIAN
6153#endif
6154 writeRnd.write(
reinterpret_cast<char*
>(&fnumber),
sizeof(
MFloat));
6156#ifdef SWAP_ENDIAN
6158#endif
6159 writeRnd.write(
reinterpret_cast<char*
>(&fnumber),
sizeof(
MFloat));
6161#ifdef SWAP_ENDIAN
6163#endif
6164 writeRnd.write(
reinterpret_cast<char*
>(&fnumber),
sizeof(
MFloat));
6166#ifdef SWAP_ENDIAN
6168#endif
6169 writeRnd.write(
reinterpret_cast<char*
>(&fnumber),
sizeof(
MFloat));
6171#ifdef SWAP_ENDIAN
6173#endif
6174 writeRnd.write(
reinterpret_cast<char*
>(&fnumber),
sizeof(
MFloat));
6176#ifdef SWAP_ENDIAN
6178#endif
6179 writeRnd.write(
reinterpret_cast<char*
>(&fnumber),
sizeof(
MFloat));
6181#ifdef SWAP_ENDIAN
6183#endif
6184 writeRnd.write(
reinterpret_cast<char*
>(&fnumber),
sizeof(
MFloat));
6186#ifdef SWAP_ENDIAN
6188#endif
6189 writeRnd.write(
reinterpret_cast<char*
>(&fnumber),
sizeof(
MFloat));
6191#ifdef SWAP_ENDIAN
6193#endif
6194 writeRnd.write(
reinterpret_cast<char*
>(&fnumber),
sizeof(
MFloat));
6196#ifdef SWAP_ENDIAN
6198#endif
6199 writeRnd.write(
reinterpret_cast<char*
>(&fnumber),
sizeof(
MFloat));
6200 }
6201 writeRnd.close();
6202 }
6203}
MBool loadRandomNumbers()
This class is a ScratchSpace.
void mTerm(const MInt errorCode, const MString &location, const MString &message)
double doubleSwap(double f)
std::basic_string< char > MString
int MPI_Bcast(void *buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm, const MString &name, const MString &varname)
same as MPI_Bcast
MFloat dist(const Point< DIM > &p, const Point< DIM > &q)