diff --git a/applications/test/DLList/Test-DLList.C b/applications/test/DLList/Test-DLList.C index 75e9e54b37..fa89566986 100644 --- a/applications/test/DLList/Test-DLList.C +++ b/applications/test/DLList/Test-DLList.C @@ -2,10 +2,10 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- - | Copyright (C) 2011 OpenFOAM Foundation + | Copyright (C) 2011 OpenFoam Foundation ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -41,8 +41,8 @@ using namespace Foam; template void printAddress(const UList& list) { - Info<< "list addr: " << uintptr_t(&list) - << " data addr: " << uintptr_t(list.cdata()) << nl; + Info<< "list addr: " << name(&list) + << " data addr: " << name(list.cdata()) << nl; } diff --git a/applications/test/DynamicList/Test-DynamicList.C b/applications/test/DynamicList/Test-DynamicList.C index 83087e4b25..2022f89ddf 100644 --- a/applications/test/DynamicList/Test-DynamicList.C +++ b/applications/test/DynamicList/Test-DynamicList.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2016 OpenFOAM Foundation @@ -50,7 +50,7 @@ void printInfo Info<< " size=\"" << lst.size() << "\""; if (lst.cdata()) { - Info<< " ptr=\"" << uintptr_t(lst.cdata()) << "\""; + Info<< " ptr=\"" << name(lst.cdata()) << "\""; } else { @@ -76,7 +76,7 @@ void printInfo << "\" capacity=\"" << lst.capacity() << "\""; if (lst.cdata()) { - Info<< " ptr=\"" << uintptr_t(lst.cdata()) << "\""; + Info<< " ptr=\"" << name(lst.cdata()) << "\""; } else { diff --git a/applications/test/FixedList/Test-FixedList.C b/applications/test/FixedList/Test-FixedList.C index be7bff686c..21b796b642 100644 --- a/applications/test/FixedList/Test-FixedList.C +++ b/applications/test/FixedList/Test-FixedList.C @@ -50,7 +50,7 @@ Ostream& printInfo(const FixedList, N>& list) Info<< list << " addresses:"; for (unsigned i = 0; i < N; ++i) { - Info<< " " << uintptr_t(list[i].cdata()); + Info<< ' ' << name(list[i].cdata()); } Info<< nl; return Info; @@ -211,7 +211,7 @@ int main(int argc, char *argv[]) // Addresses don't change with swap Info<< "mem: " - << uintptr_t(list1.data()) << " " << uintptr_t(list2.data()) << nl; + << name(list1.data()) << " " << name(list2.data()) << nl; list1.swap(list2); Info<< "The swap() method" << nl; @@ -219,7 +219,7 @@ int main(int argc, char *argv[]) << "list2: " << list2 << nl; Info<< "mem: " - << uintptr_t(list1.data()) << " " << uintptr_t(list2.data()) << nl; + << name(list1.data()) << " " << name(list2.data()) << nl; Swap(list1, list2); Info<< "The Swap() function" << nl; @@ -227,7 +227,7 @@ int main(int argc, char *argv[]) << "list2: " << list2 << nl; Info<< "mem: " - << uintptr_t(list1.data()) << " " << uintptr_t(list2.data()) << nl; + << name(list1.data()) << " " << name(list2.data()) << nl; Info<< "====" << nl; diff --git a/applications/test/HashPtrTable/Test-HashPtrTable.C b/applications/test/HashPtrTable/Test-HashPtrTable.C index 19d6a261b7..34df611119 100644 --- a/applications/test/HashPtrTable/Test-HashPtrTable.C +++ b/applications/test/HashPtrTable/Test-HashPtrTable.C @@ -2,10 +2,8 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2011-2019 OpenCFD Ltd. \\/ M anipulation | -------------------------------------------------------------------------------- - | Copyright (C) 2011 OpenFOAM Foundation ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -45,7 +43,7 @@ void printTable(const HashPtrTable& table) Info<< iter.key() << " = "; if (ptr) { - Info<< *ptr << " (" << uintptr_t(ptr) << ")"; + Info<< *ptr << " (" << name(ptr) << ")"; } else { diff --git a/applications/test/HashTable2/Test-HashTable2.C b/applications/test/HashTable2/Test-HashTable2.C index 5507168766..0673d1c705 100644 --- a/applications/test/HashTable2/Test-HashTable2.C +++ b/applications/test/HashTable2/Test-HashTable2.C @@ -172,7 +172,7 @@ int main(int argc, char *argv[]) if (iter.good()) { Info<< "have " << k << nl - << " addr: " << uintptr_t(*iter) << nl + << " addr: " << name(*iter) << nl << " info: " << (*iter)->info() << nl << " info: " << iter->info() << nl << " incr: " << iter->increment() << nl @@ -214,7 +214,7 @@ int main(int argc, char *argv[]) if (iter1.good()) { Info<< "have " << k << nl - << " addr: " << uintptr_t(*iter1) << nl + << " addr: " << name(*iter1) << nl << " info: " << (*iter1)->info() << nl << " info: " << iter1->info() << nl << " incr: " << iter1->increment() << nl @@ -225,7 +225,7 @@ int main(int argc, char *argv[]) if (iter2.good()) { Info<< "have " << k << nl - << " addr: " << uintptr_t(*iter2) << nl + << " addr: " << name(*iter2) << nl << " info: " << (*iter2)->info() << nl << " info: " << iter2->info() << nl // Good: does not compile @@ -237,7 +237,7 @@ int main(int argc, char *argv[]) if (iter3.good()) { Info<< "have " << k << nl - << " addr: " << uintptr_t(*iter3) << nl + << " addr: " << name(*iter3) << nl << " info: " << (*iter3)->info() << nl << " info: " << iter3->info() << nl // Good: does not compile diff --git a/applications/test/IOobjectList/Test-IOobjectList.C b/applications/test/IOobjectList/Test-IOobjectList.C index 92871430b2..f13ee97d9c 100644 --- a/applications/test/IOobjectList/Test-IOobjectList.C +++ b/applications/test/IOobjectList/Test-IOobjectList.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -69,7 +69,7 @@ void reportDetail(const IOobjectList& objects) } Info<< key << " (" << io->headerClassName() - << ") = addr " << uintptr_t(io) << nl; + << ") = addr " << name(io) << nl; if (count != 1) { diff --git a/applications/test/IjkField/Test-IjkField.C b/applications/test/IjkField/Test-IjkField.C index 8abb6a8568..da9d4771ac 100644 --- a/applications/test/IjkField/Test-IjkField.C +++ b/applications/test/IjkField/Test-IjkField.C @@ -36,7 +36,7 @@ template Ostream& print(const IjkField& fld) { Info<< static_cast&>(fld).size() - << " addr:" << uintptr_t(fld.cdata()) << ' ' << fld.sizes() << ' ' + << " addr:" << name(fld.cdata()) << ' ' << fld.sizes() << ' ' << flatOutput(fld); return Info; @@ -149,15 +149,15 @@ int main(int argc, char *argv[]) Info<< nl - << "Before transfer: addr:" << uintptr_t(field1.data()) + << "Before transfer: addr:" << name(field1.data()) << " size:" << field1.size() << nl; Field sfield1(std::move(field1)); field1.clear(); Info<< "After transfer to regular field" << nl - << " source:" << uintptr_t(field1.data()) << nl - << " target:" << uintptr_t(sfield1.data()) << nl + << " source:" << name(field1.data()) << nl + << " target:" << name(sfield1.data()) << nl << "Values" << " source:"; print(field1) << nl; diff --git a/applications/test/List3/Test-List3.C b/applications/test/List3/Test-List3.C index 79dd0f18fe..10c3d3554c 100644 --- a/applications/test/List3/Test-List3.C +++ b/applications/test/List3/Test-List3.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -47,15 +47,15 @@ using namespace Foam; template void printAddress(const UList& list) { - Info<< "list addr: " << uintptr_t(&list) - << " data addr: " << uintptr_t(list.cdata()) << nl; + Info<< "list addr: " << name(&list) + << " data addr: " << name(list.cdata()) << nl; } template void printAddress(const SLList& list) { - Info<< "list addr: " << uintptr_t(&list) + Info<< "list addr: " << name(&list) << " data addr: ???" << nl; } diff --git a/applications/test/Matrix/Test-Matrix.C b/applications/test/Matrix/Test-Matrix.C index 7eb69af579..52935f1b7c 100644 --- a/applications/test/Matrix/Test-Matrix.C +++ b/applications/test/Matrix/Test-Matrix.C @@ -244,8 +244,8 @@ int main(int argc, char *argv[]) << "Number of elements = " << tab << S.size() << nl << "Number of rows/columns = " << tab << S.sizes() << nl << "Matrix is empty = " << tab << Switch(S.empty()) << nl - << "Constant pointer = " << tab << uintptr_t(S.cdata()) << nl - << "Pointer = " << tab << uintptr_t(S.data()) << nl + << "Constant pointer = " << tab << name(S.cdata()) << nl + << "Pointer = " << tab << name(S.data()) << nl << nl; horizontalLine(); diff --git a/applications/test/PtrList/Test-PtrList.C b/applications/test/PtrList/Test-PtrList.C index e3ad64a58a..9fb4546fae 100644 --- a/applications/test/PtrList/Test-PtrList.C +++ b/applications/test/PtrList/Test-PtrList.C @@ -107,7 +107,7 @@ Ostream& printAddr for (label i=0; i < len; ++i) { - os << "addr=" << uintptr_t(list(i)) << nl; + os << "addr=" << name(list(i)) << nl; } // End delimiter @@ -193,7 +193,7 @@ Ostream& print { const T* ptr = list(i); - os << "unused " << uintptr_t(ptr) << nl; + os << "unused " << name(ptr) << nl; } } diff --git a/applications/test/PtrMap/Test-PtrMap.C b/applications/test/PtrMap/Test-PtrMap.C index 958bb0d3d4..b7bc33b01c 100644 --- a/applications/test/PtrMap/Test-PtrMap.C +++ b/applications/test/PtrMap/Test-PtrMap.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2018 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,7 +23,6 @@ License Description - \*---------------------------------------------------------------------------*/ #include @@ -42,7 +41,7 @@ void printTable(const PtrMap& table) Info<< iter.key() << " = "; if (ptr) { - Info<< *ptr << " (" << uintptr_t(ptr) << ")"; + Info<< *ptr << " (" << name(ptr) << ")"; } else { diff --git a/applications/test/SLList/Test-SLList.C b/applications/test/SLList/Test-SLList.C index e9569307ba..db65b2ed62 100644 --- a/applications/test/SLList/Test-SLList.C +++ b/applications/test/SLList/Test-SLList.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2016 OpenFOAM Foundation @@ -41,8 +41,8 @@ using namespace Foam; template void printAddress(const UList& list) { - Info<< "list addr: " << uintptr_t(&list) - << " data addr: " << uintptr_t(list.cdata()) << nl; + Info<< "list addr: " << name(&list) + << " data addr: " << name(list.cdata()) << nl; } diff --git a/applications/test/Tuple2/Test-Tuple2.C b/applications/test/Tuple2/Test-Tuple2.C index 63564a404d..867628e8e9 100644 --- a/applications/test/Tuple2/Test-Tuple2.C +++ b/applications/test/Tuple2/Test-Tuple2.C @@ -75,8 +75,8 @@ void printTuple2(const Tuple2& t) { Info<< "tuple: " << t << nl; - Info<< "first @: " << uintptr_t(t.first().data()) << nl; - Info<< "second @: " << uintptr_t(t.second().data()) << nl; + Info<< "first @: " << name(t.first().data()) << nl; + Info<< "second @: " << name(t.second().data()) << nl; } @@ -85,8 +85,8 @@ void printTuple2(const Pair& t) { Info<< "tuple: " << t << nl; - Info<< "first @: " << uintptr_t(t.first().data()) << nl; - Info<< "second @: " << uintptr_t(t.second().data()) << nl; + Info<< "first @: " << name(t.first().data()) << nl; + Info<< "second @: " << name(t.second().data()) << nl; } @@ -191,30 +191,30 @@ int main() word word1("hello"); word word2("word"); - Info<< "create with " << word1 << " @ " << uintptr_t(word1.data()) - << " " << word2 << " @ " << uintptr_t(word2.data()) << nl; + Info<< "create with " << word1 << " @ " << name(word1.data()) + << " " << word2 << " @ " << name(word2.data()) << nl; Tuple2 tup(std::move(word2), std::move(word1)); printTuple2(tup); - Info<< "input is now " << word1 << " @ " << uintptr_t(word1.data()) - << " " << word2 << " @ " << uintptr_t(word2.data()) << nl; + Info<< "input is now " << word1 << " @ " << name(word1.data()) + << " " << word2 << " @ " << name(word2.data()) << nl; } { word word1("hello"); word word2("word"); - Info<< "create with " << word1 << " @ " << uintptr_t(word1.data()) - << " " << word2 << " @ " << uintptr_t(word2.data()) << nl; + Info<< "create with " << word1 << " @ " << name(word1.data()) + << " " << word2 << " @ " << name(word2.data()) << nl; Pair tup(std::move(word2), std::move(word1)); printTuple2(tup); - Info<< "input is now " << word1 << " @ " << uintptr_t(word1.data()) - << " " << word2 << " @ " << uintptr_t(word2.data()) << nl; + Info<< "input is now " << word1 << " @ " << name(word1.data()) + << " " << word2 << " @ " << name(word2.data()) << nl; } Info<< "\nEnd\n" << endl; diff --git a/applications/test/UList/Test-UList.C b/applications/test/UList/Test-UList.C index 364eca07cb..32ccfb6962 100644 --- a/applications/test/UList/Test-UList.C +++ b/applications/test/UList/Test-UList.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -46,7 +46,7 @@ using namespace Foam; template void print(const ListType& list) { - Info << flatOutput(list) << " data addr: " << uintptr_t(list.cdata()) << nl; + Info << flatOutput(list) << " data addr: " << name(list.cdata()) << nl; } diff --git a/applications/test/autoPtr/Test-autoPtr.C b/applications/test/autoPtr/Test-autoPtr.C index a134d49fa8..509f2b32a1 100644 --- a/applications/test/autoPtr/Test-autoPtr.C +++ b/applications/test/autoPtr/Test-autoPtr.C @@ -85,7 +85,7 @@ int main(int argc, char *argv[]) const labelList* plist = list; - Info<<"pointer: " << uintptr_t(plist) << nl + Info<<"pointer: " << name(plist) << nl <<"content: " << *plist << nl; Info<<"create: " << autoPtr::New(10, label(-1))() @@ -107,17 +107,17 @@ int main(int argc, char *argv[]) { auto source = identity(8); Info<<"move construct from " - << flatOutput(source) << " @ " << uintptr_t(source.cdata()) + << flatOutput(source) << " @ " << name(source.cdata()) << nl << nl; auto list = autoPtr::New(std::move(source)); Info<<"created: " - << flatOutput(*list) << " @ " << uintptr_t(list->cdata()) + << flatOutput(*list) << " @ " << name(list->cdata()) << nl << nl; Info<<"orig: " - << flatOutput(source) << " @ " << uintptr_t(source.cdata()) + << flatOutput(source) << " @ " << name(source.cdata()) << nl << nl; } @@ -154,7 +154,7 @@ int main(int argc, char *argv[]) auto list = autoPtr::New(identity(8)); Info<<"forward to function from " - << flatOutput(*list) << " @ " << uintptr_t(list->cdata()) + << flatOutput(*list) << " @ " << name(list->cdata()) << nl << nl; testTransfer2(std::move(list)); @@ -164,7 +164,7 @@ int main(int argc, char *argv[]) if (list) { Info<< nl - << flatOutput(*list) << " @ " << uintptr_t(list->cdata()) + << flatOutput(*list) << " @ " << name(list->cdata()) << nl; } else @@ -202,7 +202,7 @@ int main(int argc, char *argv[]) auto list = autoPtr::New(identity(8)); Info<<"forward to function from " - << flatOutput(*list) << " @ " << uintptr_t(list->cdata()) + << flatOutput(*list) << " @ " << name(list->cdata()) << nl << nl; testTransfer2(std::move(list)); @@ -212,7 +212,7 @@ int main(int argc, char *argv[]) if (list.valid()) { Info<< nl - << flatOutput(*list) << " @ " << uintptr_t(list->cdata()) + << flatOutput(*list) << " @ " << name(list->cdata()) << nl; } else diff --git a/applications/test/foamVersion/Test-foamVersion.C b/applications/test/foamVersion/Test-foamVersion.C index 7d7f9514a8..4d6c24df10 100644 --- a/applications/test/foamVersion/Test-foamVersion.C +++ b/applications/test/foamVersion/Test-foamVersion.C @@ -78,8 +78,8 @@ int main() Info << "\nVerify memory addesses are identical:" << nl - << "macro " << uintptr_t(Foam::FOAMversion) << nl - << "namespace " << uintptr_t(&(foamVersion::version[0])) << nl; + << "macro " << name(Foam::FOAMversion) << nl + << "namespace " << name(&(foamVersion::version[0])) << nl; // Test extraction diff --git a/applications/test/hashedWordList/Test-hashedWordList.C b/applications/test/hashedWordList/Test-hashedWordList.C index 0734d661ea..3a2e4a78dc 100644 --- a/applications/test/hashedWordList/Test-hashedWordList.C +++ b/applications/test/hashedWordList/Test-hashedWordList.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2018 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -37,7 +37,7 @@ Ostream& printInfo(const hashedWordList& list, bool withAddr=false) Info<< flatOutput(list) << nl << list.lookup() << nl; if (withAddr) { - Info<< "addr=" << uintptr_t(list.cdata()) << nl; + Info<< "addr=" << name(list.cdata()) << nl; } return Info; diff --git a/applications/test/nullObject/Test-nullObject.C b/applications/test/nullObject/Test-nullObject.C index 5f2e65ab95..89f4f0d972 100644 --- a/applications/test/nullObject/Test-nullObject.C +++ b/applications/test/nullObject/Test-nullObject.C @@ -57,12 +57,12 @@ void printInfo(const UList& list) { std::cout << nl - << "List : addr: " << uintptr_t(&list) + << "List : addr: " << name(&list) << " (null: " << isNull(list) << ")" << nl << " size: " << list.size() << " empty: " << list.empty() << nl - << " data: " << uintptr_t(list.cdata()) - << " begin=" << uintptr_t(list.begin()) - << " end=" << uintptr_t(list.end()) << nl; + << " data: " << name(list.cdata()) + << " begin=" << name(list.begin()) + << " end=" << name(list.end()) << nl; Info<< list << nl; } @@ -78,7 +78,7 @@ int main() SimpleClass& refToClass(*ptrToClass); std::cout - << "nullObject addr=" << uintptr_t(&(nullObjectPtr)) << nl + << "nullObject addr=" << name(&(nullObjectPtr)) << nl << " sizeof(nullObject) = " << sizeof(NullObject::nullObject) << nl << " sizeof(void*) = " << sizeof(void*) << nl << " sizeof(labelList) = " << sizeof(labelList) << nl @@ -86,7 +86,7 @@ int main() std::cout << "nullObject" << nl - << " pointer:" << uintptr_t(nullObjectPtr->pointer()) << nl + << " pointer:" << name(nullObjectPtr->pointer()) << nl << " value:" << nullObjectPtr->value() << nl << nl; if (notNull(ptrToClass)) diff --git a/applications/test/tmp/Test-tmp.C b/applications/test/tmp/Test-tmp.C index c37ac68dd4..8abc82d772 100644 --- a/applications/test/tmp/Test-tmp.C +++ b/applications/test/tmp/Test-tmp.C @@ -2,10 +2,8 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2011-2019 OpenCFD Ltd. \\/ M anipulation | -------------------------------------------------------------------------------- - | Copyright (C) 2011 OpenFOAM Foundation ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -46,7 +44,7 @@ void printInfo(const tmp& tmpItem) { Info<< "tmp valid:" << tmpItem.valid() << " isTmp:" << tmpItem.isTmp() - << " addr: " << uintptr_t(tmpItem.get()); + << " addr: " << name(tmpItem.get()); if (tmpItem.valid()) { diff --git a/src/OpenFOAM/containers/Lists/ListOps/ListOpsTemplates.C b/src/OpenFOAM/containers/Lists/ListOps/ListOpsTemplates.C index d905505f5b..105e19b21b 100644 --- a/src/OpenFOAM/containers/Lists/ListOps/ListOpsTemplates.C +++ b/src/OpenFOAM/containers/Lists/ListOps/ListOpsTemplates.C @@ -212,8 +212,8 @@ Foam::PackedList Foam::reorder } // Verify addresses (for movable refs) - // Info<< "reordered in " << uintptr_t(input.storage().cdata()) << nl - // << "reordered out " << uintptr_t(output.storage().cdata()) << nl; + // Info<< "reordered in " << name(input.storage().cdata()) << nl + // << "reordered out " << name(output.storage().cdata()) << nl; return output; } @@ -230,7 +230,7 @@ void Foam::inplaceReorder input = reorder(oldToNew, input, prune); // Verify address (for movable refs) - // Info<< "now have " << uintptr_t(input.storage().cdata()) << nl; + // Info<< "now have " << name(input.storage().cdata()) << nl; } diff --git a/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C b/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C index c0d90c5d7a..81c122215c 100644 --- a/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C +++ b/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2018 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2017 OpenFOAM Foundation @@ -61,16 +61,14 @@ Foam::dlLibraryTable::~dlLibraryTable() { if (libPtrs_[i]) { - if (debug) - { - InfoInFunction - << "Closing " << libNames_[i] - << " with handle " << uintptr_t(libPtrs_[i]) << endl; - } + DebugInFunction + << "Closing " << libNames_[i] + << " with handle " << name(libPtrs_[i]) << nl; + if (!dlClose(libPtrs_[i])) { WarningInFunction<< "Failed closing " << libNames_[i] - << " with handle " << uintptr_t(libPtrs_[i]) << endl; + << " with handle " << name(libPtrs_[i]) << endl; } } } @@ -92,12 +90,9 @@ bool Foam::dlLibraryTable::open void* ptr = dlOpen(fileName(libName).expand(), verbose); - if (debug) - { - InfoInFunction - << "Opened " << libName - << " resulting in handle " << uintptr_t(ptr) << endl; - } + DebugInFunction + << "Opened " << libName + << " resulting in handle " << name(ptr) << endl; if (ptr) { @@ -138,12 +133,9 @@ bool Foam::dlLibraryTable::close return false; } - if (debug) - { - InfoInFunction - << "Closing " << libName - << " with handle " << uintptr_t(libPtrs_[index]) << endl; - } + DebugInFunction + << "Closing " << libName + << " with handle " << name(libPtrs_[index]) << nl; const bool ok = dlClose(libPtrs_[index]); diff --git a/src/OpenFOAM/primitives/Scalar/Scalar.C b/src/OpenFOAM/primitives/Scalar/Scalar.C index 02da350ba3..b21fe9880c 100644 --- a/src/OpenFOAM/primitives/Scalar/Scalar.C +++ b/src/OpenFOAM/primitives/Scalar/Scalar.C @@ -62,7 +62,8 @@ word name(const Scalar val) { std::ostringstream buf; buf << val; - return buf.str(); + + return word(buf.str(), false); // Needs no stripping } diff --git a/src/OpenFOAM/primitives/strings/word/word.C b/src/OpenFOAM/primitives/strings/word/word.C index c0e0945e64..481d61d499 100644 --- a/src/OpenFOAM/primitives/strings/word/word.C +++ b/src/OpenFOAM/primitives/strings/word/word.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011 OpenFOAM Foundation @@ -28,6 +28,7 @@ License #include "word.H" #include "debug.H" #include +#include // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -170,4 +171,15 @@ Foam::word Foam::operator&(const word& a, const word& b) } +// * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * * // + +Foam::word Foam::name(const void* ptr) +{ + std::ostringstream buf; + buf << "0x" << std::hex << uintptr_t(ptr); + + return word(buf.str(), false); // Needs no stripping +} + + // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/strings/word/word.H b/src/OpenFOAM/primitives/strings/word/word.H index 141b83a6df..1ca685dfbd 100644 --- a/src/OpenFOAM/primitives/strings/word/word.H +++ b/src/OpenFOAM/primitives/strings/word/word.H @@ -228,6 +228,11 @@ word operator&(const word& a, const word& b); // * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * * // +//- A word representation of a memory address as hexadecimal. +// No special handling of nullptr (renders as 0x0) +word name(const void* ptr); + + //- Extract name (as a word) from an object, typically using its name() method. template struct nameOp diff --git a/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C b/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C index 95ae8ed877..1fe61c8dcd 100644 --- a/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C +++ b/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2015-2018 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2015-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2017 OpenFOAM Foundation @@ -658,10 +658,10 @@ Foam::label Foam::ptscotchDecomp::decompose { Pout<< "SCOTCH_dgraphBuild with:" << nl << "xadjSize-1 : " << xadjSize-1 << nl - << "xadj : " << uintptr_t(xadj) << nl - << "velotab : " << uintptr_t(velotab.begin()) << nl + << "xadj : " << name(xadj) << nl + << "velotab : " << name(velotab.begin()) << nl << "adjncySize : " << adjncySize << nl - << "adjncy : " << uintptr_t(adjncy) << nl + << "adjncy : " << name(adjncy) << nl << endl; }