Fem: clean debug comments in FemVTKTools.cpp and AppFemPy.cpp
This commit is contained in:
parent
2d29983be7
commit
1f34562354
|
@ -249,25 +249,16 @@ private:
|
|||
#ifdef FC_USE_VTK
|
||||
Py::Object readCfdResult(const Py::Tuple& args)
|
||||
{
|
||||
//the second parameter is either objName (utf8, obj.Label is unicode type) or python obj (not yet implemented)
|
||||
//PyObject *pcObj; // PythonFeatureT<FemResultObject> is of python type `` or c++ type
|
||||
char* fileName;
|
||||
char* objName;
|
||||
//if (!PyArg_ParseTuple(args.ptr(), "etO!","utf-8", &Name, &(App::DocumentObjectPy::Type), &pcObj))
|
||||
if (!PyArg_ParseTuple(args.ptr(), "etet","utf-8", &fileName, "utf-8", &objName))
|
||||
char* fileName = NULL;
|
||||
char* objName = NULL;
|
||||
|
||||
if (!PyArg_ParseTuple(args.ptr(), "et|et","utf-8", &fileName, "utf-8", &objName))
|
||||
throw Py::Exception();
|
||||
std::string EncodedName = std::string(fileName);
|
||||
PyMem_Free(fileName);
|
||||
std::string resName = std::string(objName);
|
||||
PyMem_Free(objName);
|
||||
/*
|
||||
if (pcObj)
|
||||
{
|
||||
// this function needs the second parameter: App::DocumentObjectPy, since it is created in python
|
||||
App::DocumentObjectPy* objpy= static_cast<App::DocumentObjectPy*>(pcObj);
|
||||
App::DocumentObject* obj = objpy->getDocumentObjectPtr();
|
||||
FemVTKTools::readFluidicResult(EncodedName.c_str(), obj);
|
||||
*/
|
||||
|
||||
if (resName.length())
|
||||
{
|
||||
App::Document* pcDoc = App::GetApplication().getActiveDocument();
|
||||
|
@ -282,21 +273,16 @@ private:
|
|||
|
||||
Py::Object writeResult(const Py::Tuple& args)
|
||||
{
|
||||
char* fileName;
|
||||
PyObject *pcObj; // PythonFeatureT<FemResultObject> is of type
|
||||
//char* objName;
|
||||
if (!PyArg_ParseTuple(args.ptr(), "etO!","utf-8", &fileName, &(App::DocumentObjectPy::Type), &pcObj))
|
||||
//if (!PyArg_ParseTuple(args.ptr(), "etet","utf-8", &Name, "utf-8", &objName))
|
||||
char* fileName = NULL;
|
||||
PyObject *pcObj = NULL;
|
||||
|
||||
if (!PyArg_ParseTuple(args.ptr(), "et|O!","utf-8", &fileName, &(App::DocumentObjectPy::Type), &pcObj))
|
||||
throw Py::Exception();
|
||||
std::string EncodedName = std::string(fileName);
|
||||
PyMem_Free(fileName);
|
||||
//std::string resName = std::string(objName);
|
||||
//PyMem_Free(objName);
|
||||
|
||||
//if (resName.length())
|
||||
if (!pcObj)
|
||||
{
|
||||
// this function needs the second parameter: App::DocumentObjectPy, since it is created in python
|
||||
App::DocumentObjectPy* objpy= static_cast<App::DocumentObjectPy*>(pcObj);
|
||||
App::DocumentObject* obj = objpy->getDocumentObjectPtr();
|
||||
if (!obj)
|
||||
|
|
|
@ -107,7 +107,6 @@ template<class TWriter> void writeVTKFile(const char* filename, vtkSmartPointer<
|
|||
writer->SetFileName(filename);
|
||||
writer->SetInputData(dataset);
|
||||
writer->Write();
|
||||
//writer->Update();
|
||||
}
|
||||
|
||||
void FemVTKTools::importVTKMesh(vtkSmartPointer<vtkDataSet> dataset, FemMesh* mesh)
|
||||
|
@ -444,7 +443,6 @@ App::DocumentObject* getObjectByType(const Base::Type type)
|
|||
|
||||
if(obj->getTypeId() == type)
|
||||
{
|
||||
Base::Console().Message("active documentObject type: %s \n", obj->getTypeId());
|
||||
return obj;
|
||||
}
|
||||
if(obj->getTypeId() == FemAnalysis::getClassTypeId())
|
||||
|
@ -491,7 +489,6 @@ App::DocumentObject* FemVTKTools::readFluidicResult(const char* filename, App::D
|
|||
Base::FileInfo f(filename);
|
||||
|
||||
vtkSmartPointer<vtkDataSet> ds;
|
||||
//vtkDataSet* ds; //
|
||||
if(f.hasExtension("vtu"))
|
||||
{
|
||||
ds = readVTKFile<vtkXMLUnstructuredGridReader>(filename);
|
||||
|
@ -531,10 +528,10 @@ App::DocumentObject* FemVTKTools::readFluidicResult(const char* filename, App::D
|
|||
|
||||
App::DocumentObject* mesh = pcDoc->addObject("Fem::FemMeshObject", "ResultMesh");
|
||||
FemMesh* fmesh = new FemMesh(); // PropertyFemMesh instance is responsible to relase FemMesh ??
|
||||
importVTKMesh(dataset, fmesh); // in doc, mesh is empty, why?
|
||||
importVTKMesh(dataset, fmesh);
|
||||
static_cast<PropertyFemMesh*>(mesh->getPropertyByName("FemMesh"))->setValue(*fmesh);
|
||||
static_cast<App::PropertyLink*>(result->getPropertyByName("Mesh"))->setValue(mesh);
|
||||
//PropertyLink is the property type to store DocumentObject pointer
|
||||
// PropertyLink is the property type to store DocumentObject pointer
|
||||
|
||||
importFluidicResult(dataset, result);
|
||||
pcDoc->recompute();
|
||||
|
@ -544,25 +541,6 @@ App::DocumentObject* FemVTKTools::readFluidicResult(const char* filename, App::D
|
|||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
App::DocumentObject* readFluidicResult(const char* filename, const std::string objName) {
|
||||
App::Document* pcDoc = App::GetApplication().getActiveDocument();
|
||||
if(!pcDoc)
|
||||
{
|
||||
Base::Console().Message("No active document is found thus created\n");
|
||||
pcDoc = App::GetApplication().newDocument();
|
||||
}
|
||||
|
||||
App::DocumentObject* res = pcDoc->getObject(objName.c_str());
|
||||
if (!res) {
|
||||
return FemVTKTools::readFluidicResult(filename, res);
|
||||
}
|
||||
else{
|
||||
Base::Console().Message("Can not find ResultObject by name %s in activeDocument", objName);
|
||||
return FemVTKTools::readFluidicResult(filename, NULL);
|
||||
}
|
||||
}
|
||||
* */
|
||||
|
||||
void FemVTKTools::writeResult(const char* filename, const App::DocumentObject* res) {
|
||||
if (!res)
|
||||
|
@ -613,25 +591,7 @@ void FemVTKTools::writeResult(const char* filename, const App::DocumentObject* r
|
|||
Base::Console().Log(" %f: Done \n",Base::TimeInfo::diffTimeF(Start, Base::TimeInfo()));
|
||||
}
|
||||
|
||||
/*
|
||||
void FemVTKTools::writeResult(const char* filename, const std::string objName) {
|
||||
App::Document* pcDoc = App::GetApplication().getActiveDocument();
|
||||
if(!pcDoc)
|
||||
{
|
||||
Base::Console().Message("No active document is found thus writing is ignored\n");
|
||||
return;
|
||||
}
|
||||
|
||||
App::DocumentObject* res = pcDoc->getObject(objName.c_str());
|
||||
if (!res) {
|
||||
return FemVTKTools::writeResult(filename, res);
|
||||
}
|
||||
else{
|
||||
Base::Console().Message("Can not find ResultObject by name %s in activeDocument", objName);
|
||||
return FemVTKTools::writeResult(filename, NULL);
|
||||
}
|
||||
}
|
||||
*/
|
||||
void FemVTKTools::importFluidicResult(vtkSmartPointer<vtkDataSet> dataset, App::DocumentObject* res) {
|
||||
|
||||
// velocity and pressure are essential, Temperature is optional, so are turbulence related variables
|
||||
|
@ -690,7 +650,6 @@ void FemVTKTools::importFluidicResult(vtkSmartPointer<vtkDataSet> dataset, App::
|
|||
stats[index*3] = vmin;
|
||||
stats[index*3 + 2] = vmax;
|
||||
stats[index*3 + 1] = vmean/nPoints;
|
||||
Base::Console().Message("debug info: vel ptr: %p \n", res->getPropertyByName("Velocity"));
|
||||
App::PropertyVectorList* velocity = static_cast<App::PropertyVectorList*>(res->getPropertyByName("Velocity"));
|
||||
if(velocity) {
|
||||
//PropertyVectorList will not show up in PropertyEditor
|
||||
|
@ -717,7 +676,6 @@ void FemVTKTools::importFluidicResult(vtkSmartPointer<vtkDataSet> dataset, App::
|
|||
continue;
|
||||
}
|
||||
|
||||
Base::Console().Message("debug info: npoints = %d, NumberOfTuples = %d", nPoints, vec->GetNumberOfTuples());
|
||||
double vmin=1.0e100, vmean=0.0, vmax=0.0;
|
||||
std::vector<double> values(nPoints, 0.0);
|
||||
for(vtkIdType i = 0; i < vec->GetNumberOfTuples(); i++)
|
||||
|
|
Loading…
Reference in New Issue
Block a user