|
cgma
|
#include <ModelQueryEngine.hpp>
Definition at line 75 of file ModelQueryEngine.hpp.
Definition at line 92 of file ModelQueryEngine.cpp.
{
// Set static instance_ to zero to indicated that we are dead.
instance_ = NULL;
}
| ModelQueryEngine::ModelQueryEngine | ( | ) | [private] |
Definition at line 112 of file ModelQueryEngine.cpp.
: queryCallStackDepth(0) { }
| void ModelQueryEngine::dec_query_call_stack | ( | ) | [protected] |
Definition at line 337 of file ModelQueryEngine.cpp.
{
assert(queryCallStackDepth > 0);
queryCallStackDepth--;
if (queryCallStackDepth == 0)
while (encounteredSet.size())
encounteredSet.pop()->encountered_ = CUBIT_FALSE;
}
| static void ModelQueryEngine::delete_instance | ( | ) | [inline, static] |
Definition at line 89 of file ModelQueryEngine.hpp.
| bool ModelQueryEngine::encountered | ( | TopologyEntity * | node_ptr | ) |
Definition at line 322 of file ModelQueryEngine.cpp.
{
if (node_ptr->encountered_)
return true;
encounteredSet.append(node_ptr);
node_ptr->encountered_ = true;
return false;
}
| void ModelQueryEngine::inc_query_call_stack | ( | ) | [protected] |
Definition at line 332 of file ModelQueryEngine.cpp.
{
queryCallStackDepth++;
}
| ModelQueryEngine * ModelQueryEngine::instance | ( | void | ) | [static] |
Definition at line 74 of file ModelQueryEngine.cpp.
{
if (instance_ == NULL)
{
instance_ = new ModelQueryEngine;
}
return instance_;
}
| CubitStatus ModelQueryEngine::query_append_children | ( | TopologyEntity & | source_object, |
| DagType | child_type, | ||
| DLIList< TopologyEntity * > & | result_set | ||
| ) | [protected] |
Definition at line 231 of file ModelQueryEngine.cpp.
{
BeginQuery lock;
DagType current_type = source_object.dag_type();
assert(current_type.is_valid() && target_type.is_valid());
assert(current_type > target_type);
intermediateNodeSets[0].clean_out();
intermediateNodeSets[0].append(&source_object);
int current_index = 0;
while (current_type > target_type)
{
DLIList<TopologyEntity*>& current_set = intermediateNodeSets[ current_index];
DLIList<TopologyEntity*>& next_set = intermediateNodeSets[!current_index];
next_set.clean_out();
current_set.reset();
for (int i = current_set.size(); i--; )
{
TopologyEntity* current_ptr = current_set.get_and_step();
current_ptr->query_append_children(next_set);
}
current_index = !current_index;
current_type--;
}
result_set += intermediateNodeSets[current_index];
return CUBIT_SUCCESS;
}
| CubitStatus ModelQueryEngine::query_append_parents | ( | TopologyEntity & | source_object, |
| DagType | parent_type, | ||
| DLIList< TopologyEntity * > & | result_set | ||
| ) | [protected] |
Definition at line 277 of file ModelQueryEngine.cpp.
{
BeginQuery lock;
DagType current_type = source_object.dag_type();
assert(current_type.is_valid() && target_type.is_valid());
assert(current_type < target_type);
intermediateNodeSets[0].clean_out();
intermediateNodeSets[0].append(&source_object);
int current_index = 0;
while (current_type < target_type)
{
DLIList<TopologyEntity*>& current_set = intermediateNodeSets[ current_index];
DLIList<TopologyEntity*>& next_set = intermediateNodeSets[!current_index];
next_set.clean_out();
current_set.reset();
for (int i = current_set.size(); i--; )
{
TopologyEntity* current_ptr = current_set.get_and_step();
current_ptr->query_append_parents(next_set);
}
current_index = !current_index;
current_type++;
}
result_set += intermediateNodeSets[current_index];
return CUBIT_SUCCESS;
}
| CubitStatus ModelQueryEngine::query_model | ( | TopologyEntity & | source_object, |
| DagType | target_type, | ||
| DLIList< TopologyEntity * > & | result_set | ||
| ) |
Definition at line 163 of file ModelQueryEngine.cpp.
{
result_set.clean_out();
return query_model_and_append( source_object, target_type, result_set );
}
| CubitStatus ModelQueryEngine::query_model | ( | DLIList< TopologyEntity * > & | source_set, |
| DagType | target_type, | ||
| DLIList< TopologyEntity * > & | result_set | ||
| ) |
Definition at line 182 of file ModelQueryEngine.cpp.
{
result_set.clean_out();
return query_model_and_append( source_set, target_type, result_set );
}
| CubitStatus ModelQueryEngine::query_model_and_append | ( | TopologyEntity & | source_object, |
| DagType | target_type, | ||
| DLIList< TopologyEntity * > & | result_set | ||
| ) |
Definition at line 126 of file ModelQueryEngine.cpp.
{
BeginQuery lock;
DagType source_type = source_object.dag_type();
if (!source_type.is_valid() || !target_type.is_valid())
return CUBIT_FAILURE;
else if (source_type < target_type)
return query_append_parents( source_object, target_type, result_set );
else if (source_type > target_type)
return query_append_children( source_object, target_type, result_set );
else // same type
{
assert(source_type == target_type);
if (!encountered(&source_object))
result_set.append(&source_object);
return CUBIT_SUCCESS;
}
}
| CubitStatus ModelQueryEngine::query_model_and_append | ( | DLIList< TopologyEntity * > & | source_set, |
| DagType | target_type, | ||
| DLIList< TopologyEntity * > & | result_set | ||
| ) |
Definition at line 201 of file ModelQueryEngine.cpp.
{
BeginQuery lock;
CubitStatus result = CUBIT_SUCCESS;
source_set.reset();
for (int i = source_set.size(); i--; )
{
TopologyEntity& source = *source_set.get_and_step();
if (!query_model_and_append( source, target_type, result_set ))
result = CUBIT_FAILURE;
}
return result;
}
friend class ModelQueryEngine::BeginQuery [friend] |
Definition at line 179 of file ModelQueryEngine.hpp.
DLIList<TopologyEntity*> ModelQueryEngine::encounteredSet [protected] |
Definition at line 186 of file ModelQueryEngine.hpp.
ModelQueryEngine * ModelQueryEngine::instance_ = NULL [static, private] |
Definition at line 197 of file ModelQueryEngine.hpp.
DLIList<TopologyEntity*> ModelQueryEngine::intermediateNodeSets[2] [protected] |
Definition at line 189 of file ModelQueryEngine.hpp.
int ModelQueryEngine::queryCallStackDepth [protected] |
Definition at line 184 of file ModelQueryEngine.hpp.