modifications for version (1.0)

This commit is contained in:
Hamidreza Norouzi
2024-03-24 02:49:47 -07:00
parent 6b3a4f017b
commit 8beaec448a
10 changed files with 101 additions and 18 deletions

View File

@ -64,15 +64,17 @@ bool pFlow::property::makeNameIndex()
{
nameIndex_.clear();
uint32 i=0;
for(auto const& nm:materials_)
{
if(!nameIndex_.insertIf(nm, i++))
if(!nameIndex_.insertIf(nm, i))
{
fatalErrorInFunction<<
" repeated material name in the list of materials: " << materials_;
return false;
}
i++;
}
nameIndex_.rehash(0);
numMaterials_ = static_cast<uint32>(materials_.size());
@ -149,3 +151,33 @@ pFlow::property::property
}
pFlow::property::property
(
const word &fileName,
const fileSystem &dir
)
:
fileDictionary
(
objectFile
(
fileName,
dir,
objectFile::READ_ALWAYS,
objectFile::WRITE_NEVER
),
nullptr
)
{
if(!readDictionary())
{
fatalExit;
}
if(!makeNameIndex())
{
fatalErrorInFunction<<
"error in dictionary "<< globalName()<<endl;
fatalExit;
}
}

View File

@ -28,7 +28,6 @@ Licence:
namespace pFlow
{
/**
* property holds the pure properties of materials.
*
@ -52,6 +51,7 @@ private:
/// rapid mapping from name to index
wordHashMap<uint32> nameIndex_;
/// number of materials
uint32 numMaterials_ = 0;
@ -78,6 +78,11 @@ public:
property(
const word& fileName,
repository* owner=nullptr);
property(
const word& fileName,
const fileSystem& dir
);
property(const word& fileName,
const wordVector& materials,
@ -177,6 +182,8 @@ public:
return false;
}
}
};