MCPcopy Create free account
hub / github.com/OpenFOAM/OpenFOAM-dev / createLibrary

Function createLibrary

src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.C:170–278  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
169
170void Foam::codedBase::createLibrary
171(
172 dynamicCode& dynCode,
173 const dynamicCodeContext& context
174) const
175{
176 bool create =
177 Pstream::master()
178 || (regIOobject::fileModificationSkew <= 0); // not NFS
179
180 if (create)
181 {
182 // Write files for new library
183 if (!dynCode.upToDate(context))
184 {
185 // filter with this context
186 dynCode.reset(context);
187
188 this->prepare(dynCode, context);
189
190 if (!dynCode.copyOrCreateFiles(true))
191 {
192 FatalIOErrorInFunction
193 (
194 context.dict()
195 ) << "Failed writing files for" << nl
196 << dynCode.libRelPath() << nl
197 << exit(FatalIOError);
198 }
199 }
200
201 if (!dynCode.wmakeLibso())
202 {
203 FatalIOErrorInFunction
204 (
205 context.dict()
206 ) << "Failed wmake " << dynCode.libRelPath() << nl
207 << exit(FatalIOError);
208 }
209 }
210
211
212 // all processes must wait for compile to finish
213 if (regIOobject::fileModificationSkew > 0)
214 {
215 //- Since the library has only been compiled on the master the
216 // other nodes need to pick this library up through NFS
217 // We do this by just polling a few times using the
218 // fileModificationSkew.
219
220 const fileName libPath = dynCode.libPath();
221
222 off_t mySize = Foam::fileSize(libPath);
223 off_t masterSize = mySize;
224 Pstream::scatter(masterSize);
225
226 if (debug)
227 {

Callers 1

updateLibraryFunction · 0.85

Calls 5

libPathMethod · 0.80
exitFunction · 0.50
fileSizeFunction · 0.50
reduceFunction · 0.50
resetMethod · 0.45

Tested by

no test coverage detected