[MOAB-dev] commit/MOAB: 8 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Fri Feb 28 14:51:10 CST 2014
8 new commits in MOAB:
https://bitbucket.org/fathomteam/moab/commits/3c33610784b1/
Changeset: 3c33610784b1
Branch: None
User: Lukasz Kaczmarczyk
Date: 2013-09-22 22:06:58
Summary: cubit file, block data attributes in variable length tag
Affected #: 1 file
diff --git a/src/io/Tqdcfr.cpp b/src/io/Tqdcfr.cpp
index 717f43a..2d24e0e 100644
--- a/src/io/Tqdcfr.cpp
+++ b/src/io/Tqdcfr.cpp
@@ -916,6 +916,7 @@ ErrorCode Tqdcfr::read_block(const unsigned int blindex,
Tqdcfr::ModelEntry *model,
Tqdcfr::BlockHeader *blockh)
{
+
if (blockh->memCt == 0) return MB_SUCCESS;
// position file
@@ -945,24 +946,35 @@ ErrorCode Tqdcfr::read_block(const unsigned int blindex,
ErrorCode result = put_into_set(blockh->setHandle, block_entities, excl_entities);
if (MB_SUCCESS != result) return result;
- // read attribs if there are any
+ // read attribs if there are any
+ // <-- likask
+ Tag block_attribs;
+ {
+ int def_Block_Attributes_lenght = 0;
+ result = mdbImpl->tag_get_handle("Block_Attributes",def_Block_Attributes_lenght,MB_TYPE_DOUBLE,
+ block_attribs,MB_TAG_CREAT|MB_TAG_SPARSE|MB_TAG_VARLEN,NULL);
+ if (MB_SUCCESS != result && MB_ALREADY_ALLOCATED != result) return result;
+ }
if (blockh->attribOrder > 0) {
- Tag block_attribs;
-
+
FREADD(blockh->attribOrder); num_read += sizeof(double);
- // now do something with them...
+ // now do something with them...
// This code seems broken. It is apparently supposed to read
// blockh->attribOrder values for each block and store them in
// a tag. However, blockh->attribOrder is not a constant
// so the same fixed-length tag cannot be used for all blocks.
// For now, just store one value, as that was what the buggy code
// previously did.
- result = mdbImpl->tag_get_handle("Block_Attributes", 1/*blockh->attribOrder*/,
- MB_TYPE_DOUBLE, block_attribs,
- MB_TAG_SPARSE|MB_TAG_CREAT);
- if (MB_SUCCESS != result && MB_ALREADY_ALLOCATED != result) return result;
- result = mdbImpl->tag_set_data(block_attribs, &(blockh->setHandle), 1,
- &(dbl_buf[0]));
+ //result = mdbImpl->tag_get_handle("Block_Attributes", 1 /*blockh->attribOrder*/,
+ //MB_TYPE_DOUBLE, block_attribs,
+ //MB_TAG_SPARSE|MB_TAG_CREAT);
+ //if (MB_SUCCESS != result && MB_ALREADY_ALLOCATED != result) return result;
+ //result = mdbImpl->tag_set_data(block_attribs, &(blockh->setHandle), 1,
+ //&(dbl_buf[0]));
+ // <- likask
+ void const* tag_data[] = { &dbl_buf[0] };
+ int tag_sizes[] = { blockh->attribOrder };
+ result = mdbImpl->tag_set_by_ptr(block_attribs,&(blockh->setHandle),1,tag_data,tag_sizes);
if (MB_SUCCESS != result) return result;
}
@@ -1922,6 +1934,16 @@ ErrorCode Tqdcfr::BlockHeader::read_info_header(const double data_version,
block_headers[i].blockLength = instance->uint_buf[10];
block_headers[i].blockDim = instance->uint_buf[11];
+ // <-likask
+ std::vector<unsigned int> def_uint_zero(12,0);
+ Tag bhTag_header;
+ result = instance->mdbImpl->tag_get_handle("BLOCK_HEADER",12*sizeof(unsigned int),MB_TYPE_INTEGER,
+ bhTag_header,MB_TAG_CREAT|MB_TAG_SPARSE|MB_TAG_BYTES,&def_uint_zero[0]);
+ if (MB_SUCCESS != result) return result;
+ result = instance->mdbImpl->tag_set_data(bhTag_header,&(block_headers[i].setHandle), 1,
+ &(instance->uint_buf[0]));
+ if (MB_SUCCESS != result) return result;
+
// adjust element type for data version; older element types didn't include
// 4 new trishell element types
if (data_version <= 1.0 && block_headers[i].blockElemType >= 15)
https://bitbucket.org/fathomteam/moab/commits/0416f322f684/
Changeset: 0416f322f684
Branch: None
User: likask
Date: 2013-09-22 23:15:52
Summary: Merged fathomteam/moab into master
Affected #: 13 files
diff --git a/MeshFiles/unittest/16_unmerged_hex.h5m b/MeshFiles/unittest/16_unmerged_hex.h5m
new file mode 100644
index 0000000..2ebde86
Binary files /dev/null and b/MeshFiles/unittest/16_unmerged_hex.h5m differ
diff --git a/MeshFiles/unittest/Makefile.am b/MeshFiles/unittest/Makefile.am
index 16dc2ed..a1784ee 100644
--- a/MeshFiles/unittest/Makefile.am
+++ b/MeshFiles/unittest/Makefile.am
@@ -1,6 +1,7 @@
SUBDIRS = io
EXTRA_DIST = 125hex.g \
+ 16_unmerged_hex.h5m \
1hex.g \
1khex.g \
1tet.g \
diff --git a/config/compiler.m4 b/config/compiler.m4
index 6a7e2ed..ce83a5f 100644
--- a/config/compiler.m4
+++ b/config/compiler.m4
@@ -222,6 +222,14 @@ if test "xyes" = "x$enable_debug"; then
CFLAGS="$CFLAGS -g"
FCFLAGS="$FCFLAGS -g"
FFLAGS="$FFLAGS -g"
+ # Add -fstack-protector-all option for g++ in debug mode
+ if test "x$cxx_compiler" = "xGNU"; then
+ CXXFLAGS="$CXXFLAGS -fstack-protector-all"
+ fi
+ # Add -fstack-protector-all option for gcc in debug mode
+ if test "x$cc_compiler" = "xGNU"; then
+ CFLAGS="$CFLAGS -fstack-protector-all"
+ fi
fi
if test "xyes" = "x$enable_cxx_optimize"; then
CXXFLAGS="$CXXFLAGS -O2 -DNDEBUG"
diff --git a/examples/HelloMOAB.cpp b/examples/HelloMOAB.cpp
index 6129233..6ca2b23 100644
--- a/examples/HelloMOAB.cpp
+++ b/examples/HelloMOAB.cpp
@@ -57,6 +57,8 @@ int main( int argc, char** argv )
cout << "Number of edges is " << edges.size() << endl;
cout << "Number of faces is " << faces.size() << endl;
cout << "Number of elements is " << elems.size() << endl;
-
+
+ delete iface;
+
return 0;
}
diff --git a/src/MergeMesh.cpp b/src/MergeMesh.cpp
index 4cc8158..7293e17 100644
--- a/src/MergeMesh.cpp
+++ b/src/MergeMesh.cpp
@@ -61,7 +61,7 @@ moab::ErrorCode MergeMesh::merge_entities(moab::Range &elems,
// get the skin of the entities
moab::Skinner skinner(mbImpl);
moab::Range skin_range;
- moab::ErrorCode result = skinner.find_skin(0, elems, 0, skin_range);
+ moab::ErrorCode result = skinner.find_skin(0, elems, 0, skin_range, false, false);
if (moab::MB_SUCCESS != result) return result;
// create a tag to mark merged-to entity; reuse tree_root
@@ -232,16 +232,16 @@ moab::ErrorCode MergeMesh::merge_higher_dimensions(moab::Range &elems)
for(int dim = 1; dim <3; dim++){
skinEnts.clear();
moreDeadEnts.clear();
- result = skinner.find_skin(0, elems, dim, skinEnts);
+ result = skinner.find_skin(0, elems, dim, skinEnts, false, false);
//Go through each skin entity and see if it shares adjacancies with another entity
for(moab::Range::iterator skinIt = skinEnts.begin(); skinIt != skinEnts.end(); skinIt++){
adj.clear();
//Get the adjacencies 1 dimension lower
- result = mbImpl->get_adjacencies(&(*skinIt), 1, dim-1, true, adj);
+ result = mbImpl->get_adjacencies(&(*skinIt), 1, dim-1, false, adj);
if(result != moab::MB_SUCCESS) return result;
//See what other entities share these adjacencies
matches.clear();
- result = mbImpl->get_adjacencies(adj, dim, true, matches, moab::Interface::INTERSECT);
+ result = mbImpl->get_adjacencies(adj, dim, false, matches, moab::Interface::INTERSECT);
if(result != moab::MB_SUCCESS) return result;
//If there is more than one entity, then we have some to merge and erase
if(matches.size() > 1){
diff --git a/src/Skinner.cpp b/src/Skinner.cpp
index b5fd24e..c3c6b1b 100644
--- a/src/Skinner.cpp
+++ b/src/Skinner.cpp
@@ -1015,11 +1015,12 @@ ErrorCode Skinner::find_skin(const EntityHandle this_set,
const Range &entities,
int dim,
Range &skin_entities,
- bool create_vert_elem_adjs)
+ bool create_vert_elem_adjs,
+ bool create_skin_elements)
{
Range tmp_skin;
ErrorCode result = find_skin(this_set, entities, (dim==0), tmp_skin, 0,
- create_vert_elem_adjs, true);
+ create_vert_elem_adjs, create_skin_elements);
if (MB_SUCCESS != result || tmp_skin.empty()) return result;
if (tmp_skin.all_of_dimension(dim)) {
@@ -1029,7 +1030,7 @@ ErrorCode Skinner::find_skin(const EntityHandle this_set,
skin_entities.merge(tmp_skin);
}
else {
- result = thisMB->get_adjacencies( tmp_skin, dim, true, skin_entities,
+ result = thisMB->get_adjacencies( tmp_skin, dim, create_skin_elements, skin_entities,
Interface::UNION );
}
diff --git a/src/io/NCHelperHOMME.cpp b/src/io/NCHelperHOMME.cpp
index 4f2ac51..f750e78 100644
--- a/src/io/NCHelperHOMME.cpp
+++ b/src/io/NCHelperHOMME.cpp
@@ -232,7 +232,7 @@ ErrorCode NCHelperHOMME::create_mesh(Range& faces)
conn_fname = "HommeMapping.nc";
}
- int success;
+ int success = 0;
int rank = 0;
int procs = 1;
@@ -265,9 +265,11 @@ ErrorCode NCHelperHOMME::create_mesh(Range& faces)
ERRORR(rval, "Failed to get dimensions for connectivity.");
// Read connectivity into temporary variable
- int num_fine_quads, num_coarse_quads, start_idx;
+ int num_fine_quads = 0;
+ int num_coarse_quads = 0;
+ int start_idx = 0;
std::vector<std::string>::iterator vit;
- int idx;
+ int idx = 0;
if ((vit = std::find(conn_names.begin(), conn_names.end(), "ncells")) != conn_names.end())
idx = vit - conn_names.begin();
else if ((vit = std::find(conn_names.begin(), conn_names.end(), "ncenters")) != conn_names.end())
diff --git a/src/moab/Skinner.hpp b/src/moab/Skinner.hpp
index 7ec5450..4eb2f51 100644
--- a/src/moab/Skinner.hpp
+++ b/src/moab/Skinner.hpp
@@ -119,7 +119,8 @@ public:
const Range &entities,
int dim,
Range &skin_entities,
- bool create_vert_elem_adjs = false);
+ bool create_vert_elem_adjs = false,
+ bool create_skin_elements = true);
ErrorCode classify_2d_boundary( const Range &boundary,
const Range &bar_elements,
diff --git a/test/Makefile.am b/test/Makefile.am
index e4d591f..99c5211 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -54,6 +54,7 @@ if HDF5_FILE
TESTS += mbfacet_test \
gttool_test \
cropvol_test \
+ mergemesh_test \
mbground_test
endif
@@ -75,6 +76,7 @@ MOSTLYCLEANFILES = mb_write.g \
tri_mid_edge_face_nodes.g \
mb_stress_out.g \
merge_test.g \
+ mm_out.h5m \
tree.h5m
# Tests and such
@@ -123,6 +125,7 @@ var_len_test_no_template_CPPFLAGS = -UTEMPLATE_SPECIALIZATION $(AM_CPPFLAGS) $(C
tag_test_SOURCES = TestUtil.hpp TagTest.cpp
spatial_locator_test_SOURCES = TestUtil.hpp spatial_locator_test.cpp
+mergemesh_test_SOURCES = mergemesh_test.cpp
mbcn_test_SOURCES = $(top_srcdir)/src/moab/CN.hpp \
$(top_srcdir)/src/CN.cpp \
diff --git a/test/mergemesh_test.cpp b/test/mergemesh_test.cpp
new file mode 100644
index 0000000..fca5304
--- /dev/null
+++ b/test/mergemesh_test.cpp
@@ -0,0 +1,48 @@
+#include "moab/Core.hpp"
+#include "moab/Range.hpp"
+#include "moab/MergeMesh.hpp"
+#include <iostream>
+
+#define STRINGIFY_(A) #A
+#define STRINGIFY(A) STRINGIFY_(A)
+
+using namespace moab;
+
+const char* meshfile = STRINGIFY(MESHDIR) "/16_unmerged_hex.h5m";
+
+
+int main( int argc, char* argv[] )
+{
+ Core moab_core;
+ ErrorCode rval;
+ Interface* iface = &moab_core;
+ // can be generalized to load user defined input/output file
+// std::cout << "loading mesh file " << (std::string) meshfile << std::endl;
+ rval = iface->load_mesh(meshfile);
+ if (MB_SUCCESS != rval) {
+ std::cerr << "Error reading file: " << meshfile << std::endl;
+ exit(2);
+ }
+ int dim = 3;
+ moab::Range ents;
+ iface->get_entities_by_dimension(0, dim, ents);
+
+ MergeMesh mm(iface);
+ double merge_tol = 1e-3;
+ bool merge_higher_dim_entities = true;
+
+ rval = mm.merge_entities(ents, merge_tol, merge_higher_dim_entities);
+ if (MB_SUCCESS != rval) {
+ std::cerr << "Error in MergeMesh during merging entities" << std::endl;
+ exit(2);
+ }
+
+ // Fixed for now
+ const char *outfile = "mm_out.h5m";
+ rval = iface->write_mesh( outfile);
+ if (MB_SUCCESS != rval) {
+ std::cerr << "Error saving file: " << outfile << std::endl;
+ exit(2);
+ }
+ return 0;
+}
diff --git a/tools/mbcoupler/Coupler.cpp b/tools/mbcoupler/Coupler.cpp
index 71231b8..f7f74b2 100644
--- a/tools/mbcoupler/Coupler.cpp
+++ b/tools/mbcoupler/Coupler.cpp
@@ -6,6 +6,7 @@
#include "iMesh_extensions.h"
#include "moab/gs.hpp"
#include "moab/TupleList.hpp"
+#include "moab/Error.hpp"
#include "iostream"
#include <stdio.h>
#include <algorithm>
@@ -518,6 +519,27 @@ ErrorCode Coupler::test_local_box(double *xyz,
return MB_SUCCESS;
}
+ErrorCode Coupler::interpolate(Coupler::Method method,
+ const std::string &interp_tag,
+ double *interp_vals,
+ TupleList *tl,
+ bool normalize)
+{
+ Tag tag;
+ ErrorCode result ;
+ if (_spectralSource)
+ result = mbImpl->tag_get_handle(interp_tag.c_str(), _ntot, MB_TYPE_DOUBLE, tag);
+ else
+ result = mbImpl->tag_get_handle(interp_tag.c_str(), 1, MB_TYPE_DOUBLE, tag);
+ if (MB_SUCCESS != result) {
+ std::ostringstream str;
+ str << "Failed to get handle for interpolation tag \"" << interp_tag << "\"";
+ mError->set_last_error(str.str());
+ return result;
+ }
+ return interpolate(method, tag, interp_vals, tl, normalize);
+}
+
ErrorCode Coupler::interpolate(Coupler::Method *methods,
Tag *tags,
int *points_per_method,
diff --git a/tools/mbcoupler/Coupler.hpp b/tools/mbcoupler/Coupler.hpp
index 74170d5..705e2dc 100644
--- a/tools/mbcoupler/Coupler.hpp
+++ b/tools/mbcoupler/Coupler.hpp
@@ -29,7 +29,6 @@
#include "moab/Interface.hpp"
#include "moab/CartVect.hpp"
#include "moab/TupleList.hpp"
-#include "moab/Error.hpp"
#include <sstream>
@@ -41,6 +40,8 @@ class AdaptiveKDTree;
class TupleList;
+class Error;
+
class Coupler
{
public:
@@ -530,27 +531,6 @@ private:
// error object used to set last error on interface
Error *mError;
};
-
-inline ErrorCode Coupler::interpolate(Coupler::Method method,
- const std::string &interp_tag,
- double *interp_vals,
- TupleList *tl,
- bool normalize)
-{
- Tag tag;
- ErrorCode result ;
- if (_spectralSource)
- result = mbImpl->tag_get_handle(interp_tag.c_str(), _ntot, MB_TYPE_DOUBLE, tag);
- else
- result = mbImpl->tag_get_handle(interp_tag.c_str(), 1, MB_TYPE_DOUBLE, tag);
- if (MB_SUCCESS != result) {
- std::ostringstream str;
- str << "Failed to get handle for interpolation tag \"" << interp_tag << "\"";
- mError->set_last_error(str.str());
- return result;
- }
- return interpolate(method, tag, interp_vals, tl, normalize);
-}
inline ErrorCode Coupler::interpolate(Coupler::Method method,
Tag tag,
diff --git a/tools/mbcslam/Intx2MeshOnSphere.cpp b/tools/mbcslam/Intx2MeshOnSphere.cpp
index a875d7b..0952ef6 100644
--- a/tools/mbcslam/Intx2MeshOnSphere.cpp
+++ b/tools/mbcslam/Intx2MeshOnSphere.cpp
@@ -439,10 +439,10 @@ ErrorCode Intx2MeshOnSphere::update_tracer_data(EntityHandle out_set, Tag & tagE
int blueIndex, redIndex;
rval = mb->tag_get_data(blueParentTag, &poly, 1, &blueIndex);
ERRORR(rval, "can't get blue tag");
- EntityHandle blue = rs1[blueIndex];
+ //EntityHandle blue = rs1[blueIndex];
rval = mb->tag_get_data(redParentTag, &poly, 1, &redIndex);
ERRORR(rval, "can't get red tag");
- EntityHandle red=rs2[redIndex];
+ //EntityHandle red = rs2[redIndex];
// big assumption here, red and blue are "parallel" ;we should have an index from
// blue to red (so a deformed blue corresponds to an arrival red)
double areap = area_spherical_element(mb, poly, R);
https://bitbucket.org/fathomteam/moab/commits/836d872d1bc3/
Changeset: 836d872d1bc3
Branch: None
User: Lukasz Kaczmarczyk
Date: 2013-10-03 22:21:53
Summary: use variable names w/o capitalisation and correction of spelling mistake
Affected #: 1 file
diff --git a/src/io/Tqdcfr.cpp b/src/io/Tqdcfr.cpp
index 2d24e0e..cb2ea2a 100644
--- a/src/io/Tqdcfr.cpp
+++ b/src/io/Tqdcfr.cpp
@@ -950,8 +950,8 @@ ErrorCode Tqdcfr::read_block(const unsigned int blindex,
// <-- likask
Tag block_attribs;
{
- int def_Block_Attributes_lenght = 0;
- result = mdbImpl->tag_get_handle("Block_Attributes",def_Block_Attributes_lenght,MB_TYPE_DOUBLE,
+ int def_block_attributes_length = 0;
+ result = mdbImpl->tag_get_handle("Block_Attributes",def_block_attributes_length,MB_TYPE_DOUBLE,
block_attribs,MB_TAG_CREAT|MB_TAG_SPARSE|MB_TAG_VARLEN,NULL);
if (MB_SUCCESS != result && MB_ALREADY_ALLOCATED != result) return result;
}
https://bitbucket.org/fathomteam/moab/commits/07b79036c614/
Changeset: 07b79036c614
Branch: None
User: Lukasz Kaczmarczyk
Date: 2013-10-03 23:36:42
Summary: add nee tags name to MBTagConventions.hpp
do changes in Tqdcfr.cpp, cleaning unnecessary comments and tags names
Affected #: 2 files
diff --git a/src/MBTagConventions.hpp b/src/MBTagConventions.hpp
index 61e5732..5cb518f 100644
--- a/src/MBTagConventions.hpp
+++ b/src/MBTagConventions.hpp
@@ -108,6 +108,18 @@
#define NAME_TAG_NAME "NAME"
#define NAME_TAG_SIZE 32
+/* BLOCK_HEADER: tag
+ * A fixex lenght tag containg block header data
+ * BlockColor, MaterialId and BlockDimension
+ */
+#define BLOCK_HEADER "BLOCK_HEADER"
+
+/* BLOCK_ATTRIBUTES: tag
+ * A varible lenght tag of doubles
+ * Tag contains attributes set to BlockSet in cubit file
+ */
+#define BLOCK_ATTRIBUTES "BLOCK_ATTRIBUTES"
+
#ifndef MB_PARALLEL_CONVENTIONS_H
#define MB_PARALLEL_CONVENTIONS_H
diff --git a/src/io/Tqdcfr.cpp b/src/io/Tqdcfr.cpp
index cb2ea2a..21fc253 100644
--- a/src/io/Tqdcfr.cpp
+++ b/src/io/Tqdcfr.cpp
@@ -588,7 +588,6 @@ ErrorCode Tqdcfr::read_nodeset(const unsigned int nsindex,
if (MB_SUCCESS != result) return result;
}
// check for more data
- // <- likask
if (num_read < nodeseth->nsLength) {
FREADC(2); num_read += 2;
if (char_buf[0] == 'i' && char_buf[1] == 'd') {
@@ -604,7 +603,7 @@ ErrorCode Tqdcfr::read_nodeset(const unsigned int nsindex,
}
}
- if(debug) { // <-likask
+ if(debug) {
nodeseth->print();
if(!bc_data.empty()) {
std::cout << "bc_data = ";
@@ -619,7 +618,7 @@ ErrorCode Tqdcfr::read_nodeset(const unsigned int nsindex,
}
std::cout << std::endl;
}
- } // <-likask
+ }
// and put entities into this nodeset's set
ErrorCode result = put_into_set(nodeseth->setHandle, ns_entities, excl_entities);
@@ -628,7 +627,6 @@ ErrorCode Tqdcfr::read_nodeset(const unsigned int nsindex,
result = get_names(model->nodesetMD, nsindex, nodeseth->setHandle);
if (MB_SUCCESS != result) return result;
- // <-likask
const int def_bc_data_len = 0;
std::string tag_name = std::string(DIRICHLET_SET_TAG_NAME)+"__BC_DATA";
Tag nbc_data;
@@ -757,7 +755,7 @@ ErrorCode Tqdcfr::read_sideset(const unsigned int ssindex,
}
}
- if(debug) { // <-likask
+ if(debug) {
sideseth->print();
if(!bc_data.empty()) {
std::cout << "bc_data = ";
@@ -772,12 +770,11 @@ ErrorCode Tqdcfr::read_sideset(const unsigned int ssindex,
}
std::cout << std::endl;
}
- } // <-likask
+ }
result = get_names(model->sidesetMD, ssindex, sideseth->setHandle);
if (MB_SUCCESS != result) return result;
- // <-likask
const int def_bc_data_len = 0;
std::string tag_name = std::string(NEUMANN_SET_TAG_NAME)+"__BC_DATA";
Tag nbc_data;
@@ -947,31 +944,16 @@ ErrorCode Tqdcfr::read_block(const unsigned int blindex,
if (MB_SUCCESS != result) return result;
// read attribs if there are any
- // <-- likask
Tag block_attribs;
{
int def_block_attributes_length = 0;
- result = mdbImpl->tag_get_handle("Block_Attributes",def_block_attributes_length,MB_TYPE_DOUBLE,
+ result = mdbImpl->tag_get_handle(BLOCK_ATTRIBUTES,def_block_attributes_length,MB_TYPE_DOUBLE,
block_attribs,MB_TAG_CREAT|MB_TAG_SPARSE|MB_TAG_VARLEN,NULL);
if (MB_SUCCESS != result && MB_ALREADY_ALLOCATED != result) return result;
}
if (blockh->attribOrder > 0) {
FREADD(blockh->attribOrder); num_read += sizeof(double);
- // now do something with them...
- // This code seems broken. It is apparently supposed to read
- // blockh->attribOrder values for each block and store them in
- // a tag. However, blockh->attribOrder is not a constant
- // so the same fixed-length tag cannot be used for all blocks.
- // For now, just store one value, as that was what the buggy code
- // previously did.
- //result = mdbImpl->tag_get_handle("Block_Attributes", 1 /*blockh->attribOrder*/,
- //MB_TYPE_DOUBLE, block_attribs,
- //MB_TAG_SPARSE|MB_TAG_CREAT);
- //if (MB_SUCCESS != result && MB_ALREADY_ALLOCATED != result) return result;
- //result = mdbImpl->tag_set_data(block_attribs, &(blockh->setHandle), 1,
- //&(dbl_buf[0]));
- // <- likask
void const* tag_data[] = { &dbl_buf[0] };
int tag_sizes[] = { blockh->attribOrder };
result = mdbImpl->tag_set_by_ptr(block_attribs,&(blockh->setHandle),1,tag_data,tag_sizes);
@@ -1934,14 +1916,14 @@ ErrorCode Tqdcfr::BlockHeader::read_info_header(const double data_version,
block_headers[i].blockLength = instance->uint_buf[10];
block_headers[i].blockDim = instance->uint_buf[11];
- // <-likask
- std::vector<unsigned int> def_uint_zero(12,0);
Tag bhTag_header;
- result = instance->mdbImpl->tag_get_handle("BLOCK_HEADER",12*sizeof(unsigned int),MB_TYPE_INTEGER,
+ std::vector<unsigned int> def_uint_zero(3,0);
+ result = instance->mdbImpl->tag_get_handle(BLOCK_HEADER,3*sizeof(unsigned int),MB_TYPE_INTEGER,
bhTag_header,MB_TAG_CREAT|MB_TAG_SPARSE|MB_TAG_BYTES,&def_uint_zero[0]);
if (MB_SUCCESS != result) return result;
+ int block_header_data[] = { block_headers[i].blockCol, block_headers[i].blockMat, block_headers[i].blockDim };
result = instance->mdbImpl->tag_set_data(bhTag_header,&(block_headers[i].setHandle), 1,
- &(instance->uint_buf[0]));
+ block_header_data);
if (MB_SUCCESS != result) return result;
// adjust element type for data version; older element types didn't include
https://bitbucket.org/fathomteam/moab/commits/bbf82ab9f139/
Changeset: bbf82ab9f139
Branch: None
User: Lukasz Kaczmarczyk
Date: 2013-10-03 23:40:46
Summary: changes for cubit file reader
add varible lenght tag for saving block attributes
add fixed lenght tag for block header
add tags name to MBTagConventions.hpp do changes in Tqdcfr.cpp, cleaning unnecessary comments and tags names
Affected #: 2 files
diff --git a/src/MBTagConventions.hpp b/src/MBTagConventions.hpp
index 61e5732..5cb518f 100644
--- a/src/MBTagConventions.hpp
+++ b/src/MBTagConventions.hpp
@@ -108,6 +108,18 @@
#define NAME_TAG_NAME "NAME"
#define NAME_TAG_SIZE 32
+/* BLOCK_HEADER: tag
+ * A fixex lenght tag containg block header data
+ * BlockColor, MaterialId and BlockDimension
+ */
+#define BLOCK_HEADER "BLOCK_HEADER"
+
+/* BLOCK_ATTRIBUTES: tag
+ * A varible lenght tag of doubles
+ * Tag contains attributes set to BlockSet in cubit file
+ */
+#define BLOCK_ATTRIBUTES "BLOCK_ATTRIBUTES"
+
#ifndef MB_PARALLEL_CONVENTIONS_H
#define MB_PARALLEL_CONVENTIONS_H
diff --git a/src/io/Tqdcfr.cpp b/src/io/Tqdcfr.cpp
index 717f43a..21fc253 100644
--- a/src/io/Tqdcfr.cpp
+++ b/src/io/Tqdcfr.cpp
@@ -588,7 +588,6 @@ ErrorCode Tqdcfr::read_nodeset(const unsigned int nsindex,
if (MB_SUCCESS != result) return result;
}
// check for more data
- // <- likask
if (num_read < nodeseth->nsLength) {
FREADC(2); num_read += 2;
if (char_buf[0] == 'i' && char_buf[1] == 'd') {
@@ -604,7 +603,7 @@ ErrorCode Tqdcfr::read_nodeset(const unsigned int nsindex,
}
}
- if(debug) { // <-likask
+ if(debug) {
nodeseth->print();
if(!bc_data.empty()) {
std::cout << "bc_data = ";
@@ -619,7 +618,7 @@ ErrorCode Tqdcfr::read_nodeset(const unsigned int nsindex,
}
std::cout << std::endl;
}
- } // <-likask
+ }
// and put entities into this nodeset's set
ErrorCode result = put_into_set(nodeseth->setHandle, ns_entities, excl_entities);
@@ -628,7 +627,6 @@ ErrorCode Tqdcfr::read_nodeset(const unsigned int nsindex,
result = get_names(model->nodesetMD, nsindex, nodeseth->setHandle);
if (MB_SUCCESS != result) return result;
- // <-likask
const int def_bc_data_len = 0;
std::string tag_name = std::string(DIRICHLET_SET_TAG_NAME)+"__BC_DATA";
Tag nbc_data;
@@ -757,7 +755,7 @@ ErrorCode Tqdcfr::read_sideset(const unsigned int ssindex,
}
}
- if(debug) { // <-likask
+ if(debug) {
sideseth->print();
if(!bc_data.empty()) {
std::cout << "bc_data = ";
@@ -772,12 +770,11 @@ ErrorCode Tqdcfr::read_sideset(const unsigned int ssindex,
}
std::cout << std::endl;
}
- } // <-likask
+ }
result = get_names(model->sidesetMD, ssindex, sideseth->setHandle);
if (MB_SUCCESS != result) return result;
- // <-likask
const int def_bc_data_len = 0;
std::string tag_name = std::string(NEUMANN_SET_TAG_NAME)+"__BC_DATA";
Tag nbc_data;
@@ -916,6 +913,7 @@ ErrorCode Tqdcfr::read_block(const unsigned int blindex,
Tqdcfr::ModelEntry *model,
Tqdcfr::BlockHeader *blockh)
{
+
if (blockh->memCt == 0) return MB_SUCCESS;
// position file
@@ -945,24 +943,20 @@ ErrorCode Tqdcfr::read_block(const unsigned int blindex,
ErrorCode result = put_into_set(blockh->setHandle, block_entities, excl_entities);
if (MB_SUCCESS != result) return result;
- // read attribs if there are any
+ // read attribs if there are any
+ Tag block_attribs;
+ {
+ int def_block_attributes_length = 0;
+ result = mdbImpl->tag_get_handle(BLOCK_ATTRIBUTES,def_block_attributes_length,MB_TYPE_DOUBLE,
+ block_attribs,MB_TAG_CREAT|MB_TAG_SPARSE|MB_TAG_VARLEN,NULL);
+ if (MB_SUCCESS != result && MB_ALREADY_ALLOCATED != result) return result;
+ }
if (blockh->attribOrder > 0) {
- Tag block_attribs;
-
+
FREADD(blockh->attribOrder); num_read += sizeof(double);
- // now do something with them...
- // This code seems broken. It is apparently supposed to read
- // blockh->attribOrder values for each block and store them in
- // a tag. However, blockh->attribOrder is not a constant
- // so the same fixed-length tag cannot be used for all blocks.
- // For now, just store one value, as that was what the buggy code
- // previously did.
- result = mdbImpl->tag_get_handle("Block_Attributes", 1/*blockh->attribOrder*/,
- MB_TYPE_DOUBLE, block_attribs,
- MB_TAG_SPARSE|MB_TAG_CREAT);
- if (MB_SUCCESS != result && MB_ALREADY_ALLOCATED != result) return result;
- result = mdbImpl->tag_set_data(block_attribs, &(blockh->setHandle), 1,
- &(dbl_buf[0]));
+ void const* tag_data[] = { &dbl_buf[0] };
+ int tag_sizes[] = { blockh->attribOrder };
+ result = mdbImpl->tag_set_by_ptr(block_attribs,&(blockh->setHandle),1,tag_data,tag_sizes);
if (MB_SUCCESS != result) return result;
}
@@ -1922,6 +1916,16 @@ ErrorCode Tqdcfr::BlockHeader::read_info_header(const double data_version,
block_headers[i].blockLength = instance->uint_buf[10];
block_headers[i].blockDim = instance->uint_buf[11];
+ Tag bhTag_header;
+ std::vector<unsigned int> def_uint_zero(3,0);
+ result = instance->mdbImpl->tag_get_handle(BLOCK_HEADER,3*sizeof(unsigned int),MB_TYPE_INTEGER,
+ bhTag_header,MB_TAG_CREAT|MB_TAG_SPARSE|MB_TAG_BYTES,&def_uint_zero[0]);
+ if (MB_SUCCESS != result) return result;
+ int block_header_data[] = { block_headers[i].blockCol, block_headers[i].blockMat, block_headers[i].blockDim };
+ result = instance->mdbImpl->tag_set_data(bhTag_header,&(block_headers[i].setHandle), 1,
+ block_header_data);
+ if (MB_SUCCESS != result) return result;
+
// adjust element type for data version; older element types didn't include
// 4 new trishell element types
if (data_version <= 1.0 && block_headers[i].blockElemType >= 15)
https://bitbucket.org/fathomteam/moab/commits/31d1d81cb130/
Changeset: 31d1d81cb130
Branch: None
User: Lukasz Kaczmarczyk
Date: 2013-10-03 23:42:50
Summary: Merge branch 'block_atributes_cubit_file_reading' of https://bitbucket.org/likask/moab into block_atributes_cubit_file_reading
* 'block_atributes_cubit_file_reading' of https://bitbucket.org/likask/moab:
add nee tags name to MBTagConventions.hpp do changes in Tqdcfr.cpp, cleaning unnecessary comments and tags names
use variable names w/o capitalisation and correction of spelling mistake
cubit file, block data attributes in variable length tag
Affected #: 0 files
https://bitbucket.org/fathomteam/moab/commits/f62e9a9a1033/
Changeset: f62e9a9a1033
Branch: None
User: Lukasz Kaczmarczyk
Date: 2013-10-03 23:48:52
Summary: cosmetic changes
Affected #: 1 file
diff --git a/src/io/Tqdcfr.cpp b/src/io/Tqdcfr.cpp
index 21fc253..c45f412 100644
--- a/src/io/Tqdcfr.cpp
+++ b/src/io/Tqdcfr.cpp
@@ -1917,13 +1917,16 @@ ErrorCode Tqdcfr::BlockHeader::read_info_header(const double data_version,
block_headers[i].blockDim = instance->uint_buf[11];
Tag bhTag_header;
- std::vector<unsigned int> def_uint_zero(3,0);
- result = instance->mdbImpl->tag_get_handle(BLOCK_HEADER,3*sizeof(unsigned int),MB_TYPE_INTEGER,
- bhTag_header,MB_TAG_CREAT|MB_TAG_SPARSE|MB_TAG_BYTES,&def_uint_zero[0]);
- if (MB_SUCCESS != result) return result;
- int block_header_data[] = { block_headers[i].blockCol, block_headers[i].blockMat, block_headers[i].blockDim };
- result = instance->mdbImpl->tag_set_data(bhTag_header,&(block_headers[i].setHandle), 1,
+ {
+ std::vector<int> def_uint_zero(3,0);
+ result = instance->mdbImpl->tag_get_handle(BLOCK_HEADER,3*sizeof(unsigned int),MB_TYPE_INTEGER,
+ bhTag_header,MB_TAG_CREAT|MB_TAG_SPARSE|MB_TAG_BYTES,&def_uint_zero[0]);
+ if (MB_SUCCESS != result) return result;
+ int block_header_data[] = { block_headers[i].blockCol, block_headers[i].blockMat, block_headers[i].blockDim };
+ result = instance->mdbImpl->tag_set_data(bhTag_header,&(block_headers[i].setHandle), 1,
block_header_data);
+ }
+
if (MB_SUCCESS != result) return result;
// adjust element type for data version; older element types didn't include
https://bitbucket.org/fathomteam/moab/commits/9522b060e29d/
Changeset: 9522b060e29d
Branch: master
User: vijaysm
Date: 2014-02-28 21:51:00
Summary: Merged in likask/moab/block_atributes_cubit_file_reading (pull request #15)
block attributes and block header for cubit file reader
Affected #: 2 files
diff --git a/src/MBTagConventions.hpp b/src/MBTagConventions.hpp
index 61e5732..5cb518f 100644
--- a/src/MBTagConventions.hpp
+++ b/src/MBTagConventions.hpp
@@ -108,6 +108,18 @@
#define NAME_TAG_NAME "NAME"
#define NAME_TAG_SIZE 32
+/* BLOCK_HEADER: tag
+ * A fixex lenght tag containg block header data
+ * BlockColor, MaterialId and BlockDimension
+ */
+#define BLOCK_HEADER "BLOCK_HEADER"
+
+/* BLOCK_ATTRIBUTES: tag
+ * A varible lenght tag of doubles
+ * Tag contains attributes set to BlockSet in cubit file
+ */
+#define BLOCK_ATTRIBUTES "BLOCK_ATTRIBUTES"
+
#ifndef MB_PARALLEL_CONVENTIONS_H
#define MB_PARALLEL_CONVENTIONS_H
diff --git a/src/io/Tqdcfr.cpp b/src/io/Tqdcfr.cpp
index afc0493..701ff15 100644
--- a/src/io/Tqdcfr.cpp
+++ b/src/io/Tqdcfr.cpp
@@ -592,7 +592,6 @@ ErrorCode Tqdcfr::read_nodeset(const unsigned int nsindex,
if (MB_SUCCESS != result) return result;
}
// check for more data
- // <- likask
if (num_read < nodeseth->nsLength) {
FREADC(2); num_read += 2;
if (char_buf[0] == 'i' && char_buf[1] == 'd') {
@@ -608,7 +607,7 @@ ErrorCode Tqdcfr::read_nodeset(const unsigned int nsindex,
}
}
- if(debug) { // <-likask
+ if(debug) {
nodeseth->print();
if(!bc_data.empty()) {
std::cout << "bc_data = ";
@@ -623,7 +622,7 @@ ErrorCode Tqdcfr::read_nodeset(const unsigned int nsindex,
}
std::cout << std::endl;
}
- } // <-likask
+ }
// and put entities into this nodeset's set
ErrorCode result = put_into_set(nodeseth->setHandle, ns_entities, excl_entities);
@@ -632,7 +631,6 @@ ErrorCode Tqdcfr::read_nodeset(const unsigned int nsindex,
result = get_names(model->nodesetMD, nsindex, nodeseth->setHandle);
if (MB_SUCCESS != result) return result;
- // <-likask
const int def_bc_data_len = 0;
std::string tag_name = std::string(DIRICHLET_SET_TAG_NAME)+"__BC_DATA";
Tag nbc_data;
@@ -761,7 +759,7 @@ ErrorCode Tqdcfr::read_sideset(const unsigned int ssindex,
}
}
- if(debug) { // <-likask
+ if(debug) {
sideseth->print();
if(!bc_data.empty()) {
std::cout << "bc_data = ";
@@ -776,12 +774,11 @@ ErrorCode Tqdcfr::read_sideset(const unsigned int ssindex,
}
std::cout << std::endl;
}
- } // <-likask
+ }
result = get_names(model->sidesetMD, ssindex, sideseth->setHandle);
if (MB_SUCCESS != result) return result;
- // <-likask
const int def_bc_data_len = 0;
std::string tag_name = std::string(NEUMANN_SET_TAG_NAME)+"__BC_DATA";
Tag nbc_data;
@@ -920,6 +917,7 @@ ErrorCode Tqdcfr::read_block(const unsigned int blindex,
Tqdcfr::ModelEntry *model,
Tqdcfr::BlockHeader *blockh)
{
+
if (blockh->memCt == 0) return MB_SUCCESS;
// position file
@@ -949,24 +947,20 @@ ErrorCode Tqdcfr::read_block(const unsigned int blindex,
ErrorCode result = put_into_set(blockh->setHandle, block_entities, excl_entities);
if (MB_SUCCESS != result) return result;
- // read attribs if there are any
+ // read attribs if there are any
+ Tag block_attribs;
+ {
+ int def_block_attributes_length = 0;
+ result = mdbImpl->tag_get_handle(BLOCK_ATTRIBUTES,def_block_attributes_length,MB_TYPE_DOUBLE,
+ block_attribs,MB_TAG_CREAT|MB_TAG_SPARSE|MB_TAG_VARLEN,NULL);
+ if (MB_SUCCESS != result && MB_ALREADY_ALLOCATED != result) return result;
+ }
if (blockh->attribOrder > 0) {
- Tag block_attribs;
-
+
FREADD(blockh->attribOrder); num_read += sizeof(double);
- // now do something with them...
- // This code seems broken. It is apparently supposed to read
- // blockh->attribOrder values for each block and store them in
- // a tag. However, blockh->attribOrder is not a constant
- // so the same fixed-length tag cannot be used for all blocks.
- // For now, just store one value, as that was what the buggy code
- // previously did.
- result = mdbImpl->tag_get_handle("Block_Attributes", 1/*blockh->attribOrder*/,
- MB_TYPE_DOUBLE, block_attribs,
- MB_TAG_SPARSE|MB_TAG_CREAT);
- if (MB_SUCCESS != result && MB_ALREADY_ALLOCATED != result) return result;
- result = mdbImpl->tag_set_data(block_attribs, &(blockh->setHandle), 1,
- &(dbl_buf[0]));
+ void const* tag_data[] = { &dbl_buf[0] };
+ int tag_sizes[] = { blockh->attribOrder };
+ result = mdbImpl->tag_set_by_ptr(block_attribs,&(blockh->setHandle),1,tag_data,tag_sizes);
if (MB_SUCCESS != result) return result;
}
@@ -1932,6 +1926,19 @@ ErrorCode Tqdcfr::BlockHeader::read_info_header(const double data_version,
block_headers[i].blockLength = instance->uint_buf[10];
block_headers[i].blockDim = instance->uint_buf[11];
+ Tag bhTag_header;
+ {
+ std::vector<int> def_uint_zero(3,0);
+ result = instance->mdbImpl->tag_get_handle(BLOCK_HEADER,3*sizeof(unsigned int),MB_TYPE_INTEGER,
+ bhTag_header,MB_TAG_CREAT|MB_TAG_SPARSE|MB_TAG_BYTES,&def_uint_zero[0]);
+ if (MB_SUCCESS != result) return result;
+ int block_header_data[] = { block_headers[i].blockCol, block_headers[i].blockMat, block_headers[i].blockDim };
+ result = instance->mdbImpl->tag_set_data(bhTag_header,&(block_headers[i].setHandle), 1,
+ block_header_data);
+ }
+
+ if (MB_SUCCESS != result) return result;
+
// adjust element type for data version; older element types didn't include
// 4 new trishell element types
if (data_version <= 1.0 && block_headers[i].blockElemType >= 15)
Repository URL: https://bitbucket.org/fathomteam/moab/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the moab-dev
mailing list