ENH: Foam::name() of memory address
- returns the memory address formatted in hexadecimal, which can be useful for detailed information
This commit is contained in:
parent
3870b1d43c
commit
3c07a1bb6f
@ -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<class T>
|
||||
void printAddress(const UList<T>& 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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -50,7 +50,7 @@ Ostream& printInfo(const FixedList<List<T>, 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;
|
||||
|
||||
|
@ -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<T>& table)
|
||||
Info<< iter.key() << " = ";
|
||||
if (ptr)
|
||||
{
|
||||
Info<< *ptr << " (" << uintptr_t(ptr) << ")";
|
||||
Info<< *ptr << " (" << name(ptr) << ")";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -36,7 +36,7 @@ template<class T>
|
||||
Ostream& print(const IjkField<T>& fld)
|
||||
{
|
||||
Info<< static_cast<const Field<T>&>(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<scalar> 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;
|
||||
|
@ -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<class T>
|
||||
void printAddress(const UList<T>& 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<class T>
|
||||
void printAddress(const SLList<T>& list)
|
||||
{
|
||||
Info<< "list addr: " << uintptr_t(&list)
|
||||
Info<< "list addr: " << name(&list)
|
||||
<< " data addr: ???" << nl;
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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 <iostream>
|
||||
@ -42,7 +41,7 @@ void printTable(const PtrMap<T>& table)
|
||||
Info<< iter.key() << " = ";
|
||||
if (ptr)
|
||||
{
|
||||
Info<< *ptr << " (" << uintptr_t(ptr) << ")";
|
||||
Info<< *ptr << " (" << name(ptr) << ")";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -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<class T>
|
||||
void printAddress(const UList<T>& 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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -75,8 +75,8 @@ void printTuple2(const Tuple2<word, word>& 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<word>& 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<word, word> 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<word> 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;
|
||||
|
@ -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<class ListType>
|
||||
void print(const ListType& list)
|
||||
{
|
||||
Info << flatOutput(list) << " data addr: " << uintptr_t(list.cdata()) << nl;
|
||||
Info << flatOutput(list) << " data addr: " << name(list.cdata()) << nl;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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<labelList>::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<labelList>::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<labelList>::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<labelList>::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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -57,12 +57,12 @@ void printInfo(const UList<T>& 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))
|
||||
|
@ -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<T>& tmpItem)
|
||||
{
|
||||
Info<< "tmp valid:" << tmpItem.valid()
|
||||
<< " isTmp:" << tmpItem.isTmp()
|
||||
<< " addr: " << uintptr_t(tmpItem.get());
|
||||
<< " addr: " << name(tmpItem.get());
|
||||
|
||||
if (tmpItem.valid())
|
||||
{
|
||||
|
@ -212,8 +212,8 @@ Foam::PackedList<Width> 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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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]);
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
||||
|
@ -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 <cctype>
|
||||
#include <sstream>
|
||||
|
||||
// * * * * * * * * * * * * * * 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
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
@ -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<class T>
|
||||
struct nameOp
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user