[vtkusers] vtkAbaqusElementModel and vtkAbaqusInputDeckReader

Budd Hirons bhiron at lsuhsc.edu
Thu Jun 23 14:23:04 EDT 2005


Thanks for the patch Mathieu, I have two questions...

1. lines 110-11 of your patch for vtkAbaqusInputDeckReader.cxx

-        if( (*iter)[0] == *(star) )
+        if( *(*iter) == *(star) )

iter is an iterator for a vector of vtkStdString objects, and this is 
meant to compare the first character.

this is the error I get on Windows:

Compiling...
vtkAbaqusInputDeckReader.cxx
C:\Shared\Source\vtkLocal\vtkAbaqusInputDeckReader.cxx(486) : error 
C2100: illegal indirection
C:\Shared\Source\vtkLocal\vtkAbaqusInputDeckReader.cxx(486) : error 
C2678: binary '==' : no operator defined which takes a left-hand operand 
of type 'class vtkStdString' (or there is no acceptable conversion)
Error executing cl.exe.

2. line 66 of your patch for the same file adds this:

+  (void)inp;

and line 82 does this:

+  (void)size;

These don't break anything, so it doens't matter to me, but I am curious 
as to why this is added here?


Otherwise, everthing else seems fine, sensible and appropriate.

Cheers,
Budd.



