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

Function updateLibrary

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

Source from the content-addressed store, hash-verified

281// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
282
283void Foam::codedBase::updateLibrary
284(
285 const word& name
286) const
287{
288 const dictionary& dict = this->codeDict();
289
290 dynamicCode::checkSecurity
291 (
292 "codedBase::updateLibrary()",
293 dict
294 );
295
296 dynamicCodeContext context(dict);
297
298 // codeName: name + _<sha1>
299 // codeDir : name
300 dynamicCode dynCode
301 (
302 name + context.sha1().str(true),
303 name
304 );
305 const fileName libPath = dynCode.libPath();
306
307
308 // the correct library was already loaded => we are done
309 if (libs().findLibrary(libPath))
310 {
311 return;
312 }
313
314 Info<< "Using dynamicCode for " << this->description().c_str()
315 << " at line " << dict.startLineNumber()
316 << " in " << dict.name() << endl;
317
318
319 // remove instantiation of fvPatchField provided by library
320 this->clearRedirect();
321
322 // may need to unload old library
323 unloadLibrary
324 (
325 oldLibPath_,
326 dynamicCode::libraryBaseName(oldLibPath_),
327 context.dict()
328 );
329
330 // try loading an existing library (avoid compilation when possible)
331 if (!loadLibrary(libPath, dynCode.codeName(), context.dict()))
332 {
333 createLibrary(dynCode, context);
334
335 loadLibrary(libPath, dynCode.codeName(), context.dict());
336 }
337
338 // retain for future reference
339 oldLibPath_ = libPath;
340}

Callers 9

executeFunction · 0.85
writeFunction · 0.85
endFunction · 0.85
readFunction · 0.85
CodedSource.CFile · 0.85

Calls 7

checkSecurityFunction · 0.85
unloadLibraryFunction · 0.85
loadLibraryFunction · 0.85
createLibraryFunction · 0.85
libPathMethod · 0.80
strMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected