rdmenezes / ifcplusplus

Automatically exported from code.google.com/p/ifcplusplus
Other
0 stars 0 forks source link

We Need non const method IfcPPModel::getMapIfcObjects(), or metod IfcStepReader::readStreamData(std::string&, shared_ptr<IfcPPModel>) #20

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
We need to load BIM model in two steps.

1) read IFC Header
2) read stream data.

Code example:

typedef std::map<int, shared_ptr<IfcPPEntity> > mapIfcPPEntity_t;
mapIfcPPEntity_t map_entity;
shared_ptr<IfcPPModel> ifc_model(new IfcPPModel);
IfcStepReader read; 
read.readStreamHeader(buffer, ifc_model); // 1)
read.readStreamData(buffer, map_entity); // 2)

After that, need to copy map_entity into ifc_model. 

mapIfcPPEntity_t::iterator it = map_entities.begin();

for(; it != map_entities.end(); ++it)
{       
    ifc_model->insertEntity(it->second);
}

Why do it? This code may be cause of a low performance loading.

I offer 2 ways to resolve this issue;

1) Add a "non const" method 
std::map<int,shared_ptr<IfcPPEntity> >& getMapIfcObjects() { return 
m_map_entities; }

Then we can use this code:

read.readStreamData(buffer, ifc_model->->getMapIfcObjects());

2) Add a new method

void IfcStepReader::readStreamData(std::string& in, shared_ptr<IfcPPModel> 
model); 

Best regards Andrey Geets

Original issue reported on code.google.com by geecandrey on 6 Aug 2014 at 12:30

GoogleCodeExporter commented 9 years ago
Thanks for the suggestion. I added a method like the one you suggested in 2)

The performance difference is not measurable though, because one insert 
operation per entity is almost nothing compared to all the geometry operations, 
especially the CSG computations. But still useful because simpler. And tiny 
performance losses sum up in the end :)

Original comment by fabian.g...@gmail.com on 6 Aug 2014 at 2:19