Mathieu Malaterre wrote:
> Budd,
> 
>     Ok I just tried quickly to compile on my linux box and here is the 
> patch I found. Could you comment on the following ?
> 
>     Basically there were unused vars, unigned int were compared to be >= 
> 0, and a problem of cast.
> 
> Thanks,
> Mathieu
> Ps: this is a patch made with -u3, a line starting with - is a line 
> meant to be removed, and a line starting with + is a line to be added.
> 
> Budd Hirons wrote:
> 
>> It is in a really *fresh* state, but all the big bugs are gone I 
>> think... we just wrapped this project this week.  But other than that, 
>> it would be great to see it developed further, and I am not sure that 
>> we will do a whole lot more to it.  I start a new project next week so 
>> I am not sure I will have any paid time to work on it in the near 
>> future, except for bug fixes.
>>
>> How do I go about contributing it (assuming it is interesting enough)? 
>> I tried to follow most of the style and programming guidelines from 
>> kitware...
>>
>> In any case, see attached, I included a sample input deck of a model 
>> of the posterior half of an eye, but to the ophthalmological naif, it 
>> just looks like a half sphere.
>>
>> Let me know what you think or any recommendations for its immediate 
>> improvement.
>>
>> Cheers,
>> Budd.
>>
>> Mathieu Malaterre wrote:
>>
>>> Budd,
>>>
>>>     I'd love to try it out ! Would you be willing to contribute it to 
>>> VTK ?
>>>
>>> Regards,
>>> Mathieu
>>>
>>> Budd Hirons wrote:
>>>
>>>> Hello,
>>>>
>>>> I have written a vtkAbaqusElementModel class derived from 
>>>> vtkUnstructuredGrid and a associated vtkAbaqusInputDeckReader 
>>>> derived from vtkUnstructuredGridSource to load it from an Abaqus 
>>>> Input Deck produced from Patran CAE modeling software.  It supports 
>>>> both explicit and generated named Element and Node Sets from the 
>>>> Input Deck in the form of vtkIdTypeArrays using the same ids listed 
>>>> in the input file, and includes methods to generate 
>>>> vtkUnstructuredGrid datasets for each of the element sets or single 
>>>> elements in the Abaqus model as well as vtkPolyData suitable for 
>>>> glyphing for each of the node sets.
>>>>
>>>> We use the imported cell groups (element sets) to clip segmented 
>>>> volume data for rendering and filtering and the node sets for 
>>>> glyphing to visualize pieces of a larger Finite Element Model 
>>>> workflow in our Opthalmology research lab.
>>>>
>>>> Only quad hex cells are used in the models the engineers are 
>>>> building here, but the class uses a discovery method to generate the 
>>>> input cell type and should be easily extendable for other cell 
>>>> types.  It is a decent first pass and surely in need of refinement, 
>>>> but we have our basic requirements met for now.  If anyone is 
>>>> interested in building it out, let me know and I'll forward you the 
>>>> code.
>>>>
>>>> It is built on vtk4.4, we added the latest CVS patches applied to 
>>>> vtkQuadraticHexahedron for our purposes, it compiles on Windows and 
>>>> MacOSX.
>>>>
>>>> Cheers,
>>>> Budd Hirons
>>>>
>>>> Systems Analyst II
>>>> LSU Lions Eye Center, Glaucoma Research
>>>> Louisiana Health Science Center
>>>> New Orleans, LA
>>>> _______________________________________________
>>>> This is the private VTK discussion list. Please keep messages 
>>>> on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>>
>>>
> 
> 
> 
> ------------------------------------------------------------------------
> 
> Only in abaqus-orig: 1186_all_anatomic_minthick.inp
> diff -u3 abaqus-orig/vtkAbaqusElementModel.cxx abaqus-patched/vtkAbaqusElementModel.cxx
> --- abaqus-orig/vtkAbaqusElementModel.cxx	2005-06-23 12:41:44.806991240 -0400
> +++ abaqus-patched/vtkAbaqusElementModel.cxx	2005-06-23 12:42:12.633760928 -0400
> @@ -1,5 +1,5 @@
> -#include "vtkAbaqusElementModel.h"
>  #include "vtkObjectFactory.h"
> +#include "vtkAbaqusElementModel.h"
>  
>  #include "vtkIdTypeArray.h"
>  #include "vtkDataArrayCollection.h"
> @@ -144,11 +144,13 @@
>  {
>  	//iterate the collection comparing the names...
>  	vtkIdTypeArray *tmp;
> -	for( items->InitTraversal() ; tmp = ( vtkIdTypeArray::SafeDownCast( items->GetNextItemAsObject() ) ) ; )
> +	for( items->InitTraversal() ; 
> +    (tmp = ( vtkIdTypeArray::SafeDownCast( items->GetNextItemAsObject() ) )) ; )
>  	{
> -		if( tmp )
> -			if( strcmp( name, tmp->GetName() ) == 0 )
> -				return tmp;
> +  if (tmp && strcmp( name, tmp->GetName() ) == 0 )
> +    {
> +    return tmp;
> +    }
>  	}
>  
>  	return NULL;
> @@ -166,8 +168,6 @@
>  		return 0;
>  	}
>  
> -	vtkIdType c = this->GetNumberOfCells();
> -
>  	vtkCell *cell = NULL;
>  	cell = this->GetCell( cellId );
>  	if( !cell )
> diff -u3 abaqus-orig/vtkAbaqusElementModel.h abaqus-patched/vtkAbaqusElementModel.h
> --- abaqus-orig/vtkAbaqusElementModel.h	2005-06-23 12:41:44.806991240 -0400
> +++ abaqus-patched/vtkAbaqusElementModel.h	2005-06-23 12:42:12.634760776 -0400
> @@ -1,7 +1,6 @@
>  #ifndef __vtkAbaqusElementModel_h
>  #define __vtkAbaqusElementModel_h
>  
> -#include "vtkLocalConfigure.h" // Include configuration header.
>  #include "vtkUnstructuredGrid.h"
>  #include "vtkDataArrayCollection.h"
>  
> @@ -21,7 +20,7 @@
>  	The class is intentionally agnostic of cell type.
>  */
>  
> -class VTK_vtkLocal_EXPORT vtkAbaqusElementModel : public vtkUnstructuredGrid
> +class VTK_IO_EXPORT vtkAbaqusElementModel : public vtkUnstructuredGrid
>  {
>  public:
>  	static vtkAbaqusElementModel* New();
> diff -u3 abaqus-orig/vtkAbaqusInputDeckReader.cxx abaqus-patched/vtkAbaqusInputDeckReader.cxx
> --- abaqus-orig/vtkAbaqusInputDeckReader.cxx	2005-06-23 12:41:44.807991088 -0400
> +++ abaqus-patched/vtkAbaqusInputDeckReader.cxx	2005-06-23 12:42:12.637760320 -0400
> @@ -80,6 +80,7 @@
>  	vtkStdString::size_type s,e,sz;
>  	vtkIdType comps, acc;
>  	comps = acc = 0;
> +  (void)inp;
>  	
>  	for( iter = start; iter <= end; ++iter ) 
>  	{
> @@ -118,6 +119,7 @@
>  	vtkStdString::size_type s,e, sz;
>  	char *stop = NULL;
>  	vtkIdType rval = -1;
> +  (void)inp;
>  
>  	for( iter = start; iter <= end; ++iter )
>  	{
> @@ -194,6 +196,7 @@
>  	nums->Allocate(tokens);
>  
>  	vtkIdType size = TokenizeToArray( start+1, end, nums, inp );
> +  (void)size;
>  
>  	//iterate the 0th, 4th, 8th, etc to find the smallest and largest node id
>  	double min, max, curr;
> @@ -209,10 +212,10 @@
>  	//now initialize to encompass our largest and smallest point ids
>  	nodes->Initialize();
>  	nodes->SetDataTypeToDouble();
> -	nodes->SetNumberOfPoints( max + 1 );
> +	nodes->SetNumberOfPoints( (int)(max + 1) );
>  
>  	scalars->Initialize();
> -	scalars->SetNumberOfValues( max + 1);
> +	scalars->SetNumberOfValues( (int)(max + 1));
>  
>  	//zero out all possible points
>  	for( int k=0; k<nodes->GetNumberOfPoints(); k++ )
> @@ -472,13 +475,13 @@
>  {
>  	InputDeckBase::iterator iter;
>  	vtkStdString::size_type in;
> -	BOOL bInSection = FALSE;
> +	int bInSection = 0;
>  
>  	for( iter = seekStart; iter != inp.end(); ++iter )
>  	{
>  		//we have a section marker
>  		//check to see if it is a set of some kind
> -		if( (*iter)[0] == *(star) )
> +		if( *(*iter) == *(star) )
>  		{
>  			//cerr << "FindSection found : " << *iter << endl;
>  
> @@ -494,7 +497,7 @@
>  			{
>  				vtkStdString &hdr = *iter;
>  				in = (hdr.find( secStr, 0 ));
> -				if( in >= 0 && in < hdr.length() )
> +				if( in < hdr.length() )
>  				{
>  					//we have found the start of the section
>  					if( bInSection )
> @@ -503,7 +506,7 @@
>  					}
>  
>  					secStart = iter;
> -					bInSection = TRUE;
> +					bInSection = 1;
>  				}
>  			}
>  		}
> @@ -591,9 +594,9 @@
>  	vtkStdString line;
>  
>  #ifdef WIN32
> -	ifstream ifile( this->FileName, ios::in | ios::nocreate, filebuf::sh_read );
> +	ifstream ifile( this->FileName, ios::in | ios::nocreate); //, filebuf::sh_read );
>  #else
> -	ifstream ifile( this->FileName, ios::in, filebuf::sh_read );
> +	ifstream ifile( this->FileName, ios::in); //, filebuf::sh_read );
>  #endif
>  		if( !ifile )
>  		{
> @@ -640,7 +643,6 @@
>  	vtkDoubleArray *nodeScalars = NULL;
>  	vtkIdTypeArray *rawElements = NULL;
>  	vtkIdTypeArray *idSet = NULL;
> -	vtkIdTypeArray *eleSection = NULL;
>  	vtkIdType tokens, cellType, nodeCount, sIdx, eIdx, idx, lastIdx;
>  	vtkIdType min, max, curr;
>  
> @@ -699,7 +701,7 @@
>  		
>  		//get the set name if there is one, should be last in line
>  		v = (hdr.find( "ELSET=", 0 ));
> -		if( v >= 0 && v < (e-6) )
> +		if( v < (e-6) )
>  		{
>  			idSet = vtkIdTypeArray::New();
>  			idSet->SetName( (hdr.substr( v+6, e ) ).c_str() );
> @@ -840,7 +842,7 @@
>  		idSet = vtkIdTypeArray::New();
>  		//find the set name
>  		v = hdr.find( "NSET=", 0 );
> -		if( v >= 0 && v < hdr.length() )
> +		if( v < hdr.length() )
>  		{
>  			vtkStdString tmp = hdr.substr( v+5, hdr.length() );
>  			e = tmp.find( ", GENERATE", 0 );
> @@ -852,7 +854,7 @@
>  
>  		//determine which kind of set it is
>  		v = hdr.find( "GENERATE", 0 );
> -		if( v >= 0 && v < hdr.length() )
> +		if( v < hdr.length() )
>  		{
>  			//we have a generated set to create
>  			idx = vtkAbaqusReaderHelper::BuildGeneratedSet( secStart+1, secEnd, idSet, inp );
> @@ -885,7 +887,7 @@
>  		idSet = vtkIdTypeArray::New();
>  		//find the set name
>  		v = hdr.find( "ELSET=", 0 );
> -		if( v >= 0 && v < hdr.length() )
> +		if( v < hdr.length() )
>  		{
>  			vtkStdString tmp = hdr.substr( v+6, hdr.length() );
>  			e = tmp.find( ", GENERATE", 0 );
> @@ -897,7 +899,7 @@
>  
>  		//determine which kind of set it is
>  		v = hdr.find( "GENERATE", 0 );
> -		if( v >= 0 && v < hdr.length() )
> +		if( v < hdr.length() )
>  		{
>  			//we have a generated set to create
>  			idx = vtkAbaqusReaderHelper::BuildGeneratedSet( secStart+1, secEnd, idSet, inp );
> diff -u3 abaqus-orig/vtkAbaqusInputDeckReader.h abaqus-patched/vtkAbaqusInputDeckReader.h
> --- abaqus-orig/vtkAbaqusInputDeckReader.h	2005-06-23 12:41:44.808990936 -0400
> +++ abaqus-patched/vtkAbaqusInputDeckReader.h	2005-06-23 12:42:12.638760168 -0400
> @@ -1,7 +1,6 @@
>  #ifndef __vtkAbaqusInputDeckReader_h
>  #define __vtkAbaqusInputDeckReader_h
>  
> -#include "vtkLocalConfigure.h" // Include configuration header for vtkLocal projects.
>  #include "vtkUnstructuredGridSource.h"
>  
>  class vtkPoints;
> @@ -145,7 +144,7 @@
>    @endverbatim
>  */
>  
> -class VTK_vtkLocal_EXPORT vtkAbaqusInputDeckReader : public vtkUnstructuredGridSource
> +class VTK_IO_EXPORT vtkAbaqusInputDeckReader : public vtkUnstructuredGridSource
>  {
>  public:
>  	static vtkAbaqusInputDeckReader* New();
> Only in abaqus-patched: vtkAbaqusModel_Reader.ZIP



More information about the vtkusers mailing list