Commit d391d235 authored by T.J. Corona's avatar T.J. Corona
Browse files

Merge branch 'upstream-moab'

* upstream-moab:
  moab 2017-04-19 (d0741884)
parents 6eafb600 1e8d8178
/** \file DenseTag.cpp
* \author Jason Kraftcheck
* \author Jason Kraftcheck
* \date 2010-12-14
*/
......@@ -98,18 +98,6 @@ ErrorCode DenseTag::release_all_data(SequenceManager* seqman,
return result;
}
ErrorCode DenseTag::get_array(const SequenceManager* seqman,
Error* /* error */,
EntityHandle h,
const unsigned char* const& ptr,
size_t& count) const
{
// cast away the const-ness; do we really want to do this?
// probably we are not calling this anywhere;
// clang compiler found this
return get_array(seqman, NULL, h, const_cast<unsigned char *> ( ptr ), count);
}
ErrorCode DenseTag::get_array(const SequenceManager* seqman,
Error* /* error */,
EntityHandle h,
......@@ -140,14 +128,6 @@ ErrorCode DenseTag::get_array(const SequenceManager* seqman,
return MB_SUCCESS;
}
ErrorCode DenseTag::get_array(const EntitySequence* seq,
const unsigned char* const & ptr) const
{
// cast away the constness; otherwise it would be infinite recursion
// probably we are not calling this anywhere
return get_array(seq, const_cast<unsigned char *> ( ptr ));
}
ErrorCode DenseTag::get_array(const EntitySequence* seq,
const unsigned char* & ptr) const
{
......@@ -169,7 +149,7 @@ ErrorCode DenseTag::get_array(SequenceManager* seqman,
ErrorCode rval = seqman->find(h, seq);
if (MB_SUCCESS != rval) {
if (!h) { // Root set
if (!meshValue && allocate)
if (!meshValue && allocate)
meshValue = new unsigned char[get_size()];
ptr = meshValue;
count = 1;
......@@ -460,7 +440,7 @@ ErrorCode DenseTag::clear_data(bool allocate,
unsigned char* array = NULL;
size_t avail = 0;
for (Range::const_pair_iterator p = entities.const_pair_begin();
for (Range::const_pair_iterator p = entities.const_pair_begin();
p != entities.const_pair_end(); ++p) {
EntityHandle start = p->first;
while (start <= p->second) {
......@@ -567,12 +547,12 @@ ErrorCode DenseTag::get_tagged_entities(const SequenceManager* seqman,
TypeSequenceManager::const_iterator i;
for (EntityType t = range.first; t != range.second; ++t) {
const TypeSequenceManager& map = seqman->entity_map(t);
for (i = map.begin(); i != map.end(); ++i)
for (i = map.begin(); i != map.end(); ++i)
if ((*i)->data()->get_tag_data(mySequenceArray))
hint = entities->insert(hint, (*i)->start_handle(), (*i)->end_handle());
}
if (intersect_list)
if (intersect_list)
entities_in = intersect(*entities, *intersect_list);
return MB_SUCCESS;
......@@ -657,7 +637,7 @@ bool DenseTag::is_tagged(const SequenceManager* seqman, EntityHandle h) const
const unsigned char* ptr = NULL; // Initialize to get rid of warning
size_t count;
return (MB_SUCCESS == get_array(seqman, 0, h, ptr, count)) && (NULL != ptr);
}
}
ErrorCode DenseTag::get_memory_use(const SequenceManager* seqman,
unsigned long& total,
......
/** \file DenseTag.hpp
* \author Jason Kraftcheck
* \author Jason Kraftcheck
* \date 2010-12-14
*/
......@@ -11,33 +11,33 @@
namespace moab {
class EntitySequence;
/**\brief Dense storage of fixed-length tag data
*
* Implement normal dense tag.
*/
class DenseTag : public TagInfo
class DenseTag : public TagInfo
{
private:
int mySequenceArray; //!< Array index in SequenceManager used to store tag data.
unsigned char* meshValue;
DenseTag( int array_index,
const char * name,
int size,
DataType type,
const char * name,
int size,
DataType type,
const void * default_value );
public:
static
static
DenseTag* create_tag( SequenceManager* seqman,
Error* error,
const char* name,
int bytes,
DataType type,
const void* default_value );
virtual ~DenseTag();
virtual TagType get_storage_type() const;
......@@ -50,18 +50,18 @@ public:
* data associated with the tag in preparation for deleting
* the tag itself.
*
*\Note Invalidates tag if \c tag_delete_pending is true. The only
*\Note Invalidates tag if \c tag_delete_pending is true. The only
* valid method that can be invoked that is is the destructor.
*
*\param seqman Pointer to mesh entity database
*/
virtual ErrorCode release_all_data( SequenceManager* seqman,
Error* error_handler,
virtual ErrorCode release_all_data( SequenceManager* seqman,
Error* error_handler,
bool delete_pending );
/**\brief Get tag value for passed entities
*
*
* Get tag values for specified entities.
*
*\Note Will fail for variable-length data.
......@@ -73,13 +73,13 @@ public:
*/
virtual
ErrorCode get_data( const SequenceManager* seqman,
Error* error_handler,
Error* error_handler,
const EntityHandle* entities,
size_t num_entities,
void* data ) const;
/**\brief Get tag value for passed entities
*
*
* Get tag values for specified entities.
*
*\Note Will fail for variable-length data.
......@@ -90,12 +90,12 @@ public:
*/
virtual
ErrorCode get_data( const SequenceManager* seqman,
Error* error_handler,
Error* error_handler,
const Range& entities,
void* data ) const;
/**\brief Get tag value for passed entities
*
*
* Get tag values for specified entities.
*
*\param seqman Pointer to mesh entity database
......@@ -105,19 +105,19 @@ public:
* for each passed entity.
*\param data_lengths One value for each entity specifying the
* length of the tag value for the corresponding
* entity.
* entity.
*/
virtual
ErrorCode get_data( const SequenceManager* seqman,
Error* error_handler,
Error* error_handler,
const EntityHandle* entities,
size_t num_entities,
const void** data_ptrs,
int* data_lengths ) const ;
/**\brief Get tag value for passed entities
*
*
* Get tag values for specified entities.
*
*\param seqman Pointer to mesh entity database
......@@ -126,17 +126,17 @@ public:
* for each passed entity.
*\param data_lengths One value for each entity specifying the
* length of the tag value for the corresponding
* entity.
* entity.
*/
virtual
ErrorCode get_data( const SequenceManager* seqman,
Error* error_handler,
Error* error_handler,
const Range& entities,
const void** data_ptrs,
int* data_lengths ) const;
/**\brief Set tag value for passed entities
*
*
* Store tag data or update stored tag values
*\Note Will fail for variable-length data.
*\param seqman Pointer to mesh entity database
......@@ -147,13 +147,13 @@ public:
*/
virtual
ErrorCode set_data( SequenceManager* seqman,
Error* error_handler,
Error* error_handler,
const EntityHandle* entities,
size_t num_entities,
const void* data );
/**\brief Set tag value for passed entities
*
*
* Store tag data or update stored tag values
*\Note Will fail for variable-length data.
*\param seqman Pointer to mesh entity database
......@@ -163,12 +163,12 @@ public:
*/
virtual
ErrorCode set_data( SequenceManager* seqman,
Error* error_handler,
Error* error_handler,
const Range& entities,
const void* data );
/**\brief Set tag value for passed entities
*
*
* Store tag data or update stored tag values
*
*\param seqman Pointer to mesh entity database
......@@ -183,15 +183,15 @@ public:
*/
virtual
ErrorCode set_data( SequenceManager* seqman,
Error* error_handler,
Error* error_handler,
const EntityHandle* entities,
size_t num_entities,
void const* const* data_ptrs,
const int* data_lengths );
/**\brief Set tag value for passed entities
*
*
* Store tag data or update stored tag values
*
*\param seqman Pointer to mesh entity database
......@@ -205,13 +205,13 @@ public:
*/
virtual
ErrorCode set_data( SequenceManager* seqman,
Error* error_handler,
Error* error_handler,
const Range& entities,
void const* const* data_ptrs,
const int* data_lengths );
/**\brief Set tag value for passed entities
*
*
* Store tag data or update stored tag values.
*
*\param seqman Pointer to mesh entity database
......@@ -225,14 +225,14 @@ public:
*/
virtual
ErrorCode clear_data( SequenceManager* seqman,
Error* error_handler,
Error* error_handler,
const EntityHandle* entities,
size_t num_entities,
const void* value_ptr,
int value_len = 0 );
/**\brief Set tag value for passed entities
*
*
* Store tag data or update stored tag values.
*
*\param seqman Pointer to mesh entity database
......@@ -245,7 +245,7 @@ public:
*/
virtual
ErrorCode clear_data( SequenceManager* seqman,
Error* error_handler,
Error* error_handler,
const Range& entities,
const void* value_ptr,
int value_len = 0 );
......@@ -259,7 +259,7 @@ public:
*\param num_entities Length of \c entities array
*/
virtual ErrorCode remove_data( SequenceManager* seqman,
Error* error_handler,
Error* error_handler,
const EntityHandle* entities,
size_t num_entities );
......@@ -271,7 +271,7 @@ public:
*\param entities Entity handles for which to store tag data
*/
virtual ErrorCode remove_data( SequenceManager* seqman,
Error* error_handler,
Error* error_handler,
const Range& entities );
/**\brief Access tag data via direct pointer into contiguous blocks
......@@ -282,23 +282,23 @@ public:
* with variable length tags because it does not provide a mechanism
* to determine the length of the value for each entity. This
* function may be used with sparse tags, but if it is used, it
* will return data for a single entity at a time.
* will return data for a single entity at a time.
*
*\param iter As input, the first entity for which to return
* data. As output, one past the last entity for
* which data was returned.
*\param end One past the last entity for which data is desired
*\param data_ptr Output: pointer to tag storage.
*
*
*\Note If this function is called for entities for which no tag value
* has been set, but for which a default value exists, it will
* has been set, but for which a default value exists, it will
* force the allocation of explicit storage for each such entity
* even though MOAB would normally not explicitly store tag values
* for such entities.
*/
virtual
ErrorCode tag_iterate( SequenceManager* seqman,
Error* error_handler,
Error* error_handler,
Range::iterator& iter,
const Range::iterator& end,
void*& data_ptr,
......@@ -307,7 +307,7 @@ public:
/**\brief Get all tagged entities
*
* Get the list of entities for which the a tag value has been set,
* or a close approximation if the tag storage scheme cannot
* or a close approximation if the tag storage scheme cannot
* accurately determine exactly which entities have explicit values.
*
*\param seqman Pointer to entity storage database
......@@ -326,7 +326,7 @@ public:
/**\brief Count all tagged entities
*
* Count the entities for which the a tag value has been set,
* or a close approximation if the tag storage scheme cannot
* or a close approximation if the tag storage scheme cannot
* accurately determine exactly which entities have explicit values.
*
*\param seqman Pointer to entity storage database
......@@ -341,7 +341,7 @@ public:
size_t& output_count,
EntityType type = MBMAXTYPE,
const Range* intersect = 0 ) const;
/**\brief Get all tagged entities with tag value
*
* Get the list of entities which have the specified tag value.
......@@ -357,16 +357,16 @@ public:
*/
virtual
ErrorCode find_entities_with_value( const SequenceManager* seqman,
Error* error_handler,
Error* error_handler,
Range& output_entities,
const void* value,
int value_bytes = 0,
EntityType type = MBMAXTYPE,
const Range* intersect_entities = 0 ) const;
/**\brief Check if entity is tagged */
virtual bool is_tagged( const SequenceManager*, EntityHandle h ) const;
/**\brief Get memory use for tag data.
*
*/
......@@ -375,52 +375,19 @@ public:
unsigned long& total,
unsigned long& per_entity ) const;
/**\brief Get read-only tag storage
*
*\param seqman Sequence manager
*\param error Error object through which to report errors
*\param h First entity for which to return storage.
*\param ptr Pointer to dag storage. This pointer will be set
* to null and \c MB_SUCCESS will be returned if the handle
* is valid but no tag storage has been allocated.
*\param count Number of consecutive entities for which tag storage
* is returned. This value will be valid even if null
* is returned for \c ptr and indicates the number of
* consecutive entities for which no tag storage has been
* allocated.
*\return MB_SUCCESS if handle is valid (regardless of whether
* or not any tag storage is allocated).
*/
ErrorCode get_array( const SequenceManager* seqman,
Error* error,
EntityHandle h,
const unsigned char* const& ptr,
size_t& count ) const;
/**\brief Get read-only tag storage for entire sequence
*
*\param seq Sequence
*\param ptr Pointer to dag storage. This pointer will be set
* to null and \c MB_SUCCESS will be returned if no tag storage has been allocated.
*\return MB_SUCCESS if sequence is valid (regardless of whether
* or not any tag storage is allocated).
*/
ErrorCode get_array( const EntitySequence* seq,
const unsigned char* const& ptr) const;
/**\brief Get non-read-only tag storage for entire sequence
*
*\param seq Sequence
*\param seq Sequence
*\param ptr Pointer to dag storage. This pointer will be set
* to null and \c MB_SUCCESS will be returned if no tag storage has been allocated.
*\return MB_SUCCESS if sequence is valid (regardless of whether
* or not any tag storage is allocated).
* or not any tag storage is allocated).
*/
ErrorCode get_array( const EntitySequence* seq,
ErrorCode get_array( const EntitySequence* seq,
const unsigned char* & ptr) const;
private:
DenseTag( const DenseTag& );
DenseTag& operator=( const DenseTag& );
......@@ -438,12 +405,12 @@ private:
*\param allocate If true storage will be allocated and initialized
* if it has not already been allocated.
*\return MB_SUCCESS if handle is valid (regardless of whether
* or not any tag storage is allocated).
* or not any tag storage is allocated).
*/
inline
ErrorCode get_array( SequenceManager* seqman,
ErrorCode get_array( SequenceManager* seqman,
Error* error,
EntityHandle h,
EntityHandle h,
unsigned char*& ptr,
size_t& count,
bool allocate );
......@@ -460,15 +427,15 @@ private:
* consecutive entities for which no tag storage has been
* allocated.
*\return MB_SUCCESS if handle is valid (regardless of whether
* or not any tag storage is allocated).
* or not any tag storage is allocated).
*/
inline
ErrorCode get_array( const SequenceManager* seqman,
ErrorCode get_array( const SequenceManager* seqman,
Error* error,
EntityHandle h,
EntityHandle h,
const unsigned char*& ptr,
size_t& count ) const;
/**\brief Common implementation of public clear_data and remove_data */
ErrorCode clear_data( bool allocate,
SequenceManager* seqman,
......@@ -476,7 +443,7 @@ private:
const EntityHandle* entities,
size_t num_entities,
const void* value_ptr );
/**\brief Common implementation of public clear_data and remove_data */
ErrorCode clear_data( bool allocate,
SequenceManager* seqman,
......
/**
* MOAB, a Mesh-Oriented datABase, is a software component for creating,
* storing and accessing finite element mesh data.
*
*
* Copyright 2004 Sandia Corporation. Under the terms of Contract
* DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
* retains certain rights in this software.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
*
*/
//-------------------------------------------------------------------------
// Filename : WriteHDF5.cpp
//
// Purpose : TSTT HDF5 Writer
// Purpose : TSTT HDF5 Writer
//
// Special Notes : WriteSLAC used as template for this
//
......@@ -73,7 +73,7 @@
namespace moab {
template <typename T> inline
template <typename T> inline
void VALGRIND_MAKE_VEC_UNDEFINED(std::vector<T>& v) {
(void)v;
(void)VALGRIND_MAKE_MEM_UNDEFINED( (T*)&v[0], v.size() * sizeof(T));
......@@ -488,7 +488,7 @@ ErrorCode WriteHDF5::write_file(const char* filename,
dbgOut.set_verbosity(tmpval);
//writeTagDense = (MB_SUCCESS == opts.get_null_option("DENSE_TAGS"));
writeTagDense = true;
writeTagDense = true;
// Enable some extra checks for reads. Note: amongst other things this
// will print errors if the entire file is not read, so if doing a
......@@ -704,7 +704,7 @@ ErrorCode WriteHDF5::write_file_impl(const char* filename,
return error(result);
}
times[TAG_TIME] = timer.time_elapsed();
times[TOTAL_TIME] = timer.time_since_birth();
if (cputime) {
......@@ -953,7 +953,7 @@ ErrorCode WriteHDF5::write_nodes()
if (collectiveIO) {
while (remaining_writes--) {
assert(writeProp != H5P_DEFAULT);
#ifdef BLOCKED_COORD_IO
#ifdef BLOCKED_COORD_IO
for (int d = 0; d < dim; ++d) {
dbgOut.printf(3, " writing (empty) %c node chunk %ld of %ld.\n",
(char)('X' + d), num_writes - remaining_writes, num_writes);
......@@ -1148,7 +1148,7 @@ ErrorCode WriteHDF5::write_set_data(const WriteUtilIface::EntityListType which_d
if (ranged) rhint = ranged->begin();
if (null_stripped) nshint = null_stripped->begin();
for (size_t w = 0; w < num_total_writes; ++w) {
if (i == setSet.range.end() && !remaining.empty() && !remaining_ptr) {
if (i == setSet.range.end() && !remaining.empty() && !remaining_ptr) {
// If here, then we've written everything but we need to
// make more write calls because we're doing collective IO
// in parallel
......@@ -1504,7 +1504,7 @@ ErrorCode range_to_id_list_templ(HandleRangeIter begin,
ri = idMap.lower_bound(ri, idMap.end(), h);
if (ri == idMap.end() || ri->begin > h) {
rval = MB_ENTITY_NOT_FOUND;
*i = 0;
*i = 0;
++i;
++h;
continue;
......@@ -1675,7 +1675,7 @@ inline ErrorCode WriteHDF5::get_adjacencies(EntityHandle entity,
size_t j = 0;
adj.resize(num_adj);
for (int i = 0; i < num_adj; ++i)
for (int i = 0; i < num_adj; ++i)
if (wid_t id = idMap.find(adj_array[i]))
adj[j++] = id;
adj.resize(j);
......@@ -2893,7 +2893,7 @@ ErrorCode WriteHDF5::get_tag_data_length(const TagDesc& tag_info,
size_t step, remaining;
step = bufferSize / (sizeof(int) + sizeof(void*));
const void** ptr_buffer = reinterpret_cast<const void**>(dataBuffer);
int* size_buffer = reinterpret_cast<int*>(ptr_buffer + step);
int* size_buffer = reinterpret_cast<int*>(ptr_buffer + step);
Range subrange;
Range::const_iterator iter = range.begin();
for (remaining = range.size(); remaining >= step; remaining -= step) {
......@@ -3142,7 +3142,7 @@ void WriteHDF5::print_id_map(std::ostream& s, const char* pfx) const
<< " -> " << i->value << "-" << i->value + i->count - 1 << std::endl;
}
else {
s << pfx << n1 << " " << id << "-"
s << pfx << n1 << " " << id << "-"
<< n1 << " " << ID_FROM_HANDLE(i->begin + i->count - 1)
<< " -> " << i->value << "-" << i->value + i->count - 1 << std::endl;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment