Commit 6e0be7b7 authored by Kirill Terekhov's avatar Kirill Terekhov

Fixes

Fixed tiny bug that resulted in #8.
Fixed pmesh_test000 not compiling on windows.
Fixed pmf format not properly saving number of tags.
parent 89323375
......@@ -3130,7 +3130,7 @@ read_elem_num_link:
BeginModification();
while (!(in >> token).eof())
while (!(in >> token).eof() && !in.fail())
{
if( !start )
{
......@@ -4268,35 +4268,33 @@ safe_output:
iconv.write_fByteOrder(out);
iconv.write_fByteSize(out);
INMOST_DATA_ENUM_TYPE header[9] = {GetDimensions(), NumberOfNodes(), NumberOfEdges(), NumberOfFaces(), NumberOfCells(), NumberOfSets(), NumberOfTags()-3, m_state, GetProcessorRank()},k;
INMOST_DATA_ENUM_TYPE header[9] =
{
GetDimensions(),
NumberOfNodes(),
NumberOfEdges(),
NumberOfFaces(),
NumberOfCells(),
NumberOfSets(),
NumberOfTags()-2,
m_state,
GetProcessorRank()
},k;
for(k = 0; k < 9; k++) uconv.write_iValue(out,header[k]);
out.write(reinterpret_cast<char *>(remember),sizeof(remember));
Tag set_id = CreateTag("TEMPORARY_ELEMENT_ID",DATA_INTEGER,ESET|CELL|FACE|EDGE|NODE,NONE,1);
{
Storage::integer cur_num = 0;
for(Mesh::iteratorNode it = BeginNode(); it != EndNode(); ++it) it->IntegerDF(set_id) = cur_num++;
cur_num = 0;
for(Mesh::iteratorEdge it = BeginEdge(); it != EndEdge(); ++it) it->IntegerDF(set_id) = cur_num++;
cur_num = 0;
for(Mesh::iteratorFace it = BeginFace(); it != EndFace(); ++it) it->IntegerDF(set_id) = cur_num++;
cur_num = 0;
for(Mesh::iteratorCell it = BeginCell(); it != EndCell(); ++it) it->IntegerDF(set_id) = cur_num++;
cur_num = 0;
for(Mesh::iteratorSet it = BeginSet(); it != EndSet(); ++it) it->IntegerDF(set_id) = cur_num++;
}
// Tags
out << INMOST::TagsHeader;
uconv.write_iValue(out,header[6]);
REPORT_STR("TagsHeader");
REPORT_VAL("tag_size",header[6]);
int tags_written = 0;
for(Mesh::iteratorTag it = BeginTag(); it != EndTag(); it++)
{
//don't forget to change header[6] if you skip more
//should match with content after MeshDataHeader
if( *it == set_id ) continue;
if( *it == HighConnTag() ) continue;
if( *it == LowConnTag() ) continue;
......@@ -4317,7 +4315,25 @@ safe_output:
out.put(sparsemask);
out.put(definedmask);
uconv.write_iValue(out,datalength);
++tags_written;
}
assert(tags_written == header[6]);
Tag set_id = CreateTag("TEMPORARY_ELEMENT_ID",DATA_INTEGER,ESET|CELL|FACE|EDGE|NODE,NONE,1);
{
Storage::integer cur_num = 0;
for(Mesh::iteratorNode it = BeginNode(); it != EndNode(); ++it) it->IntegerDF(set_id) = cur_num++;
cur_num = 0;
for(Mesh::iteratorEdge it = BeginEdge(); it != EndEdge(); ++it) it->IntegerDF(set_id) = cur_num++;
cur_num = 0;
for(Mesh::iteratorFace it = BeginFace(); it != EndFace(); ++it) it->IntegerDF(set_id) = cur_num++;
cur_num = 0;
for(Mesh::iteratorCell it = BeginCell(); it != EndCell(); ++it) it->IntegerDF(set_id) = cur_num++;
cur_num = 0;
for(Mesh::iteratorSet it = BeginSet(); it != EndSet(); ++it) it->IntegerDF(set_id) = cur_num++;
}
// Nodes
out << INMOST::NodeHeader;
......
......@@ -90,7 +90,7 @@ namespace INMOST
bool flag = true;
const Storage::integer * recv = static_cast<const Storage::integer *>(static_cast<const void *>(data));
Storage::integer_array arr = e->IntegerArray(tag);
for(Storage::integer_array::iterator it = arr.begin(); it != arr.end(); it++)
for(Storage::integer_array::iterator it = arr.begin(); it != arr.end(); it+=2)
if( *it == recv[0] )
{
flag = false;
......@@ -1800,18 +1800,18 @@ namespace INMOST
}
for(int i = 0; i < GetProcessorRank(); i++) MPI_Barrier(comm);
file = fopen("skin.gmv","ab");
for(std::map< int, std::vector<Element *> >::iterator it = skin_faces.begin(); it != skin_faces.end(); it++)
for(std::vector<Element *>::iterator f = it->second.begin(); f != it->second.end(); f++)
for(proc_elements::iterator it = skin_faces.begin(); it != skin_faces.end(); it++)
for(element_set::iterator f = it->second.begin(); f != it->second.end(); f++)
{
adjacent<Node> fnodes = (*f)->getNodes();
ElementArray<Node> fnodes = Element(this,*f)->getNodes();
keynum = GetProcessorRank()*GetProcessorsNumber()+(it->first+1);
fwrite(&keynum,sizeof(Storage::integer),1,file);
keynum = static_cast<Storage::integer>(fnodes.size()); fwrite(&keynum,sizeof(Storage::integer),1,file);
for(adjacent<Node>::iterator fn = fnodes.begin(); fn != fnodes.end(); fn++)
for(ElementArray<Node>::iterator fn = fnodes.begin(); fn != fnodes.end(); fn++)
fwrite(&fn->Coords()[0],sizeof(Storage::real),1,file);
for(adjacent<Node>::iterator fn = fnodes.begin(); fn != fnodes.end(); fn++)
for(ElementArray<Node>::iterator fn = fnodes.begin(); fn != fnodes.end(); fn++)
fwrite(&fn->Coords()[1],sizeof(Storage::real),1,file);
for(adjacent<Node>::iterator fn = fnodes.begin(); fn != fnodes.end(); fn++)
for(ElementArray<Node>::iterator fn = fnodes.begin(); fn != fnodes.end(); fn++)
fwrite(&fn->Coords()[2],sizeof(Storage::real),1,file);
}
fclose(file);
......
......@@ -67,7 +67,7 @@ int main(int argc,char ** argv)
if( nproc == 2 ) // In case np=2 and simple box 3x3x3 these should cover the whole mesh, let's check that!
{
int mask[total];
int * mask = new int[total];
for (int i=0; i<total; i++) mask[i] = 0;
for(Mesh::iteratorCell it = m->BeginCell(); it != m->EndCell(); ++it)
{
......@@ -78,6 +78,7 @@ int main(int argc,char ** argv)
std::cout << "Check: proc: " << rank << ", cell: " << i << ((mask[i])? " duplicated" : " missing") << std::endl;
errors++;
}
delete [] mask;
}
delete m;
......
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