Ioss::IntVector Ioss::TriShell6::edge_connectivity(int edge_number) const { assert(edge_number > 0 && edge_number <= Constants::nedge); Ioss::IntVector connectivity(Constants::nedgenode); for (int i = 0; i < Constants::nedgenode; i++) { connectivity[i] = Constants::edge_node_order[edge_number - 1][i]; } return connectivity; }
Ioss::IntVector Ioss::Wedge16::face_connectivity(int face_number) const { assert(face_number > 0 && face_number <= number_faces()); Ioss::IntVector connectivity(number_nodes_face(face_number)); for (int i = 0; i < number_nodes_face(face_number); i++) { connectivity[i] = Constants::face_node_order[face_number - 1][i]; } return connectivity; }
Ioss::IntVector Ioss::TriShell6::face_connectivity(int face_number) const { assert(face_number > 0 && face_number <= number_faces()); Ioss::IntVector connectivity(Constants::nodes_per_face[face_number]); for (int i = 0; i < Constants::nodes_per_face[face_number]; i++) { connectivity[i] = Constants::face_node_order[face_number - 1][i]; } return connectivity; }
TEUCHOS_UNIT_TEST(tOrientation, testFaceBasis_tet) { out << note << std::endl; // basis to build patterns from RCP<Intrepid2::Basis<PHX::exec_space,double,double> > basisA = rcp(new Intrepid2::Basis_HGRAD_TET_C1_FEM<PHX::exec_space,double,double>); RCP<Intrepid2::Basis<PHX::exec_space,double,double> > basisB = rcp(new Intrepid2::Basis_HDIV_TET_I1_FEM<PHX::exec_space,double,double>); RCP<Intrepid2::Basis<PHX::exec_space,double,double> > basisC = rcp(new Intrepid2::Basis_HGRAD_TET_C2_FEM<PHX::exec_space,double,double>); // used further down RCP<const FieldPattern> patternA = rcp(new Intrepid2FieldPattern(basisA)); RCP<const FieldPattern> patternB = rcp(new Intrepid2FieldPattern(basisB)); RCP<const FieldPattern> patternC = rcp(new Intrepid2FieldPattern(basisC)); // used further down TEST_EQUALITY(patternA->numberIds(),4); TEST_EQUALITY(patternB->numberIds(),4); std::vector<std::vector<int> > topFaceIndices; orientation_helpers::computePatternFaceIndices(*patternA,topFaceIndices); TEST_EQUALITY(topFaceIndices.size(),4); TEST_EQUALITY(topFaceIndices[0].size(),3); TEST_EQUALITY(topFaceIndices[0][0],0); TEST_EQUALITY(topFaceIndices[0][1],1); TEST_EQUALITY(topFaceIndices[0][2],3); TEST_EQUALITY(topFaceIndices[1].size(),3); TEST_EQUALITY(topFaceIndices[1][0],1); TEST_EQUALITY(topFaceIndices[1][1],2); TEST_EQUALITY(topFaceIndices[1][2],3); TEST_EQUALITY(topFaceIndices[2].size(),3); TEST_EQUALITY(topFaceIndices[2][0],0); TEST_EQUALITY(topFaceIndices[2][1],3); TEST_EQUALITY(topFaceIndices[2][2],2); TEST_EQUALITY(topFaceIndices[3].size(),3); TEST_EQUALITY(topFaceIndices[3][0],0); TEST_EQUALITY(topFaceIndices[3][1],2); TEST_EQUALITY(topFaceIndices[3][2],1); // Topologically the first elements look like (shown by looking at each face), note // that the expected orientation is included as a +/- sign in the element // // // 7 7 7 2 // // / \ / \ / \ / \ // // / - \ / - \ / + \ / + \ // // / \ / \ / \ / \ // // 6 ----- 2 2 ----- 9 9 ----- 6 6 ----- 9 // // // // all that matters is the global // node numbering and the local ordering // The local ordering is defined by the following connectivity std::vector<std::vector<long> > connectivity(1); connectivity[0].resize(patternA->numberIds()); connectivity[0][0] = 6; connectivity[0][1] = 2; connectivity[0][2] = 9; connectivity[0][3] = 7; { std::vector<char> orientations(patternB->numberIds(),0); orientation_helpers::computeCellFaceOrientations(topFaceIndices, connectivity[0], *patternB, orientations); TEST_EQUALITY(orientations[0],char(-1)); TEST_EQUALITY(orientations[1],char(-1)); TEST_EQUALITY(orientations[2],char(1)); TEST_EQUALITY(orientations[3],char(1)); } }
Ioss::IntVector Ioss::ShellLine2D3::edge_connectivity(int edge_number) const { Ioss::IntVector connectivity(Constants::nedgenode); if (edge_number == 1) { connectivity[0] = 0; connectivity[1] = 1; connectivity[2] = 2; } else { connectivity[0] = 1; connectivity[1] = 0; connectivity[2] = 2; } return connectivity; }
//-------------------------------------------------------------------------- void PromotedElementIO::write_element_connectivity( const stk::mesh::PartVector& baseParts, const std::vector<stk::mesh::EntityId>& entityIds) { for(const auto* ip : baseParts) { const stk::mesh::Part& part = *ip; if(part.topology().rank() !=stk::topology::ELEM_RANK) { continue; } const auto& selector = metaData_.locally_owned_part() & part; const auto& elemBuckets = bulkData_.get_buckets(stk::topology::ELEM_RANK, selector); const size_t numSubElementsInBlock = num_sub_elements(nDim_, elemBuckets, elem_.polyOrder); const unsigned nodesPerLinearElem = elem_.nodesPerSubElement; std::vector<int64_t> connectivity(nodesPerLinearElem*numSubElementsInBlock); std::vector<int64_t> globalSubElementIds(numSubElementsInBlock); int connIndex = 0; unsigned subElementCounter = 0; for (const auto* ib: elemBuckets) { const stk::mesh::Bucket& b = *ib; const auto length = b.size(); for (size_t k = 0; k < length; ++k) { const auto* node_rels = b.begin_nodes(k); const auto& subElems = elem_.subElementConnectivity; const auto numberSubElements = subElems.size(); for (unsigned subElementIndex = 0; subElementIndex < numberSubElements; ++subElementIndex) { globalSubElementIds.at(subElementCounter) = entityIds[subElementCounter]; const auto& localIndices = subElems.at(subElementIndex); for (unsigned j = 0; j < nodesPerLinearElem; ++j) { connectivity[connIndex] = bulkData_.identifier(node_rels[localIndices[j]]); ++connIndex; } ++subElementCounter; } } } elementBlockPointers_.at(ip)->put_field_data("ids", globalSubElementIds); elementBlockPointers_.at(ip)->put_field_data("connectivity", connectivity); } }
void mesh_basic::fill_normal() { int const N_vertex=size_vertex(); if(size_normal()!=N_vertex) normal_data.resize(N_vertex); //init normal data to 0 for(auto& n : normal_data) n=vec3(); //walk through all the triangles and add each triangle normal to the vertices int const N_triangle=size_connectivity(); for(int k_triangle=0;k_triangle<N_triangle;++k_triangle) { //get current triangle index triangle_index const& tri=connectivity(k_triangle); //check that the index given have correct values ASSERT_CPE(tri.u0()>=0 && tri.u0()<N_vertex,"Incorrect triangle index"); ASSERT_CPE(tri.u1()>=0 && tri.u1()<N_vertex,"Incorrect triangle index"); ASSERT_CPE(tri.u2()>=0 && tri.u2()<N_vertex,"Incorrect triangle index"); //compute current normal vec3 const& p0=vertex(tri.u0()); vec3 const& p1=vertex(tri.u1()); vec3 const& p2=vertex(tri.u2()); vec3 const u1=normalized(p1-p0); vec3 const u2=normalized(p2-p0); vec3 const n=normalized(cross(u1,u2)); //add the computed normal to the normal_data for(int kv=0;kv<3;++kv) normal_data[tri[kv]] += n; } //normalize all normal value for(auto& n : normal_data) n=normalized(n); }
void MeshUtility::calculateNormals(Vector3* vertices, UINT8* indices, UINT32 numVertices, UINT32 numIndices, Vector3* normals, UINT32 indexSize) { UINT32 numFaces = numIndices / 3; Vector3* faceNormals = bs_newN<Vector3>(numFaces); for (UINT32 i = 0; i < numFaces; i++) { UINT32 triangle[3]; memcpy(&triangle[0], indices + (i * 3 + 0) * indexSize, indexSize); memcpy(&triangle[1], indices + (i * 3 + 1) * indexSize, indexSize); memcpy(&triangle[2], indices + (i * 3 + 2) * indexSize, indexSize); Vector3 edgeA = vertices[triangle[1]] - vertices[triangle[0]]; Vector3 edgeB = vertices[triangle[2]] - vertices[triangle[0]]; faceNormals[i] = Vector3::normalize(Vector3::cross(edgeA, edgeB)); // Note: Potentially don't normalize here in order to weigh the normals // by triangle size } VertexConnectivity connectivity(indices, numVertices, numFaces, indexSize); for (UINT32 i = 0; i < numVertices; i++) { VertexFaces& faces = connectivity.vertexFaces[i]; normals[i] = Vector3::ZERO; for (UINT32 j = 0; j < faces.numFaces; j++) { UINT32 faceIdx = faces.faces[j]; normals[i] += faceNormals[faceIdx]; } normals[i].normalize(); } bs_deleteN(faceNormals, numFaces); }
void MeshUtility::calculateTangents(Vector3* vertices, Vector3* normals, Vector2* uv, UINT8* indices, UINT32 numVertices, UINT32 numIndices, Vector3* tangents, Vector3* bitangents, UINT32 indexSize, UINT32 vertexStride) { UINT32 numFaces = numIndices / 3; UINT32 vec2Stride = vertexStride == 0 ? sizeof(Vector2) : vertexStride; UINT32 vec3Stride = vertexStride == 0 ? sizeof(Vector3) : vertexStride; UINT8* positionBytes = (UINT8*)vertices; UINT8* normalBytes = (UINT8*)normals; UINT8* uvBytes = (UINT8*)uv; Vector3* faceTangents = bs_newN<Vector3>(numFaces); Vector3* faceBitangents = bs_newN<Vector3>(numFaces); for (UINT32 i = 0; i < numFaces; i++) { UINT32 triangle[3]; memcpy(&triangle[0], indices + (i * 3 + 0) * indexSize, indexSize); memcpy(&triangle[1], indices + (i * 3 + 1) * indexSize, indexSize); memcpy(&triangle[2], indices + (i * 3 + 2) * indexSize, indexSize); Vector3 p0 = *(Vector3*)&positionBytes[triangle[0] * vec3Stride]; Vector3 p1 = *(Vector3*)&positionBytes[triangle[1] * vec3Stride]; Vector3 p2 = *(Vector3*)&positionBytes[triangle[2] * vec3Stride]; Vector2 uv0 = *(Vector2*)&uvBytes[triangle[0] * vec2Stride]; Vector2 uv1 = *(Vector2*)&uvBytes[triangle[1] * vec2Stride]; Vector2 uv2 = *(Vector2*)&uvBytes[triangle[2] * vec2Stride]; Vector3 q0 = p1 - p0; Vector3 q1 = p2 - p0; Vector2 st1 = uv1 - uv0; Vector2 st2 = uv2 - uv0; float denom = st1.x * st2.y - st2.x * st1.y; if (fabs(denom) >= 0e-8f) { float r = 1.0f / denom; faceTangents[i] = (st2.y * q0 - st1.y * q1) * r; faceBitangents[i] = (st1.x * q1 - st2.x * q0) * r; faceTangents[i].normalize(); faceBitangents[i].normalize(); } // Note: Potentially don't normalize here in order to weight the normals by triangle size } VertexConnectivity connectivity(indices, numVertices, numFaces, indexSize); for (UINT32 i = 0; i < numVertices; i++) { VertexFaces& faces = connectivity.vertexFaces[i]; tangents[i] = Vector3::ZERO; bitangents[i] = Vector3::ZERO; for (UINT32 j = 0; j < faces.numFaces; j++) { UINT32 faceIdx = faces.faces[j]; tangents[i] += faceTangents[faceIdx]; bitangents[i] += faceBitangents[faceIdx]; } tangents[i].normalize(); bitangents[i].normalize(); Vector3 normal = *(Vector3*)&normalBytes[i * vec3Stride]; // Orthonormalize float dot0 = normal.dot(tangents[i]); tangents[i] -= dot0*normal; tangents[i].normalize(); float dot1 = tangents[i].dot(bitangents[i]); dot0 = normal.dot(bitangents[i]); bitangents[i] -= dot0*normal + dot1*tangents[i]; bitangents[i].normalize(); } bs_deleteN(faceTangents, numFaces); bs_deleteN(faceBitangents, numFaces); // TODO - Consider weighing tangents by triangle size and/or edge angles }
DTKAdapter::DTKAdapter(Teuchos::RCP<const Teuchos::Comm<int> > in_comm, EquationSystems & in_es): comm(in_comm), es(in_es), mesh(in_es.get_mesh()), dim(mesh.mesh_dimension()) { std::set<unsigned int> semi_local_nodes; get_semi_local_nodes(semi_local_nodes); num_local_nodes = semi_local_nodes.size(); vertices.resize(num_local_nodes); Teuchos::ArrayRCP<double> coordinates(num_local_nodes * dim); // Fill in the vertices and coordinates { unsigned int i = 0; for(std::set<unsigned int>::iterator it = semi_local_nodes.begin(); it != semi_local_nodes.end(); ++it) { const Node & node = mesh.node(*it); vertices[i] = node.id(); for(unsigned int j=0; j<dim; j++) coordinates[(j*num_local_nodes) + i] = node(j); i++; } } // Currently assuming all elements are the same! DataTransferKit::DTK_ElementTopology element_topology = get_element_topology(mesh.elem(0)); unsigned int n_nodes_per_elem = mesh.elem(0)->n_nodes(); unsigned int n_local_elem = mesh.n_local_elem(); Teuchos::ArrayRCP<int> elements(n_local_elem); Teuchos::ArrayRCP<int> connectivity(n_nodes_per_elem*n_local_elem); // Fill in the elements and connectivity { unsigned int i = 0; MeshBase::const_element_iterator end = mesh.local_elements_end(); for(MeshBase::const_element_iterator it = mesh.local_elements_begin(); it != end; ++it) { const Elem & elem = *(*it); elements[i] = elem.id(); for(unsigned int j=0; j<n_nodes_per_elem; j++) connectivity[(j*n_local_elem)+i] = elem.node(j); i++; } } Teuchos::ArrayRCP<int> permutation_list(n_nodes_per_elem); for (unsigned int i = 0; i < n_nodes_per_elem; ++i ) permutation_list[i] = i; /* if(this->processor_id() == 1) sleep(1); libMesh::out<<"n_nodes_per_elem: "<<n_nodes_per_elem<<std::endl; libMesh::out<<"Dim: "<<dim<<std::endl; libMesh::err<<"Vertices size: "<<vertices.size()<<std::endl; { libMesh::err<<this->processor_id()<<" Vertices: "; for(unsigned int i=0; i<vertices.size(); i++) libMesh::err<<vertices[i]<<" "; libMesh::err<<std::endl; } libMesh::err<<"Coordinates size: "<<coordinates.size()<<std::endl; { libMesh::err<<this->processor_id()<<" Coordinates: "; for(unsigned int i=0; i<coordinates.size(); i++) libMesh::err<<coordinates[i]<<" "; libMesh::err<<std::endl; } libMesh::err<<"Connectivity size: "<<connectivity.size()<<std::endl; { libMesh::err<<this->processor_id()<<" Connectivity: "; for(unsigned int i=0; i<connectivity.size(); i++) libMesh::err<<connectivity[i]<<" "; libMesh::err<<std::endl; } libMesh::err<<"Permutation_List size: "<<permutation_list.size()<<std::endl; { libMesh::err<<this->processor_id()<<" Permutation_List: "; for(unsigned int i=0; i<permutation_list.size(); i++) libMesh::err<<permutation_list[i]<<" "; libMesh::err<<std::endl; } */ Teuchos::RCP<MeshContainerType> mesh_container = Teuchos::rcp( new MeshContainerType(dim, vertices, coordinates, element_topology, n_nodes_per_elem, elements, connectivity, permutation_list) ); // We only have 1 element topology in this grid so we make just one mesh block Teuchos::ArrayRCP<Teuchos::RCP<MeshContainerType> > mesh_blocks(1); mesh_blocks[0] = mesh_container; // Create the MeshManager mesh_manager = Teuchos::rcp(new DataTransferKit::MeshManager<MeshContainerType>(mesh_blocks, comm, dim) ); // Pack the coordinates into a field, this will be the positions we'll ask for other systems fields at target_coords = Teuchos::rcp(new DataTransferKit::FieldManager<MeshContainerType>(mesh_container, comm)); }
// Block now checks to see if nodes i and j are connected and, if // so, uses our alternative spring function. loos::DoubleMatrix block(const uint j, const uint i) { if (connectivity(j, i)) return(blockImpl(j, i, bound_spring)); else return(decorated->block(j, i)); }
Ioss::IntVector Ioss::Edge2::edge_connectivity(int /* edge_number */) const { Ioss::IntVector connectivity(Constants::nedgenode); return connectivity; }
void grpc_end2end_tests(int argc, char **argv, grpc_end2end_test_config config) { int i; GPR_ASSERT(g_pre_init_called); if (argc <= 1) { authority_not_supported(config); bad_hostname(config); binary_metadata(config); call_creds(config); cancel_after_accept(config); cancel_after_client_done(config); cancel_after_invoke(config); cancel_before_invoke(config); cancel_in_a_vacuum(config); cancel_with_status(config); compressed_payload(config); connectivity(config); default_host(config); disappearing_server(config); empty_batch(config); filter_call_init_fails(config); filter_causes_close(config); filter_latency(config); graceful_server_shutdown(config); high_initial_seqno(config); hpack_size(config); idempotent_request(config); invoke_large_request(config); large_metadata(config); load_reporting_hook(config); max_concurrent_streams(config); max_message_length(config); negative_deadline(config); network_status_change(config); no_logging(config); no_op(config); payload(config); ping(config); ping_pong_streaming(config); registered_call(config); request_with_flags(config); request_with_payload(config); resource_quota_server(config); server_finishes_request(config); shutdown_finishes_calls(config); shutdown_finishes_tags(config); simple_cacheable_request(config); simple_delayed_request(config); simple_metadata(config); simple_request(config); streaming_error_response(config); trailing_metadata(config); return; } for (i = 1; i < argc; i++) { if (0 == strcmp("authority_not_supported", argv[i])) { authority_not_supported(config); continue; } if (0 == strcmp("bad_hostname", argv[i])) { bad_hostname(config); continue; } if (0 == strcmp("binary_metadata", argv[i])) { binary_metadata(config); continue; } if (0 == strcmp("call_creds", argv[i])) { call_creds(config); continue; } if (0 == strcmp("cancel_after_accept", argv[i])) { cancel_after_accept(config); continue; } if (0 == strcmp("cancel_after_client_done", argv[i])) { cancel_after_client_done(config); continue; } if (0 == strcmp("cancel_after_invoke", argv[i])) { cancel_after_invoke(config); continue; } if (0 == strcmp("cancel_before_invoke", argv[i])) { cancel_before_invoke(config); continue; } if (0 == strcmp("cancel_in_a_vacuum", argv[i])) { cancel_in_a_vacuum(config); continue; } if (0 == strcmp("cancel_with_status", argv[i])) { cancel_with_status(config); continue; } if (0 == strcmp("compressed_payload", argv[i])) { compressed_payload(config); continue; } if (0 == strcmp("connectivity", argv[i])) { connectivity(config); continue; } if (0 == strcmp("default_host", argv[i])) { default_host(config); continue; } if (0 == strcmp("disappearing_server", argv[i])) { disappearing_server(config); continue; } if (0 == strcmp("empty_batch", argv[i])) { empty_batch(config); continue; } if (0 == strcmp("filter_call_init_fails", argv[i])) { filter_call_init_fails(config); continue; } if (0 == strcmp("filter_causes_close", argv[i])) { filter_causes_close(config); continue; } if (0 == strcmp("filter_latency", argv[i])) { filter_latency(config); continue; } if (0 == strcmp("graceful_server_shutdown", argv[i])) { graceful_server_shutdown(config); continue; } if (0 == strcmp("high_initial_seqno", argv[i])) { high_initial_seqno(config); continue; } if (0 == strcmp("hpack_size", argv[i])) { hpack_size(config); continue; } if (0 == strcmp("idempotent_request", argv[i])) { idempotent_request(config); continue; } if (0 == strcmp("invoke_large_request", argv[i])) { invoke_large_request(config); continue; } if (0 == strcmp("large_metadata", argv[i])) { large_metadata(config); continue; } if (0 == strcmp("load_reporting_hook", argv[i])) { load_reporting_hook(config); continue; } if (0 == strcmp("max_concurrent_streams", argv[i])) { max_concurrent_streams(config); continue; } if (0 == strcmp("max_message_length", argv[i])) { max_message_length(config); continue; } if (0 == strcmp("negative_deadline", argv[i])) { negative_deadline(config); continue; } if (0 == strcmp("network_status_change", argv[i])) { network_status_change(config); continue; } if (0 == strcmp("no_logging", argv[i])) { no_logging(config); continue; } if (0 == strcmp("no_op", argv[i])) { no_op(config); continue; } if (0 == strcmp("payload", argv[i])) { payload(config); continue; } if (0 == strcmp("ping", argv[i])) { ping(config); continue; } if (0 == strcmp("ping_pong_streaming", argv[i])) { ping_pong_streaming(config); continue; } if (0 == strcmp("registered_call", argv[i])) { registered_call(config); continue; } if (0 == strcmp("request_with_flags", argv[i])) { request_with_flags(config); continue; } if (0 == strcmp("request_with_payload", argv[i])) { request_with_payload(config); continue; } if (0 == strcmp("resource_quota_server", argv[i])) { resource_quota_server(config); continue; } if (0 == strcmp("server_finishes_request", argv[i])) { server_finishes_request(config); continue; } if (0 == strcmp("shutdown_finishes_calls", argv[i])) { shutdown_finishes_calls(config); continue; } if (0 == strcmp("shutdown_finishes_tags", argv[i])) { shutdown_finishes_tags(config); continue; } if (0 == strcmp("simple_cacheable_request", argv[i])) { simple_cacheable_request(config); continue; } if (0 == strcmp("simple_delayed_request", argv[i])) { simple_delayed_request(config); continue; } if (0 == strcmp("simple_metadata", argv[i])) { simple_metadata(config); continue; } if (0 == strcmp("simple_request", argv[i])) { simple_request(config); continue; } if (0 == strcmp("streaming_error_response", argv[i])) { streaming_error_response(config); continue; } if (0 == strcmp("trailing_metadata", argv[i])) { trailing_metadata(config); continue; } gpr_log(GPR_DEBUG, "not a test: '%s'", argv[i]); abort(); } }
/*! * \brief Get the wave mesh. */ Teuchos::RCP<DataTransferKit::MeshManager<WaveAdapter::MeshType> > WaveAdapter::getMesh( const RCP_Wave& wave ) { // Get the process rank. int my_rank = wave->get_comm()->getRank(); // Set the vertex dimension - this is a 1D problem. int vertex_dimension = 1; // Compute globally unique vertex ids. Teuchos::RCP<std::vector<double> > grid = wave->get_grid(); Teuchos::ArrayRCP<int> vertices( grid->size() ); for ( int i = 0; i < (int) vertices.size(); ++i ) { vertices[i] = i + my_rank*vertices.size(); } // Get the grid vertex coordinates. Teuchos::ArrayRCP<double> coordinates( &(*grid)[0], 0, grid->size(), false ); // Set the grid topology - this is 1D so we are using line segments. DataTransferKit::DTK_ElementTopology element_topology = DataTransferKit::DTK_LINE_SEGMENT; // Each line segment will be constructed by 2 vertices. int vertices_per_element = 2; // Compute globally unique element ids. Teuchos::ArrayRCP<int> elements( grid->size() - 1 ); for ( int i = 0; i < (int) elements.size(); ++i ) { elements[i] = i + my_rank*elements.size(); } // Generate element connectivity. The global vertex ids are used to // describe the construction of each line segment. Teuchos::ArrayRCP<int> connectivity( vertices_per_element*elements.size() ); for ( int i = 0; i < (int) elements.size(); ++i ) { connectivity[i] = vertices[i]; connectivity[ elements.size() + i ] = vertices[i+1]; } // Define the permutation list. Here our line segments are ordered the // same as DTK canonical ordering so the list is an monotonically // increasing set of integers. Teuchos::ArrayRCP<int> permutation_list( vertices_per_element ); for ( int i = 0; i < vertices_per_element; ++i ) { permutation_list[i] = i; } // Build a DTK Mesh container with the data. The MeshType typedef is set // in the header file. Teuchos::RCP<MeshType> mesh_container = Teuchos::rcp( new MeshType( vertex_dimension, vertices, coordinates, element_topology, vertices_per_element, elements, connectivity, permutation_list ) ); // We only have 1 element topology in this grid so we make just one mesh // block. Teuchos::ArrayRCP<Teuchos::RCP<MeshType> > mesh_blocks( 1 ); mesh_blocks[0] = mesh_container; // Return a mesh manager. return Teuchos::rcp( new DataTransferKit::MeshManager<MeshType>( mesh_blocks, wave->get_comm(), 1 ) ); }
Ioss::IntVector Ioss::Super::edge_connectivity(int edge_number) const { Ioss::IntVector connectivity(0); return connectivity; }
/* * \brief This constructor will pull the mesh data DTK needs out of Moab, * partition it for the example, and build a DataTransferKit::MeshContainer * object from the local data in the partition. You can directly write the * traits interface yourself, but this is probably the easiest way to get * started (although potentially inefficient). */ MoabMesh::MoabMesh( const RCP_Comm& comm, const std::string& filename, const moab::EntityType& block_topology, const int partitioning_type ) : d_comm( comm ) { // Compute the node dimension. int node_dim = 0; if ( block_topology == moab::MBTRI ) { node_dim = 2; } else if ( block_topology == moab::MBQUAD ) { node_dim = 2; } else if ( block_topology == moab::MBTET ) { node_dim = 3; } else if ( block_topology == moab::MBHEX ) { node_dim = 3; } else if ( block_topology == moab::MBPYRAMID ) { node_dim = 3; } else { node_dim = 0; } // Create a moab instance. moab::ErrorCode error; d_moab = Teuchos::rcp( new moab::Core() ); std::cout<<"Filename: "<<filename<<std::endl; // Load the mesh. d_moab->load_mesh( &filename[0] ); moab::EntityHandle root_set = d_moab->get_root_set(); // Extract the elements with this block's topology. std::vector<moab::EntityHandle> global_elements; error = d_moab->get_entities_by_type( root_set, block_topology, global_elements ); assert( error == moab::MB_SUCCESS ); std::cout<<"Global elements: "<<global_elements.size()<<std::endl; // Partition the mesh. int comm_size = d_comm->getSize(); int comm_rank = d_comm->getRank(); // Get the number of nodes in an element. std::vector<moab::EntityHandle> elem_vertices; error = d_moab->get_adjacencies( &global_elements[0], 1, 0, false, elem_vertices ); assert( error == moab::MB_SUCCESS ); int nodes_per_element = elem_vertices.size(); // Get the global element coordinates. std::vector<double> global_coords; error = d_moab->get_vertex_coordinates( global_coords ); assert( error == moab::MB_SUCCESS ); // Get the global max and min values for the coordinates. This problem is // symmetric. double min = *(std::min_element( global_coords.begin(), global_coords.end() ) ); double max = *(std::max_element( global_coords.begin(), global_coords.end() ) ); double width = max - min; Teuchos::Array<moab::EntityHandle> elements; elem_vertices.resize( nodes_per_element ); std::vector<double> elem_coords( 3*nodes_per_element ); std::vector<moab::EntityHandle>::const_iterator global_elem_iterator; for ( global_elem_iterator = global_elements.begin(); global_elem_iterator != global_elements.end(); ++global_elem_iterator ) { // Get the individual element vertices. error = d_moab->get_adjacencies( &*global_elem_iterator, 1, 0, false, elem_vertices ); assert( error == moab::MB_SUCCESS ); // Get the invidivual element coordinates. error = d_moab->get_coords( &elem_vertices[0], elem_vertices.size(), &elem_coords[0] ); assert( error == moab::MB_SUCCESS ); // Partition in x direction. if ( partitioning_type == 0 ) { for ( int i = 0; i < comm_size; ++i ) { if ( elem_coords[0] >= min + width*(comm_rank)/comm_size - 1e-6 && elem_coords[0] <= min + width*(comm_rank+1)/comm_size + 1e-6 ) { elements.push_back( *global_elem_iterator ); } } } // Partition in y direction. else if ( partitioning_type == 1 ) { for ( int i = 0; i < comm_size; ++i ) { if ( elem_coords[1] >= min + width*(comm_rank)/comm_size - 1e-6 && elem_coords[1] <= min + width*(comm_rank+1)/comm_size + 1e-6 ) { elements.push_back( *global_elem_iterator ); } } } else { throw std::logic_error( "Partitioning type not supported." ); } } Teuchos::ArrayRCP<moab::EntityHandle> elements_arcp( elements.size() ); std::copy( elements.begin(), elements.end(), elements_arcp.begin() ); elements.clear(); d_comm->barrier(); // Get the nodes. std::vector<moab::EntityHandle> vertices; error = d_moab->get_connectivity( &elements_arcp[0], elements_arcp.size(), vertices ); assert( error == moab::MB_SUCCESS ); d_vertices = Teuchos::ArrayRCP<moab::EntityHandle>( vertices.size() ); std::copy( vertices.begin(), vertices.end(), d_vertices.begin() ); vertices.clear(); // Get the node coordinates. Teuchos::ArrayRCP<double> coords( node_dim * d_vertices.size() ); std::vector<double> interleaved_coords( 3*d_vertices.size() ); error = d_moab->get_coords( &d_vertices[0], d_vertices.size(), &interleaved_coords[0] ); assert( error == moab::MB_SUCCESS ); for ( int n = 0; n < (int) d_vertices.size(); ++n ) { for ( int d = 0; d < (int) node_dim; ++d ) { coords[ d*d_vertices.size() + n ] = interleaved_coords[ n*3 + d ]; } } interleaved_coords.clear(); // Get the connectivity. int connectivity_size = elements_arcp.size() * nodes_per_element; Teuchos::ArrayRCP<moab::EntityHandle> connectivity( connectivity_size ); std::vector<moab::EntityHandle> elem_conn; for ( int i = 0; i < (int) elements_arcp.size(); ++i ) { error = d_moab->get_connectivity( &elements_arcp[i], 1, elem_conn ); assert( error == moab::MB_SUCCESS ); assert( elem_conn.size() == Teuchos::as<std::vector<moab::EntityHandle>::size_type>(nodes_per_element) ); for ( int n = 0; n < (int) elem_conn.size(); ++n ) { connectivity[ n*elements_arcp.size() + i ] = elem_conn[n]; } } // Get the permutation vector. Teuchos::ArrayRCP<int> permutation_list( nodes_per_element ); for ( int i = 0; i < (int) nodes_per_element; ++i ) { permutation_list[i] = i; } // Create the mesh container. d_mesh_container = Teuchos::rcp( new Container( node_dim, d_vertices, coords, getTopology(block_topology), nodes_per_element, elements_arcp, connectivity, permutation_list ) ); }
TEUCHOS_UNIT_TEST(tOrientation, testFaceBasis_hex) { out << note << std::endl; // basis to build patterns from RCP<Intrepid2::Basis<PHX::exec_space,double,double> > basisA = rcp(new Intrepid2::Basis_HGRAD_HEX_C1_FEM<PHX::exec_space,double,double>); RCP<Intrepid2::Basis<PHX::exec_space,double,double> > basisB = rcp(new Intrepid2::Basis_HDIV_HEX_I1_FEM<PHX::exec_space,double,double>); RCP<Intrepid2::Basis<PHX::exec_space,double,double> > basisC = rcp(new Intrepid2::Basis_HGRAD_HEX_C2_FEM<PHX::exec_space,double,double>); // used further down RCP<const FieldPattern> patternA = rcp(new Intrepid2FieldPattern(basisA)); RCP<const FieldPattern> patternB = rcp(new Intrepid2FieldPattern(basisB)); RCP<const FieldPattern> patternC = rcp(new Intrepid2FieldPattern(basisC)); // used further down TEST_EQUALITY(patternA->numberIds(),8); TEST_EQUALITY(patternB->numberIds(),6); std::vector<std::vector<int> > topFaceIndices; orientation_helpers::computePatternFaceIndices(*patternA,topFaceIndices); // this checks to ensure that each face is oriented in a counter clockwise direction TEST_EQUALITY(topFaceIndices.size(),6); TEST_EQUALITY(topFaceIndices[0].size(),4); TEST_EQUALITY(topFaceIndices[0][0],0); TEST_EQUALITY(topFaceIndices[0][1],1); TEST_EQUALITY(topFaceIndices[0][2],5); TEST_EQUALITY(topFaceIndices[0][3],4); TEST_EQUALITY(topFaceIndices[1].size(),4); TEST_EQUALITY(topFaceIndices[1][0],1); TEST_EQUALITY(topFaceIndices[1][1],2); TEST_EQUALITY(topFaceIndices[1][2],6); TEST_EQUALITY(topFaceIndices[1][3],5); TEST_EQUALITY(topFaceIndices[2].size(),4); TEST_EQUALITY(topFaceIndices[2][0],2); TEST_EQUALITY(topFaceIndices[2][1],3); TEST_EQUALITY(topFaceIndices[2][2],7); TEST_EQUALITY(topFaceIndices[2][3],6); TEST_EQUALITY(topFaceIndices[3].size(),4); TEST_EQUALITY(topFaceIndices[3][0],0); TEST_EQUALITY(topFaceIndices[3][1],4); TEST_EQUALITY(topFaceIndices[3][2],7); TEST_EQUALITY(topFaceIndices[3][3],3); TEST_EQUALITY(topFaceIndices[4].size(),4); TEST_EQUALITY(topFaceIndices[4][0],0); TEST_EQUALITY(topFaceIndices[4][1],3); TEST_EQUALITY(topFaceIndices[4][2],2); TEST_EQUALITY(topFaceIndices[4][3],1); TEST_EQUALITY(topFaceIndices[5].size(),4); TEST_EQUALITY(topFaceIndices[5][0],4); TEST_EQUALITY(topFaceIndices[5][1],5); TEST_EQUALITY(topFaceIndices[5][2],6); TEST_EQUALITY(topFaceIndices[5][3],7); // Topologically the first elements look like (shown by looking at each face), note // that the expected orientation is included as a +/- sign in the element // // 0 ----- 8 8 ----- 9 9 ----- 1 // | | | | | | // | + | | + | | - | // | | | | | | // 5 ----- 2 2 ----- 6 6 ----- 7 // // 1 ----- 0 5 ----- 2 1 ----- 9 // | | | | | | // | + | | + | | - | // | | | | | | // 7 ----- 5 7 ----- 6 0 ----- 8 // // all that matters is the global // node numbering and the local ordering // The local ordering is defined by the following connectivity std::vector<std::vector<long> > connectivity(1); connectivity[0].resize(patternA->numberIds()); connectivity[0][0] = 5; connectivity[0][1] = 2; connectivity[0][2] = 6; connectivity[0][3] = 7; connectivity[0][4] = 0; connectivity[0][5] = 8; connectivity[0][6] = 9; connectivity[0][7] = 1; { std::vector<char> orientations(patternB->numberIds(),0); orientation_helpers::computeCellFaceOrientations(topFaceIndices, connectivity[0], *patternB, orientations); TEST_EQUALITY(orientations[0],char(1)); TEST_EQUALITY(orientations[1],char(1)); TEST_EQUALITY(orientations[2],char(-1)); TEST_EQUALITY(orientations[3],char(1)); TEST_EQUALITY(orientations[4],char(1)); TEST_EQUALITY(orientations[5],char(-1)); } }
TEUCHOS_UNIT_TEST(tOrientation, testEdgeBasis_tri) { out << note << std::endl; // basis to build patterns from RCP<Intrepid2::Basis<PHX::exec_space,double,double> > basisA = rcp(new Intrepid2::Basis_HGRAD_TRI_C1_FEM<PHX::exec_space,double,double>); RCP<Intrepid2::Basis<PHX::exec_space,double,double> > basisB = rcp(new Intrepid2::Basis_HCURL_TRI_I1_FEM<PHX::exec_space,double,double>); RCP<Intrepid2::Basis<PHX::exec_space,double,double> > basisC = rcp(new Intrepid2::Basis_HGRAD_TRI_C2_FEM<PHX::exec_space,double,double>); // used further down RCP<const FieldPattern> patternA = rcp(new Intrepid2FieldPattern(basisA)); RCP<const FieldPattern> patternB = rcp(new Intrepid2FieldPattern(basisB)); RCP<const FieldPattern> patternC = rcp(new Intrepid2FieldPattern(basisC)); // used further down TEST_EQUALITY(patternA->numberIds(),3); TEST_EQUALITY(patternB->numberIds(),3); std::vector<std::pair<int,int> > topEdgeIndices; orientation_helpers::computePatternEdgeIndices(*patternA,topEdgeIndices); TEST_EQUALITY(topEdgeIndices.size(),3); TEST_EQUALITY(topEdgeIndices[0].first,0); TEST_EQUALITY(topEdgeIndices[0].second,1); TEST_EQUALITY(topEdgeIndices[1].first,1); TEST_EQUALITY(topEdgeIndices[1].second,2); TEST_EQUALITY(topEdgeIndices[2].first,2); TEST_EQUALITY(topEdgeIndices[2].second,0); std::vector<std::vector<long> > connectivity(4); connectivity[0].resize(patternA->numberIds()); connectivity[1].resize(patternA->numberIds()); connectivity[2].resize(patternA->numberIds()); connectivity[3].resize(patternA->numberIds()); // Topologocally the four elements look like: // // 3-----1 // |\ /| // | \ / | // | 6 | // | / \ | // |/ \| // 5-----0 // // all that matters is the global // node numbering and the local ordering // The local ordering is defined by the following connectivity connectivity[0][0] = 0; connectivity[0][1] = 6; connectivity[0][2] = 5; connectivity[1][0] = 6; connectivity[1][1] = 0; connectivity[1][2] = 1; connectivity[2][0] = 1; connectivity[2][1] = 3; connectivity[2][2] = 6; connectivity[3][0] = 3; connectivity[3][1] = 5; connectivity[3][2] = 6; // LOCAL element orientations are always set so that they flow in the positive // direction along an edge from node 0 to node 1. As a result if the GID of // node 0 is larger then node 1 then the GLOBAL orientation is -1 (and positive // otherwise. The local definition of the edge direction is defined by // the shards cell topology. { std::vector<char> orientations(patternB->numberIds(),0); orientation_helpers::computeCellEdgeOrientations(topEdgeIndices, connectivity[0], *patternB, orientations); TEST_EQUALITY(orientations[0],char(1)); TEST_EQUALITY(orientations[1],char(-1)); TEST_EQUALITY(orientations[2],char(-1)); } { std::vector<char> orientations(patternB->numberIds(),0); orientation_helpers::computeCellEdgeOrientations(topEdgeIndices, connectivity[1], *patternB, orientations); TEST_EQUALITY(orientations[0],char(-1)); TEST_EQUALITY(orientations[1],char(1)); TEST_EQUALITY(orientations[2],char(1)); } { std::vector<char> orientations(patternB->numberIds(),0); orientation_helpers::computeCellEdgeOrientations(topEdgeIndices, connectivity[2], *patternB, orientations); TEST_EQUALITY(orientations[0],char(1)); TEST_EQUALITY(orientations[1],char(1)); TEST_EQUALITY(orientations[2],char(-1)); } { std::vector<char> orientations(patternB->numberIds(),0); orientation_helpers::computeCellEdgeOrientations(topEdgeIndices, connectivity[3], *patternB, orientations); TEST_EQUALITY(orientations[0],char(1)); TEST_EQUALITY(orientations[1],char(1)); TEST_EQUALITY(orientations[2],char(-1)); } // lets now test an aggregate basis std::vector<std::pair<int,Teuchos::RCP<const FieldPattern> > > patterns; patterns.push_back(std::make_pair(0,patternB)); patterns.push_back(std::make_pair(1,patternC)); patterns.push_back(std::make_pair(2,patternA)); Teuchos::RCP<const FieldPattern> aggPattern = Teuchos::rcp(new FieldAggPattern(patterns)); std::vector<char> orientations(aggPattern->numberIds(),0); orientation_helpers::computeCellEdgeOrientations(topEdgeIndices, connectivity[2], *aggPattern, orientations); int nonzeroCount = 0; for(std::size_t s=0;s<orientations.size();s++) nonzeroCount += orientations[s]*orientations[s]; // should be +1 only if it is an edge TEST_EQUALITY(nonzeroCount,6); // loop over edges char tests[] = { 1,1,-1}; // for element 2 for(std::size_t e=0;e<3;e++) { const std::vector<int> & edgeIndices = aggPattern->getSubcellIndices(1,e); for(std::size_t s=0;s<edgeIndices.size();s++) TEST_EQUALITY(orientations[edgeIndices[s]],tests[e]); } }
DTKInterpolationAdapter::DTKInterpolationAdapter(Teuchos::RCP<const Teuchos::MpiComm<int> > in_comm, EquationSystems & in_es, const Point & offset, unsigned int from_dim): comm(in_comm), es(in_es), _offset(offset), mesh(in_es.get_mesh()), dim(mesh.mesh_dimension()) { MPI_Comm old_comm = Moose::swapLibMeshComm(*comm->getRawMpiComm()); std::set<GlobalOrdinal> semi_local_nodes; get_semi_local_nodes(semi_local_nodes); num_local_nodes = semi_local_nodes.size(); vertices.resize(num_local_nodes); Teuchos::ArrayRCP<double> coordinates(num_local_nodes * dim); Teuchos::ArrayRCP<double> target_coordinates(num_local_nodes * from_dim); // Fill in the vertices and coordinates { GlobalOrdinal i = 0; for (std::set<GlobalOrdinal>::iterator it = semi_local_nodes.begin(); it != semi_local_nodes.end(); ++it) { const Node & node = mesh.node(*it); vertices[i] = node.id(); for (GlobalOrdinal j=0; j<dim; j++) coordinates[(j*num_local_nodes) + i] = node(j) + offset(j); for (GlobalOrdinal j=0; j<from_dim; j++) target_coordinates[(j*num_local_nodes) + i] = node(j) + offset(j); i++; } } // Currently assuming all elements are the same! DataTransferKit::DTK_ElementTopology element_topology = get_element_topology(mesh.elem(0)); GlobalOrdinal n_nodes_per_elem = mesh.elem(0)->n_nodes(); GlobalOrdinal n_local_elem = mesh.n_local_elem(); elements.resize(n_local_elem); Teuchos::ArrayRCP<GlobalOrdinal> connectivity(n_nodes_per_elem*n_local_elem); Teuchos::ArrayRCP<double> elem_centroid_coordinates(n_local_elem*from_dim); // Fill in the elements and connectivity { GlobalOrdinal i = 0; MeshBase::const_element_iterator end = mesh.local_elements_end(); for (MeshBase::const_element_iterator it = mesh.local_elements_begin(); it != end; ++it) { const Elem & elem = *(*it); elements[i] = elem.id(); for (GlobalOrdinal j=0; j<n_nodes_per_elem; j++) connectivity[(j*n_local_elem)+i] = elem.node(j); { Point centroid = elem.centroid(); for (GlobalOrdinal j=0; j<from_dim; j++) elem_centroid_coordinates[(j*n_local_elem) + i] = centroid(j) + offset(j); } i++; } } Teuchos::ArrayRCP<int> permutation_list(n_nodes_per_elem); for (GlobalOrdinal i = 0; i < n_nodes_per_elem; ++i ) permutation_list[i] = i; /* Moose::out<<"n_nodes_per_elem: "<<n_nodes_per_elem<<std::endl; Moose::out<<"Dim: "<<dim<<std::endl; Moose::err<<"Vertices size: "<<vertices.size()<<std::endl; { Moose::err<<libMesh::processor_id()<<" Vertices: "; for (unsigned int i=0; i<vertices.size(); i++) Moose::err<<vertices[i]<<" "; Moose::err<<std::endl; } Moose::err<<"Coordinates size: "<<coordinates.size()<<std::endl; { Moose::err<<libMesh::processor_id()<<" Coordinates: "; for (unsigned int i=0; i<coordinates.size(); i++) Moose::err<<coordinates[i]<<" "; Moose::err<<std::endl; } Moose::err<<"Connectivity size: "<<connectivity.size()<<std::endl; { Moose::err<<libMesh::processor_id()<<" Connectivity: "; for (unsigned int i=0; i<connectivity.size(); i++) Moose::err<<connectivity[i]<<" "; Moose::err<<std::endl; } Moose::err<<"Permutation_List size: "<<permutation_list.size()<<std::endl; { Moose::err<<libMesh::processor_id()<<" Permutation_List: "; for (unsigned int i=0; i<permutation_list.size(); i++) Moose::err<<permutation_list[i]<<" "; Moose::err<<std::endl; } */ Teuchos::RCP<MeshContainerType> mesh_container = Teuchos::rcp( new MeshContainerType(dim, vertices, coordinates, element_topology, n_nodes_per_elem, elements, connectivity, permutation_list) ); // We only have 1 element topology in this grid so we make just one mesh block Teuchos::ArrayRCP<Teuchos::RCP<MeshContainerType> > mesh_blocks(1); mesh_blocks[0] = mesh_container; // Create the MeshManager mesh_manager = Teuchos::rcp(new DataTransferKit::MeshManager<MeshContainerType>(mesh_blocks, comm, dim) ); // Pack the coordinates into a field, this will be the positions we'll ask for other systems fields at if (from_dim == dim) target_coords = Teuchos::rcp(new DataTransferKit::FieldManager<MeshContainerType>(mesh_container, comm)); else { Teuchos::ArrayRCP<GlobalOrdinal> empty_elements(0); Teuchos::ArrayRCP<GlobalOrdinal> empty_connectivity(0); Teuchos::RCP<MeshContainerType> coords_only_mesh_container = Teuchos::rcp( new MeshContainerType(from_dim, vertices, target_coordinates, element_topology, n_nodes_per_elem, empty_elements, empty_connectivity, permutation_list) ); target_coords = Teuchos::rcp(new DataTransferKit::FieldManager<MeshContainerType>(coords_only_mesh_container, comm)); } { Teuchos::ArrayRCP<GlobalOrdinal> empty_elements(0); Teuchos::ArrayRCP<GlobalOrdinal> empty_connectivity(0); Teuchos::RCP<MeshContainerType> centroid_coords_only_mesh_container = Teuchos::rcp( new MeshContainerType(from_dim, elements, elem_centroid_coordinates, element_topology, n_nodes_per_elem, empty_elements, empty_connectivity, permutation_list) ); elem_centroid_coords = Teuchos::rcp(new DataTransferKit::FieldManager<MeshContainerType>(centroid_coords_only_mesh_container, comm)); } // Swap back Moose::swapLibMeshComm(old_comm); }
vtkDataArray * avtNodeDegreeExpression::DeriveVariable(vtkDataSet *in_ds) { vtkIdType nPoints = in_ds->GetNumberOfPoints(); // This is our connectivity list. It says that point P is connected to // the points in connectivity[P]. A point is not connected to itself. // Therefore, the degree of that node is connectivity[P].size(). // But first we have to construct the list. std::vector<std::vector<int> > connectivity(nPoints); vtkIdType nCells = in_ds->GetNumberOfCells(); for (vtkIdType i = 0 ; i < nCells ; i++) { vtkCell *cell = in_ds->GetCell(i); vtkIdType numPointsForThisCell = cell->GetNumberOfPoints(); for (int localId = 0 ; localId < numPointsForThisCell ; localId++) { vtkIdType id = cell->GetPointId(localId); // Most nodes have 3 adjacent nodes in that cell. // One pryamid node has 4, and is treated as a special case. // But we will store in adj[] the global ID of the points // that this point is adjacent to. int adj[4], nadj = 3; switch (cell->GetCellType()) { case VTK_TETRA: switch (localId) { // Example reading: // This first line says that // CellLocalPointId 0 is adjacent to // CellLocalPointIds 1,2 and 3. Please find what those // point's global IDs are, and store them in adj[]. case 0: GlobalPointAssign(cell,adj,1,2,3); break; case 1: GlobalPointAssign(cell,adj,0,2,3); break; case 2: GlobalPointAssign(cell,adj,0,1,3); break; case 3: GlobalPointAssign(cell,adj,0,1,2); break; } break; case VTK_HEXAHEDRON: switch (localId) { case 0: GlobalPointAssign(cell,adj,1,3,4); break; case 1: GlobalPointAssign(cell,adj,0,2,5); break; case 2: GlobalPointAssign(cell,adj,1,3,6); break; case 3: GlobalPointAssign(cell,adj,0,2,7); break; case 4: GlobalPointAssign(cell,adj,0,5,7); break; case 5: GlobalPointAssign(cell,adj,1,4,6); break; case 6: GlobalPointAssign(cell,adj,2,5,7); break; case 7: GlobalPointAssign(cell,adj,3,4,6); break; } break; case VTK_VOXEL: switch (localId) { case 0: GlobalPointAssign(cell,adj,1,2,4); break; case 1: GlobalPointAssign(cell,adj,0,3,5); break; case 2: GlobalPointAssign(cell,adj,0,3,6); break; case 3: GlobalPointAssign(cell,adj,1,2,7); break; case 4: GlobalPointAssign(cell,adj,0,5,6); break; case 5: GlobalPointAssign(cell,adj,1,4,7); break; case 6: GlobalPointAssign(cell,adj,2,4,7); break; case 7: GlobalPointAssign(cell,adj,3,5,6); break; } break; case VTK_WEDGE: switch (localId) { case 0: GlobalPointAssign(cell,adj,1,2,3); break; case 1: GlobalPointAssign(cell,adj,0,2,4); break; case 2: GlobalPointAssign(cell,adj,0,1,5); break; case 3: GlobalPointAssign(cell,adj,0,4,5); break; case 4: GlobalPointAssign(cell,adj,1,3,5); break; case 5: GlobalPointAssign(cell,adj,2,3,4); break; } break; case VTK_PYRAMID: switch (localId) { case 0: GlobalPointAssign(cell,adj,1,3,4,-1); break; case 1: GlobalPointAssign(cell,adj,0,2,4,-1); break; case 2: GlobalPointAssign(cell,adj,1,3,4,-1); break; case 3: GlobalPointAssign(cell,adj,0,2,4,-1); break; case 4: GlobalPointAssign(cell,adj,0,1,2,3); nadj = 4; break; } break; case VTK_QUAD: nadj = 2; switch (localId) { case 0: GlobalPointAssign2(cell,adj,1,3); break; case 1: GlobalPointAssign2(cell,adj,0,2); break; case 2: GlobalPointAssign2(cell,adj,1,3); break; case 3: GlobalPointAssign2(cell,adj,0,2); break; } break; case VTK_TRIANGLE: nadj = 2; switch (localId) { case 0: GlobalPointAssign2(cell,adj,1,2); break; case 1: GlobalPointAssign2(cell,adj,0,2); break; case 2: GlobalPointAssign2(cell,adj,0,1); break; } break; case VTK_LINE: nadj = 1; switch (localId) { case 0: adj[0] = cell->GetPointId(1); break; case 1: adj[0] = cell->GetPointId(0); break; } break; default: EXCEPTION0(ImproperUseException); } // Now we add to the connectivity list. // Take the three points in adj[] // and if they're not already in the connectivity list, add them. for (int j = 0; j < nadj; j++) { if (VIntFind(connectivity[id],adj[j]) == -1) connectivity[id].push_back(adj[j]); } } } // // Set up a VTK variable reflecting the NodeDegrees we calculated, which // is found by taking the length of the connectivity lists. // vtkIntArray *dv = vtkIntArray::New(); dv->SetNumberOfValues(nPoints); for(vtkIdType i = 0 ; i < nPoints ; i++) { dv->SetValue(i, connectivity[i].size()); } return dv; }