mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-29 03:40:34 +05:00
Export UNV
This commit is contained in:
parent
39e3ed0090
commit
4d9935e8c4
@ -224,6 +224,45 @@ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
|
||||
}
|
||||
UNV2412::Write(out_stream,aDataSet2412);
|
||||
}
|
||||
{
|
||||
using namespace UNV2417;
|
||||
cout << "### MyGroups size " << myGroups.size() << endl;
|
||||
if (myGroups.size() > 0) {
|
||||
TDataSet aDataSet2417;
|
||||
TGroupList::const_iterator aIter = myGroups.begin();
|
||||
for (; aIter != myGroups.end(); aIter++) {
|
||||
SMESHDS_GroupBase* aGroupDS = *aIter;
|
||||
TRecord aRec;
|
||||
aRec.GroupName = aGroupDS->GetStoreName();
|
||||
cout << "### GrName = "<<aRec.GroupName<<endl;
|
||||
cout << "### GrSize = "<<aGroupDS->Extent()<<endl;
|
||||
cout << "### GrType = "<<aGroupDS->GetType()<<endl;
|
||||
|
||||
int i;
|
||||
SMDS_ElemIteratorPtr aIter = aGroupDS->GetElements();
|
||||
if (aGroupDS->GetType() == SMDSAbs_Node) {
|
||||
aRec.NodeList.resize(aGroupDS->Extent());
|
||||
i = 0;
|
||||
while (aIter->more()) {
|
||||
const SMDS_MeshElement* aElem = aIter->next();
|
||||
aRec.NodeList[i] = aElem->GetID();
|
||||
i++;
|
||||
}
|
||||
} else {
|
||||
aRec.ElementList.resize(aGroupDS->Extent());
|
||||
i = 0;
|
||||
while (aIter->more()) {
|
||||
const SMDS_MeshElement* aElem = aIter->next();
|
||||
aRec.ElementList[i] = aElem->GetID();
|
||||
i++;
|
||||
}
|
||||
}
|
||||
aDataSet2417.insert(TDataSet::value_type(aGroupDS->GetID(), aRec));
|
||||
}
|
||||
UNV2417::Write(out_stream,aDataSet2417);
|
||||
myGroups.clear();
|
||||
}
|
||||
}
|
||||
/* {
|
||||
using namespace UNV2417;
|
||||
TDataSet aDataSet2417;
|
||||
|
@ -21,21 +21,21 @@
|
||||
#define _INCLUDE_DRIVERUNV_W_SMDS_MESH
|
||||
|
||||
#include "Driver_SMDS_Mesh.h"
|
||||
//#include "SMESH_Group.hxx"
|
||||
#include <map>
|
||||
#include "SMESHDS_GroupBase.hxx"
|
||||
#include <list>
|
||||
|
||||
|
||||
//typedef std::map<int, SMESH_Group*> TGroupsMap;
|
||||
typedef std::list<SMESHDS_GroupBase*> TGroupList;
|
||||
|
||||
class DriverUNV_W_SMDS_Mesh: public Driver_SMDS_Mesh
|
||||
{
|
||||
public:
|
||||
virtual Status Perform();
|
||||
|
||||
// void SetGroups(const TGroupsMap& theGroupsMap) { myGroupsMap = theGroupsMap; }
|
||||
void AddGroup(SMESHDS_GroupBase* theGroup) { myGroups.push_back(theGroup); }
|
||||
|
||||
private:
|
||||
// TGroupsMap myGroupsMap;
|
||||
TGroupList myGroups;
|
||||
};
|
||||
|
||||
|
||||
|
@ -18,7 +18,7 @@ static int MYDEBUG = 0;
|
||||
static string _group_labels[] = {"2417", "2429", "2430", "2432", "2435", "2452", "2467"};
|
||||
#define NBGROUP 7
|
||||
|
||||
static string _label_dataset = "2429";
|
||||
static string _label_dataset = "2467";
|
||||
|
||||
void UNV2417::Read(std::ifstream& in_stream, TDataSet& theDataSet)
|
||||
{
|
||||
@ -134,21 +134,25 @@ void UNV2417::Write(std::ofstream& out_stream, const TDataSet& theDataSet)
|
||||
int aRow = 0;
|
||||
int i;
|
||||
for (i = 0; i < aNbNodes; i++) {
|
||||
if (aRow == 4) {
|
||||
if (aRow == 2) {
|
||||
out_stream<<std::endl;
|
||||
aRow = 0;
|
||||
}
|
||||
out_stream<<std::setw(10)<<7;
|
||||
out_stream<<std::setw(10)<<aRec.NodeList[i];
|
||||
out_stream<<std::setw(10)<<0;
|
||||
out_stream<<std::setw(10)<<0;
|
||||
aRow++;
|
||||
}
|
||||
for (i = 0; i < aNbElements; i++) {
|
||||
if (aRow == 4) {
|
||||
if (aRow == 2) {
|
||||
out_stream<<std::endl;
|
||||
aRow = 0;
|
||||
}
|
||||
out_stream<<std::setw(10)<<8;
|
||||
out_stream<<std::setw(10)<<aRec.ElementList[i];
|
||||
out_stream<<std::setw(10)<<0;
|
||||
out_stream<<std::setw(10)<<0;
|
||||
aRow++;
|
||||
}
|
||||
out_stream<<std::endl;
|
||||
|
@ -949,6 +949,16 @@ void SMESH_Mesh::ExportUNV(const char *file) throw(SALOME_Exception)
|
||||
myWriter.SetMesh(_myMeshDS);
|
||||
myWriter.SetMeshId(_idDoc);
|
||||
// myWriter.SetGroups(_mapGroup);
|
||||
|
||||
for ( map<int, SMESH_Group*>::iterator it = _mapGroup.begin(); it != _mapGroup.end(); it++ ) {
|
||||
SMESH_Group* aGroup = it->second;
|
||||
SMESHDS_GroupBase* aGroupDS = aGroup->GetGroupDS();
|
||||
if ( aGroupDS ) {
|
||||
string aGroupName = aGroup->GetName();
|
||||
aGroupDS->SetStoreName( aGroupName.c_str() );
|
||||
myWriter.AddGroup( aGroupDS );
|
||||
}
|
||||
}
|
||||
myWriter.Perform();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user