From a082e7bf257c108eba572a6259a731f66c1ae015 Mon Sep 17 00:00:00 2001 From: apo Date: Thu, 5 Jul 2007 12:10:39 +0000 Subject: [PATCH] Add Result::GetNumberOfComponents(in EntityName theMeshName, in Entity theEntity, in EntityName theFieldName) method --- idl/VISU_Gen.idl | 5 ++- src/VISU_I/VISU_Result_i.cc | 64 +++++++++++++++++++++++++++++++++++++ src/VISU_I/VISU_Result_i.hh | 6 ++++ 3 files changed, 74 insertions(+), 1 deletion(-) diff --git a/idl/VISU_Gen.idl b/idl/VISU_Gen.idl index 84d7a966..0ac9c224 100644 --- a/idl/VISU_Gen.idl +++ b/idl/VISU_Gen.idl @@ -1625,7 +1625,10 @@ module VISU { /*! Gets existing fields for the given mesh name and entity */ EntityNames GetFields(in EntityName theMeshName, in Entity theEntity); - /*! Gets existing fields for the given mesh name, entity and name of field */ + /*! Gets number of components for the given mesh name, entity and name of field */ + long GetNumberOfComponents(in EntityName theMeshName, in Entity theEntity, in EntityName theFieldName); + + /*! Gets existing numbers of time stamps for the given mesh name, entity and name of field */ TimeStampNumbers GetTimeStampNumbers(in EntityName theMeshName, in Entity theEntity, in EntityName theFieldName); /*! Gets existing parts of multi resolution structure for the given mesh name */ diff --git a/src/VISU_I/VISU_Result_i.cc b/src/VISU_I/VISU_Result_i.cc index e1ea7dfe..61236dda 100644 --- a/src/VISU_I/VISU_Result_i.cc +++ b/src/VISU_I/VISU_Result_i.cc @@ -980,6 +980,8 @@ VISU::Result_i return anEntities._retn(); } + +//--------------------------------------------------------------- VISU::Result::EntityNames* VISU::Result_i ::GetFamilies(const char* theMeshName, @@ -1023,6 +1025,8 @@ VISU::Result_i return aResult._retn(); } + +//--------------------------------------------------------------- VISU::Result::EntityNames* VISU::Result_i ::GetGroups(const char* theMeshName) @@ -1053,6 +1057,8 @@ VISU::Result_i return aResult._retn(); } + +//--------------------------------------------------------------- VISU::Result::EntityNames* VISU::Result_i ::GetFields(const char* theMeshName, @@ -1096,6 +1102,8 @@ VISU::Result_i return aResult._retn(); } + +//--------------------------------------------------------------- VISU::Result::TimeStampNumbers* VISU::Result_i ::GetTimeStampNumbers(const char* theMeshName, @@ -1153,6 +1161,56 @@ VISU::Result_i return aResult._retn(); } + +//--------------------------------------------------------------- +CORBA::Long +VISU::Result_i +::GetNumberOfComponents(const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName) +{ + CORBA::Long aResult = 0; + const VISU::TMeshMap& aMeshMap = GetInput()->GetMeshMap(); + if(aMeshMap.empty()) + return aResult; + + VISU::TMeshMap::const_iterator anIter = aMeshMap.find(theMeshName); + if(anIter == aMeshMap.end()) + return aResult; + + const VISU::PMesh& aMesh = anIter->second; + const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap; + if(aMeshOnEntityMap.empty()) + return aResult; + + { + VISU::TEntity anEntity = VISU::TEntity(theEntity); + VISU::TMeshOnEntityMap::const_iterator anIter = aMeshOnEntityMap.find(anEntity); + if(anIter == aMeshOnEntityMap.end()) + return aResult; + + const VISU::PMeshOnEntity& aMeshOnEntity = anIter->second; + const VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap; + if(aFieldMap.empty()) + return aResult; + + { + VISU::TFieldMap::const_iterator anIter = aFieldMap.find(theFieldName); + if(anIter == aFieldMap.end()) + return aResult; + + { + const VISU::PField& aField = anIter->second; + aResult = aField->myNbComp; + } + } + } + + return aResult; +} + + +//--------------------------------------------------------------- VISU::Result::EntityNames* VISU::Result_i ::GetPartNames(const char* theMeshName) @@ -1161,6 +1219,8 @@ VISU::Result_i return aResult._retn(); } + +//--------------------------------------------------------------- VISU::Result::Resolutions* VISU::Result_i ::GetResolutions(const char* theMeshName, @@ -1170,6 +1230,8 @@ VISU::Result_i return aResult._retn(); } + +//--------------------------------------------------------------- VISU::Result::Resolution VISU::Result_i ::GetResolution(const char* theMeshName, @@ -1178,6 +1240,8 @@ VISU::Result_i return VISU::Result::HIDDEN; } + +//--------------------------------------------------------------- void VISU::Result_i ::SetResolution(const char* theMeshName, diff --git a/src/VISU_I/VISU_Result_i.hh b/src/VISU_I/VISU_Result_i.hh index bfb6f9b7..7f2e8962 100644 --- a/src/VISU_I/VISU_Result_i.hh +++ b/src/VISU_I/VISU_Result_i.hh @@ -158,6 +158,12 @@ namespace VISU Entity theEntity, const char* theFieldName); + virtual + CORBA::Long + GetNumberOfComponents(const char* theMeshName, + Entity theEntity, + const char* theFieldName); + virtual VISU::Result::EntityNames* GetPartNames(const char* theMeshName); -- 2.39.2